export type CreateApiStudioCreativesCreativesIdPublishArgs = {creativesId: string}; export type CreateApiStudioCreativesCreativesIdPublishOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Publish for a studio creative. * * POST /studio/creatives/{creativesId}/publish */ export const createApiStudioCreativesCreativesIdPublish = async (args: CreateApiStudioCreativesCreativesIdPublishArgs, options?: CreateApiStudioCreativesCreativesIdPublishOptions) => { const {baseUrl = "https://dfareporting.googleapis.com/dfareporting/v5", fetch: fetchFn = fetch, Oauth2, Oauth2c} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/studio/creatives/${encodeURIComponent(String(args.creativesId))}/publish${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 };