import type { ShopInterface } from "./repository.js"; /** * HttpClient is a simple wrapper around the fetch API, pre-configured with the shop's URL and access token */ export declare class HttpClient { private shop; private tokenCache; private defaultTimeout; constructor(shop: ShopInterface, tokenCache?: HttpClientTokenCacheInterface, defaultTimeout?: number); /** * Permform a GET request */ get(url: string, headers?: Record, options?: { timeout?: number; }): Promise>; /** * Permform a POST request */ post(url: string, json?: object | FormData | Blob, headers?: Record, options?: { timeout?: number; }): Promise>; /** * Permform a PUT request */ put(url: string, json?: object, headers?: Record, options?: { timeout?: number; }): Promise>; /** * Permform a PATCH request */ patch(url: string, json?: object, headers?: Record, options?: { timeout?: number; }): Promise>; /** * Permform a DELETE request */ delete(url: string, json?: object, headers?: Record, options?: { timeout?: number; }): Promise>; private getUrl; private request; /** * Obtain a valid bearer token */ getToken(): Promise; } /** * HttpClientResponse is the response object of the HttpClient */ export declare class HttpClientResponse { statusCode: number; body: ResponseType; headers: Headers; constructor(statusCode: number, body: ResponseType, headers: Headers); } type ShopwareErrorResponse = { errors: { code: string; status: string; title: string; detail: string; }[]; }; /** * ApiClientAuthenticationFailed is thrown when the authentication to the shop's API fails */ export declare class ApiClientAuthenticationFailed extends Error { response: HttpClientResponse; constructor(shopId: string, response: HttpClientResponse); } /** * ApiClientRequestFailed is thrown when the request to the shop's API fails */ export declare class ApiClientRequestFailed extends Error { response: HttpClientResponse>; constructor(shopId: string, response: HttpClientResponse>); } export interface HttpClientTokenCacheItem { token: string; expiresIn: Date; } export declare class InMemoryHttpClientTokenCache implements HttpClientTokenCacheInterface { private cache; getToken(shopId: string): Promise; setToken(shopId: string, token: HttpClientTokenCacheItem): Promise; clearToken(shopId: string): Promise; } export interface HttpClientTokenCacheInterface { getToken(shopId: string): Promise; setToken(shopId: string, token: HttpClientTokenCacheItem): Promise; clearToken(shopId: string): Promise; } export {}; //# sourceMappingURL=http-client.d.ts.map