import { IncomingMessage } from "node:http"; import { AxiosRequestConfig } from "axios"; import { PirschNodeClientConfig, PirschHttpOptions, PirschHit, PirschProxyHeader, Protocol } from "./types"; import { PirschCoreClient } from "./core"; import { PirschApiError } from "./common"; /** * Client is used to access the Pirsch API. */ export declare class PirschNodeApiClient extends PirschCoreClient { protected readonly hostname: string; protected readonly protocol: Protocol; protected readonly trustedProxyHeaders?: PirschProxyHeader[]; private httpClient; /** * The constructor creates a new client. * * @param {object} configuration You need to pass in the **Hostname**, **Client ID** and **Client Secret** or **Access Key** 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.clientId The OAuth client ID * @param {string} configuration.clientSecret The OAuth client secret * @param {string} configuration.hostname The hostname of the domain to track * @param {string} configuration.protocol The default HTTP protocol to use for tracking * */ constructor(configuration: PirschNodeClientConfig); /** * hitFromRequest returns the required data to send a hit to Pirsch for a Node request object. * * @param request the Node request object from the http package. * @returns Hit object containing all necessary fields. */ hitFromRequest(request: IncomingMessage): PirschHit; private getReferrer; private getHeader; protected get(url: string, options?: PirschHttpOptions): Promise; protected post(url: string, data: Data, options?: PirschHttpOptions): Promise; protected toApiError(error: unknown): Promise; protected httpOptionsToAxiosOptions(options?: PirschHttpOptions): AxiosRequestConfig; } export declare const Pirsch: typeof PirschNodeApiClient; export declare const Client: typeof PirschNodeApiClient;