export type TaxOnlyUpdate = {tax_only: boolean}; export type CreateApiV1TransactionsTransactionIdTaxOnlyArgs = {transaction_id: string, 'x-organization-id': string | null, body: TaxOnlyUpdate}; export type CreateApiV1TransactionsTransactionIdTaxOnlyOptions = {baseUrl?: string | undefined, APIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set transaction tax only * * POST /v1/transactions/{transaction_id}/tax_only */ export const createApiV1TransactionsTransactionIdTaxOnly = async (args: CreateApiV1TransactionsTransactionIdTaxOnlyArgs, options?: CreateApiV1TransactionsTransactionIdTaxOnlyOptions) => { const {baseUrl = "https://api.trykintsugi.com", fetch: fetchFn = fetch, APIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-organization-id'] != null) headers.set("x-organization-id", String(args['x-organization-id'])) if (APIKeyHeader !== undefined) headers.set("X-API-KEY", APIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v1/transactions/${encodeURIComponent(String(args.transaction_id))}/tax_only${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };