export type CreateApiAppCampaignGoogleAdsCampaignIdAccessArgs = {campaignId: number}; export type CreateApiAppCampaignGoogleAdsCampaignIdAccessOptions = {baseUrl: string, token?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /app/campaign/googleAds/{campaignId}/access */ export const createApiAppCampaignGoogleAdsCampaignIdAccess = async (args: CreateApiAppCampaignGoogleAdsCampaignIdAccessArgs, options: CreateApiAppCampaignGoogleAdsCampaignIdAccessOptions) => { const {baseUrl, fetch: fetchFn = fetch, token} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (token !== undefined) headers.set("authorization", token) const url = `${baseUrl.replace(/\/+$/, '')}/app/campaign/googleAds/${encodeURIComponent(String(args.campaignId))}/access${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };