Sinch Node.js SDK - v1.9.0
    Preparing search index...

    Class ApiFetchClient

    Client to process the call to the API using Fetch API

    Index

    Constructors

    • Initialize your API Client instance with the provided configuration options. Default request plugins: VersionRequest Default response plugins: ExceptionResponse

      Parameters

      • options: ApiClientOptions

        Configuration options for the API Client.

      Returns ApiFetchClient

    Properties

    apiClientOptions: ApiClientOptions

    Methods

    • Run the request plugins on the request options and attach the logger.

      Parameters

      • options: RequestOptions

        The request options to transform.

      • OptionalskipPlugin: (plugin: RequestPlugin) => boolean

        Returns true for the plugins that must not run for this request.

      Returns Promise<RequestOptions>

      The transformed request options.

    • Returns a map containing the query parameters based on the provided data and names.

      Type Parameters

      • T extends { [key: string]: any }

      Parameters

      • data: T

        The data object from which to extract query parameters.

      • names: (keyof T)[]

        An array of keys (property names) to extract from the data object.

      Returns { [p in string | number | symbol]: string }

      A map containing the extracted query parameters.

    • Asynchronously prepares options for an HTTP request.

      Parameters

      • url: string

        The URL for the HTTP request.

      • method: string

        The HTTP method for the request (e.g., 'GET', 'POST').

      • queryParams: { [key: string]: string | undefined }

        An object representing query parameters.

      • headers: { [key: string]: string | undefined }

        An object representing headers.

      • Optionalbody: RequestBody

        The request body, if applicable.

      • Optionalpath: string

        An optional path for the request.

      Returns Promise<RequestOptions>

      A promise that resolves to the prepared options for the HTTP request.

    • Prepares the url to be called by appending query parameters.

      Parameters

      • url: string

        The base url to be used.

      • OptionalqueryParameters: { [key: string]: string | undefined }

        Key-value pair with the parameters. If the value is undefined, the key is dropped.

      • OptionalrepeatParamArray: boolean

        create as many single parameters with each value of the array

      Returns string

      The prepared URL as a string.

    • Type Parameters

      • T

      Parameters

      • apiCallParameters: ApiCallParameters

      Returns Promise<T>

    • Type Parameters

      • T

      Parameters

      • apiCallParameters: ApiCallParametersWithPagination

      Returns Promise<PageResult<T>>

    • Parameters

      • apiCallParameters: ApiCallParameters

      Returns Promise<FileData>

    • Parameters

      • apiCallParameters: ApiCallParameters

      Returns Promise<FileBuffer>

    • Process HTTP call and return the raw response, without parsing the body. Token refresh and rate-limit retries are applied as for any other call.

      Parameters

      • apiCallParameters: ApiCallParameters

        Parameters for the HTTP call.

      • Optionaloverrides: CallOverrides

        Retry and token refresh settings overriding the client ones for this call.

      Returns Promise<HttpResponse>

      The response, with a body still available for lazy parsing.

      when the response status is >= 400.