Options
All
  • Public
  • Public/Protected
  • All
Menu

The default ApiCaller implementation used by upfrontjs.

link

{ApiCaller}

Hierarchy

  • API

Implements

Indexable

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

Enable indexing object by strings.

Index

Constructors

Properties

getParamEncodingOptions: IStringifyOptions = ...

The settings for the parsing of the get parameters.

see

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

Methods

  • call(url: string, method: "HEAD" | "head", data?: Record<string, unknown> | FormData, customHeaders?: CustomHeaders, queryParameters?: Record<string, unknown>): Promise<ApiResponse<null | string | any[] | Record<string, any>> & { request: { method: "HEAD" } }>
  • call<T>(url: string, method: Method, data?: Record<string, unknown> | FormData, customHeaders?: CustomHeaders, queryParameters?: Record<string, unknown>): Promise<ApiResponse<T>>
  • The expected signature of the call method.

    Parameters

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

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

  • Type parameters

    • T

    Parameters

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

    Returns Promise<ApiResponse<T>>

  • initConfig(url: string, method: Method, data?: Record<string, unknown> | FormData, customHeaders?: CustomHeaders, queryParameters?: Record<string, unknown>): Promise<{ requestInit: RequestInit; url: string }>
  • Prepare/compile the ajax call initialisation.

    Parameters

    • url: string

      The endpoint the request goes to.

    • method: Method

      The method the request uses.

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

      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