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.d.cts CHANGED
@@ -19259,7 +19259,10 @@ interface WallapopAutocompleteResponse {
19259
19259
  }
19260
19260
  /** One category (recursive tree node). */
19261
19261
  interface WallapopCategory {
19262
- /** Category id — usable as the search `categoryId`. */
19262
+ /**
19263
+ * Category id — a top-level id is usable as the search `categoryId`,
19264
+ * a nested one in `subcategoryIds`.
19265
+ */
19263
19266
  id: number;
19264
19267
  /** Localised category name. */
19265
19268
  name: string | null;
@@ -19328,7 +19331,10 @@ interface WallapopMarketsResponse {
19328
19331
  type WallapopOrderBy = "most_relevance" | "newest" | "closest" | "price_low_to_high" | "price_high_to_low";
19329
19332
  /** Listing-age window for /search. */
19330
19333
  type WallapopTimeFilter = "today" | "lastWeek" | "lastMonth";
19331
- /** Options for the /search endpoint. Needs a query, a `categoryId`, or both. */
19334
+ /**
19335
+ * Options for the /search endpoint. Needs a query, a `categoryId`,
19336
+ * `subcategoryIds`, or a combination.
19337
+ */
19332
19338
  interface WallapopSearchParams {
19333
19339
  /** Market code: es, it, pt (default: "es"). */
19334
19340
  market?: string;
@@ -19340,6 +19346,13 @@ interface WallapopSearchParams {
19340
19346
  distanceKm?: number;
19341
19347
  /** Category id (see `listCategories`). */
19342
19348
  categoryId?: number;
19349
+ /**
19350
+ * Subcategory ids from `listCategories` (a category's `subcategories`, at
19351
+ * any depth), e.g. `[9447]` (Smartphones) or `[9447, 10310]`; a listing
19352
+ * matching any of them is returned. Also accepts a comma-separated string.
19353
+ * Works with or without `categoryId`.
19354
+ */
19355
+ subcategoryIds?: ReadonlyArray<number | string> | string;
19343
19356
  /** Minimum price (EUR). */
19344
19357
  minPrice?: number;
19345
19358
  /** Maximum price (EUR). */
@@ -19405,6 +19418,8 @@ interface WallapopMarketParams {
19405
19418
  interface WallapopFiltersParams {
19406
19419
  /** Category the filters apply to. */
19407
19420
  categoryId?: number;
19421
+ /** Subcategory ids the filters apply to (array or comma-separated string). */
19422
+ subcategoryIds?: ReadonlyArray<number | string> | string;
19408
19423
  /** Search text the filters apply to. */
19409
19424
  query?: string;
19410
19425
  /** Market code: es, it, pt (default: "es"). Localises labels. */
@@ -19457,15 +19472,26 @@ declare class WallapopClient {
19457
19472
  /**
19458
19473
  * Search Wallapop listings (40 per page).
19459
19474
  *
19460
- * Needs a query, a `categoryId`, or both — unless `nextPage` is given, in
19461
- * which case every other parameter is ignored.
19475
+ * Needs a query, a `categoryId`, `subcategoryIds`, or a combination —
19476
+ * unless `nextPage` is given, in which case every other parameter is
19477
+ * ignored (the cursor already carries them).
19462
19478
  *
19463
19479
  * @param query - Search text, e.g. "iphone 14" (optional with `categoryId` or `nextPage`).
19464
19480
  * @param options - Optional parameters (market, location/radius, category,
19465
- * price, condition, brand/model/colour, cars filters, sort, cursor).
19481
+ * subcategories, price, condition, brand/model/colour, cars filters,
19482
+ * sort, cursor).
19466
19483
  * @returns Search response with matching listings and the next-page cursor.
19467
19484
  * @throws AuthenticationError - If the API key is invalid.
19468
- * @throws ValidationError - If neither a query nor a category is given.
19485
+ * @throws ValidationError - If neither a query nor a category/subcategory is given.
19486
+ *
19487
+ * @example
19488
+ * ```typescript
19489
+ * // Smartphones (9447) under Technology & electronics (24200)
19490
+ * const phones = await client.wallapop.search("iphone", {
19491
+ * categoryId: 24200,
19492
+ * subcategoryIds: [9447],
19493
+ * });
19494
+ * ```
19469
19495
  */
19470
19496
  search(query?: string, options?: WallapopSearchParams): Promise<WallapopSearchResponse>;
19471
19497
  /**
@@ -19524,7 +19550,7 @@ declare class WallapopClient {
19524
19550
  * Get the search filters Wallapop offers for a category and/or query,
19525
19551
  * with their option ids.
19526
19552
  *
19527
- * @param options - Optional parameters (categoryId, query, market).
19553
+ * @param options - Optional parameters (categoryId, subcategoryIds, query, market).
19528
19554
  * @returns Available filters.
19529
19555
  */
19530
19556
  listFilters(options?: WallapopFiltersParams): Promise<WallapopFiltersResponse>;
@@ -19533,7 +19559,8 @@ declare class WallapopClient {
19533
19559
  * separately — filters flagged `options_endpoint` in `listFilters`.
19534
19560
  *
19535
19561
  * @param filterId - Filter id, e.g. "brand".
19536
- * @param options - Optional parameters (categoryId, query, market).
19562
+ * @param options - Optional parameters (categoryId, subcategoryIds, query,
19563
+ * market); e.g. `subcategoryIds: [9447]` returns phone brands only.
19537
19564
  * @returns The filter's options.
19538
19565
  * @throws ValidationError - If the filter id is invalid.
19539
19566
  */
package/dist/index.d.ts CHANGED
@@ -19259,7 +19259,10 @@ interface WallapopAutocompleteResponse {
19259
19259
  }
19260
19260
  /** One category (recursive tree node). */
19261
19261
  interface WallapopCategory {
19262
- /** Category id — usable as the search `categoryId`. */
19262
+ /**
19263
+ * Category id — a top-level id is usable as the search `categoryId`,
19264
+ * a nested one in `subcategoryIds`.
19265
+ */
19263
19266
  id: number;
19264
19267
  /** Localised category name. */
19265
19268
  name: string | null;
@@ -19328,7 +19331,10 @@ interface WallapopMarketsResponse {
19328
19331
  type WallapopOrderBy = "most_relevance" | "newest" | "closest" | "price_low_to_high" | "price_high_to_low";
19329
19332
  /** Listing-age window for /search. */
19330
19333
  type WallapopTimeFilter = "today" | "lastWeek" | "lastMonth";
19331
- /** Options for the /search endpoint. Needs a query, a `categoryId`, or both. */
19334
+ /**
19335
+ * Options for the /search endpoint. Needs a query, a `categoryId`,
19336
+ * `subcategoryIds`, or a combination.
19337
+ */
19332
19338
  interface WallapopSearchParams {
19333
19339
  /** Market code: es, it, pt (default: "es"). */
19334
19340
  market?: string;
@@ -19340,6 +19346,13 @@ interface WallapopSearchParams {
19340
19346
  distanceKm?: number;
19341
19347
  /** Category id (see `listCategories`). */
19342
19348
  categoryId?: number;
19349
+ /**
19350
+ * Subcategory ids from `listCategories` (a category's `subcategories`, at
19351
+ * any depth), e.g. `[9447]` (Smartphones) or `[9447, 10310]`; a listing
19352
+ * matching any of them is returned. Also accepts a comma-separated string.
19353
+ * Works with or without `categoryId`.
19354
+ */
19355
+ subcategoryIds?: ReadonlyArray<number | string> | string;
19343
19356
  /** Minimum price (EUR). */
19344
19357
  minPrice?: number;
19345
19358
  /** Maximum price (EUR). */
@@ -19405,6 +19418,8 @@ interface WallapopMarketParams {
19405
19418
  interface WallapopFiltersParams {
19406
19419
  /** Category the filters apply to. */
19407
19420
  categoryId?: number;
19421
+ /** Subcategory ids the filters apply to (array or comma-separated string). */
19422
+ subcategoryIds?: ReadonlyArray<number | string> | string;
19408
19423
  /** Search text the filters apply to. */
19409
19424
  query?: string;
19410
19425
  /** Market code: es, it, pt (default: "es"). Localises labels. */
@@ -19457,15 +19472,26 @@ declare class WallapopClient {
19457
19472
  /**
19458
19473
  * Search Wallapop listings (40 per page).
19459
19474
  *
19460
- * Needs a query, a `categoryId`, or both — unless `nextPage` is given, in
19461
- * which case every other parameter is ignored.
19475
+ * Needs a query, a `categoryId`, `subcategoryIds`, or a combination —
19476
+ * unless `nextPage` is given, in which case every other parameter is
19477
+ * ignored (the cursor already carries them).
19462
19478
  *
19463
19479
  * @param query - Search text, e.g. "iphone 14" (optional with `categoryId` or `nextPage`).
19464
19480
  * @param options - Optional parameters (market, location/radius, category,
19465
- * price, condition, brand/model/colour, cars filters, sort, cursor).
19481
+ * subcategories, price, condition, brand/model/colour, cars filters,
19482
+ * sort, cursor).
19466
19483
  * @returns Search response with matching listings and the next-page cursor.
19467
19484
  * @throws AuthenticationError - If the API key is invalid.
19468
- * @throws ValidationError - If neither a query nor a category is given.
19485
+ * @throws ValidationError - If neither a query nor a category/subcategory is given.
19486
+ *
19487
+ * @example
19488
+ * ```typescript
19489
+ * // Smartphones (9447) under Technology & electronics (24200)
19490
+ * const phones = await client.wallapop.search("iphone", {
19491
+ * categoryId: 24200,
19492
+ * subcategoryIds: [9447],
19493
+ * });
19494
+ * ```
19469
19495
  */
19470
19496
  search(query?: string, options?: WallapopSearchParams): Promise<WallapopSearchResponse>;
19471
19497
  /**
@@ -19524,7 +19550,7 @@ declare class WallapopClient {
19524
19550
  * Get the search filters Wallapop offers for a category and/or query,
19525
19551
  * with their option ids.
19526
19552
  *
19527
- * @param options - Optional parameters (categoryId, query, market).
19553
+ * @param options - Optional parameters (categoryId, subcategoryIds, query, market).
19528
19554
  * @returns Available filters.
19529
19555
  */
19530
19556
  listFilters(options?: WallapopFiltersParams): Promise<WallapopFiltersResponse>;
@@ -19533,7 +19559,8 @@ declare class WallapopClient {
19533
19559
  * separately — filters flagged `options_endpoint` in `listFilters`.
19534
19560
  *
19535
19561
  * @param filterId - Filter id, e.g. "brand".
19536
- * @param options - Optional parameters (categoryId, query, market).
19562
+ * @param options - Optional parameters (categoryId, subcategoryIds, query,
19563
+ * market); e.g. `subcategoryIds: [9447]` returns phone brands only.
19537
19564
  * @returns The filter's options.
19538
19565
  * @throws ValidationError - If the filter id is invalid.
19539
19566
  */
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import WebSocket from 'ws';
3
3
  import { createHmac, timingSafeEqual } from 'crypto';
4
4
 
5
5
  // src/internal/version.ts
6
- var SDK_VERSION = "0.82.1";
6
+ var SDK_VERSION = "0.83.0";
7
7
 
8
8
  // src/internal/exceptions.ts
9
9
  var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
@@ -10510,6 +10510,10 @@ var DepopClient = class {
10510
10510
 
10511
10511
  // src/wallapop/client.ts
10512
10512
  var onlyTrue = (value) => value ? true : void 0;
10513
+ var idList = (ids) => {
10514
+ if (ids === void 0 || typeof ids === "string") return ids;
10515
+ return ids.length > 0 ? ids.join(",") : void 0;
10516
+ };
10513
10517
  var WallapopClient = class {
10514
10518
  client;
10515
10519
  constructor(client) {
@@ -10518,15 +10522,26 @@ var WallapopClient = class {
10518
10522
  /**
10519
10523
  * Search Wallapop listings (40 per page).
10520
10524
  *
10521
- * Needs a query, a `categoryId`, or both — unless `nextPage` is given, in
10522
- * which case every other parameter is ignored.
10525
+ * Needs a query, a `categoryId`, `subcategoryIds`, or a combination —
10526
+ * unless `nextPage` is given, in which case every other parameter is
10527
+ * ignored (the cursor already carries them).
10523
10528
  *
10524
10529
  * @param query - Search text, e.g. "iphone 14" (optional with `categoryId` or `nextPage`).
10525
10530
  * @param options - Optional parameters (market, location/radius, category,
10526
- * price, condition, brand/model/colour, cars filters, sort, cursor).
10531
+ * subcategories, price, condition, brand/model/colour, cars filters,
10532
+ * sort, cursor).
10527
10533
  * @returns Search response with matching listings and the next-page cursor.
10528
10534
  * @throws AuthenticationError - If the API key is invalid.
10529
- * @throws ValidationError - If neither a query nor a category is given.
10535
+ * @throws ValidationError - If neither a query nor a category/subcategory is given.
10536
+ *
10537
+ * @example
10538
+ * ```typescript
10539
+ * // Smartphones (9447) under Technology & electronics (24200)
10540
+ * const phones = await client.wallapop.search("iphone", {
10541
+ * categoryId: 24200,
10542
+ * subcategoryIds: [9447],
10543
+ * });
10544
+ * ```
10530
10545
  */
10531
10546
  async search(query, options = {}) {
10532
10547
  return this.client.request("/v1/wallapop/search", {
@@ -10537,6 +10552,7 @@ var WallapopClient = class {
10537
10552
  longitude: options.longitude,
10538
10553
  distance_km: options.distanceKm,
10539
10554
  category_id: options.categoryId,
10555
+ subcategory_ids: idList(options.subcategoryIds),
10540
10556
  min_price: options.minPrice,
10541
10557
  max_price: options.maxPrice,
10542
10558
  condition: options.condition,
@@ -10643,13 +10659,14 @@ var WallapopClient = class {
10643
10659
  * Get the search filters Wallapop offers for a category and/or query,
10644
10660
  * with their option ids.
10645
10661
  *
10646
- * @param options - Optional parameters (categoryId, query, market).
10662
+ * @param options - Optional parameters (categoryId, subcategoryIds, query, market).
10647
10663
  * @returns Available filters.
10648
10664
  */
10649
10665
  async listFilters(options = {}) {
10650
10666
  return this.client.request("/v1/wallapop/filters", {
10651
10667
  params: {
10652
10668
  category_id: options.categoryId,
10669
+ subcategory_ids: idList(options.subcategoryIds),
10653
10670
  query: options.query,
10654
10671
  market: options.market
10655
10672
  }
@@ -10660,7 +10677,8 @@ var WallapopClient = class {
10660
10677
  * separately — filters flagged `options_endpoint` in `listFilters`.
10661
10678
  *
10662
10679
  * @param filterId - Filter id, e.g. "brand".
10663
- * @param options - Optional parameters (categoryId, query, market).
10680
+ * @param options - Optional parameters (categoryId, subcategoryIds, query,
10681
+ * market); e.g. `subcategoryIds: [9447]` returns phone brands only.
10664
10682
  * @returns The filter's options.
10665
10683
  * @throws ValidationError - If the filter id is invalid.
10666
10684
  */
@@ -10670,6 +10688,7 @@ var WallapopClient = class {
10670
10688
  {
10671
10689
  params: {
10672
10690
  category_id: options.categoryId,
10691
+ subcategory_ids: idList(options.subcategoryIds),
10673
10692
  query: options.query,
10674
10693
  market: options.market
10675
10694
  }