export type DeleteApiHdDesksDeskIdTicketsNumberAttachmentsAttachmentIdArgs = {desk_id: string, number: string, attachment_id: string, 'X-SV-Client': 'help-desk-portal'}; export type DeleteApiHdDesksDeskIdTicketsNumberAttachmentsAttachmentIdOptions = {baseUrl?: string | undefined, HelpDeskCustomerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancel a file's upload into a reply * * DELETE /hd/desks/{desk_id}/tickets/{number}/attachments/{attachment_id} */ export const deleteApiHdDesksDeskIdTicketsNumberAttachmentsAttachmentId = async (args: DeleteApiHdDesksDeskIdTicketsNumberAttachmentsAttachmentIdArgs, options?: DeleteApiHdDesksDeskIdTicketsNumberAttachmentsAttachmentIdOptions) => { const {baseUrl = "https://api.sparkvault.com/v1", fetch: fetchFn = fetch, HelpDeskCustomerToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-SV-Client'] != null) headers.set("X-SV-Client", String(args['X-SV-Client'])) if (HelpDeskCustomerToken !== undefined) headers.set('authorization', `Bearer ${HelpDeskCustomerToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/hd/desks/${encodeURIComponent(String(args.desk_id))}/tickets/${encodeURIComponent(String(args.number))}/attachments/${encodeURIComponent(String(args.attachment_id))}${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 };