export type GetApiApiV1WorkspacesSlugTopicsSearchArgs = {q: string, include_notes: string, tags: string, limit: string, stale: string, view: string}; export type GetApiApiV1WorkspacesSlugTopicsSearchOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /api/v1/workspaces/{slug}/topics/search */ export const getApiApiV1WorkspacesSlugTopicsSearch = async (args: GetApiApiV1WorkspacesSlugTopicsSearchArgs, options?: GetApiApiV1WorkspacesSlugTopicsSearchOptions) => { const {baseUrl = "https://api.trybrein.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.q != null) query.append("q", String(args.q)) if (args.include_notes != null) query.append("include_notes", String(args.include_notes)) if (args.tags != null) query.append("tags", String(args.tags)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.stale != null) query.append("stale", String(args.stale)) if (args.view != null) query.append("view", String(args.view)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/workspaces/${encodeURIComponent(String(args.slug))}/topics/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 undefined };