export type PortfolioTypeParam = Record; export type IntParam = number; export type OutputTypeParam = Record; export type DateParam = string; export type GetApiPortfolioViewsViewIdResultsArgs = {'Addepar-Firm': string, 'view-id': number, portfolio_type?: PortfolioTypeParam | undefined, portfolio_id?: IntParam | undefined, output_type?: OutputTypeParam | undefined, start_date?: DateParam | undefined, end_date?: DateParam | undefined, as_of_knowledge_date?: DateParam | undefined, 'Addepar-Compute-Type'?: ('DEFAULT' | 'BATCH') | undefined}; export type GetApiPortfolioViewsViewIdResultsOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Portfolio View Results * * GET /portfolio/views/{view-id}/results */ export const getApiPortfolioViewsViewIdResults = async (args: GetApiPortfolioViewsViewIdResultsArgs, options?: GetApiPortfolioViewsViewIdResultsOptions) => { const {baseUrl = "https://examplefirm.addepar.com/api/v1", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/vnd.api+json") if (args['Addepar-Firm'] != null) headers.set("Addepar-Firm", String(args['Addepar-Firm'])) if (args.portfolio_type != null) query.append("portfolio_type", JSON.stringify(args.portfolio_type)) if (args.portfolio_id != null) query.append("portfolio_id", String(args.portfolio_id)) if (args.output_type != null) query.append("output_type", JSON.stringify(args.output_type)) if (args.start_date != null) query.append("start_date", String(args.start_date)) if (args.end_date != null) query.append("end_date", String(args.end_date)) if (args.as_of_knowledge_date != null) query.append("as_of_knowledge_date", String(args.as_of_knowledge_date)) if (args['Addepar-Compute-Type'] != null) headers.set("Addepar-Compute-Type", String(args['Addepar-Compute-Type'])) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/portfolio/views/${encodeURIComponent(String(args['view-id']))}/results${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) 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 };