export type PatchApiInvoicesInvoiceIdItemsItemIdArgs = {invoice_id: number, item_id: number, body: {quantity?: number | undefined, price?: number | undefined, discount?: ({type: 'percentage' | 'value', percentage: number, amount: number, sponsor: 'staff' | 'company'}) | undefined, warranty?: ({period: number, unit: 'days' | 'months'}) | undefined, tax_ids?: Array | undefined, comment?: string | undefined, comment_visibility?: ('private' | 'public') | undefined}}; export type PatchApiInvoicesInvoiceIdItemsItemIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Invoice Item * * PATCH /invoices/{invoice_id}/items/{item_id} */ export const patchApiInvoicesInvoiceIdItemsItemId = async (args: PatchApiInvoicesInvoiceIdItemsItemIdArgs, options?: PatchApiInvoicesInvoiceIdItemsItemIdOptions) => { const {baseUrl = "https://api.roapp.io/v2", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set('authorization', `Bearer ${apiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/invoices/${encodeURIComponent(String(args.invoice_id))}/items/${encodeURIComponent(String(args.item_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };