UNPKG

@xompass/sdk-cloud-api

Version:

Xompass Client for cloud-api

472 lines (467 loc) 15.1 kB
import { SDKModels } from './SDKModels'; import { XompassBaseApi, XompassAuth } from '../core'; import { XompassClient } from '../../XompassClient'; import { LoopBackFilter } from '../../models'; import { AssetTemplate } from '../../models'; import { AssetStateTemplate, AssetWizardType, Admin, Customer, EventGroupTemplate, EventTriggerTemplate, Log, Manager, Project, SensorTemplate } from '../../models'; /** * Api services for the `AssetTemplate` model. */ export abstract class AssetTemplateApi extends XompassBaseApi { public static model = SDKModels.get('AssetTemplate'); public static getConfig(id: any, refresh: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/config' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; if (typeof refresh !== 'undefined' && refresh !== null) { _urlParams['refresh'] = refresh; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static createConfig(id: any, data: any = {}, retry = false): Promise<any> { const _method = 'POST'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/config' ].join(''); const _routeParams = { id }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static updateConfig(id: any, data: any = {}, retry = false): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/config' ].join(''); const _routeParams = { id }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static destroyConfig(id: any, retry = false): Promise<any> { const _method = 'DELETE'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/config' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getContainer(id: any, refresh: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/container' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; if (typeof refresh !== 'undefined' && refresh !== null) { _urlParams['refresh'] = refresh; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static createContainer(id: any, data: any = {}, retry = false): Promise<any> { const _method = 'POST'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/container' ].join(''); const _routeParams = { id }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static updateContainer(id: any, data: any = {}, retry = false): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/container' ].join(''); const _routeParams = { id }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static destroyContainer(id: any, retry = false): Promise<any> { const _method = 'DELETE'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/container' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static findByIdTrackingLogs(id: any, fk: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/trackingLogs/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getProject(id: any, refresh: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/project' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; if (typeof refresh !== 'undefined' && refresh !== null) { _urlParams['refresh'] = refresh; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static findByIdSensorTemplates(id: any, fk: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/sensorTemplates/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static updateByIdSensorTemplates( id: any, fk: any, data: any = {}, retry = false ): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/sensorTemplates/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getTrackingLogs(id: any, filter: LoopBackFilter = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/trackingLogs' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; if (typeof filter !== 'undefined' && filter !== null) { _urlParams['filter'] = filter; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static countTrackingLogs(id: any, where: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/trackingLogs/count' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; if (typeof where !== 'undefined' && where !== null) { _urlParams['where'] = where; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getSensorTemplates(id: any, filter: LoopBackFilter = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/sensorTemplates' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; if (typeof filter !== 'undefined' && filter !== null) { _urlParams['filter'] = filter; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static createSensorTemplates(id: any, data: any = {}, retry = false): Promise<any> { const _method = 'POST'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/sensorTemplates' ].join(''); const _routeParams = { id }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static countSensorTemplates(id: any, where: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/sensorTemplates/count' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; if (typeof where !== 'undefined' && where !== null) { _urlParams['where'] = where; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static subscribe(id: any, socketId: any, retry = false): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/sockets/:socketId/subscribe' ].join(''); const _routeParams = { id, socketId }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static unsubscribe(id: any, socketId: any, retry = false): Promise<any> { const _method = 'DELETE'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/sockets/:socketId/unsubscribe' ].join(''); const _routeParams = { id, socketId }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getContainerInfo(id: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/container/info' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getFiles(id: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/container/files' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getFile(id: any, file: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/container/files/:file' ].join(''); const _routeParams = { id, file }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static removeFile( id: any, property: any, file: any, retry = false ): Promise<any> { const _method = 'DELETE'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/container/files/:file' ].join(''); const _routeParams = { id, file }; const _postBody = {}; const _urlParams: any = {}; if (typeof property !== 'undefined' && property !== null) { _urlParams['property'] = property; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static upload(id: any, property: any, retry = false): Promise<any> { const _method = 'POST'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/container/upload' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; if (typeof property !== 'undefined' && property !== null) { _urlParams['property'] = property; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static download( id: any, property: any, file: any, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/container/download/:file' ].join(''); const _routeParams = { id, file }; const _postBody = {}; const _urlParams: any = {}; if (typeof property !== 'undefined' && property !== null) { _urlParams['property'] = property; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static instantiate(id: any, options: any = {}, retry = false): Promise<any> { const _method = 'POST'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/instantiate' ].join(''); const _routeParams = { id }; const _postBody = options ; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getAssetStateTemplatesEventTriggerAssetStateTemplates( id: any, nk: any, filter: LoopBackFilter = {}, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/assetStateTemplates/:nk/eventTriggerAssetStateTemplates' ].join(''); const _routeParams = { id, nk }; const _postBody = {}; const _urlParams: any = {}; if (typeof filter !== 'undefined' && filter !== null) { _urlParams['filter'] = filter; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getAssetStateTemplatesStateTemplates( id: any, nk: any, filter: LoopBackFilter = {}, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/AssetTemplates/:id/assetStateTemplates/:nk/stateTemplates' ].join(''); const _routeParams = { id, nk }; const _postBody = {}; const _urlParams: any = {}; if (typeof filter !== 'undefined' && filter !== null) { _urlParams['filter'] = filter; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } /** * The name of the model represented by this $resource, * i.e. `AssetTemplate`. */ public static getModelName(): string { return 'AssetTemplate'; } }