@metis-w/api-client
Version:
Modern TypeScript HTTP API client with dynamic routes, parameterized endpoints, interceptors, and advanced features
29 lines • 1.46 kB
TypeScript
import { APIConfig, RequestConfig } from "../../types/config";
export declare class RequestBuilder {
/**
* Merges user-provided config with default values
* @param config - User-provided request configuration
* @param defaultConfig - Default configuration values
*/
static mergeConfig(config: Partial<RequestConfig>, defaultConfig: Required<RequestConfig | APIConfig>): Required<RequestConfig>;
/**
* Builds a complete URL from base URL, path, and query parameters
* @param baseUrl - The base URL for the API
* @param path - The endpoint path to append to the base URL
* @param params - Optional query parameters to include in the URL
* @param useKebabCase - Whether to convert path segments to kebab-case
*/
static buildUrl(baseUrl: string, path: string, params?: Record<string, unknown>, useKebabCase?: boolean): string;
/**
* Builds request headers, sanitizing them and adding Content-Type if necessary
* @param configHeaders - Headers from the request configuration
* @param data - Optional data to determine Content-Type
*/
static buildHeaders(configHeaders: Record<string, string>, data?: unknown): Record<string, string>;
/**
* Converts a path string to kebab-case, ensuring each segment is formatted correctly
* @param path - The path to convert
*/
private static convertPathToKebab;
}
//# sourceMappingURL=request-builder.d.ts.map