1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 01:33:33 +00:00

refactor for login uris and response model changes

This commit is contained in:
Kyle Spearrin
2018-03-01 23:44:29 -05:00
parent 52f3ea58d1
commit 063bb010db
27 changed files with 405 additions and 102 deletions

View File

@@ -1,14 +1,26 @@
import { AttachmentResponse } from './attachmentResponse';
import { CardApi } from '../api/cardApi';
import { FieldApi } from '../api/fieldApi';
import { IdentityApi } from '../api/identityApi';
import { LoginApi } from '../api/loginApi';
import { SecureNoteApi } from '../api/secureNoteApi';
export class CipherResponse {
id: string;
organizationId: string;
folderId: string;
type: number;
name: string;
notes: string;
fields: FieldApi[];
login: LoginApi;
card: CardApi;
identity: IdentityApi;
secureNote: SecureNoteApi;
favorite: boolean;
edit: boolean;
organizationUseTotp: boolean;
data: any;
revisionDate: string;
attachments: AttachmentResponse[];
collectionIds: string[];
@@ -18,12 +30,36 @@ export class CipherResponse {
this.organizationId = response.OrganizationId;
this.folderId = response.FolderId;
this.type = response.Type;
this.name = response.Name;
this.notes = response.Notes;
this.favorite = response.Favorite;
this.edit = response.Edit;
this.organizationUseTotp = response.OrganizationUseTotp;
this.data = response.Data;
this.revisionDate = response.RevisionDate;
if (response.Login != null) {
this.login = new LoginApi(response.Login);
}
if (response.Card != null) {
this.card = new CardApi(response.Card);
}
if (response.Identity != null) {
this.identity = new IdentityApi(response.Identity);
}
if (response.SecureNote != null) {
this.secureNote = new SecureNoteApi(response.SecureNote);
}
if (response.Fields != null) {
this.fields = [];
response.Fields.forEach((field: any) => {
this.fields.push(new FieldApi(field));
});
}
if (response.Attachments != null) {
this.attachments = [];
response.Attachments.forEach((attachment: any) => {