/** * @author jasonHzq * @description HTTP API Executor 内置实现 * 根据 API 元数据和运行时参数执行 HTTP 请求 */ import type { ApiExecutionContext, ApiResponse } from "../types.d.ts"; import type { Parameter } from "@pontx/spec"; interface ParsedParams { pathParams: Record; queryParams: Record; headerParams: Record; bodyParams: Record; } /** * Parse and classify parameters based on their location in the API definition. * Parameters are classified into path, query, header, and body params. * Unmatched parameters are treated as body parameters. * * @param parameters - Array of parameter definitions from the API spec * @param toolParams - Runtime parameter values provided by the caller * @returns Parsed parameters classified by location */ export declare function parseParams(parameters: Parameter[] | undefined, toolParams: Record): ParsedParams; /** * Normalize base URL to ensure it has a protocol prefix. * If no protocol is specified, defaults to https://. * * @param baseUrl - The base URL to normalize * @returns Normalized URL with protocol */ export declare function normalizeBaseUrl(baseUrl: string): string; /** * Build complete URL from base URL, path, and parameters. * Handles path parameter substitution and query string construction. * * @param baseUrl - The base URL (will be normalized) * @param path - The API path with optional {param} placeholders * @param pathParams - Values for path parameters * @param queryParams - Values for query string parameters * @returns Complete URL with substituted path params and query string */ export declare function buildUrl(baseUrl: string, path: string, pathParams: Record, queryParams: Record): string; /** * Build fetch RequestInit configuration from method, headers, and body. * Handles content type detection and body serialization for different formats * (JSON, form-urlencoded, multipart, text). * * @param method - HTTP method (GET, POST, PUT, etc.) * @param headerParams - Custom header parameters * @param bodyParams - Body parameters to serialize * @param consumes - Content types the API accepts (used to determine Content-Type) * @param produces - Content types the API produces (used to set Accept header) * @returns RequestInit object for fetch() */ export declare function buildRequestConfig(method: string, headerParams: Record, bodyParams: Record, consumes?: string[], produces?: string[]): RequestInit; /** * 内置 HTTP API 执行器实现 * 支持 ExecuteApiConfig 配置 */ export declare function builtinExecuteApi(context: ApiExecutionContext): Promise; export {};