mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
support camel or pascal case in API responses
This commit is contained in:
parent
62e9c75357
commit
48164a31d9
@ -1,4 +1,6 @@
|
||||
export class CardApi {
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
export class CardApi extends BaseResponse {
|
||||
cardholderName: string;
|
||||
brand: string;
|
||||
number: string;
|
||||
@ -6,12 +8,16 @@ export class CardApi {
|
||||
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;
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,19 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
import { FieldType } from '../../enums/fieldType';
|
||||
|
||||
export class FieldApi {
|
||||
export class FieldApi extends BaseResponse {
|
||||
name: string;
|
||||
value: string;
|
||||
type: FieldType;
|
||||
|
||||
constructor(response: any) {
|
||||
this.type = response.Type;
|
||||
this.name = response.Name;
|
||||
this.value = response.Value;
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
export class IdentityApi {
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
export class IdentityApi extends BaseResponse {
|
||||
title: string;
|
||||
firstName: string;
|
||||
middleName: string;
|
||||
@ -18,24 +20,28 @@ export class IdentityApi {
|
||||
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;
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,27 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
import { LoginUriApi } from './loginUriApi';
|
||||
|
||||
export class LoginApi {
|
||||
export class LoginApi extends BaseResponse {
|
||||
uris: LoginUriApi[];
|
||||
username: string;
|
||||
password: string;
|
||||
passwordRevisionDate: string;
|
||||
totp: string;
|
||||
|
||||
constructor(data: any) {
|
||||
this.username = data.Username;
|
||||
this.password = data.Password;
|
||||
this.passwordRevisionDate = data.PasswordRevisionDate;
|
||||
this.totp = data.Totp;
|
||||
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');
|
||||
|
||||
if (data.Uris) {
|
||||
this.uris = [];
|
||||
data.Uris.forEach((u: any) => {
|
||||
this.uris.push(new LoginUriApi(u));
|
||||
});
|
||||
const uris = this.getResponseProperty('Uris');
|
||||
if (uris != null) {
|
||||
this.uris = uris.map((u: any) => new LoginUriApi(u));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,18 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
import { UriMatchType } from '../../enums/uriMatchType';
|
||||
|
||||
export class LoginUriApi {
|
||||
export class LoginUriApi extends BaseResponse {
|
||||
uri: string;
|
||||
match: UriMatchType = null;
|
||||
|
||||
constructor(data: any) {
|
||||
this.uri = data.Uri;
|
||||
this.match = data.Match != null ? data.Match : 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;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,15 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
import { SecureNoteType } from '../../enums/secureNoteType';
|
||||
|
||||
export class SecureNoteApi {
|
||||
export class SecureNoteApi extends BaseResponse {
|
||||
type: SecureNoteType;
|
||||
|
||||
constructor(data: any) {
|
||||
this.type = data.Type;
|
||||
constructor(data: any = null) {
|
||||
super(data);
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
this.type = this.getResponseProperty('Type');
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import { CardApi } from '../api/cardApi';
|
||||
import { FieldApi } from '../api/fieldApi';
|
||||
import { IdentityApi } from '../api/identityApi';
|
||||
import { LoginApi } from '../api/loginApi';
|
||||
import { LoginUriApi } from '../api/loginUriApi';
|
||||
import { SecureNoteApi } from '../api/secureNoteApi';
|
||||
|
||||
import { AttachmentRequest } from './attachmentRequest';
|
||||
@ -38,79 +39,85 @@ export class CipherRequest {
|
||||
|
||||
switch (this.type) {
|
||||
case CipherType.Login:
|
||||
this.login = {
|
||||
uris: null,
|
||||
username: cipher.login.username ? cipher.login.username.encryptedString : null,
|
||||
password: cipher.login.password ? cipher.login.password.encryptedString : null,
|
||||
passwordRevisionDate: cipher.login.passwordRevisionDate != null ?
|
||||
cipher.login.passwordRevisionDate.toISOString() : null,
|
||||
totp: cipher.login.totp ? cipher.login.totp.encryptedString : null,
|
||||
};
|
||||
this.login = new LoginApi();
|
||||
this.login.uris = null;
|
||||
this.login.username = cipher.login.username ? cipher.login.username.encryptedString : null;
|
||||
this.login.password = cipher.login.password ? cipher.login.password.encryptedString : null;
|
||||
this.login.passwordRevisionDate = cipher.login.passwordRevisionDate != null ?
|
||||
cipher.login.passwordRevisionDate.toISOString() : null;
|
||||
this.login.totp = cipher.login.totp ? cipher.login.totp.encryptedString : null;
|
||||
|
||||
if (cipher.login.uris) {
|
||||
this.login.uris = [];
|
||||
cipher.login.uris.forEach((u) => {
|
||||
this.login.uris.push({
|
||||
uri: u.uri ? u.uri.encryptedString : null,
|
||||
match: u.match != null ? u.match : null,
|
||||
});
|
||||
if (cipher.login.uris != null) {
|
||||
this.login.uris = cipher.login.uris.map((u) => {
|
||||
const uri = new LoginUriApi();
|
||||
uri.uri = u.uri != null ? u.uri.encryptedString : null;
|
||||
uri.match = u.match != null ? u.match : null;
|
||||
return uri;
|
||||
});
|
||||
}
|
||||
break;
|
||||
case CipherType.SecureNote:
|
||||
this.secureNote = {
|
||||
type: cipher.secureNote.type,
|
||||
};
|
||||
this.secureNote = new SecureNoteApi();
|
||||
this.secureNote.type = cipher.secureNote.type;
|
||||
break;
|
||||
case CipherType.Card:
|
||||
this.card = {
|
||||
cardholderName: cipher.card.cardholderName ? cipher.card.cardholderName.encryptedString : null,
|
||||
brand: cipher.card.brand ? cipher.card.brand.encryptedString : null,
|
||||
number: cipher.card.number ? cipher.card.number.encryptedString : null,
|
||||
expMonth: cipher.card.expMonth ? cipher.card.expMonth.encryptedString : null,
|
||||
expYear: cipher.card.expYear ? cipher.card.expYear.encryptedString : null,
|
||||
code: cipher.card.code ? cipher.card.code.encryptedString : null,
|
||||
};
|
||||
this.card = new CardApi();
|
||||
this.card.cardholderName = cipher.card.cardholderName != null ?
|
||||
cipher.card.cardholderName.encryptedString : null;
|
||||
this.card.brand = cipher.card.brand != null ? cipher.card.brand.encryptedString : null;
|
||||
this.card.number = cipher.card.number != null ? cipher.card.number.encryptedString : null;
|
||||
this.card.expMonth = cipher.card.expMonth != null ? cipher.card.expMonth.encryptedString : null;
|
||||
this.card.expYear = cipher.card.expYear != null ? cipher.card.expYear.encryptedString : null;
|
||||
this.card.code = cipher.card.code != null ? cipher.card.code.encryptedString : null;
|
||||
break;
|
||||
case CipherType.Identity:
|
||||
this.identity = {
|
||||
title: cipher.identity.title ? cipher.identity.title.encryptedString : null,
|
||||
firstName: cipher.identity.firstName ? cipher.identity.firstName.encryptedString : null,
|
||||
middleName: cipher.identity.middleName ? cipher.identity.middleName.encryptedString : null,
|
||||
lastName: cipher.identity.lastName ? cipher.identity.lastName.encryptedString : null,
|
||||
address1: cipher.identity.address1 ? cipher.identity.address1.encryptedString : null,
|
||||
address2: cipher.identity.address2 ? cipher.identity.address2.encryptedString : null,
|
||||
address3: cipher.identity.address3 ? cipher.identity.address3.encryptedString : null,
|
||||
city: cipher.identity.city ? cipher.identity.city.encryptedString : null,
|
||||
state: cipher.identity.state ? cipher.identity.state.encryptedString : null,
|
||||
postalCode: cipher.identity.postalCode ? cipher.identity.postalCode.encryptedString : null,
|
||||
country: cipher.identity.country ? cipher.identity.country.encryptedString : null,
|
||||
company: cipher.identity.company ? cipher.identity.company.encryptedString : null,
|
||||
email: cipher.identity.email ? cipher.identity.email.encryptedString : null,
|
||||
phone: cipher.identity.phone ? cipher.identity.phone.encryptedString : null,
|
||||
ssn: cipher.identity.ssn ? cipher.identity.ssn.encryptedString : null,
|
||||
username: cipher.identity.username ? cipher.identity.username.encryptedString : null,
|
||||
passportNumber: cipher.identity.passportNumber ?
|
||||
cipher.identity.passportNumber.encryptedString : null,
|
||||
licenseNumber: cipher.identity.licenseNumber ? cipher.identity.licenseNumber.encryptedString : null,
|
||||
};
|
||||
this.identity = new IdentityApi();
|
||||
this.identity.title = cipher.identity.title != null ? cipher.identity.title.encryptedString : null;
|
||||
this.identity.firstName = cipher.identity.firstName != null ?
|
||||
cipher.identity.firstName.encryptedString : null;
|
||||
this.identity.middleName = cipher.identity.middleName != null ?
|
||||
cipher.identity.middleName.encryptedString : null;
|
||||
this.identity.lastName = cipher.identity.lastName != null ?
|
||||
cipher.identity.lastName.encryptedString : null;
|
||||
this.identity.address1 = cipher.identity.address1 != null ?
|
||||
cipher.identity.address1.encryptedString : null;
|
||||
this.identity.address2 = cipher.identity.address2 != null ?
|
||||
cipher.identity.address2.encryptedString : null;
|
||||
this.identity.address3 = cipher.identity.address3 != null ?
|
||||
cipher.identity.address3.encryptedString : null;
|
||||
this.identity.city = cipher.identity.city != null ? cipher.identity.city.encryptedString : null;
|
||||
this.identity.state = cipher.identity.state != null ? cipher.identity.state.encryptedString : null;
|
||||
this.identity.postalCode = cipher.identity.postalCode != null ?
|
||||
cipher.identity.postalCode.encryptedString : null;
|
||||
this.identity.country = cipher.identity.country != null ?
|
||||
cipher.identity.country.encryptedString : null;
|
||||
this.identity.company = cipher.identity.company != null ?
|
||||
cipher.identity.company.encryptedString : null;
|
||||
this.identity.email = cipher.identity.email != null ? cipher.identity.email.encryptedString : null;
|
||||
this.identity.phone = cipher.identity.phone != null ? cipher.identity.phone.encryptedString : null;
|
||||
this.identity.ssn = cipher.identity.ssn != null ? cipher.identity.ssn.encryptedString : null;
|
||||
this.identity.username = cipher.identity.username != null ?
|
||||
cipher.identity.username.encryptedString : null;
|
||||
this.identity.passportNumber = cipher.identity.passportNumber != null ?
|
||||
cipher.identity.passportNumber.encryptedString : null;
|
||||
this.identity.licenseNumber = cipher.identity.licenseNumber != null ?
|
||||
cipher.identity.licenseNumber.encryptedString : null;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (cipher.fields) {
|
||||
this.fields = [];
|
||||
cipher.fields.forEach((field) => {
|
||||
this.fields.push({
|
||||
type: field.type,
|
||||
name: field.name ? field.name.encryptedString : null,
|
||||
value: field.value ? field.value.encryptedString : null,
|
||||
});
|
||||
if (cipher.fields != null) {
|
||||
this.fields = cipher.fields.map((f) => {
|
||||
const field = new FieldApi();
|
||||
field.type = f.type;
|
||||
field.name = f.name ? f.name.encryptedString : null;
|
||||
field.value = f.value ? f.value.encryptedString : null;
|
||||
return field;
|
||||
});
|
||||
}
|
||||
|
||||
if (cipher.passwordHistory) {
|
||||
if (cipher.passwordHistory != null) {
|
||||
this.passwordHistory = [];
|
||||
cipher.passwordHistory.forEach((ph) => {
|
||||
this.passwordHistory.push({
|
||||
@ -120,7 +127,7 @@ export class CipherRequest {
|
||||
});
|
||||
}
|
||||
|
||||
if (cipher.attachments) {
|
||||
if (cipher.attachments != null) {
|
||||
this.attachments = {};
|
||||
this.attachments2 = {};
|
||||
cipher.attachments.forEach((attachment) => {
|
||||
|
@ -1,4 +1,6 @@
|
||||
export class AttachmentResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class AttachmentResponse extends BaseResponse {
|
||||
id: string;
|
||||
url: string;
|
||||
fileName: string;
|
||||
@ -7,11 +9,12 @@ export class AttachmentResponse {
|
||||
sizeName: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.Id;
|
||||
this.url = response.Url;
|
||||
this.fileName = response.FileName;
|
||||
this.key = response.Key;
|
||||
this.size = response.Size;
|
||||
this.sizeName = response.SizeName;
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.url = this.getResponseProperty('Url');
|
||||
this.fileName = this.getResponseProperty('FileName');
|
||||
this.key = this.getResponseProperty('Key');
|
||||
this.size = this.getResponseProperty('Size');
|
||||
this.sizeName = this.getResponseProperty('SizeName');
|
||||
}
|
||||
}
|
||||
|
36
src/models/response/baseResponse.ts
Normal file
36
src/models/response/baseResponse.ts
Normal file
@ -0,0 +1,36 @@
|
||||
export abstract class BaseResponse {
|
||||
protected response: any;
|
||||
|
||||
constructor(response: any) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
protected getResponseProperty(propertyName: string, response: any = null, exactName = false): any {
|
||||
if (propertyName == null || propertyName === '') {
|
||||
throw new Error('propertyName must not be null/empty.');
|
||||
}
|
||||
if (response == null) {
|
||||
response = this.response;
|
||||
}
|
||||
if (!exactName && response[propertyName] === undefined) {
|
||||
let otherCasePropertyName: string = null;
|
||||
if (propertyName.charAt(0) === propertyName.charAt(0).toUpperCase()) {
|
||||
otherCasePropertyName = propertyName.charAt(0).toLowerCase();
|
||||
} else {
|
||||
otherCasePropertyName = propertyName.charAt(0).toUpperCase();
|
||||
}
|
||||
if (propertyName.length > 1) {
|
||||
otherCasePropertyName += propertyName.slice(1);
|
||||
}
|
||||
|
||||
propertyName = otherCasePropertyName;
|
||||
if (response[propertyName] === undefined) {
|
||||
propertyName = propertyName.toLowerCase();
|
||||
}
|
||||
if (response[propertyName] === undefined) {
|
||||
propertyName = propertyName.toUpperCase();
|
||||
}
|
||||
}
|
||||
return response[propertyName];
|
||||
}
|
||||
}
|
@ -1,39 +1,46 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
import { PaymentMethodType } from '../../enums/paymentMethodType';
|
||||
import { TransactionType } from '../../enums/transactionType';
|
||||
|
||||
export class BillingResponse {
|
||||
export class BillingResponse extends BaseResponse {
|
||||
balance: number;
|
||||
paymentSource: BillingSourceResponse;
|
||||
invoices: BillingInvoiceResponse[] = [];
|
||||
transactions: BillingTransactionResponse[] = [];
|
||||
|
||||
constructor(response: any) {
|
||||
this.balance = response.Balance;
|
||||
this.paymentSource = response.PaymentSource == null ? null : new BillingSourceResponse(response.PaymentSource);
|
||||
if (response.Transactions != null) {
|
||||
this.transactions = response.Transactions.map((t: any) => new BillingTransactionResponse(t));
|
||||
super(response);
|
||||
this.balance = this.getResponseProperty('Balance');
|
||||
const paymentSource = this.getResponseProperty('PaymentSource');
|
||||
const transactions = this.getResponseProperty('Transactions');
|
||||
const invoices = this.getResponseProperty('Invoices');
|
||||
this.paymentSource = paymentSource == null ? null : new BillingSourceResponse(paymentSource);
|
||||
if (transactions != null) {
|
||||
this.transactions = transactions.map((t: any) => new BillingTransactionResponse(t));
|
||||
}
|
||||
if (response.Invoices != null) {
|
||||
this.invoices = response.Invoices.map((i: any) => new BillingInvoiceResponse(i));
|
||||
if (invoices != null) {
|
||||
this.invoices = invoices.map((i: any) => new BillingInvoiceResponse(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class BillingSourceResponse {
|
||||
export class BillingSourceResponse extends BaseResponse {
|
||||
type: PaymentMethodType;
|
||||
cardBrand: string;
|
||||
description: string;
|
||||
needsVerification: boolean;
|
||||
|
||||
constructor(response: any) {
|
||||
this.type = response.Type;
|
||||
this.cardBrand = response.CardBrand;
|
||||
this.description = response.Description;
|
||||
this.needsVerification = response.NeedsVerification;
|
||||
super(response);
|
||||
this.type = this.getResponseProperty('Type');
|
||||
this.cardBrand = this.getResponseProperty('CardBrand');
|
||||
this.description = this.getResponseProperty('Description');
|
||||
this.needsVerification = this.getResponseProperty('NeedsVerification');
|
||||
}
|
||||
}
|
||||
|
||||
export class BillingInvoiceResponse {
|
||||
export class BillingInvoiceResponse extends BaseResponse {
|
||||
url: string;
|
||||
pdfUrl: string;
|
||||
number: string;
|
||||
@ -42,16 +49,17 @@ export class BillingInvoiceResponse {
|
||||
amount: number;
|
||||
|
||||
constructor(response: any) {
|
||||
this.url = response.Url;
|
||||
this.pdfUrl = response.PdfUrl;
|
||||
this.number = response.Number;
|
||||
this.paid = response.Paid;
|
||||
this.date = response.Date;
|
||||
this.amount = response.Amount;
|
||||
super(response);
|
||||
this.url = this.getResponseProperty('Url');
|
||||
this.pdfUrl = this.getResponseProperty('PdfUrl');
|
||||
this.number = this.getResponseProperty('Number');
|
||||
this.paid = this.getResponseProperty('Paid');
|
||||
this.date = this.getResponseProperty('Date');
|
||||
this.amount = this.getResponseProperty('Amount');
|
||||
}
|
||||
}
|
||||
|
||||
export class BillingTransactionResponse {
|
||||
export class BillingTransactionResponse extends BaseResponse {
|
||||
createdDate: string;
|
||||
amount: number;
|
||||
refunded: boolean;
|
||||
@ -62,13 +70,14 @@ export class BillingTransactionResponse {
|
||||
details: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.createdDate = response.CreatedDate;
|
||||
this.amount = response.Amount;
|
||||
this.refunded = response.Refunded;
|
||||
this.partiallyRefunded = response.PartiallyRefunded;
|
||||
this.refundedAmount = response.RefundedAmount;
|
||||
this.type = response.Type;
|
||||
this.paymentMethodType = response.PaymentMethodType;
|
||||
this.details = response.Details;
|
||||
super(response);
|
||||
this.createdDate = this.getResponseProperty('CreatedDate');
|
||||
this.amount = this.getResponseProperty('Amount');
|
||||
this.refunded = this.getResponseProperty('Refunded');
|
||||
this.partiallyRefunded = this.getResponseProperty('PartiallyRefunded');
|
||||
this.refundedAmount = this.getResponseProperty('RefundedAmount');
|
||||
this.type = this.getResponseProperty('Type');
|
||||
this.paymentMethodType = this.getResponseProperty('PaymentMethodType');
|
||||
this.details = this.getResponseProperty('Details');
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
export class BreachAccountResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class BreachAccountResponse extends BaseResponse {
|
||||
addedDate: string;
|
||||
breachDate: string;
|
||||
dataClasses: string[];
|
||||
@ -13,17 +15,18 @@ export class BreachAccountResponse {
|
||||
title: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.addedDate = response.AddedDate;
|
||||
this.breachDate = response.BreachDate;
|
||||
this.dataClasses = response.DataClasses;
|
||||
this.description = response.Description;
|
||||
this.domain = response.Domain;
|
||||
this.isActive = response.IsActive;
|
||||
this.isVerified = response.IsVerified;
|
||||
this.logoPath = response.LogoPath;
|
||||
this.modifiedDate = response.ModifiedDate;
|
||||
this.name = response.Name;
|
||||
this.pwnCount = response.PwnCount;
|
||||
this.title = response.Title;
|
||||
super(response);
|
||||
this.addedDate = this.getResponseProperty('AddedDate');
|
||||
this.breachDate = this.getResponseProperty('BreachDate');
|
||||
this.dataClasses = this.getResponseProperty('DataClasses');
|
||||
this.description = this.getResponseProperty('Description');
|
||||
this.domain = this.getResponseProperty('Domain');
|
||||
this.isActive = this.getResponseProperty('IsActive');
|
||||
this.isVerified = this.getResponseProperty('IsVerified');
|
||||
this.logoPath = this.getResponseProperty('LogoPath');
|
||||
this.modifiedDate = this.getResponseProperty('ModifiedDate');
|
||||
this.name = this.getResponseProperty('Name');
|
||||
this.pwnCount = this.getResponseProperty('PwnCount');
|
||||
this.title = this.getResponseProperty('Title');
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { AttachmentResponse } from './attachmentResponse';
|
||||
import { BaseResponse } from './baseResponse';
|
||||
import { PasswordHistoryResponse } from './passwordHistoryResponse';
|
||||
|
||||
import { CardApi } from '../api/cardApi';
|
||||
@ -7,7 +8,7 @@ import { IdentityApi } from '../api/identityApi';
|
||||
import { LoginApi } from '../api/loginApi';
|
||||
import { SecureNoteApi } from '../api/secureNoteApi';
|
||||
|
||||
export class CipherResponse {
|
||||
export class CipherResponse extends BaseResponse {
|
||||
id: string;
|
||||
organizationId: string;
|
||||
folderId: string;
|
||||
@ -28,59 +29,52 @@ export class CipherResponse {
|
||||
collectionIds: string[];
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.Id;
|
||||
this.organizationId = response.OrganizationId;
|
||||
this.folderId = response.FolderId || null;
|
||||
this.type = response.Type;
|
||||
this.name = response.Name;
|
||||
this.notes = response.Notes;
|
||||
this.favorite = response.Favorite || false;
|
||||
this.edit = response.Edit || true;
|
||||
this.organizationUseTotp = response.OrganizationUseTotp;
|
||||
this.revisionDate = response.RevisionDate;
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.organizationId = this.getResponseProperty('OrganizationId');
|
||||
this.folderId = this.getResponseProperty('FolderId') || null;
|
||||
this.type = this.getResponseProperty('Type');
|
||||
this.name = this.getResponseProperty('Name');
|
||||
this.notes = this.getResponseProperty('Notes');
|
||||
this.favorite = this.getResponseProperty('Favorite') || false;
|
||||
this.edit = this.getResponseProperty('Edit') || true;
|
||||
this.organizationUseTotp = this.getResponseProperty('OrganizationUseTotp');
|
||||
this.revisionDate = this.getResponseProperty('RevisionDate');
|
||||
this.collectionIds = this.getResponseProperty('CollectionIds');
|
||||
|
||||
if (response.Login != null) {
|
||||
this.login = new LoginApi(response.Login);
|
||||
const login = this.getResponseProperty('Login');
|
||||
if (login != null) {
|
||||
this.login = new LoginApi(login);
|
||||
}
|
||||
|
||||
if (response.Card != null) {
|
||||
this.card = new CardApi(response.Card);
|
||||
const card = this.getResponseProperty('Card');
|
||||
if (card != null) {
|
||||
this.card = new CardApi(card);
|
||||
}
|
||||
|
||||
if (response.Identity != null) {
|
||||
this.identity = new IdentityApi(response.Identity);
|
||||
const identity = this.getResponseProperty('Identity');
|
||||
if (identity != null) {
|
||||
this.identity = new IdentityApi(identity);
|
||||
}
|
||||
|
||||
if (response.SecureNote != null) {
|
||||
this.secureNote = new SecureNoteApi(response.SecureNote);
|
||||
const secureNote = this.getResponseProperty('SecureNote');
|
||||
if (secureNote != null) {
|
||||
this.secureNote = new SecureNoteApi(secureNote);
|
||||
}
|
||||
|
||||
if (response.Fields != null) {
|
||||
this.fields = [];
|
||||
response.Fields.forEach((field: any) => {
|
||||
this.fields.push(new FieldApi(field));
|
||||
});
|
||||
const fields = this.getResponseProperty('Fields');
|
||||
if (fields != null) {
|
||||
this.fields = fields.map((f: any) => new FieldApi(f));
|
||||
}
|
||||
|
||||
if (response.Attachments != null) {
|
||||
this.attachments = [];
|
||||
response.Attachments.forEach((attachment: any) => {
|
||||
this.attachments.push(new AttachmentResponse(attachment));
|
||||
});
|
||||
const attachments = this.getResponseProperty('Attachments');
|
||||
if (attachments != null) {
|
||||
this.attachments = attachments.map((a: any) => new AttachmentResponse(a));
|
||||
}
|
||||
|
||||
if (response.PasswordHistory != null) {
|
||||
this.passwordHistory = [];
|
||||
response.PasswordHistory.forEach((ph: any) => {
|
||||
this.passwordHistory.push(new PasswordHistoryResponse(ph));
|
||||
});
|
||||
}
|
||||
|
||||
if (response.CollectionIds) {
|
||||
this.collectionIds = [];
|
||||
response.CollectionIds.forEach((id: string) => {
|
||||
this.collectionIds.push(id);
|
||||
});
|
||||
const passwordHistory = this.getResponseProperty('PasswordHistory');
|
||||
if (passwordHistory != null) {
|
||||
this.passwordHistory = passwordHistory.map((h: any) => new PasswordHistoryResponse(h));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,16 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
import { SelectionReadOnlyResponse } from './selectionReadOnlyResponse';
|
||||
|
||||
export class CollectionResponse {
|
||||
export class CollectionResponse extends BaseResponse {
|
||||
id: string;
|
||||
organizationId: string;
|
||||
name: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.Id;
|
||||
this.organizationId = response.OrganizationId;
|
||||
this.name = response.Name;
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.organizationId = this.getResponseProperty('OrganizationId');
|
||||
this.name = this.getResponseProperty('Name');
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +19,7 @@ export class CollectionDetailsResponse extends CollectionResponse {
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
this.readOnly = response.ReadOnly || false;
|
||||
this.readOnly = this.getResponseProperty('ReadOnly') || false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,8 +28,9 @@ export class CollectionGroupDetailsResponse extends CollectionResponse {
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
if (response.Groups != null) {
|
||||
this.groups = response.Groups.map((g: any) => new SelectionReadOnlyResponse(g));
|
||||
const groups = this.getResponseProperty('Groups');
|
||||
if (groups != null) {
|
||||
this.groups = groups.map((g: any) => new SelectionReadOnlyResponse(g));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
import { DeviceType } from '../../enums/deviceType';
|
||||
|
||||
export class DeviceResponse {
|
||||
export class DeviceResponse extends BaseResponse {
|
||||
id: string;
|
||||
name: number;
|
||||
identifier: string;
|
||||
@ -8,10 +10,11 @@ export class DeviceResponse {
|
||||
creationDate: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.Id;
|
||||
this.name = response.Name;
|
||||
this.identifier = response.Identifier;
|
||||
this.type = response.Type;
|
||||
this.creationDate = response.CreationDate;
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.name = this.getResponseProperty('Name');
|
||||
this.identifier = this.getResponseProperty('Identifier');
|
||||
this.type = this.getResponseProperty('Type');
|
||||
this.creationDate = this.getResponseProperty('CreationDate');
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,18 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
import { GlobalDomainResponse } from './globalDomainResponse';
|
||||
|
||||
export class DomainsResponse {
|
||||
export class DomainsResponse extends BaseResponse {
|
||||
equivalentDomains: string[][];
|
||||
globalEquivalentDomains: GlobalDomainResponse[] = [];
|
||||
|
||||
constructor(response: any) {
|
||||
this.equivalentDomains = response.EquivalentDomains;
|
||||
|
||||
this.globalEquivalentDomains = [];
|
||||
if (response.GlobalEquivalentDomains) {
|
||||
response.GlobalEquivalentDomains.forEach((domain: any) => {
|
||||
this.globalEquivalentDomains.push(new GlobalDomainResponse(domain));
|
||||
});
|
||||
super(response);
|
||||
this.equivalentDomains = this.getResponseProperty('EquivalentDomains');
|
||||
const globalEquivalentDomains = this.getResponseProperty('GlobalEquivalentDomains');
|
||||
if (globalEquivalentDomains != null) {
|
||||
this.globalEquivalentDomains = globalEquivalentDomains.map((d: any) => new GlobalDomainResponse(d));
|
||||
} else {
|
||||
this.globalEquivalentDomains = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,23 @@
|
||||
export class ErrorResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class ErrorResponse extends BaseResponse {
|
||||
message: string;
|
||||
validationErrors: { [key: string]: string[]; };
|
||||
statusCode: number;
|
||||
|
||||
constructor(response: any, status: number, identityResponse?: boolean) {
|
||||
super(response);
|
||||
let errorModel = null;
|
||||
if (identityResponse && response && response.ErrorModel) {
|
||||
errorModel = response.ErrorModel;
|
||||
const responseErrorModel = this.getResponseProperty('ErrorModel');
|
||||
if (responseErrorModel && identityResponse && response) {
|
||||
errorModel = responseErrorModel;
|
||||
} else if (response) {
|
||||
errorModel = response;
|
||||
}
|
||||
|
||||
if (errorModel) {
|
||||
this.message = errorModel.Message;
|
||||
this.validationErrors = errorModel.ValidationErrors;
|
||||
this.message = this.getResponseProperty('Message', errorModel);
|
||||
this.validationErrors = this.getResponseProperty('ValidationErrors', errorModel);
|
||||
} else {
|
||||
if (status === 429) {
|
||||
this.message = 'Rate limit exceeded. Try again later.';
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
import { DeviceType } from '../../enums/deviceType';
|
||||
import { EventType } from '../../enums/eventType';
|
||||
|
||||
export class EventResponse {
|
||||
export class EventResponse extends BaseResponse {
|
||||
type: EventType;
|
||||
userId: string;
|
||||
organizationId: string;
|
||||
@ -15,16 +17,17 @@ export class EventResponse {
|
||||
ipAddress: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.type = response.Type;
|
||||
this.userId = response.UserId;
|
||||
this.organizationId = response.OrganizationId;
|
||||
this.cipherId = response.CipherId;
|
||||
this.collectionId = response.CollectionId;
|
||||
this.groupId = response.GroupId;
|
||||
this.organizationUserId = response.OrganizationUserId;
|
||||
this.actingUserId = response.ActingUserId;
|
||||
this.date = response.Date;
|
||||
this.deviceType = response.DeviceType;
|
||||
this.ipAddress = response.IpAddress;
|
||||
super(response);
|
||||
this.type = this.getResponseProperty('Type');
|
||||
this.userId = this.getResponseProperty('UserId');
|
||||
this.organizationId = this.getResponseProperty('OrganizationId');
|
||||
this.cipherId = this.getResponseProperty('CipherId');
|
||||
this.collectionId = this.getResponseProperty('CollectionId');
|
||||
this.groupId = this.getResponseProperty('GroupId');
|
||||
this.organizationUserId = this.getResponseProperty('OrganizationUserId');
|
||||
this.actingUserId = this.getResponseProperty('ActingUserId');
|
||||
this.date = this.getResponseProperty('Date');
|
||||
this.deviceType = this.getResponseProperty('DeviceType');
|
||||
this.ipAddress = this.getResponseProperty('IpAddress');
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
export class FolderResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class FolderResponse extends BaseResponse {
|
||||
id: string;
|
||||
name: string;
|
||||
revisionDate: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.Id;
|
||||
this.name = response.Name;
|
||||
this.revisionDate = response.RevisionDate;
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.name = this.getResponseProperty('Name');
|
||||
this.revisionDate = this.getResponseProperty('RevisionDate');
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
export class GlobalDomainResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class GlobalDomainResponse extends BaseResponse {
|
||||
type: number;
|
||||
domains: string[];
|
||||
excluded: number[];
|
||||
|
||||
constructor(response: any) {
|
||||
this.type = response.Type;
|
||||
this.domains = response.Domains;
|
||||
this.excluded = response.Excluded;
|
||||
super(response);
|
||||
this.type = this.getResponseProperty('Type');
|
||||
this.domains = this.getResponseProperty('Domains');
|
||||
this.excluded = this.getResponseProperty('Excluded');
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
import { SelectionReadOnlyResponse } from './selectionReadOnlyResponse';
|
||||
|
||||
export class GroupResponse {
|
||||
export class GroupResponse extends BaseResponse {
|
||||
id: string;
|
||||
organizationId: string;
|
||||
name: string;
|
||||
@ -8,11 +9,12 @@ export class GroupResponse {
|
||||
externalId: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.Id;
|
||||
this.organizationId = response.OrganizationId;
|
||||
this.name = response.Name;
|
||||
this.accessAll = response.AccessAll;
|
||||
this.externalId = response.ExternalId;
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.organizationId = this.getResponseProperty('OrganizationId');
|
||||
this.name = this.getResponseProperty('Name');
|
||||
this.accessAll = this.getResponseProperty('AccessAll');
|
||||
this.externalId = this.getResponseProperty('ExternalId');
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,8 +23,9 @@ export class GroupDetailsResponse extends GroupResponse {
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
if (response.Collections != null) {
|
||||
this.collections = response.Collections.map((c: any) => new SelectionReadOnlyResponse(c));
|
||||
const collections = this.getResponseProperty('Collections');
|
||||
if (collections != null) {
|
||||
this.collections = collections.map((c: any) => new SelectionReadOnlyResponse(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
export class IdentityTokenResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class IdentityTokenResponse extends BaseResponse {
|
||||
accessToken: string;
|
||||
expiresIn: number;
|
||||
refreshToken: string;
|
||||
@ -9,13 +11,14 @@ export class IdentityTokenResponse {
|
||||
twoFactorToken: string;
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
this.accessToken = response.access_token;
|
||||
this.expiresIn = response.expires_in;
|
||||
this.refreshToken = response.refresh_token;
|
||||
this.tokenType = response.token_type;
|
||||
|
||||
this.privateKey = response.PrivateKey;
|
||||
this.key = response.Key;
|
||||
this.twoFactorToken = response.TwoFactorToken;
|
||||
this.privateKey = this.getResponseProperty('PrivateKey');
|
||||
this.key = this.getResponseProperty('Key');
|
||||
this.twoFactorToken = this.getResponseProperty('TwoFactorToken');
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,19 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
import { TwoFactorProviderType } from '../../enums/twoFactorProviderType';
|
||||
|
||||
export class IdentityTwoFactorResponse {
|
||||
export class IdentityTwoFactorResponse extends BaseResponse {
|
||||
twoFactorProviders: TwoFactorProviderType[];
|
||||
twoFactorProviders2 = new Map<TwoFactorProviderType, { [key: string]: string; }>();
|
||||
|
||||
constructor(response: any) {
|
||||
this.twoFactorProviders = response.TwoFactorProviders;
|
||||
if (response.TwoFactorProviders2 != null) {
|
||||
for (const prop in response.TwoFactorProviders2) {
|
||||
if (response.TwoFactorProviders2.hasOwnProperty(prop)) {
|
||||
this.twoFactorProviders2.set(parseInt(prop, null), response.TwoFactorProviders2[prop]);
|
||||
super(response);
|
||||
this.twoFactorProviders = this.getResponseProperty('TwoFactorProviders');
|
||||
const twoFactorProviders2 = this.getResponseProperty('TwoFactorProviders2');
|
||||
if (twoFactorProviders2 != null) {
|
||||
for (const prop in twoFactorProviders2) {
|
||||
if (twoFactorProviders2.hasOwnProperty(prop)) {
|
||||
this.twoFactorProviders2.set(parseInt(prop, null), twoFactorProviders2[prop]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
export class KeysResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class KeysResponse extends BaseResponse {
|
||||
privateKey: string;
|
||||
publicKey: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.privateKey = response.PrivateKey;
|
||||
this.publicKey = response.PublicKey;
|
||||
super(response);
|
||||
this.privateKey = this.getResponseProperty('PrivateKey');
|
||||
this.publicKey = this.getResponseProperty('PublicKey');
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
export class ListResponse<T> {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class ListResponse<T> extends BaseResponse {
|
||||
data: T[];
|
||||
continuationToken: string;
|
||||
|
||||
constructor(response: any, t: new (dataResponse: any) => T) {
|
||||
this.data = response.Data == null ? [] : response.Data.map((dr: any) => new t(dr));
|
||||
this.continuationToken = response.ContinuationToken;
|
||||
super(response);
|
||||
const data = this.getResponseProperty('Data');
|
||||
this.data = data == null ? [] : data.map((dr: any) => new t(dr));
|
||||
this.continuationToken = this.getResponseProperty('ContinuationToken');
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,18 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
import { NotificationType } from '../../enums/notificationType';
|
||||
|
||||
export class NotificationResponse {
|
||||
export class NotificationResponse extends BaseResponse {
|
||||
contextId: string;
|
||||
type: NotificationType;
|
||||
payload: any;
|
||||
|
||||
constructor(response: any) {
|
||||
this.contextId = response.contextId || response.ContextId;
|
||||
this.type = response.type != null ? response.type : response.Type;
|
||||
super(response);
|
||||
this.contextId = this.getResponseProperty('ContextId');
|
||||
this.type = this.getResponseProperty('Type');
|
||||
|
||||
const payload = response.payload || response.Payload;
|
||||
const payload = this.getResponseProperty('Payload');
|
||||
switch (this.type) {
|
||||
case NotificationType.SyncCipherCreate:
|
||||
case NotificationType.SyncCipherDelete:
|
||||
@ -35,7 +38,7 @@ export class NotificationResponse {
|
||||
}
|
||||
}
|
||||
|
||||
export class SyncCipherNotification {
|
||||
export class SyncCipherNotification extends BaseResponse {
|
||||
id: string;
|
||||
userId: string;
|
||||
organizationId: string;
|
||||
@ -43,32 +46,35 @@ export class SyncCipherNotification {
|
||||
revisionDate: Date;
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.id || response.Id;
|
||||
this.userId = response.userId || response.UserId;
|
||||
this.organizationId = response.organizationId || response.OrganizationId;
|
||||
this.collectionIds = response.collectionIds || response.CollectionIds;
|
||||
this.revisionDate = new Date(response.revisionDate || response.RevisionDate);
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.userId = this.getResponseProperty('UserId');
|
||||
this.organizationId = this.getResponseProperty('OrganizationId');
|
||||
this.collectionIds = this.getResponseProperty('CollectionIds');
|
||||
this.revisionDate = new Date(this.getResponseProperty('RevisionDate'));
|
||||
}
|
||||
}
|
||||
|
||||
export class SyncFolderNotification {
|
||||
export class SyncFolderNotification extends BaseResponse {
|
||||
id: string;
|
||||
userId: string;
|
||||
revisionDate: Date;
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.id || response.Id;
|
||||
this.userId = response.userId || response.UserId;
|
||||
this.revisionDate = new Date(response.revisionDate || response.RevisionDate);
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.userId = this.getResponseProperty('UserId');
|
||||
this.revisionDate = new Date(this.getResponseProperty('RevisionDate'));
|
||||
}
|
||||
}
|
||||
|
||||
export class UserNotification {
|
||||
export class UserNotification extends BaseResponse {
|
||||
userId: string;
|
||||
date: Date;
|
||||
|
||||
constructor(response: any) {
|
||||
this.userId = response.userId || response.UserId;
|
||||
this.date = new Date(response.date || response.Date);
|
||||
super(response);
|
||||
this.userId = this.getResponseProperty('UserId');
|
||||
this.date = new Date(this.getResponseProperty('Date'));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
import { PlanType } from '../../enums/planType';
|
||||
|
||||
export class OrganizationResponse {
|
||||
export class OrganizationResponse extends BaseResponse {
|
||||
id: string;
|
||||
name: string;
|
||||
businessName: string;
|
||||
@ -22,24 +24,25 @@ export class OrganizationResponse {
|
||||
use2fa: boolean;
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.Id;
|
||||
this.name = response.Name;
|
||||
this.businessName = response.BusinessName;
|
||||
this.businessAddress1 = response.BusinessAddress1;
|
||||
this.businessAddress2 = response.BusinessAddress2;
|
||||
this.businessAddress3 = response.BusinessAddress3;
|
||||
this.businessCountry = response.BusinessCountry;
|
||||
this.businessTaxNumber = response.BusinessTaxNumber;
|
||||
this.billingEmail = response.BillingEmail;
|
||||
this.plan = response.Plan;
|
||||
this.planType = response.PlanType;
|
||||
this.seats = response.Seats;
|
||||
this.maxCollections = response.MaxCollections;
|
||||
this.maxStorageGb = response.MaxStorageGb;
|
||||
this.useGroups = response.UseGroups;
|
||||
this.useDirectory = response.UseDirectory;
|
||||
this.useEvents = response.UseEvents;
|
||||
this.useTotp = response.UseTotp;
|
||||
this.use2fa = response.Use2fa;
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.name = this.getResponseProperty('Name');
|
||||
this.businessName = this.getResponseProperty('BusinessName');
|
||||
this.businessAddress1 = this.getResponseProperty('BusinessAddress1');
|
||||
this.businessAddress2 = this.getResponseProperty('BusinessAddress2');
|
||||
this.businessAddress3 = this.getResponseProperty('BusinessAddress3');
|
||||
this.businessCountry = this.getResponseProperty('BusinessCountry');
|
||||
this.businessTaxNumber = this.getResponseProperty('BusinessTaxNumber');
|
||||
this.billingEmail = this.getResponseProperty('BillingEmail');
|
||||
this.plan = this.getResponseProperty('Plan');
|
||||
this.planType = this.getResponseProperty('PlanType');
|
||||
this.seats = this.getResponseProperty('Seats');
|
||||
this.maxCollections = this.getResponseProperty('MaxCollections');
|
||||
this.maxStorageGb = this.getResponseProperty('MaxStorageGb');
|
||||
this.useGroups = this.getResponseProperty('UseGroups');
|
||||
this.useDirectory = this.getResponseProperty('UseDirectory');
|
||||
this.useEvents = this.getResponseProperty('UseEvents');
|
||||
this.useTotp = this.getResponseProperty('UseTotp');
|
||||
this.use2fa = this.getResponseProperty('Use2fa');
|
||||
}
|
||||
}
|
||||
|
@ -13,12 +13,13 @@ export class OrganizationSubscriptionResponse extends OrganizationResponse {
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
this.storageName = response.StorageName;
|
||||
this.storageGb = response.StorageGb;
|
||||
this.subscription = response.Subscription == null ?
|
||||
null : new BillingSubscriptionResponse(response.Subscription);
|
||||
this.upcomingInvoice = response.UpcomingInvoice == null ?
|
||||
null : new BillingSubscriptionUpcomingInvoiceResponse(response.UpcomingInvoice);
|
||||
this.expiration = response.Expiration;
|
||||
this.storageName = this.getResponseProperty('StorageName');
|
||||
this.storageGb = this.getResponseProperty('StorageGb');
|
||||
const subscription = this.getResponseProperty('Subscription');
|
||||
this.subscription = subscription == null ? null : new BillingSubscriptionResponse(subscription);
|
||||
const upcomingInvoice = this.getResponseProperty('UpcomingInvoice');
|
||||
this.upcomingInvoice = upcomingInvoice == null ? null :
|
||||
new BillingSubscriptionUpcomingInvoiceResponse(upcomingInvoice);
|
||||
this.expiration = this.getResponseProperty('Expiration');
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { OrganizationUserStatusType } from '../../enums/organizationUserStatusType';
|
||||
import { OrganizationUserType } from '../../enums/organizationUserType';
|
||||
|
||||
import { BaseResponse } from './baseResponse';
|
||||
import { SelectionReadOnlyResponse } from './selectionReadOnlyResponse';
|
||||
|
||||
export class OrganizationUserResponse {
|
||||
export class OrganizationUserResponse extends BaseResponse {
|
||||
id: string;
|
||||
userId: string;
|
||||
type: OrganizationUserType;
|
||||
@ -10,11 +12,12 @@ export class OrganizationUserResponse {
|
||||
accessAll: boolean;
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.Id;
|
||||
this.userId = response.UserId;
|
||||
this.type = response.Type;
|
||||
this.status = response.Status;
|
||||
this.accessAll = response.AccessAll;
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.userId = this.getResponseProperty('UserId');
|
||||
this.type = this.getResponseProperty('Type');
|
||||
this.status = this.getResponseProperty('Status');
|
||||
this.accessAll = this.getResponseProperty('AccessAll');
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,9 +28,9 @@ export class OrganizationUserUserDetailsResponse extends OrganizationUserRespons
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
this.name = response.Name;
|
||||
this.email = response.Email;
|
||||
this.twoFactorEnabled = response.TwoFactorEnabled;
|
||||
this.name = this.getResponseProperty('Name');
|
||||
this.email = this.getResponseProperty('Email');
|
||||
this.twoFactorEnabled = this.getResponseProperty('TwoFactorEnabled');
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,8 +39,9 @@ export class OrganizationUserDetailsResponse extends OrganizationUserResponse {
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
if (response.Collections != null) {
|
||||
this.collections = response.Collections.map((c: any) => new SelectionReadOnlyResponse(c));
|
||||
const collections = this.getResponseProperty('Collections');
|
||||
if (collections != null) {
|
||||
this.collections = collections.map((c: any) => new SelectionReadOnlyResponse(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
export class PasswordHistoryResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class PasswordHistoryResponse extends BaseResponse {
|
||||
password: string;
|
||||
lastUsedDate: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.password = response.Password;
|
||||
this.lastUsedDate = response.LastUsedDate;
|
||||
super(response);
|
||||
this.password = this.getResponseProperty('Password');
|
||||
this.lastUsedDate = this.getResponseProperty('LastUsedDate');
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
import { KdfType } from '../../enums/kdfType';
|
||||
|
||||
export class PreloginResponse {
|
||||
export class PreloginResponse extends BaseResponse {
|
||||
kdf: KdfType;
|
||||
kdfIterations: number;
|
||||
|
||||
constructor(response: any) {
|
||||
this.kdf = response.Kdf;
|
||||
this.kdfIterations = response.KdfIterations;
|
||||
super(response);
|
||||
this.kdf = this.getResponseProperty('Kdf');
|
||||
this.kdfIterations = this.getResponseProperty('KdfIterations');
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
import { OrganizationUserStatusType } from '../../enums/organizationUserStatusType';
|
||||
import { OrganizationUserType } from '../../enums/organizationUserType';
|
||||
|
||||
export class ProfileOrganizationResponse {
|
||||
export class ProfileOrganizationResponse extends BaseResponse {
|
||||
id: string;
|
||||
name: string;
|
||||
useGroups: boolean;
|
||||
@ -20,21 +22,22 @@ export class ProfileOrganizationResponse {
|
||||
enabled: boolean;
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.Id;
|
||||
this.name = response.Name;
|
||||
this.useGroups = response.UseGroups;
|
||||
this.useDirectory = response.UseDirectory;
|
||||
this.useEvents = response.UseEvents;
|
||||
this.useTotp = response.UseTotp;
|
||||
this.use2fa = response.Use2fa;
|
||||
this.selfHost = response.SelfHost;
|
||||
this.usersGetPremium = response.UsersGetPremium;
|
||||
this.seats = response.Seats;
|
||||
this.maxCollections = response.MaxCollections;
|
||||
this.maxStorageGb = response.MaxStorageGb;
|
||||
this.key = response.Key;
|
||||
this.status = response.Status;
|
||||
this.type = response.Type;
|
||||
this.enabled = response.Enabled;
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.name = this.getResponseProperty('Name');
|
||||
this.useGroups = this.getResponseProperty('UseGroups');
|
||||
this.useDirectory = this.getResponseProperty('UseDirectory');
|
||||
this.useEvents = this.getResponseProperty('UseEvents');
|
||||
this.useTotp = this.getResponseProperty('UseTotp');
|
||||
this.use2fa = this.getResponseProperty('Use2fa');
|
||||
this.selfHost = this.getResponseProperty('SelfHost');
|
||||
this.usersGetPremium = this.getResponseProperty('UsersGetPremium');
|
||||
this.seats = this.getResponseProperty('Seats');
|
||||
this.maxCollections = this.getResponseProperty('MaxCollections');
|
||||
this.maxStorageGb = this.getResponseProperty('MaxStorageGb');
|
||||
this.key = this.getResponseProperty('Key');
|
||||
this.status = this.getResponseProperty('Status');
|
||||
this.type = this.getResponseProperty('Type');
|
||||
this.enabled = this.getResponseProperty('Enabled');
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
import { ProfileOrganizationResponse } from './profileOrganizationResponse';
|
||||
|
||||
export class ProfileResponse {
|
||||
export class ProfileResponse extends BaseResponse {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
@ -15,22 +16,22 @@ export class ProfileResponse {
|
||||
organizations: ProfileOrganizationResponse[] = [];
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.Id;
|
||||
this.name = response.Name;
|
||||
this.email = response.Email;
|
||||
this.emailVerified = response.EmailVerified;
|
||||
this.masterPasswordHint = response.MasterPasswordHint;
|
||||
this.premium = response.Premium;
|
||||
this.culture = response.Culture;
|
||||
this.twoFactorEnabled = response.TwoFactorEnabled;
|
||||
this.key = response.Key;
|
||||
this.privateKey = response.PrivateKey;
|
||||
this.securityStamp = response.SecurityStamp;
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.name = this.getResponseProperty('Name');
|
||||
this.email = this.getResponseProperty('Email');
|
||||
this.emailVerified = this.getResponseProperty('EmailVerified');
|
||||
this.masterPasswordHint = this.getResponseProperty('MasterPasswordHint');
|
||||
this.premium = this.getResponseProperty('Premium');
|
||||
this.culture = this.getResponseProperty('Culture');
|
||||
this.twoFactorEnabled = this.getResponseProperty('TwoFactorEnabled');
|
||||
this.key = this.getResponseProperty('Key');
|
||||
this.privateKey = this.getResponseProperty('PrivateKey');
|
||||
this.securityStamp = this.getResponseProperty('SecurityStamp');
|
||||
|
||||
if (response.Organizations) {
|
||||
response.Organizations.forEach((org: any) => {
|
||||
this.organizations.push(new ProfileOrganizationResponse(org));
|
||||
});
|
||||
const organizations = this.getResponseProperty('Organizations');
|
||||
if (organizations != null) {
|
||||
this.organizations = organizations.map((o: any) => new ProfileOrganizationResponse(o));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
export class SelectionReadOnlyResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class SelectionReadOnlyResponse extends BaseResponse {
|
||||
id: string;
|
||||
readOnly: boolean;
|
||||
|
||||
constructor(response: any) {
|
||||
this.id = response.Id;
|
||||
this.readOnly = response.ReadOnly;
|
||||
super(response);
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.readOnly = this.getResponseProperty('ReadOnly');
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
export class SubscriptionResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class SubscriptionResponse extends BaseResponse {
|
||||
storageName: string;
|
||||
storageGb: number;
|
||||
maxStorageGb: number;
|
||||
@ -8,19 +10,21 @@ export class SubscriptionResponse {
|
||||
expiration: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.storageName = response.StorageName;
|
||||
this.storageGb = response.StorageGb;
|
||||
this.maxStorageGb = response.MaxStorageGb;
|
||||
this.subscription = response.Subscription == null ?
|
||||
null : new BillingSubscriptionResponse(response.Subscription);
|
||||
this.upcomingInvoice = response.UpcomingInvoice == null ?
|
||||
null : new BillingSubscriptionUpcomingInvoiceResponse(response.UpcomingInvoice);
|
||||
this.license = response.License;
|
||||
this.expiration = response.Expiration;
|
||||
super(response);
|
||||
this.storageName = this.getResponseProperty('StorageName');
|
||||
this.storageGb = this.getResponseProperty('StorageGb');
|
||||
this.maxStorageGb = this.getResponseProperty('MaxStorageGb');
|
||||
this.license = this.getResponseProperty('License');
|
||||
this.expiration = this.getResponseProperty('Expiration');
|
||||
const subscription = this.getResponseProperty('Subscription');
|
||||
const upcomingInvoice = this.getResponseProperty('UpcomingInvoice');
|
||||
this.subscription = subscription == null ? null : new BillingSubscriptionResponse(subscription);
|
||||
this.upcomingInvoice = upcomingInvoice == null ? null :
|
||||
new BillingSubscriptionUpcomingInvoiceResponse(upcomingInvoice);
|
||||
}
|
||||
}
|
||||
|
||||
export class BillingSubscriptionResponse {
|
||||
export class BillingSubscriptionResponse extends BaseResponse {
|
||||
trialStartDate: string;
|
||||
trialEndDate: string;
|
||||
periodStartDate: string;
|
||||
@ -32,40 +36,44 @@ export class BillingSubscriptionResponse {
|
||||
items: BillingSubscriptionItemResponse[] = [];
|
||||
|
||||
constructor(response: any) {
|
||||
this.trialEndDate = response.TrialStartDate;
|
||||
this.trialEndDate = response.TrialEndDate;
|
||||
this.periodStartDate = response.PeriodStartDate;
|
||||
this.periodEndDate = response.PeriodEndDate;
|
||||
this.cancelledDate = response.CancelledDate;
|
||||
this.cancelAtEndDate = response.CancelAtEndDate;
|
||||
this.status = response.Status;
|
||||
this.cancelled = response.Cancelled;
|
||||
if (response.Items != null) {
|
||||
this.items = response.Items.map((i: any) => new BillingSubscriptionItemResponse(i));
|
||||
super(response);
|
||||
this.trialEndDate = this.getResponseProperty('TrialStartDate');
|
||||
this.trialEndDate = this.getResponseProperty('TrialEndDate');
|
||||
this.periodStartDate = this.getResponseProperty('PeriodStartDate');
|
||||
this.periodEndDate = this.getResponseProperty('PeriodEndDate');
|
||||
this.cancelledDate = this.getResponseProperty('CancelledDate');
|
||||
this.cancelAtEndDate = this.getResponseProperty('CancelAtEndDate');
|
||||
this.status = this.getResponseProperty('Status');
|
||||
this.cancelled = this.getResponseProperty('Cancelled');
|
||||
const items = this.getResponseProperty('Items');
|
||||
if (items != null) {
|
||||
this.items = items.map((i: any) => new BillingSubscriptionItemResponse(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class BillingSubscriptionItemResponse {
|
||||
export class BillingSubscriptionItemResponse extends BaseResponse {
|
||||
name: string;
|
||||
amount: number;
|
||||
quantity: number;
|
||||
interval: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.name = response.Name;
|
||||
this.amount = response.Amount;
|
||||
this.quantity = response.Quantity;
|
||||
this.interval = response.Interval;
|
||||
super(response);
|
||||
this.name = this.getResponseProperty('Name');
|
||||
this.amount = this.getResponseProperty('Amount');
|
||||
this.quantity = this.getResponseProperty('Quantity');
|
||||
this.interval = this.getResponseProperty('Interval');
|
||||
}
|
||||
}
|
||||
|
||||
export class BillingSubscriptionUpcomingInvoiceResponse {
|
||||
export class BillingSubscriptionUpcomingInvoiceResponse extends BaseResponse {
|
||||
date: string;
|
||||
amount: number;
|
||||
|
||||
constructor(response: any) {
|
||||
this.date = response.Date;
|
||||
this.amount = response.Amount;
|
||||
super(response);
|
||||
this.date = this.getResponseProperty('Date');
|
||||
this.amount = this.getResponseProperty('Amount');
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
import { CipherResponse } from './cipherResponse';
|
||||
import { CollectionDetailsResponse } from './collectionResponse';
|
||||
import { DomainsResponse } from './domainsResponse';
|
||||
import { FolderResponse } from './folderResponse';
|
||||
import { ProfileResponse } from './profileResponse';
|
||||
|
||||
export class SyncResponse {
|
||||
export class SyncResponse extends BaseResponse {
|
||||
profile?: ProfileResponse;
|
||||
folders: FolderResponse[] = [];
|
||||
collections: CollectionDetailsResponse[] = [];
|
||||
@ -12,30 +13,31 @@ export class SyncResponse {
|
||||
domains?: DomainsResponse;
|
||||
|
||||
constructor(response: any) {
|
||||
if (response.Profile) {
|
||||
this.profile = new ProfileResponse(response.Profile);
|
||||
super(response);
|
||||
|
||||
const profile = this.getResponseProperty('Profile');
|
||||
if (profile != null) {
|
||||
this.profile = new ProfileResponse(profile);
|
||||
}
|
||||
|
||||
if (response.Folders) {
|
||||
response.Folders.forEach((folder: any) => {
|
||||
this.folders.push(new FolderResponse(folder));
|
||||
});
|
||||
const folders = this.getResponseProperty('Folders');
|
||||
if (folders != null) {
|
||||
this.folders = folders.map((f: any) => new FolderResponse(f));
|
||||
}
|
||||
|
||||
if (response.Collections) {
|
||||
response.Collections.forEach((collection: any) => {
|
||||
this.collections.push(new CollectionDetailsResponse(collection));
|
||||
});
|
||||
const collections = this.getResponseProperty('Collections');
|
||||
if (collections != null) {
|
||||
this.collections = collections.map((c: any) => new CollectionDetailsResponse(c));
|
||||
}
|
||||
|
||||
if (response.Ciphers) {
|
||||
response.Ciphers.forEach((cipher: any) => {
|
||||
this.ciphers.push(new CipherResponse(cipher));
|
||||
});
|
||||
const ciphers = this.getResponseProperty('Ciphers');
|
||||
if (ciphers != null) {
|
||||
this.ciphers = ciphers.map((c: any) => new CipherResponse(c));
|
||||
}
|
||||
|
||||
if (response.Domains) {
|
||||
this.domains = new DomainsResponse(response.Domains);
|
||||
const domains = this.getResponseProperty('Domains');
|
||||
if (domains != null) {
|
||||
this.domains = new DomainsResponse(domains);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
export class TwoFactorAuthenticatorResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class TwoFactorAuthenticatorResponse extends BaseResponse {
|
||||
enabled: boolean;
|
||||
key: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.enabled = response.Enabled;
|
||||
this.key = response.Key;
|
||||
super(response);
|
||||
this.enabled = this.getResponseProperty('Enabled');
|
||||
this.key = this.getResponseProperty('Key');
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,16 @@
|
||||
export class TwoFactorDuoResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class TwoFactorDuoResponse extends BaseResponse {
|
||||
enabled: boolean;
|
||||
host: string;
|
||||
secretKey: string;
|
||||
integrationKey: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.enabled = response.Enabled;
|
||||
this.host = response.Host;
|
||||
this.secretKey = response.SecretKey;
|
||||
this.integrationKey = response.IntegrationKey;
|
||||
super(response);
|
||||
this.enabled = this.getResponseProperty('Enabled');
|
||||
this.host = this.getResponseProperty('Host');
|
||||
this.secretKey = this.getResponseProperty('SecretKey');
|
||||
this.integrationKey = this.getResponseProperty('IntegrationKey');
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
export class TwoFactorEmailResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class TwoFactorEmailResponse extends BaseResponse {
|
||||
enabled: boolean;
|
||||
email: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.enabled = response.Enabled;
|
||||
this.email = response.Email;
|
||||
super(response);
|
||||
this.enabled = this.getResponseProperty('Enabled');
|
||||
this.email = this.getResponseProperty('Email');
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
import { TwoFactorProviderType } from '../../enums/twoFactorProviderType';
|
||||
|
||||
export class TwoFactorProviderResponse {
|
||||
export class TwoFactorProviderResponse extends BaseResponse {
|
||||
enabled: boolean;
|
||||
type: TwoFactorProviderType;
|
||||
|
||||
constructor(response: any) {
|
||||
this.enabled = response.Enabled;
|
||||
this.type = response.Type;
|
||||
super(response);
|
||||
this.enabled = this.getResponseProperty('Enabled');
|
||||
this.type = this.getResponseProperty('Type');
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
export class TwoFactorRecoverResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class TwoFactorRecoverResponse extends BaseResponse {
|
||||
code: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.code = response.Code;
|
||||
super(response);
|
||||
this.code = this.getResponseProperty('Code');
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,41 @@
|
||||
export class TwoFactorU2fResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class TwoFactorU2fResponse extends BaseResponse {
|
||||
enabled: boolean;
|
||||
keys: KeyResponse[];
|
||||
|
||||
constructor(response: any) {
|
||||
this.enabled = response.Enabled;
|
||||
this.keys = response.Keys == null ? null : response.Keys.map((k: any) => new KeyResponse(k));
|
||||
super(response);
|
||||
this.enabled = this.getResponseProperty('Enabled');
|
||||
const keys = this.getResponseProperty('Keys');
|
||||
this.keys = keys == null ? null : keys.map((k: any) => new KeyResponse(k));
|
||||
}
|
||||
}
|
||||
|
||||
export class KeyResponse {
|
||||
export class KeyResponse extends BaseResponse {
|
||||
name: string;
|
||||
id: number;
|
||||
compromised: boolean;
|
||||
|
||||
constructor(response: any) {
|
||||
this.name = response.Name;
|
||||
this.id = response.Id;
|
||||
this.compromised = response.Compromised;
|
||||
super(response);
|
||||
this.name = this.getResponseProperty('Name');
|
||||
this.id = this.getResponseProperty('Id');
|
||||
this.compromised = this.getResponseProperty('Compromised');
|
||||
}
|
||||
}
|
||||
|
||||
export class ChallengeResponse {
|
||||
export class ChallengeResponse extends BaseResponse {
|
||||
userId: string;
|
||||
appId: string;
|
||||
challenge: string;
|
||||
version: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.userId = response.UserId;
|
||||
this.appId = response.AppId;
|
||||
this.challenge = response.Challenge;
|
||||
this.version = response.Version;
|
||||
super(response);
|
||||
this.userId = this.getResponseProperty('UserId');
|
||||
this.appId = this.getResponseProperty('AppId');
|
||||
this.challenge = this.getResponseProperty('Challenge');
|
||||
this.version = this.getResponseProperty('Version');
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
export class TwoFactorYubiKeyResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class TwoFactorYubiKeyResponse extends BaseResponse {
|
||||
enabled: boolean;
|
||||
key1: string;
|
||||
key2: string;
|
||||
@ -8,12 +10,13 @@ export class TwoFactorYubiKeyResponse {
|
||||
nfc: boolean;
|
||||
|
||||
constructor(response: any) {
|
||||
this.enabled = response.Enabled;
|
||||
this.key1 = response.Key1;
|
||||
this.key2 = response.Key2;
|
||||
this.key3 = response.Key3;
|
||||
this.key4 = response.Key4;
|
||||
this.key5 = response.Key5;
|
||||
this.nfc = response.Nfc;
|
||||
super(response);
|
||||
this.enabled = this.getResponseProperty('Enable');
|
||||
this.key1 = this.getResponseProperty('Key1');
|
||||
this.key2 = this.getResponseProperty('Key2');
|
||||
this.key3 = this.getResponseProperty('Key3');
|
||||
this.key4 = this.getResponseProperty('Key4');
|
||||
this.key5 = this.getResponseProperty('Key5');
|
||||
this.nfc = this.getResponseProperty('Nfc');
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
export class UserKeyResponse {
|
||||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class UserKeyResponse extends BaseResponse {
|
||||
userId: string;
|
||||
publicKey: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.userId = response.UserId;
|
||||
this.publicKey = response.PublicKey;
|
||||
super(response);
|
||||
this.userId = this.getResponseProperty('UserId');
|
||||
this.publicKey = this.getResponseProperty('PublicKey');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user