export type DeleteApiApiV2TicketsTicketIdArgs = {ticket_id: number}; export type DeleteApiApiV2TicketsTicketIdOptions = {baseUrl?: string | undefined, apiTokenAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Delete Ticket * * DELETE /api/v2/tickets/{ticket_id} */ export const deleteApiApiV2TicketsTicketId = async (args: DeleteApiApiV2TicketsTicketIdArgs, options?: DeleteApiApiV2TicketsTicketIdOptions) => { const {baseUrl = "https://example.zendesk.com", fetch: fetchFn = fetch, apiTokenAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiTokenAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${apiTokenAuth.username}:${apiTokenAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/tickets/${encodeURIComponent(String(args.ticket_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 };