import { PirschIdentificationCodeClientConfig, PirschHttpOptions, PirschBrowserHit, Scalar } from "./types"; import { PirschApiError, PirschCommon } from "./common"; /** * Client is used to access the Pirsch API. */ export declare class PirschWebClient extends PirschCommon { private readonly baseUrl; private readonly timeout; private readonly identificationCode; private readonly hostname?; private httpClient; /** * The constructor creates a new client. * * @param {object} configuration You need to pass in the **Identification Code** you have configured on the Pirsch dashboard. * It's also recommended to set the proper protocol for your website, else it will be set to `https` by default. * All other configuration parameters can be left to their defaults. * @param {string} configuration.baseUrl The base URL for the pirsch API * @param {number} configuration.timeout The default HTTP timeout in milliseconds * @param {string} configuration.identificationCode The identification code * @param {string} configuration.hostname The hostname to rewrite the URL. Usually only required for testing * */ constructor(configuration: PirschIdentificationCodeClientConfig); /** * hit sends a hit to Pirsch. * * @param hit optional override data for the request. */ hit(hit?: Partial): Promise; /** * event sends an event to Pirsch. * * @param name the name for the event * @param duration optional duration for the event * @param meta optional object containing metadata (only scalar values, like strings, numbers, and booleans) * @param hit optional override data for the request */ event(name: string, duration?: number, meta?: Record, hit?: Partial): Promise; /** * customHit sends a hit to Pirsch. * * @param hit data for the request. */ customHit(hit: PirschBrowserHit): Promise; /** * customEvent sends an event to Pirsch. * * @param name the name for the event * @param duration optional duration for the event * @param hit data for the request * @param meta optional object containing metadata (only scalar values, like strings, numbers, and booleans) */ customEvent(name: string, duration: number | undefined, hit: PirschBrowserHit, meta?: Record): Promise; /** * hitFromBrowser returns the required data to send a hit to Pirsch. * * @returns Hit object containing all necessary fields. */ hitFromBrowser(): PirschBrowserHit; private browserHitToGetParameters; private generateUrl; protected get(url: string, options?: PirschHttpOptions): Promise; protected post(url: string, data: Data, options?: PirschHttpOptions): Promise; protected beacon(url: string, data: Data): Promise; protected toApiError(error: unknown): Promise; private createOptions; } export declare const Pirsch: typeof PirschWebClient; export declare const Client: typeof PirschWebClient;