ApiClient
Upgather SDK / ApiClient
Class: ApiClient
The ApiClient class provides a generic HTTP client that supports both synchronous and asynchronous API requests. It applies authentication, error handling, and request interception, and it can return responses with type safety.
Remarks
This class uses Axios under the hood to perform HTTP requests. It provides typed methods
(e.g. getTyped, postTyped, etc.) that allow the caller to receive the response body cast
to the expected TypeScript type.
Constructors
new ApiClient()
new ApiClient(
baseUrl,authStrategy,errorStrategy,logger?,timeoutMs?):ApiClient
Creates a new instance of the ApiClient.
Parameters
baseUrl
string
The base URL for the API.
authStrategy
The authentication strategy to use on outgoing requests.
errorStrategy
The error handling strategy to use when a request fails.
logger?
Optional logger instance for request/response logging. If not provided, uses a silent logger.
timeoutMs?
number
Optional per-request timeout in milliseconds. When omitted, Axios applies no timeout.