diff --git a/.apigentools-info b/.apigentools-info index de4e0b2..469ec03 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,8 +4,8 @@ "spec_versions": { "v2": { "apigentools_version": "1.1.0", - "regenerated": "2023-01-26 08:22:33.066296", - "spec_repo_commit": "f14e083" + "regenerated": "2023-09-21 07:50:52.826061", + "spec_repo_commit": "3b4cb8a" } } } \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1156ada..6a7d6d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,130 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories node_modules/ -/dist/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* \ No newline at end of file diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 290ea57..088db9d 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,7 +1,11 @@ .babelrc +.gitignore .travis.yml README.md docs/ArduinoCompressedv2.md +docs/ArduinoDashboardowner.md +docs/ArduinoDashboardshare.md +docs/ArduinoDashboardv2.md docs/ArduinoDevicev2.md docs/ArduinoDevicev2Cert.md docs/ArduinoDevicev2EventProperties.md @@ -14,6 +18,10 @@ docs/ArduinoDevicev2propertyvalueValue.md docs/ArduinoDevicev2propertyvalueValueStatistics.md docs/ArduinoDevicev2propertyvalues.md docs/ArduinoDevicev2propertyvaluesLastEvaluatedKey.md +docs/ArduinoLinkedvariable.md +docs/ArduinoLoradevicev1.md +docs/ArduinoLorafreqplansv1.md +docs/ArduinoLorafreqplanv1.md docs/ArduinoProperty.md docs/ArduinoSeriesBatch.md docs/ArduinoSeriesRawBatch.md @@ -21,7 +29,12 @@ docs/ArduinoSeriesRawBatchLastvalue.md docs/ArduinoSeriesRawLastValueResponse.md docs/ArduinoSeriesRawResponse.md docs/ArduinoSeriesResponse.md +docs/ArduinoTags.md docs/ArduinoThing.md +docs/ArduinoTimeseriesmedia.md +docs/ArduinoTimezone.md +docs/ArduinoVariableslinks.md +docs/ArduinoWidgetv2.md docs/BatchLastValueRequestsMediaV1.md docs/BatchQueryRawLastValueRequestMediaV1.md docs/BatchQueryRawRequestMediaV1.md @@ -32,36 +45,61 @@ docs/BatchQueryRequestsMediaV1.md docs/CheckDevicesV2PassPayload.md docs/CreateDevicesV2CertsPayload.md docs/CreateDevicesV2Payload.md -docs/CreateThingsV2Payload.md +docs/CreateLoraDevicesV1Payload.md +docs/DashboardsV2Api.md +docs/Dashboardshare.md +docs/Dashboardv2.md docs/DevicesV2Api.md docs/DevicesV2CertsApi.md +docs/DevicesV2OtaApi.md docs/DevicesV2PassApi.md +docs/DevicesV2TagsApi.md docs/Devicev2.md docs/Devicev2Cert.md +docs/Devicev2Otabinaryurl.md docs/Devicev2Pass.md docs/Error.md +docs/HistoricDataRequest.md +docs/LoraDevicesV1Api.md +docs/LoraFreqPlanV1Api.md docs/PropertiesV2Api.md docs/PropertiesValue.md docs/PropertiesValues.md docs/Property.md docs/PropertyValue.md docs/SeriesV2Api.md -docs/Thing.md +docs/Sharerequest.md +docs/Tag.md +docs/ThingCreate.md docs/ThingSketch.md +docs/ThingUpdate.md docs/ThingsV2Api.md +docs/ThingsV2TagsApi.md +docs/TimeseriesDataPoint.md docs/UpdateSketch.md +docs/Widget.md +docs/Widgetlink.md git_push.sh mocha.opts package.json src/ApiClient.js +src/api/DashboardsV2Api.js src/api/DevicesV2Api.js src/api/DevicesV2CertsApi.js +src/api/DevicesV2OtaApi.js src/api/DevicesV2PassApi.js +src/api/DevicesV2TagsApi.js +src/api/LoraDevicesV1Api.js +src/api/LoraFreqPlanV1Api.js src/api/PropertiesV2Api.js src/api/SeriesV2Api.js src/api/ThingsV2Api.js +src/api/ThingsV2TagsApi.js src/index.js src/model/ArduinoCompressedv2.js +src/model/ArduinoDashboardowner.js +src/model/ArduinoDashboardshare.js +src/model/ArduinoDashboardv2.js src/model/ArduinoDevicev2.js src/model/ArduinoDevicev2Cert.js src/model/ArduinoDevicev2EventProperties.js @@ -74,6 +112,10 @@ src/model/ArduinoDevicev2propertyvalueValue.js src/model/ArduinoDevicev2propertyvalueValueStatistics.js src/model/ArduinoDevicev2propertyvalues.js src/model/ArduinoDevicev2propertyvaluesLastEvaluatedKey.js +src/model/ArduinoLinkedvariable.js +src/model/ArduinoLoradevicev1.js +src/model/ArduinoLorafreqplansv1.js +src/model/ArduinoLorafreqplanv1.js src/model/ArduinoProperty.js src/model/ArduinoSeriesBatch.js src/model/ArduinoSeriesRawBatch.js @@ -81,7 +123,12 @@ src/model/ArduinoSeriesRawBatchLastvalue.js src/model/ArduinoSeriesRawLastValueResponse.js src/model/ArduinoSeriesRawResponse.js src/model/ArduinoSeriesResponse.js +src/model/ArduinoTags.js src/model/ArduinoThing.js +src/model/ArduinoTimeseriesmedia.js +src/model/ArduinoTimezone.js +src/model/ArduinoVariableslinks.js +src/model/ArduinoWidgetv2.js src/model/BatchLastValueRequestsMediaV1.js src/model/BatchQueryRawLastValueRequestMediaV1.js src/model/BatchQueryRawRequestMediaV1.js @@ -92,25 +139,44 @@ src/model/BatchQueryRequestsMediaV1.js src/model/CheckDevicesV2PassPayload.js src/model/CreateDevicesV2CertsPayload.js src/model/CreateDevicesV2Payload.js -src/model/CreateThingsV2Payload.js +src/model/CreateLoraDevicesV1Payload.js +src/model/Dashboardshare.js +src/model/Dashboardv2.js src/model/Devicev2.js src/model/Devicev2Cert.js +src/model/Devicev2Otabinaryurl.js src/model/Devicev2Pass.js src/model/Error.js +src/model/HistoricDataRequest.js src/model/PropertiesValue.js src/model/PropertiesValues.js src/model/Property.js src/model/PropertyValue.js -src/model/Thing.js +src/model/Sharerequest.js +src/model/Tag.js +src/model/ThingCreate.js src/model/ThingSketch.js +src/model/ThingUpdate.js +src/model/TimeseriesDataPoint.js src/model/UpdateSketch.js +src/model/Widget.js +src/model/Widgetlink.js +test/api/DashboardsV2Api.spec.js test/api/DevicesV2Api.spec.js test/api/DevicesV2CertsApi.spec.js +test/api/DevicesV2OtaApi.spec.js test/api/DevicesV2PassApi.spec.js +test/api/DevicesV2TagsApi.spec.js +test/api/LoraDevicesV1Api.spec.js +test/api/LoraFreqPlanV1Api.spec.js test/api/PropertiesV2Api.spec.js test/api/SeriesV2Api.spec.js test/api/ThingsV2Api.spec.js +test/api/ThingsV2TagsApi.spec.js test/model/ArduinoCompressedv2.spec.js +test/model/ArduinoDashboardowner.spec.js +test/model/ArduinoDashboardshare.spec.js +test/model/ArduinoDashboardv2.spec.js test/model/ArduinoDevicev2.spec.js test/model/ArduinoDevicev2Cert.spec.js test/model/ArduinoDevicev2EventProperties.spec.js @@ -123,6 +189,10 @@ test/model/ArduinoDevicev2propertyvalueValue.spec.js test/model/ArduinoDevicev2propertyvalueValueStatistics.spec.js test/model/ArduinoDevicev2propertyvalues.spec.js test/model/ArduinoDevicev2propertyvaluesLastEvaluatedKey.spec.js +test/model/ArduinoLinkedvariable.spec.js +test/model/ArduinoLoradevicev1.spec.js +test/model/ArduinoLorafreqplansv1.spec.js +test/model/ArduinoLorafreqplanv1.spec.js test/model/ArduinoProperty.spec.js test/model/ArduinoSeriesBatch.spec.js test/model/ArduinoSeriesRawBatch.spec.js @@ -130,7 +200,12 @@ test/model/ArduinoSeriesRawBatchLastvalue.spec.js test/model/ArduinoSeriesRawLastValueResponse.spec.js test/model/ArduinoSeriesRawResponse.spec.js test/model/ArduinoSeriesResponse.spec.js +test/model/ArduinoTags.spec.js test/model/ArduinoThing.spec.js +test/model/ArduinoTimeseriesmedia.spec.js +test/model/ArduinoTimezone.spec.js +test/model/ArduinoVariableslinks.spec.js +test/model/ArduinoWidgetv2.spec.js test/model/BatchLastValueRequestsMediaV1.spec.js test/model/BatchQueryRawLastValueRequestMediaV1.spec.js test/model/BatchQueryRawRequestMediaV1.spec.js @@ -141,15 +216,25 @@ test/model/BatchQueryRequestsMediaV1.spec.js test/model/CheckDevicesV2PassPayload.spec.js test/model/CreateDevicesV2CertsPayload.spec.js test/model/CreateDevicesV2Payload.spec.js -test/model/CreateThingsV2Payload.spec.js +test/model/CreateLoraDevicesV1Payload.spec.js +test/model/Dashboardshare.spec.js +test/model/Dashboardv2.spec.js test/model/Devicev2.spec.js test/model/Devicev2Cert.spec.js +test/model/Devicev2Otabinaryurl.spec.js test/model/Devicev2Pass.spec.js test/model/Error.spec.js +test/model/HistoricDataRequest.spec.js test/model/PropertiesValue.spec.js test/model/PropertiesValues.spec.js test/model/Property.spec.js test/model/PropertyValue.spec.js -test/model/Thing.spec.js +test/model/Sharerequest.spec.js +test/model/Tag.spec.js +test/model/ThingCreate.spec.js test/model/ThingSketch.spec.js +test/model/ThingUpdate.spec.js +test/model/TimeseriesDataPoint.spec.js test/model/UpdateSketch.spec.js +test/model/Widget.spec.js +test/model/Widgetlink.spec.js diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index ecedc98..c0be8a7 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -4.3.1 \ No newline at end of file +6.4.0 \ No newline at end of file diff --git a/git_push.sh b/git_push.sh index ced3be2..f53a75d 100644 --- a/git_push.sh +++ b/git_push.sh @@ -1,7 +1,7 @@ #!/bin/sh # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 @@ -38,14 +38,14 @@ git add . git commit -m "$release_note" # Sets the new remote -git_remote=`git remote` +git_remote=$(git remote) if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git fi fi @@ -55,4 +55,3 @@ git pull origin master # Pushes (Forces) the changes in the local repository up to the remote repository echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https' - diff --git a/package.json b/package.json index 9c87a83..dad8d4c 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "@arduino/arduino-iot-client", - "version": "1.4.4", - "description": "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", + "version": "1.5.0", + "description": " 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)", "license": "GPLv3", "main": "dist/index.js", "scripts": { "build": "babel src -d dist", - "prepack": "npm run build", + "prepare": "npm run build", "test": "mocha --require @babel/register --recursive" }, "browser": { @@ -14,7 +14,7 @@ }, "dependencies": { "@babel/cli": "^7.0.0", - "superagent": "3.7.0" + "superagent": "^5.3.0" }, "devDependencies": { "@babel/core": "^7.0.0", @@ -37,7 +37,7 @@ "@babel/preset-env": "^7.0.0", "@babel/register": "^7.0.0", "expect.js": "^0.3.1", - "mocha": "^5.2.0", + "mocha": "^8.0.1", "sinon": "^7.2.0" }, "files": [ diff --git a/src/ApiClient.js b/src/ApiClient.js index 32d08ef..5861053 100644 --- a/src/ApiClient.js +++ b/src/ApiClient.js @@ -17,7 +17,7 @@ import querystring from "querystring"; /** * @module ApiClient -* @version 1.4.4 +* @version 1.5.0 */ /** @@ -28,13 +28,18 @@ import querystring from "querystring"; * @class */ class ApiClient { - constructor() { + /** + * The base URL against which to resolve every API call's (relative) path. + * Overrides the default value set in spec file if present + * @param {String} basePath + */ + constructor(basePath = 'https://api2.arduino.cc/iot') { /** * The base URL against which to resolve every API call's (relative) path. * @type {String} * @default https://api2.arduino.cc/iot */ - this.basePath = 'https://api2.arduino.cc/iot'.replace(/\/+$/, ''); + this.basePath = basePath.replace(/\/+$/, ''); /** * The authentication methods to be included for all API calls. @@ -49,7 +54,9 @@ class ApiClient { * @type {Array.} * @default {} */ - this.defaultHeaders = {}; + this.defaultHeaders = { + 'User-Agent': 'OpenAPI/1.3.5/javascript' + }; /** * The default HTTP timeout for all API calls. @@ -105,10 +112,29 @@ class ApiClient { if (param instanceof Date) { return param.toJSON(); } + if (ApiClient.canBeJsonified(param)) { + return JSON.stringify(param); + } return param.toString(); } + /** + * Returns a boolean indicating if the parameter could be JSON.stringified + * @param param The actual parameter + * @returns {Boolean} Flag indicating if param can be JSON.stringified + */ + static canBeJsonified(str) { + if (typeof str !== 'string' && typeof str !== 'object') return false; + try { + const type = str.toString(); + return type === '[object Object]' + || type === '[object Array]'; + } catch (err) { + return false; + } + }; + /** * Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values. * NOTE: query parameters are not handled here. @@ -129,7 +155,7 @@ class ApiClient { url = apiBasePath + path; } - url = url.replace(/\{([\w-]+)\}/g, (fullMatch, key) => { + url = url.replace(/\{([\w-\.]+)\}/g, (fullMatch, key) => { var value; if (pathParams.hasOwnProperty(key)) { value = this.paramToString(pathParams[key]); @@ -247,16 +273,18 @@ class ApiClient { } switch (collectionFormat) { case 'csv': - return param.map(this.paramToString).join(','); + return param.map(this.paramToString, this).join(','); case 'ssv': - return param.map(this.paramToString).join(' '); + return param.map(this.paramToString, this).join(' '); case 'tsv': - return param.map(this.paramToString).join('\t'); + return param.map(this.paramToString, this).join('\t'); case 'pipes': - return param.map(this.paramToString).join('|'); + return param.map(this.paramToString, this).join('|'); case 'multi': //return the array directly as SuperAgent will handle it as expected - return param.map(this.paramToString); + return param.map(this.paramToString, this); + case 'passthrough': + return param; default: throw new Error('Unknown collection format: ' + collectionFormat); } @@ -279,7 +307,10 @@ class ApiClient { break; case 'bearer': if (auth.accessToken) { - request.set({'Authorization': 'Bearer ' + auth.accessToken}); + var localVarBearerToken = typeof auth.accessToken === 'function' + ? auth.accessToken() + : auth.accessToken + request.set({'Authorization': 'Bearer ' + localVarBearerToken}); } break; @@ -405,11 +436,16 @@ class ApiClient { var _formParams = this.normalizeParams(formParams); for (var key in _formParams) { if (_formParams.hasOwnProperty(key)) { - if (this.isFileParam(_formParams[key])) { + let _formParamsValue = _formParams[key]; + if (this.isFileParam(_formParamsValue)) { // file field - request.attach(key, _formParams[key]); + request.attach(key, _formParamsValue); + } else if (Array.isArray(_formParamsValue) && _formParamsValue.length + && this.isFileParam(_formParamsValue[0])) { + // multiple files + _formParamsValue.forEach(file => request.attach(key, file)); } else { - request.field(key, _formParams[key]); + request.field(key, _formParamsValue); } } } @@ -428,7 +464,7 @@ class ApiClient { if (returnType === 'Blob') { request.responseType('blob'); } else if (returnType === 'String') { - request.responseType('string'); + request.responseType('text'); } // Attach previously saved cookies, if enabled @@ -472,12 +508,15 @@ class ApiClient { } /** - * Parses an ISO-8601 string representation of a date value. + * Parses an ISO-8601 string representation or epoch representation of a date value. * @param {String} str The date value as a string. * @returns {Date} The parsed date object. */ static parseDate(str) { - return new Date(str); + if (isNaN(str)) { + return new Date(str.replace(/(\d)(T)(\d)/i, '$1 $3')); + } + return new Date(+str); } /** diff --git a/src/api/DashboardsV2Api.js b/src/api/DashboardsV2Api.js index e54c541..3d6c6fa 100644 --- a/src/api/DashboardsV2Api.js +++ b/src/api/DashboardsV2Api.js @@ -25,7 +25,7 @@ import Widgetlink from '../model/Widgetlink'; /** * DashboardsV2 service. * @module api/DashboardsV2Api -* @version 1.4.4 +* @version 1.5.0 */ export default class DashboardsV2Api { @@ -47,7 +47,7 @@ export default class DashboardsV2Api { * Create a new dashboard * @param {module:model/Dashboardv2} dashboardv2 DashboardV2Payload describes a dashboard * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoDashboardv2} and HTTP response */ dashboardsV2CreateWithHttpInfo(dashboardv2, opts) { @@ -68,9 +68,9 @@ export default class DashboardsV2Api { let formParams = { }; - let authNames = []; + let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.dashboardv2+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDashboardv2; return this.apiClient.callApi( '/v2/dashboards', 'POST', @@ -100,7 +100,7 @@ export default class DashboardsV2Api { * Delete a dashboard * @param {String} id The id of the dashboard * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ dashboardsV2DeleteWithHttpInfo(id, opts) { @@ -122,9 +122,9 @@ export default class DashboardsV2Api { let formParams = { }; - let authNames = []; + let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/dashboards/{id}', 'DELETE', @@ -155,7 +155,7 @@ export default class DashboardsV2Api { * @param {String} id The id of the dashboard * @param {String} userId The id of the user * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ dashboardsV2DeleteShareWithHttpInfo(id, userId, opts) { @@ -182,9 +182,9 @@ export default class DashboardsV2Api { let formParams = { }; - let authNames = []; + let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/dashboards/{id}/shares/{user_id}', 'DELETE', @@ -217,7 +217,7 @@ export default class DashboardsV2Api { * @param {String} widgetId The id of the widget * @param {module:model/Widgetlink} widgetlink * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoVariableslinks} and HTTP response */ dashboardsV2LinkWithHttpInfo(id, widgetId, widgetlink, opts) { @@ -248,9 +248,9 @@ export default class DashboardsV2Api { let formParams = { }; - let authNames = []; + let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.variableslinks+json', 'application/vnd.goa.error+json']; let returnType = ArduinoVariableslinks; return this.apiClient.callApi( '/v2/dashboards/{id}/widgets/{widgetId}/variables', 'PUT', @@ -281,9 +281,9 @@ export default class DashboardsV2Api { * list dashboards_v2 * Returns the list of dashboards * @param {Object} opts Optional parameters - * @param {String} opts.name The name of the dashboard - * @param {String} opts.userId The user_id of the dashboard's owner - * @param {String} opts.xOrganization + * @param {String} [name] The name of the dashboard + * @param {String} [userId] The user_id of the dashboard's owner + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.} and HTTP response */ dashboardsV2ListWithHttpInfo(opts) { @@ -302,9 +302,9 @@ export default class DashboardsV2Api { let formParams = { }; - let authNames = []; + let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.dashboardv2+json; type=collection', 'application/vnd.goa.error+json']; let returnType = [ArduinoDashboardv2]; return this.apiClient.callApi( '/v2/dashboards', 'GET', @@ -335,7 +335,7 @@ export default class DashboardsV2Api { * List of users the dashboard has been shared with * @param {String} id The id of the dashboard * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.} and HTTP response */ dashboardsV2ListSharesWithHttpInfo(id, opts) { @@ -357,9 +357,9 @@ export default class DashboardsV2Api { let formParams = { }; - let authNames = []; + let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.dashboardshare+json; type=collection', 'application/vnd.goa.error+json']; let returnType = [ArduinoDashboardshare]; return this.apiClient.callApi( '/v2/dashboards/{id}/shares', 'GET', @@ -390,7 +390,7 @@ export default class DashboardsV2Api { * @param {String} id The id of the dashboard * @param {module:model/Sharerequest} sharerequest * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ dashboardsV2RequestAccessWithHttpInfo(id, sharerequest, opts) { @@ -416,9 +416,9 @@ export default class DashboardsV2Api { let formParams = { }; - let authNames = []; + let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/dashboards/{id}/share_request', 'PUT', @@ -450,7 +450,7 @@ export default class DashboardsV2Api { * @param {String} id The id of the dashboard * @param {module:model/Dashboardshare} dashboardshare * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ dashboardsV2ShareWithHttpInfo(id, dashboardshare, opts) { @@ -476,9 +476,9 @@ export default class DashboardsV2Api { let formParams = { }; - let authNames = []; + let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/dashboards/{id}/shares', 'PUT', @@ -509,7 +509,7 @@ export default class DashboardsV2Api { * Show a dashboard * @param {String} id The id of the dashboard * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoDashboardv2} and HTTP response */ dashboardsV2ShowWithHttpInfo(id, opts) { @@ -531,9 +531,9 @@ export default class DashboardsV2Api { let formParams = { }; - let authNames = []; + let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.dashboardv2+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDashboardv2; return this.apiClient.callApi( '/v2/dashboards/{id}', 'GET', @@ -564,7 +564,7 @@ export default class DashboardsV2Api { * @param {String} id The id of the dashboard * @param {module:model/Dashboardv2} dashboardv2 DashboardV2Payload describes a dashboard * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoDashboardv2} and HTTP response */ dashboardsV2UpdateWithHttpInfo(id, dashboardv2, opts) { @@ -590,9 +590,9 @@ export default class DashboardsV2Api { let formParams = { }; - let authNames = []; + let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.dashboardv2+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDashboardv2; return this.apiClient.callApi( '/v2/dashboards/{id}', 'PUT', diff --git a/src/api/DevicesV2Api.js b/src/api/DevicesV2Api.js index 2390e71..8379b61 100644 --- a/src/api/DevicesV2Api.js +++ b/src/api/DevicesV2Api.js @@ -25,7 +25,7 @@ import PropertiesValues from '../model/PropertiesValues'; /** * DevicesV2 service. * @module api/DevicesV2Api -* @version 1.4.4 +* @version 1.5.0 */ export default class DevicesV2Api { @@ -47,7 +47,7 @@ export default class DevicesV2Api { * Creates a new device associated to the user. * @param {module:model/CreateDevicesV2Payload} createDevicesV2Payload DeviceV2 describes a device. * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoDevicev2} and HTTP response */ devicesV2CreateWithHttpInfo(createDevicesV2Payload, opts) { @@ -70,7 +70,7 @@ export default class DevicesV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.devicev2+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDevicev2; return this.apiClient.callApi( '/v2/devices', 'PUT', @@ -100,7 +100,7 @@ export default class DevicesV2Api { * Removes a device associated to the user * @param {String} id The id of the device * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ devicesV2DeleteWithHttpInfo(id, opts) { @@ -124,7 +124,7 @@ export default class DevicesV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/devices/{id}', 'DELETE', @@ -154,9 +154,9 @@ export default class DevicesV2Api { * GET device events * @param {String} id The id of the device * @param {Object} opts Optional parameters - * @param {Number} opts.limit The number of events to select - * @param {String} opts.start The time at which to start selecting events - * @param {String} opts.xOrganization + * @param {Number} [limit] The number of events to select + * @param {String} [start] The time at which to start selecting events + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoDevicev2EventProperties} and HTTP response */ devicesV2GetEventsWithHttpInfo(id, opts) { @@ -182,7 +182,7 @@ export default class DevicesV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.devicev2.event.properties+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDevicev2EventProperties; return this.apiClient.callApi( '/v2/devices/{id}/events', 'GET', @@ -214,8 +214,8 @@ export default class DevicesV2Api { * GET device properties * @param {String} id The id of the device * @param {Object} opts Optional parameters - * @param {Boolean} opts.showDeleted If true, shows the soft deleted properties (default to false) - * @param {String} opts.xOrganization + * @param {Boolean} [showDeleted = false)] If true, shows the soft deleted properties + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoDevicev2properties} and HTTP response */ devicesV2GetPropertiesWithHttpInfo(id, opts) { @@ -240,7 +240,7 @@ export default class DevicesV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.devicev2properties+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDevicev2properties; return this.apiClient.callApi( '/v2/devices/{id}/properties', 'GET', @@ -270,10 +270,10 @@ export default class DevicesV2Api { * list devices_v2 * Returns the list of devices associated to the user * @param {Object} opts Optional parameters - * @param {Boolean} opts.acrossUserIds If true, returns all the devices (default to false) - * @param {String} opts.serial Filter by device serial number - * @param {Array.} opts.tags Filter by tags - * @param {String} opts.xOrganization + * @param {Boolean} [acrossUserIds = false)] If true, returns all the devices + * @param {String} [serial] Filter by device serial number + * @param {Array.} [tags] Filter by tags + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.} and HTTP response */ devicesV2ListWithHttpInfo(opts) { @@ -295,7 +295,7 @@ export default class DevicesV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.devicev2+json; type=collection', 'application/vnd.goa.error+json']; let returnType = [ArduinoDevicev2]; return this.apiClient.callApi( '/v2/devices', 'GET', @@ -327,7 +327,7 @@ export default class DevicesV2Api { * Returns the device requested by the user * @param {String} id The id of the device * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoDevicev2} and HTTP response */ devicesV2ShowWithHttpInfo(id, opts) { @@ -351,7 +351,7 @@ export default class DevicesV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.devicev2+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDevicev2; return this.apiClient.callApi( '/v2/devices/{id}', 'GET', @@ -382,9 +382,9 @@ export default class DevicesV2Api { * @param {String} id The id of the device * @param {String} pid The id of the property * @param {Object} opts Optional parameters - * @param {Number} opts.limit The number of properties to select - * @param {String} opts.start The time at which to start selecting properties - * @param {String} opts.xOrganization + * @param {Number} [limit] The number of properties to select + * @param {String} [start] The time at which to start selecting properties + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoDevicev2propertyvalues} and HTTP response */ devicesV2TimeseriesWithHttpInfo(id, pid, opts) { @@ -415,7 +415,7 @@ export default class DevicesV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.devicev2propertyvalues+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDevicev2propertyvalues; return this.apiClient.callApi( '/v2/devices/{id}/properties/{pid}', 'GET', @@ -449,7 +449,7 @@ export default class DevicesV2Api { * @param {String} id The id of the device * @param {module:model/Devicev2} devicev2 DeviceV2 describes a device. * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoDevicev2} and HTTP response */ devicesV2UpdateWithHttpInfo(id, devicev2, opts) { @@ -477,7 +477,7 @@ export default class DevicesV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.devicev2+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDevicev2; return this.apiClient.callApi( '/v2/devices/{id}', 'POST', @@ -509,7 +509,7 @@ export default class DevicesV2Api { * @param {String} id The id of the device * @param {module:model/PropertiesValues} propertiesValues * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ devicesV2UpdatePropertiesWithHttpInfo(id, propertiesValues, opts) { @@ -537,7 +537,7 @@ export default class DevicesV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/devices/{id}/properties', 'PUT', diff --git a/src/api/DevicesV2CertsApi.js b/src/api/DevicesV2CertsApi.js index ac14864..d8b74d2 100644 --- a/src/api/DevicesV2CertsApi.js +++ b/src/api/DevicesV2CertsApi.js @@ -21,7 +21,7 @@ import Error from '../model/Error'; /** * DevicesV2Certs service. * @module api/DevicesV2CertsApi -* @version 1.4.4 +* @version 1.5.0 */ export default class DevicesV2CertsApi { @@ -68,7 +68,7 @@ export default class DevicesV2CertsApi { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.devicev2.cert+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDevicev2Cert; return this.apiClient.callApi( '/v2/devices/{id}/certs', 'PUT', @@ -123,7 +123,7 @@ export default class DevicesV2CertsApi { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/devices/{id}/certs/{cid}', 'DELETE', @@ -172,7 +172,7 @@ export default class DevicesV2CertsApi { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.devicev2.cert+json; type=collection', 'application/vnd.goa.error+json']; let returnType = [ArduinoDevicev2Cert]; return this.apiClient.callApi( '/v2/devices/{id}/certs', 'GET', @@ -226,7 +226,7 @@ export default class DevicesV2CertsApi { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.devicev2.cert+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDevicev2Cert; return this.apiClient.callApi( '/v2/devices/{id}/certs/{cid}', 'GET', @@ -286,7 +286,7 @@ export default class DevicesV2CertsApi { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.devicev2.cert+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDevicev2Cert; return this.apiClient.callApi( '/v2/devices/{id}/certs/{cid}', 'POST', diff --git a/src/api/DevicesV2OtaApi.js b/src/api/DevicesV2OtaApi.js index d10b2c1..538e129 100644 --- a/src/api/DevicesV2OtaApi.js +++ b/src/api/DevicesV2OtaApi.js @@ -19,7 +19,7 @@ import Error from '../model/Error'; /** * DevicesV2Ota service. * @module api/DevicesV2OtaApi -* @version 1.4.4 +* @version 1.5.0 */ export default class DevicesV2OtaApi { @@ -66,7 +66,7 @@ export default class DevicesV2OtaApi { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/devices/{id}/ota', 'PUT', @@ -96,8 +96,8 @@ export default class DevicesV2OtaApi { * @param {String} id The id of the device * @param {File} otaFile OTA file * @param {Object} opts Optional parameters - * @param {Boolean} opts.async If false, wait for the full OTA process, until it gets a result from the device (default to true) - * @param {Number} opts.expireInMins Binary expire time in minutes, default 10 mins (default to 10) + * @param {Boolean} [async = true)] If false, wait for the full OTA process, until it gets a result from the device + * @param {Number} [expireInMins = 10)] Binary expire time in minutes, default 10 mins * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ devicesV2OtaUploadWithHttpInfo(id, otaFile, opts) { @@ -127,7 +127,7 @@ export default class DevicesV2OtaApi { let authNames = ['oauth2']; let contentTypes = ['multipart/form-data']; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/devices/{id}/ota', 'POST', diff --git a/src/api/DevicesV2PassApi.js b/src/api/DevicesV2PassApi.js index a19e5ab..82a0a81 100644 --- a/src/api/DevicesV2PassApi.js +++ b/src/api/DevicesV2PassApi.js @@ -21,7 +21,7 @@ import Error from '../model/Error'; /** * DevicesV2Pass service. * @module api/DevicesV2PassApi -* @version 1.4.4 +* @version 1.5.0 */ export default class DevicesV2PassApi { @@ -68,7 +68,7 @@ export default class DevicesV2PassApi { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/devices/{id}/pass', 'POST', @@ -117,7 +117,7 @@ export default class DevicesV2PassApi { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/devices/{id}/pass', 'DELETE', @@ -145,7 +145,7 @@ export default class DevicesV2PassApi { * Returns whether the password for this device is set or not. It doesn't return the password. * @param {String} id The id of the device * @param {Object} opts Optional parameters - * @param {Boolean} opts.suggestedPassword If true, return a suggested password (default to false) + * @param {Boolean} [suggestedPassword = false)] If true, return a suggested password * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoDevicev2Pass} and HTTP response */ devicesV2PassGetWithHttpInfo(id, opts) { @@ -169,7 +169,7 @@ export default class DevicesV2PassApi { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.devicev2.pass+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDevicev2Pass; return this.apiClient.callApi( '/v2/devices/{id}/pass', 'GET', @@ -224,7 +224,7 @@ export default class DevicesV2PassApi { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.devicev2.pass+json', 'application/vnd.goa.error+json']; let returnType = ArduinoDevicev2Pass; return this.apiClient.callApi( '/v2/devices/{id}/pass', 'PUT', diff --git a/src/api/DevicesV2TagsApi.js b/src/api/DevicesV2TagsApi.js index d912e24..6838720 100644 --- a/src/api/DevicesV2TagsApi.js +++ b/src/api/DevicesV2TagsApi.js @@ -20,7 +20,7 @@ import Tag from '../model/Tag'; /** * DevicesV2Tags service. * @module api/DevicesV2TagsApi -* @version 1.4.4 +* @version 1.5.0 */ export default class DevicesV2TagsApi { @@ -68,7 +68,7 @@ export default class DevicesV2TagsApi { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/devices/{id}/tags/{key}', 'DELETE', @@ -117,7 +117,7 @@ export default class DevicesV2TagsApi { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.tags+json', 'application/vnd.goa.error+json']; let returnType = ArduinoTags; return this.apiClient.callApi( '/v2/devices/{id}/tags', 'GET', @@ -170,7 +170,7 @@ export default class DevicesV2TagsApi { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/devices/{id}/tags', 'PUT', diff --git a/src/api/LoraDevicesV1Api.js b/src/api/LoraDevicesV1Api.js index 10bcb21..d9d5504 100644 --- a/src/api/LoraDevicesV1Api.js +++ b/src/api/LoraDevicesV1Api.js @@ -19,7 +19,7 @@ import CreateLoraDevicesV1Payload from '../model/CreateLoraDevicesV1Payload'; /** * LoraDevicesV1 service. * @module api/LoraDevicesV1Api -* @version 1.4.4 +* @version 1.5.0 */ export default class LoraDevicesV1Api { @@ -41,7 +41,7 @@ export default class LoraDevicesV1Api { * Create a new lora device. Its info are saved on our database, and on the lora provider network. Creates a device_v2 automatically * @param {module:model/CreateLoraDevicesV1Payload} createLoraDevicesV1Payload * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoLoradevicev1} and HTTP response */ loraDevicesV1CreateWithHttpInfo(createLoraDevicesV1Payload, opts) { @@ -64,7 +64,7 @@ export default class LoraDevicesV1Api { let authNames = []; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.loradevicev1+json']; let returnType = ArduinoLoradevicev1; return this.apiClient.callApi( '/v1/lora-devices/', 'PUT', diff --git a/src/api/LoraFreqPlanV1Api.js b/src/api/LoraFreqPlanV1Api.js index c3b1372..e4fd1fe 100644 --- a/src/api/LoraFreqPlanV1Api.js +++ b/src/api/LoraFreqPlanV1Api.js @@ -19,7 +19,7 @@ import Error from '../model/Error'; /** * LoraFreqPlanV1 service. * @module api/LoraFreqPlanV1Api -* @version 1.4.4 +* @version 1.5.0 */ export default class LoraFreqPlanV1Api { @@ -55,7 +55,7 @@ export default class LoraFreqPlanV1Api { let authNames = []; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.lorafreqplansv1+json', 'application/vnd.goa.error+json']; let returnType = ArduinoLorafreqplansv1; return this.apiClient.callApi( '/v1/lora-freq-plans/', 'GET', diff --git a/src/api/PropertiesV2Api.js b/src/api/PropertiesV2Api.js index af13674..ce444a9 100644 --- a/src/api/PropertiesV2Api.js +++ b/src/api/PropertiesV2Api.js @@ -22,7 +22,7 @@ import PropertyValue from '../model/PropertyValue'; /** * PropertiesV2 service. * @module api/PropertiesV2Api -* @version 1.4.4 +* @version 1.5.0 */ export default class PropertiesV2Api { @@ -69,7 +69,7 @@ export default class PropertiesV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.property+json', 'application/vnd.goa.error+json']; let returnType = ArduinoProperty; return this.apiClient.callApi( '/v2/things/{id}/properties', 'PUT', @@ -99,7 +99,7 @@ export default class PropertiesV2Api { * @param {String} id The id of the thing * @param {String} pid The id of the property * @param {Object} opts Optional parameters - * @param {Boolean} opts.force If true, hard delete the property (default to false) + * @param {Boolean} [force = false)] If true, hard delete the property * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ propertiesV2DeleteWithHttpInfo(id, pid, opts) { @@ -128,7 +128,7 @@ export default class PropertiesV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/things/{id}/properties/{pid}', 'DELETE', @@ -159,7 +159,7 @@ export default class PropertiesV2Api { * Returns the list of properties associated to the thing * @param {String} id The id of the thing * @param {Object} opts Optional parameters - * @param {Boolean} opts.showDeleted If true, shows the soft deleted properties (default to false) + * @param {Boolean} [showDeleted = false)] If true, shows the soft deleted properties * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.} and HTTP response */ propertiesV2ListWithHttpInfo(id, opts) { @@ -183,7 +183,7 @@ export default class PropertiesV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.property+json; type=collection', 'application/vnd.goa.error+json']; let returnType = [ArduinoProperty]; return this.apiClient.callApi( '/v2/things/{id}/properties', 'GET', @@ -244,7 +244,7 @@ export default class PropertiesV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/things/{id}/properties/{pid}/publish', 'PUT', @@ -275,7 +275,7 @@ export default class PropertiesV2Api { * @param {String} id The id of the thing * @param {String} pid The id of the property * @param {Object} opts Optional parameters - * @param {Boolean} opts.showDeleted If true, shows the soft deleted properties (default to false) + * @param {Boolean} [showDeleted = false)] If true, shows the soft deleted properties * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoProperty} and HTTP response */ propertiesV2ShowWithHttpInfo(id, pid, opts) { @@ -304,7 +304,7 @@ export default class PropertiesV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.property+json', 'application/vnd.goa.error+json']; let returnType = ArduinoProperty; return this.apiClient.callApi( '/v2/things/{id}/properties/{pid}', 'GET', @@ -336,10 +336,10 @@ export default class PropertiesV2Api { * @param {String} id The id of the thing * @param {String} pid ID of a numerical property * @param {Object} opts Optional parameters - * @param {Boolean} opts.desc Whether data's ordering (by time) should be descending (default to false) - * @param {String} opts.from Get data with a timestamp >= to this date (default: 2 weeks ago, min: 1842-01-01T00:00:00Z, max: 2242-01-01T00:00:00Z) - * @param {Number} opts.interval Binning interval in seconds (defaut: the smallest possible value compatibly with the limit of 1000 data points in the response) - * @param {String} opts.to Get data with a timestamp < to this date (default: now, min: 1842-01-01T00:00:00Z, max: 2242-01-01T00:00:00Z) + * @param {Boolean} [desc = false)] Whether data's ordering (by time) should be descending + * @param {String} [from] Get data with a timestamp >= to this date (default: 2 weeks ago, min: 1842-01-01T00:00:00Z, max: 2242-01-01T00:00:00Z) + * @param {Number} [interval] Binning interval in seconds (defaut: the smallest possible value compatibly with the limit of 1000 data points in the response) + * @param {String} [to] Get data with a timestamp < to this date (default: now, min: 1842-01-01T00:00:00Z, max: 2242-01-01T00:00:00Z) * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoTimeseriesmedia} and HTTP response */ propertiesV2TimeseriesWithHttpInfo(id, pid, opts) { @@ -371,7 +371,7 @@ export default class PropertiesV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.timeseriesmedia+json', 'application/vnd.goa.error+json']; let returnType = ArduinoTimeseriesmedia; return this.apiClient.callApi( '/v2/things/{id}/properties/{pid}/timeseries', 'GET', @@ -436,7 +436,7 @@ export default class PropertiesV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.property+json', 'application/vnd.goa.error+json']; let returnType = ArduinoProperty; return this.apiClient.callApi( '/v2/things/{id}/properties/{pid}', 'POST', diff --git a/src/api/SeriesV2Api.js b/src/api/SeriesV2Api.js index 6278549..80e1677 100644 --- a/src/api/SeriesV2Api.js +++ b/src/api/SeriesV2Api.js @@ -25,7 +25,7 @@ import HistoricDataRequest from '../model/HistoricDataRequest'; /** * SeriesV2 service. * @module api/SeriesV2Api -* @version 1.4.4 +* @version 1.5.0 */ export default class SeriesV2Api { @@ -66,7 +66,7 @@ export default class SeriesV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.series.batch+json', 'application/vnd.goa.error+json']; let returnType = ArduinoSeriesBatch; return this.apiClient.callApi( '/v2/series/batch_query', 'POST', @@ -113,7 +113,7 @@ export default class SeriesV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.series.raw.batch+json', 'application/vnd.goa.error+json']; let returnType = ArduinoSeriesRawBatch; return this.apiClient.callApi( '/v2/series/batch_query_raw', 'POST', @@ -160,7 +160,7 @@ export default class SeriesV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.series.raw.batch.lastvalue+json', 'application/vnd.goa.error+json']; let returnType = ArduinoSeriesRawBatchLastvalue; return this.apiClient.callApi( '/v2/series/batch_query_raw/lastvalue', 'POST', @@ -207,7 +207,7 @@ export default class SeriesV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json']; let returnType = null; return this.apiClient.callApi( '/v2/series/historic_data', 'POST', diff --git a/src/api/ThingsV2Api.js b/src/api/ThingsV2Api.js index 5bc3f60..c013312 100644 --- a/src/api/ThingsV2Api.js +++ b/src/api/ThingsV2Api.js @@ -23,7 +23,7 @@ import UpdateSketch from '../model/UpdateSketch'; /** * ThingsV2 service. * @module api/ThingsV2Api -* @version 1.4.4 +* @version 1.5.0 */ export default class ThingsV2Api { @@ -45,8 +45,8 @@ export default class ThingsV2Api { * Creates a new thing associated to the user * @param {module:model/ThingCreate} thingCreate Payload to create a new thing * @param {Object} opts Optional parameters - * @param {Boolean} opts.force If true, detach device from the other thing, and attach to this thing (default to false) - * @param {String} opts.xOrganization + * @param {Boolean} [force = false)] If true, detach device from the other thing, and attach to this thing + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoThing} and HTTP response */ thingsV2CreateWithHttpInfo(thingCreate, opts) { @@ -70,7 +70,7 @@ export default class ThingsV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.thing+json', 'application/vnd.goa.error+json']; let returnType = ArduinoThing; return this.apiClient.callApi( '/v2/things', 'PUT', @@ -102,7 +102,7 @@ export default class ThingsV2Api { * @param {String} id The id of the thing * @param {module:model/ThingSketch} thingSketch ThingSketchPayload describes a sketch of a thing * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoThing} and HTTP response */ thingsV2CreateSketchWithHttpInfo(id, thingSketch, opts) { @@ -130,7 +130,7 @@ export default class ThingsV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.thing+json', 'application/vnd.goa.error+json']; let returnType = ArduinoThing; return this.apiClient.callApi( '/v2/things/{id}/sketch', 'PUT', @@ -161,8 +161,8 @@ export default class ThingsV2Api { * Removes a thing associated to the user * @param {String} id The id of the thing * @param {Object} opts Optional parameters - * @param {Boolean} opts.force If true, hard delete the thing (default to false) - * @param {String} opts.xOrganization + * @param {Boolean} [force = false)] If true, hard delete the thing + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ thingsV2DeleteWithHttpInfo(id, opts) { @@ -187,7 +187,7 @@ export default class ThingsV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/things/{id}', 'DELETE', @@ -217,7 +217,7 @@ export default class ThingsV2Api { * deleteSketch things_v2 * @param {String} id The id of the thing * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoThing} and HTTP response */ thingsV2DeleteSketchWithHttpInfo(id, opts) { @@ -241,7 +241,7 @@ export default class ThingsV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.thing+json', 'application/vnd.goa.error+json']; let returnType = ArduinoThing; return this.apiClient.callApi( '/v2/things/{id}/sketch', 'DELETE', @@ -269,13 +269,13 @@ export default class ThingsV2Api { * list things_v2 * Returns the list of things associated to the user * @param {Object} opts Optional parameters - * @param {Boolean} opts.acrossUserIds If true, returns all the things (default to false) - * @param {String} opts.deviceId The id of the device you want to filter - * @param {Array.} opts.ids Filter only the desired things - * @param {Boolean} opts.showDeleted If true, shows the soft deleted things (default to false) - * @param {Boolean} opts.showProperties If true, returns things with their properties, and last values (default to false) - * @param {Array.} opts.tags Filter by tags - * @param {String} opts.xOrganization + * @param {Boolean} [acrossUserIds = false)] If true, returns all the things + * @param {String} [deviceId] The id of the device you want to filter + * @param {Array.} [ids] Filter only the desired things + * @param {Boolean} [showDeleted = false)] If true, shows the soft deleted things + * @param {Boolean} [showProperties = false)] If true, returns things with their properties, and last values + * @param {Array.} [tags] Filter by tags + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.} and HTTP response */ thingsV2ListWithHttpInfo(opts) { @@ -300,7 +300,7 @@ export default class ThingsV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.thing+json; type=collection', 'application/vnd.goa.error+json']; let returnType = [ArduinoThing]; return this.apiClient.callApi( '/v2/things', 'GET', @@ -335,8 +335,8 @@ export default class ThingsV2Api { * Returns the thing requested by the user * @param {String} id The id of the thing * @param {Object} opts Optional parameters - * @param {Boolean} opts.showDeleted If true, shows the soft deleted thing (default to false) - * @param {String} opts.xOrganization + * @param {Boolean} [showDeleted = false)] If true, shows the soft deleted thing + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoThing} and HTTP response */ thingsV2ShowWithHttpInfo(id, opts) { @@ -361,7 +361,7 @@ export default class ThingsV2Api { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.thing+json', 'application/vnd.goa.error+json']; let returnType = ArduinoThing; return this.apiClient.callApi( '/v2/things/{id}', 'GET', @@ -393,8 +393,8 @@ export default class ThingsV2Api { * @param {String} id The id of the thing * @param {module:model/ThingUpdate} thingUpdate Payload to update an existing thing * @param {Object} opts Optional parameters - * @param {Boolean} opts.force If true, detach device from the other thing, and attach to this thing (default to false) - * @param {String} opts.xOrganization + * @param {Boolean} [force = false)] If true, detach device from the other thing, and attach to this thing + * @param {String} [xOrganization] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoThing} and HTTP response */ thingsV2UpdateWithHttpInfo(id, thingUpdate, opts) { @@ -423,7 +423,7 @@ export default class ThingsV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.thing+json', 'application/vnd.goa.error+json']; let returnType = ArduinoThing; return this.apiClient.callApi( '/v2/things/{id}', 'POST', @@ -456,8 +456,8 @@ export default class ThingsV2Api { * @param {String} id The id of the thing * @param {String} sketchId The id of the sketch * @param {Object} opts Optional parameters - * @param {String} opts.xOrganization - * @param {module:model/UpdateSketch} opts.updateSketch + * @param {String} [xOrganization] + * @param {module:model/UpdateSketch} [updateSketch] * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ArduinoThing} and HTTP response */ thingsV2UpdateSketchWithHttpInfo(id, sketchId, opts) { @@ -486,7 +486,7 @@ export default class ThingsV2Api { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.thing+json', 'application/vnd.goa.error+json']; let returnType = ArduinoThing; return this.apiClient.callApi( '/v2/things/{id}/sketch/{sketchId}', 'PUT', diff --git a/src/api/ThingsV2TagsApi.js b/src/api/ThingsV2TagsApi.js index 0fd7a88..c0b747a 100644 --- a/src/api/ThingsV2TagsApi.js +++ b/src/api/ThingsV2TagsApi.js @@ -20,7 +20,7 @@ import Tag from '../model/Tag'; /** * ThingsV2Tags service. * @module api/ThingsV2TagsApi -* @version 1.4.4 +* @version 1.5.0 */ export default class ThingsV2TagsApi { @@ -68,7 +68,7 @@ export default class ThingsV2TagsApi { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/things/{id}/tags/{key}', 'DELETE', @@ -117,7 +117,7 @@ export default class ThingsV2TagsApi { let authNames = ['oauth2']; let contentTypes = []; - let accepts = ['application/json']; + let accepts = ['application/vnd.arduino.tags+json', 'application/vnd.goa.error+json']; let returnType = ArduinoTags; return this.apiClient.callApi( '/v2/things/{id}/tags', 'GET', @@ -170,7 +170,7 @@ export default class ThingsV2TagsApi { let authNames = ['oauth2']; let contentTypes = ['application/json', 'application/x-www-form-urlencoded']; - let accepts = ['application/json']; + let accepts = ['application/vnd.goa.error+json', 'text/plain']; let returnType = null; return this.apiClient.callApi( '/v2/things/{id}/tags', 'PUT', diff --git a/src/index.js b/src/index.js index 1d1a47b..d95c092 100644 --- a/src/index.js +++ b/src/index.js @@ -65,7 +65,6 @@ import Devicev2Otabinaryurl from './model/Devicev2Otabinaryurl'; import Devicev2Pass from './model/Devicev2Pass'; import Error from './model/Error'; import HistoricDataRequest from './model/HistoricDataRequest'; -import InlineObject from './model/InlineObject'; import PropertiesValue from './model/PropertiesValue'; import PropertiesValues from './model/PropertiesValues'; import Property from './model/Property'; @@ -94,7 +93,7 @@ import ThingsV2TagsApi from './api/ThingsV2TagsApi'; /** -* 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.
+* 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).
* The index module provides access to constructors for all the classes which comprise the public API. *

* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: @@ -122,7 +121,7 @@ import ThingsV2TagsApi from './api/ThingsV2TagsApi'; * *

* @module index -* @version 1.4.4 +* @version 1.5.0 */ export { /** @@ -443,12 +442,6 @@ export { */ HistoricDataRequest, - /** - * The InlineObject model constructor. - * @property {module:model/InlineObject} - */ - InlineObject, - /** * The PropertiesValue model constructor. * @property {module:model/PropertiesValue} diff --git a/src/model/ArduinoCompressedv2.js b/src/model/ArduinoCompressedv2.js index 2b75129..402ec25 100644 --- a/src/model/ArduinoCompressedv2.js +++ b/src/model/ArduinoCompressedv2.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoCompressedv2 model module. * @module model/ArduinoCompressedv2 - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoCompressedv2 { /** @@ -85,9 +85,47 @@ class ArduinoCompressedv2 { return obj; } + /** + * Validates the JSON data with respect to ArduinoCompressedv2. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoCompressedv2. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoCompressedv2.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['authority_key_identifier'] && !(typeof data['authority_key_identifier'] === 'string' || data['authority_key_identifier'] instanceof String)) { + throw new Error("Expected the field `authority_key_identifier` to be a primitive type in the JSON string but got " + data['authority_key_identifier']); + } + // ensure the json data is a string + if (data['serial'] && !(typeof data['serial'] === 'string' || data['serial'] instanceof String)) { + throw new Error("Expected the field `serial` to be a primitive type in the JSON string but got " + data['serial']); + } + // ensure the json data is a string + if (data['signature'] && !(typeof data['signature'] === 'string' || data['signature'] instanceof String)) { + throw new Error("Expected the field `signature` to be a primitive type in the JSON string but got " + data['signature']); + } + // ensure the json data is a string + if (data['signature_asn1_x'] && !(typeof data['signature_asn1_x'] === 'string' || data['signature_asn1_x'] instanceof String)) { + throw new Error("Expected the field `signature_asn1_x` to be a primitive type in the JSON string but got " + data['signature_asn1_x']); + } + // ensure the json data is a string + if (data['signature_asn1_y'] && !(typeof data['signature_asn1_y'] === 'string' || data['signature_asn1_y'] instanceof String)) { + throw new Error("Expected the field `signature_asn1_y` to be a primitive type in the JSON string but got " + data['signature_asn1_y']); + } + + return true; + } + } +ArduinoCompressedv2.RequiredProperties = ["not_after", "not_before", "serial", "signature", "signature_asn1_x", "signature_asn1_y"]; + /** * The Authority Key Identifier of the certificate * @member {String} authority_key_identifier diff --git a/src/model/ArduinoDashboardowner.js b/src/model/ArduinoDashboardowner.js index 3ab9946..a987c7d 100644 --- a/src/model/ArduinoDashboardowner.js +++ b/src/model/ArduinoDashboardowner.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoDashboardowner model module. * @module model/ArduinoDashboardowner - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDashboardowner { /** @@ -60,9 +60,35 @@ class ArduinoDashboardowner { return obj; } + /** + * Validates the JSON data with respect to ArduinoDashboardowner. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDashboardowner. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoDashboardowner.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['user_id'] && !(typeof data['user_id'] === 'string' || data['user_id'] instanceof String)) { + throw new Error("Expected the field `user_id` to be a primitive type in the JSON string but got " + data['user_id']); + } + // ensure the json data is a string + if (data['username'] && !(typeof data['username'] === 'string' || data['username'] instanceof String)) { + throw new Error("Expected the field `username` to be a primitive type in the JSON string but got " + data['username']); + } + + return true; + } + } +ArduinoDashboardowner.RequiredProperties = ["user_id"]; + /** * The userID of the user who created the dashboard * @member {String} user_id diff --git a/src/model/ArduinoDashboardshare.js b/src/model/ArduinoDashboardshare.js index d68e9f7..6f27c00 100644 --- a/src/model/ArduinoDashboardshare.js +++ b/src/model/ArduinoDashboardshare.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoDashboardshare model module. * @module model/ArduinoDashboardshare - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDashboardshare { /** @@ -60,9 +60,35 @@ class ArduinoDashboardshare { return obj; } + /** + * Validates the JSON data with respect to ArduinoDashboardshare. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDashboardshare. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoDashboardshare.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['user_id'] && !(typeof data['user_id'] === 'string' || data['user_id'] instanceof String)) { + throw new Error("Expected the field `user_id` to be a primitive type in the JSON string but got " + data['user_id']); + } + // ensure the json data is a string + if (data['username'] && !(typeof data['username'] === 'string' || data['username'] instanceof String)) { + throw new Error("Expected the field `username` to be a primitive type in the JSON string but got " + data['username']); + } + + return true; + } + } +ArduinoDashboardshare.RequiredProperties = ["user_id"]; + /** * The userID of the user you want to share the dashboard with * @member {String} user_id diff --git a/src/model/ArduinoDashboardv2.js b/src/model/ArduinoDashboardv2.js index 0401e76..416c94b 100644 --- a/src/model/ArduinoDashboardv2.js +++ b/src/model/ArduinoDashboardv2.js @@ -19,7 +19,7 @@ import ArduinoWidgetv2 from './ArduinoWidgetv2'; /** * The ArduinoDashboardv2 model module. * @module model/ArduinoDashboardv2 - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDashboardv2 { /** @@ -85,9 +85,67 @@ class ArduinoDashboardv2 { return obj; } + /** + * Validates the JSON data with respect to ArduinoDashboardv2. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDashboardv2. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoDashboardv2.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // validate the optional field `created_by` + if (data['created_by']) { // data not null + ArduinoDashboardowner.validateJSON(data['created_by']); + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + // ensure the json data is a string + if (data['organization_id'] && !(typeof data['organization_id'] === 'string' || data['organization_id'] instanceof String)) { + throw new Error("Expected the field `organization_id` to be a primitive type in the JSON string but got " + data['organization_id']); + } + // validate the optional field `shared_by` + if (data['shared_by']) { // data not null + ArduinoDashboardshare.validateJSON(data['shared_by']); + } + if (data['shared_with']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['shared_with'])) { + throw new Error("Expected the field `shared_with` to be an array in the JSON data but got " + data['shared_with']); + } + // validate the optional field `shared_with` (array) + for (const item of data['shared_with']) { + ArduinoDashboardshare.validateJSON(item); + }; + } + if (data['widgets']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['widgets'])) { + throw new Error("Expected the field `widgets` to be an array in the JSON data but got " + data['widgets']); + } + // validate the optional field `widgets` (array) + for (const item of data['widgets']) { + ArduinoWidgetv2.validateJSON(item); + }; + } + + return true; + } + } +ArduinoDashboardv2.RequiredProperties = ["id", "name", "updated_at"]; + /** * @member {module:model/ArduinoDashboardowner} created_by */ diff --git a/src/model/ArduinoDevicev2.js b/src/model/ArduinoDevicev2.js index d033b6d..16ed343 100644 --- a/src/model/ArduinoDevicev2.js +++ b/src/model/ArduinoDevicev2.js @@ -19,7 +19,7 @@ import ArduinoThing from './ArduinoThing'; /** * The ArduinoDevicev2 model module. * @module model/ArduinoDevicev2 - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDevicev2 { /** @@ -138,9 +138,103 @@ class ArduinoDevicev2 { return obj; } + /** + * Validates the JSON data with respect to ArduinoDevicev2. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDevicev2. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoDevicev2.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['connection_type'] && !(typeof data['connection_type'] === 'string' || data['connection_type'] instanceof String)) { + throw new Error("Expected the field `connection_type` to be a primitive type in the JSON string but got " + data['connection_type']); + } + if (data['events']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['events'])) { + throw new Error("Expected the field `events` to be an array in the JSON data but got " + data['events']); + } + // validate the optional field `events` (array) + for (const item of data['events']) { + ArduinoDevicev2SimpleProperties.validateJSON(item); + }; + } + // ensure the json data is a string + if (data['fqbn'] && !(typeof data['fqbn'] === 'string' || data['fqbn'] instanceof String)) { + throw new Error("Expected the field `fqbn` to be a primitive type in the JSON string but got " + data['fqbn']); + } + // ensure the json data is a string + if (data['href'] && !(typeof data['href'] === 'string' || data['href'] instanceof String)) { + throw new Error("Expected the field `href` to be a primitive type in the JSON string but got " + data['href']); + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['label'] && !(typeof data['label'] === 'string' || data['label'] instanceof String)) { + throw new Error("Expected the field `label` to be a primitive type in the JSON string but got " + data['label']); + } + // ensure the json data is a string + if (data['latest_wifi_fw_version'] && !(typeof data['latest_wifi_fw_version'] === 'string' || data['latest_wifi_fw_version'] instanceof String)) { + throw new Error("Expected the field `latest_wifi_fw_version` to be a primitive type in the JSON string but got " + data['latest_wifi_fw_version']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + // ensure the json data is a string + if (data['organization_id'] && !(typeof data['organization_id'] === 'string' || data['organization_id'] instanceof String)) { + throw new Error("Expected the field `organization_id` to be a primitive type in the JSON string but got " + data['organization_id']); + } + // ensure the json data is a string + if (data['required_wifi_fw_version'] && !(typeof data['required_wifi_fw_version'] === 'string' || data['required_wifi_fw_version'] instanceof String)) { + throw new Error("Expected the field `required_wifi_fw_version` to be a primitive type in the JSON string but got " + data['required_wifi_fw_version']); + } + // ensure the json data is a string + if (data['serial'] && !(typeof data['serial'] === 'string' || data['serial'] instanceof String)) { + throw new Error("Expected the field `serial` to be a primitive type in the JSON string but got " + data['serial']); + } + // validate the optional field `thing` + if (data['thing']) { // data not null + ArduinoThing.validateJSON(data['thing']); + } + // ensure the json data is a string + if (data['type'] && !(typeof data['type'] === 'string' || data['type'] instanceof String)) { + throw new Error("Expected the field `type` to be a primitive type in the JSON string but got " + data['type']); + } + // ensure the json data is a string + if (data['user_id'] && !(typeof data['user_id'] === 'string' || data['user_id'] instanceof String)) { + throw new Error("Expected the field `user_id` to be a primitive type in the JSON string but got " + data['user_id']); + } + if (data['webhooks']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['webhooks'])) { + throw new Error("Expected the field `webhooks` to be an array in the JSON data but got " + data['webhooks']); + } + // validate the optional field `webhooks` (array) + for (const item of data['webhooks']) { + ArduinoDevicev2Webhook.validateJSON(item); + }; + } + // ensure the json data is a string + if (data['wifi_fw_version'] && !(typeof data['wifi_fw_version'] === 'string' || data['wifi_fw_version'] instanceof String)) { + throw new Error("Expected the field `wifi_fw_version` to be a primitive type in the JSON string but got " + data['wifi_fw_version']); + } + + return true; + } + } +ArduinoDevicev2.RequiredProperties = ["href", "id", "label", "name", "serial", "type", "user_id"]; + /** * The type of the connections selected by the user when multiple connections are available * @member {module:model/ArduinoDevicev2.ConnectionTypeEnum} connection_type diff --git a/src/model/ArduinoDevicev2Cert.js b/src/model/ArduinoDevicev2Cert.js index e9d0aea..ebdfe15 100644 --- a/src/model/ArduinoDevicev2Cert.js +++ b/src/model/ArduinoDevicev2Cert.js @@ -17,7 +17,7 @@ import ArduinoCompressedv2 from './ArduinoCompressedv2'; /** * The ArduinoDevicev2Cert model module. * @module model/ArduinoDevicev2Cert - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDevicev2Cert { /** @@ -46,7 +46,7 @@ class ArduinoDevicev2Cert { obj['compressed'] = compressed; obj['der'] = der; obj['device_id'] = deviceId; - obj['enabled'] = enabled; + obj['enabled'] = enabled || true; obj['href'] = href; obj['id'] = id; obj['pem'] = pem; @@ -91,9 +91,55 @@ class ArduinoDevicev2Cert { return obj; } + /** + * Validates the JSON data with respect to ArduinoDevicev2Cert. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDevicev2Cert. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoDevicev2Cert.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['ca'] && !(typeof data['ca'] === 'string' || data['ca'] instanceof String)) { + throw new Error("Expected the field `ca` to be a primitive type in the JSON string but got " + data['ca']); + } + // validate the optional field `compressed` + if (data['compressed']) { // data not null + ArduinoCompressedv2.validateJSON(data['compressed']); + } + // ensure the json data is a string + if (data['der'] && !(typeof data['der'] === 'string' || data['der'] instanceof String)) { + throw new Error("Expected the field `der` to be a primitive type in the JSON string but got " + data['der']); + } + // ensure the json data is a string + if (data['device_id'] && !(typeof data['device_id'] === 'string' || data['device_id'] instanceof String)) { + throw new Error("Expected the field `device_id` to be a primitive type in the JSON string but got " + data['device_id']); + } + // ensure the json data is a string + if (data['href'] && !(typeof data['href'] === 'string' || data['href'] instanceof String)) { + throw new Error("Expected the field `href` to be a primitive type in the JSON string but got " + data['href']); + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['pem'] && !(typeof data['pem'] === 'string' || data['pem'] instanceof String)) { + throw new Error("Expected the field `pem` to be a primitive type in the JSON string but got " + data['pem']); + } + + return true; + } + } +ArduinoDevicev2Cert.RequiredProperties = ["compressed", "der", "device_id", "enabled", "href", "id", "pem"]; + /** * The Certification Authority used to sign the certificate * @member {String} ca diff --git a/src/model/ArduinoDevicev2EventProperties.js b/src/model/ArduinoDevicev2EventProperties.js index 2974c37..4f8feec 100644 --- a/src/model/ArduinoDevicev2EventProperties.js +++ b/src/model/ArduinoDevicev2EventProperties.js @@ -17,7 +17,7 @@ import ArduinoDevicev2SimpleProperties from './ArduinoDevicev2SimpleProperties'; /** * The ArduinoDevicev2EventProperties model module. * @module model/ArduinoDevicev2EventProperties - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDevicev2EventProperties { /** @@ -63,9 +63,41 @@ class ArduinoDevicev2EventProperties { return obj; } + /** + * Validates the JSON data with respect to ArduinoDevicev2EventProperties. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDevicev2EventProperties. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoDevicev2EventProperties.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + if (data['events']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['events'])) { + throw new Error("Expected the field `events` to be an array in the JSON data but got " + data['events']); + } + // validate the optional field `events` (array) + for (const item of data['events']) { + ArduinoDevicev2SimpleProperties.validateJSON(item); + }; + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + + return true; + } + } +ArduinoDevicev2EventProperties.RequiredProperties = ["events", "id"]; + /** * ArduinoDevicev2SimplePropertiesCollection is the media type for an array of ArduinoDevicev2SimpleProperties (default view) * @member {Array.} events diff --git a/src/model/ArduinoDevicev2Pass.js b/src/model/ArduinoDevicev2Pass.js index ce855aa..30d50fc 100644 --- a/src/model/ArduinoDevicev2Pass.js +++ b/src/model/ArduinoDevicev2Pass.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoDevicev2Pass model module. * @module model/ArduinoDevicev2Pass - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDevicev2Pass { /** @@ -60,9 +60,31 @@ class ArduinoDevicev2Pass { return obj; } + /** + * Validates the JSON data with respect to ArduinoDevicev2Pass. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDevicev2Pass. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoDevicev2Pass.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['suggested_password'] && !(typeof data['suggested_password'] === 'string' || data['suggested_password'] instanceof String)) { + throw new Error("Expected the field `suggested_password` to be a primitive type in the JSON string but got " + data['suggested_password']); + } + + return true; + } + } +ArduinoDevicev2Pass.RequiredProperties = ["set"]; + /** * Whether the password is set or not * @member {Boolean} set diff --git a/src/model/ArduinoDevicev2SimpleProperties.js b/src/model/ArduinoDevicev2SimpleProperties.js index 73be4b5..56407aa 100644 --- a/src/model/ArduinoDevicev2SimpleProperties.js +++ b/src/model/ArduinoDevicev2SimpleProperties.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoDevicev2SimpleProperties model module. * @module model/ArduinoDevicev2SimpleProperties - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDevicev2SimpleProperties { /** @@ -67,9 +67,31 @@ class ArduinoDevicev2SimpleProperties { return obj; } + /** + * Validates the JSON data with respect to ArduinoDevicev2SimpleProperties. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDevicev2SimpleProperties. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoDevicev2SimpleProperties.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + + return true; + } + } +ArduinoDevicev2SimpleProperties.RequiredProperties = ["name", "updated_at", "value"]; + /** * The name of the property * @member {String} name diff --git a/src/model/ArduinoDevicev2Webhook.js b/src/model/ArduinoDevicev2Webhook.js index a07426a..79d0f47 100644 --- a/src/model/ArduinoDevicev2Webhook.js +++ b/src/model/ArduinoDevicev2Webhook.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoDevicev2Webhook model module. * @module model/ArduinoDevicev2Webhook - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDevicev2Webhook { /** @@ -65,9 +65,35 @@ class ArduinoDevicev2Webhook { return obj; } + /** + * Validates the JSON data with respect to ArduinoDevicev2Webhook. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDevicev2Webhook. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoDevicev2Webhook.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['uri'] && !(typeof data['uri'] === 'string' || data['uri'] instanceof String)) { + throw new Error("Expected the field `uri` to be a primitive type in the JSON string but got " + data['uri']); + } + + return true; + } + } +ArduinoDevicev2Webhook.RequiredProperties = ["id", "uri"]; + /** * Whether the webhook is active * @member {Boolean} active diff --git a/src/model/ArduinoDevicev2properties.js b/src/model/ArduinoDevicev2properties.js index d5c2044..d5850c9 100644 --- a/src/model/ArduinoDevicev2properties.js +++ b/src/model/ArduinoDevicev2properties.js @@ -17,7 +17,7 @@ import ArduinoProperty from './ArduinoProperty'; /** * The ArduinoDevicev2properties model module. * @module model/ArduinoDevicev2properties - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDevicev2properties { /** @@ -73,9 +73,45 @@ class ArduinoDevicev2properties { return obj; } + /** + * Validates the JSON data with respect to ArduinoDevicev2properties. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDevicev2properties. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoDevicev2properties.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['deviceId'] && !(typeof data['deviceId'] === 'string' || data['deviceId'] instanceof String)) { + throw new Error("Expected the field `deviceId` to be a primitive type in the JSON string but got " + data['deviceId']); + } + if (data['properties']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['properties'])) { + throw new Error("Expected the field `properties` to be an array in the JSON data but got " + data['properties']); + } + // validate the optional field `properties` (array) + for (const item of data['properties']) { + ArduinoProperty.validateJSON(item); + }; + } + // ensure the json data is a string + if (data['user_id'] && !(typeof data['user_id'] === 'string' || data['user_id'] instanceof String)) { + throw new Error("Expected the field `user_id` to be a primitive type in the JSON string but got " + data['user_id']); + } + + return true; + } + } +ArduinoDevicev2properties.RequiredProperties = ["data_retention_days", "deviceId", "properties", "user_id"]; + /** * How many days the data will be kept * @member {Number} data_retention_days diff --git a/src/model/ArduinoDevicev2propertyvalue.js b/src/model/ArduinoDevicev2propertyvalue.js index addba4e..251982b 100644 --- a/src/model/ArduinoDevicev2propertyvalue.js +++ b/src/model/ArduinoDevicev2propertyvalue.js @@ -17,7 +17,7 @@ import ArduinoDevicev2propertyvalueValue from './ArduinoDevicev2propertyvalueVal /** * The ArduinoDevicev2propertyvalue model module. * @module model/ArduinoDevicev2propertyvalue - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDevicev2propertyvalue { /** @@ -59,9 +59,25 @@ class ArduinoDevicev2propertyvalue { return obj; } + /** + * Validates the JSON data with respect to ArduinoDevicev2propertyvalue. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDevicev2propertyvalue. + */ + static validateJSON(data) { + // validate the optional field `value` + if (data['value']) { // data not null + ArduinoDevicev2propertyvalueValue.validateJSON(data['value']); + } + + return true; + } + } + + /** * @member {Date} created_at */ diff --git a/src/model/ArduinoDevicev2propertyvalueValue.js b/src/model/ArduinoDevicev2propertyvalueValue.js index 5fef439..45ae68f 100644 --- a/src/model/ArduinoDevicev2propertyvalueValue.js +++ b/src/model/ArduinoDevicev2propertyvalueValue.js @@ -17,7 +17,7 @@ import ArduinoDevicev2propertyvalueValueStatistics from './ArduinoDevicev2proper /** * The ArduinoDevicev2propertyvalueValue model module. * @module model/ArduinoDevicev2propertyvalueValue - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDevicev2propertyvalueValue { /** @@ -61,9 +61,29 @@ class ArduinoDevicev2propertyvalueValue { return obj; } + /** + * Validates the JSON data with respect to ArduinoDevicev2propertyvalueValue. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDevicev2propertyvalueValue. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['payload'] && !(typeof data['payload'] === 'string' || data['payload'] instanceof String)) { + throw new Error("Expected the field `payload` to be a primitive type in the JSON string but got " + data['payload']); + } + // validate the optional field `statistics` + if (data['statistics']) { // data not null + ArduinoDevicev2propertyvalueValueStatistics.validateJSON(data['statistics']); + } + + return true; + } + } + + /** * @member {String} payload */ diff --git a/src/model/ArduinoDevicev2propertyvalueValueStatistics.js b/src/model/ArduinoDevicev2propertyvalueValueStatistics.js index 9331462..6cb5666 100644 --- a/src/model/ArduinoDevicev2propertyvalueValueStatistics.js +++ b/src/model/ArduinoDevicev2propertyvalueValueStatistics.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoDevicev2propertyvalueValueStatistics model module. * @module model/ArduinoDevicev2propertyvalueValueStatistics - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDevicev2propertyvalueValueStatistics { /** @@ -81,9 +81,21 @@ class ArduinoDevicev2propertyvalueValueStatistics { return obj; } + /** + * Validates the JSON data with respect to ArduinoDevicev2propertyvalueValueStatistics. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDevicev2propertyvalueValueStatistics. + */ + static validateJSON(data) { + + return true; + } + } + + /** * @member {Number} adr */ diff --git a/src/model/ArduinoDevicev2propertyvalues.js b/src/model/ArduinoDevicev2propertyvalues.js index a96b260..afc5616 100644 --- a/src/model/ArduinoDevicev2propertyvalues.js +++ b/src/model/ArduinoDevicev2propertyvalues.js @@ -18,7 +18,7 @@ import ArduinoDevicev2propertyvaluesLastEvaluatedKey from './ArduinoDevicev2prop /** * The ArduinoDevicev2propertyvalues model module. * @module model/ArduinoDevicev2propertyvalues - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDevicev2propertyvalues { /** @@ -74,9 +74,49 @@ class ArduinoDevicev2propertyvalues { return obj; } + /** + * Validates the JSON data with respect to ArduinoDevicev2propertyvalues. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDevicev2propertyvalues. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoDevicev2propertyvalues.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // validate the optional field `last_evaluated_key` + if (data['last_evaluated_key']) { // data not null + ArduinoDevicev2propertyvaluesLastEvaluatedKey.validateJSON(data['last_evaluated_key']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + if (data['values']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['values'])) { + throw new Error("Expected the field `values` to be an array in the JSON data but got " + data['values']); + } + // validate the optional field `values` (array) + for (const item of data['values']) { + ArduinoDevicev2propertyvalue.validateJSON(item); + }; + } + + return true; + } + } +ArduinoDevicev2propertyvalues.RequiredProperties = ["id", "last_evaluated_key", "name", "values"]; + /** * @member {String} id */ diff --git a/src/model/ArduinoDevicev2propertyvaluesLastEvaluatedKey.js b/src/model/ArduinoDevicev2propertyvaluesLastEvaluatedKey.js index 95de3bb..2f9df8f 100644 --- a/src/model/ArduinoDevicev2propertyvaluesLastEvaluatedKey.js +++ b/src/model/ArduinoDevicev2propertyvaluesLastEvaluatedKey.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoDevicev2propertyvaluesLastEvaluatedKey model module. * @module model/ArduinoDevicev2propertyvaluesLastEvaluatedKey - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoDevicev2propertyvaluesLastEvaluatedKey { /** @@ -60,9 +60,29 @@ class ArduinoDevicev2propertyvaluesLastEvaluatedKey { return obj; } + /** + * Validates the JSON data with respect to ArduinoDevicev2propertyvaluesLastEvaluatedKey. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoDevicev2propertyvaluesLastEvaluatedKey. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + + return true; + } + } + + /** * @member {Date} created_at */ diff --git a/src/model/ArduinoLinkedvariable.js b/src/model/ArduinoLinkedvariable.js index 563cd5d..dd41673 100644 --- a/src/model/ArduinoLinkedvariable.js +++ b/src/model/ArduinoLinkedvariable.js @@ -17,7 +17,7 @@ import ArduinoTimezone from './ArduinoTimezone'; /** * The ArduinoLinkedvariable model module. * @module model/ArduinoLinkedvariable - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoLinkedvariable { /** @@ -97,9 +97,59 @@ class ArduinoLinkedvariable { return obj; } + /** + * Validates the JSON data with respect to ArduinoLinkedvariable. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoLinkedvariable. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoLinkedvariable.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + // ensure the json data is a string + if (data['permission'] && !(typeof data['permission'] === 'string' || data['permission'] instanceof String)) { + throw new Error("Expected the field `permission` to be a primitive type in the JSON string but got " + data['permission']); + } + // ensure the json data is a string + if (data['thing_id'] && !(typeof data['thing_id'] === 'string' || data['thing_id'] instanceof String)) { + throw new Error("Expected the field `thing_id` to be a primitive type in the JSON string but got " + data['thing_id']); + } + // ensure the json data is a string + if (data['thing_name'] && !(typeof data['thing_name'] === 'string' || data['thing_name'] instanceof String)) { + throw new Error("Expected the field `thing_name` to be a primitive type in the JSON string but got " + data['thing_name']); + } + // validate the optional field `thing_timezone` + if (data['thing_timezone']) { // data not null + ArduinoTimezone.validateJSON(data['thing_timezone']); + } + // ensure the json data is a string + if (data['type'] && !(typeof data['type'] === 'string' || data['type'] instanceof String)) { + throw new Error("Expected the field `type` to be a primitive type in the JSON string but got " + data['type']); + } + // ensure the json data is a string + if (data['variable_name'] && !(typeof data['variable_name'] === 'string' || data['variable_name'] instanceof String)) { + throw new Error("Expected the field `variable_name` to be a primitive type in the JSON string but got " + data['variable_name']); + } + + return true; + } + } +ArduinoLinkedvariable.RequiredProperties = ["id", "name", "permission", "thing_id", "thing_name", "type", "variable_name"]; + /** * The id of the linked variable * @member {String} id diff --git a/src/model/ArduinoLoradevicev1.js b/src/model/ArduinoLoradevicev1.js index bbcc2ac..0d0f35c 100644 --- a/src/model/ArduinoLoradevicev1.js +++ b/src/model/ArduinoLoradevicev1.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoLoradevicev1 model module. * @module model/ArduinoLoradevicev1 - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoLoradevicev1 { /** @@ -72,9 +72,43 @@ class ArduinoLoradevicev1 { return obj; } + /** + * Validates the JSON data with respect to ArduinoLoradevicev1. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoLoradevicev1. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoLoradevicev1.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['app_eui'] && !(typeof data['app_eui'] === 'string' || data['app_eui'] instanceof String)) { + throw new Error("Expected the field `app_eui` to be a primitive type in the JSON string but got " + data['app_eui']); + } + // ensure the json data is a string + if (data['app_key'] && !(typeof data['app_key'] === 'string' || data['app_key'] instanceof String)) { + throw new Error("Expected the field `app_key` to be a primitive type in the JSON string but got " + data['app_key']); + } + // ensure the json data is a string + if (data['device_id'] && !(typeof data['device_id'] === 'string' || data['device_id'] instanceof String)) { + throw new Error("Expected the field `device_id` to be a primitive type in the JSON string but got " + data['device_id']); + } + // ensure the json data is a string + if (data['eui'] && !(typeof data['eui'] === 'string' || data['eui'] instanceof String)) { + throw new Error("Expected the field `eui` to be a primitive type in the JSON string but got " + data['eui']); + } + + return true; + } + } +ArduinoLoradevicev1.RequiredProperties = ["app_eui", "app_key", "device_id", "eui"]; + /** * The eui of the app * @member {String} app_eui diff --git a/src/model/ArduinoLorafreqplansv1.js b/src/model/ArduinoLorafreqplansv1.js index a09c974..156a4ba 100644 --- a/src/model/ArduinoLorafreqplansv1.js +++ b/src/model/ArduinoLorafreqplansv1.js @@ -17,7 +17,7 @@ import ArduinoLorafreqplanv1 from './ArduinoLorafreqplanv1'; /** * The ArduinoLorafreqplansv1 model module. * @module model/ArduinoLorafreqplansv1 - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoLorafreqplansv1 { /** @@ -56,9 +56,31 @@ class ArduinoLorafreqplansv1 { return obj; } + /** + * Validates the JSON data with respect to ArduinoLorafreqplansv1. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoLorafreqplansv1. + */ + static validateJSON(data) { + if (data['frequency_plans']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['frequency_plans'])) { + throw new Error("Expected the field `frequency_plans` to be an array in the JSON data but got " + data['frequency_plans']); + } + // validate the optional field `frequency_plans` (array) + for (const item of data['frequency_plans']) { + ArduinoLorafreqplanv1.validateJSON(item); + }; + } + + return true; + } + } + + /** * The list of frequency plans * @member {Array.} frequency_plans diff --git a/src/model/ArduinoLorafreqplanv1.js b/src/model/ArduinoLorafreqplanv1.js index d6097da..8910749 100644 --- a/src/model/ArduinoLorafreqplanv1.js +++ b/src/model/ArduinoLorafreqplanv1.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoLorafreqplanv1 model module. * @module model/ArduinoLorafreqplanv1 - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoLorafreqplanv1 { /** @@ -67,9 +67,35 @@ class ArduinoLorafreqplanv1 { return obj; } + /** + * Validates the JSON data with respect to ArduinoLorafreqplanv1. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoLorafreqplanv1. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoLorafreqplanv1.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + + return true; + } + } +ArduinoLorafreqplanv1.RequiredProperties = ["advanced", "id", "name"]; + /** * Frequency plan only for advanced users * @member {Boolean} advanced diff --git a/src/model/ArduinoProperty.js b/src/model/ArduinoProperty.js index e979f6b..7edca1d 100644 --- a/src/model/ArduinoProperty.js +++ b/src/model/ArduinoProperty.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoProperty model module. * @module model/ArduinoProperty - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoProperty { /** @@ -77,6 +77,9 @@ class ArduinoProperty { if (data.hasOwnProperty('last_value')) { obj['last_value'] = ApiClient.convertToType(data['last_value'], Object); } + if (data.hasOwnProperty('linked_to_trigger')) { + obj['linked_to_trigger'] = ApiClient.convertToType(data['linked_to_trigger'], 'Boolean'); + } if (data.hasOwnProperty('max_value')) { obj['max_value'] = ApiClient.convertToType(data['max_value'], 'Number'); } @@ -126,9 +129,67 @@ class ArduinoProperty { return obj; } + /** + * Validates the JSON data with respect to ArduinoProperty. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoProperty. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoProperty.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['href'] && !(typeof data['href'] === 'string' || data['href'] instanceof String)) { + throw new Error("Expected the field `href` to be a primitive type in the JSON string but got " + data['href']); + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + // ensure the json data is a string + if (data['permission'] && !(typeof data['permission'] === 'string' || data['permission'] instanceof String)) { + throw new Error("Expected the field `permission` to be a primitive type in the JSON string but got " + data['permission']); + } + // ensure the json data is a string + if (data['sync_id'] && !(typeof data['sync_id'] === 'string' || data['sync_id'] instanceof String)) { + throw new Error("Expected the field `sync_id` to be a primitive type in the JSON string but got " + data['sync_id']); + } + // ensure the json data is a string + if (data['thing_id'] && !(typeof data['thing_id'] === 'string' || data['thing_id'] instanceof String)) { + throw new Error("Expected the field `thing_id` to be a primitive type in the JSON string but got " + data['thing_id']); + } + // ensure the json data is a string + if (data['thing_name'] && !(typeof data['thing_name'] === 'string' || data['thing_name'] instanceof String)) { + throw new Error("Expected the field `thing_name` to be a primitive type in the JSON string but got " + data['thing_name']); + } + // ensure the json data is a string + if (data['type'] && !(typeof data['type'] === 'string' || data['type'] instanceof String)) { + throw new Error("Expected the field `type` to be a primitive type in the JSON string but got " + data['type']); + } + // ensure the json data is a string + if (data['update_strategy'] && !(typeof data['update_strategy'] === 'string' || data['update_strategy'] instanceof String)) { + throw new Error("Expected the field `update_strategy` to be a primitive type in the JSON string but got " + data['update_strategy']); + } + // ensure the json data is a string + if (data['variable_name'] && !(typeof data['variable_name'] === 'string' || data['variable_name'] instanceof String)) { + throw new Error("Expected the field `variable_name` to be a primitive type in the JSON string but got " + data['variable_name']); + } + + return true; + } + } +ArduinoProperty.RequiredProperties = ["href", "id", "name", "permission", "thing_id", "type", "update_strategy"]; + /** * Creation date of the property * @member {Date} created_at @@ -159,6 +220,12 @@ ArduinoProperty.prototype['id'] = undefined; */ ArduinoProperty.prototype['last_value'] = undefined; +/** + * Indicates if the property is involved in the activation of at least a trigger + * @member {Boolean} linked_to_trigger + */ +ArduinoProperty.prototype['linked_to_trigger'] = undefined; + /** * Maximum value of this property * @member {Number} max_value diff --git a/src/model/ArduinoSeriesBatch.js b/src/model/ArduinoSeriesBatch.js index 47fa4c9..ae38ad2 100644 --- a/src/model/ArduinoSeriesBatch.js +++ b/src/model/ArduinoSeriesBatch.js @@ -17,7 +17,7 @@ import ArduinoSeriesResponse from './ArduinoSeriesResponse'; /** * The ArduinoSeriesBatch model module. * @module model/ArduinoSeriesBatch - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoSeriesBatch { /** @@ -63,9 +63,37 @@ class ArduinoSeriesBatch { return obj; } + /** + * Validates the JSON data with respect to ArduinoSeriesBatch. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoSeriesBatch. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoSeriesBatch.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + if (data['responses']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['responses'])) { + throw new Error("Expected the field `responses` to be an array in the JSON data but got " + data['responses']); + } + // validate the optional field `responses` (array) + for (const item of data['responses']) { + ArduinoSeriesResponse.validateJSON(item); + }; + } + + return true; + } + } +ArduinoSeriesBatch.RequiredProperties = ["resp_version", "responses"]; + /** * Response version * @member {Number} resp_version diff --git a/src/model/ArduinoSeriesRawBatch.js b/src/model/ArduinoSeriesRawBatch.js index 482154b..5489e17 100644 --- a/src/model/ArduinoSeriesRawBatch.js +++ b/src/model/ArduinoSeriesRawBatch.js @@ -17,7 +17,7 @@ import ArduinoSeriesRawResponse from './ArduinoSeriesRawResponse'; /** * The ArduinoSeriesRawBatch model module. * @module model/ArduinoSeriesRawBatch - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoSeriesRawBatch { /** @@ -63,9 +63,37 @@ class ArduinoSeriesRawBatch { return obj; } + /** + * Validates the JSON data with respect to ArduinoSeriesRawBatch. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoSeriesRawBatch. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoSeriesRawBatch.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + if (data['responses']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['responses'])) { + throw new Error("Expected the field `responses` to be an array in the JSON data but got " + data['responses']); + } + // validate the optional field `responses` (array) + for (const item of data['responses']) { + ArduinoSeriesRawResponse.validateJSON(item); + }; + } + + return true; + } + } +ArduinoSeriesRawBatch.RequiredProperties = ["resp_version", "responses"]; + /** * Response version * @member {Number} resp_version diff --git a/src/model/ArduinoSeriesRawBatchLastvalue.js b/src/model/ArduinoSeriesRawBatchLastvalue.js index 3cbece1..22d26d3 100644 --- a/src/model/ArduinoSeriesRawBatchLastvalue.js +++ b/src/model/ArduinoSeriesRawBatchLastvalue.js @@ -17,7 +17,7 @@ import ArduinoSeriesRawLastValueResponse from './ArduinoSeriesRawLastValueRespon /** * The ArduinoSeriesRawBatchLastvalue model module. * @module model/ArduinoSeriesRawBatchLastvalue - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoSeriesRawBatchLastvalue { /** @@ -63,9 +63,41 @@ class ArduinoSeriesRawBatchLastvalue { return obj; } + /** + * Validates the JSON data with respect to ArduinoSeriesRawBatchLastvalue. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoSeriesRawBatchLastvalue. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoSeriesRawBatchLastvalue.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + if (data['responses']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['responses'])) { + throw new Error("Expected the field `responses` to be an array in the JSON data but got " + data['responses']); + } + // validate the optional field `responses` (array) + for (const item of data['responses']) { + ArduinoSeriesRawLastValueResponse.validateJSON(item); + }; + } + // ensure the json data is a string + if (data['status'] && !(typeof data['status'] === 'string' || data['status'] instanceof String)) { + throw new Error("Expected the field `status` to be a primitive type in the JSON string but got " + data['status']); + } + + return true; + } + } +ArduinoSeriesRawBatchLastvalue.RequiredProperties = ["responses", "status"]; + /** * Responses of the request * @member {Array.} responses diff --git a/src/model/ArduinoSeriesRawLastValueResponse.js b/src/model/ArduinoSeriesRawLastValueResponse.js index f58c428..7b394f4 100644 --- a/src/model/ArduinoSeriesRawLastValueResponse.js +++ b/src/model/ArduinoSeriesRawLastValueResponse.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoSeriesRawLastValueResponse model module. * @module model/ArduinoSeriesRawLastValueResponse - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoSeriesRawLastValueResponse { /** @@ -77,9 +77,43 @@ class ArduinoSeriesRawLastValueResponse { return obj; } + /** + * Validates the JSON data with respect to ArduinoSeriesRawLastValueResponse. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoSeriesRawLastValueResponse. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoSeriesRawLastValueResponse.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['property_id'] && !(typeof data['property_id'] === 'string' || data['property_id'] instanceof String)) { + throw new Error("Expected the field `property_id` to be a primitive type in the JSON string but got " + data['property_id']); + } + // ensure the json data is a string + if (data['thing_id'] && !(typeof data['thing_id'] === 'string' || data['thing_id'] instanceof String)) { + throw new Error("Expected the field `thing_id` to be a primitive type in the JSON string but got " + data['thing_id']); + } + // ensure the json data is an array + if (!Array.isArray(data['times'])) { + throw new Error("Expected the field `times` to be an array in the JSON data but got " + data['times']); + } + // ensure the json data is an array + if (!Array.isArray(data['values'])) { + throw new Error("Expected the field `values` to be an array in the JSON data but got " + data['values']); + } + + return true; + } + } +ArduinoSeriesRawLastValueResponse.RequiredProperties = ["count_values", "property_id", "thing_id", "times", "values"]; + /** * Total number of values in the array 'values' * @member {Number} count_values diff --git a/src/model/ArduinoSeriesRawResponse.js b/src/model/ArduinoSeriesRawResponse.js index fcf670a..b819154 100644 --- a/src/model/ArduinoSeriesRawResponse.js +++ b/src/model/ArduinoSeriesRawResponse.js @@ -17,7 +17,7 @@ import BatchQueryRawResponseSeriesMediaV1 from './BatchQueryRawResponseSeriesMed /** * The ArduinoSeriesRawResponse model module. * @module model/ArduinoSeriesRawResponse - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoSeriesRawResponse { /** @@ -109,9 +109,55 @@ class ArduinoSeriesRawResponse { return obj; } + /** + * Validates the JSON data with respect to ArduinoSeriesRawResponse. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoSeriesRawResponse. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoSeriesRawResponse.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['message'] && !(typeof data['message'] === 'string' || data['message'] instanceof String)) { + throw new Error("Expected the field `message` to be a primitive type in the JSON string but got " + data['message']); + } + // ensure the json data is a string + if (data['query'] && !(typeof data['query'] === 'string' || data['query'] instanceof String)) { + throw new Error("Expected the field `query` to be a primitive type in the JSON string but got " + data['query']); + } + // validate the optional field `series` + if (data['series']) { // data not null + BatchQueryRawResponseSeriesMediaV1.validateJSON(data['series']); + } + // ensure the json data is a string + if (data['sort'] && !(typeof data['sort'] === 'string' || data['sort'] instanceof String)) { + throw new Error("Expected the field `sort` to be a primitive type in the JSON string but got " + data['sort']); + } + // ensure the json data is a string + if (data['status'] && !(typeof data['status'] === 'string' || data['status'] instanceof String)) { + throw new Error("Expected the field `status` to be a primitive type in the JSON string but got " + data['status']); + } + // ensure the json data is an array + if (!Array.isArray(data['times'])) { + throw new Error("Expected the field `times` to be an array in the JSON data but got " + data['times']); + } + // ensure the json data is an array + if (!Array.isArray(data['values'])) { + throw new Error("Expected the field `values` to be an array in the JSON data but got " + data['values']); + } + + return true; + } + } +ArduinoSeriesRawResponse.RequiredProperties = ["count_values", "from_date", "query", "resp_version", "series", "sort", "status", "times", "to_date", "values"]; + /** * Total number of values in the array 'values' * @member {Number} count_values diff --git a/src/model/ArduinoSeriesResponse.js b/src/model/ArduinoSeriesResponse.js index 1552c99..4160bc7 100644 --- a/src/model/ArduinoSeriesResponse.js +++ b/src/model/ArduinoSeriesResponse.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoSeriesResponse model module. * @module model/ArduinoSeriesResponse - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoSeriesResponse { /** @@ -103,9 +103,47 @@ class ArduinoSeriesResponse { return obj; } + /** + * Validates the JSON data with respect to ArduinoSeriesResponse. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoSeriesResponse. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoSeriesResponse.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['message'] && !(typeof data['message'] === 'string' || data['message'] instanceof String)) { + throw new Error("Expected the field `message` to be a primitive type in the JSON string but got " + data['message']); + } + // ensure the json data is a string + if (data['query'] && !(typeof data['query'] === 'string' || data['query'] instanceof String)) { + throw new Error("Expected the field `query` to be a primitive type in the JSON string but got " + data['query']); + } + // ensure the json data is a string + if (data['status'] && !(typeof data['status'] === 'string' || data['status'] instanceof String)) { + throw new Error("Expected the field `status` to be a primitive type in the JSON string but got " + data['status']); + } + // ensure the json data is an array + if (!Array.isArray(data['times'])) { + throw new Error("Expected the field `times` to be an array in the JSON data but got " + data['times']); + } + // ensure the json data is an array + if (!Array.isArray(data['values'])) { + throw new Error("Expected the field `values` to be an array in the JSON data but got " + data['values']); + } + + return true; + } + } +ArduinoSeriesResponse.RequiredProperties = ["count_values", "from_date", "interval", "query", "resp_version", "status", "times", "to_date", "values"]; + /** * Total number of values in the array 'values' * @member {Number} count_values diff --git a/src/model/ArduinoTags.js b/src/model/ArduinoTags.js index 33655d3..69a3adb 100644 --- a/src/model/ArduinoTags.js +++ b/src/model/ArduinoTags.js @@ -17,7 +17,7 @@ import Tag from './Tag'; /** * The ArduinoTags model module. * @module model/ArduinoTags - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoTags { /** @@ -58,9 +58,37 @@ class ArduinoTags { return obj; } + /** + * Validates the JSON data with respect to ArduinoTags. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoTags. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoTags.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + if (data['tags']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['tags'])) { + throw new Error("Expected the field `tags` to be an array in the JSON data but got " + data['tags']); + } + // validate the optional field `tags` (array) + for (const item of data['tags']) { + Tag.validateJSON(item); + }; + } + + return true; + } + } +ArduinoTags.RequiredProperties = ["tags"]; + /** * @member {Array.} tags */ diff --git a/src/model/ArduinoThing.js b/src/model/ArduinoThing.js index 65f2e17..5e342d1 100644 --- a/src/model/ArduinoThing.js +++ b/src/model/ArduinoThing.js @@ -17,7 +17,7 @@ import ArduinoProperty from './ArduinoProperty'; /** * The ArduinoThing model module. * @module model/ArduinoThing - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoThing { /** @@ -120,9 +120,85 @@ class ArduinoThing { return obj; } + /** + * Validates the JSON data with respect to ArduinoThing. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoThing. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoThing.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['device_fqbn'] && !(typeof data['device_fqbn'] === 'string' || data['device_fqbn'] instanceof String)) { + throw new Error("Expected the field `device_fqbn` to be a primitive type in the JSON string but got " + data['device_fqbn']); + } + // ensure the json data is a string + if (data['device_id'] && !(typeof data['device_id'] === 'string' || data['device_id'] instanceof String)) { + throw new Error("Expected the field `device_id` to be a primitive type in the JSON string but got " + data['device_id']); + } + // ensure the json data is a string + if (data['device_name'] && !(typeof data['device_name'] === 'string' || data['device_name'] instanceof String)) { + throw new Error("Expected the field `device_name` to be a primitive type in the JSON string but got " + data['device_name']); + } + // ensure the json data is a string + if (data['device_type'] && !(typeof data['device_type'] === 'string' || data['device_type'] instanceof String)) { + throw new Error("Expected the field `device_type` to be a primitive type in the JSON string but got " + data['device_type']); + } + // ensure the json data is a string + if (data['href'] && !(typeof data['href'] === 'string' || data['href'] instanceof String)) { + throw new Error("Expected the field `href` to be a primitive type in the JSON string but got " + data['href']); + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + // ensure the json data is a string + if (data['organization_id'] && !(typeof data['organization_id'] === 'string' || data['organization_id'] instanceof String)) { + throw new Error("Expected the field `organization_id` to be a primitive type in the JSON string but got " + data['organization_id']); + } + if (data['properties']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['properties'])) { + throw new Error("Expected the field `properties` to be an array in the JSON data but got " + data['properties']); + } + // validate the optional field `properties` (array) + for (const item of data['properties']) { + ArduinoProperty.validateJSON(item); + }; + } + // ensure the json data is a string + if (data['sketch_id'] && !(typeof data['sketch_id'] === 'string' || data['sketch_id'] instanceof String)) { + throw new Error("Expected the field `sketch_id` to be a primitive type in the JSON string but got " + data['sketch_id']); + } + // ensure the json data is a string + if (data['timezone'] && !(typeof data['timezone'] === 'string' || data['timezone'] instanceof String)) { + throw new Error("Expected the field `timezone` to be a primitive type in the JSON string but got " + data['timezone']); + } + // ensure the json data is a string + if (data['user_id'] && !(typeof data['user_id'] === 'string' || data['user_id'] instanceof String)) { + throw new Error("Expected the field `user_id` to be a primitive type in the JSON string but got " + data['user_id']); + } + // ensure the json data is a string + if (data['webhook_uri'] && !(typeof data['webhook_uri'] === 'string' || data['webhook_uri'] instanceof String)) { + throw new Error("Expected the field `webhook_uri` to be a primitive type in the JSON string but got " + data['webhook_uri']); + } + + return true; + } + } +ArduinoThing.RequiredProperties = ["href", "id", "name", "timezone", "user_id"]; + /** * Creation date of the thing * @member {Date} created_at diff --git a/src/model/ArduinoTimeseriesmedia.js b/src/model/ArduinoTimeseriesmedia.js index 9898340..a500ab8 100644 --- a/src/model/ArduinoTimeseriesmedia.js +++ b/src/model/ArduinoTimeseriesmedia.js @@ -17,7 +17,7 @@ import TimeseriesDataPoint from './TimeseriesDataPoint'; /** * The ArduinoTimeseriesmedia model module. * @module model/ArduinoTimeseriesmedia - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoTimeseriesmedia { /** @@ -58,9 +58,37 @@ class ArduinoTimeseriesmedia { return obj; } + /** + * Validates the JSON data with respect to ArduinoTimeseriesmedia. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoTimeseriesmedia. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoTimeseriesmedia.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + if (data['data']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['data'])) { + throw new Error("Expected the field `data` to be an array in the JSON data but got " + data['data']); + } + // validate the optional field `data` (array) + for (const item of data['data']) { + TimeseriesDataPoint.validateJSON(item); + }; + } + + return true; + } + } +ArduinoTimeseriesmedia.RequiredProperties = ["data"]; + /** * @member {Array.} data */ diff --git a/src/model/ArduinoTimezone.js b/src/model/ArduinoTimezone.js index f39f778..224f862 100644 --- a/src/model/ArduinoTimezone.js +++ b/src/model/ArduinoTimezone.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoTimezone model module. * @module model/ArduinoTimezone - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoTimezone { /** @@ -65,9 +65,31 @@ class ArduinoTimezone { return obj; } + /** + * Validates the JSON data with respect to ArduinoTimezone. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoTimezone. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoTimezone.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + + return true; + } + } +ArduinoTimezone.RequiredProperties = ["name", "offset"]; + /** * Name of the time zone. * @member {String} name diff --git a/src/model/ArduinoVariableslinks.js b/src/model/ArduinoVariableslinks.js index 3e23747..45887e4 100644 --- a/src/model/ArduinoVariableslinks.js +++ b/src/model/ArduinoVariableslinks.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ArduinoVariableslinks model module. * @module model/ArduinoVariableslinks - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoVariableslinks { /** @@ -57,9 +57,31 @@ class ArduinoVariableslinks { return obj; } + /** + * Validates the JSON data with respect to ArduinoVariableslinks. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoVariableslinks. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoVariableslinks.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is an array + if (!Array.isArray(data['variables'])) { + throw new Error("Expected the field `variables` to be an array in the JSON data but got " + data['variables']); + } + + return true; + } + } +ArduinoVariableslinks.RequiredProperties = ["variables"]; + /** * The ids of the linked variables * @member {Array.} variables diff --git a/src/model/ArduinoWidgetv2.js b/src/model/ArduinoWidgetv2.js index d1867a7..32efa58 100644 --- a/src/model/ArduinoWidgetv2.js +++ b/src/model/ArduinoWidgetv2.js @@ -17,7 +17,7 @@ import ArduinoLinkedvariable from './ArduinoLinkedvariable'; /** * The ArduinoWidgetv2 model module. * @module model/ArduinoWidgetv2 - * @version 1.4.4 + * @version 1.5.0 */ class ArduinoWidgetv2 { /** @@ -115,9 +115,49 @@ class ArduinoWidgetv2 { return obj; } + /** + * Validates the JSON data with respect to ArduinoWidgetv2. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArduinoWidgetv2. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ArduinoWidgetv2.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + // ensure the json data is a string + if (data['type'] && !(typeof data['type'] === 'string' || data['type'] instanceof String)) { + throw new Error("Expected the field `type` to be a primitive type in the JSON string but got " + data['type']); + } + if (data['variables']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['variables'])) { + throw new Error("Expected the field `variables` to be an array in the JSON data but got " + data['variables']); + } + // validate the optional field `variables` (array) + for (const item of data['variables']) { + ArduinoLinkedvariable.validateJSON(item); + }; + } + + return true; + } + } +ArduinoWidgetv2.RequiredProperties = ["height", "id", "options", "type", "width", "x", "y"]; + /** * True if the linked variables permissions are incompatible with the widget * @member {Boolean} has_permission_incompatibility diff --git a/src/model/BatchLastValueRequestsMediaV1.js b/src/model/BatchLastValueRequestsMediaV1.js index 20eada3..2e52f5d 100644 --- a/src/model/BatchLastValueRequestsMediaV1.js +++ b/src/model/BatchLastValueRequestsMediaV1.js @@ -17,7 +17,7 @@ import BatchQueryRawLastValueRequestMediaV1 from './BatchQueryRawLastValueReques /** * The BatchLastValueRequestsMediaV1 model module. * @module model/BatchLastValueRequestsMediaV1 - * @version 1.4.4 + * @version 1.5.0 */ class BatchLastValueRequestsMediaV1 { /** @@ -57,9 +57,37 @@ class BatchLastValueRequestsMediaV1 { return obj; } + /** + * Validates the JSON data with respect to BatchLastValueRequestsMediaV1. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to BatchLastValueRequestsMediaV1. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of BatchLastValueRequestsMediaV1.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + if (data['requests']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['requests'])) { + throw new Error("Expected the field `requests` to be an array in the JSON data but got " + data['requests']); + } + // validate the optional field `requests` (array) + for (const item of data['requests']) { + BatchQueryRawLastValueRequestMediaV1.validateJSON(item); + }; + } + + return true; + } + } +BatchLastValueRequestsMediaV1.RequiredProperties = ["requests"]; + /** * Requests * @member {Array.} requests diff --git a/src/model/BatchQueryRawLastValueRequestMediaV1.js b/src/model/BatchQueryRawLastValueRequestMediaV1.js index d0ec3ab..1693651 100644 --- a/src/model/BatchQueryRawLastValueRequestMediaV1.js +++ b/src/model/BatchQueryRawLastValueRequestMediaV1.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The BatchQueryRawLastValueRequestMediaV1 model module. * @module model/BatchQueryRawLastValueRequestMediaV1 - * @version 1.4.4 + * @version 1.5.0 */ class BatchQueryRawLastValueRequestMediaV1 { /** @@ -61,9 +61,35 @@ class BatchQueryRawLastValueRequestMediaV1 { return obj; } + /** + * Validates the JSON data with respect to BatchQueryRawLastValueRequestMediaV1. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to BatchQueryRawLastValueRequestMediaV1. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of BatchQueryRawLastValueRequestMediaV1.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['property_id'] && !(typeof data['property_id'] === 'string' || data['property_id'] instanceof String)) { + throw new Error("Expected the field `property_id` to be a primitive type in the JSON string but got " + data['property_id']); + } + // ensure the json data is a string + if (data['thing_id'] && !(typeof data['thing_id'] === 'string' || data['thing_id'] instanceof String)) { + throw new Error("Expected the field `thing_id` to be a primitive type in the JSON string but got " + data['thing_id']); + } + + return true; + } + } +BatchQueryRawLastValueRequestMediaV1.RequiredProperties = ["property_id", "thing_id"]; + /** * Property id * @member {String} property_id diff --git a/src/model/BatchQueryRawRequestMediaV1.js b/src/model/BatchQueryRawRequestMediaV1.js index 3527c17..21ddffd 100644 --- a/src/model/BatchQueryRawRequestMediaV1.js +++ b/src/model/BatchQueryRawRequestMediaV1.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The BatchQueryRawRequestMediaV1 model module. * @module model/BatchQueryRawRequestMediaV1 - * @version 1.4.4 + * @version 1.5.0 */ class BatchQueryRawRequestMediaV1 { /** @@ -68,9 +68,35 @@ class BatchQueryRawRequestMediaV1 { return obj; } + /** + * Validates the JSON data with respect to BatchQueryRawRequestMediaV1. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to BatchQueryRawRequestMediaV1. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of BatchQueryRawRequestMediaV1.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['q'] && !(typeof data['q'] === 'string' || data['q'] instanceof String)) { + throw new Error("Expected the field `q` to be a primitive type in the JSON string but got " + data['q']); + } + // ensure the json data is a string + if (data['sort'] && !(typeof data['sort'] === 'string' || data['sort'] instanceof String)) { + throw new Error("Expected the field `sort` to be a primitive type in the JSON string but got " + data['sort']); + } + + return true; + } + } +BatchQueryRawRequestMediaV1.RequiredProperties = ["q"]; + /** * From timestamp * @member {Date} from diff --git a/src/model/BatchQueryRawRequestsMediaV1.js b/src/model/BatchQueryRawRequestsMediaV1.js index 6cb6eac..69d6c6b 100644 --- a/src/model/BatchQueryRawRequestsMediaV1.js +++ b/src/model/BatchQueryRawRequestsMediaV1.js @@ -17,7 +17,7 @@ import BatchQueryRawRequestMediaV1 from './BatchQueryRawRequestMediaV1'; /** * The BatchQueryRawRequestsMediaV1 model module. * @module model/BatchQueryRawRequestsMediaV1 - * @version 1.4.4 + * @version 1.5.0 */ class BatchQueryRawRequestsMediaV1 { /** @@ -62,9 +62,37 @@ class BatchQueryRawRequestsMediaV1 { return obj; } + /** + * Validates the JSON data with respect to BatchQueryRawRequestsMediaV1. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to BatchQueryRawRequestsMediaV1. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of BatchQueryRawRequestsMediaV1.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + if (data['requests']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['requests'])) { + throw new Error("Expected the field `requests` to be an array in the JSON data but got " + data['requests']); + } + // validate the optional field `requests` (array) + for (const item of data['requests']) { + BatchQueryRawRequestMediaV1.validateJSON(item); + }; + } + + return true; + } + } +BatchQueryRawRequestsMediaV1.RequiredProperties = ["requests", "resp_version"]; + /** * Requests * @member {Array.} requests diff --git a/src/model/BatchQueryRawResponseSeriesMediaV1.js b/src/model/BatchQueryRawResponseSeriesMediaV1.js index 594b450..cfbc7a9 100644 --- a/src/model/BatchQueryRawResponseSeriesMediaV1.js +++ b/src/model/BatchQueryRawResponseSeriesMediaV1.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The BatchQueryRawResponseSeriesMediaV1 model module. * @module model/BatchQueryRawResponseSeriesMediaV1 - * @version 1.4.4 + * @version 1.5.0 */ class BatchQueryRawResponseSeriesMediaV1 { /** @@ -56,9 +56,31 @@ class BatchQueryRawResponseSeriesMediaV1 { return obj; } + /** + * Validates the JSON data with respect to BatchQueryRawResponseSeriesMediaV1. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to BatchQueryRawResponseSeriesMediaV1. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of BatchQueryRawResponseSeriesMediaV1.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['metric'] && !(typeof data['metric'] === 'string' || data['metric'] instanceof String)) { + throw new Error("Expected the field `metric` to be a primitive type in the JSON string but got " + data['metric']); + } + + return true; + } + } +BatchQueryRawResponseSeriesMediaV1.RequiredProperties = ["metric"]; + /** * Metric name * @member {String} metric diff --git a/src/model/BatchQueryRequestMediaV1.js b/src/model/BatchQueryRequestMediaV1.js index e850cb1..8ae323b 100644 --- a/src/model/BatchQueryRequestMediaV1.js +++ b/src/model/BatchQueryRequestMediaV1.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The BatchQueryRequestMediaV1 model module. * @module model/BatchQueryRequestMediaV1 - * @version 1.4.4 + * @version 1.5.0 */ class BatchQueryRequestMediaV1 { /** @@ -72,9 +72,31 @@ class BatchQueryRequestMediaV1 { return obj; } + /** + * Validates the JSON data with respect to BatchQueryRequestMediaV1. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to BatchQueryRequestMediaV1. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of BatchQueryRequestMediaV1.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['q'] && !(typeof data['q'] === 'string' || data['q'] instanceof String)) { + throw new Error("Expected the field `q` to be a primitive type in the JSON string but got " + data['q']); + } + + return true; + } + } +BatchQueryRequestMediaV1.RequiredProperties = ["from", "q", "to"]; + /** * From timestamp * @member {Date} from diff --git a/src/model/BatchQueryRequestsMediaV1.js b/src/model/BatchQueryRequestsMediaV1.js index de6bc7d..de63899 100644 --- a/src/model/BatchQueryRequestsMediaV1.js +++ b/src/model/BatchQueryRequestsMediaV1.js @@ -17,7 +17,7 @@ import BatchQueryRequestMediaV1 from './BatchQueryRequestMediaV1'; /** * The BatchQueryRequestsMediaV1 model module. * @module model/BatchQueryRequestsMediaV1 - * @version 1.4.4 + * @version 1.5.0 */ class BatchQueryRequestsMediaV1 { /** @@ -62,9 +62,37 @@ class BatchQueryRequestsMediaV1 { return obj; } + /** + * Validates the JSON data with respect to BatchQueryRequestsMediaV1. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to BatchQueryRequestsMediaV1. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of BatchQueryRequestsMediaV1.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + if (data['requests']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['requests'])) { + throw new Error("Expected the field `requests` to be an array in the JSON data but got " + data['requests']); + } + // validate the optional field `requests` (array) + for (const item of data['requests']) { + BatchQueryRequestMediaV1.validateJSON(item); + }; + } + + return true; + } + } +BatchQueryRequestsMediaV1.RequiredProperties = ["requests", "resp_version"]; + /** * Requests * @member {Array.} requests diff --git a/src/model/CheckDevicesV2PassPayload.js b/src/model/CheckDevicesV2PassPayload.js index f9191eb..c152847 100644 --- a/src/model/CheckDevicesV2PassPayload.js +++ b/src/model/CheckDevicesV2PassPayload.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The CheckDevicesV2PassPayload model module. * @module model/CheckDevicesV2PassPayload - * @version 1.4.4 + * @version 1.5.0 */ class CheckDevicesV2PassPayload { /** @@ -56,9 +56,31 @@ class CheckDevicesV2PassPayload { return obj; } + /** + * Validates the JSON data with respect to CheckDevicesV2PassPayload. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to CheckDevicesV2PassPayload. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of CheckDevicesV2PassPayload.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['password'] && !(typeof data['password'] === 'string' || data['password'] instanceof String)) { + throw new Error("Expected the field `password` to be a primitive type in the JSON string but got " + data['password']); + } + + return true; + } + } +CheckDevicesV2PassPayload.RequiredProperties = ["password"]; + /** * The password for the device * @member {String} password diff --git a/src/model/CreateDevicesV2CertsPayload.js b/src/model/CreateDevicesV2CertsPayload.js index 8c94f26..58b1479 100644 --- a/src/model/CreateDevicesV2CertsPayload.js +++ b/src/model/CreateDevicesV2CertsPayload.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The CreateDevicesV2CertsPayload model module. * @module model/CreateDevicesV2CertsPayload - * @version 1.4.4 + * @version 1.5.0 */ class CreateDevicesV2CertsPayload { /** @@ -64,9 +64,35 @@ class CreateDevicesV2CertsPayload { return obj; } + /** + * Validates the JSON data with respect to CreateDevicesV2CertsPayload. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to CreateDevicesV2CertsPayload. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of CreateDevicesV2CertsPayload.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['ca'] && !(typeof data['ca'] === 'string' || data['ca'] instanceof String)) { + throw new Error("Expected the field `ca` to be a primitive type in the JSON string but got " + data['ca']); + } + // ensure the json data is a string + if (data['csr'] && !(typeof data['csr'] === 'string' || data['csr'] instanceof String)) { + throw new Error("Expected the field `csr` to be a primitive type in the JSON string but got " + data['csr']); + } + + return true; + } + } +CreateDevicesV2CertsPayload.RequiredProperties = ["csr", "enabled"]; + /** * The Certification Authority you want to use * @member {String} ca diff --git a/src/model/CreateDevicesV2Payload.js b/src/model/CreateDevicesV2Payload.js index f732422..1e54bce 100644 --- a/src/model/CreateDevicesV2Payload.js +++ b/src/model/CreateDevicesV2Payload.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The CreateDevicesV2Payload model module. * @module model/CreateDevicesV2Payload - * @version 1.4.4 + * @version 1.5.0 */ class CreateDevicesV2Payload { /** @@ -75,9 +75,55 @@ class CreateDevicesV2Payload { return obj; } + /** + * Validates the JSON data with respect to CreateDevicesV2Payload. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to CreateDevicesV2Payload. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of CreateDevicesV2Payload.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['connection_type'] && !(typeof data['connection_type'] === 'string' || data['connection_type'] instanceof String)) { + throw new Error("Expected the field `connection_type` to be a primitive type in the JSON string but got " + data['connection_type']); + } + // ensure the json data is a string + if (data['fqbn'] && !(typeof data['fqbn'] === 'string' || data['fqbn'] instanceof String)) { + throw new Error("Expected the field `fqbn` to be a primitive type in the JSON string but got " + data['fqbn']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + // ensure the json data is a string + if (data['serial'] && !(typeof data['serial'] === 'string' || data['serial'] instanceof String)) { + throw new Error("Expected the field `serial` to be a primitive type in the JSON string but got " + data['serial']); + } + // ensure the json data is a string + if (data['type'] && !(typeof data['type'] === 'string' || data['type'] instanceof String)) { + throw new Error("Expected the field `type` to be a primitive type in the JSON string but got " + data['type']); + } + // ensure the json data is a string + if (data['user_id'] && !(typeof data['user_id'] === 'string' || data['user_id'] instanceof String)) { + throw new Error("Expected the field `user_id` to be a primitive type in the JSON string but got " + data['user_id']); + } + // ensure the json data is a string + if (data['wifi_fw_version'] && !(typeof data['wifi_fw_version'] === 'string' || data['wifi_fw_version'] instanceof String)) { + throw new Error("Expected the field `wifi_fw_version` to be a primitive type in the JSON string but got " + data['wifi_fw_version']); + } + + return true; + } + } +CreateDevicesV2Payload.RequiredProperties = ["type"]; + /** * The type of the connections selected by the user when multiple connections are available * @member {module:model/CreateDevicesV2Payload.ConnectionTypeEnum} connection_type @@ -264,7 +310,37 @@ CreateDevicesV2Payload['TypeEnum'] = { * value: "opta" * @const */ - "opta": "opta" + "opta": "opta", + + /** + * value: "giga" + * @const + */ + "giga": "giga", + + /** + * value: "generic_device_secretkey" + * @const + */ + "generic_device_secretkey": "generic_device_secretkey", + + /** + * value: "portenta_c33" + * @const + */ + "portenta_c33": "portenta_c33", + + /** + * value: "unor4wifi" + * @const + */ + "unor4wifi": "unor4wifi", + + /** + * value: "nano_nora" + * @const + */ + "nano_nora": "nano_nora" }; diff --git a/src/model/CreateLoraDevicesV1Payload.js b/src/model/CreateLoraDevicesV1Payload.js index a23e35d..ded6f97 100644 --- a/src/model/CreateLoraDevicesV1Payload.js +++ b/src/model/CreateLoraDevicesV1Payload.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The CreateLoraDevicesV1Payload model module. * @module model/CreateLoraDevicesV1Payload - * @version 1.4.4 + * @version 1.5.0 */ class CreateLoraDevicesV1Payload { /** @@ -90,9 +90,63 @@ class CreateLoraDevicesV1Payload { return obj; } + /** + * Validates the JSON data with respect to CreateLoraDevicesV1Payload. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to CreateLoraDevicesV1Payload. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of CreateLoraDevicesV1Payload.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['app'] && !(typeof data['app'] === 'string' || data['app'] instanceof String)) { + throw new Error("Expected the field `app` to be a primitive type in the JSON string but got " + data['app']); + } + // ensure the json data is a string + if (data['app_eui'] && !(typeof data['app_eui'] === 'string' || data['app_eui'] instanceof String)) { + throw new Error("Expected the field `app_eui` to be a primitive type in the JSON string but got " + data['app_eui']); + } + // ensure the json data is a string + if (data['app_key'] && !(typeof data['app_key'] === 'string' || data['app_key'] instanceof String)) { + throw new Error("Expected the field `app_key` to be a primitive type in the JSON string but got " + data['app_key']); + } + // ensure the json data is a string + if (data['eui'] && !(typeof data['eui'] === 'string' || data['eui'] instanceof String)) { + throw new Error("Expected the field `eui` to be a primitive type in the JSON string but got " + data['eui']); + } + // ensure the json data is a string + if (data['frequency_plan'] && !(typeof data['frequency_plan'] === 'string' || data['frequency_plan'] instanceof String)) { + throw new Error("Expected the field `frequency_plan` to be a primitive type in the JSON string but got " + data['frequency_plan']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + // ensure the json data is a string + if (data['serial'] && !(typeof data['serial'] === 'string' || data['serial'] instanceof String)) { + throw new Error("Expected the field `serial` to be a primitive type in the JSON string but got " + data['serial']); + } + // ensure the json data is a string + if (data['type'] && !(typeof data['type'] === 'string' || data['type'] instanceof String)) { + throw new Error("Expected the field `type` to be a primitive type in the JSON string but got " + data['type']); + } + // ensure the json data is a string + if (data['user_id'] && !(typeof data['user_id'] === 'string' || data['user_id'] instanceof String)) { + throw new Error("Expected the field `user_id` to be a primitive type in the JSON string but got " + data['user_id']); + } + + return true; + } + } +CreateLoraDevicesV1Payload.RequiredProperties = ["app", "eui", "frequency_plan", "name", "type", "user_id"]; + /** * The app name * @member {String} app diff --git a/src/model/Dashboardshare.js b/src/model/Dashboardshare.js index 1d7bbd5..ed85cc4 100644 --- a/src/model/Dashboardshare.js +++ b/src/model/Dashboardshare.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The Dashboardshare model module. * @module model/Dashboardshare - * @version 1.4.4 + * @version 1.5.0 */ class Dashboardshare { /** @@ -57,9 +57,29 @@ class Dashboardshare { return obj; } + /** + * Validates the JSON data with respect to Dashboardshare. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Dashboardshare. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['user_id'] && !(typeof data['user_id'] === 'string' || data['user_id'] instanceof String)) { + throw new Error("Expected the field `user_id` to be a primitive type in the JSON string but got " + data['user_id']); + } + // ensure the json data is a string + if (data['username'] && !(typeof data['username'] === 'string' || data['username'] instanceof String)) { + throw new Error("Expected the field `username` to be a primitive type in the JSON string but got " + data['username']); + } + + return true; + } + } + + /** * The userID of the user you want to share the dashboard with * @member {String} user_id diff --git a/src/model/Dashboardv2.js b/src/model/Dashboardv2.js index e00a673..0123c92 100644 --- a/src/model/Dashboardv2.js +++ b/src/model/Dashboardv2.js @@ -17,7 +17,7 @@ import Widget from './Widget'; /** * The Dashboardv2 model module. * @module model/Dashboardv2 - * @version 1.4.4 + * @version 1.5.0 */ class Dashboardv2 { /** @@ -59,9 +59,35 @@ class Dashboardv2 { return obj; } + /** + * Validates the JSON data with respect to Dashboardv2. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Dashboardv2. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + if (data['widgets']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['widgets'])) { + throw new Error("Expected the field `widgets` to be an array in the JSON data but got " + data['widgets']); + } + // validate the optional field `widgets` (array) + for (const item of data['widgets']) { + Widget.validateJSON(item); + }; + } + + return true; + } + } + + /** * The friendly name of the dashboard * @member {String} name diff --git a/src/model/Devicev2.js b/src/model/Devicev2.js index 2d6b00b..13606a0 100644 --- a/src/model/Devicev2.js +++ b/src/model/Devicev2.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The Devicev2 model module. * @module model/Devicev2 - * @version 1.4.4 + * @version 1.5.0 */ class Devicev2 { /** @@ -73,9 +73,49 @@ class Devicev2 { return obj; } + /** + * Validates the JSON data with respect to Devicev2. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Devicev2. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['connection_type'] && !(typeof data['connection_type'] === 'string' || data['connection_type'] instanceof String)) { + throw new Error("Expected the field `connection_type` to be a primitive type in the JSON string but got " + data['connection_type']); + } + // ensure the json data is a string + if (data['fqbn'] && !(typeof data['fqbn'] === 'string' || data['fqbn'] instanceof String)) { + throw new Error("Expected the field `fqbn` to be a primitive type in the JSON string but got " + data['fqbn']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + // ensure the json data is a string + if (data['serial'] && !(typeof data['serial'] === 'string' || data['serial'] instanceof String)) { + throw new Error("Expected the field `serial` to be a primitive type in the JSON string but got " + data['serial']); + } + // ensure the json data is a string + if (data['type'] && !(typeof data['type'] === 'string' || data['type'] instanceof String)) { + throw new Error("Expected the field `type` to be a primitive type in the JSON string but got " + data['type']); + } + // ensure the json data is a string + if (data['user_id'] && !(typeof data['user_id'] === 'string' || data['user_id'] instanceof String)) { + throw new Error("Expected the field `user_id` to be a primitive type in the JSON string but got " + data['user_id']); + } + // ensure the json data is a string + if (data['wifi_fw_version'] && !(typeof data['wifi_fw_version'] === 'string' || data['wifi_fw_version'] instanceof String)) { + throw new Error("Expected the field `wifi_fw_version` to be a primitive type in the JSON string but got " + data['wifi_fw_version']); + } + + return true; + } + } + + /** * The type of the connections selected by the user when multiple connections are available * @member {module:model/Devicev2.ConnectionTypeEnum} connection_type @@ -262,7 +302,37 @@ Devicev2['TypeEnum'] = { * value: "opta" * @const */ - "opta": "opta" + "opta": "opta", + + /** + * value: "giga" + * @const + */ + "giga": "giga", + + /** + * value: "generic_device_secretkey" + * @const + */ + "generic_device_secretkey": "generic_device_secretkey", + + /** + * value: "portenta_c33" + * @const + */ + "portenta_c33": "portenta_c33", + + /** + * value: "unor4wifi" + * @const + */ + "unor4wifi": "unor4wifi", + + /** + * value: "nano_nora" + * @const + */ + "nano_nora": "nano_nora" }; diff --git a/src/model/Devicev2Cert.js b/src/model/Devicev2Cert.js index 670346d..db1f1d4 100644 --- a/src/model/Devicev2Cert.js +++ b/src/model/Devicev2Cert.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The Devicev2Cert model module. * @module model/Devicev2Cert - * @version 1.4.4 + * @version 1.5.0 */ class Devicev2Cert { /** @@ -60,9 +60,29 @@ class Devicev2Cert { return obj; } + /** + * Validates the JSON data with respect to Devicev2Cert. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Devicev2Cert. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['ca'] && !(typeof data['ca'] === 'string' || data['ca'] instanceof String)) { + throw new Error("Expected the field `ca` to be a primitive type in the JSON string but got " + data['ca']); + } + // ensure the json data is a string + if (data['csr'] && !(typeof data['csr'] === 'string' || data['csr'] instanceof String)) { + throw new Error("Expected the field `csr` to be a primitive type in the JSON string but got " + data['csr']); + } + + return true; + } + } + + /** * The Certification Authority you want to use * @member {String} ca diff --git a/src/model/Devicev2Otabinaryurl.js b/src/model/Devicev2Otabinaryurl.js index 0a3e9a5..170db8f 100644 --- a/src/model/Devicev2Otabinaryurl.js +++ b/src/model/Devicev2Otabinaryurl.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The Devicev2Otabinaryurl model module. * @module model/Devicev2Otabinaryurl - * @version 1.4.4 + * @version 1.5.0 */ class Devicev2Otabinaryurl { /** @@ -62,9 +62,31 @@ class Devicev2Otabinaryurl { return obj; } + /** + * Validates the JSON data with respect to Devicev2Otabinaryurl. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Devicev2Otabinaryurl. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of Devicev2Otabinaryurl.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['binary_key'] && !(typeof data['binary_key'] === 'string' || data['binary_key'] instanceof String)) { + throw new Error("Expected the field `binary_key` to be a primitive type in the JSON string but got " + data['binary_key']); + } + + return true; + } + } +Devicev2Otabinaryurl.RequiredProperties = ["binary_key"]; + /** * If false, wait for the full OTA process, until it gets a result from the device * @member {Boolean} async diff --git a/src/model/Devicev2Pass.js b/src/model/Devicev2Pass.js index 37f2a01..4696eac 100644 --- a/src/model/Devicev2Pass.js +++ b/src/model/Devicev2Pass.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The Devicev2Pass model module. * @module model/Devicev2Pass - * @version 1.4.4 + * @version 1.5.0 */ class Devicev2Pass { /** @@ -54,9 +54,25 @@ class Devicev2Pass { return obj; } + /** + * Validates the JSON data with respect to Devicev2Pass. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Devicev2Pass. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['password'] && !(typeof data['password'] === 'string' || data['password'] instanceof String)) { + throw new Error("Expected the field `password` to be a primitive type in the JSON string but got " + data['password']); + } + + return true; + } + } + + /** * The password for the device * @member {String} password diff --git a/src/model/Error.js b/src/model/Error.js index e60f8ad..dc0e258 100644 --- a/src/model/Error.js +++ b/src/model/Error.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The Error model module. * @module model/Error - * @version 1.4.4 + * @version 1.5.0 */ class Error { /** @@ -67,9 +67,33 @@ class Error { return obj; } + /** + * Validates the JSON data with respect to Error. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Error. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['code'] && !(typeof data['code'] === 'string' || data['code'] instanceof String)) { + throw new Error("Expected the field `code` to be a primitive type in the JSON string but got " + data['code']); + } + // ensure the json data is a string + if (data['detail'] && !(typeof data['detail'] === 'string' || data['detail'] instanceof String)) { + throw new Error("Expected the field `detail` to be a primitive type in the JSON string but got " + data['detail']); + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + + return true; + } + } + + /** * an application-specific error code, expressed as a string value. * @member {String} code diff --git a/src/model/HistoricDataRequest.js b/src/model/HistoricDataRequest.js index 4407386..1175633 100644 --- a/src/model/HistoricDataRequest.js +++ b/src/model/HistoricDataRequest.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The HistoricDataRequest model module. * @module model/HistoricDataRequest - * @version 1.4.4 + * @version 1.5.0 */ class HistoricDataRequest { /** @@ -66,9 +66,31 @@ class HistoricDataRequest { return obj; } + /** + * Validates the JSON data with respect to HistoricDataRequest. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to HistoricDataRequest. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of HistoricDataRequest.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is an array + if (!Array.isArray(data['properties'])) { + throw new Error("Expected the field `properties` to be an array in the JSON data but got " + data['properties']); + } + + return true; + } + } +HistoricDataRequest.RequiredProperties = ["from", "properties", "to"]; + /** * Get data starting from this date * @member {Date} from diff --git a/src/model/PropertiesValue.js b/src/model/PropertiesValue.js index c945fa6..b2c384b 100644 --- a/src/model/PropertiesValue.js +++ b/src/model/PropertiesValue.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The PropertiesValue model module. * @module model/PropertiesValue - * @version 1.4.4 + * @version 1.5.0 */ class PropertiesValue { /** @@ -38,7 +38,7 @@ class PropertiesValue { */ static initialize(obj, name, type, value) { obj['name'] = name; - obj['type'] = type; + obj['type'] = type || 'infer'; obj['value'] = value; } @@ -66,9 +66,35 @@ class PropertiesValue { return obj; } + /** + * Validates the JSON data with respect to PropertiesValue. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to PropertiesValue. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of PropertiesValue.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + // ensure the json data is a string + if (data['type'] && !(typeof data['type'] === 'string' || data['type'] instanceof String)) { + throw new Error("Expected the field `type` to be a primitive type in the JSON string but got " + data['type']); + } + + return true; + } + } +PropertiesValue.RequiredProperties = ["name", "type", "value"]; + /** * The name of the property * @member {String} name diff --git a/src/model/PropertiesValues.js b/src/model/PropertiesValues.js index a0e7129..6f6f660 100644 --- a/src/model/PropertiesValues.js +++ b/src/model/PropertiesValues.js @@ -17,7 +17,7 @@ import PropertiesValue from './PropertiesValue'; /** * The PropertiesValues model module. * @module model/PropertiesValues - * @version 1.4.4 + * @version 1.5.0 */ class PropertiesValues { /** @@ -60,9 +60,37 @@ class PropertiesValues { return obj; } + /** + * Validates the JSON data with respect to PropertiesValues. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to PropertiesValues. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of PropertiesValues.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + if (data['properties']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['properties'])) { + throw new Error("Expected the field `properties` to be an array in the JSON data but got " + data['properties']); + } + // validate the optional field `properties` (array) + for (const item of data['properties']) { + PropertiesValue.validateJSON(item); + }; + } + + return true; + } + } +PropertiesValues.RequiredProperties = ["properties"]; + /** * If true, send property values to device's input topic. * @member {Boolean} input diff --git a/src/model/Property.js b/src/model/Property.js index f919a89..e2a7165 100644 --- a/src/model/Property.js +++ b/src/model/Property.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The Property model module. * @module model/Property - * @version 1.4.4 + * @version 1.5.0 */ class Property { /** @@ -90,9 +90,47 @@ class Property { return obj; } + /** + * Validates the JSON data with respect to Property. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Property. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of Property.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + // ensure the json data is a string + if (data['permission'] && !(typeof data['permission'] === 'string' || data['permission'] instanceof String)) { + throw new Error("Expected the field `permission` to be a primitive type in the JSON string but got " + data['permission']); + } + // ensure the json data is a string + if (data['type'] && !(typeof data['type'] === 'string' || data['type'] instanceof String)) { + throw new Error("Expected the field `type` to be a primitive type in the JSON string but got " + data['type']); + } + // ensure the json data is a string + if (data['update_strategy'] && !(typeof data['update_strategy'] === 'string' || data['update_strategy'] instanceof String)) { + throw new Error("Expected the field `update_strategy` to be a primitive type in the JSON string but got " + data['update_strategy']); + } + // ensure the json data is a string + if (data['variable_name'] && !(typeof data['variable_name'] === 'string' || data['variable_name'] instanceof String)) { + throw new Error("Expected the field `variable_name` to be a primitive type in the JSON string but got " + data['variable_name']); + } + + return true; + } + } +Property.RequiredProperties = ["name", "permission", "type", "update_strategy"]; + /** * Maximum value of this property * @member {Number} max_value diff --git a/src/model/PropertyValue.js b/src/model/PropertyValue.js index 69e98f6..56634b4 100644 --- a/src/model/PropertyValue.js +++ b/src/model/PropertyValue.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The PropertyValue model module. * @module model/PropertyValue - * @version 1.4.4 + * @version 1.5.0 */ class PropertyValue { /** @@ -60,9 +60,31 @@ class PropertyValue { return obj; } + /** + * Validates the JSON data with respect to PropertyValue. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to PropertyValue. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of PropertyValue.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['device_id'] && !(typeof data['device_id'] === 'string' || data['device_id'] instanceof String)) { + throw new Error("Expected the field `device_id` to be a primitive type in the JSON string but got " + data['device_id']); + } + + return true; + } + } +PropertyValue.RequiredProperties = ["value"]; + /** * The device who send the property * @member {String} device_id diff --git a/src/model/Sharerequest.js b/src/model/Sharerequest.js index be0816e..fe0e431 100644 --- a/src/model/Sharerequest.js +++ b/src/model/Sharerequest.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The Sharerequest model module. * @module model/Sharerequest - * @version 1.4.4 + * @version 1.5.0 */ class Sharerequest { /** @@ -54,9 +54,25 @@ class Sharerequest { return obj; } + /** + * Validates the JSON data with respect to Sharerequest. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Sharerequest. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['message'] && !(typeof data['message'] === 'string' || data['message'] instanceof String)) { + throw new Error("Expected the field `message` to be a primitive type in the JSON string but got " + data['message']); + } + + return true; + } + } + + /** * The message the user want to send to the dashboard owner * @member {String} message diff --git a/src/model/Tag.js b/src/model/Tag.js index 1a62556..878a14d 100644 --- a/src/model/Tag.js +++ b/src/model/Tag.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The Tag model module. * @module model/Tag - * @version 1.4.4 + * @version 1.5.0 */ class Tag { /** @@ -61,9 +61,35 @@ class Tag { return obj; } + /** + * Validates the JSON data with respect to Tag. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Tag. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of Tag.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['key'] && !(typeof data['key'] === 'string' || data['key'] instanceof String)) { + throw new Error("Expected the field `key` to be a primitive type in the JSON string but got " + data['key']); + } + // ensure the json data is a string + if (data['value'] && !(typeof data['value'] === 'string' || data['value'] instanceof String)) { + throw new Error("Expected the field `value` to be a primitive type in the JSON string but got " + data['value']); + } + + return true; + } + } +Tag.RequiredProperties = ["key", "value"]; + /** * Key of the tag * @member {String} key diff --git a/src/model/ThingCreate.js b/src/model/ThingCreate.js index d12b5af..a946a7d 100644 --- a/src/model/ThingCreate.js +++ b/src/model/ThingCreate.js @@ -17,7 +17,7 @@ import Property from './Property'; /** * The ThingCreate model module. * @module model/ThingCreate - * @version 1.4.4 + * @version 1.5.0 */ class ThingCreate { /** @@ -74,9 +74,51 @@ class ThingCreate { return obj; } + /** + * Validates the JSON data with respect to ThingCreate. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ThingCreate. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['device_id'] && !(typeof data['device_id'] === 'string' || data['device_id'] instanceof String)) { + throw new Error("Expected the field `device_id` to be a primitive type in the JSON string but got " + data['device_id']); + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + if (data['properties']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['properties'])) { + throw new Error("Expected the field `properties` to be an array in the JSON data but got " + data['properties']); + } + // validate the optional field `properties` (array) + for (const item of data['properties']) { + Property.validateJSON(item); + }; + } + // ensure the json data is a string + if (data['timezone'] && !(typeof data['timezone'] === 'string' || data['timezone'] instanceof String)) { + throw new Error("Expected the field `timezone` to be a primitive type in the JSON string but got " + data['timezone']); + } + // ensure the json data is a string + if (data['webhook_uri'] && !(typeof data['webhook_uri'] === 'string' || data['webhook_uri'] instanceof String)) { + throw new Error("Expected the field `webhook_uri` to be a primitive type in the JSON string but got " + data['webhook_uri']); + } + + return true; + } + } + + /** * The arn of the associated device * @member {String} device_id diff --git a/src/model/ThingSketch.js b/src/model/ThingSketch.js index e900834..b66785f 100644 --- a/src/model/ThingSketch.js +++ b/src/model/ThingSketch.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The ThingSketch model module. * @module model/ThingSketch - * @version 1.4.4 + * @version 1.5.0 */ class ThingSketch { /** @@ -55,9 +55,25 @@ class ThingSketch { return obj; } + /** + * Validates the JSON data with respect to ThingSketch. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ThingSketch. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['sketch_version'] && !(typeof data['sketch_version'] === 'string' || data['sketch_version'] instanceof String)) { + throw new Error("Expected the field `sketch_version` to be a primitive type in the JSON string but got " + data['sketch_version']); + } + + return true; + } + } + + /** * The autogenerated sketch version * @member {module:model/ThingSketch.SketchVersionEnum} sketch_version diff --git a/src/model/ThingUpdate.js b/src/model/ThingUpdate.js index 0559eb0..3eb18d8 100644 --- a/src/model/ThingUpdate.js +++ b/src/model/ThingUpdate.js @@ -17,7 +17,7 @@ import Property from './Property'; /** * The ThingUpdate model module. * @module model/ThingUpdate - * @version 1.4.4 + * @version 1.5.0 */ class ThingUpdate { /** @@ -74,9 +74,51 @@ class ThingUpdate { return obj; } + /** + * Validates the JSON data with respect to ThingUpdate. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ThingUpdate. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['device_id'] && !(typeof data['device_id'] === 'string' || data['device_id'] instanceof String)) { + throw new Error("Expected the field `device_id` to be a primitive type in the JSON string but got " + data['device_id']); + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + if (data['properties']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['properties'])) { + throw new Error("Expected the field `properties` to be an array in the JSON data but got " + data['properties']); + } + // validate the optional field `properties` (array) + for (const item of data['properties']) { + Property.validateJSON(item); + }; + } + // ensure the json data is a string + if (data['timezone'] && !(typeof data['timezone'] === 'string' || data['timezone'] instanceof String)) { + throw new Error("Expected the field `timezone` to be a primitive type in the JSON string but got " + data['timezone']); + } + // ensure the json data is a string + if (data['webhook_uri'] && !(typeof data['webhook_uri'] === 'string' || data['webhook_uri'] instanceof String)) { + throw new Error("Expected the field `webhook_uri` to be a primitive type in the JSON string but got " + data['webhook_uri']); + } + + return true; + } + } + + /** * The arn of the associated device * @member {String} device_id diff --git a/src/model/TimeseriesDataPoint.js b/src/model/TimeseriesDataPoint.js index 5195bc2..3158908 100644 --- a/src/model/TimeseriesDataPoint.js +++ b/src/model/TimeseriesDataPoint.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The TimeseriesDataPoint model module. * @module model/TimeseriesDataPoint - * @version 1.4.4 + * @version 1.5.0 */ class TimeseriesDataPoint { /** @@ -61,9 +61,27 @@ class TimeseriesDataPoint { return obj; } + /** + * Validates the JSON data with respect to TimeseriesDataPoint. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to TimeseriesDataPoint. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of TimeseriesDataPoint.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + + return true; + } + } +TimeseriesDataPoint.RequiredProperties = ["time", "value"]; + /** * Binning timestamp * @member {Date} time diff --git a/src/model/UpdateSketch.js b/src/model/UpdateSketch.js index 006631d..2a11f84 100644 --- a/src/model/UpdateSketch.js +++ b/src/model/UpdateSketch.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The UpdateSketch model module. * @module model/UpdateSketch - * @version 1.4.4 + * @version 1.5.0 */ class UpdateSketch { /** @@ -54,9 +54,25 @@ class UpdateSketch { return obj; } + /** + * Validates the JSON data with respect to UpdateSketch. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to UpdateSketch. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['sketch_version'] && !(typeof data['sketch_version'] === 'string' || data['sketch_version'] instanceof String)) { + throw new Error("Expected the field `sketch_version` to be a primitive type in the JSON string but got " + data['sketch_version']); + } + + return true; + } + } + + /** * The autogenerated sketch version * @member {module:model/UpdateSketch.SketchVersionEnum} sketch_version diff --git a/src/model/Widget.js b/src/model/Widget.js index a4a3362..73ee7cf 100644 --- a/src/model/Widget.js +++ b/src/model/Widget.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The Widget model module. * @module model/Widget - * @version 1.4.4 + * @version 1.5.0 */ class Widget { /** @@ -105,9 +105,43 @@ class Widget { return obj; } + /** + * Validates the JSON data with respect to Widget. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Widget. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of Widget.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + // ensure the json data is a string + if (data['type'] && !(typeof data['type'] === 'string' || data['type'] instanceof String)) { + throw new Error("Expected the field `type` to be a primitive type in the JSON string but got " + data['type']); + } + // ensure the json data is an array + if (!Array.isArray(data['variables'])) { + throw new Error("Expected the field `variables` to be an array in the JSON data but got " + data['variables']); + } + + return true; + } + } +Widget.RequiredProperties = ["height", "id", "options", "type", "width", "x", "y"]; + /** * Widget current height for desktop * @member {Number} height diff --git a/src/model/Widgetlink.js b/src/model/Widgetlink.js index 645f5a6..1ee5576 100644 --- a/src/model/Widgetlink.js +++ b/src/model/Widgetlink.js @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The Widgetlink model module. * @module model/Widgetlink - * @version 1.4.4 + * @version 1.5.0 */ class Widgetlink { /** @@ -54,9 +54,25 @@ class Widgetlink { return obj; } + /** + * Validates the JSON data with respect to Widgetlink. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Widgetlink. + */ + static validateJSON(data) { + // ensure the json data is an array + if (!Array.isArray(data['variables'])) { + throw new Error("Expected the field `variables` to be an array in the JSON data but got " + data['variables']); + } + + return true; + } + } + + /** * @member {Array.} variables */