|
| 1 | +/** |
| 2 | + * Arduino IoT Cloud API |
| 3 | + * 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) |
| 4 | + * |
| 5 | + * The version of the OpenAPI document: 2.0 |
| 6 | + * |
| 7 | + * |
| 8 | + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 9 | + * https://openapi-generator.tech |
| 10 | + * Do not edit the class manually. |
| 11 | + * |
| 12 | + */ |
| 13 | + |
| 14 | + |
| 15 | +import ApiClient from "../ApiClient"; |
| 16 | +import ArduinoTags from '../model/ArduinoTags'; |
| 17 | +import Error from '../model/Error'; |
| 18 | +import Tag from '../model/Tag'; |
| 19 | + |
| 20 | +/** |
| 21 | +* DevicesV2Tags service. |
| 22 | +* @module api/DevicesV2TagsApi |
| 23 | +* @version 1.3.9 |
| 24 | +*/ |
| 25 | +export default class DevicesV2TagsApi { |
| 26 | + |
| 27 | + /** |
| 28 | + * Constructs a new DevicesV2TagsApi. |
| 29 | + * @alias module:api/DevicesV2TagsApi |
| 30 | + * @class |
| 31 | + * @param {module:ApiClient} [apiClient] Optional API client implementation to use, |
| 32 | + * default to {@link module:ApiClient#instance} if unspecified. |
| 33 | + */ |
| 34 | + constructor(apiClient) { |
| 35 | + this.apiClient = apiClient || ApiClient.instance; |
| 36 | + } |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + /** |
| 41 | + * delete devices_v2_tags |
| 42 | + * Delete a tag associated to the device given its key. |
| 43 | + * @param {String} id The id of the device |
| 44 | + * @param {String} key The key of the tag |
| 45 | + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response |
| 46 | + */ |
| 47 | + devicesV2TagsDeleteWithHttpInfo(id, key) { |
| 48 | + let postBody = null; |
| 49 | + // verify the required parameter 'id' is set |
| 50 | + if (id === undefined || id === null) { |
| 51 | + throw new Error("Missing the required parameter 'id' when calling devicesV2TagsDelete"); |
| 52 | + } |
| 53 | + // verify the required parameter 'key' is set |
| 54 | + if (key === undefined || key === null) { |
| 55 | + throw new Error("Missing the required parameter 'key' when calling devicesV2TagsDelete"); |
| 56 | + } |
| 57 | + |
| 58 | + let pathParams = { |
| 59 | + 'id': id, |
| 60 | + 'key': key |
| 61 | + }; |
| 62 | + let queryParams = { |
| 63 | + }; |
| 64 | + let headerParams = { |
| 65 | + }; |
| 66 | + let formParams = { |
| 67 | + }; |
| 68 | + |
| 69 | + let authNames = ['oauth2']; |
| 70 | + let contentTypes = []; |
| 71 | + let accepts = ['application/json']; |
| 72 | + let returnType = null; |
| 73 | + return this.apiClient.callApi( |
| 74 | + '/v2/devices/{id}/tags/{key}', 'DELETE', |
| 75 | + pathParams, queryParams, headerParams, formParams, postBody, |
| 76 | + authNames, contentTypes, accepts, returnType, null |
| 77 | + ); |
| 78 | + } |
| 79 | + |
| 80 | + /** |
| 81 | + * delete devices_v2_tags |
| 82 | + * Delete a tag associated to the device given its key. |
| 83 | + * @param {String} id The id of the device |
| 84 | + * @param {String} key The key of the tag |
| 85 | + * @return {Promise} a {@link https://www.promisejs.org/|Promise} |
| 86 | + */ |
| 87 | + devicesV2TagsDelete(id, key) { |
| 88 | + return this.devicesV2TagsDeleteWithHttpInfo(id, key) |
| 89 | + .then(function(response_and_data) { |
| 90 | + return response_and_data.data; |
| 91 | + }); |
| 92 | + } |
| 93 | + |
| 94 | + |
| 95 | + /** |
| 96 | + * list devices_v2_tags |
| 97 | + * List tags associated to the device. |
| 98 | + * @param {String} id The id of the device |
| 99 | + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoTags} and HTTP response |
| 100 | + */ |
| 101 | + devicesV2TagsListWithHttpInfo(id) { |
| 102 | + let postBody = null; |
| 103 | + // verify the required parameter 'id' is set |
| 104 | + if (id === undefined || id === null) { |
| 105 | + throw new Error("Missing the required parameter 'id' when calling devicesV2TagsList"); |
| 106 | + } |
| 107 | + |
| 108 | + let pathParams = { |
| 109 | + 'id': id |
| 110 | + }; |
| 111 | + let queryParams = { |
| 112 | + }; |
| 113 | + let headerParams = { |
| 114 | + }; |
| 115 | + let formParams = { |
| 116 | + }; |
| 117 | + |
| 118 | + let authNames = ['oauth2']; |
| 119 | + let contentTypes = []; |
| 120 | + let accepts = ['application/json']; |
| 121 | + let returnType = ArduinoTags; |
| 122 | + return this.apiClient.callApi( |
| 123 | + '/v2/devices/{id}/tags', 'GET', |
| 124 | + pathParams, queryParams, headerParams, formParams, postBody, |
| 125 | + authNames, contentTypes, accepts, returnType, null |
| 126 | + ); |
| 127 | + } |
| 128 | + |
| 129 | + /** |
| 130 | + * list devices_v2_tags |
| 131 | + * List tags associated to the device. |
| 132 | + * @param {String} id The id of the device |
| 133 | + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ArduinoTags} |
| 134 | + */ |
| 135 | + devicesV2TagsList(id) { |
| 136 | + return this.devicesV2TagsListWithHttpInfo(id) |
| 137 | + .then(function(response_and_data) { |
| 138 | + return response_and_data.data; |
| 139 | + }); |
| 140 | + } |
| 141 | + |
| 142 | + |
| 143 | + /** |
| 144 | + * upsert devices_v2_tags |
| 145 | + * Creates or updates a tag associated to the device. |
| 146 | + * @param {String} id The id of the device |
| 147 | + * @param {module:model/Tag} tag |
| 148 | + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response |
| 149 | + */ |
| 150 | + devicesV2TagsUpsertWithHttpInfo(id, tag) { |
| 151 | + let postBody = tag; |
| 152 | + // verify the required parameter 'id' is set |
| 153 | + if (id === undefined || id === null) { |
| 154 | + throw new Error("Missing the required parameter 'id' when calling devicesV2TagsUpsert"); |
| 155 | + } |
| 156 | + // verify the required parameter 'tag' is set |
| 157 | + if (tag === undefined || tag === null) { |
| 158 | + throw new Error("Missing the required parameter 'tag' when calling devicesV2TagsUpsert"); |
| 159 | + } |
| 160 | + |
| 161 | + let pathParams = { |
| 162 | + 'id': id |
| 163 | + }; |
| 164 | + let queryParams = { |
| 165 | + }; |
| 166 | + let headerParams = { |
| 167 | + }; |
| 168 | + let formParams = { |
| 169 | + }; |
| 170 | + |
| 171 | + let authNames = ['oauth2']; |
| 172 | + let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; |
| 173 | + let accepts = ['application/json']; |
| 174 | + let returnType = null; |
| 175 | + return this.apiClient.callApi( |
| 176 | + '/v2/devices/{id}/tags', 'PUT', |
| 177 | + pathParams, queryParams, headerParams, formParams, postBody, |
| 178 | + authNames, contentTypes, accepts, returnType, null |
| 179 | + ); |
| 180 | + } |
| 181 | + |
| 182 | + /** |
| 183 | + * upsert devices_v2_tags |
| 184 | + * Creates or updates a tag associated to the device. |
| 185 | + * @param {String} id The id of the device |
| 186 | + * @param {module:model/Tag} tag |
| 187 | + * @return {Promise} a {@link https://www.promisejs.org/|Promise} |
| 188 | + */ |
| 189 | + devicesV2TagsUpsert(id, tag) { |
| 190 | + return this.devicesV2TagsUpsertWithHttpInfo(id, tag) |
| 191 | + .then(function(response_and_data) { |
| 192 | + return response_and_data.data; |
| 193 | + }); |
| 194 | + } |
| 195 | + |
| 196 | + |
| 197 | +} |
0 commit comments