import { HALConfig } from '../hal.config'; import { InviteCollection } from './invite.collection'; import { InviteConverter } from './invite.converter'; export class InviteCollectionConverter { public constructor(private converter: InviteConverter) { } public toCollection(json: any): InviteCollection { const collection: InviteCollection = new InviteCollection(); collection.count = json['count']; collection.total = json['total']; if (json[HALConfig.embedded] && json[HALConfig.embedded]['invites']) { collection.invites = this.converter.toMany(json[HALConfig.embedded]['invites']); } return collection; } }