tcgpriser 0.7.0 → 0.13.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
@@ -4,31 +4,69 @@ interface HttpClientOptions {
4
4
  headers?: Record<string, string>;
5
5
  /** Default bearer token for premium endpoints, used when a call doesn't pass its own `authToken`. */
6
6
  authToken?: string;
7
+ /** Default per-request timeout. See `RequestOptions.timeoutMs`. */
8
+ timeoutMs?: number;
7
9
  }
8
- /** Per-call auth override for a premium endpoint, on top of the client's default `authToken`.
9
- * Every premium method takes one of these, either standalone or merged into its params object via
10
- * `splitAuthToken`. */
11
- interface PremiumOptions {
12
- /** Overrides the client's default `authToken` for this call. Pass `undefined` explicitly to
13
- * force an anonymous request even when the client has a default token. */
10
+ /**
11
+ * Per-call overrides, accepted by every method — either standalone or merged into its params object
12
+ * and split back out by `splitRequestOptions`.
13
+ */
14
+ interface RequestOptions {
15
+ /**
16
+ * Overrides the client's default `authToken` for this call. Pass `undefined` explicitly to force
17
+ * an anonymous request even when the client has a default token.
18
+ */
14
19
  authToken?: string;
20
+ /**
21
+ * Cancel the request from outside — a user navigating away, a parent operation being abandoned.
22
+ * Composed with `timeoutMs`, so whichever fires first wins; aborting through this signal rejects
23
+ * with the standard `AbortError`, not a `TcgPriserError`.
24
+ */
25
+ signal?: AbortSignal;
26
+ /**
27
+ * Milliseconds before this request is aborted, overriding the client's default. `0` disables the
28
+ * timeout for this call, which is occasionally right for `expansions.cardsLivePricing()` on a very
29
+ * large set. A timeout rejects with a `TcgPriserError` whose `code` is `'timeout'`.
30
+ */
31
+ timeoutMs?: number;
15
32
  }
16
- /** Thin wrapper around `fetch`: joins the base URL, adds default headers, turns non-2xx responses
17
- * into a `TcgPriserError`. Every resource method goes through this instead of calling `fetch`
18
- * directly. */
33
+ /** @deprecated Renamed to `RequestOptions`, which also carries `signal` and `timeoutMs`. */
34
+ type PremiumOptions = RequestOptions;
35
+ /**
36
+ * Default request timeout.
37
+ *
38
+ * There was none, which meant a connection that opened and then stalled hung the caller forever
39
+ * with no way out: `fetch` has no built-in timeout, and without a `signal` there is nothing to
40
+ * cancel. A minute is well clear of the slowest thing the API does (a whole-expansion live-pricing
41
+ * recompute) while still being a bound.
42
+ */
43
+ declare const DEFAULT_TIMEOUT_MS = 60000;
44
+ /** Thin wrapper around `fetch`: joins the base URL, adds default headers, applies the timeout, turns
45
+ * non-2xx responses into a `TcgPriserError`. Every resource method goes through this instead of
46
+ * calling `fetch` directly. */
19
47
  declare class HttpClient {
20
48
  private readonly baseUrl;
21
49
  private readonly fetchImpl;
22
50
  private readonly defaultHeaders;
23
51
  private readonly defaultAuthToken;
52
+ private readonly defaultTimeoutMs;
53
+ /**
54
+ * The `X-Credits-Remaining` value from the most recent charged response, or `undefined` if no
55
+ * charged call has been made yet. See `TcgPriser.creditsRemaining`.
56
+ */
57
+ creditsRemaining: number | undefined;
24
58
  constructor(options: HttpClientOptions);
25
- get<T>(path: string, requestOptions?: PremiumOptions): Promise<T>;
26
- post<T>(path: string, body: unknown, requestOptions?: PremiumOptions): Promise<T>;
27
- patch<T>(path: string, body: unknown, requestOptions?: PremiumOptions): Promise<T>;
59
+ get<T>(path: string, requestOptions?: RequestOptions): Promise<T>;
60
+ post<T>(path: string, body: unknown, requestOptions?: RequestOptions): Promise<T>;
61
+ patch<T>(path: string, body: unknown, requestOptions?: RequestOptions): Promise<T>;
62
+ delete<T>(path: string, requestOptions?: RequestOptions): Promise<T>;
28
63
  private request;
29
64
  }
30
65
  interface components {
31
66
  schemas: {
67
+ Acknowledgement: {
68
+ message: string;
69
+ };
32
70
  AlternativeName: {
33
71
  name: string;
34
72
  shortName: string | undefined;
@@ -41,7 +79,7 @@ interface components {
41
79
  ApiError: {
42
80
  error: {
43
81
  /** @enum {string} */
44
- code: "validationFailed" | "unauthorized" | "forbidden" | "notFound" | "conflict" | "readOnlyField" | "rateLimited" | "premiumRequired" | "businessRequired" | "internalError";
82
+ code: "validationFailed" | "unauthorized" | "forbidden" | "notFound" | "conflict" | "readOnlyField" | "rateLimited" | "premiumRequired" | "businessRequired" | "creditsExhausted" | "internalError";
45
83
  message: string;
46
84
  details: unknown;
47
85
  };
@@ -311,17 +349,6 @@ interface components {
311
349
  */
312
350
  updatedAt: string;
313
351
  };
314
- ExpansionContents: {
315
- expansion: components["schemas"]["ExpansionRef"];
316
- cards: {
317
- count: number;
318
- items: components["schemas"]["Card"][];
319
- };
320
- sealed: {
321
- count: number;
322
- items: components["schemas"]["Product"][];
323
- };
324
- };
325
352
  ExpansionLivePricing: {
326
353
  expansion: {
327
354
  technicalName: string;
@@ -1021,7 +1048,7 @@ interface components {
1021
1048
  shopUrl: components["schemas"]["ShopUrl"];
1022
1049
  };
1023
1050
  /** @enum {string} */
1024
- ShopUrlStatus: "pending" | "active" | "invalid" | "rejected" | "sanityRejected";
1051
+ ShopUrlStatus: "pending" | "active" | "invalid" | "rejected" | "sanityRejected" | "wrongBrand";
1025
1052
  SoldPrice: {
1026
1053
  /**
1027
1054
  * @description Resource identifier
@@ -1089,6 +1116,70 @@ interface components {
1089
1116
  looseCount: number;
1090
1117
  gradedCount: number;
1091
1118
  };
1119
+ Webhook: {
1120
+ /**
1121
+ * @description Resource identifier
1122
+ * @example 6a577711abc1ce71383d3e10
1123
+ */
1124
+ id: string;
1125
+ url: string;
1126
+ events: components["schemas"]["WebhookEvent"][];
1127
+ isActive: boolean;
1128
+ /**
1129
+ * Format: date-time
1130
+ * @example 2026-07-15T12:03:29.322Z
1131
+ */
1132
+ lastDeliveryAt: string | undefined;
1133
+ /** @enum {string|null} */
1134
+ lastDeliveryStatus: "success" | "failed" | undefined;
1135
+ /**
1136
+ * Format: date-time
1137
+ * @example 2026-07-15T12:03:29.322Z
1138
+ */
1139
+ createdAt: string;
1140
+ /**
1141
+ * Format: date-time
1142
+ * @example 2026-07-15T12:03:29.322Z
1143
+ */
1144
+ updatedAt: string;
1145
+ };
1146
+ /** @enum {string} */
1147
+ WebhookEvent: "price.updated" | "bargain.found" | "product.created" | "card.created";
1148
+ WebhookList: {
1149
+ data: components["schemas"]["Webhook"][];
1150
+ pagination: components["schemas"]["PageMeta"];
1151
+ };
1152
+ WebhookSecret: {
1153
+ /**
1154
+ * @description Resource identifier
1155
+ * @example 6a577711abc1ce71383d3e10
1156
+ */
1157
+ id: string;
1158
+ url: string;
1159
+ events: components["schemas"]["WebhookEvent"][];
1160
+ isActive: boolean;
1161
+ /**
1162
+ * Format: date-time
1163
+ * @example 2026-07-15T12:03:29.322Z
1164
+ */
1165
+ lastDeliveryAt: string | undefined;
1166
+ /** @enum {string|null} */
1167
+ lastDeliveryStatus: "success" | "failed" | undefined;
1168
+ /**
1169
+ * Format: date-time
1170
+ * @example 2026-07-15T12:03:29.322Z
1171
+ */
1172
+ createdAt: string;
1173
+ /**
1174
+ * Format: date-time
1175
+ * @example 2026-07-15T12:03:29.322Z
1176
+ */
1177
+ updatedAt: string;
1178
+ secret: string;
1179
+ };
1180
+ WebhookTestResult: {
1181
+ message: string;
1182
+ };
1092
1183
  };
1093
1184
  responses: never;
1094
1185
  parameters: never;
@@ -1209,8 +1300,14 @@ interface ListResponse<T> {
1209
1300
  data: T[];
1210
1301
  pagination: PageMeta;
1211
1302
  }
1212
- /** Query params shared by every offset-paginated list endpoint. */
1213
- interface PaginationParams {
1303
+ /**
1304
+ * Query params shared by every offset-paginated list endpoint.
1305
+ *
1306
+ * Extends `RequestOptions` so `signal` and `timeoutMs` can be passed inline alongside the filters,
1307
+ * rather than as a second argument on some methods and a merged field on others. `splitRequestOptions`
1308
+ * strips them back out before the query string is built, so they never reach the URL.
1309
+ */
1310
+ interface PaginationParams extends RequestOptions {
1214
1311
  limit?: number;
1215
1312
  skip?: number;
1216
1313
  }
@@ -1343,7 +1440,7 @@ type ReferencePriceProvider = "tradera" | "cardmarket" | "tcgplayer" | "ebay";
1343
1440
  /** Keyed by provider, at most one snapshot per provider. */
1344
1441
  type ReferencePriceSnapshotsByProvider = Partial<Record<ReferencePriceProvider, ReferencePriceSnapshot>>;
1345
1442
  /** A card, as returned by `client.cards.get()` / `client.cards.list()`, and as embedded in
1346
- * `client.expansions.products()`. `kind: 'card'` is a literal on the generated type, which is what
1443
+ * `client.expansions.cards()`. `kind: 'card'` is a literal on the generated type, which is what
1347
1444
  * makes `CatalogItem` (below) discriminate cleanly. Content only — no pricing fields; fetch those
1348
1445
  * separately via `client.cards.pricing()` / `.pricingBatch()`. */
1349
1446
  type Card = {
@@ -1397,8 +1494,9 @@ type Card = {
1397
1494
  prisjaktId: string | undefined;
1398
1495
  };
1399
1496
  /** A sealed product (booster box, ETB, tin, ...), as returned by `client.products.get()` /
1400
- * `client.products.list()`. `kind: 'sealed'` is a literal on the generated type. Content only — no
1401
- * pricing fields; fetch those separately via `client.products.pricing()` / `.pricingBatch()`. */
1497
+ * `client.products.list()`, and as embedded in `client.expansions.sealedProducts()`. `kind:
1498
+ * 'sealed'` is a literal on the generated type. Content only — no pricing fields; fetch those
1499
+ * separately via `client.products.pricing()` / `.pricingBatch()`. */
1402
1500
  type SealedProduct = {
1403
1501
  /**
1404
1502
  * @description Resource identifier
@@ -1488,6 +1586,17 @@ type CardVariants = {
1488
1586
  firstEdition: boolean;
1489
1587
  wPromo: boolean;
1490
1588
  };
1589
+ /** One entry from `client.cards.technicalNames()` / `client.products.technicalNames()`: a slug and
1590
+ * when that item last changed. Enough to build a sitemap or decide what to re-fetch, without paying
1591
+ * for the full catalog page. */
1592
+ type CatalogSlug = {
1593
+ technicalName: string;
1594
+ /**
1595
+ * Format: date-time
1596
+ * @example 2026-07-15T12:03:29.322Z
1597
+ */
1598
+ updatedAt: string;
1599
+ };
1491
1600
  /** The compact item reference used inside flat shop-match rows (`client.shopMatches.list()` /
1492
1601
  * `.forShop()`), enough to render a result list, not the full `CatalogItem`. */
1493
1602
  type MatchedItemRef = {
@@ -1566,9 +1675,10 @@ type BargainProductRef = {
1566
1675
  */
1567
1676
  imageUrl: string | undefined;
1568
1677
  };
1569
- /** A set/expansion, as returned by `client.expansions.list()`. This is the full record. The
1570
- * `expansion` field embedded on a card or product is the smaller `ExpansionRef` from
1571
- * `types/common.ts`. */
1678
+ /** A set/expansion, as returned by `client.expansions.list()`. This is the full record, including
1679
+ * the `sealedCount`/`cardCount`/`productCount` aggregation `list()` runs. The `expansion` field
1680
+ * embedded on a card or product, and the result of `client.expansions.get()`, are the smaller
1681
+ * `ExpansionRef` from `types/common.ts` instead. */
1572
1682
  type Expansion = {
1573
1683
  /**
1574
1684
  * @description Resource identifier
@@ -1633,26 +1743,6 @@ type Expansion = {
1633
1743
  */
1634
1744
  updatedAt: string;
1635
1745
  };
1636
- /** Response of `client.expansions.products()`: everything in one expansion, cards and sealed
1637
- * products kept as separate `cards`/`sealed` groups rather than merged into one mixed list. */
1638
- type ExpansionContents = {
1639
- expansion: ExpansionRef;
1640
- cards: {
1641
- count: number;
1642
- items: CardSchema[];
1643
- };
1644
- sealed: {
1645
- count: number;
1646
- items: SealedProduct[];
1647
- };
1648
- };
1649
- /** One card as embedded in `client.expansions.products()`'s `cards` group. `$ref`s `CardWithPricing`
1650
- * on the wire, so this is literally `Card` — kept as its own name since a card found through an
1651
- * expansion's contents reads more naturally as `ExpansionCard` at the call site. */
1652
- type ExpansionCard = Card;
1653
- /** One sealed product as embedded in `client.expansions.products()`'s `sealed` group. Literally
1654
- * `SealedProduct`, same reasoning as `ExpansionCard`. */
1655
- type ExpansionSealedProduct = SealedProduct;
1656
1746
  type ShopMatchWithItemSchema = {
1657
1747
  /**
1658
1748
  * @description Resource identifier
@@ -2389,7 +2479,7 @@ type ItemPriceComparison = {
2389
2479
  items: ShopPriceComparisonRow[];
2390
2480
  stats: ShopPriceComparisonStats | undefined;
2391
2481
  };
2392
- type ShopUrlStatus = "pending" | "active" | "invalid" | "rejected" | "sanityRejected";
2482
+ type ShopUrlStatus = "pending" | "active" | "invalid" | "rejected" | "sanityRejected" | "wrongBrand";
2393
2483
  type ShopUrlDiscoveredBy = "scraper" | "user";
2394
2484
  /** A URL at a shop that tcgpriser scrapes, and what it has been matched to. */
2395
2485
  type ShopUrl = {
@@ -2446,11 +2536,93 @@ type ShopUrlMutationResult = {
2446
2536
  message: string;
2447
2537
  shopUrl: ShopUrl;
2448
2538
  };
2449
- interface ListBargainsParams {
2539
+ /**
2540
+ * Types for the Business tier: outbound webhooks, the one feature that distinguishes Business from
2541
+ * Premium. Everything here needs a Business subscriber's API token — a Premium token answers
2542
+ * `403 businessRequired`.
2543
+ *
2544
+ * Derived from `src/generated/openapi.d.ts`, same as everything else in this directory.
2545
+ */
2546
+ /** One registered webhook, as returned by `client.webhooks.list()`. Never carries the signing
2547
+ * secret — see `WebhookWithSecret`, which is returned exactly once at registration. */
2548
+ type Webhook = {
2549
+ /**
2550
+ * @description Resource identifier
2551
+ * @example 6a577711abc1ce71383d3e10
2552
+ */
2553
+ id: string;
2554
+ url: string;
2555
+ events: WebhookEvent[];
2556
+ isActive: boolean;
2557
+ /**
2558
+ * Format: date-time
2559
+ * @example 2026-07-15T12:03:29.322Z
2560
+ */
2561
+ lastDeliveryAt: string | undefined;
2562
+ /** @enum {string|null} */
2563
+ lastDeliveryStatus: "success" | "failed" | undefined;
2564
+ /**
2565
+ * Format: date-time
2566
+ * @example 2026-07-15T12:03:29.322Z
2567
+ */
2568
+ createdAt: string;
2569
+ /**
2570
+ * Format: date-time
2571
+ * @example 2026-07-15T12:03:29.322Z
2572
+ */
2573
+ updatedAt: string;
2574
+ };
2575
+ /** The catalog-wide events a webhook can subscribe to. */
2576
+ type WebhookEvent = "price.updated" | "bargain.found" | "product.created" | "card.created";
2577
+ /** Whether the most recent delivery attempt succeeded. `undefined` until the first attempt. */
2578
+ type WebhookDeliveryStatus = "success" | "failed";
2579
+ /**
2580
+ * What `client.webhooks.create()` returns: a `Webhook` plus the `secret` used to sign deliveries.
2581
+ *
2582
+ * The secret is returned by that one call and never again — there is no endpoint that reads it
2583
+ * back, by design. Store it when you create the webhook; if you lose it, delete the webhook and
2584
+ * register a new one.
2585
+ */
2586
+ type WebhookWithSecret = {
2587
+ /**
2588
+ * @description Resource identifier
2589
+ * @example 6a577711abc1ce71383d3e10
2590
+ */
2591
+ id: string;
2592
+ url: string;
2593
+ events: WebhookEvent[];
2594
+ isActive: boolean;
2595
+ /**
2596
+ * Format: date-time
2597
+ * @example 2026-07-15T12:03:29.322Z
2598
+ */
2599
+ lastDeliveryAt: string | undefined;
2600
+ /** @enum {string|null} */
2601
+ lastDeliveryStatus: "success" | "failed" | undefined;
2602
+ /**
2603
+ * Format: date-time
2604
+ * @example 2026-07-15T12:03:29.322Z
2605
+ */
2606
+ createdAt: string;
2607
+ /**
2608
+ * Format: date-time
2609
+ * @example 2026-07-15T12:03:29.322Z
2610
+ */
2611
+ updatedAt: string;
2612
+ secret: string;
2613
+ };
2614
+ /** Response of `client.webhooks.test()`. */
2615
+ type WebhookTestResult = {
2616
+ message: string;
2617
+ };
2618
+ /** Response of `client.webhooks.delete()`. */
2619
+ type Acknowledgement = {
2620
+ message: string;
2621
+ };
2622
+ interface ListBargainsParams extends RequestOptions {
2450
2623
  type?: 'sealed' | 'card' | 'all';
2451
2624
  }
2452
2625
  interface SearchBargainsParams extends PaginationParams {
2453
- authToken?: string;
2454
2626
  type?: 'sealed' | 'card' | 'all';
2455
2627
  /** Filter by shop technicalName. */
2456
2628
  shop?: string;
@@ -2479,6 +2651,8 @@ declare class BargainsResource {
2479
2651
  search(params?: SearchBargainsParams): Promise<ListResponse<Bargain>>;
2480
2652
  }
2481
2653
  interface ListCardsParams extends PaginationParams {
2654
+ }
2655
+ interface SearchCardsParams extends PaginationParams {
2482
2656
  /** Free-text search over card and set names. */
2483
2657
  search?: string;
2484
2658
  }
@@ -2486,7 +2660,7 @@ interface CardMatchesParams extends PaginationParams {
2486
2660
  /** Keep only matches whose shop currently has stock. */
2487
2661
  inStock?: boolean;
2488
2662
  }
2489
- interface CardReferencePricesParams {
2663
+ interface CardReferencePricesParams extends RequestOptions {
2490
2664
  /** Bearer token for this call. Overrides the client's default `authToken`. */
2491
2665
  authToken?: string;
2492
2666
  /** Rolling window ending today, in days. Ignored when `from`/`to` are supplied. Default 90. */
@@ -2500,15 +2674,45 @@ interface CardReferencePricesParams {
2500
2674
  variant?: ReferencePriceCardVariant;
2501
2675
  }
2502
2676
  interface CardPricesParams extends PaginationParams {
2503
- authToken?: string;
2677
+ }
2678
+ /** Filters for `cards.dailyStats()`. Narrow to one card, or to a whole expansion/category. */
2679
+ interface CardDailyStatsParams extends RequestOptions {
2680
+ /** `YYYY-MM-DD` */
2681
+ startDate?: string;
2682
+ /** `YYYY-MM-DD` */
2683
+ endDate?: string;
2684
+ productName?: string;
2685
+ technicalName?: string;
2686
+ /** Category technicalName. */
2687
+ category?: string;
2688
+ /** Expansion technicalName. */
2689
+ expansion?: string;
2690
+ /** Category id (ObjectId), an alternative to `category`. */
2691
+ categoryId?: string;
2692
+ /** Expansion id (ObjectId), an alternative to `expansion`. */
2693
+ expansionId?: string;
2694
+ }
2695
+ /** Filters for `cards.estimatedValues()`. Note `page`/`limit`, not the `limit`/`skip` the rest of
2696
+ * the API paginates with — this endpoint predates that convention. */
2697
+ interface CardEstimatedValuesParams extends RequestOptions {
2698
+ page?: number;
2699
+ limit?: number;
2700
+ productName?: string;
2701
+ technicalName?: string;
2702
+ /** Category technicalName. */
2703
+ category?: string;
2704
+ /** Expansion technicalName. */
2705
+ expansion?: string;
2504
2706
  }
2505
2707
  declare class CardsResource {
2506
2708
  private readonly http;
2507
2709
  constructor(http: HttpClient);
2508
- /** `GET /cards`: search or list cards. */
2710
+ /** `GET /cards`: list cards, newest first. No free-text search — use `search()` for that. */
2509
2711
  list(params?: ListCardsParams): Promise<ListResponse<Card>>;
2712
+ /** `GET /cards/search`: like `list()`, but with free-text search on card and set names. Premium. */
2713
+ search(params?: SearchCardsParams): Promise<ListResponse<Card>>;
2510
2714
  /** `GET /cards/{id}`: fetch one card by its id or technicalName. */
2511
- get(idOrTechnicalName: string): Promise<Card>;
2715
+ get(idOrTechnicalName: string, options?: RequestOptions): Promise<Card>;
2512
2716
  /** `GET /cards/{id}/matches`: current shop listings matched to this card (latest per shop). */
2513
2717
  matches(idOrTechnicalName: string, params?: CardMatchesParams): Promise<ItemShopMatches>;
2514
2718
  /** `GET /cards/{id}/reference-prices`: Cardmarket/TCGplayer/eBay/Tradera price history. Premium. */
@@ -2517,46 +2721,70 @@ declare class CardsResource {
2517
2721
  prices(idOrTechnicalName: string, params?: CardPricesParams): Promise<ItemSoldPrices>;
2518
2722
  /** `GET /cards/{id}/pricing/live`: computed fresh for this request, not read from the last
2519
2723
  * stats job. Premium. */
2520
- livePricing(idOrTechnicalName: string, options?: PremiumOptions): Promise<LivePricingForItem>;
2724
+ livePricing(idOrTechnicalName: string, options?: RequestOptions): Promise<LivePricingForItem>;
2521
2725
  /** `GET /cards/{id}/pricing`: this card's current pricing snapshot — `retailPrice`,
2522
2726
  * `estimatedValue`, `lowestShopOffer`, `referencePriceSnapshotsByProvider` — refreshed once a day
2523
2727
  * by the nightly pricing/scraper jobs. `get()` returns content only; this is the separate,
2524
2728
  * shorter-cached call for the part of a card that actually changes day to day. */
2525
- pricing(idOrTechnicalName: string): Promise<CatalogItemPricing>;
2729
+ pricing(idOrTechnicalName: string, options?: RequestOptions): Promise<CatalogItemPricing>;
2526
2730
  /** `GET /cards/pricing`: pricing for up to 200 cards in one request, keyed by `id` — the batch
2527
2731
  * counterpart to `pricing()`, for a page of results (a search page, an expansion's contents) that
2528
2732
  * needs pricing for many items at once. Unlike `get()`/`pricing()`, this only accepts `id`s, not
2529
2733
  * technicalNames — pass the `id`s already on the cards you fetched. Ids with no match are
2530
2734
  * silently omitted from the result rather than causing an error. */
2531
- pricingBatch(ids: string[]): Promise<ListResponse<CatalogItemPricing>>;
2735
+ pricingBatch(ids: string[], options?: RequestOptions): Promise<ListResponse<CatalogItemPricing>>;
2736
+ /** `GET /cards/technical-names`: every card's `technicalName` and `updatedAt`, unpaginated and
2737
+ * with no pricing joins. Built for enumerating the whole catalog cheaply — a sitemap, or working
2738
+ * out which items changed since your last sync — where `list()` would make you page through full
2739
+ * card documents to learn the same two fields. */
2740
+ technicalNames(options?: RequestOptions): Promise<ListResponse<CatalogSlug>>;
2741
+ /** `GET /cards/price-stats/daily`: daily average price history, cards only. The same data as
2742
+ * `client.priceStats.daily()`, scoped to the card catalog so a filter like `expansion` can't pull
2743
+ * in that expansion's sealed products too. */
2744
+ dailyStats(params?: CardDailyStatsParams): Promise<ListResponse<ItemDailyStats>>;
2745
+ /** `GET /cards/price-stats/estimated-values`: current estimated market value, cards only. The
2746
+ * card-scoped counterpart to `client.priceStats.estimatedValues()`. */
2747
+ estimatedValues(params?: CardEstimatedValuesParams): Promise<ListResponse<ItemEstimatedValue>>;
2532
2748
  }
2533
2749
  declare class ExpansionsResource {
2534
2750
  private readonly http;
2535
2751
  constructor(http: HttpClient);
2536
2752
  /** `GET /expansions`: every expansion. Unwrapped to a plain array, nothing to paginate here. */
2537
- list(): Promise<Expansion[]>;
2538
- /** `GET /expansions/{technicalName}/products`: every card and sealed product in one
2539
- * expansion, kept as separate `cards`/`sealed` groups. Content only, no pricing fields — pass the
2540
- * `id`s from the result to `client.cards.pricingBatch()` / `client.products.pricingBatch()` if you
2541
- * need pricing too. This mirrors the API 1:1 rather than fetching pricing for you, since pricing
2542
- * for every item in an expansion is a second, separately-cached call the caller may not want. */
2543
- products(technicalName: string): Promise<ExpansionContents>;
2544
- /** `GET /expansions/{technicalName}/products/live-pricing`: computed fresh for every item in
2545
- * this expansion, not read from the last stats job. Premium. */
2546
- livePricing(technicalName: string, options?: PremiumOptions): Promise<ExpansionLivePricing>;
2753
+ list(options?: RequestOptions): Promise<Expansion[]>;
2754
+ /** `GET /expansions/{technicalName}`: metadata only — no cards or sealed products. Returns the
2755
+ * smaller `ExpansionRef`, not the full `Expansion`: this is a plain lookup by technicalName, not
2756
+ * the aggregation `list()` runs, so `sealedCount`/`cardCount`/`productCount` aren't available
2757
+ * here. See `cards()` and `sealedProducts()` for this expansion's contents. */
2758
+ get(technicalName: string, options?: RequestOptions): Promise<ExpansionRef>;
2759
+ /** `GET /expansions/{technicalName}/cards`: every card in this expansion. Content only, no
2760
+ * pricing fields — pass the `id`s from the result to `client.cards.pricingBatch()` if you need
2761
+ * pricing too. Sealed products are a separate call — see `sealedProducts()` — never merged into
2762
+ * this one. */
2763
+ cards(technicalName: string, options?: RequestOptions): Promise<ListResponse<Card>>;
2764
+ /** `GET /expansions/{technicalName}/products`: every sealed product in this expansion. Content
2765
+ * only, no pricing fields — pass the `id`s from the result to `client.products.pricingBatch()`
2766
+ * if you need pricing too. Cards are a separate call — see `cards()` — never merged into this
2767
+ * one. */
2768
+ sealedProducts(technicalName: string, options?: RequestOptions): Promise<ListResponse<SealedProduct>>;
2769
+ /** `GET /expansions/{technicalName}/cards/live-pricing`: computed fresh for every card in this
2770
+ * expansion, not read from the last stats job. Premium. */
2771
+ cardsLivePricing(technicalName: string, options?: RequestOptions): Promise<ExpansionLivePricing>;
2772
+ /** `GET /expansions/{technicalName}/products/live-pricing`: computed fresh for every sealed
2773
+ * product in this expansion, not read from the last stats job. Premium. */
2774
+ productsLivePricing(technicalName: string, options?: RequestOptions): Promise<ExpansionLivePricing>;
2547
2775
  }
2548
2776
  declare class PackRatesResource {
2549
2777
  private readonly http;
2550
2778
  constructor(http: HttpClient);
2551
2779
  /** `GET /pack-rates`: pull-rate odds for every expansion that has them. Unwrapped to a plain
2552
2780
  * array, nothing to paginate here. */
2553
- list(): Promise<PackRate[]>;
2781
+ list(options?: RequestOptions): Promise<PackRate[]>;
2554
2782
  /** `GET /pack-rates/{expansionId}`: pull-rate odds for one expansion. */
2555
- get(expansionId: string): Promise<PackRate>;
2783
+ get(expansionId: string, options?: RequestOptions): Promise<PackRate>;
2556
2784
  }
2557
2785
  /** Filters shared by `daily()` and `estimatedValues()`: all narrow which product(s) the stats
2558
2786
  * cover; combine as many as you like. */
2559
- interface ProductFilterParams {
2787
+ interface ProductFilterParams extends RequestOptions {
2560
2788
  productName?: string;
2561
2789
  technicalName?: string;
2562
2790
  priceChartingId?: string;
@@ -2580,21 +2808,18 @@ interface EstimatedValuesParams extends ProductFilterParams {
2580
2808
  page?: number;
2581
2809
  limit?: number;
2582
2810
  }
2583
- interface TopProductsParams {
2811
+ interface TopProductsParams extends RequestOptions {
2584
2812
  limit?: number;
2585
2813
  }
2586
- interface ProductDailyStatsParams {
2587
- authToken?: string;
2814
+ interface ProductDailyStatsParams extends RequestOptions {
2588
2815
  /** Number of days to retrieve, from today backwards. Default 30. */
2589
2816
  days?: number;
2590
2817
  }
2591
- interface ProductByVariantParams {
2592
- authToken?: string;
2818
+ interface ProductByVariantParams extends RequestOptions {
2593
2819
  /** Number of days to include in the average calculation. Default 30. */
2594
2820
  days?: number;
2595
2821
  }
2596
- interface ProductDailyByVariantParams {
2597
- authToken?: string;
2822
+ interface ProductDailyByVariantParams extends RequestOptions {
2598
2823
  cardType: CardType;
2599
2824
  /** Required when `cardType` is `'loose'`. */
2600
2825
  condition?: ItemCondition;
@@ -2618,18 +2843,18 @@ declare class PriceStatsResource {
2618
2843
  topProducts(params?: TopProductsParams): Promise<ListResponse<TopItem>>;
2619
2844
  /** `GET /price-stats/product/{id}`: daily price history, current estimate, and a variant-count
2620
2845
  * summary for one product. Premium. */
2621
- product(idOrTechnicalName: string, options?: PremiumOptions): Promise<ItemStats>;
2846
+ product(idOrTechnicalName: string, options?: RequestOptions): Promise<ItemStats>;
2622
2847
  /** `GET /price-stats/product/{id}/full`: everything `product()` has, plus the item's current
2623
2848
  * shop matches. Premium. */
2624
- productFull(idOrTechnicalName: string, options?: PremiumOptions): Promise<ItemFullStats>;
2849
+ productFull(idOrTechnicalName: string, options?: RequestOptions): Promise<ItemFullStats>;
2625
2850
  /** `GET /price-stats/product/{id}/daily`: daily price history for one product, with a
2626
2851
  * caller-chosen window. Premium. */
2627
2852
  productDaily(idOrTechnicalName: string, params?: ProductDailyStatsParams): Promise<ItemDailyStats>;
2628
2853
  /** `GET /price-stats/product/{id}/daily-last-30`: daily price history for the last 30 days
2629
2854
  * exactly (no window param, for callers that want a stable cache key). Premium. */
2630
- productDailyLast30(idOrTechnicalName: string, options?: PremiumOptions): Promise<ItemDailyStats>;
2855
+ productDailyLast30(idOrTechnicalName: string, options?: RequestOptions): Promise<ItemDailyStats>;
2631
2856
  /** `GET /price-stats/product/{id}/estimated-value`: current estimated value only. Premium. */
2632
- productEstimatedValue(idOrTechnicalName: string, options?: PremiumOptions): Promise<ItemEstimatedValue>;
2857
+ productEstimatedValue(idOrTechnicalName: string, options?: RequestOptions): Promise<ItemEstimatedValue>;
2633
2858
  /** `GET /price-stats/product/{id}/by-variant`: price stats broken out per card condition/grade.
2634
2859
  * Premium. */
2635
2860
  productByVariant(idOrTechnicalName: string, params?: ProductByVariantParams): Promise<ItemVariantStats>;
@@ -2639,6 +2864,8 @@ declare class PriceStatsResource {
2639
2864
  productDailyByVariant(idOrTechnicalName: string, params: ProductDailyByVariantParams): Promise<ItemVariantDailyStats>;
2640
2865
  }
2641
2866
  interface ListProductsParams extends PaginationParams {
2867
+ }
2868
+ interface SearchProductsParams extends PaginationParams {
2642
2869
  /** Whitespace-separated tokens, each matched against the start of a word. */
2643
2870
  search?: string;
2644
2871
  }
@@ -2650,7 +2877,7 @@ interface ProductMatchesParams extends PaginationParams {
2650
2877
  gradingCompany?: GradingCompany;
2651
2878
  grade?: number;
2652
2879
  }
2653
- interface ProductReferencePricesParams {
2880
+ interface ProductReferencePricesParams extends RequestOptions {
2654
2881
  authToken?: string;
2655
2882
  /** Rolling window ending today, in days. Ignored when `from`/`to` are supplied. Default 90. */
2656
2883
  days?: number;
@@ -2661,17 +2888,52 @@ interface ProductReferencePricesParams {
2661
2888
  provider?: ReferencePriceProvider;
2662
2889
  }
2663
2890
  interface ProductPricesParams extends PaginationParams {
2664
- authToken?: string;
2891
+ }
2892
+ /** Filters for `products.dailyStats()`. Narrow to one product, or to a whole expansion/category. */
2893
+ interface ProductDailyPriceStatsParams extends RequestOptions {
2894
+ /** `YYYY-MM-DD` */
2895
+ startDate?: string;
2896
+ /** `YYYY-MM-DD` */
2897
+ endDate?: string;
2898
+ productName?: string;
2899
+ technicalName?: string;
2900
+ priceChartingId?: string;
2901
+ modelNumber?: string;
2902
+ /** Category technicalName. */
2903
+ category?: string;
2904
+ /** Expansion technicalName. */
2905
+ expansion?: string;
2906
+ /** Category id (ObjectId), an alternative to `category`. */
2907
+ categoryId?: string;
2908
+ /** Expansion id (ObjectId), an alternative to `expansion`. */
2909
+ expansionId?: string;
2910
+ }
2911
+ /** Filters for `products.estimatedValues()`. Note `page`/`limit`, not the `limit`/`skip` the rest
2912
+ * of the API paginates with — this endpoint predates that convention. */
2913
+ interface ProductEstimatedValuesParams extends RequestOptions {
2914
+ page?: number;
2915
+ limit?: number;
2916
+ productName?: string;
2917
+ technicalName?: string;
2918
+ priceChartingId?: string;
2919
+ modelNumber?: string;
2920
+ /** Category technicalName. */
2921
+ category?: string;
2922
+ /** Expansion technicalName. */
2923
+ expansion?: string;
2665
2924
  }
2666
2925
  /** Sealed products: booster boxes, ETBs, tins, and the like. Single cards live under
2667
2926
  * `client.cards` instead. */
2668
2927
  declare class ProductsResource {
2669
2928
  private readonly http;
2670
2929
  constructor(http: HttpClient);
2671
- /** `GET /product`: search or list sealed products. */
2930
+ /** `GET /product`: list sealed products, newest first. No free-text search — use `search()` for
2931
+ * that. */
2672
2932
  list(params?: ListProductsParams): Promise<ListResponse<SealedProduct>>;
2933
+ /** `GET /product/search`: like `list()`, but with free-text search on the product name. Premium. */
2934
+ search(params?: SearchProductsParams): Promise<ListResponse<SealedProduct>>;
2673
2935
  /** `GET /product/{id}`: fetch one sealed product by its id or technicalName. */
2674
- get(idOrTechnicalName: string): Promise<SealedProduct>;
2936
+ get(idOrTechnicalName: string, options?: RequestOptions): Promise<SealedProduct>;
2675
2937
  /** `GET /product/{id}/matches`: current shop listings matched to this product (latest per shop). */
2676
2938
  matches(idOrTechnicalName: string, params?: ProductMatchesParams): Promise<ItemShopMatches>;
2677
2939
  /** `GET /product/{id}/reference-prices`: Cardmarket/TCGplayer/Tradera price history. Premium. */
@@ -2680,21 +2942,31 @@ declare class ProductsResource {
2680
2942
  prices(idOrTechnicalName: string, params?: ProductPricesParams): Promise<ItemSoldPrices>;
2681
2943
  /** `GET /product/{id}/pricing/live`: computed fresh for this request, not read from the last
2682
2944
  * stats job. Premium. */
2683
- livePricing(idOrTechnicalName: string, options?: PremiumOptions): Promise<LivePricingForItem>;
2945
+ livePricing(idOrTechnicalName: string, options?: RequestOptions): Promise<LivePricingForItem>;
2684
2946
  /** `GET /product/{id}/pricing`: this product's current pricing snapshot — `retailPrice`,
2685
2947
  * `estimatedValue`, `lowestShopOffer`, `referencePriceSnapshotsByProvider` — refreshed once a day
2686
2948
  * by the nightly pricing/scraper jobs. `get()` returns content only; this is the separate,
2687
2949
  * shorter-cached call for the part of a product that actually changes day to day. */
2688
- pricing(idOrTechnicalName: string): Promise<CatalogItemPricing>;
2950
+ pricing(idOrTechnicalName: string, options?: RequestOptions): Promise<CatalogItemPricing>;
2689
2951
  /** `GET /product/pricing`: pricing for up to 200 sealed products in one request, keyed by `id` —
2690
2952
  * the batch counterpart to `pricing()`, for a page of results (a search page, an expansion's
2691
2953
  * contents) that needs pricing for many items at once. Unlike `get()`/`pricing()`, this only
2692
2954
  * accepts `id`s, not technicalNames — pass the `id`s already on the products you fetched. Ids with
2693
2955
  * no match are silently omitted from the result rather than causing an error. */
2694
- pricingBatch(ids: string[]): Promise<ListResponse<CatalogItemPricing>>;
2956
+ pricingBatch(ids: string[], options?: RequestOptions): Promise<ListResponse<CatalogItemPricing>>;
2957
+ /** `GET /product/technical-names`: every sealed product's `technicalName` and `updatedAt`,
2958
+ * unpaginated and with no pricing joins. The sealed counterpart to
2959
+ * `client.cards.technicalNames()` — for sitemaps and incremental syncs. */
2960
+ technicalNames(options?: RequestOptions): Promise<ListResponse<CatalogSlug>>;
2961
+ /** `GET /product/price-stats/daily`: daily average price history, sealed products only. The same
2962
+ * data as `client.priceStats.daily()`, scoped to the sealed catalog so a filter like `expansion`
2963
+ * can't pull in that expansion's single cards too. */
2964
+ dailyStats(params?: ProductDailyPriceStatsParams): Promise<ListResponse<ItemDailyStats>>;
2965
+ /** `GET /product/price-stats/estimated-values`: current estimated market value, sealed products
2966
+ * only. The sealed-scoped counterpart to `client.priceStats.estimatedValues()`. */
2967
+ estimatedValues(params?: ProductEstimatedValuesParams): Promise<ListResponse<ItemEstimatedValue>>;
2695
2968
  }
2696
- interface ShopMatchStatsForProductParams {
2697
- authToken?: string;
2969
+ interface ShopMatchStatsForProductParams extends RequestOptions {
2698
2970
  /** `YYYY-MM-DD` */
2699
2971
  startDate?: string;
2700
2972
  /** `YYYY-MM-DD` */
@@ -2702,17 +2974,15 @@ interface ShopMatchStatsForProductParams {
2702
2974
  /** Filter to one shop's technicalName. */
2703
2975
  shop?: string;
2704
2976
  }
2705
- interface ShopMatchStatsForShopParams {
2706
- authToken?: string;
2977
+ interface ShopMatchStatsForShopParams extends RequestOptions {
2707
2978
  /** `YYYY-MM-DD` */
2708
2979
  startDate?: string;
2709
2980
  /** `YYYY-MM-DD` */
2710
2981
  endDate?: string;
2711
- /** Maximum products to return. Default 100. */
2982
+ /** Maximum products to return. Default 20, max 50. */
2712
2983
  limit?: number;
2713
2984
  }
2714
- interface CompareShopPricesParams {
2715
- authToken?: string;
2985
+ interface CompareShopPricesParams extends RequestOptions {
2716
2986
  /** Product/card id or technicalName. */
2717
2987
  productId: string;
2718
2988
  /** `YYYY-MM-DD`: defaults to the latest date with data. */
@@ -2755,12 +3025,12 @@ declare class ShopMatchesResource {
2755
3025
  /** `GET /shop-matches/shops`: match counts per shop (based on latest records only). */
2756
3026
  shopStats(params?: PaginationParams): Promise<ListResponse<ShopMatchStats>>;
2757
3027
  }
2758
- interface SubmitShopUrlParams extends PremiumOptions {
3028
+ interface SubmitShopUrlParams extends RequestOptions {
2759
3029
  url: string;
2760
3030
  /** Shop technicalName. Auto-created if it doesn't exist yet. */
2761
3031
  shop: string;
2762
3032
  }
2763
- interface AssignShopUrlProductParams extends PremiumOptions {
3033
+ interface AssignShopUrlProductParams extends RequestOptions {
2764
3034
  /** Product/card id to link, or `null` to unlink and let auto-matching resume. */
2765
3035
  productId: string | null;
2766
3036
  }
@@ -2774,7 +3044,7 @@ declare class ShopUrlsResource {
2774
3044
  /** `PATCH /shop-urls/{id}/product`: manually assign (or clear) the product a shop URL resolves to. */
2775
3045
  assignProduct(shopUrlId: string, params: AssignShopUrlProductParams): Promise<ShopUrlMutationResult>;
2776
3046
  }
2777
- interface ListShopsParams {
3047
+ interface ListShopsParams extends RequestOptions {
2778
3048
  active?: boolean;
2779
3049
  }
2780
3050
  declare class ShopsResource {
@@ -2783,13 +3053,48 @@ declare class ShopsResource {
2783
3053
  /** `GET /shops`: every tracked shop. Unwrapped to a plain array, nothing to paginate here. */
2784
3054
  list(params?: ListShopsParams): Promise<Shop[]>;
2785
3055
  /** `GET /shops/{id}`: fetch one shop by its id or technicalName. */
2786
- get(idOrTechnicalName: string): Promise<Shop>;
3056
+ get(idOrTechnicalName: string, options?: RequestOptions): Promise<Shop>;
2787
3057
  }
2788
3058
  declare class StatsResource {
2789
3059
  private readonly http;
2790
3060
  constructor(http: HttpClient);
2791
3061
  /** `GET /stats`: platform-wide overview counts (shops, expansions, products, prices tracked). */
2792
- platform(): Promise<PlatformStats>;
3062
+ platform(options?: RequestOptions): Promise<PlatformStats>;
3063
+ }
3064
+ interface CreateWebhookParams extends RequestOptions {
3065
+ /**
3066
+ * Where deliveries are POSTed. Must be `https://` — the API rejects plaintext, since a delivery
3067
+ * carries the signature that authenticates it.
3068
+ */
3069
+ url: string;
3070
+ /** At least one event to subscribe to. */
3071
+ events: WebhookEvent[];
3072
+ }
3073
+ /**
3074
+ * Outbound webhooks: the API calls you when something changes, instead of you polling for it.
3075
+ *
3076
+ * Business tier, not Premium — a Premium token answers `403 businessRequired`. The feature is also
3077
+ * behind a server-side flag, and when that flag is off these answer `404 notFound` rather than 403,
3078
+ * so a `notFound` here means "not enabled on this instance", not "wrong id".
3079
+ */
3080
+ declare class WebhooksResource {
3081
+ private readonly http;
3082
+ constructor(http: HttpClient);
3083
+ /**
3084
+ * `POST /webhooks`: register a new webhook.
3085
+ *
3086
+ * The returned `secret` is the only copy you will ever get — sign-verification depends on it and
3087
+ * no endpoint reads it back. Persist it here, at creation, or delete the webhook and make a new
3088
+ * one.
3089
+ */
3090
+ create(params: CreateWebhookParams): Promise<WebhookWithSecret>;
3091
+ /** `GET /webhooks`: every webhook registered on this account. Secrets are never included. */
3092
+ list(options?: RequestOptions): Promise<ListResponse<Webhook>>;
3093
+ /** `DELETE /webhooks/{id}`: revoke a webhook. Deliveries stop immediately; its secret is void. */
3094
+ delete(webhookId: string, options?: RequestOptions): Promise<Acknowledgement>;
3095
+ /** `POST /webhooks/{id}/test`: send a sample delivery to the registered URL, so you can verify
3096
+ * your endpoint and your signature check before waiting on a real event. */
3097
+ test(webhookId: string, options?: RequestOptions): Promise<WebhookTestResult>;
2793
3098
  }
2794
3099
  declare const DEFAULT_BASE_URL = "https://api.tcgpriser.se";
2795
3100
  /** Local dev, self-hosting and testing overrides. Most integrations never touch these. */
@@ -2800,6 +3105,12 @@ interface TcgPriserAdvancedOptions {
2800
3105
  headers?: Record<string, string>;
2801
3106
  /** Swap in a different `fetch` (older Node, testing, a proxying agent). Defaults to global `fetch`. */
2802
3107
  fetch?: typeof fetch;
3108
+ /**
3109
+ * Default milliseconds before a request is aborted, for every call this client makes. Defaults to
3110
+ * `DEFAULT_TIMEOUT_MS` (60s). `0` disables the timeout entirely. Every method can override it per
3111
+ * call with `timeoutMs`.
3112
+ */
3113
+ timeoutMs?: number;
2803
3114
  }
2804
3115
  interface TcgPriserOptions {
2805
3116
  /**
@@ -2850,14 +3161,37 @@ declare class TcgPriser {
2850
3161
  readonly bargains: BargainsResource;
2851
3162
  readonly packRates: PackRatesResource;
2852
3163
  readonly stats: StatsResource;
3164
+ readonly webhooks: WebhooksResource;
3165
+ /** Holds the `HttpClient` so `creditsRemaining` can read the running value off it. */
3166
+ private readonly http;
2853
3167
  /**
2854
3168
  * @param optionsOrAuthToken A subscriber's API token (`new TcgPriser(myApiToken)`), a full
2855
3169
  * `TcgPriserOptions` object, or omit it entirely for an anonymous, public-only client.
2856
3170
  */
2857
3171
  constructor(optionsOrAuthToken?: string | TcgPriserOptions);
3172
+ /**
3173
+ * Credits left in this week's allowance, as of the last charged call this client made.
3174
+ *
3175
+ * The API returns `X-Credits-Remaining` on every response it charges for, so this needs no extra
3176
+ * request — but it is only as current as your last premium call, and it is `undefined` until you
3177
+ * make one. Uncharged calls (every public method, and any call authenticated with something other
3178
+ * than an API token) don't update it, because the API doesn't meter them.
3179
+ *
3180
+ * ```ts
3181
+ * await tcgpriser.cards.livePricing('fezandipiti-ex');
3182
+ * if ((tcgpriser.creditsRemaining ?? Infinity) < 100) scheduleFewerRefreshes();
3183
+ * ```
3184
+ *
3185
+ * Reading it in a browser additionally needs the API to expose the header via CORS, which it does.
3186
+ */
3187
+ get creditsRemaining(): number | undefined;
2858
3188
  }
2859
3189
  /** The stable error codes the API's `error.code` field can hold. */
2860
- type TcgPriserErrorCode = 'validationFailed' | 'unauthorized' | 'forbidden' | 'notFound' | 'conflict' | 'readOnlyField' | 'rateLimited' | 'premiumRequired' | 'internalError'
3190
+ type TcgPriserErrorCode = 'validationFailed' | 'unauthorized' | 'forbidden' | 'notFound' | 'conflict' | 'readOnlyField' | 'rateLimited' | 'premiumRequired' | 'businessRequired' | 'creditsExhausted' | 'internalError'
3191
+ /** The request exceeded its `timeoutMs` and was aborted client-side. Never sent by the API — the
3192
+ * one code this package raises on its own, so a stalled connection is distinguishable from a
3193
+ * server that answered. */
3194
+ | 'timeout'
2861
3195
  /** Response body wasn't the `{ error: { code, message } }` shape. Probably a proxy or gateway
2862
3196
  * error in front of the API. */
2863
3197
  | 'unknown';
@@ -2871,6 +3205,18 @@ declare class TcgPriserError extends Error {
2871
3205
  readonly details: unknown;
2872
3206
  /** The raw response body, for debugging when `code`/`details` don't cover what you need. */
2873
3207
  readonly body: string;
3208
+ /**
3209
+ * Seconds to wait before retrying, from the `Retry-After` header. Present on `rateLimited`, and
3210
+ * on anything else a proxy in front of the API decides to send it with. Absent otherwise — an
3211
+ * error without it is not one that says retrying will help.
3212
+ */
3213
+ readonly retryAfter: number | undefined;
3214
+ /**
3215
+ * Credits left in this week's allowance, from `X-Credits-Remaining`. Present on errors from
3216
+ * charged routes — notably `creditsExhausted`, where it is `0`. Absent on uncharged routes and on
3217
+ * anything a proxy answered instead of the API.
3218
+ */
3219
+ readonly creditsRemaining: number | undefined;
2874
3220
  constructor(params: {
2875
3221
  statusCode: number;
2876
3222
  statusText: string;
@@ -2879,6 +3225,8 @@ declare class TcgPriserError extends Error {
2879
3225
  message: string;
2880
3226
  details?: unknown;
2881
3227
  body: string;
3228
+ retryAfter?: number;
3229
+ creditsRemaining?: number;
2882
3230
  });
2883
3231
  }
2884
- export { type AlternativeName, type AssignShopUrlProductParams, type Bargain, type BargainInfo, type BargainProductRef, type BargainReferenceSource, type BrandRef, type Card, type CardMatchesParams, type CardPricesParams, type CardReferencePricesParams, type CardType, type CardVariants, type CatalogItem, type CatalogItemPricing, type CategoryRef, type CompareShopPricesParams, type CurrencyCode, DEFAULT_BASE_URL, type DailyPricePoint, type DailyPriceStatsParams, type EstimatedValue, type EstimatedValuesParams, type Expansion, type ExpansionCard, type ExpansionContents, type ExpansionLivePricing, type ExpansionRef, type ExpansionSealedProduct, type GradingCompany, type ItemCondition, type ItemDailyStats, type ItemEstimatedValue, type ItemFullStats, type ItemPriceComparison, type ItemRef, type ItemReferencePrices, type ItemShopMatch, type ItemShopMatches, type ItemShopPriceHistory, type ItemSoldPrices, type ItemStats, type ItemVariantDailyStats, type ItemVariantStats, type ListBargainsParams, type ListCardsParams, type ListProductsParams, type ListResponse, type ListShopMatchesParams, type ListShopsParams, type LivePricingDetail, type LivePricingForItem, type LowestShopOffer, type MatchShop, type MatchedItemRef, type PackRate, type PackRateBucket, type PackSlot, type PageMeta, type PaginationParams, type PlatformStats, type PremiumOptions, type PrintingLanguage, type ProductByVariantParams, type ProductDailyByVariantParams, type ProductDailyStatsParams, type ProductFilterParams, type ProductMatchesParams, type ProductPricesParams, type ProductReferencePricesParams, type ReferencePriceCardVariant, type ReferencePriceCurrencyMode, type ReferencePriceMetric, type ReferencePriceProvider, type ReferencePriceSeries, type ReferencePriceSeriesPoint, type ReferencePriceSnapshot, type ReferencePriceSnapshotsByProvider, type ReferencePriceSource, type ResourceId, type SealedProduct, type SearchBargainsParams, type Shop, type ShopItemPriceHistory, type ShopMatch, type ShopMatchDelivery, type ShopMatchStats, type ShopMatchStatsForProductParams, type ShopMatchStatsForShopParams, type ShopMatchesForShop, type ShopMatchesForShopParams, type ShopPriceComparisonRow, type ShopPriceComparisonStats, type ShopPriceHistory, type ShopPriceHistoryList, type ShopPricePoint, type ShopRef, type ShopSummary, type ShopUrl, type ShopUrlDiscoveredBy, type ShopUrlMutationResult, type ShopUrlStatus, type SoldPrice, type StatsItemRef, type SubmitShopUrlParams, TcgPriser, TcgPriserError, type TcgPriserErrorCode, type TcgPriserOptions, type Timestamp, type TopItem, type TopProductsParams, type VariantPriceStat, type VariantSelector, type VariantStatsSummary, type components };
3232
+ export { type Acknowledgement, type AlternativeName, type AssignShopUrlProductParams, type Bargain, type BargainInfo, type BargainProductRef, type BargainReferenceSource, type BrandRef, type Card, type CardDailyStatsParams, type CardEstimatedValuesParams, type CardMatchesParams, type CardPricesParams, type CardReferencePricesParams, type CardType, type CardVariants, type CatalogItem, type CatalogItemPricing, type CatalogSlug, type CategoryRef, type CompareShopPricesParams, type CreateWebhookParams, type CurrencyCode, DEFAULT_BASE_URL, DEFAULT_TIMEOUT_MS, type DailyPricePoint, type DailyPriceStatsParams, type EstimatedValue, type EstimatedValuesParams, type Expansion, type ExpansionLivePricing, type ExpansionRef, type GradingCompany, type ItemCondition, type ItemDailyStats, type ItemEstimatedValue, type ItemFullStats, type ItemPriceComparison, type ItemRef, type ItemReferencePrices, type ItemShopMatch, type ItemShopMatches, type ItemShopPriceHistory, type ItemSoldPrices, type ItemStats, type ItemVariantDailyStats, type ItemVariantStats, type ListBargainsParams, type ListCardsParams, type ListProductsParams, type ListResponse, type ListShopMatchesParams, type ListShopsParams, type LivePricingDetail, type LivePricingForItem, type LowestShopOffer, type MatchShop, type MatchedItemRef, type PackRate, type PackRateBucket, type PackSlot, type PageMeta, type PaginationParams, type PlatformStats, type PremiumOptions, type PrintingLanguage, type ProductByVariantParams, type ProductDailyByVariantParams, type ProductDailyPriceStatsParams, type ProductDailyStatsParams, type ProductEstimatedValuesParams, type ProductFilterParams, type ProductMatchesParams, type ProductPricesParams, type ProductReferencePricesParams, type ReferencePriceCardVariant, type ReferencePriceCurrencyMode, type ReferencePriceMetric, type ReferencePriceProvider, type ReferencePriceSeries, type ReferencePriceSeriesPoint, type ReferencePriceSnapshot, type ReferencePriceSnapshotsByProvider, type ReferencePriceSource, type RequestOptions, type ResourceId, type SealedProduct, type SearchBargainsParams, type SearchCardsParams, type SearchProductsParams, type Shop, type ShopItemPriceHistory, type ShopMatch, type ShopMatchDelivery, type ShopMatchStats, type ShopMatchStatsForProductParams, type ShopMatchStatsForShopParams, type ShopMatchesForShop, type ShopMatchesForShopParams, type ShopPriceComparisonRow, type ShopPriceComparisonStats, type ShopPriceHistory, type ShopPriceHistoryList, type ShopPricePoint, type ShopRef, type ShopSummary, type ShopUrl, type ShopUrlDiscoveredBy, type ShopUrlMutationResult, type ShopUrlStatus, type SoldPrice, type StatsItemRef, type SubmitShopUrlParams, TcgPriser, type TcgPriserAdvancedOptions, TcgPriserError, type TcgPriserErrorCode, type TcgPriserOptions, type Timestamp, type TopItem, type TopProductsParams, type VariantPriceStat, type VariantSelector, type VariantStatsSummary, type Webhook, type WebhookDeliveryStatus, type WebhookEvent, type WebhookTestResult, type WebhookWithSecret, type components };