export type PositionJson = {createdAt?: string | undefined, displayName?: string | undefined, factors?: {[key: string]: Record} | undefined, fromEntityId?: number | undefined, id?: number | undefined, inceptingOpenPositionCurrencyFactor?: ('USD' | 'EUR' | 'GBP' | 'GBX' | 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'ATS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BEF' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTC' | 'BTN' | 'BWP' | 'BYN' | 'BYR' | 'BZD' | 'CAD' | 'CDF' | 'CHF' | 'CLF' | 'CLP' | 'CNH' | 'CNY' | 'COP' | 'CRC' | 'CUC' | 'CUP' | 'CYP' | 'CVE' | 'CZK' | 'DEM' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EEK' | 'EGP' | 'ERN' | 'ESP' | 'ETB' | 'ETH' | 'FIM' | 'FJD' | 'FKP' | 'FRF' | 'GEL' | 'GGP' | 'GHC' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GRD' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'IEP' | 'ILS' | 'IMP' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'ITL' | 'JEP' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LTC' | 'LTL' | 'LVL' | 'LUF' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRO' | 'MRU' | 'MTL' | 'MUR' | 'MVQ' | 'MVR' | 'MWK' | 'MXN' | 'MXP' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NLG' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PTE' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SIT' | 'SKK' | 'SLL' | 'SOS' | 'SRD' | 'STD' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRL' | 'TRY' | 'TTD' | 'TVD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'UYI' | 'UYU' | 'UZS' | 'VEB' | 'VEF' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XCD' | 'XEU' | 'XOF' | 'XPD' | 'XRH' | 'XRI' | 'XRP' | 'XPF' | 'XPT' | 'YER' | 'YUD' | 'ZAR' | 'ZMK' | 'ZMW' | 'ZWD' | 'ZWL') | undefined, inceptingOpenPositionDate?: string | undefined, inceptingOpenPositionOwnershipPercentage?: number | undefined, inceptingOpenPositionValue?: number | undefined, modifiedAt?: string | undefined, name?: string | undefined, toEntityId?: number | undefined}; export type PatchApiPositionsArgs = {'Addepar-Firm': string, body: PositionJson}; export type PatchApiPositionsOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Positions * * PATCH /positions */ export const patchApiPositions = async (args: PatchApiPositionsArgs, options?: PatchApiPositionsOptions) => { 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(/\/+$/, '')}/positions${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 };