1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-26 12:25:20 +01:00

PM-1049 - Add getDevices call to retrieve all user devices to API service

This commit is contained in:
Jared Snider 2023-05-10 15:57:16 -04:00
parent 59a8dee993
commit 9d140a8aad
No known key found for this signature in database
GPG Key ID: A149DDD612516286
2 changed files with 10 additions and 0 deletions

View File

@ -70,6 +70,7 @@ import { UpdateTwoFactorYubioOtpRequest } from "../auth/models/request/update-tw
import { ApiKeyResponse } from "../auth/models/response/api-key.response";
import { AuthRequestResponse } from "../auth/models/response/auth-request.response";
import { DeviceVerificationResponse } from "../auth/models/response/device-verification.response";
import { DeviceResponse } from "../auth/models/response/device.response";
import {
EmergencyAccessGranteeDetailsResponse,
EmergencyAccessGrantorDetailsResponse,
@ -363,6 +364,8 @@ export abstract class ApiService {
) => Promise<DeviceVerificationResponse>;
getKnownDevice: (email: string, deviceIdentifier: string) => Promise<boolean>;
getDevices: () => Promise<ListResponse<DeviceResponse>>;
getEmergencyAccessTrusted: () => Promise<ListResponse<EmergencyAccessGranteeDetailsResponse>>;
getEmergencyAccessGranted: () => Promise<ListResponse<EmergencyAccessGrantorDetailsResponse>>;
getEmergencyAccess: (id: string) => Promise<EmergencyAccessGranteeDetailsResponse>;

View File

@ -77,6 +77,7 @@ import { UpdateTwoFactorYubioOtpRequest } from "../auth/models/request/update-tw
import { ApiKeyResponse } from "../auth/models/response/api-key.response";
import { AuthRequestResponse } from "../auth/models/response/auth-request.response";
import { DeviceVerificationResponse } from "../auth/models/response/device-verification.response";
import { DeviceResponse } from "../auth/models/response/device.response";
import {
EmergencyAccessGranteeDetailsResponse,
EmergencyAccessGrantorDetailsResponse,
@ -1118,6 +1119,12 @@ export class ApiService implements ApiServiceAbstraction {
return r as boolean;
}
// TODO: move this method to new devices-api.service once it's merged to master
async getDevices(): Promise<ListResponse<DeviceResponse>> {
const r = await this.send("GET", "/devices", null, true, true, null);
return new ListResponse(r, DeviceResponse);
}
// Emergency Access APIs
async getEmergencyAccessTrusted(): Promise<ListResponse<EmergencyAccessGranteeDetailsResponse>> {