@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 CHANGED
@@ -897,9 +897,22 @@ var AnyAPI = class {
897
897
  );
898
898
  return mapCatalogList(raw);
899
899
  }
900
- /** Ranked catalog search. GET /catalog/search. Browse never accepts a query. */
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
- const search = new URLSearchParams({ q: options.query });
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));