1
0
mirror of https://github.com/bitwarden/jslib synced 2026-01-15 06:53:38 +00:00
Files
jslib/src/models/response/syncResponse.ts
2018-07-06 12:40:43 -04:00

42 lines
1.3 KiB
TypeScript

import { CipherResponse } from './cipherResponse';
import { CollectionDetailsResponse } from './collectionResponse';
import { DomainsResponse } from './domainsResponse';
import { FolderResponse } from './folderResponse';
import { ProfileResponse } from './profileResponse';
export class SyncResponse {
profile?: ProfileResponse;
folders: FolderResponse[] = [];
collections: CollectionDetailsResponse[] = [];
ciphers: CipherResponse[] = [];
domains?: DomainsResponse;
constructor(response: any) {
if (response.Profile) {
this.profile = new ProfileResponse(response.Profile);
}
if (response.Folders) {
response.Folders.forEach((folder: any) => {
this.folders.push(new FolderResponse(folder));
});
}
if (response.Collections) {
response.Collections.forEach((collection: any) => {
this.collections.push(new CollectionDetailsResponse(collection));
});
}
if (response.Ciphers) {
response.Ciphers.forEach((cipher: any) => {
this.ciphers.push(new CipherResponse(cipher));
});
}
if (response.Domains) {
this.domains = new DomainsResponse(response.Domains);
}
}
}