UNPKG

@xompass/sdk-cloud-api

Version:

Xompass Client for cloud-api

188 lines (182 loc) 4.43 kB
import {ModelDefinition} from './BaseModels'; import {Asset} from './Asset'; import {Admin} from './Admin'; import {Customer} from './Customer'; import {Log} from './Log'; import {Manager} from './Manager'; import {Project} from './Project'; declare var Object: any; export interface CredentialInterface { identifier?: string; name: string; description?: string; type: string; namespace: string; content: any; created?: Date; modified?: Date; deleted?: Date; id?: any; assets?: Asset[]; admins?: Admin[]; customers?: Customer[]; trackingLogs?: Log[]; managers?: Manager[]; projects?: Project[]; } export class Credential implements CredentialInterface { identifier: string; name: string; description: string; type: string; namespace: string = 'Default'; content: any; created: Date; modified: Date; deleted: Date; id: any; assets?: Asset[]; admins?: Admin[]; customers?: Customer[]; trackingLogs?: Log[]; managers?: Manager[]; projects?: Project[]; constructor(data?: CredentialInterface) { Object.assign(this, data); } /** * The name of the model represented by this $resource, * i.e. `Credential`. */ public static getModelName(): string { return 'Credential'; } /** * @method factory * @author Jonathan Casarrubias * @license MIT * This method creates an instance of Credential for dynamic purposes. */ public static factory(data: CredentialInterface): Credential{ return new Credential(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: 'Credential', plural: 'Credentials', path: 'Credentials', idName: 'id', properties: { identifier: { name: 'identifier', type: 'string' }, name: { name: 'name', type: 'string' }, description: { name: 'description', type: 'string' }, type: { name: 'type', type: 'string' }, namespace: { name: 'namespace', type: 'string', default: 'Default' }, content: { name: 'content', type: 'any' }, created: { name: 'created', type: 'Date' }, modified: { name: 'modified', type: 'Date' }, deleted: { name: 'deleted', type: 'Date', default: undefined }, id: { name: 'id', type: 'any' }, }, relations: { assets: { name: 'assets', type: 'Asset[]', model: 'Asset', relationType: 'hasMany', modelThrough: 'CredentialAsset', keyThrough: 'assetId', keyFrom: 'id', keyTo: 'credentialId' }, admins: { name: 'admins', type: 'Admin[]', model: 'Admin', relationType: 'hasMany', modelThrough: 'CredentialAdmin', keyThrough: 'adminId', keyFrom: 'id', keyTo: 'credentialId' }, customers: { name: 'customers', type: 'Customer[]', model: 'Customer', relationType: 'hasMany', modelThrough: 'CredentialCustomer', keyThrough: 'customerId', keyFrom: 'id', keyTo: 'credentialId' }, trackingLogs: { name: 'trackingLogs', type: 'Log[]', model: 'Log', relationType: 'hasMany', keyFrom: 'id', keyTo: 'trackingModelId' }, managers: { name: 'managers', type: 'Manager[]', model: 'Manager', relationType: 'hasMany', modelThrough: 'CredentialManager', keyThrough: 'managerId', keyFrom: 'id', keyTo: 'credentialId' }, projects: { name: 'projects', type: 'Project[]', model: 'Project', relationType: 'hasMany', modelThrough: 'CredentialProject', keyThrough: 'projectId', keyFrom: 'id', keyTo: 'credentialId' }, } }; } }