import { Media, MediaType } from "../types/input/Media.ts"; import { ProviderConfig, SupportedId } from "../types/models/Provider.ts"; import { ScrapeRequester } from "../types/input/Requester.ts"; export declare class Provider { config: ProviderConfig; private constructor(); static create(config: ProviderConfig): Provider; /** Constructs query parameters for a provider based on the media information and the provider's expected query format * @param localizedTextIndex Index into `media.localizedTitles` to pick a translated title. * - `undefined` (default) — auto-selects a localized title when the provider's language differs from the media's original language. * - `number` — uses that specific index (wraps around via modulo). * - `null` — forces the original title, skipping localization entirely. */ private createQueries; /** Creates a URL for the media resource based on the provider's configuration and the media information provided in the requester. * * @param localizedTextIndex Index into `localizedTitles` to pick a translated title. * - `undefined` — auto-selects based on provider language. * - `number` — uses that index (wraps via modulo). * - `null` — forces the original title, skipping localization. * @description Throws an error if the media type is not supported by the provider. * @returns A URL object representing the full URL to access the media resource on the provider's platform. */ createResourceURL(requester: Omit, localizedTextIndex?: number | null): URL; /** Generates a deduplicated, prioritized list of resource URLs for the media request, * combining ID-based and localized-title-based variants. * @throws If the media type is not supported by the provider. * @returns Deduplicated URL array ordered by priority. */ createResourceUrls(requester: Omit, customURL?: URL): URL[]; /** Creates a pattern string by replacing placeholders * in the given `pattern` with corresponding values from the media object and any additional custom parameters `customPattern`. * * For formatting patterns: * `{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} * * - id = 0 → Media ID (TMDB or IMDB based on provider's mediaIds preference) * - tmdb = 1 → Media TMDB ID * - imdb = 2 → Media IMDB ID * - title = 3 → Media title * - year = 4 → Release year * - season = 5 → Season number * - episode = 6 → Episode number * - ep_id = 7 → Episode ID Based on provider's mediaIds preference (for series) * - ep_tmdb = 8 → Episode TMDB ID (for series) * - ep_imdb = 9 → Episode IMDB ID (for series) * @param localizedTextIndex Index into `localizedTitles` to pick a translated title. * - `undefined` — auto-selects based on provider language. * - `number` — uses that index (wraps via modulo). * - `null` — forces the original title, skipping localization. * @see {@link EProviderQueryKey} for numeric placeholder index mappings} */ createPatternString(pattern: string, media: Media, customPattern?: Record, localizedTextIndex?: number | null): string; /** Applies the provider's pattern to a given URL or path, replacing placeholders with media information from the requester */ applyPatternURL(urlOrPath: string, requester: Omit): URL; /** Checks if the provider supports the given media based on the provider's configuration and the media's properties */ isMediaSupported(media: Media): boolean; /** Retrieves the preferred media ID(s) for the given media * This function checks the media type and retrieves the appropriate ID(s) (TMDB or IMDB) based on the provider's expected media ID types. * If the media type is not supported or if the required IDs are not available, * it throws an error. * @description Throws Error if not supported or invalid media ID is found based on provider's configuration. For series, it checks for both media ID and episode ID based on the provider's mediaIds preference. * @returns An object containing the supported media ID(s) for the given media. * - For movies: { id: string } * - For series: { id: string, ep_id: string } * - For channels: { id: string } */ retrievePreferedIds(media: Media): SupportedId; /** Retrieves the primary language code from the provider's configuration */ getPrimaryLanguage(): string; useTranslation(media: Media): boolean; }