export type DeleteApiOrdersOrderHandleTasksTaskIdArgs = {order_handle: string, task_id: string, fulfillment_attempt?: (number | null) | undefined}; export type DeleteApiOrdersOrderHandleTasksTaskIdOptions = {baseUrl?: string | undefined, BasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Delete Order Task * * DELETE /orders/{order_handle}/tasks/{task_id} * * Also accepts auth: TokenAuth */ export const deleteApiOrdersOrderHandleTasksTaskId = async (args: DeleteApiOrdersOrderHandleTasksTaskIdArgs, options?: DeleteApiOrdersOrderHandleTasksTaskIdOptions) => { const {baseUrl = "https://v3.api.hypertrack.com", fetch: fetchFn = fetch, BasicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.fulfillment_attempt != null) query.append("fulfillment_attempt", String(args.fulfillment_attempt)) if (BasicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${BasicAuth.username}:${BasicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/orders/${encodeURIComponent(String(args.order_handle))}/tasks/${encodeURIComponent(String(args.task_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 };