export type GetApiV1PromotionsFacebookBusinessAssetsPageAccessArgs = {adAccountId?: string | undefined, pageId?: string | undefined}; export type GetApiV1PromotionsFacebookBusinessAssetsPageAccessOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * GET /v1/promotions/facebook/businessAssets/pageAccess */ export const getApiV1PromotionsFacebookBusinessAssetsPageAccess = async (args: GetApiV1PromotionsFacebookBusinessAssetsPageAccessArgs, options: GetApiV1PromotionsFacebookBusinessAssetsPageAccessOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.adAccountId != null) query.append("adAccountId", String(args.adAccountId)) if (args.pageId != null) query.append("pageId", String(args.pageId)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/promotions/facebook/businessAssets/pageAccess${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 };