export type GetApiFinancialDatasetsIndexFundsArgs = {ticker?: string | undefined, holding?: string | undefined, as_of?: string | undefined, asset_class?: string | undefined, limit?: number | undefined, offset?: number | undefined, cursor?: string | undefined}; export type GetApiFinancialDatasetsIndexFundsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Query fund holdings in two directions. Provide exactly one of `ticker` or `holding`. `?ticker=SPY` returns a fund's constituents and each position's weight (the fund's latest filing by default, or the composition in effect on/before `as_of`). `?holding=AAPL` returns the funds whose latest filing holds that security, sorted by weight. * * GET /financial-datasets/index-funds */ export const getApiFinancialDatasetsIndexFunds = async (args: GetApiFinancialDatasetsIndexFundsArgs, options?: GetApiFinancialDatasetsIndexFundsOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.ticker != null) query.append("ticker", String(args.ticker)) if (args.holding != null) query.append("holding", String(args.holding)) if (args.as_of != null) query.append("as_of", String(args.as_of)) if (args.asset_class != null) query.append("asset_class", String(args.asset_class)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.offset != null) query.append("offset", String(args.offset)) if (args.cursor != null) query.append("cursor", String(args.cursor)) const url = `${baseUrl.replace(/\/+$/, '')}/financial-datasets/index-funds${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 undefined };