export type GetApiV1PromotionsFacebookCatalogsArgs = {facebookAccountId?: string | undefined, instagramAccountId?: string | undefined, Origin?: string | undefined}; export type GetApiV1PromotionsFacebookCatalogsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * GET /v1/promotions/facebook/catalogs */ export const getApiV1PromotionsFacebookCatalogs = async (args: GetApiV1PromotionsFacebookCatalogsArgs, options: GetApiV1PromotionsFacebookCatalogsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.facebookAccountId != null) query.append("facebookAccountId", String(args.facebookAccountId)) if (args.instagramAccountId != null) query.append("instagramAccountId", String(args.instagramAccountId)) if (args.Origin != null) headers.set("Origin", String(args.Origin)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/promotions/facebook/catalogs${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 (await res.json()) as unknown };