Skip to content

basalt / sdk/src / ClientOptions

Interface: ClientOptions ​

Defined in: sdk/src/client.ts:13

Properties ​

baseUrl ​

> baseUrl: string

Defined in: sdk/src/client.ts:15

API root, e.g. 'https://api.example.com'. A trailing slash is fine.


fetch? ​

> optional fetch?: (input, init?) => Promise<Response>

Defined in: sdk/src/client.ts:17

Fetch implementation. Defaults to the global fetch.

Parameters ​

input ​

string | URL | Request

init? ​

RequestInit

Returns ​

Promise<Response>


getToken? ​

> optional getToken?: () => string | Promise<string | undefined> | undefined

Defined in: sdk/src/client.ts:21

Current access token — attached as Authorization: Bearer.

Returns ​

string | Promise<string | undefined> | undefined


headers? ​

> optional headers?: Record<string, string>

Defined in: sdk/src/client.ts:19

Headers sent on every request (before auth).


refresh? ​

> optional refresh?: () => Promise<string | null>

Defined in: sdk/src/client.ts:26

Called once on a 401 to obtain a fresh token; the request is then retried with it. Return null to give up and surface the 401.

Returns ​

Promise<string | null>

Released under the MIT License.