From 9edf3849f9b023b924f8127434e7226070d1c5d0 Mon Sep 17 00:00:00 2001 From: ArduinoBot Date: Tue, 16 Apr 2024 08:18:53 +0000 Subject: [PATCH] Regenerate client from commit 28842c9 of spec repo --- .apigentools-info | 4 +- .openapi-generator/FILES | 4 + api/openapi.yaml | 149 +++++++++++++++++- api_devices_v2_ota.go | 178 ++++++++++++++++++++- docs/ArduinoDevicev2Otaupload.md | 129 ++++++++++++++++ docs/DevicesV2OtaApi.md | 79 +++++++++- docs/Devicev2Otaurlpyalod.md | 108 +++++++++++++ model_arduino_devicev2_otaupload.go | 229 ++++++++++++++++++++++++++++ model_devicev2_otaurlpyalod.go | 201 ++++++++++++++++++++++++ 9 files changed, 1064 insertions(+), 17 deletions(-) create mode 100644 docs/ArduinoDevicev2Otaupload.md create mode 100644 docs/Devicev2Otaurlpyalod.md create mode 100644 model_arduino_devicev2_otaupload.go create mode 100644 model_devicev2_otaurlpyalod.go diff --git a/.apigentools-info b/.apigentools-info index 0ae968c..ea74a62 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,8 +4,8 @@ "spec_versions": { "v2": { "apigentools_version": "1.1.0", - "regenerated": "2024-01-31 14:21:03.657126", - "spec_repo_commit": "138c42b" + "regenerated": "2024-04-16 08:15:00.517940", + "spec_repo_commit": "28842c9" } } } \ No newline at end of file diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 22d4393..181b695 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -24,6 +24,7 @@ docs/ArduinoDashboardv2template.md docs/ArduinoDevicev2.md docs/ArduinoDevicev2Cert.md docs/ArduinoDevicev2EventProperties.md +docs/ArduinoDevicev2Otaupload.md docs/ArduinoDevicev2Pass.md docs/ArduinoDevicev2SimpleProperties.md docs/ArduinoDevicev2StatusEvent.md @@ -79,6 +80,7 @@ docs/DevicesV2TagsApi.md docs/Devicev2.md docs/Devicev2Cert.md docs/Devicev2Otabinaryurl.md +docs/Devicev2Otaurlpyalod.md docs/Devicev2Pass.md docs/HistoricDataRequest.md docs/LoraDevicesV1Api.md @@ -114,6 +116,7 @@ model_arduino_dashboardv2template.go model_arduino_devicev2.go model_arduino_devicev2_cert.go model_arduino_devicev2_event_properties.go +model_arduino_devicev2_otaupload.go model_arduino_devicev2_pass.go model_arduino_devicev2_simple_properties.go model_arduino_devicev2_status_event.go @@ -163,6 +166,7 @@ model_dashboardv2.go model_devicev2.go model_devicev2_cert.go model_devicev2_otabinaryurl.go +model_devicev2_otaurlpyalod.go model_devicev2_pass.go model_error.go model_historic_data_request.go diff --git a/api/openapi.yaml b/api/openapi.yaml index c7a5cb6..5d83a7a 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -1557,6 +1557,101 @@ paths: multipart/form-data: schema: $ref: '#/components/schemas/devices_v2_ota_upload_request' + responses: + "200": + content: + application/vnd.arduino.devicev2.otaupload+json: + schema: + $ref: '#/components/schemas/ArduinoDevicev2Otaupload' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoDevicev2Otaupload' + description: OK + "202": + content: + application/vnd.arduino.devicev2.otaupload+json: + schema: + $ref: '#/components/schemas/ArduinoDevicev2Otaupload' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoDevicev2Otaupload' + description: Accepted + "400": + content: + application/vnd.arduino.devicev2.otaupload+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Bad Request + "401": + description: Unauthorized + "404": + content: + application/vnd.arduino.devicev2.otaupload+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Not Found + "409": + description: Conflict + "410": + content: + application/vnd.arduino.devicev2.otaupload+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Gone + "412": + content: + application/vnd.arduino.devicev2.otaupload+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Precondition Failed + "500": + content: + application/vnd.arduino.devicev2.otaupload+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Internal Server Error + security: + - oauth2: [] + summary: upload devices_v2_ota + tags: + - devices_v2_ota + put: + description: Send a binary url to a device + operationId: devices_v2_ota#send + parameters: + - description: The id of the device + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/devicev2.otabinaryurl' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/devicev2.otabinaryurl' + required: true + x-originalParamName: payload responses: "200": description: OK @@ -1611,12 +1706,13 @@ paths: description: Internal Server Error security: - oauth2: [] - summary: upload devices_v2_ota + summary: send devices_v2_ota tags: - devices_v2_ota - put: - description: Send a binary url to a device - operationId: devices_v2_ota#send + /v2/devices/{id}/ota/url: + post: + description: Generate a url for downloading a binary + operationId: devices_v2_ota#url parameters: - description: The id of the device explode: false @@ -1630,10 +1726,10 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/devicev2.otabinaryurl' + $ref: '#/components/schemas/devicev2.otaurlpyalod' application/x-www-form-urlencoded: schema: - $ref: '#/components/schemas/devicev2.otabinaryurl' + $ref: '#/components/schemas/devicev2.otaurlpyalod' required: true x-originalParamName: payload responses: @@ -1690,7 +1786,7 @@ paths: description: Internal Server Error security: - oauth2: [] - summary: send devices_v2_ota + summary: url devices_v2_ota tags: - devices_v2_ota /v2/devices/{id}/pass: @@ -4052,6 +4148,8 @@ components: description: Accepted BadRequest: description: Bad Request + Conflict: + description: Conflict NotFound: description: Not Found NotImplemented: @@ -4404,6 +4502,27 @@ components: title: "Mediatype identifier: application/vnd.arduino.devicev2.event.properties+json;\ \ view=default" type: object + ArduinoDevicev2Otaupload: + description: ArduinoDevicev2Otaupload media type (default view) + properties: + file_sha: + description: SHA256 of the uploaded file + type: string + ota_id: + description: OTA request id (only available from OTA version 2 and above) + type: string + ota_version: + description: OTA version + format: int64 + type: integer + status: + description: OTA request status (only available from OTA version 2 and above) + type: string + required: + - ota_version + title: "Mediatype identifier: application/vnd.arduino.devicev2.otaupload+json;\ + \ view=default" + type: object ArduinoDevicev2Pass: description: DeviceCertV2 describes a password associated to a device (default view) @@ -6117,6 +6236,22 @@ components: - binary_key title: devicev2.otabinaryurl type: object + devicev2.otaurlpyalod: + properties: + binary_key: + description: The object key of the binary + pattern: "^ota/[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+.ota$" + type: string + sha256: + description: The sha256 of the binary + pattern: "^[a-fA-F0-9]{64}$" + type: string + user_id: + description: The id of the user who is requesting the url + format: uuid + type: string + title: devicev2.otaurlpyalod + type: object devicev2.pass: properties: password: diff --git a/api_devices_v2_ota.go b/api_devices_v2_ota.go index 5c67a58..f200af6 100644 --- a/api_devices_v2_ota.go +++ b/api_devices_v2_ota.go @@ -208,7 +208,7 @@ func (r ApiDevicesV2OtaUploadRequest) ExpireInMins(expireInMins int32) ApiDevice return r } -func (r ApiDevicesV2OtaUploadRequest) Execute() (*http.Response, error) { +func (r ApiDevicesV2OtaUploadRequest) Execute() (*ArduinoDevicev2Otaupload, *http.Response, error) { return r.ApiService.DevicesV2OtaUploadExecute(r) } @@ -230,16 +230,18 @@ func (a *DevicesV2OtaApiService) DevicesV2OtaUpload(ctx context.Context, id stri } // Execute executes the request -func (a *DevicesV2OtaApiService) DevicesV2OtaUploadExecute(r ApiDevicesV2OtaUploadRequest) (*http.Response, error) { +// @return ArduinoDevicev2Otaupload +func (a *DevicesV2OtaApiService) DevicesV2OtaUploadExecute(r ApiDevicesV2OtaUploadRequest) (*ArduinoDevicev2Otaupload, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile + localVarReturnValue *ArduinoDevicev2Otaupload ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesV2OtaApiService.DevicesV2OtaUpload") if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/v2/devices/{id}/ota" @@ -249,7 +251,7 @@ func (a *DevicesV2OtaApiService) DevicesV2OtaUploadExecute(r ApiDevicesV2OtaUplo localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.otaFile == nil { - return nil, reportError("otaFile is required and must be specified") + return localVarReturnValue, nil, reportError("otaFile is required and must be specified") } // to determine the Content-Type header @@ -262,7 +264,7 @@ func (a *DevicesV2OtaApiService) DevicesV2OtaUploadExecute(r ApiDevicesV2OtaUplo } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/vnd.goa.error+json", "text/plain"} + localVarHTTPHeaderAccepts := []string{"application/vnd.arduino.devicev2.otaupload+json", "application/vnd.goa.error+json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -293,6 +295,172 @@ func (a *DevicesV2OtaApiService) DevicesV2OtaUploadExecute(r ApiDevicesV2OtaUplo formFiles = append(formFiles, formFile{fileBytes: otaFileLocalVarFileBytes, fileName: otaFileLocalVarFileName, formFileName: otaFileLocalVarFormFileName}) } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 410 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDevicesV2OtaUrlRequest struct { + ctx context.Context + ApiService *DevicesV2OtaApiService + id string + devicev2Otaurlpyalod *Devicev2Otaurlpyalod +} + +func (r ApiDevicesV2OtaUrlRequest) Devicev2Otaurlpyalod(devicev2Otaurlpyalod Devicev2Otaurlpyalod) ApiDevicesV2OtaUrlRequest { + r.devicev2Otaurlpyalod = &devicev2Otaurlpyalod + return r +} + +func (r ApiDevicesV2OtaUrlRequest) Execute() (*http.Response, error) { + return r.ApiService.DevicesV2OtaUrlExecute(r) +} + +/* +DevicesV2OtaUrl url devices_v2_ota + +Generate a url for downloading a binary + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The id of the device + @return ApiDevicesV2OtaUrlRequest +*/ +func (a *DevicesV2OtaApiService) DevicesV2OtaUrl(ctx context.Context, id string) ApiDevicesV2OtaUrlRequest { + return ApiDevicesV2OtaUrlRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *DevicesV2OtaApiService) DevicesV2OtaUrlExecute(r ApiDevicesV2OtaUrlRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesV2OtaApiService.DevicesV2OtaUrl") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v2/devices/{id}/ota/url" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.devicev2Otaurlpyalod == nil { + return nil, reportError("devicev2Otaurlpyalod is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/vnd.goa.error+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.devicev2Otaurlpyalod + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } diff --git a/docs/ArduinoDevicev2Otaupload.md b/docs/ArduinoDevicev2Otaupload.md new file mode 100644 index 0000000..b958ab4 --- /dev/null +++ b/docs/ArduinoDevicev2Otaupload.md @@ -0,0 +1,129 @@ +# ArduinoDevicev2Otaupload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**FileSha** | Pointer to **string** | SHA256 of the uploaded file | [optional] +**OtaId** | Pointer to **string** | OTA request id (only available from OTA version 2 and above) | [optional] +**OtaVersion** | **int64** | OTA version | +**Status** | Pointer to **string** | OTA request status (only available from OTA version 2 and above) | [optional] + +## Methods + +### NewArduinoDevicev2Otaupload + +`func NewArduinoDevicev2Otaupload(otaVersion int64, ) *ArduinoDevicev2Otaupload` + +NewArduinoDevicev2Otaupload instantiates a new ArduinoDevicev2Otaupload object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewArduinoDevicev2OtauploadWithDefaults + +`func NewArduinoDevicev2OtauploadWithDefaults() *ArduinoDevicev2Otaupload` + +NewArduinoDevicev2OtauploadWithDefaults instantiates a new ArduinoDevicev2Otaupload object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetFileSha + +`func (o *ArduinoDevicev2Otaupload) GetFileSha() string` + +GetFileSha returns the FileSha field if non-nil, zero value otherwise. + +### GetFileShaOk + +`func (o *ArduinoDevicev2Otaupload) GetFileShaOk() (*string, bool)` + +GetFileShaOk returns a tuple with the FileSha field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFileSha + +`func (o *ArduinoDevicev2Otaupload) SetFileSha(v string)` + +SetFileSha sets FileSha field to given value. + +### HasFileSha + +`func (o *ArduinoDevicev2Otaupload) HasFileSha() bool` + +HasFileSha returns a boolean if a field has been set. + +### GetOtaId + +`func (o *ArduinoDevicev2Otaupload) GetOtaId() string` + +GetOtaId returns the OtaId field if non-nil, zero value otherwise. + +### GetOtaIdOk + +`func (o *ArduinoDevicev2Otaupload) GetOtaIdOk() (*string, bool)` + +GetOtaIdOk returns a tuple with the OtaId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOtaId + +`func (o *ArduinoDevicev2Otaupload) SetOtaId(v string)` + +SetOtaId sets OtaId field to given value. + +### HasOtaId + +`func (o *ArduinoDevicev2Otaupload) HasOtaId() bool` + +HasOtaId returns a boolean if a field has been set. + +### GetOtaVersion + +`func (o *ArduinoDevicev2Otaupload) GetOtaVersion() int64` + +GetOtaVersion returns the OtaVersion field if non-nil, zero value otherwise. + +### GetOtaVersionOk + +`func (o *ArduinoDevicev2Otaupload) GetOtaVersionOk() (*int64, bool)` + +GetOtaVersionOk returns a tuple with the OtaVersion field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOtaVersion + +`func (o *ArduinoDevicev2Otaupload) SetOtaVersion(v int64)` + +SetOtaVersion sets OtaVersion field to given value. + + +### GetStatus + +`func (o *ArduinoDevicev2Otaupload) GetStatus() string` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *ArduinoDevicev2Otaupload) GetStatusOk() (*string, bool)` + +GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatus + +`func (o *ArduinoDevicev2Otaupload) SetStatus(v string)` + +SetStatus sets Status field to given value. + +### HasStatus + +`func (o *ArduinoDevicev2Otaupload) HasStatus() bool` + +HasStatus returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/DevicesV2OtaApi.md b/docs/DevicesV2OtaApi.md index 08f74a3..f4e8be5 100644 --- a/docs/DevicesV2OtaApi.md +++ b/docs/DevicesV2OtaApi.md @@ -6,6 +6,7 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**DevicesV2OtaSend**](DevicesV2OtaApi.md#DevicesV2OtaSend) | **Put** /v2/devices/{id}/ota | send devices_v2_ota [**DevicesV2OtaUpload**](DevicesV2OtaApi.md#DevicesV2OtaUpload) | **Post** /v2/devices/{id}/ota | upload devices_v2_ota +[**DevicesV2OtaUrl**](DevicesV2OtaApi.md#DevicesV2OtaUrl) | **Post** /v2/devices/{id}/ota/url | url devices_v2_ota @@ -81,7 +82,7 @@ Name | Type | Description | Notes ## DevicesV2OtaUpload -> DevicesV2OtaUpload(ctx, id).OtaFile(otaFile).Async(async).ExpireInMins(expireInMins).Execute() +> ArduinoDevicev2Otaupload DevicesV2OtaUpload(ctx, id).OtaFile(otaFile).Async(async).ExpireInMins(expireInMins).Execute() upload devices_v2_ota @@ -107,11 +108,13 @@ func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.DevicesV2OtaApi.DevicesV2OtaUpload(context.Background(), id).OtaFile(otaFile).Async(async).ExpireInMins(expireInMins).Execute() + resp, r, err := apiClient.DevicesV2OtaApi.DevicesV2OtaUpload(context.Background(), id).OtaFile(otaFile).Async(async).ExpireInMins(expireInMins).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DevicesV2OtaApi.DevicesV2OtaUpload``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } + // response from `DevicesV2OtaUpload`: ArduinoDevicev2Otaupload + fmt.Fprintf(os.Stdout, "Response from `DevicesV2OtaApi.DevicesV2OtaUpload`: %v\n", resp) } ``` @@ -137,7 +140,7 @@ Name | Type | Description | Notes ### Return type - (empty response body) +[**ArduinoDevicev2Otaupload**](ArduinoDevicev2Otaupload.md) ### Authorization @@ -146,6 +149,76 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: multipart/form-data +- **Accept**: application/vnd.arduino.devicev2.otaupload+json, application/vnd.goa.error+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DevicesV2OtaUrl + +> DevicesV2OtaUrl(ctx, id).Devicev2Otaurlpyalod(devicev2Otaurlpyalod).Execute() + +url devices_v2_ota + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/arduino/iot-client-go" +) + +func main() { + id := "id_example" // string | The id of the device + devicev2Otaurlpyalod := *openapiclient.NewDevicev2Otaurlpyalod() // Devicev2Otaurlpyalod | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.DevicesV2OtaApi.DevicesV2OtaUrl(context.Background(), id).Devicev2Otaurlpyalod(devicev2Otaurlpyalod).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DevicesV2OtaApi.DevicesV2OtaUrl``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | The id of the device | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDevicesV2OtaUrlRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **devicev2Otaurlpyalod** | [**Devicev2Otaurlpyalod**](Devicev2Otaurlpyalod.md) | | + +### Return type + + (empty response body) + +### Authorization + +[oauth2](../README.md#oauth2) + +### HTTP request headers + +- **Content-Type**: application/json, application/x-www-form-urlencoded - **Accept**: application/vnd.goa.error+json, text/plain [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) diff --git a/docs/Devicev2Otaurlpyalod.md b/docs/Devicev2Otaurlpyalod.md new file mode 100644 index 0000000..a230da2 --- /dev/null +++ b/docs/Devicev2Otaurlpyalod.md @@ -0,0 +1,108 @@ +# Devicev2Otaurlpyalod + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**BinaryKey** | Pointer to **string** | The object key of the binary | [optional] +**Sha256** | Pointer to **string** | The sha256 of the binary | [optional] +**UserId** | Pointer to **string** | The id of the user who is requesting the url | [optional] + +## Methods + +### NewDevicev2Otaurlpyalod + +`func NewDevicev2Otaurlpyalod() *Devicev2Otaurlpyalod` + +NewDevicev2Otaurlpyalod instantiates a new Devicev2Otaurlpyalod object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewDevicev2OtaurlpyalodWithDefaults + +`func NewDevicev2OtaurlpyalodWithDefaults() *Devicev2Otaurlpyalod` + +NewDevicev2OtaurlpyalodWithDefaults instantiates a new Devicev2Otaurlpyalod object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetBinaryKey + +`func (o *Devicev2Otaurlpyalod) GetBinaryKey() string` + +GetBinaryKey returns the BinaryKey field if non-nil, zero value otherwise. + +### GetBinaryKeyOk + +`func (o *Devicev2Otaurlpyalod) GetBinaryKeyOk() (*string, bool)` + +GetBinaryKeyOk returns a tuple with the BinaryKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBinaryKey + +`func (o *Devicev2Otaurlpyalod) SetBinaryKey(v string)` + +SetBinaryKey sets BinaryKey field to given value. + +### HasBinaryKey + +`func (o *Devicev2Otaurlpyalod) HasBinaryKey() bool` + +HasBinaryKey returns a boolean if a field has been set. + +### GetSha256 + +`func (o *Devicev2Otaurlpyalod) GetSha256() string` + +GetSha256 returns the Sha256 field if non-nil, zero value otherwise. + +### GetSha256Ok + +`func (o *Devicev2Otaurlpyalod) GetSha256Ok() (*string, bool)` + +GetSha256Ok returns a tuple with the Sha256 field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSha256 + +`func (o *Devicev2Otaurlpyalod) SetSha256(v string)` + +SetSha256 sets Sha256 field to given value. + +### HasSha256 + +`func (o *Devicev2Otaurlpyalod) HasSha256() bool` + +HasSha256 returns a boolean if a field has been set. + +### GetUserId + +`func (o *Devicev2Otaurlpyalod) GetUserId() string` + +GetUserId returns the UserId field if non-nil, zero value otherwise. + +### GetUserIdOk + +`func (o *Devicev2Otaurlpyalod) GetUserIdOk() (*string, bool)` + +GetUserIdOk returns a tuple with the UserId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUserId + +`func (o *Devicev2Otaurlpyalod) SetUserId(v string)` + +SetUserId sets UserId field to given value. + +### HasUserId + +`func (o *Devicev2Otaurlpyalod) HasUserId() bool` + +HasUserId returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/model_arduino_devicev2_otaupload.go b/model_arduino_devicev2_otaupload.go new file mode 100644 index 0000000..933a1c5 --- /dev/null +++ b/model_arduino_devicev2_otaupload.go @@ -0,0 +1,229 @@ +/* +Arduino IoT Cloud API + + Provides a set of endpoints to manage Arduino IoT Cloud **Devices**, **Things**, **Properties** and **Timeseries**. This API can be called just with any HTTP Client, or using one of these clients: * [Javascript NPM package](https://www.npmjs.com/package/@arduino/arduino-iot-client) * [Python PYPI Package](https://pypi.org/project/arduino-iot-client/) * [Golang Module](https://github.com/arduino/iot-client-go) + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iot + +import ( + "encoding/json" +) + +// checks if the ArduinoDevicev2Otaupload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ArduinoDevicev2Otaupload{} + +// ArduinoDevicev2Otaupload ArduinoDevicev2Otaupload media type (default view) +type ArduinoDevicev2Otaupload struct { + // SHA256 of the uploaded file + FileSha *string `json:"file_sha,omitempty"` + // OTA request id (only available from OTA version 2 and above) + OtaId *string `json:"ota_id,omitempty"` + // OTA version + OtaVersion int64 `json:"ota_version"` + // OTA request status (only available from OTA version 2 and above) + Status *string `json:"status,omitempty"` +} + +// NewArduinoDevicev2Otaupload instantiates a new ArduinoDevicev2Otaupload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewArduinoDevicev2Otaupload(otaVersion int64) *ArduinoDevicev2Otaupload { + this := ArduinoDevicev2Otaupload{} + this.OtaVersion = otaVersion + return &this +} + +// NewArduinoDevicev2OtauploadWithDefaults instantiates a new ArduinoDevicev2Otaupload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewArduinoDevicev2OtauploadWithDefaults() *ArduinoDevicev2Otaupload { + this := ArduinoDevicev2Otaupload{} + return &this +} + +// GetFileSha returns the FileSha field value if set, zero value otherwise. +func (o *ArduinoDevicev2Otaupload) GetFileSha() string { + if o == nil || IsNil(o.FileSha) { + var ret string + return ret + } + return *o.FileSha +} + +// GetFileShaOk returns a tuple with the FileSha field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArduinoDevicev2Otaupload) GetFileShaOk() (*string, bool) { + if o == nil || IsNil(o.FileSha) { + return nil, false + } + return o.FileSha, true +} + +// HasFileSha returns a boolean if a field has been set. +func (o *ArduinoDevicev2Otaupload) HasFileSha() bool { + if o != nil && !IsNil(o.FileSha) { + return true + } + + return false +} + +// SetFileSha gets a reference to the given string and assigns it to the FileSha field. +func (o *ArduinoDevicev2Otaupload) SetFileSha(v string) { + o.FileSha = &v +} + +// GetOtaId returns the OtaId field value if set, zero value otherwise. +func (o *ArduinoDevicev2Otaupload) GetOtaId() string { + if o == nil || IsNil(o.OtaId) { + var ret string + return ret + } + return *o.OtaId +} + +// GetOtaIdOk returns a tuple with the OtaId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArduinoDevicev2Otaupload) GetOtaIdOk() (*string, bool) { + if o == nil || IsNil(o.OtaId) { + return nil, false + } + return o.OtaId, true +} + +// HasOtaId returns a boolean if a field has been set. +func (o *ArduinoDevicev2Otaupload) HasOtaId() bool { + if o != nil && !IsNil(o.OtaId) { + return true + } + + return false +} + +// SetOtaId gets a reference to the given string and assigns it to the OtaId field. +func (o *ArduinoDevicev2Otaupload) SetOtaId(v string) { + o.OtaId = &v +} + +// GetOtaVersion returns the OtaVersion field value +func (o *ArduinoDevicev2Otaupload) GetOtaVersion() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.OtaVersion +} + +// GetOtaVersionOk returns a tuple with the OtaVersion field value +// and a boolean to check if the value has been set. +func (o *ArduinoDevicev2Otaupload) GetOtaVersionOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.OtaVersion, true +} + +// SetOtaVersion sets field value +func (o *ArduinoDevicev2Otaupload) SetOtaVersion(v int64) { + o.OtaVersion = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *ArduinoDevicev2Otaupload) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArduinoDevicev2Otaupload) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *ArduinoDevicev2Otaupload) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *ArduinoDevicev2Otaupload) SetStatus(v string) { + o.Status = &v +} + +func (o ArduinoDevicev2Otaupload) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ArduinoDevicev2Otaupload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.FileSha) { + toSerialize["file_sha"] = o.FileSha + } + if !IsNil(o.OtaId) { + toSerialize["ota_id"] = o.OtaId + } + toSerialize["ota_version"] = o.OtaVersion + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + return toSerialize, nil +} + +type NullableArduinoDevicev2Otaupload struct { + value *ArduinoDevicev2Otaupload + isSet bool +} + +func (v NullableArduinoDevicev2Otaupload) Get() *ArduinoDevicev2Otaupload { + return v.value +} + +func (v *NullableArduinoDevicev2Otaupload) Set(val *ArduinoDevicev2Otaupload) { + v.value = val + v.isSet = true +} + +func (v NullableArduinoDevicev2Otaupload) IsSet() bool { + return v.isSet +} + +func (v *NullableArduinoDevicev2Otaupload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArduinoDevicev2Otaupload(val *ArduinoDevicev2Otaupload) *NullableArduinoDevicev2Otaupload { + return &NullableArduinoDevicev2Otaupload{value: val, isSet: true} +} + +func (v NullableArduinoDevicev2Otaupload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArduinoDevicev2Otaupload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/model_devicev2_otaurlpyalod.go b/model_devicev2_otaurlpyalod.go new file mode 100644 index 0000000..c4e3775 --- /dev/null +++ b/model_devicev2_otaurlpyalod.go @@ -0,0 +1,201 @@ +/* +Arduino IoT Cloud API + + Provides a set of endpoints to manage Arduino IoT Cloud **Devices**, **Things**, **Properties** and **Timeseries**. This API can be called just with any HTTP Client, or using one of these clients: * [Javascript NPM package](https://www.npmjs.com/package/@arduino/arduino-iot-client) * [Python PYPI Package](https://pypi.org/project/arduino-iot-client/) * [Golang Module](https://github.com/arduino/iot-client-go) + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iot + +import ( + "encoding/json" +) + +// checks if the Devicev2Otaurlpyalod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Devicev2Otaurlpyalod{} + +// Devicev2Otaurlpyalod struct for Devicev2Otaurlpyalod +type Devicev2Otaurlpyalod struct { + // The object key of the binary + BinaryKey *string `json:"binary_key,omitempty"` + // The sha256 of the binary + Sha256 *string `json:"sha256,omitempty"` + // The id of the user who is requesting the url + UserId *string `json:"user_id,omitempty"` +} + +// NewDevicev2Otaurlpyalod instantiates a new Devicev2Otaurlpyalod object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDevicev2Otaurlpyalod() *Devicev2Otaurlpyalod { + this := Devicev2Otaurlpyalod{} + return &this +} + +// NewDevicev2OtaurlpyalodWithDefaults instantiates a new Devicev2Otaurlpyalod object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDevicev2OtaurlpyalodWithDefaults() *Devicev2Otaurlpyalod { + this := Devicev2Otaurlpyalod{} + return &this +} + +// GetBinaryKey returns the BinaryKey field value if set, zero value otherwise. +func (o *Devicev2Otaurlpyalod) GetBinaryKey() string { + if o == nil || IsNil(o.BinaryKey) { + var ret string + return ret + } + return *o.BinaryKey +} + +// GetBinaryKeyOk returns a tuple with the BinaryKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Devicev2Otaurlpyalod) GetBinaryKeyOk() (*string, bool) { + if o == nil || IsNil(o.BinaryKey) { + return nil, false + } + return o.BinaryKey, true +} + +// HasBinaryKey returns a boolean if a field has been set. +func (o *Devicev2Otaurlpyalod) HasBinaryKey() bool { + if o != nil && !IsNil(o.BinaryKey) { + return true + } + + return false +} + +// SetBinaryKey gets a reference to the given string and assigns it to the BinaryKey field. +func (o *Devicev2Otaurlpyalod) SetBinaryKey(v string) { + o.BinaryKey = &v +} + +// GetSha256 returns the Sha256 field value if set, zero value otherwise. +func (o *Devicev2Otaurlpyalod) GetSha256() string { + if o == nil || IsNil(o.Sha256) { + var ret string + return ret + } + return *o.Sha256 +} + +// GetSha256Ok returns a tuple with the Sha256 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Devicev2Otaurlpyalod) GetSha256Ok() (*string, bool) { + if o == nil || IsNil(o.Sha256) { + return nil, false + } + return o.Sha256, true +} + +// HasSha256 returns a boolean if a field has been set. +func (o *Devicev2Otaurlpyalod) HasSha256() bool { + if o != nil && !IsNil(o.Sha256) { + return true + } + + return false +} + +// SetSha256 gets a reference to the given string and assigns it to the Sha256 field. +func (o *Devicev2Otaurlpyalod) SetSha256(v string) { + o.Sha256 = &v +} + +// GetUserId returns the UserId field value if set, zero value otherwise. +func (o *Devicev2Otaurlpyalod) GetUserId() string { + if o == nil || IsNil(o.UserId) { + var ret string + return ret + } + return *o.UserId +} + +// GetUserIdOk returns a tuple with the UserId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Devicev2Otaurlpyalod) GetUserIdOk() (*string, bool) { + if o == nil || IsNil(o.UserId) { + return nil, false + } + return o.UserId, true +} + +// HasUserId returns a boolean if a field has been set. +func (o *Devicev2Otaurlpyalod) HasUserId() bool { + if o != nil && !IsNil(o.UserId) { + return true + } + + return false +} + +// SetUserId gets a reference to the given string and assigns it to the UserId field. +func (o *Devicev2Otaurlpyalod) SetUserId(v string) { + o.UserId = &v +} + +func (o Devicev2Otaurlpyalod) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Devicev2Otaurlpyalod) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BinaryKey) { + toSerialize["binary_key"] = o.BinaryKey + } + if !IsNil(o.Sha256) { + toSerialize["sha256"] = o.Sha256 + } + if !IsNil(o.UserId) { + toSerialize["user_id"] = o.UserId + } + return toSerialize, nil +} + +type NullableDevicev2Otaurlpyalod struct { + value *Devicev2Otaurlpyalod + isSet bool +} + +func (v NullableDevicev2Otaurlpyalod) Get() *Devicev2Otaurlpyalod { + return v.value +} + +func (v *NullableDevicev2Otaurlpyalod) Set(val *Devicev2Otaurlpyalod) { + v.value = val + v.isSet = true +} + +func (v NullableDevicev2Otaurlpyalod) IsSet() bool { + return v.isSet +} + +func (v *NullableDevicev2Otaurlpyalod) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDevicev2Otaurlpyalod(val *Devicev2Otaurlpyalod) *NullableDevicev2Otaurlpyalod { + return &NullableDevicev2Otaurlpyalod{value: val, isSet: true} +} + +func (v NullableDevicev2Otaurlpyalod) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDevicev2Otaurlpyalod) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +