export type GetApiScrapecreatorsV1YoutubeChannelVideosArgs = {channelId?: string | undefined, handle?: string | undefined, sort?: string | undefined, continuationToken?: string | undefined, includeExtras?: string | undefined}; export type GetApiScrapecreatorsV1YoutubeChannelVideosOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Channel Videos * * GET /scrapecreators/v1/youtube/channel-videos */ export const getApiScrapecreatorsV1YoutubeChannelVideos = async (args: GetApiScrapecreatorsV1YoutubeChannelVideosArgs, options?: GetApiScrapecreatorsV1YoutubeChannelVideosOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.channelId != null) query.append("channelId", String(args.channelId)) if (args.handle != null) query.append("handle", String(args.handle)) if (args.sort != null) query.append("sort", String(args.sort)) if (args.continuationToken != null) query.append("continuationToken", String(args.continuationToken)) if (args.includeExtras != null) query.append("includeExtras", String(args.includeExtras)) const url = `${baseUrl.replace(/\/+$/, '')}/scrapecreators/v1/youtube/channel-videos${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 };