export type BenchmarkID = {id?: number | undefined}; export type V1BlendedBenchmarkJson = {benchmark_composition_id?: number | undefined, rebalance_interval?: ('None' | 'Daily' | 'Weekdays Only' | 'Weekly' | 'Monthly' | 'Quarterly' | 'Semi-annually' | 'Annually') | undefined}; export type V1FixedIncomeBenchmarkJson = {currency?: string | undefined, global_security_master_id?: number | undefined, index_name?: string | undefined, index_type?: ('INDEX' | 'INDEX_ESTIMATED' | 'INDEX_PRELIMINARY' | 'TOTAL_RETURN' | 'NET_RETURN' | 'HEDGED_RETURN' | 'TOTAL_RETURN_DATASTREAM' | 'TOTAL_RETURN_MSCI' | 'TOTAL_RETURN_MTD') | undefined, vendor?: string | undefined, vendor_id?: string | undefined}; export type Percent = {value?: number | undefined}; export type V1FixedReturnBenchmarkJson = {fixed_return?: Percent | undefined, is_compounded?: boolean | undefined}; export type V1IndexBenchmarkJson = {compounded?: boolean | undefined, end_date: string, global_security_master_id?: number | undefined, index_family?: string | undefined, index_name: string, index_type: 'INDEX' | 'INDEX_ESTIMATED' | 'INDEX_PRELIMINARY' | 'TOTAL_RETURN' | 'NET_RETURN' | 'HEDGED_RETURN' | 'TOTAL_RETURN_DATASTREAM' | 'TOTAL_RETURN_MSCI' | 'TOTAL_RETURN_MTD', is_compounded?: boolean | undefined, start_date: string, vendor: string, vendor_id: string}; export type V1NodeBenchmarkJson = {entity_id: number}; export type V1BenchmarkJson = {benchmarkId?: BenchmarkID | undefined, benchmarkType?: ('BLENDED' | 'COMPOSITE_INDEX_BENCHMARK' | 'COMPOSITE_INDEX' | 'FIXED_INCOME_BENCHMARK' | 'FIXED_RETURN' | 'IMPORTED' | 'INDEX' | 'PORTFOLIO_BENCHMARK' | 'SECURITY_BENCHMARK' | 'TOP_LEVEL_OWNER_BENCHMARK' | 'PLACEHOLDER') | undefined, blendedBenchmarkJson?: V1BlendedBenchmarkJson | undefined, compounded?: boolean | undefined, endDate?: string | undefined, entityId?: number | undefined, fixedIncomeBenchmarkJson?: V1FixedIncomeBenchmarkJson | undefined, fixedIncomeCurrency?: string | undefined, fixedIncomeGlobalSecurityMasterId?: number | undefined, fixedIncomeIndexName?: string | undefined, fixedIncomeIndexType?: ('INDEX' | 'INDEX_ESTIMATED' | 'INDEX_PRELIMINARY' | 'TOTAL_RETURN' | 'NET_RETURN' | 'HEDGED_RETURN' | 'TOTAL_RETURN_DATASTREAM' | 'TOTAL_RETURN_MSCI' | 'TOTAL_RETURN_MTD') | undefined, fixedIncomeVendorId?: string | undefined, fixedIncomeVendorToken?: string | undefined, fixedReturn?: Percent | undefined, fixedReturnBenchmarkJson?: V1FixedReturnBenchmarkJson | undefined, globalSecurityMasterId?: number | undefined, id?: number | undefined, indexBenchmarkIsCompounded?: boolean | undefined, indexBenchmarkJson?: V1IndexBenchmarkJson | undefined, indexFamily?: string | undefined, indexName?: string | undefined, indexType?: ('INDEX' | 'INDEX_ESTIMATED' | 'INDEX_PRELIMINARY' | 'TOTAL_RETURN' | 'NET_RETURN' | 'HEDGED_RETURN' | 'TOTAL_RETURN_DATASTREAM' | 'TOTAL_RETURN_MSCI' | 'TOTAL_RETURN_MTD') | undefined, name?: string | undefined, portfolioBenchmarkJson?: V1NodeBenchmarkJson | undefined, rebalanceInterval?: ('None' | 'Daily' | 'Weekdays Only' | 'Weekly' | 'Monthly' | 'Quarterly' | 'Semi-annually' | 'Annually') | undefined, securityBenchmarkJson?: V1NodeBenchmarkJson | undefined, startDate?: string | undefined, vendorId?: string | undefined, vendorToken?: string | undefined}; export type PatchApiBenchmarksArgs = {'Addepar-Firm': string, body: V1BenchmarkJson}; export type PatchApiBenchmarksOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Benchmarks * * PATCH /benchmarks */ export const patchApiBenchmarks = async (args: PatchApiBenchmarksArgs, options?: PatchApiBenchmarksOptions) => { const {baseUrl = "https://examplefirm.addepar.com/api/v1", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/vnd.api+json") headers.set('accept', "application/vnd.api+json") if (args['Addepar-Firm'] != null) headers.set("Addepar-Firm", String(args['Addepar-Firm'])) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/benchmarks${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 };