mirror of
https://github.com/bitwarden/browser
synced 2025-12-28 14:13:22 +00:00
Split jslib into multiple modules (#363)
* Split jslib into multiple modules
This commit is contained in:
23
common/src/models/api/cardApi.ts
Normal file
23
common/src/models/api/cardApi.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
export class CardApi extends BaseResponse {
|
||||
cardholderName: string;
|
||||
brand: string;
|
||||
number: string;
|
||||
expMonth: string;
|
||||
expYear: string;
|
||||
code: string;
|
||||
|
||||
constructor(data: any = null) {
|
||||
super(data);
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
this.cardholderName = this.getResponseProperty('CardholderName');
|
||||
this.brand = this.getResponseProperty('Brand');
|
||||
this.number = this.getResponseProperty('Number');
|
||||
this.expMonth = this.getResponseProperty('ExpMonth');
|
||||
this.expYear = this.getResponseProperty('ExpYear');
|
||||
this.code = this.getResponseProperty('Code');
|
||||
}
|
||||
}
|
||||
19
common/src/models/api/fieldApi.ts
Normal file
19
common/src/models/api/fieldApi.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
import { FieldType } from '../../enums/fieldType';
|
||||
|
||||
export class FieldApi extends BaseResponse {
|
||||
name: string;
|
||||
value: string;
|
||||
type: FieldType;
|
||||
|
||||
constructor(data: any = null) {
|
||||
super(data);
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
this.type = this.getResponseProperty('Type');
|
||||
this.name = this.getResponseProperty('Name');
|
||||
this.value = this.getResponseProperty('Value');
|
||||
}
|
||||
}
|
||||
47
common/src/models/api/identityApi.ts
Normal file
47
common/src/models/api/identityApi.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
export class IdentityApi extends BaseResponse {
|
||||
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 = null) {
|
||||
super(data);
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
this.title = this.getResponseProperty('Title');
|
||||
this.firstName = this.getResponseProperty('FirstName');
|
||||
this.middleName = this.getResponseProperty('MiddleName');
|
||||
this.lastName = this.getResponseProperty('LastName');
|
||||
this.address1 = this.getResponseProperty('Address1');
|
||||
this.address2 = this.getResponseProperty('Address2');
|
||||
this.address3 = this.getResponseProperty('Address3');
|
||||
this.city = this.getResponseProperty('City');
|
||||
this.state = this.getResponseProperty('State');
|
||||
this.postalCode = this.getResponseProperty('PostalCode');
|
||||
this.country = this.getResponseProperty('Country');
|
||||
this.company = this.getResponseProperty('Company');
|
||||
this.email = this.getResponseProperty('Email');
|
||||
this.phone = this.getResponseProperty('Phone');
|
||||
this.ssn = this.getResponseProperty('SSN');
|
||||
this.username = this.getResponseProperty('Username');
|
||||
this.passportNumber = this.getResponseProperty('PassportNumber');
|
||||
this.licenseNumber = this.getResponseProperty('LicenseNumber');
|
||||
}
|
||||
}
|
||||
29
common/src/models/api/loginApi.ts
Normal file
29
common/src/models/api/loginApi.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
import { LoginUriApi } from './loginUriApi';
|
||||
|
||||
export class LoginApi extends BaseResponse {
|
||||
uris: LoginUriApi[];
|
||||
username: string;
|
||||
password: string;
|
||||
passwordRevisionDate: string;
|
||||
totp: string;
|
||||
autofillOnPageLoad: boolean;
|
||||
|
||||
constructor(data: any = null) {
|
||||
super(data);
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
this.username = this.getResponseProperty('Username');
|
||||
this.password = this.getResponseProperty('Password');
|
||||
this.passwordRevisionDate = this.getResponseProperty('PasswordRevisionDate');
|
||||
this.totp = this.getResponseProperty('Totp');
|
||||
this.autofillOnPageLoad = this.getResponseProperty('AutofillOnPageLoad');
|
||||
|
||||
const uris = this.getResponseProperty('Uris');
|
||||
if (uris != null) {
|
||||
this.uris = uris.map((u: any) => new LoginUriApi(u));
|
||||
}
|
||||
}
|
||||
}
|
||||
18
common/src/models/api/loginUriApi.ts
Normal file
18
common/src/models/api/loginUriApi.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
import { UriMatchType } from '../../enums/uriMatchType';
|
||||
|
||||
export class LoginUriApi extends BaseResponse {
|
||||
uri: string;
|
||||
match: UriMatchType = null;
|
||||
|
||||
constructor(data: any = null) {
|
||||
super(data);
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
this.uri = this.getResponseProperty('Uri');
|
||||
const match = this.getResponseProperty('Match');
|
||||
this.match = match != null ? match : null;
|
||||
}
|
||||
}
|
||||
35
common/src/models/api/permissionsApi.ts
Normal file
35
common/src/models/api/permissionsApi.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
export class PermissionsApi extends BaseResponse {
|
||||
accessBusinessPortal: boolean;
|
||||
accessEventLogs: boolean;
|
||||
accessImportExport: boolean;
|
||||
accessReports: boolean;
|
||||
manageAllCollections: boolean;
|
||||
manageAssignedCollections: boolean;
|
||||
manageCiphers: boolean;
|
||||
manageGroups: boolean;
|
||||
manageSso: boolean;
|
||||
managePolicies: boolean;
|
||||
manageUsers: boolean;
|
||||
manageResetPassword: boolean;
|
||||
|
||||
constructor(data: any = null) {
|
||||
super(data);
|
||||
if (data == null) {
|
||||
return this;
|
||||
}
|
||||
this.accessBusinessPortal = this.getResponseProperty('AccessBusinessPortal');
|
||||
this.accessEventLogs = this.getResponseProperty('AccessEventLogs');
|
||||
this.accessImportExport = this.getResponseProperty('AccessImportExport');
|
||||
this.accessReports = this.getResponseProperty('AccessReports');
|
||||
this.manageAllCollections = this.getResponseProperty('ManageAllCollections');
|
||||
this.manageAssignedCollections = this.getResponseProperty('ManageAssignedCollections');
|
||||
this.manageCiphers = this.getResponseProperty('ManageCiphers');
|
||||
this.manageGroups = this.getResponseProperty('ManageGroups');
|
||||
this.manageSso = this.getResponseProperty('ManageSso');
|
||||
this.managePolicies = this.getResponseProperty('ManagePolicies');
|
||||
this.manageUsers = this.getResponseProperty('ManageUsers');
|
||||
this.manageResetPassword = this.getResponseProperty('ManageResetPassword');
|
||||
}
|
||||
}
|
||||
15
common/src/models/api/secureNoteApi.ts
Normal file
15
common/src/models/api/secureNoteApi.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
import { SecureNoteType } from '../../enums/secureNoteType';
|
||||
|
||||
export class SecureNoteApi extends BaseResponse {
|
||||
type: SecureNoteType;
|
||||
|
||||
constructor(data: any = null) {
|
||||
super(data);
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
this.type = this.getResponseProperty('Type');
|
||||
}
|
||||
}
|
||||
21
common/src/models/api/sendFileApi.ts
Normal file
21
common/src/models/api/sendFileApi.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
export class SendFileApi extends BaseResponse {
|
||||
id: string;
|
||||
fileName: string;
|
||||
key: string;
|
||||
size: string;
|
||||
sizeName: string;
|
||||
|
||||
constructor(data: any = null) {
|
||||
super(data);
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.fileName = this.getResponseProperty('FileName');
|
||||
this.key = this.getResponseProperty('Key');
|
||||
this.size = this.getResponseProperty('Size');
|
||||
this.sizeName = this.getResponseProperty('SizeName');
|
||||
}
|
||||
}
|
||||
15
common/src/models/api/sendTextApi.ts
Normal file
15
common/src/models/api/sendTextApi.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
export class SendTextApi extends BaseResponse {
|
||||
text: string;
|
||||
hidden: boolean;
|
||||
|
||||
constructor(data: any = null) {
|
||||
super(data);
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
this.text = this.getResponseProperty('Text');
|
||||
this.hidden = this.getResponseProperty('Hidden') || false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user