@iotize/tap
Version:
IoTize Device client for Javascript
699 lines (687 loc) • 17.3 kB
JavaScript
import { AbstractService, extendServiceContainer } from '@iotize/tap';
import { TapRequestFrame } from '@iotize/tap/client/api';
import { createEnumConverter, createEnumArrayConverter, converters } from '@iotize/tap/service/core';
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
var CloudPlatform;
(function (CloudPlatform) {
CloudPlatform[CloudPlatform["NO_PLATFORM"] = 0] = "NO_PLATFORM";
CloudPlatform[CloudPlatform["IOTIZE"] = 1] = "IOTIZE";
CloudPlatform[CloudPlatform["IBM_BLUEMIX"] = 2] = "IBM_BLUEMIX";
CloudPlatform[CloudPlatform["AMAZON_AWS"] = 3] = "AMAZON_AWS";
CloudPlatform[CloudPlatform["CUSTOM"] = 4] = "CUSTOM";
})(CloudPlatform || (CloudPlatform = {}));
/**
* Generated file. Do not edit
*/
const cloudPlatform = createEnumConverter(CloudPlatform, 1);
const cloudPlatformArray = createEnumArrayConverter(CloudPlatform, 1);
var serviceConverters = /*#__PURE__*/Object.freeze({
__proto__: null,
cloudPlatform: cloudPlatform,
cloudPlatformArray: cloudPlatformArray
});
/**
* Generated file. Do not edit
*/
const allConverters = Object.assign(Object.assign({}, converters), serviceConverters);
const SERVICE_CALLS = {
getPlatform: {
method: TapRequestFrame.MethodType.GET,
pathAlias: '/cloud/platform',
path: '/1024//26',
responseBodyDecoder: allConverters.cloudPlatform,
},
putPlatform: {
method: TapRequestFrame.MethodType.PUT,
pathAlias: '/cloud/platform',
path: '/1024//26',
bodyEncoder: allConverters.cloudPlatform,
},
getDataLogUploadPeriod: {
method: TapRequestFrame.MethodType.GET,
pathAlias: '/cloud/data-log/upload-period',
path: '/1024//33',
responseBodyDecoder: allConverters.uint32,
},
putDataLogUploadPeriod: {
method: TapRequestFrame.MethodType.PUT,
pathAlias: '/cloud/data-log/upload-period',
path: '/1024//33',
bodyEncoder: allConverters.uint32,
},
getMqttBrokerPort: {
method: TapRequestFrame.MethodType.GET,
pathAlias: '/cloud/mqtt/broker-port',
path: '/1024//61',
responseBodyDecoder: allConverters.ascii,
},
putMqttBrokerPort: {
method: TapRequestFrame.MethodType.PUT,
pathAlias: '/cloud/mqtt/broker-port',
path: '/1024//61',
bodyEncoder: allConverters.ascii,
},
getMqttClientId: {
method: TapRequestFrame.MethodType.GET,
pathAlias: '/cloud/mqtt/client-id',
path: '/1024//27',
responseBodyDecoder: allConverters.ascii,
},
putMqttClientId: {
method: TapRequestFrame.MethodType.PUT,
pathAlias: '/cloud/mqtt/client-id',
path: '/1024//27',
bodyEncoder: allConverters.ascii,
},
getMqttUsername: {
method: TapRequestFrame.MethodType.GET,
pathAlias: '/cloud/mqtt/username',
path: '/1024//28',
responseBodyDecoder: allConverters.ascii,
},
putMqttUsername: {
method: TapRequestFrame.MethodType.PUT,
pathAlias: '/cloud/mqtt/username',
path: '/1024//28',
bodyEncoder: allConverters.ascii,
},
getMqttPassword: {
method: TapRequestFrame.MethodType.GET,
pathAlias: '/cloud/mqtt/password',
path: '/1024//29',
responseBodyDecoder: allConverters.ascii,
},
putMqttPassword: {
method: TapRequestFrame.MethodType.PUT,
pathAlias: '/cloud/mqtt/password',
path: '/1024//29',
bodyEncoder: allConverters.ascii,
},
getDataLogPublishTopic: {
method: TapRequestFrame.MethodType.GET,
pathAlias: '/cloud/data-log/publish-topic',
path: '/1024//68',
responseBodyDecoder: allConverters.ascii,
},
putDataLogPublishTopic: {
method: TapRequestFrame.MethodType.PUT,
pathAlias: '/cloud/data-log/publish-topic',
path: '/1024//68',
bodyEncoder: allConverters.ascii,
},
getDataLogSubscribeTopic: {
method: TapRequestFrame.MethodType.GET,
pathAlias: '/cloud/data-log/subscribe-topic',
path: '/1024//69',
responseBodyDecoder: allConverters.ascii,
},
putDataLogSubscribeTopic: {
method: TapRequestFrame.MethodType.PUT,
pathAlias: '/cloud/data-log/subscribe-topic',
path: '/1024//69',
bodyEncoder: allConverters.ascii,
},
};
class CloudService extends AbstractService {
constructor() {
super(...arguments);
this.resources = SERVICE_CALLS;
}
/**
* Get cloud connection mode
*
* LWM2M path: /1024//26
*
* @tapVersion(">=1.0")
* @return
*/
getPlatform() {
return this.serviceCallRunner.execute(this.getPlatformCall());
}
/**
*
*
* LWM2M path: /1024//26
*
* @tapVersion(">=1.0")
* @return call options
*/
getPlatformCall() {
const callOptions = Object.assign({}, this.resources.getPlatform);
return callOptions;
}
/**
* Write cloud connection mode
*
* LWM2M path: /1024//26
*
* @tapVersion(">=1.0")
* @param key input
* @return
*/
putPlatform(
/*
*
*/
key) {
return this.serviceCallRunner.execute(this.putPlatformCall(key));
}
/**
*
*
* LWM2M path: /1024//26
*
* @tapVersion(">=1.0")
* @param key input
* @return call options
*/
putPlatformCall(
/*
*
*/
key) {
const callOptions = Object.assign({}, this.resources.putPlatform);
callOptions.body = key;
return callOptions;
}
/**
* Uploading period for the cloud
*
* LWM2M path: /1024//33
*
* @tapVersion(">=1.0")
* @return
*/
getDataLogUploadPeriod() {
return this.serviceCallRunner.execute(this.getDataLogUploadPeriodCall());
}
/**
*
*
* LWM2M path: /1024//33
*
* @tapVersion(">=1.0")
* @return call options
*/
getDataLogUploadPeriodCall() {
const callOptions = Object.assign({}, this.resources.getDataLogUploadPeriod);
return callOptions;
}
/**
* Write cloud mqtt period
*
* LWM2M path: /1024//33
*
* @tapVersion(">=1.0")
* @param key input
* @return
*/
putDataLogUploadPeriod(
/*
*
*/
key) {
return this.serviceCallRunner.execute(this.putDataLogUploadPeriodCall(key));
}
/**
*
*
* LWM2M path: /1024//33
*
* @tapVersion(">=1.0")
* @param key input
* @return call options
*/
putDataLogUploadPeriodCall(
/*
*
*/
key) {
const callOptions = Object.assign({}, this.resources.putDataLogUploadPeriod);
callOptions.body = key;
return callOptions;
}
/**
* Get the cloud MQTT broker port
*
* LWM2M path: /1024//61
*
* @tapVersion(">=1.0")
* @return
*/
getMqttBrokerPort() {
return this.serviceCallRunner.execute(this.getMqttBrokerPortCall());
}
/**
*
*
* LWM2M path: /1024//61
*
* @tapVersion(">=1.0")
* @return call options
*/
getMqttBrokerPortCall() {
const callOptions = Object.assign({}, this.resources.getMqttBrokerPort);
return callOptions;
}
/**
* Write cloud MQTT broker port
*
* LWM2M path: /1024//61
*
* @tapVersion(">=1.0")
* @param name input
* @return
*/
putMqttBrokerPort(
/*
*
*/
name) {
return this.serviceCallRunner.execute(this.putMqttBrokerPortCall(name));
}
/**
*
*
* LWM2M path: /1024//61
*
* @tapVersion(">=1.0")
* @param name input
* @return call options
*/
putMqttBrokerPortCall(
/*
*
*/
name) {
const callOptions = Object.assign({}, this.resources.putMqttBrokerPort);
callOptions.body = name;
return callOptions;
}
/**
* Get cloud MQTT client id
*
* LWM2M path: /1024//27
*
* @tapVersion(">=1.0")
* @return
*/
getMqttClientId() {
return this.serviceCallRunner.execute(this.getMqttClientIdCall());
}
/**
*
*
* LWM2M path: /1024//27
*
* @tapVersion(">=1.0")
* @return call options
*/
getMqttClientIdCall() {
const callOptions = Object.assign({}, this.resources.getMqttClientId);
return callOptions;
}
/**
* Write cloud MQTT client id
*
* LWM2M path: /1024//27
*
* @tapVersion(">=1.0")
* @param value input
* @return
*/
putMqttClientId(
/*
*
*/
value) {
return this.serviceCallRunner.execute(this.putMqttClientIdCall(value));
}
/**
*
*
* LWM2M path: /1024//27
*
* @tapVersion(">=1.0")
* @param value input
* @return call options
*/
putMqttClientIdCall(
/*
*
*/
value) {
const callOptions = Object.assign({}, this.resources.putMqttClientId);
callOptions.body = value;
return callOptions;
}
/**
* Get cloud MQTT login id
*
* LWM2M path: /1024//28
*
* @tapVersion(">=1.0")
* @return
*/
getMqttUsername() {
return this.serviceCallRunner.execute(this.getMqttUsernameCall());
}
/**
*
*
* LWM2M path: /1024//28
*
* @tapVersion(">=1.0")
* @return call options
*/
getMqttUsernameCall() {
const callOptions = Object.assign({}, this.resources.getMqttUsername);
return callOptions;
}
/**
* Write cloud MQTT login id
*
* LWM2M path: /1024//28
*
* @tapVersion(">=1.0")
* @param key input
* @return
*/
putMqttUsername(
/*
*
*/
key) {
return this.serviceCallRunner.execute(this.putMqttUsernameCall(key));
}
/**
*
*
* LWM2M path: /1024//28
*
* @tapVersion(">=1.0")
* @param key input
* @return call options
*/
putMqttUsernameCall(
/*
*
*/
key) {
const callOptions = Object.assign({}, this.resources.putMqttUsername);
callOptions.body = key;
return callOptions;
}
/**
* Get cloud MQTT user password
*
* LWM2M path: /1024//29
*
* @tapVersion(">=1.0")
* @return
*/
getMqttPassword() {
return this.serviceCallRunner.execute(this.getMqttPasswordCall());
}
/**
*
*
* LWM2M path: /1024//29
*
* @tapVersion(">=1.0")
* @return call options
*/
getMqttPasswordCall() {
const callOptions = Object.assign({}, this.resources.getMqttPassword);
return callOptions;
}
/**
* Write cloud MQTT user password
*
* LWM2M path: /1024//29
*
* @tapVersion(">=1.0")
* @param key input
* @return
*/
putMqttPassword(
/*
*
*/
key) {
return this.serviceCallRunner.execute(this.putMqttPasswordCall(key));
}
/**
*
*
* LWM2M path: /1024//29
*
* @tapVersion(">=1.0")
* @param key input
* @return call options
*/
putMqttPasswordCall(
/*
*
*/
key) {
const callOptions = Object.assign({}, this.resources.putMqttPassword);
callOptions.body = key;
return callOptions;
}
/**
* Get cloud data log public topic
*
* LWM2M path: /1024//68
*
* @tapVersion(">=1.0")
* @return
*/
getDataLogPublishTopic() {
return this.serviceCallRunner.execute(this.getDataLogPublishTopicCall());
}
/**
*
*
* LWM2M path: /1024//68
*
* @tapVersion(">=1.0")
* @return call options
*/
getDataLogPublishTopicCall() {
const callOptions = Object.assign({}, this.resources.getDataLogPublishTopic);
return callOptions;
}
/**
* Write cloud data log publish topic
*
* LWM2M path: /1024//68
*
* @tapVersion(">=1.0")
* @param key input
* @return
*/
putDataLogPublishTopic(
/*
*
*/
key) {
return this.serviceCallRunner.execute(this.putDataLogPublishTopicCall(key));
}
/**
*
*
* LWM2M path: /1024//68
*
* @tapVersion(">=1.0")
* @param key input
* @return call options
*/
putDataLogPublishTopicCall(
/*
*
*/
key) {
const callOptions = Object.assign({}, this.resources.putDataLogPublishTopic);
callOptions.body = key;
return callOptions;
}
/**
* Get cloud data log subscribe topic
*
* LWM2M path: /1024//69
*
* @tapVersion(">=1.0")
* @return
*/
getDataLogSubscribeTopic() {
return this.serviceCallRunner.execute(this.getDataLogSubscribeTopicCall());
}
/**
*
*
* LWM2M path: /1024//69
*
* @tapVersion(">=1.0")
* @return call options
*/
getDataLogSubscribeTopicCall() {
const callOptions = Object.assign({}, this.resources.getDataLogSubscribeTopic);
return callOptions;
}
/**
* Write cloud data log subscribe topic
*
* LWM2M path: /1024//69
*
* @tapVersion(">=1.0")
* @param key input
* @return
*/
putDataLogSubscribeTopic(
/*
*
*/
key) {
return this.serviceCallRunner.execute(this.putDataLogSubscribeTopicCall(key));
}
/**
*
*
* LWM2M path: /1024//69
*
* @tapVersion(">=1.0")
* @param key input
* @return call options
*/
putDataLogSubscribeTopicCall(
/*
*
*/
key) {
const callOptions = Object.assign({}, this.resources.putDataLogSubscribeTopic);
callOptions.body = key;
return callOptions;
}
}
const _TAP_SERVICE_EXTENSION_CLOUD_ = extendServiceContainer('cloud', CloudService);
/**
* Generated file. Do not edit
*/
/**
* Generated file. Do not edit
*/
/**
* Generated file. Do not edit
*/
const ResourceMetaData = {
'/cloud/platform': {
put: {
minApiVersion: 1.0,
configModeRequired: false,
schema: {
$ref: './definitions.yaml#/CloudPlatform',
},
},
},
'/cloud/data-log/upload-period': {
put: {
minApiVersion: 1.0,
configModeRequired: false,
schema: {
type: 'integer',
format: 'uint32',
},
},
},
'/cloud/mqtt/broker-port': {
put: {
minApiVersion: 1.0,
configModeRequired: false,
schema: {
type: 'string',
maxLength: 32,
},
},
},
'/cloud/mqtt/client-id': {
put: {
minApiVersion: 1.0,
configModeRequired: false,
schema: {
type: 'string',
maxLength: 32,
},
},
},
'/cloud/mqtt/username': {
put: {
minApiVersion: 1.0,
configModeRequired: false,
schema: {
type: 'string',
maxLength: 32,
},
},
},
'/cloud/mqtt/password': {
put: {
minApiVersion: 1.0,
configModeRequired: false,
schema: {
type: 'string',
maxLength: 32,
},
},
},
'/cloud/data-log/publish-topic': {
put: {
minApiVersion: 1.0,
configModeRequired: false,
schema: {
type: 'string',
maxLength: 32,
},
},
},
'/cloud/data-log/subscribe-topic': {
put: {
minApiVersion: 1.0,
configModeRequired: false,
schema: {
type: 'string',
maxLength: 128,
},
},
},
};
/**
* Generated bundle index. Do not edit.
*/
export { SERVICE_CALLS as CLOUD_SERVICE_CALLS, CloudPlatform, ResourceMetaData as CloudResourceMetaData, CloudService, _TAP_SERVICE_EXTENSION_CLOUD_, serviceConverters as cloudConverters };
//# sourceMappingURL=iotize-tap-service-impl-cloud.js.map