RequestOptions

Interface: RequestOptions<TData, ThrowOnError, Url>

Defined in: api/client/types.gen.ts:52

Extends

  • Config<{ throwOnError: ThrowOnError; }>.Pick<ServerSentEventsOptions<TData>, "onRequest" | "onSseError" | "onSseEvent" | "sseDefaultRetryDelay" | "sseMaxRetryAttempts" | "sseMaxRetryDelay">

Type Parameters

TData

TData = unknown

ThrowOnError

ThrowOnError *extends* boolean = boolean

Url

Url *extends* string = string

Properties

auth?

optional auth?: ((auth) => AuthToken | Promise<AuthToken>) | AuthToken

Defined in: api/core/types.gen.ts:40

Auth token or a function returning auth token. The resolved value will be added to the request payload as defined by its security array.

Inherited from

Config.auth


axios?

optional axios?: AxiosStatic | AxiosInstance

Defined in: api/client/types.gen.ts:27

Axios implementation. You can use this option to provide either an

AxiosStatic or an AxiosInstance.

Default

axios

Inherited from

Config.axios


baseURL?

optional baseURL?: unknown

Defined in: api/client/types.gen.ts:31

Base URL for all requests made by this client.

Inherited from

Config.baseURL


body?

optional body?: unknown

Defined in: api/client/types.gen.ts:75

Any body that you want to add to your request.

https://developer.mozilla.org/docs/Web/API/fetch#body


bodySerializer?

optional bodySerializer?: BodySerializer | null

Defined in: api/core/types.gen.ts:45

A function for serializing request body parameter. By default, JSON.stringify() will be used.

Inherited from

Config.bodySerializer


headers?

optional headers?: AxiosRequestHeaders | Record<string, unknown>

Defined in: api/client/types.gen.ts:38

An object containing any HTTP headers that you want to pre-populate your

Headers object with.

See more

Inherited from

Config.headers


method?

optional method?: "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE"

Defined in: api/core/types.gen.ts:63

The request method.

See more

Inherited from

Config.method


onRequest?

optional onRequest?: (url, init) => Promise<Request>

Defined in: api/core/serverSentEvents.gen.ts:17

Implementing clients can call request interceptors inside this hook.

Parameters

url
[object Object]
init
[object Object]

Returns

Promise<Request>

Inherited from

[object Object]

onSseError?

optional onSseError?: (error) => void

Defined in: api/core/serverSentEvents.gen.ts:25

Callback invoked when a network or parsing error occurs during streaming.

This option applies only if the endpoint returns a stream of events.

Parameters

error
[object Object]

The error that occurred.

Returns

[object Object]

Inherited from

[object Object]

onSseEvent?

optional onSseEvent?: (event) => void

Defined in: api/core/serverSentEvents.gen.ts:34

Callback invoked when an event is streamed from the server.

This option applies only if the endpoint returns a stream of events.

Parameters

event

StreamEvent<TData>

Event streamed from the server.

Returns

[object Object]

Nothing (void).

Inherited from

[object Object]

path?

optional path?: Record<string, unknown>

Defined in: api/client/types.gen.ts:76


query?

optional query?: Record<string, unknown>

Defined in: api/client/types.gen.ts:77


querySerializer?

optional querySerializer?: QuerySerializer | QuerySerializerOptions

Defined in: api/core/types.gen.ts:74

A function for serializing request query parameters. By default, arrays will be exploded in form style, objects will be exploded in deepObject style, and reserved characters are percent-encoded.

This method will have no effect if the native paramsSerializer() Axios API function is used.

View examples

Inherited from

Config.querySerializer


requestValidator?

optional requestValidator?: (data) => Promise<unknown>

Defined in: api/core/types.gen.ts:80

A function validating request data. This is useful if you want to ensure the request conforms to the desired shape, so it can be safely sent to the server.

Parameters

data
[object Object]

Returns

Promise<unknown>

Inherited from

Config.requestValidator


responseTransformer?

optional responseTransformer?: (data) => Promise<unknown>

Defined in: api/core/types.gen.ts:85

A function transforming response data before it's returned. This is useful for post-processing data, e.g., converting ISO strings into Date objects.

Parameters

data
[object Object]

Returns

Promise<unknown>

Inherited from

Config.responseTransformer


responseValidator?

optional responseValidator?: (data) => Promise<unknown>

Defined in: api/core/types.gen.ts:91

A function validating response data. This is useful if you want to ensure the response conforms to the desired shape, so it can be safely passed to the transformers and returned to the user.

Parameters

data
[object Object]

Returns

Promise<unknown>

Inherited from

Config.responseValidator


security?

optional security?: readonly Auth[]

Defined in: api/client/types.gen.ts:81

Security mechanism(s) to use for the request.


sseDefaultRetryDelay?

optional sseDefaultRetryDelay?: number

Defined in: api/core/serverSentEvents.gen.ts:43

Default retry delay in milliseconds.

This option applies only if the endpoint returns a stream of events.

Default

3000

Inherited from

[object Object]

sseMaxRetryAttempts?

optional sseMaxRetryAttempts?: number

Defined in: api/core/serverSentEvents.gen.ts:47

Maximum number of retry attempts before giving up.

Inherited from

[object Object]

sseMaxRetryDelay?

optional sseMaxRetryDelay?: number

Defined in: api/core/serverSentEvents.gen.ts:57

Maximum retry delay in milliseconds.

Applies only when exponential backoff is used.

This option applies only if the endpoint returns a stream of events.

Default

30000

Inherited from

[object Object]

throwOnError?

optional throwOnError?: ThrowOnError

Defined in: api/client/types.gen.ts:49

Throw an error instead of returning it in the response?

Default

false

Inherited from

Config.throwOnError


url

[object Object]

Defined in: api/client/types.gen.ts:82

Overrides

[object Object]

On this page