scrapebadger 0.82.1 → 0.83.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 +26 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -8
- package/dist/index.d.ts +35 -8
- package/dist/index.mjs +26 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9,7 +9,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
9
9
|
var WebSocket__default = /*#__PURE__*/_interopDefault(WebSocket);
|
|
10
10
|
|
|
11
11
|
// src/internal/version.ts
|
|
12
|
-
var SDK_VERSION = "0.
|
|
12
|
+
var SDK_VERSION = "0.83.0";
|
|
13
13
|
|
|
14
14
|
// src/internal/exceptions.ts
|
|
15
15
|
var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
|
|
@@ -10516,6 +10516,10 @@ var DepopClient = class {
|
|
|
10516
10516
|
|
|
10517
10517
|
// src/wallapop/client.ts
|
|
10518
10518
|
var onlyTrue = (value) => value ? true : void 0;
|
|
10519
|
+
var idList = (ids) => {
|
|
10520
|
+
if (ids === void 0 || typeof ids === "string") return ids;
|
|
10521
|
+
return ids.length > 0 ? ids.join(",") : void 0;
|
|
10522
|
+
};
|
|
10519
10523
|
var WallapopClient = class {
|
|
10520
10524
|
client;
|
|
10521
10525
|
constructor(client) {
|
|
@@ -10524,15 +10528,26 @@ var WallapopClient = class {
|
|
|
10524
10528
|
/**
|
|
10525
10529
|
* Search Wallapop listings (40 per page).
|
|
10526
10530
|
*
|
|
10527
|
-
* Needs a query, a `categoryId`, or
|
|
10528
|
-
* which case every other parameter is
|
|
10531
|
+
* Needs a query, a `categoryId`, `subcategoryIds`, or a combination —
|
|
10532
|
+
* unless `nextPage` is given, in which case every other parameter is
|
|
10533
|
+
* ignored (the cursor already carries them).
|
|
10529
10534
|
*
|
|
10530
10535
|
* @param query - Search text, e.g. "iphone 14" (optional with `categoryId` or `nextPage`).
|
|
10531
10536
|
* @param options - Optional parameters (market, location/radius, category,
|
|
10532
|
-
* price, condition, brand/model/colour, cars filters,
|
|
10537
|
+
* subcategories, price, condition, brand/model/colour, cars filters,
|
|
10538
|
+
* sort, cursor).
|
|
10533
10539
|
* @returns Search response with matching listings and the next-page cursor.
|
|
10534
10540
|
* @throws AuthenticationError - If the API key is invalid.
|
|
10535
|
-
* @throws ValidationError - If neither a query nor a category is given.
|
|
10541
|
+
* @throws ValidationError - If neither a query nor a category/subcategory is given.
|
|
10542
|
+
*
|
|
10543
|
+
* @example
|
|
10544
|
+
* ```typescript
|
|
10545
|
+
* // Smartphones (9447) under Technology & electronics (24200)
|
|
10546
|
+
* const phones = await client.wallapop.search("iphone", {
|
|
10547
|
+
* categoryId: 24200,
|
|
10548
|
+
* subcategoryIds: [9447],
|
|
10549
|
+
* });
|
|
10550
|
+
* ```
|
|
10536
10551
|
*/
|
|
10537
10552
|
async search(query, options = {}) {
|
|
10538
10553
|
return this.client.request("/v1/wallapop/search", {
|
|
@@ -10543,6 +10558,7 @@ var WallapopClient = class {
|
|
|
10543
10558
|
longitude: options.longitude,
|
|
10544
10559
|
distance_km: options.distanceKm,
|
|
10545
10560
|
category_id: options.categoryId,
|
|
10561
|
+
subcategory_ids: idList(options.subcategoryIds),
|
|
10546
10562
|
min_price: options.minPrice,
|
|
10547
10563
|
max_price: options.maxPrice,
|
|
10548
10564
|
condition: options.condition,
|
|
@@ -10649,13 +10665,14 @@ var WallapopClient = class {
|
|
|
10649
10665
|
* Get the search filters Wallapop offers for a category and/or query,
|
|
10650
10666
|
* with their option ids.
|
|
10651
10667
|
*
|
|
10652
|
-
* @param options - Optional parameters (categoryId, query, market).
|
|
10668
|
+
* @param options - Optional parameters (categoryId, subcategoryIds, query, market).
|
|
10653
10669
|
* @returns Available filters.
|
|
10654
10670
|
*/
|
|
10655
10671
|
async listFilters(options = {}) {
|
|
10656
10672
|
return this.client.request("/v1/wallapop/filters", {
|
|
10657
10673
|
params: {
|
|
10658
10674
|
category_id: options.categoryId,
|
|
10675
|
+
subcategory_ids: idList(options.subcategoryIds),
|
|
10659
10676
|
query: options.query,
|
|
10660
10677
|
market: options.market
|
|
10661
10678
|
}
|
|
@@ -10666,7 +10683,8 @@ var WallapopClient = class {
|
|
|
10666
10683
|
* separately — filters flagged `options_endpoint` in `listFilters`.
|
|
10667
10684
|
*
|
|
10668
10685
|
* @param filterId - Filter id, e.g. "brand".
|
|
10669
|
-
* @param options - Optional parameters (categoryId, query,
|
|
10686
|
+
* @param options - Optional parameters (categoryId, subcategoryIds, query,
|
|
10687
|
+
* market); e.g. `subcategoryIds: [9447]` returns phone brands only.
|
|
10670
10688
|
* @returns The filter's options.
|
|
10671
10689
|
* @throws ValidationError - If the filter id is invalid.
|
|
10672
10690
|
*/
|
|
@@ -10676,6 +10694,7 @@ var WallapopClient = class {
|
|
|
10676
10694
|
{
|
|
10677
10695
|
params: {
|
|
10678
10696
|
category_id: options.categoryId,
|
|
10697
|
+
subcategory_ids: idList(options.subcategoryIds),
|
|
10679
10698
|
query: options.query,
|
|
10680
10699
|
market: options.market
|
|
10681
10700
|
}
|