UNPKG

@xompass/sdk-cloud-api

Version:

Xompass Client for cloud-api

675 lines (670 loc) 20 kB
import { SDKModels } from './SDKModels'; import { XompassBaseApi, XompassAuth } from '../core'; import { XompassClient } from '../../XompassClient'; import { LoopBackFilter } from '../../models'; import { Device } from '../../models'; import { Customer, DeviceEvent, DeviceToken, EdgeAgent, Log, TelegramChat } from '../../models'; /** * Api services for the `Device` model. */ export abstract class DeviceApi extends XompassBaseApi { public static model = SDKModels.get('Device'); public static getConfig(id: any, refresh: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/: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(), '/Devices/: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(), '/Devices/: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(), '/Devices/:id/config' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static findByIdEvents(id: any, fk: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static updateByIdEvents( id: any, fk: any, data: any = {}, retry = false ): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getToken(id: any, refresh: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/token' ].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 createToken(id: any, data: any = {}, retry = false): Promise<any> { const _method = 'POST'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/token' ].join(''); const _routeParams = { id }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static updateToken(id: any, data: any = {}, retry = false): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/token' ].join(''); const _routeParams = { id }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static destroyToken(id: any, retry = false): Promise<any> { const _method = 'DELETE'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/token' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static findByIdEdgeAgents(id: any, fk: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/edgeAgents/:fk' ].join(''); const _routeParams = { id, fk }; 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(), '/Devices/:id/trackingLogs/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static findByIdTelegramChats(id: any, fk: any, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/telegramChats/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static linkTelegramChats( id: any, fk: any, data: any = {}, retry = false ): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/telegramChats/rel/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static unlinkTelegramChats(id: any, fk: any, retry = false): Promise<any> { const _method = 'DELETE'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/telegramChats/rel/:fk' ].join(''); const _routeParams = { id, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getEvents(id: any, filter: LoopBackFilter = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events' ].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 countEvents(id: any, where: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/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 getEdgeAgents(id: any, filter: LoopBackFilter = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/edgeAgents' ].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 countEdgeAgents(id: any, where: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/edgeAgents/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 getTrackingLogs(id: any, filter: LoopBackFilter = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/: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(), '/Devices/: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 getTelegramChats(id: any, filter: LoopBackFilter = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/telegramChats' ].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 countTelegramChats(id: any, where: any = {}, retry = false): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/telegramChats/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 cmdcRestart(id: any, retry = false): Promise<any> { const _method = 'POST'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/cmdc/restart' ].join(''); const _routeParams = { id }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static cmdcRestartModule(id: any, name: any, retry = false): Promise<any> { const _method = 'POST'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/cmdc/modules/:name/restart' ].join(''); const _routeParams = { id, name }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static findByIdEventsComments( id: any, nk: any, fk: any, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/:nk/comments/:fk' ].join(''); const _routeParams = { id, nk, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static destroyByIdEventsComments( id: any, nk: any, fk: any, retry = false ): Promise<any> { const _method = 'DELETE'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/:nk/comments/:fk' ].join(''); const _routeParams = { id, nk, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static updateByIdEventsComments( id: any, nk: any, fk: any, data: any = {}, retry = false ): Promise<any> { const _method = 'PUT'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/:nk/comments/:fk' ].join(''); const _routeParams = { id, nk, fk }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static findByIdEventsData( id: any, nk: any, fk: any, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/: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 findByIdEventsStateChanges( id: any, nk: any, fk: any, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/:nk/stateChanges/:fk' ].join(''); const _routeParams = { id, nk, fk }; const _postBody = {}; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static getEventsComments( id: any, nk: any, filter: LoopBackFilter = {}, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/:nk/comments' ].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 createEventsComments( id: any, nk: any, data: any = {}, retry = false ): Promise<any> { const _method = 'POST'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/:nk/comments' ].join(''); const _routeParams = { id, nk }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static countEventsComments( id: any, nk: any, where: any = {}, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/:nk/comments/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); } public static getEventsData( id: any, nk: any, filter: LoopBackFilter = {}, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/: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 countEventsData( id: any, nk: any, where: any = {}, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/: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); } public static getEventsStateChanges( id: any, nk: any, filter: LoopBackFilter = {}, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/:nk/stateChanges' ].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 createEventsStateChanges( id: any, nk: any, data: any = {}, retry = false ): Promise<any> { const _method = 'POST'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/:nk/stateChanges' ].join(''); const _routeParams = { id, nk }; const _postBody = data; const _urlParams: any = {}; return super.request(_method, _url, _routeParams, _urlParams, _postBody, retry); } public static countEventsStateChanges( id: any, nk: any, where: any = {}, retry = false ): Promise<any> { const _method = 'GET'; const _url = [ XompassClient.getPath() + '/' + XompassClient.getApiVersion(), '/Devices/:id/events/:nk/stateChanges/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. `Device`. */ public static getModelName(): string { return 'Device'; } }