UNPKG

@xompass/sdk-cloud-api

Version:

Xompass Client for cloud-api

796 lines (791 loc) 24.3 kB
import { SDKModels } from './SDKModels'; import { XompassBaseApi, XompassAuth } from '../core'; import { XompassClient } from '../../XompassClient'; import { LoopBackFilter } from '../../models'; import { Sensor } from '../../models'; import { Log, Asset, Dataset, Alert, AlertHistory, RateLimit, SensorAssetState, AssetState, SensorTemplate, SensorUptime, SensorUptimeCollector, Summary } from '../../models'; /** * Api services for the `Sensor` model. */ export abstract class SensorApi extends XompassBaseApi { public static model = SDKModels.get('Sensor'); public static findByIdTrackingLogs(id: any, fk: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/trackingLogs/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getAsset(id: any, refresh: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/asset' ].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 findByIdDatasets(id: any, fk: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/datasets/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static updateByIdDatasets( id: any, fk: any, data: any = {}, retry = false ): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/datasets/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static findByIdAlerts(id: any, fk: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/alerts/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static updateByIdAlerts( id: any, fk: any, data: any = {}, retry = false ): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/alerts/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static findByIdAlertHistory(id: any, fk: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/alertHistory/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static updateByIdAlertHistory( id: any, fk: any, data: any = {}, retry = false ): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/alertHistory/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getLastData(id: any, refresh: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/lastData' ].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 destroyLastData(id: any, retry = false): Promise<any> { const _method = 'DELETE'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/lastData' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getRateLimit(id: any, refresh: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/rateLimit' ].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 createRateLimit(id: any, data: any = {}, retry = false): Promise<any> { const _method = 'POST'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/rateLimit' ].join(''); const _routeParams = { id }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static updateRateLimit(id: any, data: any = {}, retry = false): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/rateLimit' ].join(''); const _routeParams = { id }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static findByIdAssetStates(id: any, fk: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/assetStates/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static linkAssetStates( id: any, fk: any, data: any = {}, retry = false ): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/assetStates/rel/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static unlinkAssetStates(id: any, fk: any, retry = false): Promise<any> { const _method = 'DELETE'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/assetStates/rel/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static existsAssetStates(id: any, fk: any, retry = false): Promise<any> { const _method = 'HEAD'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/assetStates/rel/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static findByIdStates(id: any, fk: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/states/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static updateByIdStates( id: any, fk: any, data: any = {}, retry = false ): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/states/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static findByIdSummaries(id: any, fk: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/summaries/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; 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(), '/Sensors/: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(), '/Sensors/: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 getDatasets(id: any, filter: LoopBackFilter = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/datasets' ].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 createDatasets(id: any, data: any = {}, retry = false): Promise<any> { const _method = 'POST'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/datasets' ].join(''); const _routeParams = { id }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static countDatasets(id: any, where: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/datasets/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 getAlerts(id: any, filter: LoopBackFilter = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/alerts' ].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 countAlerts(id: any, where: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/alerts/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 getAlertHistory(id: any, filter: LoopBackFilter = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/alertHistory' ].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 countAlertHistory(id: any, where: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/alertHistory/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 getAssetStates(id: any, filter: LoopBackFilter = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/assetStates' ].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 countAssetStates(id: any, where: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/assetStates/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 getStates(id: any, filter: LoopBackFilter = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/states' ].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 countStates(id: any, where: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/states/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 getSummaries(id: any, filter: LoopBackFilter = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/summaries' ].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 countSummaries(id: any, where: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/summaries/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 downloadDatasets( id: any, nk: any, file: any, datasourceName: any = {}, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/datasets/:nk/download/:file' ].join(''); const _routeParams = { id, nk, file }; const _postBody = {}; const _urlParams: any = {}; if (typeof datasourceName !== 'undefined' && datasourceName !== null) { _urlParams['datasourceName'] = datasourceName; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getSignedUrlDatasets( id: any, nk: any, file: any, datasourceName: any = {}, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/datasets/:nk/signed-url/:file' ].join(''); const _routeParams = { id, nk, file }; const _postBody = {}; const _urlParams: any = {}; if (typeof datasourceName !== 'undefined' && datasourceName !== null) { _urlParams['datasourceName'] = datasourceName; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static lastData(id: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/data/last' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getCurrentState(id: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/currentState' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static withCurrentState(id: any, filter: LoopBackFilter = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/withCurrentState' ].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 findByIdDatasetsData( id: any, nk: any, fk: any, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/datasets/:nk/data/:fk' ].join(''); const _routeParams = { id, nk, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static destroyByIdDatasetsData( id: any, nk: any, fk: any, retry = false ): Promise<any> { const _method = 'DELETE'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/datasets/:nk/data/:fk' ].join(''); const _routeParams = { id, nk, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static updateByIdDatasetsData( id: any, nk: any, fk: any, data: any = {}, retry = false ): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/datasets/:nk/data/:fk' ].join(''); const _routeParams = { id, nk, fk }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getDatasetsData( id: any, nk: any, filter: LoopBackFilter = {}, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/datasets/:nk/data' ].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 createDatasetsData( id: any, nk: any, data: any = {}, retry = false ): Promise<any> { const _method = 'POST'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/datasets/:nk/data' ].join(''); const _routeParams = { id, nk }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static countDatasetsData( id: any, nk: any, where: any = {}, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Sensors/:id/datasets/:nk/data/count' ].join(''); const _routeParams = { id, nk }; const _postBody = {}; const _urlParams: any = {}; if (typeof where !== 'undefined' && where !== null) { _urlParams['where'] = where; } return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } /** * The name of the model represented by this $resource, * i.e. `Sensor`. */ public static getModelName(): string { return 'Sensor'; } }