export type GetApiApiV2ToolsArgs = {sort_by?: string | undefined, type?: string | undefined, source?: string | undefined, limit?: number | undefined, cursor?: string | undefined}; export type GetApiApiV2ToolsOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * [Beta] List registered tools * * GET /api/v2/tools */ export const getApiApiV2Tools = async (args: GetApiApiV2ToolsArgs, options?: GetApiApiV2ToolsOptions) => { const {baseUrl = "https://api.opensea.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.sort_by != null) query.append("sort_by", String(args.sort_by)) if (args.type != null) query.append("type", String(args.type)) if (args.source != null) query.append("source", String(args.source)) 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${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() };