scrapebadger 0.66.0 → 0.68.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.mjs CHANGED
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events';
3
3
  import WebSocket from 'ws';
4
4
 
5
5
  // src/internal/version.ts
6
- var SDK_VERSION = "0.65.0";
6
+ var SDK_VERSION = "0.67.0";
7
7
 
8
8
  // src/internal/exceptions.ts
9
9
  var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
@@ -5083,6 +5083,31 @@ var RequestsClient = class {
5083
5083
  data
5084
5084
  };
5085
5085
  }
5086
+ /**
5087
+ * Submit up to 100 GET reads as async requests in one call. Submitting is free.
5088
+ *
5089
+ * Each item runs under this key with the same auth, credit check, rate limit
5090
+ * and price as if sent alone; at most 10 of a batch run at a time.
5091
+ *
5092
+ * @example
5093
+ * ```typescript
5094
+ * const sub = await client.requests.batch(
5095
+ * prompts.map((prompt) => ({ path: "/v1/chatgpt/ask", query: { prompt } })),
5096
+ * { callbackUrl: "https://example.com/hook" }
5097
+ * );
5098
+ * const ids = sub.requests.filter((r) => r.accepted).map((r) => r.request_id);
5099
+ * ```
5100
+ *
5101
+ * @param items - `{ path: "/v1/...", query: {...} }` (method defaults to GET).
5102
+ * @param options - `callbackUrl` for one signed webhook per item.
5103
+ * @returns A request_id (or the refusal) for every item.
5104
+ */
5105
+ async batch(items, options = {}) {
5106
+ return this.client.request("/v1/batch", {
5107
+ method: "POST",
5108
+ body: { requests: items, callback_url: options.callbackUrl }
5109
+ });
5110
+ }
5086
5111
  };
5087
5112
 
5088
5113
  // src/airbnb/client.ts
@@ -9735,6 +9760,10 @@ var LoopNetClient = class {
9735
9760
  };
9736
9761
 
9737
9762
  // src/perplexity/client.ts
9763
+ function toQuery(params) {
9764
+ const { strictCountry, ...rest } = params;
9765
+ return strictCountry ? { ...rest, strict_country: true } : rest;
9766
+ }
9738
9767
  var PerplexityClient = class {
9739
9768
  client;
9740
9769
  constructor(client) {
@@ -9742,7 +9771,7 @@ var PerplexityClient = class {
9742
9771
  }
9743
9772
  /** Ask Perplexity a question. Generated from the OpenAPI spec; returns the raw response object. */
9744
9773
  async askPerplexityAQuestion(params = {}) {
9745
- return this.client.request("/v1/perplexity/ask", { params });
9774
+ return this.client.request("/v1/perplexity/ask", { params: toQuery(params) });
9746
9775
  }
9747
9776
  /** Ask Perplexity a question (POST). Generated from the OpenAPI spec; returns the raw response object. */
9748
9777
  async askPerplexityAQuestionPost(body, params = {}) {
@@ -9750,7 +9779,7 @@ var PerplexityClient = class {
9750
9779
  }
9751
9780
  /** Measure a brand's visibility in a Perplexity answer. Generated from the OpenAPI spec; returns the raw response object. */
9752
9781
  async measureABrandSVisibilityInAPerplexityAnswer(params = {}) {
9753
- return this.client.request("/v1/perplexity/brand-visibility", { params });
9782
+ return this.client.request("/v1/perplexity/brand-visibility", { params: toQuery(params) });
9754
9783
  }
9755
9784
  /** Measure a brand's visibility in a Perplexity answer (POST). Generated from the OpenAPI spec; returns the raw response object. */
9756
9785
  async measureABrandSVisibilityInAPerplexityAnswerPost(body, params = {}) {