PS-589 Added get/put device verification settings api calls

This commit is contained in:
Federico Andrés Maccaroni 2022-05-25 17:10:30 -03:00
parent 0a072b6452
commit 684500b864
4 changed files with 35 additions and 0 deletions

View File

@ -1,7 +1,9 @@
import { OrganizationConnectionType } from "jslib-common/enums/organizationConnectionType";
import { DeviceVerificationRequest } from "jslib-common/models/request/DeviceVerificationRequest";
import { OrganizationConnectionRequest } from "jslib-common/models/request/organizationConnectionRequest";
import { BillingHistoryResponse } from "jslib-common/models/response/billingHistoryResponse";
import { BillingPaymentResponse } from "jslib-common/models/response/billingPaymentResponse";
import { DeviceVerificationResponse } from "jslib-common/models/response/deviceVerificationResponse";
import {
OrganizationConnectionConfigApis,
OrganizationConnectionResponse,
@ -493,6 +495,8 @@ export abstract class ApiService {
postTwoFactorRecover: (request: TwoFactorRecoveryRequest) => Promise<any>;
postTwoFactorEmailSetup: (request: TwoFactorEmailRequest) => Promise<any>;
postTwoFactorEmail: (request: TwoFactorEmailRequest) => Promise<any>;
getDeviceVerificationSettings: () => Promise<DeviceVerificationResponse>;
putDeviceVerificationSettings: (request: DeviceVerificationRequest) => Promise<DeviceVerificationResponse>;
getEmergencyAccessTrusted: () => Promise<ListResponse<EmergencyAccessGranteeDetailsResponse>>;
getEmergencyAccessGranted: () => Promise<ListResponse<EmergencyAccessGrantorDetailsResponse>>;

View File

@ -0,0 +1,7 @@
export class DeviceVerificationRequest {
unknownDeviceVerificationEnabled: boolean;
constructor(unknownDeviceVerificationEnabled: boolean) {
this.unknownDeviceVerificationEnabled = unknownDeviceVerificationEnabled;
}
}

View File

@ -0,0 +1,12 @@
import { BaseResponse } from "./baseResponse";
export class DeviceVerificationResponse extends BaseResponse {
isDeviceVerificationSectionEnabled: boolean;
unknownDeviceVerificationEnabled: boolean;
constructor(response: any) {
super(response);
this.isDeviceVerificationSectionEnabled = this.getResponseProperty("IsDeviceVerificationSectionEnabled");
this.unknownDeviceVerificationEnabled = this.getResponseProperty("UnknownDeviceVerificationEnabled");
}
}

View File

@ -187,6 +187,8 @@ import {
import { TwoFactorYubiKeyResponse } from "../models/response/twoFactorYubiKeyResponse";
import { UserKeyResponse } from "../models/response/userKeyResponse";
import { SendAccessView } from "../models/view/sendAccessView";
import { DeviceVerificationResponse } from "../models/response/deviceVerificationResponse";
import { DeviceVerificationRequest } from "../models/request/DeviceVerificationRequest";
export class ApiService implements ApiServiceAbstraction {
private device: DeviceType;
@ -1571,6 +1573,16 @@ export class ApiService implements ApiServiceAbstraction {
return this.send("POST", "/two-factor/send-email-login", request, false, false);
}
async getDeviceVerificationSettings(): Promise<DeviceVerificationResponse> {
const r = await this.send("GET", "/two-factor/get-device-verification-settings", null, true, true);
return new DeviceVerificationResponse(r);
}
async putDeviceVerificationSettings(request: DeviceVerificationRequest): Promise<DeviceVerificationResponse> {
const r = await this.send("PUT", "/two-factor/device-verification-settings", request, true, true);
return new DeviceVerificationResponse(r);
}
// Emergency Access APIs
async getEmergencyAccessTrusted(): Promise<ListResponse<EmergencyAccessGranteeDetailsResponse>> {