export type GetApiApiNewsExportAllArticlesArgs = {company?: string | undefined, agency?: string | undefined, team?: string | undefined, category?: string | undefined, subcategory?: string | undefined, league?: string | undefined, newsTag?: string | undefined, reporter?: string | undefined, publishedAfter?: string | undefined, publishedBefore?: string | undefined}; export type GetApiApiNewsExportAllArticlesOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export curated news articles * * GET /api/news/export/all-articles */ export const getApiApiNewsExportAllArticles = async (args: GetApiApiNewsExportAllArticlesArgs, options: GetApiApiNewsExportAllArticlesOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.company != null) query.append("company", String(args.company)) if (args.agency != null) query.append("agency", String(args.agency)) if (args.team != null) query.append("team", String(args.team)) if (args.category != null) query.append("category", String(args.category)) if (args.subcategory != null) query.append("subcategory", String(args.subcategory)) if (args.league != null) query.append("league", String(args.league)) if (args.newsTag != null) query.append("newsTag", String(args.newsTag)) if (args.reporter != null) query.append("reporter", String(args.reporter)) if (args.publishedAfter != null) query.append("publishedAfter", String(args.publishedAfter)) if (args.publishedBefore != null) query.append("publishedBefore", String(args.publishedBefore)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/news/export/all-articles${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 };