export type DeleteApiCompaniesCompanySlugPurchasesDraftsDraftIdAttachmentsAttachmentUuidOptions = {baseUrl?: string | undefined, fikenApiOauth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes an attachment from a Purchase draft. * * DELETE /companies/{companySlug}/purchases/drafts/{draftId}/attachments/{attachmentUuid} */ export const deleteApiCompaniesCompanySlugPurchasesDraftsDraftIdAttachmentsAttachmentUuid = async (options?: DeleteApiCompaniesCompanySlugPurchasesDraftsDraftIdAttachmentsAttachmentUuidOptions) => { const {baseUrl = "https://api.fiken.no/api/v2", fetch: fetchFn = fetch, fikenApiOauth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (fikenApiOauth !== undefined) headers.set('authorization', `Bearer ${fikenApiOauth}`) const url = `${baseUrl.replace(/\/+$/, '')}/companies/${encodeURIComponent(String(args.companySlug))}/purchases/drafts/${encodeURIComponent(String(args.draftId))}/attachments/${encodeURIComponent(String(args.attachmentUuid))}${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 };