Skip to main content

Class: BaseApiClient

Defined in: packages/sdk/src/api/base.ts:153

Extended by

Constructors

Constructor

new BaseApiClient(apiKey, baseUrl, customFetch?): BaseApiClient

Defined in: packages/sdk/src/api/base.ts:173

Parameters

apiKey

string | undefined

baseUrl

string

customFetch?

{(input, init?): Promise<Response>; (input, init?): Promise<Response>; }

Returns

BaseApiClient

Methods

getActingMember()

getActingMember(): string | undefined

Defined in: packages/sdk/src/api/base.ts:226

Get the current acting member UUID.

Returns

string | undefined


setActingMember()

setActingMember(memberUuid): void

Defined in: packages/sdk/src/api/base.ts:219

Set the acting member UUID for member identity switching. When set, all API requests will include the X-Acting-Member header. The backend will validate that the authenticated account owns this member and use it as the effective identity for the request.

Parameters

memberUuid

string | undefined

Returns

void


setEnhancedAuthHandler()

setEnhancedAuthHandler(handler): void

Defined in: packages/sdk/src/api/base.ts:193

Set the handler for enhanced authentication requirements (RFC 9470 Step-Up Auth). This handler is called when a 401 response includes WWW-Authenticate header with error="insufficient_user_authentication".

Parameters

handler

EnhancedAuthHandler | undefined

Returns

void


setOrgAuthHandler()

setOrgAuthHandler(handler): void

Defined in: packages/sdk/src/api/base.ts:202

Set the handler for organization authentication requirements. This handler is called when a 401 response includes WWW-Authenticate header with realm="org". The handler should redirect the user to complete org auth.

Parameters

handler

OrgAuthHandler | undefined

Returns

void


setOrgToken()

setOrgToken(token, orgUuid?): void

Defined in: packages/sdk/src/api/base.ts:240

Set the org auth credential for cross-domain requests. Legacy orgToken values use X-Org-Token; opaque gr_sess_ values use X-Org-Session, allowing org-level SSO verification without cookies.

orgUuid is the org that issued the credential; passing it lets the 401 handler detect a stale token when a subsequent request targets a different org and re-fire the org-auth handler instead of silently 401-ing. Callers without that context (legacy / unknown) may omit it.

Parameters

token

string | undefined

orgUuid?

string

Returns

void


updateApiKey()

updateApiKey(newApiKey): void

Defined in: packages/sdk/src/api/base.ts:209

Update the API key (used after successful re-authentication).

Parameters

newApiKey

string

Returns

void