import type { AnalyticsOptions } from '../interfaces'; interface RequestOptions { timeout?: number | null; } export declare class BentoClient { private readonly _headers; private readonly _baseUrl; private readonly _siteUuid; private readonly _logErrors; private readonly _timeout; constructor(options: AnalyticsOptions); /** * Wraps a GET request to the Bento API and automatically adds the required * headers. * * @param endpoint string * @param payload object * @returns Promise\ * */ get(endpoint: string, payload?: Record, requestOptions?: RequestOptions): Promise; /** * Wraps a POST request to the Bento API and automatically adds the required * headers. * * @param endpoint string * @param payload object * @returns Promise\ * */ post(endpoint: string, payload?: Record, requestOptions?: RequestOptions): Promise; /** * Wraps a PATCH request to the Bento API and automatically adds the required * headers. * * @param endpoint string * @param payload object * @returns Promise\ * */ patch(endpoint: string, payload?: Record, requestOptions?: RequestOptions): Promise; /** * Performs a fetch request with a configurable timeout. * * @param url The URL to fetch * @param options Fetch options * @returns Promise */ private _fetchWithTimeout; /** * Handles the response from a fetch request, parsing JSON or throwing appropriate errors. * * @param response The fetch Response object * @returns Promise The parsed response data */ private _handleResponse; /** * Extracts the `publishableKey` and `secretKey` from the `authentication` options, * adds the `Authorization` header, and includes a `User-Agent` header with the site UUID. * * @param authentication AuthenticationOptions * @param siteUuid string The site UUID to be included in the User-Agent header * @returns HeadersInit */ private _extractHeaders; /** * Takes the existing payload and adds the `site_uuid` to it, then returns * it out as a JSON string so that it can be sent alongside the request. * * @param payload object * @returns string */ private _getBody; /** * Takes the existing payload and adds the `site_uuid` to it, converts the * object to a query string so that it can be sent alongside a GET request. * * @param payload object * @returns string */ private _getQueryParameters; /** * Filters down the status codes to those that are considered a 'success'. * * @param statusCode number * @returns boolean */ private _isSuccessfulStatus; /** * Returns an appropriate error to be thrown given the received response. * * @param response Response * @returns Error */ private _getErrorForResponse; } export {};