export type DeleteAttachmentRequest = Record; export type DeleteApiVisitsVisitIdAttachmentsAttachmentIdArgs = {visit_id: string, attachment_id: string, body: DeleteAttachmentRequest}; export type DeleteApiVisitsVisitIdAttachmentsAttachmentIdOptions = {baseUrl?: string | undefined, BasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Delete Attachment * * DELETE /visits/{visit_id}/attachments/{attachment_id} * * Also accepts auth: TokenAuth */ export const deleteApiVisitsVisitIdAttachmentsAttachmentId = async (args: DeleteApiVisitsVisitIdAttachmentsAttachmentIdArgs, options?: DeleteApiVisitsVisitIdAttachmentsAttachmentIdOptions) => { const {baseUrl = "https://v3.api.hypertrack.com", fetch: fetchFn = fetch, BasicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BasicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${BasicAuth.username}:${BasicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/visits/${encodeURIComponent(String(args.visit_id))}/attachments/${encodeURIComponent(String(args.attachment_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };