export type InvoicingSettingsPatch = {bankData?: ({accountAUD?: string | undefined, accountCHF?: string | undefined, accountCZK?: string | undefined, accountEUR?: string | undefined, accountGBP?: string | undefined, accountNOK?: string | undefined, accountNZD?: string | undefined, accountUSD?: string | undefined, address?: string | undefined, banks?: (Array<{currency: string, data?: string | undefined, iban?: string | undefined, id: string, name: string, type: 'iban' | 'custom'}>) | undefined, buildingNumber?: string | undefined, city?: string | undefined, country?: string | undefined, details?: string | undefined, iban?: string | undefined, name?: string | undefined, secondaryIban?: string | undefined, street?: string | undefined, vatEnabled?: boolean | undefined, vatMode?: ('additive' | 'inclusive') | undefined, vatNumber?: string | undefined, vatTaxMethod?: ('effective' | 'flat') | undefined, zip?: string | undefined}) | undefined, bank_data?: ({accountAUD?: string | undefined, accountCHF?: string | undefined, accountCZK?: string | undefined, accountEUR?: string | undefined, accountGBP?: string | undefined, accountNOK?: string | undefined, accountNZD?: string | undefined, accountUSD?: string | undefined, address?: string | undefined, banks?: (Array<{currency: string, data?: string | undefined, iban?: string | undefined, id: string, name: string, type: 'iban' | 'custom'}>) | undefined, buildingNumber?: string | undefined, city?: string | undefined, country?: string | undefined, details?: string | undefined, iban?: string | undefined, name?: string | undefined, secondaryIban?: string | undefined, street?: string | undefined, vatEnabled?: boolean | undefined, vatMode?: ('additive' | 'inclusive') | undefined, vatNumber?: string | undefined, vatTaxMethod?: ('effective' | 'flat') | undefined, zip?: string | undefined}) | undefined, company?: ({banks?: (Array<{currency: string, data?: string | undefined, iban?: string | undefined, id: string, name: string, type: 'iban' | 'custom'}>) | undefined, buildingNumber?: string | undefined, city?: string | undefined, country?: string | undefined, details?: string | undefined, name?: string | undefined, street?: string | undefined, vatEnabled?: boolean | undefined, vatMode?: ('additive' | 'inclusive') | undefined, vatNumber?: string | undefined, vatTaxMethod?: ('effective' | 'flat') | undefined, zip?: string | undefined}) | undefined, locale?: ('de' | 'en' | 'fr' | 'it') | undefined, settings?: ({allowCustomVatRate?: boolean | undefined, countToggleExpenseToPaid?: number | undefined, flatVatTaxRate?: number | undefined, invoiceDefaultDescription?: string | undefined, invoiceDefaultQuoteDescription?: string | undefined, invoicePaymentDueInDays?: number | undefined, invoicePaymentReference?: string | undefined, invoiceQRAccountName?: string | undefined, invoiceReplyToEmail?: string | undefined, invoiceShowPaymentDueDate?: boolean | undefined, invoiceShowQuoteSignatureFields?: boolean | undefined, lastUsedAdvancePaymentNote?: string | undefined, lastUsedAdvancePaymentPercentage?: number | undefined, lastUsedInvoiceItemHourlyRate?: number | undefined, lastUsedInvoiceType?: ('normal' | 'quote') | undefined, lastUsedVatRate?: (number | null) | undefined, notificationToken?: (string | null) | undefined, quotePaymentDueInDays?: number | undefined}) | undefined}; export type PatchApiInvoicingSettingsArgs = {body: InvoicingSettingsPatch}; export type PatchApiInvoicingSettingsOptions = {baseUrl: string, ApiKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update invoicing settings * * PATCH /invoicing-settings * * Also accepts auth: FirebaseIdToken */ export const patchApiInvoicingSettings = async (args: PatchApiInvoicingSettingsArgs, options: PatchApiInvoicingSettingsOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (ApiKeyHeader !== undefined) headers.set("X-API-Key", ApiKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/invoicing-settings${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 (await res.json()) as unknown };