@xompass/sdk-cloud-api
Version:
Xompass Client for cloud-api
120 lines (114 loc) • 2.73 kB
text/typescript
import {ModelDefinition} from './BaseModels';
import {Log} from './Log';
declare var Object: any;
export interface DeviceEventStateChangeInterface {
id?: string;
name: string;
description?: string;
created?: Date;
modified?: Date;
deleted?: Date;
userId?: string;
principalType?: string;
user?: any;
trackingLogs?: Log[];
}
export class DeviceEventStateChange implements DeviceEventStateChangeInterface {
id: string;
name: string;
description: string;
created: Date;
modified: Date;
deleted: Date;
userId: string;
principalType: string;
user?: any;
trackingLogs?: Log[];
constructor(data?: DeviceEventStateChangeInterface) {
Object.assign(this, data);
}
/**
* The name of the model represented by this $resource,
* i.e. `DeviceEventStateChange`.
*/
public static getModelName(): string {
return 'DeviceEventStateChange';
}
/**
* @method factory
* @author Jonathan Casarrubias
* @license MIT
* This method creates an instance of DeviceEventStateChange for dynamic purposes.
*/
public static factory(data: DeviceEventStateChangeInterface): DeviceEventStateChange{
return new DeviceEventStateChange(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: 'DeviceEventStateChange',
plural: 'DeviceEventStateChanges',
path: 'DeviceEventStateChanges',
idName: 'id',
properties: {
id: {
name: 'id',
type: 'string'
},
name: {
name: 'name',
type: 'string'
},
description: {
name: 'description',
type: 'string'
},
created: {
name: 'created',
type: 'Date'
},
modified: {
name: 'modified',
type: 'Date'
},
deleted: {
name: 'deleted',
type: 'Date',
default: undefined
},
userId: {
name: 'userId',
type: 'string'
},
principalType: {
name: 'principalType',
type: 'string'
},
},
relations: {
user: {
name: 'user',
type: 'any',
model: '',
relationType: 'belongsTo',
keyFrom: 'userId',
keyTo: 'id'
},
trackingLogs: {
name: 'trackingLogs',
type: 'Log[]',
model: 'Log',
relationType: 'hasMany',
keyFrom: 'id',
keyTo: 'trackingModelId'
},
}
};
}
}