All route paths are joined to this URL.
OptionalfetchOverride: ClientFetchOptional fetch override to wrap or reimplement the native fetch function.
OptionalwebSocketConstructor: new (...params: WebSocketConnectWebSocketConstructorParams) => CommonWebSocketOptional WebSocket constructor used as the fallback when
RestVirClient.connectWebSocket is called without an explicit
webSocketConstructor param.
ReadonlyapiAll route paths are joined to this URL.
OptionalfetchOptional fetch override to wrap or reimplement the native fetch function.
OptionalwebOptional WebSocket constructor used as the fallback when
RestVirClient.connectWebSocket is called without an explicit
webSocketConstructor param.
Return a method-keyed object for the given endpoint. Each property is a function that runs the fetch for that specific HTTP method.
Send a request to an endpoint definition and return a ReadableStream instead of parsing the
response body. Useful for consuming SSE (Server-Sent Events) endpoints from the frontend.
Uses the same request-building flow as .fetch(), but skips response body and JSON
validation.
ProtectedrunValidate that the endpoint is registered, build its request init, send the request, and shape
the response into the status-keyed output. The body of RestVirClient.fetch and
RestVirClient.fetchStream; their only divergent step is how they read responseData
out of the response.
OptionalfetchOverride?: ClientFetchOverride the fetch function that is used when fetching the endpoint.
Optionaloptions?: Omit<RequestInit, "body" | "method">Set the standard request init options that fetch allows.
OptionalpathParams?: GenericPathParamsSet the required path params, if any. These are only allowed if the endpoint's path has param or wildcard strings.
OptionalrequestData?: anySet the endpoint fetch's request data, if allowed by the endpoint.
OptionalrequiredHeaders?: Record<string, string>Set headers that are required by this route's definition, if any. Note that additional
headers can be supplied in the options property, but any headers provided in both will
instead use the values from here here (in requiredHeaders).
OptionalsearchParams?: Readonly<Record<string, AllowedSearchParamValue>>Set search params on the endpoint's URL.
OptionalskipAutomaticContentTypeHeader?: booleanIf true, automatic request data 'Content-Type' header assignment will be skipped.
OptionalgetResponseDataOverride: HandleDeclaredResponseStatusOverride
Package
@rest-vir/api