|
1 | | -export type BaseParameters = { |
2 | | - /** |
3 | | - * Parameter defines the device to use to get the results. It can be set to |
4 | | - * `desktop` (default) to use a regular browser, `tablet` to use a tablet browser |
5 | | - * (currently using iPads), or `mobile` to use a mobile browser (currently |
6 | | - * using iPhones). |
7 | | - */ |
8 | | - device?: "desktop" | "tablet" | "mobile"; |
9 | | - |
10 | | - /** |
11 | | - * Parameter will force SerpApi to fetch the Google results even if a cached |
12 | | - * version is already present. A cache is served only if the query and all |
13 | | - * parameters are exactly the same. Cache expires after 1h. Cached searches |
14 | | - * are free, and are not counted towards your searches per month. It can be set |
15 | | - * to `false` (default) to allow results from the cache, or `true` to disallow |
16 | | - * results from the cache. `no_cache` and `async` parameters should not be used together. |
17 | | - */ |
18 | | - no_cache?: boolean; |
19 | | - |
20 | | - /** |
21 | | - * Parameter defines the way you want to submit your search to SerpApi. It can |
22 | | - * be set to `false` (default) to open an HTTP connection and keep it open until |
23 | | - * you got your search results, or `true` to just submit your search to SerpApi |
24 | | - * and retrieve them later. In this case, you'll need to use our |
25 | | - * [Searches Archive API](https://serpapi.com/search-archive-api) to retrieve |
26 | | - * your results. `async` and `no_cache` parameters should not be used together. |
27 | | - * `async` should not be used on accounts with |
28 | | - * [Ludicrous Speed](https://serpapi.com/plan) enabled. |
29 | | - */ |
30 | | - async?: boolean; |
31 | | - |
32 | | - /** |
33 | | - * Parameter defines the SerpApi private key to use. |
34 | | - */ |
35 | | - api_key?: string | null; |
36 | | - |
37 | | - /** |
38 | | - * Specify the client-side timeout of the request. In milliseconds. |
39 | | - */ |
40 | | - timeout?: number; |
41 | | -}; |
42 | | - |
43 | | -export type EngineParameters< |
44 | | - EngineRequired = true, |
45 | | -> = |
46 | | - & (EngineRequired extends true ? { engine: string } |
47 | | - : { engine?: string }) |
48 | | - & BaseParameters |
49 | | - & Record<string, unknown>; |
| 1 | +// deno-lint-ignore no-explicit-any |
| 2 | +export type EngineParameters = Record<string, any>; |
50 | 3 |
|
51 | 4 | export type BaseResponse = { |
52 | | - search_metadata: { |
53 | | - id: string; |
54 | | - status: "Queued" | "Processing" | "Success"; |
55 | | - json_endpoint: string; |
56 | | - created_at: string; |
57 | | - processed_at: string; |
58 | | - raw_html_file: string; |
59 | | - total_time_taken: number; |
60 | | - }; |
61 | | - search_parameters: Omit< |
62 | | - EngineParameters, |
63 | | - "api_key" | "no_cache" | "async" | "timeout" |
64 | | - >; |
65 | | - serpapi_pagination?: { next: string }; |
66 | | - pagination?: { next: string }; |
67 | 5 | next?: ( |
68 | 6 | callback?: (json: BaseResponse) => void, |
69 | 7 | ) => Promise<BaseResponse>; |
70 | 8 | // deno-lint-ignore no-explicit-any |
71 | | - [key: string]: any; // TODO(seb): use recursive type |
72 | | -}; |
| 9 | +} & Record<string, any>; |
73 | 10 |
|
74 | 11 | export type GetBySearchIdParameters = { |
75 | 12 | api_key?: string; |
|
0 commit comments