export type DeleteApiInventoryTransactionsInventoryTransactionIdAttachmentsIdArgs = {inventory_transaction_id: number, id: number}; export type DeleteApiInventoryTransactionsInventoryTransactionIdAttachmentsIdOptions = {baseUrl?: string | undefined, OAuth2AccessCode?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete attachment * * DELETE /inventory_transactions/{inventory_transaction_id}/attachments/{id} * * Also accepts auth: OAuth2ClientCredential */ export const deleteApiInventoryTransactionsInventoryTransactionIdAttachmentsId = async (args: DeleteApiInventoryTransactionsInventoryTransactionIdAttachmentsIdArgs, options?: DeleteApiInventoryTransactionsInventoryTransactionIdAttachmentsIdOptions) => { const {baseUrl = "https://r38.coupadev.com/api", fetch: fetchFn = fetch, OAuth2AccessCode} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (OAuth2AccessCode !== undefined) headers.set('authorization', `Bearer ${OAuth2AccessCode}`) const url = `${baseUrl.replace(/\/+$/, '')}/inventory_transactions/${encodeURIComponent(String(args.inventory_transaction_id))}/attachments/${encodeURIComponent(String(args.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 };