Class API

The default ApiCaller implementation used by upfrontjs.

Link

Hierarchy

  • API

Implements

Indexable

[index: string]: CallableFunction | qs.IStringifyOptions | Record<string, unknown>

Constructors

Properties

Methods

Constructors

Properties

getParamEncodingOptions: IStringifyOptions = ...

The settings for the parsing of the get parameters.

See

https://www.npmjs.com/package/qs

Methods

  • The expected signature of the call method.

    Parameters

    • url: string

      The endpoint the request goes to.

    • method: "head" | "options" | "connect" | "CONNECT" | "HEAD" | "OPTIONS" | "TRACE" | "trace"

      The method the request uses.

    • Optional data: FormData | Record<string, unknown>

      The optional data to send with the request.

    • Optional customHeaders: CustomHeaders

      Custom headers to merge into the request.

    • Optional queryParameters: Record<string, unknown>

    Returns Promise<ApiResponse<null | string | any[] | Record<string, any>> & {
        request: {
            method: "CONNECT" | "HEAD" | "OPTIONS" | "TRACE";
        };
    }>

  • Type Parameters

    • T

    Parameters

    • url: string
    • method: Method
    • Optional data: FormData | Record<string, unknown>
    • Optional customHeaders: CustomHeaders
    • Optional queryParameters: Record<string, unknown>

    Returns Promise<ApiResponse<T>>

  • Protected

    Prepare/compile the ajax call initialisation.

    Parameters

    • url: string

      The endpoint the request goes to.

    • method: Method

      The method the request uses.

    • Optional data: FormData | Record<string, unknown>

      The optional data to send with the request.

    • Optional customHeaders: CustomHeaders

      Custom headers to merge into the request.

    • Optional queryParameters: Record<string, unknown>

      The query parameters to append to the url

    Returns Promise<{
        requestInit: RequestInit;
        url: string;
    }>

Generated using TypeDoc