export type DiscountDto = {type?: ('PERCENTAGE' | 'FIXED') | undefined, amount?: string | undefined, note?: string | undefined}; export type UpdateObligationDto = {name?: string | undefined, description?: string | undefined, itemId?: string | undefined, productId?: (string | null) | undefined, classId?: string | undefined, categoryId?: string | undefined, eventTypeId?: string | undefined, price?: string | undefined, invoiceDateStrategy?: string | undefined, netPaymentTerms?: number | undefined, includeInArr?: boolean | undefined, billingStartDate?: string | undefined, billingFrequency?: number | undefined, billingFrequencyUnit?: ('NONE' | 'DAY' | 'MONTH' | 'HOUR' | 'YEAR' | 'QUARTER' | 'SEMI_MONTH' | 'WEEK') | undefined, totalNumberOfInvoices?: number | undefined, revenueStartDate?: string | undefined, revenueEndDate?: string | undefined, discount?: DiscountDto | undefined, regenerateInvoices?: boolean | undefined}; export type PatchApiV31ContractsIdObligationObligationIdArgs = {id: string, obligationId: string, body: UpdateObligationDto}; export type PatchApiV31ContractsIdObligationObligationIdOptions = {baseUrl?: string | undefined, customHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update contract obligation * * PATCH /v3.1/contracts/{id}/obligation/{obligationId} */ export const patchApiV31ContractsIdObligationObligationId = async (args: PatchApiV31ContractsIdObligationObligationIdArgs, options?: PatchApiV31ContractsIdObligationObligationIdOptions) => { const {baseUrl = "https://integrators.prod.api.tabsplatform.com", fetch: fetchFn = fetch, customHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (customHeader !== undefined) headers.set("Authorization", customHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v3.1/contracts/${encodeURIComponent(String(args.id))}/obligation/${encodeURIComponent(String(args.obligationId))}${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 };