scryfall-api 1.0.7 → 2.1.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/CHANGELOG.md +5 -7
- package/README.md +9 -6
- package/lib/api/CardIdfentifier.d.ts +9 -0
- package/lib/api/Cards.d.ts +15 -323
- package/lib/api/Cards.spec.d.ts +1 -0
- package/lib/api/Catalog.d.ts +9 -9
- package/lib/api/Catalog.spec.d.ts +1 -0
- package/lib/api/Misc.d.ts +3 -11
- package/lib/api/Misc.spec.d.ts +1 -0
- package/lib/api/Rulings.d.ts +6 -10
- package/lib/api/Rulings.spec.d.ts +1 -0
- package/lib/api/Sets.d.ts +6 -46
- package/lib/api/Sets.spec.d.ts +1 -0
- package/lib/api/Symbology.d.ts +4 -24
- package/lib/api/Symbology.spec.d.ts +1 -0
- package/lib/error/MagicQueryError.d.ts +5 -0
- package/lib/index.d.ts +0 -25
- package/lib/query/MagicPageResult.d.ts +17 -0
- package/lib/query/MagicQuery.d.ts +13 -0
- package/lib/skryfall.es5.js +148 -639
- package/lib/skryfall.es5.js.map +1 -1
- package/lib/skryfall.es5.min.js +2 -2
- package/lib/skryfall.es5.min.js.map +1 -1
- package/lib/skryfall.umd.js +152 -651
- package/lib/skryfall.umd.js.map +1 -1
- package/lib/skryfall.umd.min.js +2 -2
- package/lib/skryfall.umd.min.js.map +1 -1
- package/lib/types/Border.d.ts +7 -0
- package/lib/types/BulkDataDefinition.d.ts +14 -0
- package/lib/types/BulkDataType.d.ts +2 -0
- package/lib/types/BulkDataTypes.d.ts +7 -0
- package/lib/types/Card.d.ts +91 -0
- package/lib/types/CardFace.d.ts +22 -0
- package/lib/types/CardIdentifier.d.ts +10 -0
- package/lib/types/CardSymbol.d.ts +13 -0
- package/lib/{util → types}/Color.d.ts +0 -0
- package/lib/types/Format.d.ts +15 -0
- package/lib/types/FrameEffect.d.ts +17 -0
- package/lib/types/Game.d.ts +5 -0
- package/lib/types/HomepageLink.d.ts +9 -0
- package/lib/types/ImageUris.d.ts +8 -0
- package/lib/types/Layout.d.ts +20 -0
- package/lib/types/Legalties.d.ts +5 -0
- package/lib/types/Legalty.d.ts +6 -0
- package/lib/types/ManaCost.d.ts +9 -0
- package/lib/types/PageQuery.d.ts +5 -0
- package/lib/types/PageQueryValue.d.ts +1 -0
- package/lib/types/Preview.d.ts +5 -0
- package/lib/types/Prices.d.ts +6 -0
- package/lib/types/PromoType.d.ts +27 -0
- package/lib/types/PurchaseUris.d.ts +6 -0
- package/lib/types/Query.d.ts +4 -0
- package/lib/types/Rarity.d.ts +6 -0
- package/lib/types/RelatedCard.d.ts +9 -0
- package/lib/types/RelatedCardComponent.d.ts +6 -0
- package/lib/types/RelatedUris.d.ts +7 -0
- package/lib/types/ResultCatalog.d.ts +2 -0
- package/lib/types/ResultData.d.ts +4 -0
- package/lib/types/ResultList.d.ts +7 -0
- package/lib/types/RetryStrategy.d.ts +11 -0
- package/lib/types/Ruling.d.ts +5 -0
- package/lib/types/SearchError.d.ts +7 -0
- package/lib/types/SearchOptions.d.ts +15 -0
- package/lib/types/Set.d.ts +20 -0
- package/lib/types/SetType.d.ts +22 -0
- package/lib/types/Sort.d.ts +15 -0
- package/lib/types/SortDirection.d.ts +5 -0
- package/lib/types/TOrArrayOfT.d.ts +1 -0
- package/lib/types/UniqueStrategy.d.ts +5 -0
- package/lib/types/index.d.ts +42 -0
- package/package.json +37 -29
- package/lib/api/BulkData.d.ts +0 -46
- package/lib/util/MagicEmitter.d.ts +0 -31
- package/lib/util/MagicQuerier.d.ts +0 -44
package/CHANGELOG.md
CHANGED
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 2.1.0 (2021-10-16)
|
|
6
6
|
|
|
7
|
-
### [1.0.6](https://bitbucket.org/MarioMH/scryfall-api/compare/v1.0.5...v1.0.6) (2021-04-07)
|
|
8
7
|
|
|
9
|
-
###
|
|
8
|
+
### Features
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
* removed BulkData ([110d6e2](https://bitbucket.org/MarioMH/scryfall-api/commit/110d6e27d6bdd98889e760d33c122713371b491d))
|
|
12
11
|
|
|
13
|
-
### [1.0.3](http://bitbucket.org/MarioMH/scryfall-api/compare/v1.0.2...v1.0.3) (2021-04-07)
|
|
14
12
|
|
|
15
|
-
###
|
|
13
|
+
### Bug Fixes
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
* removed invalid condition ([c74c0c7](https://bitbucket.org/MarioMH/scryfall-api/commit/c74c0c793bf43058c7a705b043b3cfd661a35206))
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# scryfall-api
|
|
2
|
+
|
|
2
3
|
[](https://www.npmjs.com/package/scryfall-api)
|
|
3
4
|
[](https://bitbucket.org/MarioMH/scryfall-api.git)
|
|
4
5
|
|
|
5
6
|
A Node.js SDK for [Scryfall](https://scryfall.com/docs/api) written in Typescript.
|
|
6
7
|
|
|
7
|
-
As of [
|
|
8
|
-
|
|
8
|
+
As of [October 16th, 2021](./CHANGELOG.md), all features described in the [Scryfall documentation](https://scryfall.com/docs/api) are supported. If you see something that isn't supported, make an issue! See [support readme](./SUPPORT.md).
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -13,31 +13,34 @@ As of [April 7th, 2021](./CHANGELOG.md), all features described in the [Scryfall
|
|
|
13
13
|
npm install scryfall-api
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
## Documentation
|
|
18
|
-
Link to [documentation.](./DOCUMENTATION.md)
|
|
19
17
|
|
|
18
|
+
Link to [documentation.](./DOCUMENTATION.md)
|
|
20
19
|
|
|
21
20
|
## Contributing
|
|
22
21
|
|
|
23
22
|
Thanks for wanting to help out! Here's the setup you'll have to do:
|
|
23
|
+
|
|
24
24
|
```bat
|
|
25
25
|
git clone https://bitbucket.org/MarioMH/scryfall-api.git
|
|
26
26
|
cd scryfall-api
|
|
27
27
|
npm install
|
|
28
28
|
```
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
You can now make changes to the repository.
|
|
30
31
|
|
|
31
32
|
To compile, then test:
|
|
33
|
+
|
|
32
34
|
```bat
|
|
33
35
|
npm run build
|
|
34
36
|
```
|
|
37
|
+
|
|
35
38
|
To compile and then test on every file change:
|
|
39
|
+
|
|
36
40
|
```bat
|
|
37
41
|
npm run build:watch
|
|
38
42
|
```
|
|
39
43
|
|
|
40
|
-
|
|
41
44
|
## MIT License
|
|
42
45
|
|
|
43
46
|
[Copyright 2017-2021 Mackenzie McClane](./LICENSE)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class CardIdentifier {
|
|
2
|
+
static byId(id: string): CardIdentifier;
|
|
3
|
+
static byIllustrationId(id: string): CardIdentifier;
|
|
4
|
+
static byMtgoId(id: number): CardIdentifier;
|
|
5
|
+
static byMultiverseId(id: number): CardIdentifier;
|
|
6
|
+
static byName(name: string, set?: string): CardIdentifier;
|
|
7
|
+
static byOracleId(id: string): CardIdentifier;
|
|
8
|
+
static bySet(set: string, collectorNumber: string | number): CardIdentifier;
|
|
9
|
+
}
|
package/lib/api/Cards.d.ts
CHANGED
|
@@ -1,327 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
declare enum UniqueStrategy {
|
|
6
|
-
cards = 0,
|
|
7
|
-
art = 1,
|
|
8
|
-
prints = 2
|
|
9
|
-
}
|
|
10
|
-
declare enum Sort {
|
|
11
|
-
name = 0,
|
|
12
|
-
set = 1,
|
|
13
|
-
released = 2,
|
|
14
|
-
rarity = 3,
|
|
15
|
-
color = 4,
|
|
16
|
-
usd = 5,
|
|
17
|
-
tix = 6,
|
|
18
|
-
eur = 7,
|
|
19
|
-
cmc = 8,
|
|
20
|
-
power = 9,
|
|
21
|
-
toughness = 10,
|
|
22
|
-
edhrec = 11,
|
|
23
|
-
artist = 12
|
|
24
|
-
}
|
|
25
|
-
declare enum SortDirection {
|
|
26
|
-
auto = 0,
|
|
27
|
-
asc = 1,
|
|
28
|
-
desc = 2
|
|
29
|
-
}
|
|
30
|
-
export interface SearchOptions {
|
|
31
|
-
unique?: keyof typeof UniqueStrategy;
|
|
32
|
-
order?: keyof typeof Sort;
|
|
33
|
-
dir?: keyof typeof SortDirection;
|
|
34
|
-
include_extras?: boolean;
|
|
35
|
-
include_multilingual?: boolean;
|
|
36
|
-
include_variations?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* The page to start on. Defaults to `1`, for first page. A page is 175 cards.
|
|
39
|
-
*/
|
|
40
|
-
page?: number;
|
|
41
|
-
}
|
|
42
|
-
declare enum Rarity {
|
|
43
|
-
common = 0,
|
|
44
|
-
uncommon = 1,
|
|
45
|
-
rare = 2,
|
|
46
|
-
mythic = 3
|
|
47
|
-
}
|
|
48
|
-
declare enum FrameEffect {
|
|
49
|
-
legendary = 0,
|
|
50
|
-
miracle = 1,
|
|
51
|
-
nyxtouched = 2,
|
|
52
|
-
draft = 3,
|
|
53
|
-
devoid = 4,
|
|
54
|
-
tombstone = 5,
|
|
55
|
-
colorshifted = 6,
|
|
56
|
-
inverted = 7,
|
|
57
|
-
sunmoondfc = 8,
|
|
58
|
-
compasslanddfc = 9,
|
|
59
|
-
originpwdfc = 10,
|
|
60
|
-
mooneldrazidfc = 11,
|
|
61
|
-
moonreversemoondfc = 12,
|
|
62
|
-
showcase = 13,
|
|
63
|
-
extendedart = 14
|
|
64
|
-
}
|
|
65
|
-
declare enum Game {
|
|
66
|
-
paper = 0,
|
|
67
|
-
arena = 1,
|
|
68
|
-
mtgo = 2
|
|
69
|
-
}
|
|
70
|
-
declare enum Legality {
|
|
71
|
-
legal = 0,
|
|
72
|
-
not_legal = 1,
|
|
73
|
-
restricted = 2,
|
|
74
|
-
banned = 3
|
|
75
|
-
}
|
|
76
|
-
declare enum Border {
|
|
77
|
-
black = 0,
|
|
78
|
-
borderless = 1,
|
|
79
|
-
gold = 2,
|
|
80
|
-
silver = 3,
|
|
81
|
-
white = 4
|
|
82
|
-
}
|
|
83
|
-
declare enum Layout {
|
|
84
|
-
normal = 0,
|
|
85
|
-
split = 1,
|
|
86
|
-
flip = 2,
|
|
87
|
-
transform = 3,
|
|
88
|
-
meld = 4,
|
|
89
|
-
leveler = 5,
|
|
90
|
-
saga = 6,
|
|
91
|
-
adventure = 7,
|
|
92
|
-
planar = 8,
|
|
93
|
-
scheme = 9,
|
|
94
|
-
vanguard = 10,
|
|
95
|
-
token = 11,
|
|
96
|
-
double_faced_token = 12,
|
|
97
|
-
emblem = 13,
|
|
98
|
-
augment = 14,
|
|
99
|
-
host = 15,
|
|
100
|
-
art_series = 16,
|
|
101
|
-
double_sided = 17
|
|
102
|
-
}
|
|
103
|
-
declare enum Format {
|
|
104
|
-
standard = 0,
|
|
105
|
-
future = 1,
|
|
106
|
-
historic = 2,
|
|
107
|
-
pioneer = 3,
|
|
108
|
-
modern = 4,
|
|
109
|
-
legacy = 5,
|
|
110
|
-
pauper = 6,
|
|
111
|
-
vintage = 7,
|
|
112
|
-
penny = 8,
|
|
113
|
-
commander = 9,
|
|
114
|
-
brawl = 10,
|
|
115
|
-
duel = 11,
|
|
116
|
-
oldschool = 12
|
|
117
|
-
}
|
|
118
|
-
export declare type Legalities = {
|
|
119
|
-
[key in keyof typeof Format]: keyof typeof Legality;
|
|
120
|
-
};
|
|
121
|
-
export interface ImageUris {
|
|
122
|
-
small: string;
|
|
123
|
-
normal: string;
|
|
124
|
-
large: string;
|
|
125
|
-
png: string;
|
|
126
|
-
art_crop: string;
|
|
127
|
-
border_crop: string;
|
|
128
|
-
}
|
|
129
|
-
export interface Prices {
|
|
130
|
-
usd?: string | null;
|
|
131
|
-
usd_foil?: string | null;
|
|
132
|
-
eur?: string | null;
|
|
133
|
-
tix?: string | null;
|
|
134
|
-
}
|
|
135
|
-
export interface PurchaseUris {
|
|
136
|
-
tcgplayer?: string | null;
|
|
137
|
-
cardmarket?: string | null;
|
|
138
|
-
cardhoarder?: string | null;
|
|
139
|
-
[key: string]: string | null | undefined;
|
|
140
|
-
}
|
|
141
|
-
export interface RelatedUris {
|
|
142
|
-
gatherer?: string | null;
|
|
143
|
-
tcgplayer_decks?: string | null;
|
|
144
|
-
edhrec?: string | null;
|
|
145
|
-
mtgtop8?: string | null;
|
|
146
|
-
[key: string]: string | null | undefined;
|
|
147
|
-
}
|
|
148
|
-
declare enum RelatedCardComponent {
|
|
149
|
-
token = 0,
|
|
150
|
-
meld_part = 1,
|
|
151
|
-
meld_result = 2,
|
|
152
|
-
combo_piece = 3
|
|
153
|
-
}
|
|
154
|
-
export interface RelatedCard {
|
|
155
|
-
object: 'related_card';
|
|
156
|
-
id: string;
|
|
157
|
-
component: keyof typeof RelatedCardComponent;
|
|
158
|
-
name: string;
|
|
159
|
-
type_line: string;
|
|
160
|
-
uri: string;
|
|
161
|
-
}
|
|
162
|
-
export interface CardFace {
|
|
163
|
-
object: 'card_face';
|
|
164
|
-
artist?: string | null;
|
|
165
|
-
color_indicator?: Color[] | null;
|
|
166
|
-
colors: Color[];
|
|
167
|
-
flavor_text?: string | null;
|
|
168
|
-
illustration_id?: string | null;
|
|
169
|
-
image_uris?: ImageUris | null;
|
|
170
|
-
loyalty?: string | null;
|
|
171
|
-
mana_cost: string;
|
|
172
|
-
name: string;
|
|
173
|
-
oracle_text?: string | null;
|
|
174
|
-
power?: string | null;
|
|
175
|
-
printed_name?: string | null;
|
|
176
|
-
printed_text?: string | null;
|
|
177
|
-
printed_type_line?: string | null;
|
|
178
|
-
toughness?: string | null;
|
|
179
|
-
type_line: string;
|
|
180
|
-
watermark?: string | null;
|
|
181
|
-
}
|
|
182
|
-
export interface Preview {
|
|
183
|
-
previewed_at?: string | null;
|
|
184
|
-
source_uri?: string | null;
|
|
185
|
-
source?: string | null;
|
|
186
|
-
}
|
|
187
|
-
declare enum PromoType {
|
|
188
|
-
tourney = 0,
|
|
189
|
-
prerelease = 1,
|
|
190
|
-
datestamped = 2,
|
|
191
|
-
planeswalkerdeck = 3,
|
|
192
|
-
buyabox = 4,
|
|
193
|
-
judgegift = 5,
|
|
194
|
-
event = 6,
|
|
195
|
-
convention = 7,
|
|
196
|
-
starterdeck = 8,
|
|
197
|
-
instore = 9,
|
|
198
|
-
setpromo = 10,
|
|
199
|
-
fnm = 11,
|
|
200
|
-
openhouse = 12,
|
|
201
|
-
league = 13,
|
|
202
|
-
draftweekend = 14,
|
|
203
|
-
gameday = 15,
|
|
204
|
-
release = 16,
|
|
205
|
-
intropack = 17,
|
|
206
|
-
giftbox = 18,
|
|
207
|
-
duels = 19,
|
|
208
|
-
wizardsplaynetwork = 20,
|
|
209
|
-
premiereshop = 21,
|
|
210
|
-
playerrewards = 22,
|
|
211
|
-
gateway = 23,
|
|
212
|
-
arenaleague = 24
|
|
213
|
-
}
|
|
214
|
-
export interface Card {
|
|
215
|
-
object: 'card';
|
|
216
|
-
arena_id?: number | null;
|
|
217
|
-
id: string;
|
|
218
|
-
lang: string;
|
|
219
|
-
mtgo_id?: number | null;
|
|
220
|
-
mtgo_foil_id?: number | null;
|
|
221
|
-
multiverse_ids?: number[] | null;
|
|
222
|
-
tcgplayer_id?: number | null;
|
|
223
|
-
oracle_id: string;
|
|
224
|
-
prints_search_uri: string;
|
|
225
|
-
rulings_uri: string;
|
|
226
|
-
scryfall_uri: string;
|
|
227
|
-
uri: string;
|
|
228
|
-
all_parts?: RelatedCard[] | null;
|
|
229
|
-
card_faces?: CardFace[] | null;
|
|
230
|
-
cmc: number;
|
|
231
|
-
colors?: Color[] | null;
|
|
232
|
-
color_identity: Color[];
|
|
233
|
-
color_indicator?: Color[] | null;
|
|
234
|
-
edhrec_rank?: number | null;
|
|
235
|
-
foil: boolean;
|
|
236
|
-
hand_modifier?: string | null;
|
|
237
|
-
layout: keyof typeof Layout;
|
|
238
|
-
legalities: Legalities;
|
|
239
|
-
life_modifier?: string | null;
|
|
240
|
-
loyalty?: string | null;
|
|
241
|
-
mana_cost?: string | null;
|
|
242
|
-
name: string;
|
|
243
|
-
nonfoil: boolean;
|
|
244
|
-
oracle_text?: string | null;
|
|
245
|
-
oversized: boolean;
|
|
246
|
-
power?: string | null;
|
|
247
|
-
reserved: boolean;
|
|
248
|
-
toughness?: string | null;
|
|
249
|
-
type_line: string;
|
|
250
|
-
artist?: string | null;
|
|
251
|
-
artist_ids?: string[] | null;
|
|
252
|
-
booster: boolean;
|
|
253
|
-
border_color: keyof typeof Border;
|
|
254
|
-
card_back_id: string;
|
|
255
|
-
collector_number: string;
|
|
256
|
-
digital: boolean;
|
|
257
|
-
flavor_text?: string | null;
|
|
258
|
-
frame_effects?: (keyof typeof FrameEffect)[] | null;
|
|
259
|
-
frame: '1993' | '1997' | '2003' | '2015' | 'Future';
|
|
260
|
-
full_art: boolean;
|
|
261
|
-
games: (keyof typeof Game)[];
|
|
262
|
-
highres_image: boolean;
|
|
263
|
-
illustration_id?: string | null;
|
|
264
|
-
image_uris?: ImageUris | null;
|
|
265
|
-
prices: Prices;
|
|
266
|
-
printed_name?: string | null;
|
|
267
|
-
printed_text?: string | null;
|
|
268
|
-
printed_type_line?: string | null;
|
|
269
|
-
promo: boolean;
|
|
270
|
-
promo_types?: (keyof typeof PromoType)[] | null;
|
|
271
|
-
purchase_uris: PurchaseUris;
|
|
272
|
-
rarity: keyof typeof Rarity;
|
|
273
|
-
related_uris: RelatedUris;
|
|
274
|
-
released_at: string;
|
|
275
|
-
reprint: boolean;
|
|
276
|
-
scryfall_set_uri: string;
|
|
277
|
-
set_name: string;
|
|
278
|
-
set_search_uri: string;
|
|
279
|
-
set_type: Set['set_type'];
|
|
280
|
-
set_uri: string;
|
|
281
|
-
set: string;
|
|
282
|
-
story_spotlight: boolean;
|
|
283
|
-
textless: boolean;
|
|
284
|
-
variation: boolean;
|
|
285
|
-
variation_of?: string | null;
|
|
286
|
-
watermark?: string | null;
|
|
287
|
-
preview?: Preview | null;
|
|
288
|
-
}
|
|
289
|
-
export interface CardIdentifier {
|
|
290
|
-
id?: string;
|
|
291
|
-
mtgo_id?: number;
|
|
292
|
-
multiverse_id?: number;
|
|
293
|
-
oracle_id?: string;
|
|
294
|
-
illustration_id?: string;
|
|
295
|
-
name?: string;
|
|
296
|
-
set?: string;
|
|
297
|
-
collector_number?: string;
|
|
298
|
-
}
|
|
299
|
-
export declare class CardIdentifier {
|
|
300
|
-
static byId(id: string): CardIdentifier;
|
|
301
|
-
static byMtgoId(id: number): CardIdentifier;
|
|
302
|
-
static byMultiverseId(id: number): CardIdentifier;
|
|
303
|
-
static byOracleId(id: string): CardIdentifier;
|
|
304
|
-
static byIllustrationId(id: string): CardIdentifier;
|
|
305
|
-
static byName(name: string, set?: string): CardIdentifier;
|
|
306
|
-
static bySet(set: string, collectorNumber: string | number): CardIdentifier;
|
|
307
|
-
}
|
|
308
|
-
declare class Cards extends MagicQuerier {
|
|
309
|
-
byName(name: string, fuzzy?: boolean): Promise<Card>;
|
|
310
|
-
byName(name: string, set?: string, fuzzy?: boolean): Promise<Card>;
|
|
311
|
-
byId(id: string): Promise<Card>;
|
|
312
|
-
bySet(setCode: string, collectorNumber: number, lang?: string): Promise<Card>;
|
|
313
|
-
byMultiverseId(id: number): Promise<Card>;
|
|
314
|
-
byMtgoId(id: number): Promise<Card>;
|
|
315
|
-
byArenaId(id: number): Promise<Card>;
|
|
316
|
-
byTcgPlayerId(id: number): Promise<Card>;
|
|
317
|
-
random(): Promise<Card>;
|
|
318
|
-
/**
|
|
319
|
-
* Returns a MagicEmitter of every card in the Scryfall database that matches the given query.
|
|
320
|
-
*/
|
|
321
|
-
search(query: string, options?: SearchOptions | number): MagicEmitter<Card, never>;
|
|
1
|
+
import MagicPageResult from '../query/MagicPageResult';
|
|
2
|
+
import MagicQuery from '../query/MagicQuery';
|
|
3
|
+
import { Card, CardIdentifier, SearchOptions } from '../types';
|
|
4
|
+
declare class Cards extends MagicQuery {
|
|
322
5
|
autoCompleteName(name: string): Promise<string[]>;
|
|
323
|
-
|
|
324
|
-
|
|
6
|
+
byArenaId(id: number): Promise<Card | undefined>;
|
|
7
|
+
byId(id: string): Promise<Card | undefined>;
|
|
8
|
+
byMtgoId(id: number): Promise<Card | undefined>;
|
|
9
|
+
byMultiverseId(id: number): Promise<Card | undefined>;
|
|
10
|
+
byName(name: string, fuzzy?: boolean): Promise<Card | undefined>;
|
|
11
|
+
byName(name: string, set?: string, fuzzy?: boolean): Promise<Card | undefined>;
|
|
12
|
+
bySet(setCode: string, collectorNumber: number, lang?: string): Promise<Card | undefined>;
|
|
13
|
+
byTcgPlayerId(id: number): Promise<Card | undefined>;
|
|
14
|
+
collection(...identifiers: CardIdentifier[]): Promise<Card[]>;
|
|
15
|
+
random(): Promise<Card | undefined>;
|
|
16
|
+
search(query: string, options?: SearchOptions | number): MagicPageResult<Card, Cards>;
|
|
325
17
|
}
|
|
326
18
|
declare const _default: Cards;
|
|
327
19
|
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/api/Catalog.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare class Catalog extends
|
|
3
|
-
|
|
1
|
+
import MagicQuery from '../query/MagicQuery';
|
|
2
|
+
declare class Catalog extends MagicQuery {
|
|
3
|
+
artifactTypes(): Promise<string[]>;
|
|
4
4
|
artistNames(): Promise<string[]>;
|
|
5
|
-
|
|
5
|
+
cardNames(): Promise<string[]>;
|
|
6
6
|
creatureTypes(): Promise<string[]>;
|
|
7
|
-
planeswalkerTypes(): Promise<string[]>;
|
|
8
|
-
landTypes(): Promise<string[]>;
|
|
9
|
-
artifactTypes(): Promise<string[]>;
|
|
10
7
|
enchantmentTypes(): Promise<string[]>;
|
|
11
|
-
|
|
8
|
+
landTypes(): Promise<string[]>;
|
|
9
|
+
loyalties(): Promise<string[]>;
|
|
10
|
+
planeswalkerTypes(): Promise<string[]>;
|
|
12
11
|
powers(): Promise<string[]>;
|
|
12
|
+
spellTypes(): Promise<string[]>;
|
|
13
13
|
toughnesses(): Promise<string[]>;
|
|
14
|
-
loyalties(): Promise<string[]>;
|
|
15
14
|
watermarks(): Promise<string[]>;
|
|
15
|
+
wordBank(): Promise<string[]>;
|
|
16
16
|
}
|
|
17
17
|
declare const _default: Catalog;
|
|
18
18
|
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/api/Misc.d.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
created_at: string;
|
|
5
|
-
updated_at: string;
|
|
6
|
-
priority: number;
|
|
7
|
-
text: string;
|
|
8
|
-
uri: string;
|
|
9
|
-
badge?: string | null;
|
|
10
|
-
}
|
|
11
|
-
declare class Misc extends MagicQuerier {
|
|
1
|
+
import MagicQuery from '../query/MagicQuery';
|
|
2
|
+
import { HomepageLink } from '../types';
|
|
3
|
+
declare class Misc extends MagicQuery {
|
|
12
4
|
homepageLinks(): Promise<HomepageLink[]>;
|
|
13
5
|
}
|
|
14
6
|
declare const _default: Misc;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/api/Rulings.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
comment: string;
|
|
6
|
-
}
|
|
7
|
-
declare class Rulings extends MagicQuerier {
|
|
1
|
+
import MagicQuery from '../query/MagicQuery';
|
|
2
|
+
import { Ruling } from '../types';
|
|
3
|
+
declare class Rulings extends MagicQuery {
|
|
4
|
+
byArenaId(id: number): Promise<Ruling[]>;
|
|
8
5
|
byId(id: string): Promise<Ruling[]>;
|
|
9
|
-
bySet(setCode: string, collectorNumber: string | number): Promise<Ruling[]>;
|
|
10
|
-
byMultiverseId(id: number): Promise<Ruling[]>;
|
|
11
6
|
byMtgoId(id: number): Promise<Ruling[]>;
|
|
12
|
-
|
|
7
|
+
byMultiverseId(id: number): Promise<Ruling[]>;
|
|
8
|
+
bySet(setCode: string, collectorNumber: string | number): Promise<Ruling[]>;
|
|
13
9
|
}
|
|
14
10
|
declare const _default: Rulings;
|
|
15
11
|
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/api/Sets.d.ts
CHANGED
|
@@ -1,50 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
expansion = 1,
|
|
5
|
-
masters = 2,
|
|
6
|
-
masterpiece = 3,
|
|
7
|
-
from_the_vault = 4,
|
|
8
|
-
spellbook = 5,
|
|
9
|
-
premium_deck = 6,
|
|
10
|
-
duel_deck = 7,
|
|
11
|
-
draft_innovation = 8,
|
|
12
|
-
treasure_chest = 9,
|
|
13
|
-
commander = 10,
|
|
14
|
-
planechase = 11,
|
|
15
|
-
archenemy = 12,
|
|
16
|
-
vanguard = 13,
|
|
17
|
-
funny = 14,
|
|
18
|
-
starter = 15,
|
|
19
|
-
box = 16,
|
|
20
|
-
promo = 17,
|
|
21
|
-
token = 18,
|
|
22
|
-
memorabilia = 19
|
|
23
|
-
}
|
|
24
|
-
export interface Set {
|
|
25
|
-
id: string;
|
|
26
|
-
code: string;
|
|
27
|
-
mtgo_code?: string | null;
|
|
28
|
-
tcgplayer_id?: number | null;
|
|
29
|
-
name: string;
|
|
30
|
-
set_type: keyof typeof SetType;
|
|
31
|
-
released_at?: string | null;
|
|
32
|
-
block_code?: string | null;
|
|
33
|
-
block?: string | null;
|
|
34
|
-
parent_set_code?: string | null;
|
|
35
|
-
card_count: number;
|
|
36
|
-
digital: boolean;
|
|
37
|
-
foil_only: boolean;
|
|
38
|
-
scryfall_uri: string;
|
|
39
|
-
uri: string;
|
|
40
|
-
icon_svg_uri: string;
|
|
41
|
-
search_uri: string;
|
|
42
|
-
}
|
|
43
|
-
declare class Sets extends MagicQuerier {
|
|
1
|
+
import MagicQuery from '../query/MagicQuery';
|
|
2
|
+
import { Set } from '../types';
|
|
3
|
+
declare class Sets extends MagicQuery {
|
|
44
4
|
all(): Promise<Set[]>;
|
|
45
|
-
byCode(code: string): Promise<Set>;
|
|
46
|
-
byId(id: string): Promise<Set>;
|
|
47
|
-
byTcgPlayerId(id: number): Promise<Set>;
|
|
5
|
+
byCode(code: string): Promise<Set | undefined>;
|
|
6
|
+
byId(id: string): Promise<Set | undefined>;
|
|
7
|
+
byTcgPlayerId(id: number): Promise<Set | undefined>;
|
|
48
8
|
}
|
|
49
9
|
declare const _default: Sets;
|
|
50
10
|
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/api/Symbology.d.ts
CHANGED
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
symbol: string;
|
|
5
|
-
loose_variant?: string | null;
|
|
6
|
-
english: string;
|
|
7
|
-
transposable: boolean;
|
|
8
|
-
represents_mana: boolean;
|
|
9
|
-
converted_mana_cost?: number | null;
|
|
10
|
-
colors: Color[];
|
|
11
|
-
appears_in_mana_costs: boolean;
|
|
12
|
-
funny: boolean;
|
|
13
|
-
gatherer_alternates?: string[] | null;
|
|
14
|
-
}
|
|
15
|
-
export interface ManaCost {
|
|
16
|
-
cost: string;
|
|
17
|
-
cmc: number;
|
|
18
|
-
colors: Color[];
|
|
19
|
-
colorless: boolean;
|
|
20
|
-
monocolored: boolean;
|
|
21
|
-
multicolored: boolean;
|
|
22
|
-
}
|
|
23
|
-
declare class Symbology extends MagicQuerier {
|
|
1
|
+
import MagicQuery from '../query/MagicQuery';
|
|
2
|
+
import { CardSymbol, ManaCost } from '../types';
|
|
3
|
+
declare class Symbology extends MagicQuery {
|
|
24
4
|
all(): Promise<CardSymbol[]>;
|
|
25
|
-
parseMana(shorthand: string): Promise<ManaCost>;
|
|
5
|
+
parseMana(shorthand: string): Promise<ManaCost | undefined>;
|
|
26
6
|
}
|
|
27
7
|
declare const _default: Symbology;
|
|
28
8
|
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,26 +1 @@
|
|
|
1
|
-
import { SearchError } from './util/MagicQuerier';
|
|
2
|
-
export { default as BulkData } from './api/BulkData';
|
|
3
|
-
export * from './api/Cards';
|
|
4
1
|
export { default as Cards } from './api/Cards';
|
|
5
|
-
export * from './api/Catalog';
|
|
6
|
-
export { default as Catalog } from './api/Catalog';
|
|
7
|
-
export * from './api/Misc';
|
|
8
|
-
export { default as Misc } from './api/Misc';
|
|
9
|
-
export * from './api/Rulings';
|
|
10
|
-
export { default as Rulings } from './api/Rulings';
|
|
11
|
-
export * from './api/Sets';
|
|
12
|
-
export { default as Sets } from './api/Sets';
|
|
13
|
-
export * from './api/Symbology';
|
|
14
|
-
export { default as Symbology } from './api/Symbology';
|
|
15
|
-
export * from './util/Color';
|
|
16
|
-
/**
|
|
17
|
-
* Returns the last error thrown while querying.
|
|
18
|
-
*/
|
|
19
|
-
export declare function error(): SearchError | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Sets the API calls to retry if they fail, for any reason.
|
|
22
|
-
* @param attempts The number of attempts that can be made (includes the initial call).
|
|
23
|
-
* @param timeout The time that the query should wait before attempting the request again.
|
|
24
|
-
* @param canRetry The function.
|
|
25
|
-
*/
|
|
26
|
-
export declare function setRetry(attempts: number, timeout?: number, canRetry?: (error: SearchError) => boolean): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PageQuery } from '../types';
|
|
2
|
+
import MagicQuery from './MagicQuery';
|
|
3
|
+
export default class MagicPageResult<T, Q extends MagicQuery, P = unknown> {
|
|
4
|
+
private readonly q;
|
|
5
|
+
private readonly apiPath;
|
|
6
|
+
private readonly query;
|
|
7
|
+
private readonly post?;
|
|
8
|
+
private hasMore;
|
|
9
|
+
constructor(q: Q, apiPath: string, query: PageQuery, post?: P | undefined);
|
|
10
|
+
private _count?;
|
|
11
|
+
get count(): number | undefined;
|
|
12
|
+
all(): Promise<T[]>;
|
|
13
|
+
get(limit: number): Promise<T[]>;
|
|
14
|
+
next(): Promise<T[]>;
|
|
15
|
+
page(page: number): Promise<T[]>;
|
|
16
|
+
private setNextPage;
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { Query, RetryStrategy, TOrArrayOfT } from '../types';
|
|
3
|
+
export default class MagicQuery {
|
|
4
|
+
static retry: RetryStrategy;
|
|
5
|
+
private static readonly endpoint;
|
|
6
|
+
private static lastQuery;
|
|
7
|
+
private static readonly rateLimit;
|
|
8
|
+
private static canRetry;
|
|
9
|
+
private static debounce;
|
|
10
|
+
private static sleep;
|
|
11
|
+
private static tryQuery;
|
|
12
|
+
query<T = unknown, Y = unknown>(apiPath: TOrArrayOfT<string | number | undefined>, query?: Query, post?: Y, requestOptions?: AxiosRequestConfig): Promise<T | undefined>;
|
|
13
|
+
}
|