export type GetApiApiV1WWIdSearchArgs = {wId: string, query: string, limit?: number | undefined, cursor?: string | undefined, viewType?: ('all' | 'document' | 'table') | undefined, spaceIds?: string | undefined, includeDataSources?: boolean | undefined, searchSourceUrls?: boolean | undefined, includeTools?: boolean | undefined}; export type GetApiApiV1WWIdSearchOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search for nodes in the workspace (streaming) * * GET /api/v1/w/{wId}/search */ export const getApiApiV1WWIdSearch = async (args: GetApiApiV1WWIdSearchArgs, options?: GetApiApiV1WWIdSearchOptions) => { const {baseUrl = "https://dust.tt", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/event-stream") if (args.query != null) query.append("query", String(args.query)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.cursor != null) query.append("cursor", String(args.cursor)) if (args.viewType != null) query.append("viewType", String(args.viewType)) if (args.spaceIds != null) query.append("spaceIds", String(args.spaceIds)) if (args.includeDataSources != null) query.append("includeDataSources", String(args.includeDataSources)) if (args.searchSourceUrls != null) query.append("searchSourceUrls", String(args.searchSourceUrls)) if (args.includeTools != null) query.append("includeTools", String(args.includeTools)) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/w/${encodeURIComponent(String(args.wId))}/search${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 res.text() };