@blinkdotnew/sdk 0.4.2 → 0.5.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
@@ -569,10 +569,10 @@ var HttpClient = class {
569
569
  });
570
570
  }
571
571
  async dataFetch(projectId, request) {
572
- return this.request(`/api/data/${projectId}/fetch`, {
573
- method: "POST",
574
- body: JSON.stringify(request)
575
- });
572
+ return this.post(`/api/data/${projectId}/fetch`, request);
573
+ }
574
+ async dataSearch(projectId, request) {
575
+ return this.post(`/api/data/${projectId}/search`, request);
576
576
  }
577
577
  /**
578
578
  * Private helper methods
@@ -2417,6 +2417,17 @@ var BlinkDataImpl = class {
2417
2417
  }
2418
2418
  throw new BlinkDataError("Unexpected response format from async fetch endpoint");
2419
2419
  }
2420
+ async search(query, options) {
2421
+ const request = {
2422
+ q: query,
2423
+ location: options?.location,
2424
+ hl: options?.language || "en",
2425
+ tbm: options?.type === "news" ? "nws" : options?.type === "images" ? "isch" : options?.type === "videos" ? "vid" : options?.type === "shopping" ? "shop" : void 0,
2426
+ num: options?.limit
2427
+ };
2428
+ const response = await this.httpClient.dataSearch(this.projectId, request);
2429
+ return response.data;
2430
+ }
2420
2431
  };
2421
2432
 
2422
2433
  // src/client.ts