import { SdGeometryError as ShapeDiverBackendError } from "@shapediver/sdk.geometry-api-sdk-v2"; import { type HttpResponse } from "./HttpResponse"; export declare class HttpClient { private readonly _logger; private static _instance; private _dataCache; private _enableCaching; private _excludedQueryParameters; private _maxCacheSize; private _sessionLoading; private constructor(); static get instance(): HttpClient; get enableCaching(): boolean; set enableCaching(value: boolean); get excludedQueryParameters(): string[]; set excludedQueryParameters(value: string[]); get maxCacheSize(): number; set maxCacheSize(value: number); /** * Add the data loading options from a session. * * @param sessionId * @param callbacks */ addDataLoading(sessionId: string, callbacks: { getAsset: (url: string) => Promise<[ArrayBuffer, string]>; downloadTexture: (url: string) => Promise<[ArrayBuffer, string]>; }): void; /** * Maps the geometry backend error to the corresponding viewer errors: * - ResError is mapped to ShapeDiverGeometryBackendResponseError * - ReqError is mapped to ShapeDiverGeometryBackendRequestError * * Other error types are thrown as is. * * @param e */ convertError(err: ShapeDiverBackendError | Error | unknown): Promise; /** * Get the requested resource either as a download or from the cache. * If available, the registered session loading is used for download. * Textures are downloaded via a specific endpoint and can be converted in this step as well. * Depending on the provided caching options, the requested resource might already be cached. * * @param href * @param config * @param textureLoading * @param textureConversion * @returns */ /** * Convert a fetch Response to an HttpResponse. * * @param response The fetch Response * @param responseType The desired response type * @returns The HttpResponse */ private fetchResponseToHttpResponse; /** * Perform a fetch request and convert the response to an HttpResponse. * * @param href The URL to fetch * @param responseType The desired response type * @returns The HttpResponse */ private fetchUrl; get(href: string, config?: { responseType?: string; }, textureLoading?: boolean): Promise>; /** * Get the requested texture either as a download or from the cache. * If the texture is not available, undefined is returned. * * @param href The URL of the texture to load. * @returns Either the texture as a buffer and blob or undefined if the texture could not be loaded. */ loadTexture(href: string): Promise>; /** * Add the data loading options from a session. * * @param sessionId */ removeDataLoading(sessionId: string): void; /** * Add * * @param key * @param value */ private addToCache; /** * Calculate the current cache size from all resolved promises. * * @returns */ private calculateCacheSize; /** * Get the value of an object from the cache. * * @param key * @returns */ private getFromCache; /** * Get the session id of the provided href. * * @param href * @returns */ private getSessionId; /** * Convert the provided href to a data cache key. * In this conversion the excludedQueryParameters are removed from the href. * * @param href * @returns */ private hrefToDataKey; } //# sourceMappingURL=HttpClient.d.ts.map