UNPKG

@xompass/sdk-cloud-api

Version:

Xompass Client for cloud-api

151 lines (145 loc) 3.25 kB
import {ModelDefinition} from './BaseModels'; import {Customer} from './Customer'; import {Log} from './Log'; declare var Object: any; export interface AgentInterface { name?: string; description?: string; enabled?: boolean; sendInterval?: string; testMode?: boolean; dataMode?: string; responsible?: Array<any>; notification?: any; created?: Date; modified?: Date; deleted?: Date; id?: any; customerId?: any; customer?: Customer; trackingLogs?: Log[]; } export class Agent implements AgentInterface { name: string; description: string; enabled: boolean; sendInterval: string; testMode: boolean; dataMode: string; responsible: Array<any>; notification: any; created: Date; modified: Date; deleted: Date; id: any; customerId: any; customer?: Customer; trackingLogs?: Log[]; constructor(data?: AgentInterface) { Object.assign(this, data); } /** * The name of the model represented by this $resource, * i.e. `Agent`. */ public static getModelName(): string { return 'Agent'; } /** * @method factory * @author Jonathan Casarrubias * @license MIT * This method creates an instance of Agent for dynamic purposes. */ public static factory(data: AgentInterface): Agent{ return new Agent(data); } /** * @method getModelDefinition * @author Julien Ledun * @license MIT * This method returns an object that represents some of the model * definitions. */ public static getModelDefinition(): ModelDefinition { return { name: 'Agent', plural: 'Agents', path: 'Agents', idName: 'id', properties: { name: { name: 'name', type: 'string' }, description: { name: 'description', type: 'string' }, enabled: { name: 'enabled', type: 'boolean' }, sendInterval: { name: 'sendInterval', type: 'string' }, testMode: { name: 'testMode', type: 'boolean' }, dataMode: { name: 'dataMode', type: 'string' }, responsible: { name: 'responsible', type: 'Array&lt;any&gt;' }, notification: { name: 'notification', type: 'any' }, created: { name: 'created', type: 'Date' }, modified: { name: 'modified', type: 'Date' }, deleted: { name: 'deleted', type: 'Date', default: undefined }, id: { name: 'id', type: 'any' }, customerId: { name: 'customerId', type: 'any' }, }, relations: { customer: { name: 'customer', type: 'Customer', model: 'Customer', relationType: 'belongsTo', keyFrom: 'customerId', keyTo: 'id' }, trackingLogs: { name: 'trackingLogs', type: 'Log[]', model: 'Log', relationType: 'hasMany', keyFrom: 'id', keyTo: 'trackingModelId' }, } }; } }