@search1api/client 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -2
- package/dist/client.d.ts +12 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/generated.d.ts +334 -8
- package/dist/generated.d.ts.map +1 -1
- package/dist/index.cjs +36 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +36 -1
- package/dist/index.js.map +2 -2
- package/dist/types.d.ts +63 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -32,12 +32,43 @@ for (const result of response.results) {
|
|
|
32
32
|
|
|
33
33
|
The constructor reads `SEARCH1API_API_KEY` when `apiKey` is omitted.
|
|
34
34
|
|
|
35
|
+
`searchService` selects one engine (`google` by default), for example `bing`,
|
|
36
|
+
`bingcn`, `yandex`, `reddit`, `github`, `arxiv`, `wikipedia`, or `grokipedia`.
|
|
37
|
+
`page` requests a later results page on engines with native pagination
|
|
38
|
+
(`bing`, `bingcn`, `baidu`, `grokipedia`). Results carry `published_date` when the source
|
|
39
|
+
exposes one. Engine-specific fields are in each result's optional `metadata`:
|
|
40
|
+
GitHub uses `metadata.kind`, `metadata.stars`, `metadata.language`, and
|
|
41
|
+
`metadata.num_comments`; Hacker News news results use `metadata.story_url`,
|
|
42
|
+
`metadata.points`, and `metadata.num_comments`. The former top-level paths
|
|
43
|
+
are removed in 0.4.0; `published_date` stays at the top level.
|
|
44
|
+
|
|
35
45
|
CommonJS projects can load the same client with `require`:
|
|
36
46
|
|
|
37
47
|
```js
|
|
38
48
|
const { Search1API } = require('@search1api/client');
|
|
39
49
|
```
|
|
40
50
|
|
|
51
|
+
## Ask
|
|
52
|
+
|
|
53
|
+
`ask` sends a natural-language request and lets Search1API choose the engines
|
|
54
|
+
and time window. It returns at most 10 results ranked by relevance, and
|
|
55
|
+
`intent` reports what was searched:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
const answer = await client.ask(
|
|
59
|
+
'What are developers saying about Bun 1.3 this month?'
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
console.log(answer.intent.sources, answer.intent.time_range);
|
|
63
|
+
for (const result of answer.results) {
|
|
64
|
+
console.log(result.relevance, result.source, result.title, result.link);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
A completed request costs 5 credits. Ask is not available with pay-per-request
|
|
69
|
+
payments, and its default timeout is 45 seconds. Use `search` when you already
|
|
70
|
+
know which engine and keywords you want.
|
|
71
|
+
|
|
41
72
|
## Deepcrawl
|
|
42
73
|
|
|
43
74
|
`deepcrawl` starts a task and waits for it to finish:
|
|
@@ -71,10 +102,22 @@ console.log(screenshot.contentType, screenshot.requestId);
|
|
|
71
102
|
The client also provides `news`, `crawl`, `sitemap`, `trending`, `extract`,
|
|
72
103
|
`usage`, and their batch variants where the HTTP API supports them.
|
|
73
104
|
|
|
105
|
+
`feedback` reports a Search1API problem, missing capability, or confusing
|
|
106
|
+
documentation. It is free and is never retried automatically, because a retry
|
|
107
|
+
could file a duplicate report. Do not include credentials or personal data:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
await client.feedback('Results for this query have no publication dates', {
|
|
111
|
+
category: 'feature_request',
|
|
112
|
+
requestId: 'the x-search1api-request-id of the original request',
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
74
116
|
Requests time out after 30 seconds and retry `429` and transient `5xx`
|
|
75
117
|
responses twice by default. Authentication, payment, and validation errors are
|
|
76
|
-
never retried. Deepcrawl task creation
|
|
77
|
-
|
|
118
|
+
never retried. Deepcrawl task creation and feedback are not retried
|
|
119
|
+
automatically because they are not idempotent. Configure this with `timeoutMs`
|
|
120
|
+
and `maxRetries`.
|
|
78
121
|
|
|
79
122
|
## Development
|
|
80
123
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BatchResponse, CrawlOptions, CrawlRequest, CrawlResponse, DeepcrawlAcceptedResponse, DeepcrawlOptions, DeepcrawlStatusResponse, ExtractOptions, ExtractResponse, HealthResponse, JsonValue, NewsOptions, NewsRequest, NewsResponse, RequestOptions, Search1APIOptions, SearchOptions, SearchRequest, SearchResponse, ScreenshotOptions, ScreenshotResponse, SitemapOptions, SitemapResponse, TimeRange, TrendingOptions, TrendingResponse, UsageResponse, WaitForDeepcrawlOptions } from './types.js';
|
|
1
|
+
import type { AskResponse, BatchResponse, CrawlOptions, CrawlRequest, CrawlResponse, DeepcrawlAcceptedResponse, DeepcrawlOptions, DeepcrawlStatusResponse, ExtractOptions, ExtractResponse, FeedbackOptions, FeedbackResponse, HealthResponse, JsonValue, NewsOptions, NewsRequest, NewsResponse, RequestOptions, Search1APIOptions, SearchOptions, SearchRequest, SearchResponse, ScreenshotOptions, ScreenshotResponse, SitemapOptions, SitemapResponse, TimeRange, TrendingOptions, TrendingResponse, UsageResponse, WaitForDeepcrawlOptions } from './types.js';
|
|
2
2
|
export declare class Search1API {
|
|
3
3
|
readonly apiKey: string;
|
|
4
4
|
readonly baseUrl: string;
|
|
@@ -12,6 +12,12 @@ export declare class Search1API {
|
|
|
12
12
|
searchBatch(requests: SearchRequest[], requestOptions?: RequestOptions): Promise<BatchResponse<SearchResponse>>;
|
|
13
13
|
news(query: string, options?: NewsOptions, requestOptions?: RequestOptions): Promise<NewsResponse>;
|
|
14
14
|
newsBatch(requests: NewsRequest[], requestOptions?: RequestOptions): Promise<BatchResponse<NewsResponse>>;
|
|
15
|
+
/**
|
|
16
|
+
* Agentic search: a decision model picks the engines and time window from a
|
|
17
|
+
* natural-language query and returns only relevant results. 5 credits per
|
|
18
|
+
* completed request; requires an API key or OAuth token.
|
|
19
|
+
*/
|
|
20
|
+
ask(query: string, requestOptions?: RequestOptions): Promise<AskResponse>;
|
|
15
21
|
crawl(url: string, options?: CrawlOptions, requestOptions?: RequestOptions): Promise<CrawlResponse>;
|
|
16
22
|
crawlBatch(requests: CrawlRequest[], requestOptions?: RequestOptions): Promise<CrawlResponse[]>;
|
|
17
23
|
screenshot(url: string, options?: ScreenshotOptions, requestOptions?: RequestOptions): Promise<ScreenshotResponse>;
|
|
@@ -24,6 +30,11 @@ export declare class Search1API {
|
|
|
24
30
|
deepcrawl(url: string, options?: DeepcrawlOptions, waitOptions?: WaitForDeepcrawlOptions, requestOptions?: RequestOptions): Promise<DeepcrawlStatusResponse>;
|
|
25
31
|
usage(period?: TimeRange, requestOptions?: RequestOptions): Promise<UsageResponse>;
|
|
26
32
|
health(requestOptions?: RequestOptions): Promise<HealthResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Report a Search1API problem, missing capability, or confusing docs. Free.
|
|
35
|
+
* Never include credentials or personal data in the report.
|
|
36
|
+
*/
|
|
37
|
+
feedback(message: string, options?: FeedbackOptions, requestOptions?: RequestOptions): Promise<FeedbackResponse>;
|
|
27
38
|
private requestJson;
|
|
28
39
|
private request;
|
|
29
40
|
private fetchOnce;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAEV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,cAAc,EACd,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACxB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAEV,WAAW,EACX,aAAa,EACb,YAAY,EAC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E,cAAmB,GAClC,OAAO,CAAC,uBAAuB,CAAC;IAK7B,KAAK,CACT,MAAM,CAAC,EAAE,SAAS,EAClB,cAAc,GAAE,cAAmB,GAClC,OAAO,CAAC,aAAa,CAAC;IAOnB,MAAM,CAAC,cAAc,GAAE,cAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;IAI1E;;;OAGG;IACG,QAAQ,CACZ,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,eAAoB,EAC7B,cAAc,GAAE,cAAmB,GAClC,OAAO,CAAC,gBAAgB,CAAC;YAmBd,WAAW;YAgBX,OAAO;YA+CP,SAAS;IAoDvB,OAAO,CAAC,UAAU;CAInB"}
|
package/dist/generated.d.ts
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
* Do not make direct changes to the file.
|
|
4
4
|
*/
|
|
5
5
|
export interface paths {
|
|
6
|
+
"/feedback": {
|
|
7
|
+
parameters: {
|
|
8
|
+
query?: never;
|
|
9
|
+
header?: never;
|
|
10
|
+
path?: never;
|
|
11
|
+
cookie?: never;
|
|
12
|
+
};
|
|
13
|
+
get?: never;
|
|
14
|
+
put?: never;
|
|
15
|
+
/**
|
|
16
|
+
* Report a Search1API problem or feature request
|
|
17
|
+
* @description Report a Search1API problem, missing capability, or confusing documentation encountered during a task. Only message is required. Optional request_id refers to the original problem request. Do not include credentials, personal data, or private user content. Reports are stored in Agentback and linked to an opaque account reference. Do not report every empty result or retry the same report automatically; feedback should not block the main task. Returns 201 only after storage succeeds. Maximum JSON body size: 16 KiB. Limited to 10 submissions per account per minute at a Cloudflare location. Free to call.
|
|
18
|
+
*/
|
|
19
|
+
post: operations["feedback"];
|
|
20
|
+
delete?: never;
|
|
21
|
+
options?: never;
|
|
22
|
+
head?: never;
|
|
23
|
+
patch?: never;
|
|
24
|
+
trace?: never;
|
|
25
|
+
};
|
|
6
26
|
"/screenshot": {
|
|
7
27
|
parameters: {
|
|
8
28
|
query?: never;
|
|
@@ -34,7 +54,7 @@ export interface paths {
|
|
|
34
54
|
put?: never;
|
|
35
55
|
/**
|
|
36
56
|
* Search the web using multiple search engines
|
|
37
|
-
* @description Search the live public web when the answer depends on current information, sources, or research a model's training data cannot cover. Returns ranked results with id, title, URL, and
|
|
57
|
+
* @description Search the live public web when the answer depends on current information, sources, or research a model's training data cannot cover. Returns ranked results with id, title, URL, snippet, and `published_date` (ISO 8601, when the engine exposes one) across 13+ engines, with optional images. Set `crawl_results` to pull the top N result pages in the same call — each crawled page is billed as an additional crawl — or pass a result URL to POST /crawl separately. Costs 1 credit per request.
|
|
38
58
|
*/
|
|
39
59
|
post: operations["search"];
|
|
40
60
|
delete?: never;
|
|
@@ -54,7 +74,7 @@ export interface paths {
|
|
|
54
74
|
put?: never;
|
|
55
75
|
/**
|
|
56
76
|
* Search news articles across multiple sources
|
|
57
|
-
* @description Search recent news when the question is about events, announcements, or coverage rather than reference material. Returns articles from verified publishers with title, URL, snippet, and optional full page content, filterable by site, language, and time range. For questions that are not time-sensitive, prefer POST /search. Costs 1 credit per request.
|
|
77
|
+
* @description Search recent news when the question is about events, announcements, or coverage rather than reference material. Returns articles from verified publishers with title, URL, snippet, `published_date` (ISO 8601, when known), and optional full page content, filterable by site, language, and time range. For questions that are not time-sensitive, prefer POST /search. Costs 1 credit per request.
|
|
58
78
|
*/
|
|
59
79
|
post: operations["news"];
|
|
60
80
|
delete?: never;
|
|
@@ -63,6 +83,26 @@ export interface paths {
|
|
|
63
83
|
patch?: never;
|
|
64
84
|
trace?: never;
|
|
65
85
|
};
|
|
86
|
+
"/ask": {
|
|
87
|
+
parameters: {
|
|
88
|
+
query?: never;
|
|
89
|
+
header?: never;
|
|
90
|
+
path?: never;
|
|
91
|
+
cookie?: never;
|
|
92
|
+
};
|
|
93
|
+
get?: never;
|
|
94
|
+
put?: never;
|
|
95
|
+
/**
|
|
96
|
+
* Search the engines a natural-language request calls for
|
|
97
|
+
* @description Agentic search. Describe what you are looking for in plain language and let a decision model (currently TypeSafe Jev) decide where to look. It picks up to five engines (web search, Hacker News, Reddit, GitHub, X, arXiv, Wikipedia, IMDb, WeChat, YouTube), rewrites the request into search keywords, infers a publication window from phrases such as "this week", searches the engines in parallel, and returns only the results judged relevant, merged and ranked, so agents read fewer off-topic results. The request takes only `query`; engines, keywords, and the window are always chosen by the model, and the response reports them in `intent`. Use POST /search instead when you already know the engine and keywords and want its raw ranking. Costs 5 credits per request.
|
|
98
|
+
*/
|
|
99
|
+
post: operations["ask"];
|
|
100
|
+
delete?: never;
|
|
101
|
+
options?: never;
|
|
102
|
+
head?: never;
|
|
103
|
+
patch?: never;
|
|
104
|
+
trace?: never;
|
|
105
|
+
};
|
|
66
106
|
"/crawl": {
|
|
67
107
|
parameters: {
|
|
68
108
|
query?: never;
|
|
@@ -74,7 +114,7 @@ export interface paths {
|
|
|
74
114
|
put?: never;
|
|
75
115
|
/**
|
|
76
116
|
* Crawl a URL and extract its content
|
|
77
|
-
* @description Fetch one public URL and return its readable title and body as clean text, with navigation, boilerplate, and scripts stripped. Use it on a URL the user supplied or one returned by POST /search. To ingest a whole site rather than a single page, use POST /deepcrawl. Costs 1 credit per request.
|
|
117
|
+
* @description Fetch one public URL and return its readable title and body as clean text, with navigation, boilerplate, and scripts stripped. Use it on a URL the user supplied or one returned by POST /search. To ingest a whole site rather than a single page, use POST /deepcrawl. Send an array of request objects to crawl several URLs in one call: the response is an array containing only the URLs that succeeded, in no guaranteed order, so match items back to your input by `crawlParameters.url`; failed URLs are omitted and not charged. `enable_fallback` is accepted as a snake_case alias of `enableFallback`. Costs 1 credit per request.
|
|
78
118
|
*/
|
|
79
119
|
post: operations["crawl"];
|
|
80
120
|
delete?: never;
|
|
@@ -94,7 +134,7 @@ export interface paths {
|
|
|
94
134
|
put?: never;
|
|
95
135
|
/**
|
|
96
136
|
* Extract sitemap URLs from a website
|
|
97
|
-
* @description Discover the public URLs of a site when you need to know which pages exist before fetching any of them — scoping a crawl, auditing coverage, or locating a section.
|
|
137
|
+
* @description Discover the public URLs of a site when you need to know which pages exist before fetching any of them — scoping a crawl, auditing coverage, or locating a section. With the default `type: "sitemap"` this reads the site's own sitemap: `Sitemap:` directives in robots.txt first, then the conventional paths, following sitemap index files and gzipped sitemaps, and returns the URLs it declares for the requested host. A site that publishes no sitemap falls back to the links found on the given page. Use `type: "all"` to skip the sitemap and get every link on that one page instead, including links to other hosts. Neither mode fetches page content. Costs 1 credit per request.
|
|
98
138
|
*/
|
|
99
139
|
post: operations["sitemap"];
|
|
100
140
|
delete?: never;
|
|
@@ -227,7 +267,7 @@ export interface paths {
|
|
|
227
267
|
export type webhooks = Record<string, never>;
|
|
228
268
|
export interface components {
|
|
229
269
|
schemas: {
|
|
230
|
-
/** @description Search1API error. Payment challenges may use RFC 9457 problem detail fields. */
|
|
270
|
+
/** @description Search1API error. Every JSON error carries `ok: false`, `error` (a short status-derived label) and `message` (human-readable detail); validation failures add `errors`. Payment challenges may use RFC 9457 problem detail fields. */
|
|
231
271
|
ApiError: {
|
|
232
272
|
/** @enum {boolean} */
|
|
233
273
|
ok?: false;
|
|
@@ -249,9 +289,11 @@ export interface components {
|
|
|
249
289
|
SearchParameters: {
|
|
250
290
|
query: string;
|
|
251
291
|
/** @enum {string} */
|
|
252
|
-
search_service?: "google" | "bing" | "duckduckgo" | "yahoo" | "youtube" | "x" | "reddit" | "github" | "arxiv" | "wechat" | "bilibili" | "imdb" | "wikipedia" | "" | "
|
|
292
|
+
search_service?: "google" | "bing" | "bingcn" | "duckduckgo" | "yahoo" | "yandex" | "youtube" | "x" | "reddit" | "github" | "arxiv" | "wechat" | "bilibili" | "imdb" | "wikipedia" | "grokipedia" | "" | "baidu" | "360" | "quark";
|
|
253
293
|
/** @default 5 */
|
|
254
294
|
max_results: number;
|
|
295
|
+
/** @default 1 */
|
|
296
|
+
page: number;
|
|
255
297
|
/** @default 0 */
|
|
256
298
|
crawl_results: number;
|
|
257
299
|
/** @default false */
|
|
@@ -318,6 +360,35 @@ export interface components {
|
|
|
318
360
|
link: string;
|
|
319
361
|
snippet: string;
|
|
320
362
|
content?: string;
|
|
363
|
+
/**
|
|
364
|
+
* @description When the page was published, as ISO 8601: `YYYY-MM-DD` when only the day is known (web search engines), or `YYYY-MM-DDTHH:MM:SSZ` in UTC when the source carries a time (x, reddit, github, arxiv, youtube, bilibili, wechat, news feeds). Omitted when the source exposes no date, so treat it as optional per result.
|
|
365
|
+
* @example 2026-09-03
|
|
366
|
+
*/
|
|
367
|
+
published_date?: string;
|
|
368
|
+
metadata?: components["schemas"]["SearchResultMetadata"];
|
|
369
|
+
} & {
|
|
370
|
+
[key: string]: unknown;
|
|
371
|
+
};
|
|
372
|
+
/** @description Optional engine-specific fields. Omitted when none apply. GitHub fields appear on POST /search; Hacker News fields appear on POST /news. */
|
|
373
|
+
SearchResultMetadata: {
|
|
374
|
+
/**
|
|
375
|
+
* @description What a `github` result is: a repository, an issue, a pull request, or a discussion. Only present for `search_service: "github"`.
|
|
376
|
+
* @enum {string}
|
|
377
|
+
*/
|
|
378
|
+
kind?: "repo" | "issue" | "pr" | "discussion";
|
|
379
|
+
/** @description Stargazer count of a `github` repository result (`metadata.kind: "repo"`). */
|
|
380
|
+
stars?: number;
|
|
381
|
+
/** @description Primary language of a `github` repository result (`metadata.kind: "repo"`). Omitted when GitHub reports none. */
|
|
382
|
+
language?: string;
|
|
383
|
+
/** @description Comment count on a `github` issue, pull request or discussion, or on a `hackernews` thread (POST /news). */
|
|
384
|
+
num_comments?: number;
|
|
385
|
+
/**
|
|
386
|
+
* Format: uri
|
|
387
|
+
* @description POST /news with `search_service: "hackernews"` only: the submitted article. `link` is the Hacker News discussion thread; `metadata.story_url` is omitted for Ask HN / Show HN text posts.
|
|
388
|
+
*/
|
|
389
|
+
story_url?: string;
|
|
390
|
+
/** @description POST /news with `search_service: "hackernews"` only: upvotes on the thread. */
|
|
391
|
+
points?: number;
|
|
321
392
|
} & {
|
|
322
393
|
[key: string]: unknown;
|
|
323
394
|
};
|
|
@@ -365,6 +436,44 @@ export interface components {
|
|
|
365
436
|
totalCost: number;
|
|
366
437
|
};
|
|
367
438
|
};
|
|
439
|
+
AskResult: {
|
|
440
|
+
title: string;
|
|
441
|
+
/** Format: uri */
|
|
442
|
+
link: string;
|
|
443
|
+
snippet: string;
|
|
444
|
+
/**
|
|
445
|
+
* @description When the page was published, as ISO 8601 (`YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`). Omitted when the engine exposes no date.
|
|
446
|
+
* @example 2026-09-03
|
|
447
|
+
*/
|
|
448
|
+
published_date?: string;
|
|
449
|
+
/** @description Engine that returned the result. */
|
|
450
|
+
source: string;
|
|
451
|
+
/** @description How likely the result is to be about the query, two decimals. Only results scoring at least 0.5 are returned. */
|
|
452
|
+
relevance: number;
|
|
453
|
+
};
|
|
454
|
+
AskResponse: {
|
|
455
|
+
/** @description The query as sent. */
|
|
456
|
+
query: string;
|
|
457
|
+
/** @description How the request was interpreted and searched. */
|
|
458
|
+
intent: {
|
|
459
|
+
/** @description Query sent to the first engine in `sources`. Each engine searches its own span of the request words, without platform names; the time window is applied as a filter. */
|
|
460
|
+
search_query: string;
|
|
461
|
+
/** @description Engines searched. */
|
|
462
|
+
sources: string[];
|
|
463
|
+
/**
|
|
464
|
+
* @description Publication window applied, or null for none. year means the past 365 days, not the current calendar year.
|
|
465
|
+
* @enum {string|null}
|
|
466
|
+
*/
|
|
467
|
+
time_range: "day" | "week" | "month" | "year" | null;
|
|
468
|
+
};
|
|
469
|
+
/** @description Relevant results from every engine, best first, with duplicates merged. May be empty. */
|
|
470
|
+
results: components["schemas"]["AskResult"][];
|
|
471
|
+
/** @description Engines that failed while others completed. The request is still charged. */
|
|
472
|
+
errors: {
|
|
473
|
+
source: string;
|
|
474
|
+
message: string;
|
|
475
|
+
}[];
|
|
476
|
+
};
|
|
368
477
|
CrawlResult: {
|
|
369
478
|
title: string;
|
|
370
479
|
/** Format: uri */
|
|
@@ -436,6 +545,11 @@ export interface components {
|
|
|
436
545
|
credential_type: "api_key" | "oauth";
|
|
437
546
|
client_id?: string | null;
|
|
438
547
|
};
|
|
548
|
+
FeedbackResponse: {
|
|
549
|
+
id: string;
|
|
550
|
+
/** @enum {string} */
|
|
551
|
+
status: "new";
|
|
552
|
+
};
|
|
439
553
|
};
|
|
440
554
|
responses: never;
|
|
441
555
|
parameters: never;
|
|
@@ -445,6 +559,115 @@ export interface components {
|
|
|
445
559
|
}
|
|
446
560
|
export type $defs = Record<string, never>;
|
|
447
561
|
export interface operations {
|
|
562
|
+
feedback: {
|
|
563
|
+
parameters: {
|
|
564
|
+
query?: never;
|
|
565
|
+
header?: never;
|
|
566
|
+
path?: never;
|
|
567
|
+
cookie?: never;
|
|
568
|
+
};
|
|
569
|
+
requestBody: {
|
|
570
|
+
content: {
|
|
571
|
+
"application/json": {
|
|
572
|
+
message: string;
|
|
573
|
+
intent?: string;
|
|
574
|
+
/**
|
|
575
|
+
* @default other
|
|
576
|
+
* @enum {string}
|
|
577
|
+
*/
|
|
578
|
+
category?: "bug" | "feature_request" | "docs" | "other";
|
|
579
|
+
request_id?: string;
|
|
580
|
+
agent?: {
|
|
581
|
+
name?: string;
|
|
582
|
+
model?: string;
|
|
583
|
+
};
|
|
584
|
+
};
|
|
585
|
+
};
|
|
586
|
+
};
|
|
587
|
+
responses: {
|
|
588
|
+
/** @description Successful response */
|
|
589
|
+
201: {
|
|
590
|
+
headers: {
|
|
591
|
+
[name: string]: unknown;
|
|
592
|
+
};
|
|
593
|
+
content: {
|
|
594
|
+
"application/json": components["schemas"]["FeedbackResponse"];
|
|
595
|
+
};
|
|
596
|
+
};
|
|
597
|
+
/** @description Bad Request */
|
|
598
|
+
400: {
|
|
599
|
+
headers: {
|
|
600
|
+
[name: string]: unknown;
|
|
601
|
+
};
|
|
602
|
+
content: {
|
|
603
|
+
"application/json": components["schemas"]["ApiError"];
|
|
604
|
+
};
|
|
605
|
+
};
|
|
606
|
+
/** @description Unauthorized */
|
|
607
|
+
401: {
|
|
608
|
+
headers: {
|
|
609
|
+
[name: string]: unknown;
|
|
610
|
+
};
|
|
611
|
+
content: {
|
|
612
|
+
"application/json": components["schemas"]["ApiError"];
|
|
613
|
+
};
|
|
614
|
+
};
|
|
615
|
+
/** @description Forbidden */
|
|
616
|
+
403: {
|
|
617
|
+
headers: {
|
|
618
|
+
[name: string]: unknown;
|
|
619
|
+
};
|
|
620
|
+
content: {
|
|
621
|
+
"application/json": components["schemas"]["ApiError"];
|
|
622
|
+
};
|
|
623
|
+
};
|
|
624
|
+
/** @description Payload Too Large */
|
|
625
|
+
413: {
|
|
626
|
+
headers: {
|
|
627
|
+
[name: string]: unknown;
|
|
628
|
+
};
|
|
629
|
+
content: {
|
|
630
|
+
"application/json": components["schemas"]["ApiError"];
|
|
631
|
+
};
|
|
632
|
+
};
|
|
633
|
+
/** @description Unsupported Media Type */
|
|
634
|
+
415: {
|
|
635
|
+
headers: {
|
|
636
|
+
[name: string]: unknown;
|
|
637
|
+
};
|
|
638
|
+
content: {
|
|
639
|
+
"application/json": components["schemas"]["ApiError"];
|
|
640
|
+
};
|
|
641
|
+
};
|
|
642
|
+
/** @description Too Many Requests */
|
|
643
|
+
429: {
|
|
644
|
+
headers: {
|
|
645
|
+
[name: string]: unknown;
|
|
646
|
+
};
|
|
647
|
+
content: {
|
|
648
|
+
"application/json": components["schemas"]["ApiError"];
|
|
649
|
+
};
|
|
650
|
+
};
|
|
651
|
+
/** @description Internal Server Error */
|
|
652
|
+
500: {
|
|
653
|
+
headers: {
|
|
654
|
+
[name: string]: unknown;
|
|
655
|
+
};
|
|
656
|
+
content: {
|
|
657
|
+
"application/json": components["schemas"]["ApiError"];
|
|
658
|
+
};
|
|
659
|
+
};
|
|
660
|
+
/** @description Service Unavailable */
|
|
661
|
+
503: {
|
|
662
|
+
headers: {
|
|
663
|
+
[name: string]: unknown;
|
|
664
|
+
};
|
|
665
|
+
content: {
|
|
666
|
+
"application/json": components["schemas"]["ApiError"];
|
|
667
|
+
};
|
|
668
|
+
};
|
|
669
|
+
};
|
|
670
|
+
};
|
|
448
671
|
screenshot: {
|
|
449
672
|
parameters: {
|
|
450
673
|
query?: never;
|
|
@@ -622,9 +845,11 @@ export interface operations {
|
|
|
622
845
|
"application/json": {
|
|
623
846
|
query: string;
|
|
624
847
|
/** @enum {string} */
|
|
625
|
-
search_service?: "google" | "bing" | "duckduckgo" | "yahoo" | "youtube" | "x" | "reddit" | "github" | "arxiv" | "wechat" | "bilibili" | "imdb" | "wikipedia" | "" | "
|
|
848
|
+
search_service?: "google" | "bing" | "bingcn" | "duckduckgo" | "yahoo" | "yandex" | "youtube" | "x" | "reddit" | "github" | "arxiv" | "wechat" | "bilibili" | "imdb" | "wikipedia" | "grokipedia" | "" | "baidu" | "360" | "quark";
|
|
626
849
|
/** @default 5 */
|
|
627
850
|
max_results?: number;
|
|
851
|
+
/** @default 1 */
|
|
852
|
+
page?: number;
|
|
628
853
|
/** @default 0 */
|
|
629
854
|
crawl_results?: number;
|
|
630
855
|
/** @default false */
|
|
@@ -639,9 +864,11 @@ export interface operations {
|
|
|
639
864
|
} | {
|
|
640
865
|
query: string;
|
|
641
866
|
/** @enum {string} */
|
|
642
|
-
search_service?: "google" | "bing" | "duckduckgo" | "yahoo" | "youtube" | "x" | "reddit" | "github" | "arxiv" | "wechat" | "bilibili" | "imdb" | "wikipedia" | "" | "
|
|
867
|
+
search_service?: "google" | "bing" | "bingcn" | "duckduckgo" | "yahoo" | "yandex" | "youtube" | "x" | "reddit" | "github" | "arxiv" | "wechat" | "bilibili" | "imdb" | "wikipedia" | "grokipedia" | "" | "baidu" | "360" | "quark";
|
|
643
868
|
/** @default 5 */
|
|
644
869
|
max_results?: number;
|
|
870
|
+
/** @default 1 */
|
|
871
|
+
page?: number;
|
|
645
872
|
/** @default 0 */
|
|
646
873
|
crawl_results?: number;
|
|
647
874
|
/** @default false */
|
|
@@ -852,6 +1079,87 @@ export interface operations {
|
|
|
852
1079
|
};
|
|
853
1080
|
};
|
|
854
1081
|
};
|
|
1082
|
+
ask: {
|
|
1083
|
+
parameters: {
|
|
1084
|
+
query?: never;
|
|
1085
|
+
header?: never;
|
|
1086
|
+
path?: never;
|
|
1087
|
+
cookie?: never;
|
|
1088
|
+
};
|
|
1089
|
+
requestBody: {
|
|
1090
|
+
content: {
|
|
1091
|
+
"application/json": {
|
|
1092
|
+
/** @description What you are looking for, in natural language. Platform hints ("on Reddit", "papers") and time hints ("this week") steer engine and time-range selection. */
|
|
1093
|
+
query: string;
|
|
1094
|
+
};
|
|
1095
|
+
};
|
|
1096
|
+
};
|
|
1097
|
+
responses: {
|
|
1098
|
+
/** @description Successful response */
|
|
1099
|
+
200: {
|
|
1100
|
+
headers: {
|
|
1101
|
+
[name: string]: unknown;
|
|
1102
|
+
};
|
|
1103
|
+
content: {
|
|
1104
|
+
"application/json": components["schemas"]["AskResponse"];
|
|
1105
|
+
};
|
|
1106
|
+
};
|
|
1107
|
+
/** @description Bad Request */
|
|
1108
|
+
400: {
|
|
1109
|
+
headers: {
|
|
1110
|
+
[name: string]: unknown;
|
|
1111
|
+
};
|
|
1112
|
+
content: {
|
|
1113
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1114
|
+
};
|
|
1115
|
+
};
|
|
1116
|
+
/** @description Unauthorized */
|
|
1117
|
+
401: {
|
|
1118
|
+
headers: {
|
|
1119
|
+
[name: string]: unknown;
|
|
1120
|
+
};
|
|
1121
|
+
content: {
|
|
1122
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1123
|
+
};
|
|
1124
|
+
};
|
|
1125
|
+
/** @description Payment Required */
|
|
1126
|
+
402: {
|
|
1127
|
+
headers: {
|
|
1128
|
+
[name: string]: unknown;
|
|
1129
|
+
};
|
|
1130
|
+
content: {
|
|
1131
|
+
"application/problem+json": components["schemas"]["ApiError"];
|
|
1132
|
+
};
|
|
1133
|
+
};
|
|
1134
|
+
/** @description Too Many Requests */
|
|
1135
|
+
429: {
|
|
1136
|
+
headers: {
|
|
1137
|
+
[name: string]: unknown;
|
|
1138
|
+
};
|
|
1139
|
+
content: {
|
|
1140
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1141
|
+
};
|
|
1142
|
+
};
|
|
1143
|
+
/** @description Internal Server Error */
|
|
1144
|
+
500: {
|
|
1145
|
+
headers: {
|
|
1146
|
+
[name: string]: unknown;
|
|
1147
|
+
};
|
|
1148
|
+
content: {
|
|
1149
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1150
|
+
};
|
|
1151
|
+
};
|
|
1152
|
+
/** @description Bad Gateway */
|
|
1153
|
+
502: {
|
|
1154
|
+
headers: {
|
|
1155
|
+
[name: string]: unknown;
|
|
1156
|
+
};
|
|
1157
|
+
content: {
|
|
1158
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1159
|
+
};
|
|
1160
|
+
};
|
|
1161
|
+
};
|
|
1162
|
+
};
|
|
855
1163
|
crawl: {
|
|
856
1164
|
parameters: {
|
|
857
1165
|
query?: never;
|
|
@@ -911,6 +1219,24 @@ export interface operations {
|
|
|
911
1219
|
"application/problem+json": components["schemas"]["ApiError"];
|
|
912
1220
|
};
|
|
913
1221
|
};
|
|
1222
|
+
/** @description Not Found */
|
|
1223
|
+
404: {
|
|
1224
|
+
headers: {
|
|
1225
|
+
[name: string]: unknown;
|
|
1226
|
+
};
|
|
1227
|
+
content: {
|
|
1228
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1229
|
+
};
|
|
1230
|
+
};
|
|
1231
|
+
/** @description Gone */
|
|
1232
|
+
410: {
|
|
1233
|
+
headers: {
|
|
1234
|
+
[name: string]: unknown;
|
|
1235
|
+
};
|
|
1236
|
+
content: {
|
|
1237
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1238
|
+
};
|
|
1239
|
+
};
|
|
914
1240
|
/** @description Validation Error */
|
|
915
1241
|
422: {
|
|
916
1242
|
headers: {
|