@getanyapi/sdk 0.35.3 → 0.36.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/dist/index.cjs +15 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -897,9 +897,22 @@ var AnyAPI = class {
|
|
|
897
897
|
);
|
|
898
898
|
return mapCatalogList(raw);
|
|
899
899
|
}
|
|
900
|
-
/**
|
|
900
|
+
/**
|
|
901
|
+
* Ranked catalog search. GET /catalog/search. Browse never accepts a query.
|
|
902
|
+
*
|
|
903
|
+
* The gateway needs at least one of query, category or platform, in any
|
|
904
|
+
* combination, so a scope with no query at all is a valid search. An absent or
|
|
905
|
+
* empty query omits `q` entirely, because an empty `q` is a different request.
|
|
906
|
+
*/
|
|
901
907
|
async search(options) {
|
|
902
|
-
|
|
908
|
+
if (!options.query && !options.category && !options.platform) {
|
|
909
|
+
throw new AnyAPIError(
|
|
910
|
+
"search needs at least one of query, category, or platform",
|
|
911
|
+
0
|
|
912
|
+
);
|
|
913
|
+
}
|
|
914
|
+
const search = new URLSearchParams();
|
|
915
|
+
if (options.query) search.set("q", options.query);
|
|
903
916
|
if (options.category) search.set("category", options.category);
|
|
904
917
|
if (options.platform) search.set("platform", options.platform);
|
|
905
918
|
if (options.limit !== void 0) search.set("limit", String(options.limit));
|