Skip to content

RestClientConfig

Defined in: clients/http-client/src/rest-client.ts:8

Settings for createRestClient.

optional apiKeyHeader?: string

Defined in: clients/http-client/src/rest-client.ts:21

Header name when tokenScheme is "apikey". Defaults to "x-api-key".


baseUrl: string

Defined in: clients/http-client/src/rest-client.ts:10

Default base URL (e.g. “https://api.github.com”).


optional defaultQuery?: Record<string, string>

Defined in: clients/http-client/src/rest-client.ts:28

Query params appended to every request URL (e.g. Vercel’s teamId).


optional errors?: ErrorSink

Defined in: clients/http-client/src/rest-client.ts:46

Reports transport failures (network errors, status: 0) and unexpected 5xx responses. 4xx is left unreported — those are typically expected / handled by the caller (a 404 from a “does this exist” check, etc.). Defaults to a no-op.


optional extraHeaders?: Record<string, string>

Defined in: clients/http-client/src/rest-client.ts:26

Static headers merged into every request. Applied after the auth header so they can override defaults (e.g. GitHub’s accept override).


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

Defined in: clients/http-client/src/rest-client.ts:32

Override fetch for tests. Defaults to globalThis.fetch.

string | URL | Request

RequestInit

Promise<Response>


optional logger?: Logger

Defined in: clients/http-client/src/rest-client.ts:39

Structured logger for request/response diagnostics (debug level). Defaults to a no-op — the seam, not a runtime. Bring your own @theholocron/observability Logger (or any structurally-compatible one) to see it.


optional retries?: number

Defined in: clients/http-client/src/rest-client.ts:52

How many times to send a request again after a transport failure that is safe to repeat (see worthRetrying): the connection never opened, or a read was dropped. An HTTP error status is retried only when it is listed in retryStatuses. Defaults to 2; 0 turns it off.


optional retryDelayMs?: number

Defined in: clients/http-client/src/rest-client.ts:54

Milliseconds before the first retry; each later one waits three times as long. Defaults to 300.


optional retryStatuses?: readonly number[]

Defined in: clients/http-client/src/rest-client.ts:60

HTTP statuses (for example [500, 502, 503, 504]) that are worth asking for again, using the same retries and retryDelayMs. Only a read (GET or HEAD) is repeated; a write is never sent again on a status, because the server may have applied it. Defaults to none, so a client that does not ask behaves as before.


token: string

Defined in: clients/http-client/src/rest-client.ts:12

Auth token.


optional tokenScheme?: "bearer" | "basic" | "apikey"

Defined in: clients/http-client/src/rest-client.ts:19

How the token is sent.

  • "bearer" (default): Authorization: Bearer <token>
  • "basic": Authorization: Basic <token>
  • "apikey": uses apiKeyHeader (e.g. x-api-key)

optional vendor?: string

Defined in: clients/http-client/src/rest-client.ts:30

Vendor label used in error messages (e.g. "GitHub").