/** * Endpoint URL Utilities * Lightweight helpers for working with endpoint definitions */ import { endpoints } from './index'; export type EndpointName = keyof typeof endpoints; /** * Get endpoint URL by name * * @param name - The endpoint name * @returns The endpoint URL template * * @example * getEndpointUrl('getCampaign') // '/campaigns/:id' */ export declare function getEndpointUrl(name: EndpointName): string; /** * Get all endpoint URLs as a record * * @returns Record of endpoint names to URLs * * @example * getAllEndpointUrls() // { getCampaign: '/campaigns/:id', ... } */ export declare function getAllEndpointUrls(): Record; /** * Check if endpoint exists * * @param name - The endpoint name to check * @returns True if endpoint exists * * @example * hasEndpoint('getCampaign') // true * hasEndpoint('invalid') // false */ export declare function hasEndpoint(name: string): name is EndpointName; /** * Get endpoint config (url, method, etc.) * * @param name - The endpoint name * @returns The full endpoint configuration * * @example * getEndpointConfig('getCampaign') // { url: '/campaigns/:id', method: 'GET' } */ export declare function getEndpointConfig(name: EndpointName): { url: string; method?: string; }; /** * Build a URL with path parameters replaced * * @param endpoint - The endpoint name * @param pathParams - Path parameters to replace * @returns URL with parameters replaced * * @example * buildEndpointUrl('getCampaign', { id: '123' }) // '/campaigns/123' */ export declare function buildEndpointUrl(endpoint: EndpointName, pathParams?: Record): string; /** * Extract path parameters from an endpoint * * @param endpoint - The endpoint name * @returns Array of parameter names * * @example * getEndpointParams('getCampaign') // ['id'] * getEndpointParams('getCampaignStats') // ['id'] */ export declare function getEndpointParams(endpoint: EndpointName): string[]; /** * Check if endpoint requires path parameters * * @param endpoint - The endpoint name * @returns True if endpoint has path parameters * * @example * hasPathParams('getCampaign') // true * hasPathParams('listCampaigns') // false */ export declare function hasPathParams(endpoint: EndpointName): boolean; /** * Get endpoint metadata * * @param endpoint - The endpoint name * @returns Metadata about the endpoint * * @example * getEndpointMetadata('getCampaign') * // { name: 'getCampaign', url: '/campaigns/:id', method: 'GET', hasParams: true, params: ['id'], config: {...} } */ export declare function getEndpointMetadata(endpoint: EndpointName): { name: EndpointName; url: string; method: string; hasParams: boolean; params: string[]; config: { url: string; method?: string; }; }; /** * Build URL from a URL template with parameters * Generic helper for any URL template * * @param url - URL template with :param placeholders * @param params - Parameters to replace * @returns URL with parameters replaced * * @example * buildUrl('/users/:id', { id: '123' }) // '/users/123' * buildUrl('/posts/:postId/comments/:commentId', { postId: '1', commentId: '2' }) // '/posts/1/comments/2' */ export declare function buildUrl(url: string, params?: Record): string; /** * Extract parameter names from a URL template * * @param url - URL template with :param placeholders * @returns Array of parameter names * * @example * extractUrlParams('/users/:id') // ['id'] * extractUrlParams('/posts/:postId/comments/:commentId') // ['postId', 'commentId'] */ export declare function extractUrlParams(url: string): string[]; //# sourceMappingURL=utils.d.ts.map