1
0
mirror of https://github.com/bitwarden/cli synced 2025-12-10 13:23:35 +00:00
Files
cli/src/models/response/cipherResponse.ts
Oscar Hinton 477066118e Add jslib as a "real" dependency (#321)
* Split jslib

* Bump jslib

* Bump jslib, replace alias with tsconfig-paths-webpack-plugin
2021-06-07 19:25:55 +02:00

34 lines
1.2 KiB
TypeScript

import { CipherWithIds } from 'jslib-common/models/export/cipherWithIds';
import { CipherView } from 'jslib-common/models/view/cipherView';
import { BaseResponse } from 'jslib-node/cli/models/response/baseResponse';
import { AttachmentResponse } from './attachmentResponse';
import { LoginResponse } from './loginResponse';
import { PasswordHistoryResponse } from './passwordHistoryResponse';
import { CipherType } from 'jslib-common/enums';
export class CipherResponse extends CipherWithIds implements BaseResponse {
object: string;
attachments: AttachmentResponse[];
revisionDate: Date;
passwordHistory: PasswordHistoryResponse[];
constructor(o: CipherView) {
super();
this.object = 'item';
this.build(o);
if (o.attachments != null) {
this.attachments = o.attachments.map(a => new AttachmentResponse(a));
}
this.revisionDate = o.revisionDate;
if (o.passwordHistory != null) {
this.passwordHistory = o.passwordHistory.map(h => new PasswordHistoryResponse(h));
}
if (o.type === CipherType.Login && o.login != null) {
this.login = new LoginResponse(o.login);
}
}
}