Client
Properties
Methods
createClient
createClient(config
): AxiosInstance
Creates the axios client used for requests As part of the creation, we configure the retry conditions and the exponential backoff approach.
Parameters
user supplied configurations
Returns
normalizeHeader
normalizeHeader(header
): string
Parameters
header
stringRequiredReturns
string
string
stringnormalizeHeaders
normalizeHeaders(obj
): Record<string
, any
>
Parameters
obj
objectRequiredReturns
Record<string
, any
>
Record
Record<string, any>Required
Record
Record<string, any>Requiredrequest
request(method
, path
, payload?
, options?
, customHeaders?
): Promise
<any
>
Axios request
Parameters
request method
path
stringRequiredrequest path
payload
Record<string, any>Requiredrequest payload
Default: `{}`
axios configuration
Default: `{}`
customHeaders
Record<string, any>Requiredcustom request headers
Default: `{}`
Returns
Promise
<any
>
Promise
Promise<any>Required
Promise
Promise<any>RequiredrequiresAuthentication
requiresAuthentication(path
, method
): boolean
Parameters
path
anyRequiredmethod
anyRequiredReturns
boolean
boolean
booleansetHeaders
setHeaders(userHeaders
, method
, path
, customHeaders?
): AxiosRequestHeaders
Creates all the initial headers. We add the idempotency key, if the request is configured to retry.
Parameters
user supplied headers
request method
path
stringRequiredrequest path
customHeaders
Record<string, any>Requireduser supplied headers
Default: `{}`
Returns
AxiosRequestHeaders
Record<string, string>RequiredshouldRetryCondition
shouldRetryCondition(err
, numRetries
, maxRetries
): boolean
Parameters
Returns
boolean
boolean
booleanWas this section helpful?