export type V1AdvanceAdjustmentSettings = {accounts_to_evaluate?: ('ALL_ACCOUNTS' | 'ONLY_NEW_AND_CLOSED_ACCOUNTS' | 'ONLY_NEW_AND_CLOSED_PORTFOLIOS') | undefined, rate_type?: ('TOP' | 'MARGINAL') | undefined}; export type V1ProrationMinimum = {monetary_value?: number | undefined, percentage?: number | undefined}; export type V1FlowProration = {data_source?: ('ALL_FLOWS' | 'INFLOWS' | 'ALL_FLOWS_EXCLUDING_BUYS_SELLS' | 'INFLOWS_EXCLUDING_BUYS_SELLS') | undefined, method?: ('NET' | 'GROSS') | undefined, rate_calculation?: ('TOP' | 'MARGINAL') | undefined, threshold?: V1ProrationMinimum | undefined}; export type V1NewAndClosedProration = {data_source?: ('ALL_FLOWS' | 'INFLOWS' | 'ALL_FLOWS_EXCLUDING_BUYS_SELLS' | 'INFLOWS_EXCLUDING_BUYS_SELLS') | undefined, method?: ('NET' | 'USING_VALUE_ON_START_OR_END_DATE' | 'GROSS' | 'USING_VALUE_ON_BILL_DATE') | undefined, rate_calculation?: ('TOP' | 'MARGINAL' | 'TOP_WITH_MARGINAL_ON_OPEN_CLOSE') | undefined, threshold?: V1ProrationMinimum | undefined}; export type V1ProrationSettings = {existing_accounts?: V1FlowProration | undefined, new_and_closed_accounts?: V1NewAndClosedProration | undefined}; export type V1RateTierJson = {id?: number | undefined, lower_bound?: number | undefined, rate?: number | undefined}; export type V1ValuationSettings = {accrual_type?: ('ALL' | 'CASH_AND_DIVIDENDS' | 'CASH_AND_INTEREST' | 'NONE') | undefined, adjustment_type?: ('ADJUSTED_VALUE' | 'ESTIMATED_RETURNS' | 'ADJUSTED_ESTIMATED_RETURNS' | 'NONE') | undefined, method?: ('ON_BILL_DATE' | 'AVERAGE_MONTHLY' | 'AVERAGE_DAILY') | undefined}; export type V1FeeRuleJson = {advanceAdjustmentSettings?: V1AdvanceAdjustmentSettings | undefined, description?: string | undefined, feeDistributionMethod?: ('BILLABLE_PORTFOLIO' | 'DIRECT_OWNER' | 'HOLDING_ACCOUNT') | undefined, feeStructure?: ('AUM' | 'FLAT') | undefined, feeType?: string | undefined, flatFeeAmount?: number | undefined, flatFeeProrationMethod?: ('NONE' | 'NEW_AND_CLOSED_BILLABLE_PORTFOLIOS') | undefined, id?: string | undefined, lastModified?: string | undefined, marginHandlingMethod?: ('USE_VALUE' | 'NET_AS_ZERO' | 'NET_ABSOLUTE' | 'GROSS_ABSOLUTE' | 'GROSS_AS_ZERO') | undefined, missingFlatFeeRuleParameters?: Array | undefined, missingTieredRateFeeRuleParameters?: Array | undefined, missingWaterFallRateFeeRuleParameters?: Array | undefined, name?: string | undefined, prorationSettings?: V1ProrationSettings | undefined, rateTierAssetFilterConfiguration?: ('BILLABLE_ASSETS' | 'ASSETS_BILLED_ON' | 'RATE_FILTERED_ASSETS') | undefined, rateTiers?: Array | undefined, rateType?: ('TOP' | 'MARGINAL' | 'MARGINAL_WITH_RANKED_ENTITIES') | undefined, scaling?: ('EVEN' | 'DAYS_IN_PERIOD') | undefined, scalingForAverageAssetValuation?: ('AVERAGE_ACROSS_ENTIRE_PERIOD' | 'SCALE_RATE' | 'AVERAGE_ACROSS_HELD_PERIOD') | undefined, scheduleIds?: Array | undefined, valuationSettings?: V1ValuationSettings | undefined}; export type CreateApiFeesArgs = {'Addepar-Firm': string, body: V1FeeRuleJson}; export type CreateApiFeesOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Fee * * POST /fees */ export const createApiFees = async (args: CreateApiFeesArgs, options?: CreateApiFeesOptions) => { 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(/\/+$/, '')}/fees${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 (await res.json()) as unknown };