export type GetApiShowsListArgs = {order?: string | undefined, since?: string | undefined, recent?: string | undefined, starting?: string | undefined, start?: string | undefined, limit?: string | undefined, filter?: string | undefined, platforms?: string | undefined, country?: string | undefined, summary?: string | undefined, broadcasted?: string | undefined, locale?: string | undefined}; export type GetApiShowsListOptions = {baseUrl?: string | undefined, BetaSeriesApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Display the list of all series * * GET /shows/list */ export const getApiShowsList = async (args: GetApiShowsListArgs, options?: GetApiShowsListOptions) => { const {baseUrl = "https://api.betaseries.com", fetch: fetchFn = fetch, BetaSeriesApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.order != null) query.append("order", String(args.order)) if (args.since != null) query.append("since", String(args.since)) if (args.recent != null) query.append("recent", String(args.recent)) if (args.starting != null) query.append("starting", String(args.starting)) if (args.start != null) query.append("start", String(args.start)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.filter != null) query.append("filter", String(args.filter)) if (args.platforms != null) query.append("platforms", String(args.platforms)) if (args.country != null) query.append("country", String(args.country)) if (args.summary != null) query.append("summary", String(args.summary)) if (args.broadcasted != null) query.append("broadcasted", String(args.broadcasted)) if (args.locale != null) query.append("locale", String(args.locale)) if (BetaSeriesApiKey !== undefined) headers.set("X-BetaSeries-Key", BetaSeriesApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/shows/list${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };