export type CreateApiCoaApiV1BillDraftIdAbandonArgs = {id: number}; export type CreateApiCoaApiV1BillDraftIdAbandonOptions = {baseUrl?: string | undefined, knoxApiToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Abandon Bill Draft * * POST /coa/api/v1/bill-draft/{id}/abandon */ export const createApiCoaApiV1BillDraftIdAbandon = async (args: CreateApiCoaApiV1BillDraftIdAbandonArgs, options?: CreateApiCoaApiV1BillDraftIdAbandonOptions) => { const {baseUrl = "https://api.meetcampfire.com", fetch: fetchFn = fetch, knoxApiToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (knoxApiToken !== undefined) headers.set("Authorization", knoxApiToken) const url = `${baseUrl.replace(/\/+$/, '')}/coa/api/v1/bill-draft/${encodeURIComponent(String(args.id))}/abandon${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };