import type { Logger } from 'pino'; import { DisconnectedError, UnauthorizedTokenError } from '../utils/errors.js'; import type { PlatformEnvironment } from '../utils/url-utils.js'; import type { PlatformClientOrigin, PreprocessRequest, RequestMetadata } from './preprocess-request.js'; export type HttpMethods = 'POST' | 'GET' | 'DELETE' | 'PUT'; export type HTTPContentType = 'application/json' | 'application/x-www-form-urlencoded' | 'text/html'; export interface PlatformClientCallOptions> { origin: PlatformClientOrigin; url: string; method: HttpMethods; contentType: HTTPContentType; headers?: Record; requestParams: T; accessToken: string; preprocessRequest: PreprocessRequest; requestMetadata?: RequestMetadata; logger: Logger; signal?: AbortSignal; } export interface PlatformResponse { body: T; response: Response; } export type PlatformClientCallError = UnauthorizedTokenError | DisconnectedError | Error; export declare class PlatformClient { static call(options: PlatformClientCallOptions): Promise; private static preprocessRequest; } /** * Retrieves the endpoint URL for a specific organization. * * @param organizationId - The ID of the organization. * @param environment - The environment of the organization. Defaults to 'prod'. * @param endpointType - The type of the endpoint. Defaults to 'platform'. * @returns The endpoint URL for the organization. */ export declare function getOrganizationEndpoint(organizationId: string, environment?: PlatformEnvironment, endpointType?: 'admin' | 'analytics' | 'platform'): string; /** * Returns the provided API base URL (proxy) if set, * otherwise falls back to the resolved organization endpoint. */ export declare function getApiBaseUrlOrOrganizationEndpoint(apiBaseUrl: string | undefined, organizationId: string, environment?: PlatformEnvironment): string; export declare function getSearchApiBaseUrl(organizationId: string, environment?: PlatformEnvironment): string; export declare function getAnalyticsNextApiBaseUrl(organizationId: string, environment?: PlatformEnvironment): string;