export type GetApiAdminMarketingV2FbAccountsNamePreviewArgs = {provider: string, product: string}; export type GetApiAdminMarketingV2FbAccountsNamePreviewOptions = {baseUrl: string, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /admin/marketing-v2/fb/accounts/name-preview */ export const getApiAdminMarketingV2FbAccountsNamePreview = async (args: GetApiAdminMarketingV2FbAccountsNamePreviewArgs, options: GetApiAdminMarketingV2FbAccountsNamePreviewOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.provider != null) query.append("provider", String(args.provider)) if (args.product != null) query.append("product", String(args.product)) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/admin/marketing-v2/fb/accounts/name-preview${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 };