export type RecognizedRevenueEntryDto = {timeframe: string, total: number}; export type UpsertRecognizedRevenueDto = {recognizedRevenue: Array}; export type CreateApiV3PerformanceObligationsPerformanceObligationIdRecognizedArgs = {performanceObligationId: string, body: UpsertRecognizedRevenueDto}; export type CreateApiV3PerformanceObligationsPerformanceObligationIdRecognizedOptions = {baseUrl?: string | undefined, customHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upsert recognized revenue * * POST /v3/performance-obligations/{performanceObligationId}/recognized */ export const createApiV3PerformanceObligationsPerformanceObligationIdRecognized = async (args: CreateApiV3PerformanceObligationsPerformanceObligationIdRecognizedArgs, options?: CreateApiV3PerformanceObligationsPerformanceObligationIdRecognizedOptions) => { 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/performance-obligations/${encodeURIComponent(String(args.performanceObligationId))}/recognized${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 };