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:
17
src/models/api/cardApi.ts
Normal file
17
src/models/api/cardApi.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
13
src/models/api/fieldApi.ts
Normal file
13
src/models/api/fieldApi.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
41
src/models/api/identityApi.ts
Normal file
41
src/models/api/identityApi.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
21
src/models/api/loginApi.ts
Normal file
21
src/models/api/loginApi.ts
Normal 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));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
11
src/models/api/loginUriApi.ts
Normal file
11
src/models/api/loginUriApi.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
9
src/models/api/secureNoteApi.ts
Normal file
9
src/models/api/secureNoteApi.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { SecureNoteType } from '../../enums/secureNoteType';
|
||||
|
||||
export class SecureNoteApi {
|
||||
type: SecureNoteType;
|
||||
|
||||
constructor(data: any) {
|
||||
this.type = data.Type;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user