export type PatchApiApiV1InvoicesIdArgs = {id: string, body: {date?: string | undefined, costCenter?: string | undefined, project?: ({id: string} | null) | undefined, customer?: ({id: string} | null) | undefined, tags?: Array<{id: string}> | undefined, devCustomer?: (string | null) | undefined, billingAddress?: ({name: string, contactPerson: string, department: string | null, subdivision: string | null, street: string, additionalDetails: string | null, city: string, zipCode: string, country: string} | null) | undefined, paymentMethodName?: string | undefined, gln?: (string | null) | undefined, taxation?: string | undefined, dunningSettings?: ({level: 'noReminder' | 'paymentReminder' | 'reminder1' | 'reminder2' | 'reminder3' | 'debtCollection' | 'lossOfReceivables', date: string, comment: unknown, sent: boolean} | null) | undefined, dunningManualSettings?: ({paymentStatus: 'pending' | 'paid' | 'partlyPaid' | 'canceled' | 'partialCancellation' | 'badDebt' | 'debited' | 'unknown', paidAt: string | null, actualAmount: number, discountGiven: number} | null) | undefined}}; export type PatchApiApiV1InvoicesIdOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update invoice * * PATCH /api/v1/invoices/{id} */ export const patchApiApiV1InvoicesId = async (args: PatchApiApiV1InvoicesIdArgs, options?: PatchApiApiV1InvoicesIdOptions) => { const {baseUrl = "https://xentral.xentral.biz", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/invoices/${encodeURIComponent(String(args.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 };