UNPKG

@xompass/sdk-cloud-api

Version:

Xompass Client for cloud-api

98 lines (92 loc) 2.05 kB
import {ModelDefinition} from './BaseModels'; import {Log} from './Log'; declare var Object: any; export interface KeywordInterface { name: string; description?: string; created?: Date; modified?: Date; deleted?: Date; id?: any; trackingLogs?: Log[]; } export class Keyword implements KeywordInterface { name: string; description: string; created: Date; modified: Date; deleted: Date; id: any; trackingLogs?: Log[]; constructor(data?: KeywordInterface) { Object.assign(this, data); } /** * The name of the model represented by this $resource, * i.e. `Keyword`. */ public static getModelName(): string { return 'Keyword'; } /** * @method factory * @author Jonathan Casarrubias * @license MIT * This method creates an instance of Keyword for dynamic purposes. */ public static factory(data: KeywordInterface): Keyword{ return new Keyword(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: 'Keyword', plural: 'Keywords', path: 'Keywords', idName: 'id', properties: { 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 }, id: { name: 'id', type: 'any' }, }, relations: { trackingLogs: { name: 'trackingLogs', type: 'Log[]', model: 'Log', relationType: 'hasMany', keyFrom: 'id', keyTo: 'trackingModelId' }, } }; } }