export type GetApiApiV2ToolsSearchArgs = {query?: string | undefined, registry_chain?: string | undefined, tags?: Array | undefined, access_type?: string | undefined, creator?: string | undefined, source?: string | undefined, collection?: string | undefined, sort_by?: string | undefined, include_details?: boolean | undefined, limit?: number | undefined, cursor?: string | undefined}; export type GetApiApiV2ToolsSearchOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * [Beta] Search registered tools * * GET /api/v2/tools/search */ export const getApiApiV2ToolsSearch = async (args: GetApiApiV2ToolsSearchArgs, options?: GetApiApiV2ToolsSearchOptions) => { const {baseUrl = "https://api.opensea.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.query != null) query.append("query", String(args.query)) if (args.registry_chain != null) query.append("registry_chain", String(args.registry_chain)) for (const item of args.tags ?? []) query.append("tags", String(item)) if (args.access_type != null) query.append("access_type", String(args.access_type)) if (args.creator != null) query.append("creator", String(args.creator)) if (args.source != null) query.append("source", String(args.source)) if (args.collection != null) query.append("collection", String(args.collection)) if (args.sort_by != null) query.append("sort_by", String(args.sort_by)) if (args.include_details != null) query.append("include_details", String(args.include_details)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.cursor != null) query.append("cursor", String(args.cursor)) if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/tools/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.blob() };