Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ and this project adheres to

### Removed

- Remove all types for engine parameters and responses. SerpApi's
[documentation](https://serpapi.com/search-api) should be the only source of
truth for valid engines and their parameters.

## [1.1.1] - 2023-02-15

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import { getJson } from "https://deno.land/x/serpapi/mod.ts";

## Features

- TypeScript types such as supported parameters and function argument types.
- TypeScript support.
- Works out-of-the-box with [Node.js](https://www.npmjs.com/package/serpapi) and
[Deno](https://deno.land/x/serpapi).
- Promises and async/await support.
Expand Down
6 changes: 4 additions & 2 deletions docs/migrating_from_google_search_results_nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ migrate over to the `serpapi` npm package.

## Added

- TypeScript types for supported parameters.
- TypeScript support.
- First-class Promises support.
```js
const json = await getJson({ engine: "google", q: "coffee" });
Expand All @@ -77,8 +77,10 @@ migrate over to the `serpapi` npm package.
config.api_key = "new_api_key";
config.timeout = 20000; // 20 seconds
```
- Error classes (`MissingApiKeyError` and `InvalidTimeoutError`).
- Error classes (`MissingApiKeyError`, `InvalidTimeoutError` and
`InvalidArgumentError`).
```js
getJson({ engine: "google", api_key: "" }); // Throws `MissingApiKeyError`
getAccount({ api_key: API_KEY, timeout: 0 }); // Throws `InvalidTimeoutError`
getJson("google"); // Throws `InvalidArgumentError`
```
4 changes: 2 additions & 2 deletions examples/deno/basic_ts/example.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { loadSync } from "https://deno.land/std@0.173.0/dotenv/mod.ts";
import { config, EngineParameters, getJson } from "../../../mod.ts";
import { config, getJson } from "../../../mod.ts";

const { API_KEY: apiKey } = loadSync();
const params = {
engine: "google",
q: "Coffee",
api_key: apiKey,
} satisfies EngineParameters<"google">;
};

// Show result as JSON (async/await)
const response1 = await getJson(params);
Expand Down
4 changes: 2 additions & 2 deletions examples/deno/pagination_ts/example.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { loadSync } from "https://deno.land/std@0.173.0/dotenv/mod.ts";
import { config, EngineParameters, getJson } from "../../../mod.ts";
import { config, getJson } from "../../../mod.ts";

const { API_KEY: apiKey } = loadSync();

Expand All @@ -10,7 +10,7 @@ const params = {
engine: "google",
q: "Coffee",
api_key: apiKey,
} satisfies EngineParameters<"google">;
};

// Pagination (async/await)
let page1 = await getJson(params);
Expand Down
4 changes: 2 additions & 2 deletions examples/node/basic_ts_node_14_up/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import * as Dotenv from "dotenv";
import { config, EngineParameters, getJson } from "serpapi";
import { config, getJson } from "serpapi";

Dotenv.config();
const apiKey = process.env.API_KEY;
Expand All @@ -16,7 +16,7 @@ const params = {
engine: "google",
q: "Coffee",
api_key: apiKey,
} satisfies EngineParameters<"google">;
};

// Show result as JSON (async/await)
const response1 = await getJson(params);
Expand Down
4 changes: 2 additions & 2 deletions examples/node/pagination_ts_node_14_up/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

import * as Dotenv from "dotenv";
import { config, EngineParameters, getJson } from "serpapi";
import { config, getJson } from "serpapi";

Dotenv.config();
const apiKey = process.env.API_KEY;
Expand All @@ -21,7 +21,7 @@ const params = {
engine: "google",
q: "Coffee",
api_key: apiKey,
} satisfies EngineParameters<"google">;
};

// Pagination (async/await)
let page1 = await getJson(params);
Expand Down
60 changes: 0 additions & 60 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ export {

export type {
AccountApiParameters,
AccountInformation,
BaseParameters,
BaseResponse,
EngineParameters,
GetBySearchIdParameters,
Location,
Locations,
LocationsApiParameters,
} from "./src/types.ts";
export {
Expand All @@ -26,59 +22,3 @@ export {
getJsonBySearchId,
getLocations,
} from "./src/serpapi.ts";

export type { GoogleParameters } from "./src/engines/google.ts";
export type { GoogleShoppingParameters } from "./src/engines/google_shopping.ts";
export type { GoogleJobsParameters } from "./src/engines/google_jobs.ts";
export type { GoogleJobsListingParameters } from "./src/engines/google_jobs_listing.ts";
export type { GoogleReverseImageParameters } from "./src/engines/google_reverse_image.ts";
export type { GoogleScholarProfilesParameters } from "./src/engines/google_scholar_profiles.ts";
export type { GoogleScholarParameters } from "./src/engines/google_scholar.ts";
export type { GoogleScholarCiteParameters } from "./src/engines/google_scholar_cite.ts";
export type { GoogleScholarAuthorParameters } from "./src/engines/google_scholar_author.ts";
export type { GoogleProductParameters } from "./src/engines/google_product.ts";
export type { GoogleMapsParameters } from "./src/engines/google_maps.ts";
export type { GoogleMapsPhotosParameters } from "./src/engines/google_maps_photos.ts";
export type { GoogleMapsPhotoMetaParameters } from "./src/engines/google_maps_photo_meta.ts";
export type { GoogleMapsReviewsParameters } from "./src/engines/google_maps_reviews.ts";
export type { GoogleEventsParameters } from "./src/engines/google_events.ts";
export type { GoogleAutocompleteParameters } from "./src/engines/google_autocomplete.ts";
export type { GoogleRelatedQuestionsParameters } from "./src/engines/google_related_questions.ts";
export type { GoogleTrendsParameters } from "./src/engines/google_trends.ts";
export type { GoogleTrendsAutocompleteParameters } from "./src/engines/google_trends_autocomplete.ts";
export type { GoogleFinanceParameters } from "./src/engines/google_finance.ts";
export type { GoogleFinanceMarketsParameters } from "./src/engines/google_finance_markets.ts";
export type { GoogleImmersiveProductParameters } from "./src/engines/google_immersive_product.ts";
export type { BingParameters } from "./src/engines/bing.ts";
export type { BingNewsParameters } from "./src/engines/bing_news.ts";
export type { BingImagesParameters } from "./src/engines/bing_images.ts";
export type { BaiduParameters } from "./src/engines/baidu.ts";
export type { BaiduNewsParameters } from "./src/engines/baidu_news.ts";
export type { YahooParameters } from "./src/engines/yahoo.ts";
export type { YahooImagesParameters } from "./src/engines/yahoo_images.ts";
export type { YahooVideosParameters } from "./src/engines/yahoo_videos.ts";
export type { YahooShoppingParameters } from "./src/engines/yahoo_shopping.ts";
export type { EbayParameters } from "./src/engines/ebay.ts";
export type { YandexParameters } from "./src/engines/yandex.ts";
export type { YandexImagesParameters } from "./src/engines/yandex_images.ts";
export type { YandexVideosParameters } from "./src/engines/yandex_videos.ts";
export type { YoutubeParameters } from "./src/engines/youtube.ts";
export type { WalmartParameters } from "./src/engines/walmart.ts";
export type { WalmartProductParameters } from "./src/engines/walmart_product.ts";
export type { WalmartProductReviewsParameters } from "./src/engines/walmart_product_reviews.ts";
export type { HomeDepotParameters } from "./src/engines/home_depot.ts";
export type { HomeDepotProductParameters } from "./src/engines/home_depot_product.ts";
export type { LinkedinParameters } from "./src/engines/linkedin.ts";
export type { LinkedinProfileParameters } from "./src/engines/linkedin_profile.ts";
export type { DuckduckgoParameters } from "./src/engines/duckduckgo.ts";
export type { GooglePlayProductParameters } from "./src/engines/google_play_product.ts";
export type { GooglePlayParameters } from "./src/engines/google_play.ts";
export type { AppleAppStoreParameters } from "./src/engines/apple_app_store.ts";
export type { AppleReviewsParameters } from "./src/engines/apple_reviews.ts";
export type { AppleProductParameters } from "./src/engines/apple_product.ts";
export type { NaverParameters } from "./src/engines/naver.ts";
export type { GoogleLensParameters } from "./src/engines/google_lens.ts";
export type { GoogleLocalServicesParameters } from "./src/engines/google_local_services.ts";
export type { GoogleAboutThisResultParameters } from "./src/engines/google_about_this_result.ts";
export type { YelpParameters } from "./src/engines/yelp.ts";
export type { YelpReviewsParameters } from "./src/engines/yelp_reviews.ts";
61 changes: 0 additions & 61 deletions src/engines/apple_app_store.ts

This file was deleted.

26 changes: 0 additions & 26 deletions src/engines/apple_product.ts

This file was deleted.

43 changes: 0 additions & 43 deletions src/engines/apple_reviews.ts

This file was deleted.

77 changes: 0 additions & 77 deletions src/engines/baidu.ts

This file was deleted.

Loading