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