scryfall-api 3.2.1 → 3.2.2
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/scryfall-api.js +1 -0
- package/dist/scryfall-api.mjs +307 -0
- package/dist/scryfall-api.umd.js +1 -0
- package/dist/types/src/api/CardIdentifierBuilder.d.ts +28 -0
- package/dist/types/src/api/Cards.d.ts +17 -0
- package/dist/types/src/api/Catalog.d.ts +18 -0
- package/dist/types/src/api/Rulings.d.ts +10 -0
- package/dist/types/src/api/Sets.d.ts +9 -0
- package/dist/types/src/api/Symbology.d.ts +7 -0
- package/dist/types/src/error/MagicQueryError.d.ts +3 -0
- package/dist/types/src/index.d.ts +10 -0
- package/dist/types/src/query/MagicPageResult.d.ts +12 -0
- package/dist/types/src/query/MagicQuery.d.ts +13 -0
- package/dist/types/src/types/Border.d.ts +1 -0
- package/dist/types/src/types/BulkDataDefinition.d.ts +0 -0
- package/dist/types/src/types/BulkDataType.d.ts +0 -0
- package/dist/types/src/types/BulkDataTypes.d.ts +1 -0
- package/dist/types/src/types/Card.d.ts +0 -0
- package/dist/types/src/types/CardFace.d.ts +0 -0
- package/dist/types/src/types/CardIdentifier.d.ts +0 -0
- package/dist/types/src/types/CardSymbol.d.ts +0 -0
- package/dist/types/src/types/Color.d.ts +1 -0
- package/dist/types/src/types/Format.d.ts +1 -0
- package/dist/types/src/types/FrameEffect.d.ts +1 -0
- package/dist/types/src/types/Game.d.ts +1 -0
- package/dist/types/src/types/HomepageLink.d.ts +0 -0
- package/dist/types/src/types/ImageUris.d.ts +0 -0
- package/dist/types/src/types/Layout.d.ts +1 -0
- package/dist/types/src/types/Legalties.d.ts +0 -0
- package/dist/types/src/types/Legalty.d.ts +1 -0
- package/dist/types/src/types/ManaCost.d.ts +0 -0
- package/dist/types/src/types/PageQuery.d.ts +0 -0
- package/dist/types/src/types/PageQueryValue.d.ts +0 -0
- package/dist/types/src/types/Preview.d.ts +0 -0
- package/dist/types/src/types/Prices.d.ts +0 -0
- package/dist/types/src/types/PromoType.d.ts +1 -0
- package/dist/types/src/types/PurchaseUris.d.ts +0 -0
- package/dist/types/src/types/Query.d.ts +0 -0
- package/dist/types/src/types/Rarity.d.ts +1 -0
- package/dist/types/src/types/RelatedCard.d.ts +0 -0
- package/dist/types/src/types/RelatedCardComponent.d.ts +1 -0
- package/dist/types/src/types/RelatedUris.d.ts +0 -0
- package/dist/types/src/types/ResultCatalog.d.ts +0 -0
- package/dist/types/src/types/ResultData.d.ts +0 -0
- package/dist/types/src/types/ResultList.d.ts +0 -0
- package/dist/types/src/types/RetryStrategy.d.ts +0 -0
- package/dist/types/src/types/Ruling.d.ts +0 -0
- package/dist/types/src/types/SearchError.d.ts +0 -0
- package/dist/types/src/types/SearchOptions.d.ts +0 -0
- package/dist/types/src/types/Set.d.ts +0 -0
- package/dist/types/src/types/SetType.d.ts +1 -0
- package/dist/types/src/types/Sort.d.ts +1 -0
- package/dist/types/src/types/SortDirection.d.ts +1 -0
- package/dist/types/src/types/TOrArrayOfT.d.ts +0 -0
- package/dist/types/src/types/UniqueStrategy.d.ts +1 -0
- package/dist/types/src/types/index.d.ts +42 -0
- package/package.json +35 -49
- package/dist/declarations/dist/src/api/CardIdentifierBuilder.d.ts +0 -10
- package/dist/declarations/dist/src/api/Cards.d.ts +0 -19
- package/dist/declarations/dist/src/api/Catalog.d.ts +0 -18
- package/dist/declarations/dist/src/api/Rulings.d.ts +0 -11
- package/dist/declarations/dist/src/api/Sets.d.ts +0 -10
- package/dist/declarations/dist/src/api/Symbology.d.ts +0 -8
- package/dist/declarations/dist/src/error/MagicQueryError.d.ts +0 -5
- package/dist/declarations/dist/src/index.d.ts +0 -10
- package/dist/declarations/dist/src/query/MagicPageResult.d.ts +0 -18
- package/dist/declarations/dist/src/query/MagicQuery.d.ts +0 -13
- package/dist/declarations/dist/src/types/Border.d.ts +0 -7
- package/dist/declarations/dist/src/types/BulkDataDefinition.d.ts +0 -14
- package/dist/declarations/dist/src/types/BulkDataType.d.ts +0 -2
- package/dist/declarations/dist/src/types/BulkDataTypes.d.ts +0 -7
- package/dist/declarations/dist/src/types/Card.d.ts +0 -91
- package/dist/declarations/dist/src/types/CardFace.d.ts +0 -22
- package/dist/declarations/dist/src/types/CardIdentifier.d.ts +0 -10
- package/dist/declarations/dist/src/types/CardSymbol.d.ts +0 -13
- package/dist/declarations/dist/src/types/Color.d.ts +0 -9
- package/dist/declarations/dist/src/types/Format.d.ts +0 -15
- package/dist/declarations/dist/src/types/FrameEffect.d.ts +0 -17
- package/dist/declarations/dist/src/types/Game.d.ts +0 -5
- package/dist/declarations/dist/src/types/HomepageLink.d.ts +0 -9
- package/dist/declarations/dist/src/types/ImageUris.d.ts +0 -8
- package/dist/declarations/dist/src/types/Layout.d.ts +0 -22
- package/dist/declarations/dist/src/types/Legalties.d.ts +0 -5
- package/dist/declarations/dist/src/types/Legalty.d.ts +0 -6
- package/dist/declarations/dist/src/types/ManaCost.d.ts +0 -9
- package/dist/declarations/dist/src/types/PageQuery.d.ts +0 -5
- package/dist/declarations/dist/src/types/PageQueryValue.d.ts +0 -1
- package/dist/declarations/dist/src/types/Preview.d.ts +0 -5
- package/dist/declarations/dist/src/types/Prices.d.ts +0 -6
- package/dist/declarations/dist/src/types/PromoType.d.ts +0 -27
- package/dist/declarations/dist/src/types/PurchaseUris.d.ts +0 -6
- package/dist/declarations/dist/src/types/Query.d.ts +0 -4
- package/dist/declarations/dist/src/types/Rarity.d.ts +0 -6
- package/dist/declarations/dist/src/types/RelatedCard.d.ts +0 -9
- package/dist/declarations/dist/src/types/RelatedCardComponent.d.ts +0 -6
- package/dist/declarations/dist/src/types/RelatedUris.d.ts +0 -7
- package/dist/declarations/dist/src/types/ResultCatalog.d.ts +0 -2
- package/dist/declarations/dist/src/types/ResultData.d.ts +0 -4
- package/dist/declarations/dist/src/types/ResultList.d.ts +0 -7
- package/dist/declarations/dist/src/types/RetryStrategy.d.ts +0 -11
- package/dist/declarations/dist/src/types/Ruling.d.ts +0 -5
- package/dist/declarations/dist/src/types/SearchError.d.ts +0 -7
- package/dist/declarations/dist/src/types/SearchOptions.d.ts +0 -15
- package/dist/declarations/dist/src/types/Set.d.ts +0 -20
- package/dist/declarations/dist/src/types/SetType.d.ts +0 -22
- package/dist/declarations/dist/src/types/Sort.d.ts +0 -15
- package/dist/declarations/dist/src/types/SortDirection.d.ts +0 -5
- package/dist/declarations/dist/src/types/TOrArrayOfT.d.ts +0 -1
- package/dist/declarations/dist/src/types/UniqueStrategy.d.ts +0 -5
- package/dist/declarations/dist/src/types/index.d.ts +0 -42
- package/dist/scryfall-api.cjs.d.ts +0 -1
- package/dist/scryfall-api.cjs.dev.js +0 -645
- package/dist/scryfall-api.cjs.js +0 -7
- package/dist/scryfall-api.cjs.prod.js +0 -645
- package/dist/scryfall-api.esm.js +0 -631
- package/dist/scryfall-api.umd.min.js +0 -2
- package/dist/scryfall-api.umd.min.js.map +0 -1
|
@@ -1,645 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var Axios = require('axios');
|
|
6
|
-
|
|
7
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var Axios__default = /*#__PURE__*/_interopDefault(Axios);
|
|
10
|
-
|
|
11
|
-
class MagicPageResult {
|
|
12
|
-
constructor(q, apiPath, query, post) {
|
|
13
|
-
this.q = q;
|
|
14
|
-
this.apiPath = apiPath;
|
|
15
|
-
this.query = query;
|
|
16
|
-
this.post = post;
|
|
17
|
-
this._hasMore = true;
|
|
18
|
-
this._count = 0;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
get count() {
|
|
22
|
-
return this._count;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
get hasMore() {
|
|
26
|
-
return this._hasMore;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async all() {
|
|
30
|
-
const r = [];
|
|
31
|
-
|
|
32
|
-
while (this._hasMore) {
|
|
33
|
-
const result = await this.next();
|
|
34
|
-
r.push(...result);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return r;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async get(limit) {
|
|
41
|
-
const r = [];
|
|
42
|
-
|
|
43
|
-
while (this._hasMore) {
|
|
44
|
-
const result = await this.next();
|
|
45
|
-
r.push(...result);
|
|
46
|
-
|
|
47
|
-
if (r.length == limit) {
|
|
48
|
-
return r;
|
|
49
|
-
} else if (r.length > limit) {
|
|
50
|
-
return r.slice(0, limit);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return r;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async next() {
|
|
58
|
-
const results = await this.q.query(this.apiPath, this.query, this.post);
|
|
59
|
-
this._hasMore = results?.has_more || false;
|
|
60
|
-
this._count = Number.parseInt((results?.total_cards || 0) + '');
|
|
61
|
-
|
|
62
|
-
if (this._hasMore) {
|
|
63
|
-
this.setNextPage();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return results?.data || [];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async page(page) {
|
|
70
|
-
this.query.page = page;
|
|
71
|
-
return this.next();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
setNextPage() {
|
|
75
|
-
this.query.page = this.query.page + 1;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
class MagicQueryError extends Error {
|
|
81
|
-
constructor(data) {
|
|
82
|
-
super(data?.details);
|
|
83
|
-
this.data = data;
|
|
84
|
-
Object.setPrototypeOf(this, MagicQueryError.prototype);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
class MagicQuery {
|
|
90
|
-
static retry = {
|
|
91
|
-
attempts: 1
|
|
92
|
-
}; // the path to the api
|
|
93
|
-
|
|
94
|
-
static endpoint = 'https://api.scryfall.com'; // time where the last api call was made
|
|
95
|
-
|
|
96
|
-
static lastQuery = 100; // the api requests 50-100 ms between calls, we go on the generous side and never wait less than 100 ms between calls
|
|
97
|
-
|
|
98
|
-
static rateLimit = 100;
|
|
99
|
-
|
|
100
|
-
static canRetry(error) {
|
|
101
|
-
if (error?.code == 'not_found' || error?.code == 'bad_request') return false;
|
|
102
|
-
return !MagicQuery.retry.canRetry ;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
static async debounce() {
|
|
106
|
-
const now = Date.now();
|
|
107
|
-
const timeSinceLastQuery = now - MagicQuery.lastQuery;
|
|
108
|
-
|
|
109
|
-
if (timeSinceLastQuery >= MagicQuery.rateLimit) {
|
|
110
|
-
MagicQuery.lastQuery = now;
|
|
111
|
-
} else {
|
|
112
|
-
const timeUntilNextQuery = MagicQuery.rateLimit - timeSinceLastQuery;
|
|
113
|
-
MagicQuery.lastQuery += timeUntilNextQuery;
|
|
114
|
-
await MagicQuery.sleep(timeUntilNextQuery);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
static sleep(ms = 0) {
|
|
119
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
static async tryQuery(apiPath, query, post, requestOptions) {
|
|
123
|
-
await MagicQuery.debounce();
|
|
124
|
-
const config = {
|
|
125
|
-
data: post,
|
|
126
|
-
method: post ? 'POST' : 'GET',
|
|
127
|
-
params: query,
|
|
128
|
-
url: `${MagicQuery.endpoint}/${apiPath}`,
|
|
129
|
-
...requestOptions
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
try {
|
|
133
|
-
return await Axios__default["default"].request(config);
|
|
134
|
-
} catch (e) {
|
|
135
|
-
if (e['isAxiosError']) {
|
|
136
|
-
const error = e;
|
|
137
|
-
throw new MagicQueryError(error.response?.data);
|
|
138
|
-
} else {
|
|
139
|
-
throw e;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
async query(apiPath, query, post, requestOptions) {
|
|
145
|
-
if (Array.isArray(apiPath)) {
|
|
146
|
-
apiPath = apiPath.join('/');
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
let retries;
|
|
150
|
-
let result;
|
|
151
|
-
|
|
152
|
-
for (retries = 0; retries < MagicQuery.retry.attempts; retries++) {
|
|
153
|
-
let error;
|
|
154
|
-
|
|
155
|
-
try {
|
|
156
|
-
result = await MagicQuery.tryQuery(`${apiPath}`, query, post, requestOptions);
|
|
157
|
-
} catch (e) {
|
|
158
|
-
if (e instanceof MagicQueryError) {
|
|
159
|
-
error = e.data;
|
|
160
|
-
} else {
|
|
161
|
-
throw e;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (result || !MagicQuery.canRetry(error)) break;
|
|
166
|
-
await MagicQuery.sleep(MagicQuery.retry.timeout);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return result?.data;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
class Cards extends MagicQuery {
|
|
175
|
-
async autoCompleteName(name) {
|
|
176
|
-
const result = await this.query('cards/autocomplete', {
|
|
177
|
-
q: name
|
|
178
|
-
});
|
|
179
|
-
return result?.data || [];
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
async byArenaId(id) {
|
|
183
|
-
return this.query(['cards/arena', id]);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
async byId(id) {
|
|
187
|
-
return this.query(['cards', id]);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
async byMtgoId(id) {
|
|
191
|
-
return this.query(['cards/mtgo', id]);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
async byMultiverseId(id) {
|
|
195
|
-
return this.query(['cards/multiverse', id]);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
async byName(name, set, fuzzy = false) {
|
|
199
|
-
if (typeof set === 'boolean') {
|
|
200
|
-
fuzzy = set;
|
|
201
|
-
set = undefined;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return this.query('cards/named', {
|
|
205
|
-
[fuzzy ? 'fuzzy' : 'exact']: name,
|
|
206
|
-
set
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
async bySet(setCode, collectorNumber, lang) {
|
|
211
|
-
const path = ['cards', setCode, collectorNumber];
|
|
212
|
-
if (lang) path.push(lang);
|
|
213
|
-
return this.query(path);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
async byTcgPlayerId(id) {
|
|
217
|
-
return this.query(['cards/tcgplayer', id]);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
async collection(...identifiers) {
|
|
221
|
-
const cards = [];
|
|
222
|
-
|
|
223
|
-
for (let i = 0; i < identifiers.length; i += 75) {
|
|
224
|
-
// the api only supports a max collection size of 75, so we take the list of identifiers (any length)
|
|
225
|
-
// and split it into 75 card-max requests
|
|
226
|
-
const collectionSection = {
|
|
227
|
-
identifiers: identifiers.slice(i, i + 75)
|
|
228
|
-
};
|
|
229
|
-
const result = await this.query('cards/collection', undefined, collectionSection);
|
|
230
|
-
cards.push(...(result?.data || []));
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
return cards;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
async random() {
|
|
237
|
-
return this.query('cards/random');
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
search(query, options) {
|
|
241
|
-
return new MagicPageResult(this, 'cards/search', {
|
|
242
|
-
q: query,
|
|
243
|
-
...(typeof options === 'number' ? {
|
|
244
|
-
page: options
|
|
245
|
-
} : {
|
|
246
|
-
page: 1,
|
|
247
|
-
...options
|
|
248
|
-
})
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
var Cards$1 = new Cards();
|
|
255
|
-
|
|
256
|
-
class Catalog extends MagicQuery {
|
|
257
|
-
async artifactTypes() {
|
|
258
|
-
return (await this.query('catalog/artifact-types'))?.data || [];
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
async artistNames() {
|
|
262
|
-
return (await this.query('catalog/artist-names'))?.data || [];
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
async cardNames() {
|
|
266
|
-
return (await this.query('catalog/card-names'))?.data || [];
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
async creatureTypes() {
|
|
270
|
-
return (await this.query('catalog/creature-types'))?.data || [];
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
async enchantmentTypes() {
|
|
274
|
-
return (await this.query('catalog/enchantment-types'))?.data || [];
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
async landTypes() {
|
|
278
|
-
return (await this.query('catalog/land-types'))?.data || [];
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
async loyalties() {
|
|
282
|
-
return (await this.query('catalog/loyalties'))?.data || [];
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
async planeswalkerTypes() {
|
|
286
|
-
return (await this.query('catalog/planeswalker-types'))?.data || [];
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
async powers() {
|
|
290
|
-
return (await this.query('catalog/powers'))?.data || [];
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
async spellTypes() {
|
|
294
|
-
return (await this.query('catalog/spell-types'))?.data || [];
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
async toughnesses() {
|
|
298
|
-
return (await this.query('catalog/toughnesses'))?.data || [];
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
async watermarks() {
|
|
302
|
-
return (await this.query('catalog/watermarks'))?.data || [];
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
async wordBank() {
|
|
306
|
-
return (await this.query('catalog/word-bank'))?.data || [];
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
var Catalog$1 = new Catalog();
|
|
312
|
-
|
|
313
|
-
class Rulings extends MagicQuery {
|
|
314
|
-
async byArenaId(id) {
|
|
315
|
-
return (await this.query(['cards/arena', id, 'rulings']))?.data || [];
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
async byId(id) {
|
|
319
|
-
return (await this.query(['cards', id, 'rulings']))?.data || [];
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
async byMtgoId(id) {
|
|
323
|
-
return (await this.query(['cards/mtgo', id, 'rulings']))?.data || [];
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
async byMultiverseId(id) {
|
|
327
|
-
return (await this.query(['cards/multiverse', id, 'rulings']))?.data || [];
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
async bySet(setCode, collectorNumber) {
|
|
331
|
-
return (await this.query(['cards', setCode, `${collectorNumber}`, 'rulings']))?.data || [];
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
var Rulings$1 = new Rulings();
|
|
337
|
-
|
|
338
|
-
class Sets extends MagicQuery {
|
|
339
|
-
async all() {
|
|
340
|
-
const result = await this.query('sets');
|
|
341
|
-
return result?.data || [];
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
async byCode(code) {
|
|
345
|
-
return await this.query(['sets', code]);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
async byId(id) {
|
|
349
|
-
return this.query(['sets', id]);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
async byTcgPlayerId(id) {
|
|
353
|
-
return this.query(['sets/tcgplayer', id]);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
var Sets$1 = new Sets();
|
|
359
|
-
|
|
360
|
-
class Symbology extends MagicQuery {
|
|
361
|
-
async all() {
|
|
362
|
-
return (await this.query('symbology'))?.data || [];
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
async parseMana(shorthand) {
|
|
366
|
-
return await this.query('symbology/parse-mana', {
|
|
367
|
-
cost: shorthand
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
var Symbology$1 = new Symbology();
|
|
374
|
-
|
|
375
|
-
class CardIdentifierBuilder {
|
|
376
|
-
static byId(id) {
|
|
377
|
-
return {
|
|
378
|
-
id
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
static byIllustrationId(id) {
|
|
383
|
-
return {
|
|
384
|
-
illustration_id: id
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
static byMtgoId(id) {
|
|
389
|
-
return {
|
|
390
|
-
mtgo_id: id
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
static byMultiverseId(id) {
|
|
395
|
-
return {
|
|
396
|
-
multiverse_id: id
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
static byName(name, set) {
|
|
401
|
-
return {
|
|
402
|
-
name,
|
|
403
|
-
set
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
static byOracleId(id) {
|
|
408
|
-
return {
|
|
409
|
-
oracle_id: id
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
static bySet(set, collectorNumber) {
|
|
414
|
-
return {
|
|
415
|
-
collector_number: `${collectorNumber}`,
|
|
416
|
-
set
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
exports.Border = void 0;
|
|
423
|
-
|
|
424
|
-
(function (Border) {
|
|
425
|
-
Border[Border["black"] = 0] = "black";
|
|
426
|
-
Border[Border["borderless"] = 1] = "borderless";
|
|
427
|
-
Border[Border["gold"] = 2] = "gold";
|
|
428
|
-
Border[Border["silver"] = 3] = "silver";
|
|
429
|
-
Border[Border["white"] = 4] = "white";
|
|
430
|
-
})(exports.Border || (exports.Border = {}));
|
|
431
|
-
|
|
432
|
-
exports.BulkDataTypes = void 0;
|
|
433
|
-
|
|
434
|
-
(function (BulkDataTypes) {
|
|
435
|
-
BulkDataTypes[BulkDataTypes["oracle_cards"] = 0] = "oracle_cards";
|
|
436
|
-
BulkDataTypes[BulkDataTypes["unique_artwork"] = 1] = "unique_artwork";
|
|
437
|
-
BulkDataTypes[BulkDataTypes["default_cards"] = 2] = "default_cards";
|
|
438
|
-
BulkDataTypes[BulkDataTypes["all_cards"] = 3] = "all_cards";
|
|
439
|
-
BulkDataTypes[BulkDataTypes["rulings"] = 4] = "rulings";
|
|
440
|
-
})(exports.BulkDataTypes || (exports.BulkDataTypes = {}));
|
|
441
|
-
|
|
442
|
-
var Colors;
|
|
443
|
-
|
|
444
|
-
(function (Colors) {
|
|
445
|
-
Colors[Colors["W"] = 0] = "W";
|
|
446
|
-
Colors[Colors["B"] = 1] = "B";
|
|
447
|
-
Colors[Colors["R"] = 2] = "R";
|
|
448
|
-
Colors[Colors["U"] = 3] = "U";
|
|
449
|
-
Colors[Colors["G"] = 4] = "G";
|
|
450
|
-
})(Colors || (Colors = {}));
|
|
451
|
-
|
|
452
|
-
exports.Format = void 0;
|
|
453
|
-
|
|
454
|
-
(function (Format) {
|
|
455
|
-
Format[Format["standard"] = 0] = "standard";
|
|
456
|
-
Format[Format["future"] = 1] = "future";
|
|
457
|
-
Format[Format["historic"] = 2] = "historic";
|
|
458
|
-
Format[Format["pioneer"] = 3] = "pioneer";
|
|
459
|
-
Format[Format["modern"] = 4] = "modern";
|
|
460
|
-
Format[Format["legacy"] = 5] = "legacy";
|
|
461
|
-
Format[Format["pauper"] = 6] = "pauper";
|
|
462
|
-
Format[Format["vintage"] = 7] = "vintage";
|
|
463
|
-
Format[Format["penny"] = 8] = "penny";
|
|
464
|
-
Format[Format["commander"] = 9] = "commander";
|
|
465
|
-
Format[Format["brawl"] = 10] = "brawl";
|
|
466
|
-
Format[Format["duel"] = 11] = "duel";
|
|
467
|
-
Format[Format["oldschool"] = 12] = "oldschool";
|
|
468
|
-
})(exports.Format || (exports.Format = {}));
|
|
469
|
-
|
|
470
|
-
exports.FrameEffect = void 0;
|
|
471
|
-
|
|
472
|
-
(function (FrameEffect) {
|
|
473
|
-
FrameEffect[FrameEffect["legendary"] = 0] = "legendary";
|
|
474
|
-
FrameEffect[FrameEffect["miracle"] = 1] = "miracle";
|
|
475
|
-
FrameEffect[FrameEffect["nyxtouched"] = 2] = "nyxtouched";
|
|
476
|
-
FrameEffect[FrameEffect["draft"] = 3] = "draft";
|
|
477
|
-
FrameEffect[FrameEffect["devoid"] = 4] = "devoid";
|
|
478
|
-
FrameEffect[FrameEffect["tombstone"] = 5] = "tombstone";
|
|
479
|
-
FrameEffect[FrameEffect["colorshifted"] = 6] = "colorshifted";
|
|
480
|
-
FrameEffect[FrameEffect["inverted"] = 7] = "inverted";
|
|
481
|
-
FrameEffect[FrameEffect["sunmoondfc"] = 8] = "sunmoondfc";
|
|
482
|
-
FrameEffect[FrameEffect["compasslanddfc"] = 9] = "compasslanddfc";
|
|
483
|
-
FrameEffect[FrameEffect["originpwdfc"] = 10] = "originpwdfc";
|
|
484
|
-
FrameEffect[FrameEffect["mooneldrazidfc"] = 11] = "mooneldrazidfc";
|
|
485
|
-
FrameEffect[FrameEffect["moonreversemoondfc"] = 12] = "moonreversemoondfc";
|
|
486
|
-
FrameEffect[FrameEffect["showcase"] = 13] = "showcase";
|
|
487
|
-
FrameEffect[FrameEffect["extendedart"] = 14] = "extendedart";
|
|
488
|
-
})(exports.FrameEffect || (exports.FrameEffect = {}));
|
|
489
|
-
|
|
490
|
-
exports.Game = void 0;
|
|
491
|
-
|
|
492
|
-
(function (Game) {
|
|
493
|
-
Game[Game["paper"] = 0] = "paper";
|
|
494
|
-
Game[Game["arena"] = 1] = "arena";
|
|
495
|
-
Game[Game["mtgo"] = 2] = "mtgo";
|
|
496
|
-
})(exports.Game || (exports.Game = {}));
|
|
497
|
-
|
|
498
|
-
exports.Layout = void 0;
|
|
499
|
-
|
|
500
|
-
(function (Layout) {
|
|
501
|
-
Layout[Layout["normal"] = 0] = "normal";
|
|
502
|
-
Layout[Layout["split"] = 1] = "split";
|
|
503
|
-
Layout[Layout["flip"] = 2] = "flip";
|
|
504
|
-
Layout[Layout["transform"] = 3] = "transform";
|
|
505
|
-
Layout[Layout["modal_dfc"] = 4] = "modal_dfc";
|
|
506
|
-
Layout[Layout["meld"] = 5] = "meld";
|
|
507
|
-
Layout[Layout["leveler"] = 6] = "leveler";
|
|
508
|
-
Layout[Layout["class"] = 7] = "class";
|
|
509
|
-
Layout[Layout["saga"] = 8] = "saga";
|
|
510
|
-
Layout[Layout["adventure"] = 9] = "adventure";
|
|
511
|
-
Layout[Layout["planar"] = 10] = "planar";
|
|
512
|
-
Layout[Layout["scheme"] = 11] = "scheme";
|
|
513
|
-
Layout[Layout["vanguard"] = 12] = "vanguard";
|
|
514
|
-
Layout[Layout["token"] = 13] = "token";
|
|
515
|
-
Layout[Layout["double_faced_token"] = 14] = "double_faced_token";
|
|
516
|
-
Layout[Layout["emblem"] = 15] = "emblem";
|
|
517
|
-
Layout[Layout["augment"] = 16] = "augment";
|
|
518
|
-
Layout[Layout["host"] = 17] = "host";
|
|
519
|
-
Layout[Layout["art_series"] = 18] = "art_series";
|
|
520
|
-
Layout[Layout["reversible_card"] = 19] = "reversible_card";
|
|
521
|
-
})(exports.Layout || (exports.Layout = {}));
|
|
522
|
-
|
|
523
|
-
exports.Legality = void 0;
|
|
524
|
-
|
|
525
|
-
(function (Legality) {
|
|
526
|
-
Legality[Legality["legal"] = 0] = "legal";
|
|
527
|
-
Legality[Legality["not_legal"] = 1] = "not_legal";
|
|
528
|
-
Legality[Legality["restricted"] = 2] = "restricted";
|
|
529
|
-
Legality[Legality["banned"] = 3] = "banned";
|
|
530
|
-
})(exports.Legality || (exports.Legality = {}));
|
|
531
|
-
|
|
532
|
-
exports.PromoType = void 0;
|
|
533
|
-
|
|
534
|
-
(function (PromoType) {
|
|
535
|
-
PromoType[PromoType["tourney"] = 0] = "tourney";
|
|
536
|
-
PromoType[PromoType["prerelease"] = 1] = "prerelease";
|
|
537
|
-
PromoType[PromoType["datestamped"] = 2] = "datestamped";
|
|
538
|
-
PromoType[PromoType["planeswalkerdeck"] = 3] = "planeswalkerdeck";
|
|
539
|
-
PromoType[PromoType["buyabox"] = 4] = "buyabox";
|
|
540
|
-
PromoType[PromoType["judgegift"] = 5] = "judgegift";
|
|
541
|
-
PromoType[PromoType["event"] = 6] = "event";
|
|
542
|
-
PromoType[PromoType["convention"] = 7] = "convention";
|
|
543
|
-
PromoType[PromoType["starterdeck"] = 8] = "starterdeck";
|
|
544
|
-
PromoType[PromoType["instore"] = 9] = "instore";
|
|
545
|
-
PromoType[PromoType["setpromo"] = 10] = "setpromo";
|
|
546
|
-
PromoType[PromoType["fnm"] = 11] = "fnm";
|
|
547
|
-
PromoType[PromoType["openhouse"] = 12] = "openhouse";
|
|
548
|
-
PromoType[PromoType["league"] = 13] = "league";
|
|
549
|
-
PromoType[PromoType["draftweekend"] = 14] = "draftweekend";
|
|
550
|
-
PromoType[PromoType["gameday"] = 15] = "gameday";
|
|
551
|
-
PromoType[PromoType["release"] = 16] = "release";
|
|
552
|
-
PromoType[PromoType["intropack"] = 17] = "intropack";
|
|
553
|
-
PromoType[PromoType["giftbox"] = 18] = "giftbox";
|
|
554
|
-
PromoType[PromoType["duels"] = 19] = "duels";
|
|
555
|
-
PromoType[PromoType["wizardsplaynetwork"] = 20] = "wizardsplaynetwork";
|
|
556
|
-
PromoType[PromoType["premiereshop"] = 21] = "premiereshop";
|
|
557
|
-
PromoType[PromoType["playerrewards"] = 22] = "playerrewards";
|
|
558
|
-
PromoType[PromoType["gateway"] = 23] = "gateway";
|
|
559
|
-
PromoType[PromoType["arenaleague"] = 24] = "arenaleague";
|
|
560
|
-
})(exports.PromoType || (exports.PromoType = {}));
|
|
561
|
-
|
|
562
|
-
exports.Rarity = void 0;
|
|
563
|
-
|
|
564
|
-
(function (Rarity) {
|
|
565
|
-
Rarity[Rarity["common"] = 0] = "common";
|
|
566
|
-
Rarity[Rarity["uncommon"] = 1] = "uncommon";
|
|
567
|
-
Rarity[Rarity["rare"] = 2] = "rare";
|
|
568
|
-
Rarity[Rarity["mythic"] = 3] = "mythic";
|
|
569
|
-
})(exports.Rarity || (exports.Rarity = {}));
|
|
570
|
-
|
|
571
|
-
exports.RelatedCardComponent = void 0;
|
|
572
|
-
|
|
573
|
-
(function (RelatedCardComponent) {
|
|
574
|
-
RelatedCardComponent[RelatedCardComponent["token"] = 0] = "token";
|
|
575
|
-
RelatedCardComponent[RelatedCardComponent["meld_part"] = 1] = "meld_part";
|
|
576
|
-
RelatedCardComponent[RelatedCardComponent["meld_result"] = 2] = "meld_result";
|
|
577
|
-
RelatedCardComponent[RelatedCardComponent["combo_piece"] = 3] = "combo_piece";
|
|
578
|
-
})(exports.RelatedCardComponent || (exports.RelatedCardComponent = {}));
|
|
579
|
-
|
|
580
|
-
exports.SetType = void 0;
|
|
581
|
-
|
|
582
|
-
(function (SetType) {
|
|
583
|
-
SetType[SetType["core"] = 0] = "core";
|
|
584
|
-
SetType[SetType["expansion"] = 1] = "expansion";
|
|
585
|
-
SetType[SetType["masters"] = 2] = "masters";
|
|
586
|
-
SetType[SetType["masterpiece"] = 3] = "masterpiece";
|
|
587
|
-
SetType[SetType["from_the_vault"] = 4] = "from_the_vault";
|
|
588
|
-
SetType[SetType["spellbook"] = 5] = "spellbook";
|
|
589
|
-
SetType[SetType["premium_deck"] = 6] = "premium_deck";
|
|
590
|
-
SetType[SetType["duel_deck"] = 7] = "duel_deck";
|
|
591
|
-
SetType[SetType["draft_innovation"] = 8] = "draft_innovation";
|
|
592
|
-
SetType[SetType["treasure_chest"] = 9] = "treasure_chest";
|
|
593
|
-
SetType[SetType["commander"] = 10] = "commander";
|
|
594
|
-
SetType[SetType["planechase"] = 11] = "planechase";
|
|
595
|
-
SetType[SetType["archenemy"] = 12] = "archenemy";
|
|
596
|
-
SetType[SetType["vanguard"] = 13] = "vanguard";
|
|
597
|
-
SetType[SetType["funny"] = 14] = "funny";
|
|
598
|
-
SetType[SetType["starter"] = 15] = "starter";
|
|
599
|
-
SetType[SetType["box"] = 16] = "box";
|
|
600
|
-
SetType[SetType["promo"] = 17] = "promo";
|
|
601
|
-
SetType[SetType["token"] = 18] = "token";
|
|
602
|
-
SetType[SetType["memorabilia"] = 19] = "memorabilia";
|
|
603
|
-
})(exports.SetType || (exports.SetType = {}));
|
|
604
|
-
|
|
605
|
-
exports.Sort = void 0;
|
|
606
|
-
|
|
607
|
-
(function (Sort) {
|
|
608
|
-
Sort[Sort["name"] = 0] = "name";
|
|
609
|
-
Sort[Sort["set"] = 1] = "set";
|
|
610
|
-
Sort[Sort["released"] = 2] = "released";
|
|
611
|
-
Sort[Sort["rarity"] = 3] = "rarity";
|
|
612
|
-
Sort[Sort["color"] = 4] = "color";
|
|
613
|
-
Sort[Sort["usd"] = 5] = "usd";
|
|
614
|
-
Sort[Sort["tix"] = 6] = "tix";
|
|
615
|
-
Sort[Sort["eur"] = 7] = "eur";
|
|
616
|
-
Sort[Sort["cmc"] = 8] = "cmc";
|
|
617
|
-
Sort[Sort["power"] = 9] = "power";
|
|
618
|
-
Sort[Sort["toughness"] = 10] = "toughness";
|
|
619
|
-
Sort[Sort["edhrec"] = 11] = "edhrec";
|
|
620
|
-
Sort[Sort["artist"] = 12] = "artist";
|
|
621
|
-
})(exports.Sort || (exports.Sort = {}));
|
|
622
|
-
|
|
623
|
-
exports.SortDirection = void 0;
|
|
624
|
-
|
|
625
|
-
(function (SortDirection) {
|
|
626
|
-
SortDirection[SortDirection["auto"] = 0] = "auto";
|
|
627
|
-
SortDirection[SortDirection["asc"] = 1] = "asc";
|
|
628
|
-
SortDirection[SortDirection["desc"] = 2] = "desc";
|
|
629
|
-
})(exports.SortDirection || (exports.SortDirection = {}));
|
|
630
|
-
|
|
631
|
-
exports.UniqueStrategy = void 0;
|
|
632
|
-
|
|
633
|
-
(function (UniqueStrategy) {
|
|
634
|
-
UniqueStrategy[UniqueStrategy["cards"] = 0] = "cards";
|
|
635
|
-
UniqueStrategy[UniqueStrategy["art"] = 1] = "art";
|
|
636
|
-
UniqueStrategy[UniqueStrategy["prints"] = 2] = "prints";
|
|
637
|
-
})(exports.UniqueStrategy || (exports.UniqueStrategy = {}));
|
|
638
|
-
|
|
639
|
-
exports.CardIdentifierBuilder = CardIdentifierBuilder;
|
|
640
|
-
exports.Cards = Cards$1;
|
|
641
|
-
exports.Catalog = Catalog$1;
|
|
642
|
-
exports.MagicQueryError = MagicQueryError;
|
|
643
|
-
exports.Rulings = Rulings$1;
|
|
644
|
-
exports.Sets = Sets$1;
|
|
645
|
-
exports.Symbology = Symbology$1;
|