import * as streamingAvailability from "streaming-availability"; import { type Catalog } from "./Catalog"; /** * A source represents a way to get a list of shows * to display in {@link Grid} or {@link Row}. * * @see {@link IdSetSource} * @see {@link TitleSearchSource} * @see {@link FilteredSearchSource} * @see {@link TopShowsSource} * @see {@link ChangesSource} * @see {@link SequentialMultiSource} * @see {@link RoundRobinMultiSource} * @see {@link RandomMultiSource} * * @category Sources */ export interface Source { type: string; } export declare function sourceToFetcher(source: Source): SourceFetcher; export interface SourceItem { show: streamingAvailability.Show; country: string; change?: streamingAvailability.Change; priorityCatalogs?: Catalog[]; } export interface SourceFetcher { fetch(): Promise; } declare abstract class BufferedSource implements SourceFetcher { private buffer; private finished; fetch(): Promise; abstract bufferedFetch(): Promise; } declare abstract class OneShotBufferedSource extends BufferedSource { private fetched; bufferedFetch(): Promise; abstract oneShotFetch(): Promise; } /** * The properties of the IdSetSource. * * @see {@link https://docs.movieofthenight.com/resource/shows#get-a-show} * * @category Sources */ export interface IdSetSourceProps { /** * The ids of the shows to fetch. * * The ids are popped from the array in order. * * You can use IMDb, TMDB, and Streaming Availability API ids. * * @example The Batman (IMDB) * "tt1877830" * @example The Batman (TMDB) * "movie/414906" * @example The Queen's Gambit (IMDB) * "tt10048342" * @example The Queen's Gambit (TMDB) * "tv/87739" */ ids: string[]; /** * 2-letter country code to display the streaming availability information accordingly. * * E.g. if you set it to "us", * the shows will be displayed with * their streaming availability information in the US. * * @see {@link https://docs.movieofthenight.com/guide/countries-and-services} for the list of supported countries. * * @example "us" * @example "gb" */ country: string; } /** * A source that returns a list of shows by their ids. * * @see {@link newIdSetSource} * @see {@link https://docs.movieofthenight.com/resource/shows#get-a-show} * * @category Sources */ export interface IdSetSource extends Source, IdSetSourceProps { } /** * Create a new IdSetSource. * * @see {@link https://docs.movieofthenight.com/resource/shows#get-a-show} * * @param props The properties of the IdSetSource. * @returns The IdSetSource. * * @category Sources */ export declare function newIdSetSource(props: IdSetSourceProps): IdSetSource; export declare class IdSetSourceFetcher implements SourceFetcher { private props; static type: string; constructor(props: IdSetSourceProps); fetch(): Promise; } /** * The properties of the TitleSearchSource. * * @see {@link https://docs.movieofthenight.com/resource/shows#search-shows-by-title} * * @category Sources */ export interface TitleSearchSourceProps extends streamingAvailability.SearchShowsByTitleRequest { /** * The maximum number of shows to fetch. */ limit?: number; } /** * A source that returns a list of shows by searching for their title. * * @see {@link newTitleSearchSource} * @see {@link https://docs.movieofthenight.com/resource/shows#search-shows-by-title} * * @category Sources */ export interface TitleSearchSource extends Source, TitleSearchSourceProps { } /** * Create a new TitleSearchSource. * * @see {@link https://docs.movieofthenight.com/resource/shows#search-shows-by-title} * * @param props The properties of the TitleSearchSource. * @returns The TitleSearchSource. * * @category Sources */ export declare function newTitleSearchSource(props: TitleSearchSourceProps): TitleSearchSource; export declare class TitleSearchSourceFetcher extends OneShotBufferedSource { private props; static type: string; constructor(props: TitleSearchSourceProps); oneShotFetch(): Promise; } /** * The properties of the FilteredSearchSource. * * @see {@link https://docs.movieofthenight.com/resource/shows#search-shows-by-filters} * * @category Sources */ export interface FilteredSearchSourceProps extends streamingAvailability.SearchShowsByFiltersRequest { /** * The maximum number of shows to fetch. */ limit?: number; } /** * A source that returns a list of shows by filtering them. * * @see {@link newFilteredSearchSource} * @see {@link https://docs.movieofthenight.com/resource/shows#search-shows-by-filters} * * @category Sources */ export interface FilteredSearchSource extends Source, FilteredSearchSourceProps { } /** * Create a new FilteredSearchSource. * * @see {@link https://docs.movieofthenight.com/resource/shows#search-shows-by-filters} * * @param props The properties of the FilteredSearchSource. * @returns The FilteredSearchSource. * * @category Sources */ export declare function newFilteredSearchSource(props: FilteredSearchSourceProps): FilteredSearchSource; export declare class FilteredSearchSourceFetcher extends BufferedSource { private props; static type: string; private cursor; private hasMore; private alreadySent; constructor(props: FilteredSearchSourceProps); getPriorityCatalogs(): Catalog[] | undefined; bufferedFetch(): Promise; } /** * The properties of the TopShowsSource. * * @see {@link https://docs.movieofthenight.com/resource/shows#get-top-shows} * * @category Sources */ export type TopShowsSourceProps = streamingAvailability.GetTopShowsRequest; /** * A source that returns a list of top shows in the given streaming service. * * Supported streaming services are * Netflix (`netflix`), * Amazon Prime Video (`prime`), * Disney+ (`disney`), * Apple TV+ (`apple`), * and Max (`hbo`) * * @see {@link newTopShowsSource} * @see {@link https://docs.movieofthenight.com/resource/shows#get-top-shows} * * @category Sources */ export interface TopShowsSource extends Source, TopShowsSourceProps { } /** * Create a new TopShowsSource. * * @see {@link https://docs.movieofthenight.com/resource/shows#get-top-shows} * * @param props The properties of the TopShowsSource. * @returns The TopShowsSource. * * @category Sources */ export declare function newTopShowsSource(props: TopShowsSourceProps): TopShowsSource; export declare class TopShowsSourceFetcher extends OneShotBufferedSource { private props; static type: string; constructor(props: TopShowsSourceProps); getPriorityCatalogs(): Catalog[] | undefined; oneShotFetch(): Promise; } /** * The properties of the ChangesSource. * * @see {@link https://docs.movieofthenight.com/resource/changes#get-changes} * * @category Sources */ export interface ChangesSourceProps extends streamingAvailability.GetChangesRequest { limit?: number; } /** * A source that returns a list of changes in the given streaming catalogs. * * @see {@link newChangesSource} * @see {@link https://docs.movieofthenight.com/resource/changes#get-changes} * * @category Sources */ export interface ChangesSource extends Source, ChangesSourceProps { } /** * Create a new ChangesSource. * * @see {@link https://docs.movieofthenight.com/resource/changes#get-changes} * * @param props The properties of the ChangesSource. * @returns The ChangesSource. * * @category Sources */ export declare function newChangesSource(props: ChangesSourceProps): ChangesSource; export declare class ChangesSourceFetcher extends BufferedSource { private props; static type: string; private cursor; private hasMore; private alreadySent; constructor(props: ChangesSourceProps); bufferedFetch(): Promise; } /** * @category Sources */ export interface SequentialMultiSourceProps { /** * The sources to aggregate. */ sources: Source[]; } /** * A source that aggregates multiple sources together. ** * The sources are used in the order they are provided, * SequentialMultiSource does not fetch from the next source * until the current source is exhausted. * * E.g. if the given sources are [A, B, C], * SequentialMultiSource will fetch from A until it is exhausted, * then fetch from B until it is exhausted, * then fetch from C until it is exhausted. * * @see {@link newSequentialMultiSource} * * @category Sources */ export interface SequentialMultiSource extends Source, SequentialMultiSourceProps { } /** * Create a new SequentialMultiSource. * * @param props The properties of the SequentialMultiSource. * @returns The SequentialMultiSource. * * @category Sources */ export declare function newSequentialMultiSource(props: SequentialMultiSourceProps): SequentialMultiSource; /** * @category Sources */ export interface RoundRobinMultiSourceProps { /** * The sources to aggregate. */ sources: Source[]; } /** * A source that aggregates multiple sources together. * * The sources are used in a round-robin fashion. * * E.g. if the given sources are [A, B, C], * RoundRobinMultiSource will fetch from A, then B, then C, then A, then B, then C, and so on. * * @see {@link newRoundRobinMultiSource} * * @category Sources */ export interface RoundRobinMultiSource extends Source, RoundRobinMultiSourceProps { } /** * Create a new RoundRobinMultiSource. * * @param props The properties of the RoundRobinMultiSource. * @returns The RoundRobinMultiSource. * * @category Sources */ export declare function newRoundRobinMultiSource(props: RoundRobinMultiSourceProps): RoundRobinMultiSource; /** * @category Sources */ export interface RandomMultiSourceProps { /** * The sources to aggregate. */ sources: Source[]; } /** * A source that aggregates multiple sources together. * * The sources are used in a random fashion. * * E.g. if the given sources are [A, B, C], * RandomMultiSource will fetch from C, then A, then B, then B, then C, then A, and so on. * * @category Sources */ export interface RandomMultiSource extends Source, RandomMultiSourceProps { } /** * Create a new RandomMultiSource. * * @param props The properties of the RandomMultiSource. * @returns The RandomMultiSource. * * @category Sources */ export declare function newRandomMultiSource(props: RandomMultiSourceProps): RandomMultiSource; export {}; //# sourceMappingURL=Source.d.ts.map