Options
All
  • Public
  • Public/Protected
  • All
Menu
experimental

This API is experimental and might change in newer versions. Use with caution. Generic request builder for building and executing requests based on apis generated by the OpenAPI generator.

Type parameters

  • ApiT

    Interface of the generated api. All properties of the interface will be treated as functions.

  • FnT: keyof ApiT

    Literal string type of the function name, must be a key of ApiT and represent a function.

Hierarchy

  • OpenApiRequestBuilder

Index

Constructors

Properties

Methods

Constructors

constructor

  • new OpenApiRequestBuilder<ApiT, FnT>(apiConstructor: ConstructorType<ApiT>, fn: FnT, ...args: ParametersType<ApiT, FnT>): OpenApiRequestBuilder<ApiT, FnT>
  • Create an instance of RestRequestBuilder.

    Type parameters

    • ApiT

    • FnT: string | number | symbol

    Parameters

    • apiConstructor: ConstructorType<ApiT>

      Constructor of the underlying OpenApi api definition.

    • fn: FnT

      Name of the function represented in thie request builder.

    • Rest ...args: ParametersType<ApiT, FnT>

      Arguments to pass to the api function.

    Returns OpenApiRequestBuilder<ApiT, FnT>

Properties

fn

fn: FnT

Methods

addCustomHeaders

  • Add custom headers to the request. If a header field with the given name already exists it is overwritten.

    Parameters

    • headers: Record<string, string>

      Key-value pairs denoting additional custom headers

    Returns OpenApiRequestBuilder<ApiT, FnT>

    The request builder itself, to facilitate method chaining

execute

  • Execute request and get the response data. Use this to conveniently access the data of a service without technical information about the response.

    Parameters

    Returns Promise<UnwrapAxiosResponse<FunctionReturnType<ApiT, FnT>>>

    A promise resolving to the requested return type.

executeRaw

  • Execute request and get a raw AxiosResponse, including all information about the HTTP response. This especially comes in handy, when you need to access the headers or status code of the response.

    Parameters

    Returns Promise<FunctionReturnType<ApiT, FnT>>

    A promise resolving to an AxiosResponse.