tcgpriser 0.10.0 → 1.0.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/README.md +214 -19
- package/dist/index.cjs +335 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +576 -79
- package/dist/index.d.ts +576 -79
- package/dist/index.js +335 -85
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* `
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
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?:
|
|
26
|
-
post<T>(path: string, body: unknown, requestOptions?:
|
|
27
|
-
patch<T>(path: string, body: unknown, requestOptions?:
|
|
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;
|
|
@@ -102,6 +140,10 @@ interface components {
|
|
|
102
140
|
name: string;
|
|
103
141
|
/** @example pokemon */
|
|
104
142
|
technicalName: string;
|
|
143
|
+
/**
|
|
144
|
+
* @description Absolute asset URL, or undefined when absent.
|
|
145
|
+
*/
|
|
146
|
+
imageUrl: string | undefined;
|
|
105
147
|
/**
|
|
106
148
|
* Format: date-time
|
|
107
149
|
* @example 2026-07-15T12:03:29.322Z
|
|
@@ -124,6 +166,8 @@ interface components {
|
|
|
124
166
|
technicalName: string;
|
|
125
167
|
brand: components["schemas"]["Brand"];
|
|
126
168
|
manufacturer: string;
|
|
169
|
+
/** @enum {string} */
|
|
170
|
+
productLine: "tcg" | "accessory" | "collectible" | "boardGame" | "videoGame" | "other";
|
|
127
171
|
modelNumber: string | undefined;
|
|
128
172
|
category: components["schemas"]["CategoryRef"] | undefined;
|
|
129
173
|
expansion: components["schemas"]["ExpansionRef"] | undefined;
|
|
@@ -132,7 +176,7 @@ interface components {
|
|
|
132
176
|
* @example JPN
|
|
133
177
|
* @enum {string|null}
|
|
134
178
|
*/
|
|
135
|
-
language: "ENG" | "JPN" | "CHI" | undefined;
|
|
179
|
+
language: "ENG" | "JPN" | "CHI" | "KOR" | "SPA" | "GER" | "FRA" | "ITA" | "POR" | "RUS" | undefined;
|
|
136
180
|
alternativeNames: components["schemas"]["AlternativeName"][];
|
|
137
181
|
supportsMultipackPricing: boolean;
|
|
138
182
|
/**
|
|
@@ -264,7 +308,7 @@ interface components {
|
|
|
264
308
|
* @example JPN
|
|
265
309
|
* @enum {string}
|
|
266
310
|
*/
|
|
267
|
-
language: "ENG" | "JPN" | "CHI";
|
|
311
|
+
language: "ENG" | "JPN" | "CHI" | "KOR" | "SPA" | "GER" | "FRA" | "ITA" | "POR" | "RUS";
|
|
268
312
|
/** @example m6a */
|
|
269
313
|
code: string | undefined;
|
|
270
314
|
/** @example m6a */
|
|
@@ -329,12 +373,16 @@ interface components {
|
|
|
329
373
|
shortName: string;
|
|
330
374
|
/** @example jpn-mega-evolution-30th-celebration */
|
|
331
375
|
technicalName: string;
|
|
376
|
+
/**
|
|
377
|
+
* @description The expansion's owning brand. Undefined only for legacy diagnostic responses that cannot populate it.
|
|
378
|
+
*/
|
|
379
|
+
brand: components["schemas"]["Brand"] | undefined;
|
|
332
380
|
/**
|
|
333
381
|
* @description Printing language of the item
|
|
334
382
|
* @example JPN
|
|
335
383
|
* @enum {string}
|
|
336
384
|
*/
|
|
337
|
-
language: "ENG" | "JPN" | "CHI";
|
|
385
|
+
language: "ENG" | "JPN" | "CHI" | "KOR" | "SPA" | "GER" | "FRA" | "ITA" | "POR" | "RUS";
|
|
338
386
|
/** @example m6a */
|
|
339
387
|
code: string | undefined;
|
|
340
388
|
/** @example m6a */
|
|
@@ -600,6 +648,8 @@ interface components {
|
|
|
600
648
|
technicalName: string;
|
|
601
649
|
brand: components["schemas"]["Brand"];
|
|
602
650
|
manufacturer: string;
|
|
651
|
+
/** @enum {string} */
|
|
652
|
+
productLine: "tcg" | "accessory" | "collectible" | "boardGame" | "videoGame" | "other";
|
|
603
653
|
modelNumber: string | undefined;
|
|
604
654
|
category: components["schemas"]["CategoryRef"] | undefined;
|
|
605
655
|
expansion: components["schemas"]["ExpansionRef"] | undefined;
|
|
@@ -608,7 +658,7 @@ interface components {
|
|
|
608
658
|
* @example JPN
|
|
609
659
|
* @enum {string|null}
|
|
610
660
|
*/
|
|
611
|
-
language: "ENG" | "JPN" | "CHI" | undefined;
|
|
661
|
+
language: "ENG" | "JPN" | "CHI" | "KOR" | "SPA" | "GER" | "FRA" | "ITA" | "POR" | "RUS" | undefined;
|
|
612
662
|
alternativeNames: components["schemas"]["AlternativeName"][];
|
|
613
663
|
supportsMultipackPricing: boolean;
|
|
614
664
|
/**
|
|
@@ -1078,6 +1128,70 @@ interface components {
|
|
|
1078
1128
|
looseCount: number;
|
|
1079
1129
|
gradedCount: number;
|
|
1080
1130
|
};
|
|
1131
|
+
Webhook: {
|
|
1132
|
+
/**
|
|
1133
|
+
* @description Resource identifier
|
|
1134
|
+
* @example 6a577711abc1ce71383d3e10
|
|
1135
|
+
*/
|
|
1136
|
+
id: string;
|
|
1137
|
+
url: string;
|
|
1138
|
+
events: components["schemas"]["WebhookEvent"][];
|
|
1139
|
+
isActive: boolean;
|
|
1140
|
+
/**
|
|
1141
|
+
* Format: date-time
|
|
1142
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
1143
|
+
*/
|
|
1144
|
+
lastDeliveryAt: string | undefined;
|
|
1145
|
+
/** @enum {string|null} */
|
|
1146
|
+
lastDeliveryStatus: "success" | "failed" | undefined;
|
|
1147
|
+
/**
|
|
1148
|
+
* Format: date-time
|
|
1149
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
1150
|
+
*/
|
|
1151
|
+
createdAt: string;
|
|
1152
|
+
/**
|
|
1153
|
+
* Format: date-time
|
|
1154
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
1155
|
+
*/
|
|
1156
|
+
updatedAt: string;
|
|
1157
|
+
};
|
|
1158
|
+
/** @enum {string} */
|
|
1159
|
+
WebhookEvent: "price.updated" | "bargain.found" | "product.created" | "card.created";
|
|
1160
|
+
WebhookList: {
|
|
1161
|
+
data: components["schemas"]["Webhook"][];
|
|
1162
|
+
pagination: components["schemas"]["PageMeta"];
|
|
1163
|
+
};
|
|
1164
|
+
WebhookSecret: {
|
|
1165
|
+
/**
|
|
1166
|
+
* @description Resource identifier
|
|
1167
|
+
* @example 6a577711abc1ce71383d3e10
|
|
1168
|
+
*/
|
|
1169
|
+
id: string;
|
|
1170
|
+
url: string;
|
|
1171
|
+
events: components["schemas"]["WebhookEvent"][];
|
|
1172
|
+
isActive: boolean;
|
|
1173
|
+
/**
|
|
1174
|
+
* Format: date-time
|
|
1175
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
1176
|
+
*/
|
|
1177
|
+
lastDeliveryAt: string | undefined;
|
|
1178
|
+
/** @enum {string|null} */
|
|
1179
|
+
lastDeliveryStatus: "success" | "failed" | undefined;
|
|
1180
|
+
/**
|
|
1181
|
+
* Format: date-time
|
|
1182
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
1183
|
+
*/
|
|
1184
|
+
createdAt: string;
|
|
1185
|
+
/**
|
|
1186
|
+
* Format: date-time
|
|
1187
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
1188
|
+
*/
|
|
1189
|
+
updatedAt: string;
|
|
1190
|
+
secret: string;
|
|
1191
|
+
};
|
|
1192
|
+
WebhookTestResult: {
|
|
1193
|
+
message: string;
|
|
1194
|
+
};
|
|
1081
1195
|
};
|
|
1082
1196
|
responses: never;
|
|
1083
1197
|
parameters: never;
|
|
@@ -1107,6 +1221,8 @@ type CardSchema = {
|
|
|
1107
1221
|
technicalName: string;
|
|
1108
1222
|
brand: BrandRef;
|
|
1109
1223
|
manufacturer: string;
|
|
1224
|
+
/** @enum {string} */
|
|
1225
|
+
productLine: "tcg" | "accessory" | "collectible" | "boardGame" | "videoGame" | "other";
|
|
1110
1226
|
modelNumber: string | undefined;
|
|
1111
1227
|
category: CategoryRef | undefined;
|
|
1112
1228
|
expansion: ExpansionRef | undefined;
|
|
@@ -1115,7 +1231,7 @@ type CardSchema = {
|
|
|
1115
1231
|
* @example JPN
|
|
1116
1232
|
* @enum {string|null}
|
|
1117
1233
|
*/
|
|
1118
|
-
language: "ENG" | "JPN" | "CHI" | undefined;
|
|
1234
|
+
language: "ENG" | "JPN" | "CHI" | "KOR" | "SPA" | "GER" | "FRA" | "ITA" | "POR" | "RUS" | undefined;
|
|
1119
1235
|
alternativeNames: AlternativeName[];
|
|
1120
1236
|
supportsMultipackPricing: boolean;
|
|
1121
1237
|
/**
|
|
@@ -1183,7 +1299,13 @@ type ResourceId = string;
|
|
|
1183
1299
|
type CurrencyCode = string;
|
|
1184
1300
|
/** ISO 8601 timestamp, as returned by the API (always UTC, `Z`-suffixed). */
|
|
1185
1301
|
type Timestamp = string;
|
|
1186
|
-
type PrintingLanguage = "ENG" | "JPN" | "CHI";
|
|
1302
|
+
type PrintingLanguage = "ENG" | "JPN" | "CHI" | "KOR" | "SPA" | "GER" | "FRA" | "ITA" | "POR" | "RUS";
|
|
1303
|
+
/** What universe of product an item is — `'tcg'` for every card and sealed product today, plus
|
|
1304
|
+
* `'accessory'`/`'collectible'`/`'boardGame'`/`'videoGame'`/`'other'` for non-TCG catalogue items.
|
|
1305
|
+
* Orthogonal to `kind` (which endpoint returned it: `cards` vs `products`) and to `category` (the
|
|
1306
|
+
* specific group within a product line, e.g. "Booster Box"). The value `productLine` filters on
|
|
1307
|
+
* `cards.list()`/`products.list()` accept. */
|
|
1308
|
+
type ProductLine = "tcg" | "accessory" | "collectible" | "boardGame" | "videoGame" | "other";
|
|
1187
1309
|
type PageMeta = {
|
|
1188
1310
|
/** @description Total matching records, ignoring pagination */
|
|
1189
1311
|
total: number;
|
|
@@ -1198,8 +1320,14 @@ interface ListResponse<T> {
|
|
|
1198
1320
|
data: T[];
|
|
1199
1321
|
pagination: PageMeta;
|
|
1200
1322
|
}
|
|
1201
|
-
/**
|
|
1202
|
-
|
|
1323
|
+
/**
|
|
1324
|
+
* Query params shared by every offset-paginated list endpoint.
|
|
1325
|
+
*
|
|
1326
|
+
* Extends `RequestOptions` so `signal` and `timeoutMs` can be passed inline alongside the filters,
|
|
1327
|
+
* rather than as a second argument on some methods and a merged field on others. `splitRequestOptions`
|
|
1328
|
+
* strips them back out before the query string is built, so they never reach the URL.
|
|
1329
|
+
*/
|
|
1330
|
+
interface PaginationParams extends RequestOptions {
|
|
1203
1331
|
limit?: number;
|
|
1204
1332
|
skip?: number;
|
|
1205
1333
|
}
|
|
@@ -1222,6 +1350,10 @@ type BrandRef = {
|
|
|
1222
1350
|
name: string;
|
|
1223
1351
|
/** @example pokemon */
|
|
1224
1352
|
technicalName: string;
|
|
1353
|
+
/**
|
|
1354
|
+
* @description Absolute asset URL, or undefined when absent.
|
|
1355
|
+
*/
|
|
1356
|
+
imageUrl: string | undefined;
|
|
1225
1357
|
/**
|
|
1226
1358
|
* Format: date-time
|
|
1227
1359
|
* @example 2026-07-15T12:03:29.322Z
|
|
@@ -1244,8 +1376,9 @@ type CategoryRef = {
|
|
|
1244
1376
|
/** @example booster-box */
|
|
1245
1377
|
technicalName: string;
|
|
1246
1378
|
};
|
|
1247
|
-
/** The expansion shape embedded on cards, products and pack rates
|
|
1248
|
-
*
|
|
1379
|
+
/** The expansion shape embedded on cards, products and pack rates, and returned by
|
|
1380
|
+
* `client.expansions.get()`. It includes the owning `brand`, but not the aggregation counts that
|
|
1381
|
+
* only `client.expansions.list()` computes. */
|
|
1249
1382
|
type ExpansionRef = {
|
|
1250
1383
|
/**
|
|
1251
1384
|
* @description Resource identifier
|
|
@@ -1258,12 +1391,16 @@ type ExpansionRef = {
|
|
|
1258
1391
|
shortName: string;
|
|
1259
1392
|
/** @example jpn-mega-evolution-30th-celebration */
|
|
1260
1393
|
technicalName: string;
|
|
1394
|
+
/**
|
|
1395
|
+
* @description The expansion's owning brand. Undefined only for legacy diagnostic responses that cannot populate it.
|
|
1396
|
+
*/
|
|
1397
|
+
brand: BrandRef | undefined;
|
|
1261
1398
|
/**
|
|
1262
1399
|
* @description Printing language of the item
|
|
1263
1400
|
* @example JPN
|
|
1264
1401
|
* @enum {string}
|
|
1265
1402
|
*/
|
|
1266
|
-
language: "ENG" | "JPN" | "CHI";
|
|
1403
|
+
language: "ENG" | "JPN" | "CHI" | "KOR" | "SPA" | "GER" | "FRA" | "ITA" | "POR" | "RUS";
|
|
1267
1404
|
/** @example m6a */
|
|
1268
1405
|
code: string | undefined;
|
|
1269
1406
|
/** @example m6a */
|
|
@@ -1331,6 +1468,38 @@ type ReferencePriceSnapshot = {
|
|
|
1331
1468
|
type ReferencePriceProvider = "tradera" | "cardmarket" | "tcgplayer" | "ebay";
|
|
1332
1469
|
/** Keyed by provider, at most one snapshot per provider. */
|
|
1333
1470
|
type ReferencePriceSnapshotsByProvider = Partial<Record<ReferencePriceProvider, ReferencePriceSnapshot>>;
|
|
1471
|
+
/** A brand/franchise (e.g. "Pokémon"), as returned by `client.brands.list()` /
|
|
1472
|
+
* `client.brands.get()`. Same shape as `BrandRef` (the form embedded on `Card`/`SealedProduct`/
|
|
1473
|
+
* `Expansion`) today — kept as its own named type for symmetry with `Shop`/`ShopRef` and
|
|
1474
|
+
* `Expansion`/`ExpansionRef`, in case the two diverge later. `imageUrl` is the CDN-hosted brand
|
|
1475
|
+
* mark when one has been uploaded. This is the value `brand` filters on
|
|
1476
|
+
* `cards.list()`, `products.list()` and `expansions.list()` accept (either `id` or
|
|
1477
|
+
* `technicalName`). */
|
|
1478
|
+
type Brand = {
|
|
1479
|
+
/**
|
|
1480
|
+
* @description Resource identifier
|
|
1481
|
+
* @example 6a577711abc1ce71383d3e10
|
|
1482
|
+
*/
|
|
1483
|
+
id: string;
|
|
1484
|
+
/** @example Pokémon */
|
|
1485
|
+
name: string;
|
|
1486
|
+
/** @example pokemon */
|
|
1487
|
+
technicalName: string;
|
|
1488
|
+
/**
|
|
1489
|
+
* @description Absolute asset URL, or undefined when absent.
|
|
1490
|
+
*/
|
|
1491
|
+
imageUrl: string | undefined;
|
|
1492
|
+
/**
|
|
1493
|
+
* Format: date-time
|
|
1494
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
1495
|
+
*/
|
|
1496
|
+
createdAt: string;
|
|
1497
|
+
/**
|
|
1498
|
+
* Format: date-time
|
|
1499
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
1500
|
+
*/
|
|
1501
|
+
updatedAt: string;
|
|
1502
|
+
};
|
|
1334
1503
|
/** A card, as returned by `client.cards.get()` / `client.cards.list()`, and as embedded in
|
|
1335
1504
|
* `client.expansions.cards()`. `kind: 'card'` is a literal on the generated type, which is what
|
|
1336
1505
|
* makes `CatalogItem` (below) discriminate cleanly. Content only — no pricing fields; fetch those
|
|
@@ -1346,6 +1515,8 @@ type Card = {
|
|
|
1346
1515
|
technicalName: string;
|
|
1347
1516
|
brand: BrandRef;
|
|
1348
1517
|
manufacturer: string;
|
|
1518
|
+
/** @enum {string} */
|
|
1519
|
+
productLine: "tcg" | "accessory" | "collectible" | "boardGame" | "videoGame" | "other";
|
|
1349
1520
|
modelNumber: string | undefined;
|
|
1350
1521
|
category: CategoryRef | undefined;
|
|
1351
1522
|
expansion: ExpansionRef | undefined;
|
|
@@ -1354,7 +1525,7 @@ type Card = {
|
|
|
1354
1525
|
* @example JPN
|
|
1355
1526
|
* @enum {string|null}
|
|
1356
1527
|
*/
|
|
1357
|
-
language: "ENG" | "JPN" | "CHI" | undefined;
|
|
1528
|
+
language: "ENG" | "JPN" | "CHI" | "KOR" | "SPA" | "GER" | "FRA" | "ITA" | "POR" | "RUS" | undefined;
|
|
1358
1529
|
alternativeNames: AlternativeName[];
|
|
1359
1530
|
supportsMultipackPricing: boolean;
|
|
1360
1531
|
/**
|
|
@@ -1400,6 +1571,8 @@ type SealedProduct = {
|
|
|
1400
1571
|
technicalName: string;
|
|
1401
1572
|
brand: BrandRef;
|
|
1402
1573
|
manufacturer: string;
|
|
1574
|
+
/** @enum {string} */
|
|
1575
|
+
productLine: "tcg" | "accessory" | "collectible" | "boardGame" | "videoGame" | "other";
|
|
1403
1576
|
modelNumber: string | undefined;
|
|
1404
1577
|
category: CategoryRef | undefined;
|
|
1405
1578
|
expansion: ExpansionRef | undefined;
|
|
@@ -1408,7 +1581,7 @@ type SealedProduct = {
|
|
|
1408
1581
|
* @example JPN
|
|
1409
1582
|
* @enum {string|null}
|
|
1410
1583
|
*/
|
|
1411
|
-
language: "ENG" | "JPN" | "CHI" | undefined;
|
|
1584
|
+
language: "ENG" | "JPN" | "CHI" | "KOR" | "SPA" | "GER" | "FRA" | "ITA" | "POR" | "RUS" | undefined;
|
|
1412
1585
|
alternativeNames: AlternativeName[];
|
|
1413
1586
|
supportsMultipackPricing: boolean;
|
|
1414
1587
|
/**
|
|
@@ -1478,6 +1651,17 @@ type CardVariants = {
|
|
|
1478
1651
|
firstEdition: boolean;
|
|
1479
1652
|
wPromo: boolean;
|
|
1480
1653
|
};
|
|
1654
|
+
/** One entry from `client.cards.technicalNames()` / `client.products.technicalNames()`: a slug and
|
|
1655
|
+
* when that item last changed. Enough to build a sitemap or decide what to re-fetch, without paying
|
|
1656
|
+
* for the full catalog page. */
|
|
1657
|
+
type CatalogSlug = {
|
|
1658
|
+
technicalName: string;
|
|
1659
|
+
/**
|
|
1660
|
+
* Format: date-time
|
|
1661
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
1662
|
+
*/
|
|
1663
|
+
updatedAt: string;
|
|
1664
|
+
};
|
|
1481
1665
|
/** The compact item reference used inside flat shop-match rows (`client.shopMatches.list()` /
|
|
1482
1666
|
* `.forShop()`), enough to render a result list, not the full `CatalogItem`. */
|
|
1483
1667
|
type MatchedItemRef = {
|
|
@@ -1559,7 +1743,7 @@ type BargainProductRef = {
|
|
|
1559
1743
|
/** A set/expansion, as returned by `client.expansions.list()`. This is the full record, including
|
|
1560
1744
|
* the `sealedCount`/`cardCount`/`productCount` aggregation `list()` runs. The `expansion` field
|
|
1561
1745
|
* embedded on a card or product, and the result of `client.expansions.get()`, are the smaller
|
|
1562
|
-
* `ExpansionRef` from `types/common.ts` instead
|
|
1746
|
+
* `ExpansionRef` from `types/common.ts` instead; both shapes include the owning `brand`. */
|
|
1563
1747
|
type Expansion = {
|
|
1564
1748
|
/**
|
|
1565
1749
|
* @description Resource identifier
|
|
@@ -1577,7 +1761,7 @@ type Expansion = {
|
|
|
1577
1761
|
* @example JPN
|
|
1578
1762
|
* @enum {string}
|
|
1579
1763
|
*/
|
|
1580
|
-
language: "ENG" | "JPN" | "CHI";
|
|
1764
|
+
language: "ENG" | "JPN" | "CHI" | "KOR" | "SPA" | "GER" | "FRA" | "ITA" | "POR" | "RUS";
|
|
1581
1765
|
/** @example m6a */
|
|
1582
1766
|
code: string | undefined;
|
|
1583
1767
|
/** @example m6a */
|
|
@@ -2124,6 +2308,8 @@ type StatsItemRef = {
|
|
|
2124
2308
|
technicalName: string;
|
|
2125
2309
|
brand: BrandRef;
|
|
2126
2310
|
manufacturer: string;
|
|
2311
|
+
/** @enum {string} */
|
|
2312
|
+
productLine: "tcg" | "accessory" | "collectible" | "boardGame" | "videoGame" | "other";
|
|
2127
2313
|
modelNumber: string | undefined;
|
|
2128
2314
|
category: CategoryRef | undefined;
|
|
2129
2315
|
expansion: ExpansionRef | undefined;
|
|
@@ -2132,7 +2318,7 @@ type StatsItemRef = {
|
|
|
2132
2318
|
* @example JPN
|
|
2133
2319
|
* @enum {string|null}
|
|
2134
2320
|
*/
|
|
2135
|
-
language: "ENG" | "JPN" | "CHI" | undefined;
|
|
2321
|
+
language: "ENG" | "JPN" | "CHI" | "KOR" | "SPA" | "GER" | "FRA" | "ITA" | "POR" | "RUS" | undefined;
|
|
2136
2322
|
alternativeNames: AlternativeName[];
|
|
2137
2323
|
supportsMultipackPricing: boolean;
|
|
2138
2324
|
/**
|
|
@@ -2173,6 +2359,8 @@ type StatsItemRef = {
|
|
|
2173
2359
|
technicalName: string;
|
|
2174
2360
|
brand: BrandRef;
|
|
2175
2361
|
manufacturer: string;
|
|
2362
|
+
/** @enum {string} */
|
|
2363
|
+
productLine: "tcg" | "accessory" | "collectible" | "boardGame" | "videoGame" | "other";
|
|
2176
2364
|
modelNumber: string | undefined;
|
|
2177
2365
|
category: CategoryRef | undefined;
|
|
2178
2366
|
expansion: ExpansionRef | undefined;
|
|
@@ -2181,7 +2369,7 @@ type StatsItemRef = {
|
|
|
2181
2369
|
* @example JPN
|
|
2182
2370
|
* @enum {string|null}
|
|
2183
2371
|
*/
|
|
2184
|
-
language: "ENG" | "JPN" | "CHI" | undefined;
|
|
2372
|
+
language: "ENG" | "JPN" | "CHI" | "KOR" | "SPA" | "GER" | "FRA" | "ITA" | "POR" | "RUS" | undefined;
|
|
2185
2373
|
alternativeNames: AlternativeName[];
|
|
2186
2374
|
supportsMultipackPricing: boolean;
|
|
2187
2375
|
/**
|
|
@@ -2417,11 +2605,93 @@ type ShopUrlMutationResult = {
|
|
|
2417
2605
|
message: string;
|
|
2418
2606
|
shopUrl: ShopUrl;
|
|
2419
2607
|
};
|
|
2420
|
-
|
|
2608
|
+
/**
|
|
2609
|
+
* Types for the Business tier: outbound webhooks, the one feature that distinguishes Business from
|
|
2610
|
+
* Premium. Everything here needs a Business subscriber's API token — a Premium token answers
|
|
2611
|
+
* `403 businessRequired`.
|
|
2612
|
+
*
|
|
2613
|
+
* Derived from `src/generated/openapi.d.ts`, same as everything else in this directory.
|
|
2614
|
+
*/
|
|
2615
|
+
/** One registered webhook, as returned by `client.webhooks.list()`. Never carries the signing
|
|
2616
|
+
* secret — see `WebhookWithSecret`, which is returned exactly once at registration. */
|
|
2617
|
+
type Webhook = {
|
|
2618
|
+
/**
|
|
2619
|
+
* @description Resource identifier
|
|
2620
|
+
* @example 6a577711abc1ce71383d3e10
|
|
2621
|
+
*/
|
|
2622
|
+
id: string;
|
|
2623
|
+
url: string;
|
|
2624
|
+
events: WebhookEvent[];
|
|
2625
|
+
isActive: boolean;
|
|
2626
|
+
/**
|
|
2627
|
+
* Format: date-time
|
|
2628
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
2629
|
+
*/
|
|
2630
|
+
lastDeliveryAt: string | undefined;
|
|
2631
|
+
/** @enum {string|null} */
|
|
2632
|
+
lastDeliveryStatus: "success" | "failed" | undefined;
|
|
2633
|
+
/**
|
|
2634
|
+
* Format: date-time
|
|
2635
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
2636
|
+
*/
|
|
2637
|
+
createdAt: string;
|
|
2638
|
+
/**
|
|
2639
|
+
* Format: date-time
|
|
2640
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
2641
|
+
*/
|
|
2642
|
+
updatedAt: string;
|
|
2643
|
+
};
|
|
2644
|
+
/** The catalog-wide events a webhook can subscribe to. */
|
|
2645
|
+
type WebhookEvent = "price.updated" | "bargain.found" | "product.created" | "card.created";
|
|
2646
|
+
/** Whether the most recent delivery attempt succeeded. `undefined` until the first attempt. */
|
|
2647
|
+
type WebhookDeliveryStatus = "success" | "failed";
|
|
2648
|
+
/**
|
|
2649
|
+
* What `client.webhooks.create()` returns: a `Webhook` plus the `secret` used to sign deliveries.
|
|
2650
|
+
*
|
|
2651
|
+
* The secret is returned by that one call and never again — there is no endpoint that reads it
|
|
2652
|
+
* back, by design. Store it when you create the webhook; if you lose it, delete the webhook and
|
|
2653
|
+
* register a new one.
|
|
2654
|
+
*/
|
|
2655
|
+
type WebhookWithSecret = {
|
|
2656
|
+
/**
|
|
2657
|
+
* @description Resource identifier
|
|
2658
|
+
* @example 6a577711abc1ce71383d3e10
|
|
2659
|
+
*/
|
|
2660
|
+
id: string;
|
|
2661
|
+
url: string;
|
|
2662
|
+
events: WebhookEvent[];
|
|
2663
|
+
isActive: boolean;
|
|
2664
|
+
/**
|
|
2665
|
+
* Format: date-time
|
|
2666
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
2667
|
+
*/
|
|
2668
|
+
lastDeliveryAt: string | undefined;
|
|
2669
|
+
/** @enum {string|null} */
|
|
2670
|
+
lastDeliveryStatus: "success" | "failed" | undefined;
|
|
2671
|
+
/**
|
|
2672
|
+
* Format: date-time
|
|
2673
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
2674
|
+
*/
|
|
2675
|
+
createdAt: string;
|
|
2676
|
+
/**
|
|
2677
|
+
* Format: date-time
|
|
2678
|
+
* @example 2026-07-15T12:03:29.322Z
|
|
2679
|
+
*/
|
|
2680
|
+
updatedAt: string;
|
|
2681
|
+
secret: string;
|
|
2682
|
+
};
|
|
2683
|
+
/** Response of `client.webhooks.test()`. */
|
|
2684
|
+
type WebhookTestResult = {
|
|
2685
|
+
message: string;
|
|
2686
|
+
};
|
|
2687
|
+
/** Response of `client.webhooks.delete()`. */
|
|
2688
|
+
type Acknowledgement = {
|
|
2689
|
+
message: string;
|
|
2690
|
+
};
|
|
2691
|
+
interface ListBargainsParams extends RequestOptions {
|
|
2421
2692
|
type?: 'sealed' | 'card' | 'all';
|
|
2422
2693
|
}
|
|
2423
2694
|
interface SearchBargainsParams extends PaginationParams {
|
|
2424
|
-
authToken?: string;
|
|
2425
2695
|
type?: 'sealed' | 'card' | 'all';
|
|
2426
2696
|
/** Filter by shop technicalName. */
|
|
2427
2697
|
shop?: string;
|
|
@@ -2449,7 +2719,30 @@ declare class BargainsResource {
|
|
|
2449
2719
|
* threshold, card condition/grade, free-text search). Premium. */
|
|
2450
2720
|
search(params?: SearchBargainsParams): Promise<ListResponse<Bargain>>;
|
|
2451
2721
|
}
|
|
2722
|
+
/** The franchises and makers the catalogue carries — what `brand` filters on `cards.list()`,
|
|
2723
|
+
* `products.list()` and `expansions.list()` accept. Read-only: brand rows are rare and deliberate
|
|
2724
|
+
* on the API side, so there is no create/update method here. */
|
|
2725
|
+
declare class BrandsResource {
|
|
2726
|
+
private readonly http;
|
|
2727
|
+
constructor(http: HttpClient);
|
|
2728
|
+
/** `GET /brands`: every brand. Unwrapped to a plain array, nothing to paginate here — same
|
|
2729
|
+
* shape as `expansions.list()`/`shops.list()`. */
|
|
2730
|
+
list(options?: RequestOptions): Promise<Brand[]>;
|
|
2731
|
+
/** `GET /brands/{id}`: fetch one brand by its id or technicalName. */
|
|
2732
|
+
get(idOrTechnicalName: string, options?: RequestOptions): Promise<Brand>;
|
|
2733
|
+
}
|
|
2452
2734
|
interface ListCardsParams extends PaginationParams {
|
|
2735
|
+
/** Brand `id` or technicalName, e.g. `'pokemon'`. Scopes the listing to one game/universe. An
|
|
2736
|
+
* unrecognized value is a 400, not an empty page. */
|
|
2737
|
+
brand?: string;
|
|
2738
|
+
productLine?: ProductLine;
|
|
2739
|
+
}
|
|
2740
|
+
interface GetCardParams extends RequestOptions {
|
|
2741
|
+
/** Brand `id` or technicalName. Disambiguates a `technicalName` two brands both happen to use —
|
|
2742
|
+
* irrelevant while the catalogue carries only one brand, and unused for an `id` lookup. */
|
|
2743
|
+
brand?: string;
|
|
2744
|
+
}
|
|
2745
|
+
interface SearchCardsParams extends PaginationParams {
|
|
2453
2746
|
/** Free-text search over card and set names. */
|
|
2454
2747
|
search?: string;
|
|
2455
2748
|
}
|
|
@@ -2457,7 +2750,7 @@ interface CardMatchesParams extends PaginationParams {
|
|
|
2457
2750
|
/** Keep only matches whose shop currently has stock. */
|
|
2458
2751
|
inStock?: boolean;
|
|
2459
2752
|
}
|
|
2460
|
-
interface CardReferencePricesParams {
|
|
2753
|
+
interface CardReferencePricesParams extends RequestOptions {
|
|
2461
2754
|
/** Bearer token for this call. Overrides the client's default `authToken`. */
|
|
2462
2755
|
authToken?: string;
|
|
2463
2756
|
/** Rolling window ending today, in days. Ignored when `from`/`to` are supplied. Default 90. */
|
|
@@ -2471,15 +2764,56 @@ interface CardReferencePricesParams {
|
|
|
2471
2764
|
variant?: ReferencePriceCardVariant;
|
|
2472
2765
|
}
|
|
2473
2766
|
interface CardPricesParams extends PaginationParams {
|
|
2474
|
-
|
|
2767
|
+
}
|
|
2768
|
+
/** Filters for `cards.dailyStats()`. Narrow to one card, or to a whole expansion/category. */
|
|
2769
|
+
interface CardDailyStatsParams extends RequestOptions {
|
|
2770
|
+
/** `YYYY-MM-DD` */
|
|
2771
|
+
startDate?: string;
|
|
2772
|
+
/** `YYYY-MM-DD` */
|
|
2773
|
+
endDate?: string;
|
|
2774
|
+
productName?: string;
|
|
2775
|
+
technicalName?: string;
|
|
2776
|
+
/** Category technicalName. */
|
|
2777
|
+
category?: string;
|
|
2778
|
+
/** Expansion technicalName. */
|
|
2779
|
+
expansion?: string;
|
|
2780
|
+
/** Category id (ObjectId), an alternative to `category`. */
|
|
2781
|
+
categoryId?: string;
|
|
2782
|
+
/** Expansion id (ObjectId), an alternative to `expansion`. */
|
|
2783
|
+
expansionId?: string;
|
|
2784
|
+
/** Brand technicalName. */
|
|
2785
|
+
brand?: string;
|
|
2786
|
+
/** Brand id (ObjectId), an alternative to `brand`. */
|
|
2787
|
+
brandId?: string;
|
|
2788
|
+
productLine?: ProductLine;
|
|
2789
|
+
}
|
|
2790
|
+
/** Filters for `cards.estimatedValues()`. Note `page`/`limit`, not the `limit`/`skip` the rest of
|
|
2791
|
+
* the API paginates with — this endpoint predates that convention. */
|
|
2792
|
+
interface CardEstimatedValuesParams extends RequestOptions {
|
|
2793
|
+
page?: number;
|
|
2794
|
+
limit?: number;
|
|
2795
|
+
productName?: string;
|
|
2796
|
+
technicalName?: string;
|
|
2797
|
+
/** Category technicalName. */
|
|
2798
|
+
category?: string;
|
|
2799
|
+
/** Expansion technicalName. */
|
|
2800
|
+
expansion?: string;
|
|
2801
|
+
/** Brand technicalName. */
|
|
2802
|
+
brand?: string;
|
|
2803
|
+
/** Brand id (ObjectId), an alternative to `brand`. */
|
|
2804
|
+
brandId?: string;
|
|
2805
|
+
productLine?: ProductLine;
|
|
2475
2806
|
}
|
|
2476
2807
|
declare class CardsResource {
|
|
2477
2808
|
private readonly http;
|
|
2478
2809
|
constructor(http: HttpClient);
|
|
2479
|
-
/** `GET /cards`: search
|
|
2810
|
+
/** `GET /cards`: list cards, newest first. No free-text search — use `search()` for that. */
|
|
2480
2811
|
list(params?: ListCardsParams): Promise<ListResponse<Card>>;
|
|
2481
|
-
/** `GET /cards/
|
|
2482
|
-
|
|
2812
|
+
/** `GET /cards/search`: like `list()`, but with free-text search on card and set names. Premium. */
|
|
2813
|
+
search(params?: SearchCardsParams): Promise<ListResponse<Card>>;
|
|
2814
|
+
/** `GET /cards/{id}`: fetch one card by its id or technicalName. Pass `brand` if two brands
|
|
2815
|
+
* might share the same technicalName — see `GetCardParams`. */
|
|
2816
|
+
get(idOrTechnicalName: string, params?: GetCardParams): Promise<Card>;
|
|
2483
2817
|
/** `GET /cards/{id}/matches`: current shop listings matched to this card (latest per shop). */
|
|
2484
2818
|
matches(idOrTechnicalName: string, params?: CardMatchesParams): Promise<ItemShopMatches>;
|
|
2485
2819
|
/** `GET /cards/{id}/reference-prices`: Cardmarket/TCGplayer/eBay/Tradera price history. Premium. */
|
|
@@ -2488,58 +2822,75 @@ declare class CardsResource {
|
|
|
2488
2822
|
prices(idOrTechnicalName: string, params?: CardPricesParams): Promise<ItemSoldPrices>;
|
|
2489
2823
|
/** `GET /cards/{id}/pricing/live`: computed fresh for this request, not read from the last
|
|
2490
2824
|
* stats job. Premium. */
|
|
2491
|
-
livePricing(idOrTechnicalName: string, options?:
|
|
2825
|
+
livePricing(idOrTechnicalName: string, options?: RequestOptions): Promise<LivePricingForItem>;
|
|
2492
2826
|
/** `GET /cards/{id}/pricing`: this card's current pricing snapshot — `retailPrice`,
|
|
2493
2827
|
* `estimatedValue`, `lowestShopOffer`, `referencePriceSnapshotsByProvider` — refreshed once a day
|
|
2494
2828
|
* by the nightly pricing/scraper jobs. `get()` returns content only; this is the separate,
|
|
2495
2829
|
* shorter-cached call for the part of a card that actually changes day to day. */
|
|
2496
|
-
pricing(idOrTechnicalName: string): Promise<CatalogItemPricing>;
|
|
2830
|
+
pricing(idOrTechnicalName: string, options?: RequestOptions): Promise<CatalogItemPricing>;
|
|
2497
2831
|
/** `GET /cards/pricing`: pricing for up to 200 cards in one request, keyed by `id` — the batch
|
|
2498
2832
|
* counterpart to `pricing()`, for a page of results (a search page, an expansion's contents) that
|
|
2499
2833
|
* needs pricing for many items at once. Unlike `get()`/`pricing()`, this only accepts `id`s, not
|
|
2500
2834
|
* technicalNames — pass the `id`s already on the cards you fetched. Ids with no match are
|
|
2501
2835
|
* silently omitted from the result rather than causing an error. */
|
|
2502
|
-
pricingBatch(ids: string[]): Promise<ListResponse<CatalogItemPricing>>;
|
|
2836
|
+
pricingBatch(ids: string[], options?: RequestOptions): Promise<ListResponse<CatalogItemPricing>>;
|
|
2837
|
+
/** `GET /cards/technical-names`: every card's `technicalName` and `updatedAt`, unpaginated and
|
|
2838
|
+
* with no pricing joins. Built for enumerating the whole catalog cheaply — a sitemap, or working
|
|
2839
|
+
* out which items changed since your last sync — where `list()` would make you page through full
|
|
2840
|
+
* card documents to learn the same two fields. */
|
|
2841
|
+
technicalNames(options?: RequestOptions): Promise<ListResponse<CatalogSlug>>;
|
|
2842
|
+
/** `GET /cards/price-stats/daily`: daily average price history, cards only. The same data as
|
|
2843
|
+
* `client.priceStats.daily()`, scoped to the card catalog so a filter like `expansion` can't pull
|
|
2844
|
+
* in that expansion's sealed products too. */
|
|
2845
|
+
dailyStats(params?: CardDailyStatsParams): Promise<ListResponse<ItemDailyStats>>;
|
|
2846
|
+
/** `GET /cards/price-stats/estimated-values`: current estimated market value, cards only. The
|
|
2847
|
+
* card-scoped counterpart to `client.priceStats.estimatedValues()`. */
|
|
2848
|
+
estimatedValues(params?: CardEstimatedValuesParams): Promise<ListResponse<ItemEstimatedValue>>;
|
|
2849
|
+
}
|
|
2850
|
+
interface ListExpansionsParams extends RequestOptions {
|
|
2851
|
+
/** Brand `id` or technicalName, e.g. `'pokemon'`. An unrecognized value is a 400, not an empty
|
|
2852
|
+
* list. */
|
|
2853
|
+
brand?: string;
|
|
2503
2854
|
}
|
|
2504
2855
|
declare class ExpansionsResource {
|
|
2505
2856
|
private readonly http;
|
|
2506
2857
|
constructor(http: HttpClient);
|
|
2507
2858
|
/** `GET /expansions`: every expansion. Unwrapped to a plain array, nothing to paginate here. */
|
|
2508
|
-
list(): Promise<Expansion[]>;
|
|
2859
|
+
list(params?: ListExpansionsParams): Promise<Expansion[]>;
|
|
2509
2860
|
/** `GET /expansions/{technicalName}`: metadata only — no cards or sealed products. Returns the
|
|
2510
2861
|
* smaller `ExpansionRef`, not the full `Expansion`: this is a plain lookup by technicalName, not
|
|
2511
2862
|
* the aggregation `list()` runs, so `sealedCount`/`cardCount`/`productCount` aren't available
|
|
2512
2863
|
* here. See `cards()` and `sealedProducts()` for this expansion's contents. */
|
|
2513
|
-
get(technicalName: string): Promise<ExpansionRef>;
|
|
2864
|
+
get(technicalName: string, options?: RequestOptions): Promise<ExpansionRef>;
|
|
2514
2865
|
/** `GET /expansions/{technicalName}/cards`: every card in this expansion. Content only, no
|
|
2515
2866
|
* pricing fields — pass the `id`s from the result to `client.cards.pricingBatch()` if you need
|
|
2516
2867
|
* pricing too. Sealed products are a separate call — see `sealedProducts()` — never merged into
|
|
2517
2868
|
* this one. */
|
|
2518
|
-
cards(technicalName: string): Promise<ListResponse<Card>>;
|
|
2869
|
+
cards(technicalName: string, options?: RequestOptions): Promise<ListResponse<Card>>;
|
|
2519
2870
|
/** `GET /expansions/{technicalName}/products`: every sealed product in this expansion. Content
|
|
2520
2871
|
* only, no pricing fields — pass the `id`s from the result to `client.products.pricingBatch()`
|
|
2521
2872
|
* if you need pricing too. Cards are a separate call — see `cards()` — never merged into this
|
|
2522
2873
|
* one. */
|
|
2523
|
-
sealedProducts(technicalName: string): Promise<ListResponse<SealedProduct>>;
|
|
2874
|
+
sealedProducts(technicalName: string, options?: RequestOptions): Promise<ListResponse<SealedProduct>>;
|
|
2524
2875
|
/** `GET /expansions/{technicalName}/cards/live-pricing`: computed fresh for every card in this
|
|
2525
2876
|
* expansion, not read from the last stats job. Premium. */
|
|
2526
|
-
cardsLivePricing(technicalName: string, options?:
|
|
2877
|
+
cardsLivePricing(technicalName: string, options?: RequestOptions): Promise<ExpansionLivePricing>;
|
|
2527
2878
|
/** `GET /expansions/{technicalName}/products/live-pricing`: computed fresh for every sealed
|
|
2528
2879
|
* product in this expansion, not read from the last stats job. Premium. */
|
|
2529
|
-
productsLivePricing(technicalName: string, options?:
|
|
2880
|
+
productsLivePricing(technicalName: string, options?: RequestOptions): Promise<ExpansionLivePricing>;
|
|
2530
2881
|
}
|
|
2531
2882
|
declare class PackRatesResource {
|
|
2532
2883
|
private readonly http;
|
|
2533
2884
|
constructor(http: HttpClient);
|
|
2534
2885
|
/** `GET /pack-rates`: pull-rate odds for every expansion that has them. Unwrapped to a plain
|
|
2535
2886
|
* array, nothing to paginate here. */
|
|
2536
|
-
list(): Promise<PackRate[]>;
|
|
2887
|
+
list(options?: RequestOptions): Promise<PackRate[]>;
|
|
2537
2888
|
/** `GET /pack-rates/{expansionId}`: pull-rate odds for one expansion. */
|
|
2538
|
-
get(expansionId: string): Promise<PackRate>;
|
|
2889
|
+
get(expansionId: string, options?: RequestOptions): Promise<PackRate>;
|
|
2539
2890
|
}
|
|
2540
2891
|
/** Filters shared by `daily()` and `estimatedValues()`: all narrow which product(s) the stats
|
|
2541
2892
|
* cover; combine as many as you like. */
|
|
2542
|
-
interface ProductFilterParams {
|
|
2893
|
+
interface ProductFilterParams extends RequestOptions {
|
|
2543
2894
|
productName?: string;
|
|
2544
2895
|
technicalName?: string;
|
|
2545
2896
|
priceChartingId?: string;
|
|
@@ -2548,6 +2899,11 @@ interface ProductFilterParams {
|
|
|
2548
2899
|
category?: string;
|
|
2549
2900
|
/** Expansion technicalName. */
|
|
2550
2901
|
expansion?: string;
|
|
2902
|
+
/** Brand technicalName. */
|
|
2903
|
+
brand?: string;
|
|
2904
|
+
/** Brand id (ObjectId), an alternative to `brand`. */
|
|
2905
|
+
brandId?: string;
|
|
2906
|
+
productLine?: ProductLine;
|
|
2551
2907
|
}
|
|
2552
2908
|
interface DailyPriceStatsParams extends ProductFilterParams {
|
|
2553
2909
|
/** `YYYY-MM-DD` */
|
|
@@ -2563,21 +2919,18 @@ interface EstimatedValuesParams extends ProductFilterParams {
|
|
|
2563
2919
|
page?: number;
|
|
2564
2920
|
limit?: number;
|
|
2565
2921
|
}
|
|
2566
|
-
interface TopProductsParams {
|
|
2922
|
+
interface TopProductsParams extends RequestOptions {
|
|
2567
2923
|
limit?: number;
|
|
2568
2924
|
}
|
|
2569
|
-
interface ProductDailyStatsParams {
|
|
2570
|
-
authToken?: string;
|
|
2925
|
+
interface ProductDailyStatsParams extends RequestOptions {
|
|
2571
2926
|
/** Number of days to retrieve, from today backwards. Default 30. */
|
|
2572
2927
|
days?: number;
|
|
2573
2928
|
}
|
|
2574
|
-
interface ProductByVariantParams {
|
|
2575
|
-
authToken?: string;
|
|
2929
|
+
interface ProductByVariantParams extends RequestOptions {
|
|
2576
2930
|
/** Number of days to include in the average calculation. Default 30. */
|
|
2577
2931
|
days?: number;
|
|
2578
2932
|
}
|
|
2579
|
-
interface ProductDailyByVariantParams {
|
|
2580
|
-
authToken?: string;
|
|
2933
|
+
interface ProductDailyByVariantParams extends RequestOptions {
|
|
2581
2934
|
cardType: CardType;
|
|
2582
2935
|
/** Required when `cardType` is `'loose'`. */
|
|
2583
2936
|
condition?: ItemCondition;
|
|
@@ -2601,18 +2954,18 @@ declare class PriceStatsResource {
|
|
|
2601
2954
|
topProducts(params?: TopProductsParams): Promise<ListResponse<TopItem>>;
|
|
2602
2955
|
/** `GET /price-stats/product/{id}`: daily price history, current estimate, and a variant-count
|
|
2603
2956
|
* summary for one product. Premium. */
|
|
2604
|
-
product(idOrTechnicalName: string, options?:
|
|
2957
|
+
product(idOrTechnicalName: string, options?: RequestOptions): Promise<ItemStats>;
|
|
2605
2958
|
/** `GET /price-stats/product/{id}/full`: everything `product()` has, plus the item's current
|
|
2606
2959
|
* shop matches. Premium. */
|
|
2607
|
-
productFull(idOrTechnicalName: string, options?:
|
|
2960
|
+
productFull(idOrTechnicalName: string, options?: RequestOptions): Promise<ItemFullStats>;
|
|
2608
2961
|
/** `GET /price-stats/product/{id}/daily`: daily price history for one product, with a
|
|
2609
2962
|
* caller-chosen window. Premium. */
|
|
2610
2963
|
productDaily(idOrTechnicalName: string, params?: ProductDailyStatsParams): Promise<ItemDailyStats>;
|
|
2611
2964
|
/** `GET /price-stats/product/{id}/daily-last-30`: daily price history for the last 30 days
|
|
2612
2965
|
* exactly (no window param, for callers that want a stable cache key). Premium. */
|
|
2613
|
-
productDailyLast30(idOrTechnicalName: string, options?:
|
|
2966
|
+
productDailyLast30(idOrTechnicalName: string, options?: RequestOptions): Promise<ItemDailyStats>;
|
|
2614
2967
|
/** `GET /price-stats/product/{id}/estimated-value`: current estimated value only. Premium. */
|
|
2615
|
-
productEstimatedValue(idOrTechnicalName: string, options?:
|
|
2968
|
+
productEstimatedValue(idOrTechnicalName: string, options?: RequestOptions): Promise<ItemEstimatedValue>;
|
|
2616
2969
|
/** `GET /price-stats/product/{id}/by-variant`: price stats broken out per card condition/grade.
|
|
2617
2970
|
* Premium. */
|
|
2618
2971
|
productByVariant(idOrTechnicalName: string, params?: ProductByVariantParams): Promise<ItemVariantStats>;
|
|
@@ -2622,6 +2975,17 @@ declare class PriceStatsResource {
|
|
|
2622
2975
|
productDailyByVariant(idOrTechnicalName: string, params: ProductDailyByVariantParams): Promise<ItemVariantDailyStats>;
|
|
2623
2976
|
}
|
|
2624
2977
|
interface ListProductsParams extends PaginationParams {
|
|
2978
|
+
/** Brand `id` or technicalName, e.g. `'pokemon'`. Scopes the listing to one game/universe. An
|
|
2979
|
+
* unrecognized value is a 400, not an empty page. */
|
|
2980
|
+
brand?: string;
|
|
2981
|
+
productLine?: ProductLine;
|
|
2982
|
+
}
|
|
2983
|
+
interface GetProductParams extends RequestOptions {
|
|
2984
|
+
/** Brand `id` or technicalName. Disambiguates a `technicalName` two brands both happen to use —
|
|
2985
|
+
* irrelevant while the catalogue carries only one brand, and unused for an `id` lookup. */
|
|
2986
|
+
brand?: string;
|
|
2987
|
+
}
|
|
2988
|
+
interface SearchProductsParams extends PaginationParams {
|
|
2625
2989
|
/** Whitespace-separated tokens, each matched against the start of a word. */
|
|
2626
2990
|
search?: string;
|
|
2627
2991
|
}
|
|
@@ -2633,7 +2997,7 @@ interface ProductMatchesParams extends PaginationParams {
|
|
|
2633
2997
|
gradingCompany?: GradingCompany;
|
|
2634
2998
|
grade?: number;
|
|
2635
2999
|
}
|
|
2636
|
-
interface ProductReferencePricesParams {
|
|
3000
|
+
interface ProductReferencePricesParams extends RequestOptions {
|
|
2637
3001
|
authToken?: string;
|
|
2638
3002
|
/** Rolling window ending today, in days. Ignored when `from`/`to` are supplied. Default 90. */
|
|
2639
3003
|
days?: number;
|
|
@@ -2644,17 +3008,63 @@ interface ProductReferencePricesParams {
|
|
|
2644
3008
|
provider?: ReferencePriceProvider;
|
|
2645
3009
|
}
|
|
2646
3010
|
interface ProductPricesParams extends PaginationParams {
|
|
2647
|
-
|
|
3011
|
+
}
|
|
3012
|
+
/** Filters for `products.dailyStats()`. Narrow to one product, or to a whole expansion/category. */
|
|
3013
|
+
interface ProductDailyPriceStatsParams extends RequestOptions {
|
|
3014
|
+
/** `YYYY-MM-DD` */
|
|
3015
|
+
startDate?: string;
|
|
3016
|
+
/** `YYYY-MM-DD` */
|
|
3017
|
+
endDate?: string;
|
|
3018
|
+
productName?: string;
|
|
3019
|
+
technicalName?: string;
|
|
3020
|
+
priceChartingId?: string;
|
|
3021
|
+
modelNumber?: string;
|
|
3022
|
+
/** Category technicalName. */
|
|
3023
|
+
category?: string;
|
|
3024
|
+
/** Expansion technicalName. */
|
|
3025
|
+
expansion?: string;
|
|
3026
|
+
/** Category id (ObjectId), an alternative to `category`. */
|
|
3027
|
+
categoryId?: string;
|
|
3028
|
+
/** Expansion id (ObjectId), an alternative to `expansion`. */
|
|
3029
|
+
expansionId?: string;
|
|
3030
|
+
/** Brand technicalName. */
|
|
3031
|
+
brand?: string;
|
|
3032
|
+
/** Brand id (ObjectId), an alternative to `brand`. */
|
|
3033
|
+
brandId?: string;
|
|
3034
|
+
productLine?: ProductLine;
|
|
3035
|
+
}
|
|
3036
|
+
/** Filters for `products.estimatedValues()`. Note `page`/`limit`, not the `limit`/`skip` the rest
|
|
3037
|
+
* of the API paginates with — this endpoint predates that convention. */
|
|
3038
|
+
interface ProductEstimatedValuesParams extends RequestOptions {
|
|
3039
|
+
page?: number;
|
|
3040
|
+
limit?: number;
|
|
3041
|
+
productName?: string;
|
|
3042
|
+
technicalName?: string;
|
|
3043
|
+
priceChartingId?: string;
|
|
3044
|
+
modelNumber?: string;
|
|
3045
|
+
/** Category technicalName. */
|
|
3046
|
+
category?: string;
|
|
3047
|
+
/** Expansion technicalName. */
|
|
3048
|
+
expansion?: string;
|
|
3049
|
+
/** Brand technicalName. */
|
|
3050
|
+
brand?: string;
|
|
3051
|
+
/** Brand id (ObjectId), an alternative to `brand`. */
|
|
3052
|
+
brandId?: string;
|
|
3053
|
+
productLine?: ProductLine;
|
|
2648
3054
|
}
|
|
2649
3055
|
/** Sealed products: booster boxes, ETBs, tins, and the like. Single cards live under
|
|
2650
3056
|
* `client.cards` instead. */
|
|
2651
3057
|
declare class ProductsResource {
|
|
2652
3058
|
private readonly http;
|
|
2653
3059
|
constructor(http: HttpClient);
|
|
2654
|
-
/** `GET /product`:
|
|
3060
|
+
/** `GET /product`: list sealed products, newest first. No free-text search — use `search()` for
|
|
3061
|
+
* that. */
|
|
2655
3062
|
list(params?: ListProductsParams): Promise<ListResponse<SealedProduct>>;
|
|
2656
|
-
/** `GET /product/
|
|
2657
|
-
|
|
3063
|
+
/** `GET /product/search`: like `list()`, but with free-text search on the product name. Premium. */
|
|
3064
|
+
search(params?: SearchProductsParams): Promise<ListResponse<SealedProduct>>;
|
|
3065
|
+
/** `GET /product/{id}`: fetch one sealed product by its id or technicalName. Pass `brand` if two
|
|
3066
|
+
* brands might share the same technicalName — see `GetProductParams`. */
|
|
3067
|
+
get(idOrTechnicalName: string, params?: GetProductParams): Promise<SealedProduct>;
|
|
2658
3068
|
/** `GET /product/{id}/matches`: current shop listings matched to this product (latest per shop). */
|
|
2659
3069
|
matches(idOrTechnicalName: string, params?: ProductMatchesParams): Promise<ItemShopMatches>;
|
|
2660
3070
|
/** `GET /product/{id}/reference-prices`: Cardmarket/TCGplayer/Tradera price history. Premium. */
|
|
@@ -2663,21 +3073,31 @@ declare class ProductsResource {
|
|
|
2663
3073
|
prices(idOrTechnicalName: string, params?: ProductPricesParams): Promise<ItemSoldPrices>;
|
|
2664
3074
|
/** `GET /product/{id}/pricing/live`: computed fresh for this request, not read from the last
|
|
2665
3075
|
* stats job. Premium. */
|
|
2666
|
-
livePricing(idOrTechnicalName: string, options?:
|
|
3076
|
+
livePricing(idOrTechnicalName: string, options?: RequestOptions): Promise<LivePricingForItem>;
|
|
2667
3077
|
/** `GET /product/{id}/pricing`: this product's current pricing snapshot — `retailPrice`,
|
|
2668
3078
|
* `estimatedValue`, `lowestShopOffer`, `referencePriceSnapshotsByProvider` — refreshed once a day
|
|
2669
3079
|
* by the nightly pricing/scraper jobs. `get()` returns content only; this is the separate,
|
|
2670
3080
|
* shorter-cached call for the part of a product that actually changes day to day. */
|
|
2671
|
-
pricing(idOrTechnicalName: string): Promise<CatalogItemPricing>;
|
|
3081
|
+
pricing(idOrTechnicalName: string, options?: RequestOptions): Promise<CatalogItemPricing>;
|
|
2672
3082
|
/** `GET /product/pricing`: pricing for up to 200 sealed products in one request, keyed by `id` —
|
|
2673
3083
|
* the batch counterpart to `pricing()`, for a page of results (a search page, an expansion's
|
|
2674
3084
|
* contents) that needs pricing for many items at once. Unlike `get()`/`pricing()`, this only
|
|
2675
3085
|
* accepts `id`s, not technicalNames — pass the `id`s already on the products you fetched. Ids with
|
|
2676
3086
|
* no match are silently omitted from the result rather than causing an error. */
|
|
2677
|
-
pricingBatch(ids: string[]): Promise<ListResponse<CatalogItemPricing>>;
|
|
3087
|
+
pricingBatch(ids: string[], options?: RequestOptions): Promise<ListResponse<CatalogItemPricing>>;
|
|
3088
|
+
/** `GET /product/technical-names`: every sealed product's `technicalName` and `updatedAt`,
|
|
3089
|
+
* unpaginated and with no pricing joins. The sealed counterpart to
|
|
3090
|
+
* `client.cards.technicalNames()` — for sitemaps and incremental syncs. */
|
|
3091
|
+
technicalNames(options?: RequestOptions): Promise<ListResponse<CatalogSlug>>;
|
|
3092
|
+
/** `GET /product/price-stats/daily`: daily average price history, sealed products only. The same
|
|
3093
|
+
* data as `client.priceStats.daily()`, scoped to the sealed catalog so a filter like `expansion`
|
|
3094
|
+
* can't pull in that expansion's single cards too. */
|
|
3095
|
+
dailyStats(params?: ProductDailyPriceStatsParams): Promise<ListResponse<ItemDailyStats>>;
|
|
3096
|
+
/** `GET /product/price-stats/estimated-values`: current estimated market value, sealed products
|
|
3097
|
+
* only. The sealed-scoped counterpart to `client.priceStats.estimatedValues()`. */
|
|
3098
|
+
estimatedValues(params?: ProductEstimatedValuesParams): Promise<ListResponse<ItemEstimatedValue>>;
|
|
2678
3099
|
}
|
|
2679
|
-
interface ShopMatchStatsForProductParams {
|
|
2680
|
-
authToken?: string;
|
|
3100
|
+
interface ShopMatchStatsForProductParams extends RequestOptions {
|
|
2681
3101
|
/** `YYYY-MM-DD` */
|
|
2682
3102
|
startDate?: string;
|
|
2683
3103
|
/** `YYYY-MM-DD` */
|
|
@@ -2685,8 +3105,7 @@ interface ShopMatchStatsForProductParams {
|
|
|
2685
3105
|
/** Filter to one shop's technicalName. */
|
|
2686
3106
|
shop?: string;
|
|
2687
3107
|
}
|
|
2688
|
-
interface ShopMatchStatsForShopParams {
|
|
2689
|
-
authToken?: string;
|
|
3108
|
+
interface ShopMatchStatsForShopParams extends RequestOptions {
|
|
2690
3109
|
/** `YYYY-MM-DD` */
|
|
2691
3110
|
startDate?: string;
|
|
2692
3111
|
/** `YYYY-MM-DD` */
|
|
@@ -2694,8 +3113,7 @@ interface ShopMatchStatsForShopParams {
|
|
|
2694
3113
|
/** Maximum products to return. Default 20, max 50. */
|
|
2695
3114
|
limit?: number;
|
|
2696
3115
|
}
|
|
2697
|
-
interface CompareShopPricesParams {
|
|
2698
|
-
authToken?: string;
|
|
3116
|
+
interface CompareShopPricesParams extends RequestOptions {
|
|
2699
3117
|
/** Product/card id or technicalName. */
|
|
2700
3118
|
productId: string;
|
|
2701
3119
|
/** `YYYY-MM-DD`: defaults to the latest date with data. */
|
|
@@ -2738,12 +3156,12 @@ declare class ShopMatchesResource {
|
|
|
2738
3156
|
/** `GET /shop-matches/shops`: match counts per shop (based on latest records only). */
|
|
2739
3157
|
shopStats(params?: PaginationParams): Promise<ListResponse<ShopMatchStats>>;
|
|
2740
3158
|
}
|
|
2741
|
-
interface SubmitShopUrlParams extends
|
|
3159
|
+
interface SubmitShopUrlParams extends RequestOptions {
|
|
2742
3160
|
url: string;
|
|
2743
3161
|
/** Shop technicalName. Auto-created if it doesn't exist yet. */
|
|
2744
3162
|
shop: string;
|
|
2745
3163
|
}
|
|
2746
|
-
interface AssignShopUrlProductParams extends
|
|
3164
|
+
interface AssignShopUrlProductParams extends RequestOptions {
|
|
2747
3165
|
/** Product/card id to link, or `null` to unlink and let auto-matching resume. */
|
|
2748
3166
|
productId: string | null;
|
|
2749
3167
|
}
|
|
@@ -2757,7 +3175,7 @@ declare class ShopUrlsResource {
|
|
|
2757
3175
|
/** `PATCH /shop-urls/{id}/product`: manually assign (or clear) the product a shop URL resolves to. */
|
|
2758
3176
|
assignProduct(shopUrlId: string, params: AssignShopUrlProductParams): Promise<ShopUrlMutationResult>;
|
|
2759
3177
|
}
|
|
2760
|
-
interface ListShopsParams {
|
|
3178
|
+
interface ListShopsParams extends RequestOptions {
|
|
2761
3179
|
active?: boolean;
|
|
2762
3180
|
}
|
|
2763
3181
|
declare class ShopsResource {
|
|
@@ -2766,13 +3184,48 @@ declare class ShopsResource {
|
|
|
2766
3184
|
/** `GET /shops`: every tracked shop. Unwrapped to a plain array, nothing to paginate here. */
|
|
2767
3185
|
list(params?: ListShopsParams): Promise<Shop[]>;
|
|
2768
3186
|
/** `GET /shops/{id}`: fetch one shop by its id or technicalName. */
|
|
2769
|
-
get(idOrTechnicalName: string): Promise<Shop>;
|
|
3187
|
+
get(idOrTechnicalName: string, options?: RequestOptions): Promise<Shop>;
|
|
2770
3188
|
}
|
|
2771
3189
|
declare class StatsResource {
|
|
2772
3190
|
private readonly http;
|
|
2773
3191
|
constructor(http: HttpClient);
|
|
2774
3192
|
/** `GET /stats`: platform-wide overview counts (shops, expansions, products, prices tracked). */
|
|
2775
|
-
platform(): Promise<PlatformStats>;
|
|
3193
|
+
platform(options?: RequestOptions): Promise<PlatformStats>;
|
|
3194
|
+
}
|
|
3195
|
+
interface CreateWebhookParams extends RequestOptions {
|
|
3196
|
+
/**
|
|
3197
|
+
* Where deliveries are POSTed. Must be `https://` — the API rejects plaintext, since a delivery
|
|
3198
|
+
* carries the signature that authenticates it.
|
|
3199
|
+
*/
|
|
3200
|
+
url: string;
|
|
3201
|
+
/** At least one event to subscribe to. */
|
|
3202
|
+
events: WebhookEvent[];
|
|
3203
|
+
}
|
|
3204
|
+
/**
|
|
3205
|
+
* Outbound webhooks: the API calls you when something changes, instead of you polling for it.
|
|
3206
|
+
*
|
|
3207
|
+
* Business tier, not Premium — a Premium token answers `403 businessRequired`. The feature is also
|
|
3208
|
+
* behind a server-side flag, and when that flag is off these answer `404 notFound` rather than 403,
|
|
3209
|
+
* so a `notFound` here means "not enabled on this instance", not "wrong id".
|
|
3210
|
+
*/
|
|
3211
|
+
declare class WebhooksResource {
|
|
3212
|
+
private readonly http;
|
|
3213
|
+
constructor(http: HttpClient);
|
|
3214
|
+
/**
|
|
3215
|
+
* `POST /webhooks`: register a new webhook.
|
|
3216
|
+
*
|
|
3217
|
+
* The returned `secret` is the only copy you will ever get — sign-verification depends on it and
|
|
3218
|
+
* no endpoint reads it back. Persist it here, at creation, or delete the webhook and make a new
|
|
3219
|
+
* one.
|
|
3220
|
+
*/
|
|
3221
|
+
create(params: CreateWebhookParams): Promise<WebhookWithSecret>;
|
|
3222
|
+
/** `GET /webhooks`: every webhook registered on this account. Secrets are never included. */
|
|
3223
|
+
list(options?: RequestOptions): Promise<ListResponse<Webhook>>;
|
|
3224
|
+
/** `DELETE /webhooks/{id}`: revoke a webhook. Deliveries stop immediately; its secret is void. */
|
|
3225
|
+
delete(webhookId: string, options?: RequestOptions): Promise<Acknowledgement>;
|
|
3226
|
+
/** `POST /webhooks/{id}/test`: send a sample delivery to the registered URL, so you can verify
|
|
3227
|
+
* your endpoint and your signature check before waiting on a real event. */
|
|
3228
|
+
test(webhookId: string, options?: RequestOptions): Promise<WebhookTestResult>;
|
|
2776
3229
|
}
|
|
2777
3230
|
declare const DEFAULT_BASE_URL = "https://api.tcgpriser.se";
|
|
2778
3231
|
/** Local dev, self-hosting and testing overrides. Most integrations never touch these. */
|
|
@@ -2783,6 +3236,12 @@ interface TcgPriserAdvancedOptions {
|
|
|
2783
3236
|
headers?: Record<string, string>;
|
|
2784
3237
|
/** Swap in a different `fetch` (older Node, testing, a proxying agent). Defaults to global `fetch`. */
|
|
2785
3238
|
fetch?: typeof fetch;
|
|
3239
|
+
/**
|
|
3240
|
+
* Default milliseconds before a request is aborted, for every call this client makes. Defaults to
|
|
3241
|
+
* `DEFAULT_TIMEOUT_MS` (60s). `0` disables the timeout entirely. Every method can override it per
|
|
3242
|
+
* call with `timeoutMs`.
|
|
3243
|
+
*/
|
|
3244
|
+
timeoutMs?: number;
|
|
2786
3245
|
}
|
|
2787
3246
|
interface TcgPriserOptions {
|
|
2788
3247
|
/**
|
|
@@ -2825,6 +3284,7 @@ declare class TcgPriser {
|
|
|
2825
3284
|
readonly cards: CardsResource;
|
|
2826
3285
|
readonly products: ProductsResource;
|
|
2827
3286
|
readonly expansions: ExpansionsResource;
|
|
3287
|
+
readonly brands: BrandsResource;
|
|
2828
3288
|
readonly shops: ShopsResource;
|
|
2829
3289
|
readonly shopMatches: ShopMatchesResource;
|
|
2830
3290
|
readonly shopMatchStats: ShopMatchStatsResource;
|
|
@@ -2833,14 +3293,37 @@ declare class TcgPriser {
|
|
|
2833
3293
|
readonly bargains: BargainsResource;
|
|
2834
3294
|
readonly packRates: PackRatesResource;
|
|
2835
3295
|
readonly stats: StatsResource;
|
|
3296
|
+
readonly webhooks: WebhooksResource;
|
|
3297
|
+
/** Holds the `HttpClient` so `creditsRemaining` can read the running value off it. */
|
|
3298
|
+
private readonly http;
|
|
2836
3299
|
/**
|
|
2837
3300
|
* @param optionsOrAuthToken A subscriber's API token (`new TcgPriser(myApiToken)`), a full
|
|
2838
3301
|
* `TcgPriserOptions` object, or omit it entirely for an anonymous, public-only client.
|
|
2839
3302
|
*/
|
|
2840
3303
|
constructor(optionsOrAuthToken?: string | TcgPriserOptions);
|
|
3304
|
+
/**
|
|
3305
|
+
* Credits left in this week's allowance, as of the last charged call this client made.
|
|
3306
|
+
*
|
|
3307
|
+
* The API returns `X-Credits-Remaining` on every response it charges for, so this needs no extra
|
|
3308
|
+
* request — but it is only as current as your last premium call, and it is `undefined` until you
|
|
3309
|
+
* make one. Uncharged calls (every public method, and any call authenticated with something other
|
|
3310
|
+
* than an API token) don't update it, because the API doesn't meter them.
|
|
3311
|
+
*
|
|
3312
|
+
* ```ts
|
|
3313
|
+
* await tcgpriser.cards.livePricing('fezandipiti-ex');
|
|
3314
|
+
* if ((tcgpriser.creditsRemaining ?? Infinity) < 100) scheduleFewerRefreshes();
|
|
3315
|
+
* ```
|
|
3316
|
+
*
|
|
3317
|
+
* Reading it in a browser additionally needs the API to expose the header via CORS, which it does.
|
|
3318
|
+
*/
|
|
3319
|
+
get creditsRemaining(): number | undefined;
|
|
2841
3320
|
}
|
|
2842
3321
|
/** The stable error codes the API's `error.code` field can hold. */
|
|
2843
3322
|
type TcgPriserErrorCode = 'validationFailed' | 'unauthorized' | 'forbidden' | 'notFound' | 'conflict' | 'readOnlyField' | 'rateLimited' | 'premiumRequired' | 'businessRequired' | 'creditsExhausted' | 'internalError'
|
|
3323
|
+
/** The request exceeded its `timeoutMs` and was aborted client-side. Never sent by the API — the
|
|
3324
|
+
* one code this package raises on its own, so a stalled connection is distinguishable from a
|
|
3325
|
+
* server that answered. */
|
|
3326
|
+
| 'timeout'
|
|
2844
3327
|
/** Response body wasn't the `{ error: { code, message } }` shape. Probably a proxy or gateway
|
|
2845
3328
|
* error in front of the API. */
|
|
2846
3329
|
| 'unknown';
|
|
@@ -2854,6 +3337,18 @@ declare class TcgPriserError extends Error {
|
|
|
2854
3337
|
readonly details: unknown;
|
|
2855
3338
|
/** The raw response body, for debugging when `code`/`details` don't cover what you need. */
|
|
2856
3339
|
readonly body: string;
|
|
3340
|
+
/**
|
|
3341
|
+
* Seconds to wait before retrying, from the `Retry-After` header. Present on `rateLimited`, and
|
|
3342
|
+
* on anything else a proxy in front of the API decides to send it with. Absent otherwise — an
|
|
3343
|
+
* error without it is not one that says retrying will help.
|
|
3344
|
+
*/
|
|
3345
|
+
readonly retryAfter: number | undefined;
|
|
3346
|
+
/**
|
|
3347
|
+
* Credits left in this week's allowance, from `X-Credits-Remaining`. Present on errors from
|
|
3348
|
+
* charged routes — notably `creditsExhausted`, where it is `0`. Absent on uncharged routes and on
|
|
3349
|
+
* anything a proxy answered instead of the API.
|
|
3350
|
+
*/
|
|
3351
|
+
readonly creditsRemaining: number | undefined;
|
|
2857
3352
|
constructor(params: {
|
|
2858
3353
|
statusCode: number;
|
|
2859
3354
|
statusText: string;
|
|
@@ -2862,6 +3357,8 @@ declare class TcgPriserError extends Error {
|
|
|
2862
3357
|
message: string;
|
|
2863
3358
|
details?: unknown;
|
|
2864
3359
|
body: string;
|
|
3360
|
+
retryAfter?: number;
|
|
3361
|
+
creditsRemaining?: number;
|
|
2865
3362
|
});
|
|
2866
3363
|
}
|
|
2867
|
-
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 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 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 };
|
|
3364
|
+
export { type Acknowledgement, type AlternativeName, type AssignShopUrlProductParams, type Bargain, type BargainInfo, type BargainProductRef, type BargainReferenceSource, type Brand, 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 ProductLine, 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 };
|