Skip to content

Commit dcbe5c2

Browse files
committed
[Types] Update types
1 parent aee53f9 commit dcbe5c2

8 files changed

Lines changed: 83 additions & 3 deletions

File tree

mod.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ export type { GoogleScholarAuthorParameters } from "./src/engines/google_scholar
3333
export type { GoogleProductParameters } from "./src/engines/google_product.ts";
3434
export type { GoogleMapsParameters } from "./src/engines/google_maps.ts";
3535
export type { GoogleMapsPhotosParameters } from "./src/engines/google_maps_photos.ts";
36+
export type { GoogleMapsPhotoMetaParameters } from "./src/engines/google_maps_photo_meta.ts";
3637
export type { GoogleMapsReviewsParameters } from "./src/engines/google_maps_reviews.ts";
3738
export type { GoogleEventsParameters } from "./src/engines/google_events.ts";
3839
export type { GoogleAutocompleteParameters } from "./src/engines/google_autocomplete.ts";
3940
export type { GoogleRelatedQuestionsParameters } from "./src/engines/google_related_questions.ts";
4041
export type { GoogleTrendsParameters } from "./src/engines/google_trends.ts";
4142
export type { GoogleTrendsAutocompleteParameters } from "./src/engines/google_trends_autocomplete.ts";
43+
export type { GoogleFinanceParameters } from "./src/engines/google_finance.ts";
4244
export type { GoogleFinanceMarketsParameters } from "./src/engines/google_finance_markets.ts";
4345
export type { GoogleImmersiveProductParameters } from "./src/engines/google_immersive_product.ts";
4446
export type { BingParameters } from "./src/engines/bing.ts";

src/engines/apple_reviews.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export type AppleReviewsParameters = BaseParameters & {
3535
* Parameter is used for sorting reviews.
3636
* It can be set to:
3737
* `mostrecent`: Most recent (default),
38-
* `mosthelpful`: Most helpful
38+
* `mosthelpful`: Most helpful,
39+
* `mostfavorable`: Most favorable,
40+
* `mostcritical`: Most critical
3941
*/
4042
sort?: string;
4143
};

src/engines/engine_map.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ import type { GoogleScholarAuthorParameters } from "./google_scholar_author.ts";
99
import type { GoogleProductParameters } from "./google_product.ts";
1010
import type { GoogleMapsParameters } from "./google_maps.ts";
1111
import type { GoogleMapsPhotosParameters } from "./google_maps_photos.ts";
12+
import type { GoogleMapsPhotoMetaParameters } from "./google_maps_photo_meta.ts";
1213
import type { GoogleMapsReviewsParameters } from "./google_maps_reviews.ts";
1314
import type { GoogleEventsParameters } from "./google_events.ts";
1415
import type { GoogleAutocompleteParameters } from "./google_autocomplete.ts";
1516
import type { GoogleRelatedQuestionsParameters } from "./google_related_questions.ts";
1617
import type { GoogleTrendsParameters } from "./google_trends.ts";
1718
import type { GoogleTrendsAutocompleteParameters } from "./google_trends_autocomplete.ts";
19+
import type { GoogleFinanceParameters } from "./google_finance.ts";
1820
import type { GoogleFinanceMarketsParameters } from "./google_finance_markets.ts";
1921
import type { GoogleImmersiveProductParameters } from "./google_immersive_product.ts";
2022
import type { BingParameters } from "./bing.ts";
@@ -63,6 +65,7 @@ export type EngineMap = {
6365
google_product: { parameters: GoogleProductParameters };
6466
google_maps: { parameters: GoogleMapsParameters };
6567
google_maps_photos: { parameters: GoogleMapsPhotosParameters };
68+
google_maps_photo_meta: { parameters: GoogleMapsPhotoMetaParameters };
6669
google_maps_reviews: { parameters: GoogleMapsReviewsParameters };
6770
google_events: { parameters: GoogleEventsParameters };
6871
google_autocomplete: { parameters: GoogleAutocompleteParameters };
@@ -71,6 +74,7 @@ export type EngineMap = {
7174
google_trends_autocomplete: {
7275
parameters: GoogleTrendsAutocompleteParameters;
7376
};
77+
google_finance: { parameters: GoogleFinanceParameters };
7478
google_finance_markets: { parameters: GoogleFinanceMarketsParameters };
7579
google_immersive_product: { parameters: GoogleImmersiveProductParameters };
7680
bing: { parameters: BingParameters };

src/engines/google.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,26 @@ export type GoogleParameters = BaseParameters & {
4747
*/
4848
lsig?: string;
4949

50+
/**
51+
* Google Knowledge Graph ID
52+
* Parameter defines the id (`KGMID`) of the Google Knowledge Graph listing you
53+
* want to scrape. Also known as Google Knowledge Graph ID. Searches with kgmid
54+
* parameter will return results for the originally encrypted search parameters.
55+
* For some searches, kgmid may override all other parameters except start, and num
56+
* parameters.
57+
*/
58+
kgmid?: string;
59+
60+
/**
61+
* Google Cached Search Parameters ID
62+
* Parameter defines the cached search parameters of the Google Search you want to
63+
* scrape. Searches with si parameter will return results for the originally
64+
* encrypted search parameters. For some searches, si may override all other
65+
* parameters except start, and num parameters. si can be used to scrape Google
66+
* Knowledge Graph Tabs.
67+
*/
68+
si?: string;
69+
5070
/**
5171
* Domain
5272
* Parameter defines the Google domain to use. It defaults to `google.com`. Head to
@@ -230,6 +250,8 @@ export type GoogleParameters = BaseParameters & {
230250
* Parameter defines the result offset. It skips the given number of results. It's
231251
* used for pagination. (e.g., `0` (default) is the first page of results, `10` is
232252
* the 2nd page of results, `20` is the 3rd page of results, etc.).
253+
* Google Local Results only accepts multiples of `20`(e.g. `20` for the second
254+
* page results, `40` for the third page results, etc.) as the start value.
233255
*/
234256
start?: number;
235257

src/engines/google_finance.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { BaseParameters } from "../types.ts";
2+
3+
export type GoogleFinanceParameters = BaseParameters & {
4+
/**
5+
* Search Query
6+
* Parameter defines the query you want to search. It can be a stock, index, mutual
7+
* fund, currency or futures.
8+
*/
9+
q: string;
10+
11+
/**
12+
* Language
13+
* Parameter defines the language to use for the Google Finance search. It's a
14+
* two-letter language code. (e.g., `en` for English, `es` for Spanish, or `fr` for
15+
* French). Head to the [Google languages
16+
* page](https://serpapi.com/google-languages) for a full list of supported Google
17+
* languages.
18+
*/
19+
hl?: string;
20+
};

src/engines/google_maps.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,24 @@ export type GoogleMapsParameters = BaseParameters & {
5454
*/
5555
data?: string;
5656

57+
/**
58+
* Place ID
59+
* Parameter defines the unique reference to a place on a Google Map. Place IDs are
60+
* available for most locations, including businesses, landmarks, parks, and
61+
* intersections. You can find the place_id using our [Google Maps
62+
* API](https://serpapi.com/maps-local-results).
63+
* You can read more about Place IDs
64+
* [here](https://developers.google.com/maps/documentation/places/web-service/place-id).
65+
* place_id can be used without any other optional parameter.
66+
*/
67+
place_id?: string;
68+
5769
/**
5870
* Type of search
5971
* Parameter defines the type of search you want to make. It can be set to:
6072
* `search` - returns a list of results for the set q parameter,
6173
* `place` - returns results for a specific place when data parameter is set
74+
* Parameter is not required when using place_id.
6275
*/
6376
type: string;
6477

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { BaseParameters } from "../types.ts";
2+
3+
export type GoogleMapsPhotoMetaParameters = BaseParameters & {
4+
/**
5+
* Data ID
6+
* Parameter defines the Google Maps Photos' data ID. Find the data ID of a photo
7+
* using our [Google Maps Photos API](https://serpapi.com/google-maps-photos-api).
8+
*/
9+
data_id: string;
10+
};

src/engines/google_trends.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,15 @@ export type GoogleTrendsParameters = BaseParameters & {
6565
/**
6666
* Time Zone
6767
* Parameter is used to define a time zone. The default value is set to `420`
68-
* (Pacific time zone: -07:00). Value is shown in minutes and can span from `-1439`
69-
* to `1439`. tz parameter affects timestamps in response.
68+
* (Pacific Day Time(PDT): -07:00). Value is shown in minutes and can span from
69+
* `-1439` to `1439`.
70+
* tz can be calculated using the time difference between UTC +0 and desired
71+
* timezone.
72+
* Example: `60 x ((Time in UTC+0 Now) - (Time in PDT Now)) = 420` will give
73+
* results for PDT now. Because the reference point is UTC+0, the positive time
74+
* zones will result in negative tz whereas negative time zones will result in
75+
* positive tz.
76+
* tz parameter also affects timestamps in response.
7077
*/
7178
tz?: string;
7279

0 commit comments

Comments
 (0)