mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 15:23:33 +00:00
feat(tokens): Allow Inactive user authenticated API calls
This commit is contained in:
@@ -127,11 +127,34 @@ import { OptionalCipherResponse } from "../vault/models/response/optional-cipher
|
||||
* of this decision please read https://contributing.bitwarden.com/architecture/adr/refactor-api-service.
|
||||
*/
|
||||
export abstract class ApiService {
|
||||
/** @deprecated Use the overload accepting the user you want the request authenticated for. */
|
||||
abstract send(
|
||||
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH",
|
||||
path: string,
|
||||
body: any,
|
||||
authed: boolean,
|
||||
authed: true,
|
||||
hasResponse: boolean,
|
||||
apiUrl?: string | null,
|
||||
alterHeaders?: (header: Headers) => void,
|
||||
): Promise<any>;
|
||||
|
||||
/** Sends an unauthenticated API request. */
|
||||
abstract send(
|
||||
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH",
|
||||
path: string,
|
||||
body: any,
|
||||
authed: false,
|
||||
hasResponse: boolean,
|
||||
apiUrl?: string | null,
|
||||
alterHeaders?: (header: Headers) => void,
|
||||
): Promise<any>;
|
||||
|
||||
/** Sends an API request authenticated with the given users ID. */
|
||||
abstract send(
|
||||
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH",
|
||||
path: string,
|
||||
body: any,
|
||||
userId: UserId,
|
||||
hasResponse: boolean,
|
||||
apiUrl?: string | null,
|
||||
alterHeaders?: (headers: Headers) => void,
|
||||
@@ -499,7 +522,7 @@ export abstract class ApiService {
|
||||
abstract postBitPayInvoice(request: BitPayInvoiceRequest): Promise<string>;
|
||||
abstract postSetupPayment(): Promise<string>;
|
||||
|
||||
abstract getActiveBearerToken(): Promise<string>;
|
||||
abstract getActiveBearerToken(userId: UserId): Promise<string>;
|
||||
abstract fetch(request: Request): Promise<Response>;
|
||||
abstract nativeFetch(request: Request): Promise<Response>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user