Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ApiCaller

Interface prescribes what's expected to be implemented by an object that initiates api requests.

link

{API.prototype.call}

link

{CallsApi.prototype.call}

Hierarchy

  • ApiCaller

Implemented by

Index

Properties

requestOptions?: Partial<RequestInit>

Optional property containing request configuration object.

Methods

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

    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, any>

    Returns Promise<ApiResponse<null | string | any[] | Record<string, any>>>

  • initRequest(url: string, method: Method, data?: Record<string, unknown> | FormData, queryParameters?: Record<string, any>): Partial<RequestInit> | Promise<Partial<RequestInit>>
  • If defined it should return a request configuration object.

    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 queryParameters: Record<string, any>

    Returns Partial<RequestInit> | Promise<Partial<RequestInit>>

Generated using TypeDoc