1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +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

17
src/models/api/cardApi.ts Normal file
View File

@@ -0,0 +1,17 @@
export class CardApi {
cardholderName: string;
brand: string;
number: string;
expMonth: string;
expYear: string;
code: string;
constructor(data: any) {
this.cardholderName = data.CardholderName;
this.brand = data.Brand;
this.number = data.Number;
this.expMonth = data.ExpMonth;
this.expYear = data.ExpYear;
this.code = data.Code;
}
}

View File

@@ -0,0 +1,13 @@
import { FieldType } from '../../enums/fieldType';
export class FieldApi {
name: string;
value: string;
type: FieldType;
constructor(response: any) {
this.type = response.Type;
this.name = response.Name;
this.value = response.Value;
}
}

View File

@@ -0,0 +1,41 @@
export class IdentityApi {
title: string;
firstName: string;
middleName: string;
lastName: string;
address1: string;
address2: string;
address3: string;
city: string;
state: string;
postalCode: string;
country: string;
company: string;
email: string;
phone: string;
ssn: string;
username: string;
passportNumber: string;
licenseNumber: string;
constructor(data: any) {
this.title = data.Title;
this.firstName = data.FirstName;
this.middleName = data.MiddleName;
this.lastName = data.LastName;
this.address1 = data.Address1;
this.address2 = data.Address2;
this.address3 = data.Address3;
this.city = data.City;
this.state = data.State;
this.postalCode = data.PostalCode;
this.country = data.Country;
this.company = data.Company;
this.email = data.Email;
this.phone = data.Phone;
this.ssn = data.SSN;
this.username = data.Username;
this.passportNumber = data.PassportNumber;
this.licenseNumber = data.LicenseNumber;
}
}

View File

@@ -0,0 +1,21 @@
import { LoginUriApi } from './loginUriApi';
export class LoginApi {
uris: LoginUriApi[];
username: string;
password: string;
totp: string;
constructor(data: any) {
this.username = data.Username;
this.password = data.Password;
this.totp = data.Totp;
if (data.Uris) {
this.uris = [];
data.Uris.forEach((u: any) => {
this.uris.push(new LoginUriApi(u));
});
}
}
}

View File

@@ -0,0 +1,11 @@
import { UriMatchType } from '../../enums/uriMatchType';
export class LoginUriApi {
uri: string;
match: UriMatchType = null;
constructor(data: any) {
this.uri = data.Uri;
this.match = data.Match ? data.Match : null;
}
}

View File

@@ -0,0 +1,9 @@
import { SecureNoteType } from '../../enums/secureNoteType';
export class SecureNoteApi {
type: SecureNoteType;
constructor(data: any) {
this.type = data.Type;
}
}