export type DeleteApiApiTransactionsTransactionIdArgs = {transaction_id: string, apply_to?: string | undefined, 'X-Workspace-Id'?: (string | null) | undefined}; export type DeleteApiApiTransactionsTransactionIdOptions = {baseUrl: string, OAuth2PasswordBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Transaction * * DELETE /api/transactions/{transaction_id} */ export const deleteApiApiTransactionsTransactionId = async (args: DeleteApiApiTransactionsTransactionIdArgs, options: DeleteApiApiTransactionsTransactionIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2PasswordBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.apply_to != null) query.append("apply_to", String(args.apply_to)) if (args['X-Workspace-Id'] != null) headers.set("X-Workspace-Id", String(args['X-Workspace-Id'])) if (OAuth2PasswordBearer !== undefined) headers.set('authorization', `Bearer ${OAuth2PasswordBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/transactions/${encodeURIComponent(String(args.transaction_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 };