export type DeleteApiV2CampaignsCampaignIdAttachmentsDocumentIdArgs = {campaignId: number, documentId: number}; export type DeleteApiV2CampaignsCampaignIdAttachmentsDocumentIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Removes an attachment from a campaign. * * DELETE /v2/campaigns/{campaignId}/attachments/{documentId} */ export const deleteApiV2CampaignsCampaignIdAttachmentsDocumentId = async (args: DeleteApiV2CampaignsCampaignIdAttachmentsDocumentIdArgs, options?: DeleteApiV2CampaignsCampaignIdAttachmentsDocumentIdOptions) => { const {baseUrl = "https://api.dotdigital.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/v2/campaigns/${encodeURIComponent(String(args.campaignId))}/attachments/${encodeURIComponent(String(args.documentId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };