UNPKG

@xompass/sdk-cloud-api

Version:

Xompass Client for cloud-api

188 lines (182 loc) 4.33 kB
import {ModelDefinition} from './BaseModels'; import {Log} from './Log'; import {Admin} from './Admin'; import {Customer} from './Customer'; import {Country} from './Country'; import {ToolkitTemplate} from './ToolkitTemplate'; import {Toolkit} from './Toolkit'; declare var Object: any; export interface VarInterface { name: string; businessName?: string; description?: string; address?: string; created?: Date; modified?: Date; deleted?: Date; id?: any; countryId?: any; toolkitTemplateIds?: Array<any>; trackingLogs?: Log[]; admins?: Admin[]; customers?: Customer[]; country?: Country; toolkitTemplates?: ToolkitTemplate[]; toolkits?: Toolkit[]; container?: any; } export class Var implements VarInterface { name: string; businessName: string; description: string; address: string; created: Date; modified: Date; deleted: Date; id: any; countryId: any; toolkitTemplateIds: Array<any> = []; trackingLogs?: Log[]; admins?: Admin[]; customers?: Customer[]; country?: Country; toolkitTemplates?: ToolkitTemplate[]; toolkits?: Toolkit[]; container?: any; constructor(data?: VarInterface) { Object.assign(this, data); } /** * The name of the model represented by this $resource, * i.e. `Var`. */ public static getModelName(): string { return 'Var'; } /** * @method factory * @author Jonathan Casarrubias * @license MIT * This method creates an instance of Var for dynamic purposes. */ public static factory(data: VarInterface): Var{ return new Var(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: 'Var', plural: 'Vars', path: 'Vars', idName: 'id', properties: { name: { name: 'name', type: 'string' }, businessName: { name: 'businessName', type: 'string' }, description: { name: 'description', type: 'string' }, address: { name: 'address', type: 'string' }, created: { name: 'created', type: 'Date' }, modified: { name: 'modified', type: 'Date' }, deleted: { name: 'deleted', type: 'Date', default: undefined }, id: { name: 'id', type: 'any' }, countryId: { name: 'countryId', type: 'any' }, toolkitTemplateIds: { name: 'toolkitTemplateIds', type: 'Array&lt;any&gt;', default: [] }, }, relations: { trackingLogs: { name: 'trackingLogs', type: 'Log[]', model: 'Log', relationType: 'hasMany', keyFrom: 'id', keyTo: 'trackingModelId' }, admins: { name: 'admins', type: 'Admin[]', model: 'Admin', relationType: 'hasMany', keyFrom: 'id', keyTo: 'varId' }, customers: { name: 'customers', type: 'Customer[]', model: 'Customer', relationType: 'hasMany', keyFrom: 'id', keyTo: 'varId' }, country: { name: 'country', type: 'Country', model: 'Country', relationType: 'belongsTo', keyFrom: 'countryId', keyTo: 'id' }, toolkitTemplates: { name: 'toolkitTemplates', type: 'ToolkitTemplate[]', model: 'ToolkitTemplate', relationType: 'referencesMany', keyFrom: 'toolkitTemplateIds', keyTo: 'id' }, toolkits: { name: 'toolkits', type: 'Toolkit[]', model: 'Toolkit', relationType: 'hasMany', keyFrom: 'id', keyTo: 'varId' }, container: { name: 'container', type: 'any', model: '', relationType: 'hasOne', keyFrom: 'id', keyTo: 'varId' }, } }; } }