@metis-w/api-client
Version:
Modern TypeScript HTTP API client with dynamic routes, parameterized endpoints, interceptors, and advanced features
29 lines • 914 B
TypeScript
export declare class URLBuilder {
private baseUrl;
private segments;
private queryParams;
constructor(baseUrl: string);
/**
* Adds a path segment to the URL, automatically handling leading/trailing slashes.
* @param path - The path segment to add.
*/
segment(path: string): this;
/**
* Adds query parameters to the URL.
* @param params - An object containing key-value pairs for query parameters.
*/
query(params: Record<string, any>): this;
/**
* Builds the final URL string.
* Combines the base URL, path segments, and query parameters.
* @returns The constructed URL string.
*/
build(): string;
/**
* Builds the query string from the query parameters.
* Filters out undefined or null values.
* @returns The query string.
*/
private buildQueryString;
}
//# sourceMappingURL=url-builder.d.ts.map