import { ZodType } from 'zod'; import { HttpRequest } from '../hooks/hook.js'; import { ContentType, HttpMethod, RetryOptions, SdkConfig, ValidationOptions } from '../types.js'; import { CreateRequestParameters, ErrorDefinition, RequestCursorPagination, RequestPagination, RequestParameter, ResponseDefinition } from './types.js'; /** * Represents an HTTP request with all necessary configuration and parameters. * Handles path/query/header/cookie serialization, pagination, validation, and retry logic. * This is the core request object passed through the handler chain for execution. * * @template PageSchema - The type of paginated data returned by this request */ export declare class Request { baseUrl: string; headers: Map; queryParams: Map; pathParams: Map; cookies: Map; body?: any; method: HttpMethod; path: string; config: SdkConfig; responses: ResponseDefinition[]; errors: ErrorDefinition[]; requestSchema: ZodType; requestContentType: ContentType; validation: ValidationOptions; retry: RetryOptions; pagination?: RequestPagination | RequestCursorPagination; filename?: string; filenames?: string[]; private readonly pathPattern; constructor(params: CreateRequestParameters); /** * Adds a header parameter to the request with OpenAPI serialization rules. * * @param key - The header name * @param param - The parameter configuration including value, style, and encoding options */ addHeaderParam(key: string, param: RequestParameter): void; /** * Adds a query parameter to the request with OpenAPI serialization rules. * * @param key - The query parameter name * @param param - The parameter configuration including value, style, and encoding options */ addQueryParam(key: string, param: RequestParameter): void; /** * Adds a path parameter to the request with OpenAPI serialization rules. * * @param key - The path parameter name (matches template variable in path pattern) * @param param - The parameter configuration including value, style, and encoding options */ addPathParam(key: string, param: RequestParameter): void; /** * Sets the request body if the value is defined. * * @param body - The request body to send */ addBody(body: any): void; /** * Updates this request from a modified hook request. * Used after hooks modify the request to sync changes back to the internal Request object. * * @param hookRequest - The modified request from hook processing */ updateFromHookRequest(hookRequest: HttpRequest): void; /** * Constructs the complete URL by combining base URL, path with substituted parameters, * and serialized query string. * * @returns The fully constructed URL ready for HTTP execution */ constructFullUrl(): string; /** * Creates a copy of this request with optional parameter overrides. * Useful for pagination where you need to modify parameters while keeping the rest intact. * * @param overrides - Optional parameters to override in the copied request * @returns A new Request instance with the specified overrides */ copy(overrides?: Partial): Request; /** * Serializes headers to a format suitable for HTTP execution. * * @returns Serialized headers as HeadersInit, or undefined if no headers */ getHeaders(): HeadersInit | undefined; /** * Serializes cookies to a format suitable for HTTP execution. * * @returns Serialized cookies as a record, or undefined if no cookies */ getCookies(): Record | undefined; /** * Advances pagination parameters to fetch the next page. * Handles both cursor-based and limit-offset pagination strategies. * * @param cursor - The cursor value for cursor-based pagination (optional for limit-offset) */ nextPage(cursor?: string): void; private constructPath; private getOffsetParam; private getCursorParam; private getAllParams; } //# sourceMappingURL=request.d.ts.map