import { TProviderEntryPatterns, TQueryMapping } from "../types/models/Provider.ts"; /** Generates a string based on a pattern by replacing placeholders with provided values. * * The pattern should contain placeholders in the format: * - `{key:}` for zero-padded numeric values * - `{key:string}` for string-based values * - `{key:uri}` for URI-encoded values * - `{key:form-uri}` for form URI-encoded values * * @param pattern - The pattern string containing placeholders * @param params - Configuration object containing values for replacement * @returns The resulting string with placeholders replaced by values * * @example * // Returns '02x07' * stringFromPattern('{season:2}x{episode:2}', { season: 2, episode: 7 }); * * @example * // Returns 'Custom: 0042' * stringFromPattern('Custom: {anyKey:4}', { anyKey: 42 }); */ export declare function stringFromPattern>(pattern: string, params?: T): string; /** Handle indexed placeholders like {0}, {1}, ... * @param pattern - The pattern string containing indexed placeholders. * @param args - The values to replace indexed placeholders. * @returns The resulting string with indexed placeholders replaced by values. * * @example * // Returns 'Hello World' * formatString('Hello {0}', ['World']); * * @example * // Returns 'Item 1: Apple, Item 2: Banana' * formatString('Item 1: {0}, Item 2: {1}', ['Apple', 'Banana']); */ export declare function formatString(pattern: string, args: unknown[]): string; /** Encodes a string for use in a URI, with optional form encoding (spaces as '+'). * @param str - The string to encode. * @param type - The encoding type: "uri" for standard URI encoding, "form-uri" for form encoding (spaces as '+'). * @return The encoded string. * @example * // Returns 'Hello%20World' * encodeURI('Hello World'); * // Returns 'Hello+World' * encodeURI('Hello World', 'form-uri'); */ export declare function encodeURI(str: string, type?: "uri" | "form-uri"): string; /** Builds a relative path for a provider entry by replacing placeholders in the endpoint and pattern with provided parameters. * @param entry - The provider entry containing the endpoint and optional pattern. * @param params - The parameters to replace placeholders in the endpoint and pattern. * @param includePattern - Whether to include the pattern in the resulting path (default: false). * @return The constructed relative path with placeholders replaced by parameter values. * * This function handles the following scenarios: * - If the endpoint contains query parameters and the pattern starts with a query, it correctly joins them with '&'. * - If the endpoint does not contain query parameters and the pattern starts with a query, it adds '?' before the pattern. * - If the pattern is a regular string (not a query), it simply appends it to the endpoint. * - It also appends any additional query parameters from entry.queries if present. */ export declare function buildRelativePath(entry: TProviderEntryPatterns, params: TQueryMapping, includePattern?: boolean): string; /** Joins multiple path segments into a single path, ensuring that there are no duplicate slashes and that the resulting path is properly formatted. * @param parts - The path segments to join. * @returns The joined path string. */ export declare function pathJoin(...parts: (string | undefined)[]): string;