Interface ApiCaller

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

Link

Link

Hierarchy

  • ApiCaller

Implemented by

Properties

call: ((url, method, data?, customHeaders?, queryParameters?) => Promise<ApiResponse<null | string | any[] | Record<string, any>>>)

Type declaration

    • (url, method, data?, customHeaders?, queryParameters?): 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: 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, any>

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

initRequest?: ((url, method, data?, queryParameters?) => Partial<RequestInit> | Promise<Partial<RequestInit>>)

Type declaration

    • (url, method, data?, queryParameters?): 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: FormData | Record<string, unknown>

        The optional data to send with the request.

      • Optional queryParameters: Record<string, any>

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

requestOptions?: Partial<RequestInit>

Optional property containing request configuration object.

Generated using TypeDoc