export type UpdateCampaignDto = {name?: string | undefined, clientId?: string | undefined, creativeId?: string | undefined}; export type PatchApiApiCampaignsIdArgs = {id: string, body: UpdateCampaignDto}; export type PatchApiApiCampaignsIdOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a campaign * * PATCH /api/campaigns/{id} */ export const patchApiApiCampaignsId = async (args: PatchApiApiCampaignsIdArgs, options: PatchApiApiCampaignsIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("X-API-Key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/campaigns/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };