export type GetApiFabricFabricApiEdgesCollectionIdArgs = {fabric: unknown, 'collection-id': unknown, vertex: string, direction?: string | undefined}; export type GetApiFabricFabricApiEdgesCollectionIdOptions = {baseUrl: string, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Read in- or outbound edges * * GET /_fabric/{fabric}/_api/edges/{collection-id} * * Also accepts auth: BearerAuth */ export const getApiFabricFabricApiEdgesCollectionId = async (args: GetApiFabricFabricApiEdgesCollectionIdArgs, options: GetApiFabricFabricApiEdgesCollectionIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.vertex != null) query.append("vertex", String(args.vertex)) if (args.direction != null) query.append("direction", String(args.direction)) if (ApiKeyAuth !== undefined) headers.set("Authorization", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/_fabric/${encodeURIComponent(String(args.fabric))}/_api/edges/${encodeURIComponent(String(args['collection-id']))}${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 };