scryfall-api 3.0.1 → 3.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/README.md +1 -1
- package/dist/declarations/dist/src/api/CardIdentifierBuilder.d.ts +10 -0
- package/dist/declarations/dist/src/api/Cards.d.ts +19 -0
- package/dist/declarations/dist/src/api/Catalog.d.ts +18 -0
- package/dist/declarations/dist/src/api/Rulings.d.ts +11 -0
- package/dist/declarations/dist/src/api/Sets.d.ts +10 -0
- package/dist/declarations/dist/src/api/Symbology.d.ts +8 -0
- package/dist/declarations/dist/src/error/MagicQueryError.d.ts +5 -0
- package/dist/declarations/dist/src/index.d.ts +10 -0
- package/dist/declarations/dist/src/query/MagicPageResult.d.ts +18 -0
- package/dist/declarations/dist/src/query/MagicQuery.d.ts +13 -0
- package/dist/declarations/dist/src/types/Border.d.ts +7 -0
- package/dist/declarations/dist/src/types/BulkDataDefinition.d.ts +14 -0
- package/dist/declarations/dist/src/types/BulkDataType.d.ts +2 -0
- package/dist/declarations/dist/src/types/BulkDataTypes.d.ts +7 -0
- package/dist/declarations/dist/src/types/Card.d.ts +91 -0
- package/dist/declarations/dist/src/types/CardFace.d.ts +22 -0
- package/dist/declarations/dist/src/types/CardIdentifier.d.ts +10 -0
- package/dist/declarations/dist/src/types/CardSymbol.d.ts +13 -0
- package/dist/declarations/dist/src/types/Color.d.ts +9 -0
- package/dist/declarations/dist/src/types/Format.d.ts +15 -0
- package/dist/declarations/dist/src/types/FrameEffect.d.ts +17 -0
- package/dist/declarations/dist/src/types/Game.d.ts +5 -0
- package/dist/declarations/dist/src/types/HomepageLink.d.ts +9 -0
- package/dist/declarations/dist/src/types/ImageUris.d.ts +8 -0
- package/dist/declarations/dist/src/types/Layout.d.ts +20 -0
- package/dist/declarations/dist/src/types/Legalties.d.ts +5 -0
- package/dist/declarations/dist/src/types/Legalty.d.ts +6 -0
- package/dist/declarations/dist/src/types/ManaCost.d.ts +9 -0
- package/dist/declarations/dist/src/types/PageQuery.d.ts +5 -0
- package/dist/declarations/dist/src/types/PageQueryValue.d.ts +1 -0
- package/dist/declarations/dist/src/types/Preview.d.ts +5 -0
- package/dist/declarations/dist/src/types/Prices.d.ts +6 -0
- package/dist/declarations/dist/src/types/PromoType.d.ts +27 -0
- package/dist/declarations/dist/src/types/PurchaseUris.d.ts +6 -0
- package/dist/declarations/dist/src/types/Query.d.ts +4 -0
- package/dist/declarations/dist/src/types/Rarity.d.ts +6 -0
- package/dist/declarations/dist/src/types/RelatedCard.d.ts +9 -0
- package/dist/declarations/dist/src/types/RelatedCardComponent.d.ts +6 -0
- package/dist/declarations/dist/src/types/RelatedUris.d.ts +7 -0
- package/dist/declarations/dist/src/types/ResultCatalog.d.ts +2 -0
- package/dist/declarations/dist/src/types/ResultData.d.ts +4 -0
- package/dist/declarations/dist/src/types/ResultList.d.ts +7 -0
- package/dist/declarations/dist/src/types/RetryStrategy.d.ts +11 -0
- package/dist/declarations/dist/src/types/Ruling.d.ts +5 -0
- package/dist/declarations/dist/src/types/SearchError.d.ts +7 -0
- package/dist/declarations/dist/src/types/SearchOptions.d.ts +15 -0
- package/dist/declarations/dist/src/types/Set.d.ts +20 -0
- package/dist/declarations/dist/src/types/SetType.d.ts +22 -0
- package/dist/declarations/dist/src/types/Sort.d.ts +15 -0
- package/dist/declarations/dist/src/types/SortDirection.d.ts +5 -0
- package/dist/declarations/dist/src/types/TOrArrayOfT.d.ts +1 -0
- package/dist/declarations/dist/src/types/UniqueStrategy.d.ts +5 -0
- package/dist/declarations/dist/src/types/index.d.ts +42 -0
- package/dist/scryfall-api.cjs.d.ts +1 -1
- package/dist/scryfall-api.cjs.dev.js +53 -122
- package/dist/scryfall-api.cjs.prod.js +53 -122
- package/dist/scryfall-api.esm.js +54 -122
- package/dist/scryfall-api.umd.min.js +1 -1
- package/dist/scryfall-api.umd.min.js.map +1 -1
- package/package.json +59 -7
- package/CHANGELOG.md +0 -13
- package/DOCUMENTATION.md +0 -505
- package/SUPPORT.md +0 -38
package/DOCUMENTATION.md
DELETED
|
@@ -1,505 +0,0 @@
|
|
|
1
|
-
## Table of Contents
|
|
2
|
-
|
|
3
|
-
- [Usage](#usage)
|
|
4
|
-
- [Cards](#cards)
|
|
5
|
-
- [`Cards.autoCompleteName(name: string): Promise<string[]>;` ](#cardsautocompletenamename-string-promisestring-)
|
|
6
|
-
- [`Cards.byArenaId(id: number): Promise<Card | undefined>;` ](#cardsbyarenaidid-number-promiscard-undefined-)
|
|
7
|
-
- [`Cards.byId(id: string): Promise<Card | undefined>;`](#cardsbyidid-string-promiscard-undefined-)
|
|
8
|
-
- [`Cards.byMtgoId(id: number): Promise<Card | undefined>;` ](#cardsbymtgoidid-number-promiscard-undefined-)
|
|
9
|
-
- [`Cards.byMultiverseId(id: number): Promise<Card | undefined>;` ](#cardsbymultiverseidid-number-promiscard-undefined-)
|
|
10
|
-
- [`Cards.byName(name: string, fuzzy = false): Promise<Card | undefined>;`](#cardsbynamename-string-set-string-fuzzy-false-promiscard-undefined-)
|
|
11
|
-
- [`Cards.byName(name: string, set?: string, fuzzy = false): Promise<Card | undefined>;`](#cardsbynamename-string-set-string-fuzzy-false-promiscard-undefined-)
|
|
12
|
-
- [`Cards.bySet(code: string, collectorId: number, lang?: string): Promise<Card | undefined>;`](#cardsbysetsetcode-string-collectornumber-number-lang-string-promiscard-undefined-)
|
|
13
|
-
- [`Cards.byTcgPlayerId(id: number): Promise<Card | undefined>;` ](#cardsbytcgplayeridid-number-promiscard-undefined-)
|
|
14
|
-
- [`Cards.collection(...collection: CardIdentifier[]): Promise<Card[]>;`](#cardscollectioncollection-cardidentifier-promiscard-)
|
|
15
|
-
- [`Cards.random(id: number): Promise<Card | undefined>;` ](#cardsrandomid-number-promiscard-undefined-)
|
|
16
|
-
- [`Cards.search(query: string, options?: SearchOptions | number): MagicPageResult<Card, Cards>;` ](#cardssearchquery-string-options-searchoptions-number-magicpageresultcard-cards-)
|
|
17
|
-
- [Sets](#sets)
|
|
18
|
-
- [`Sets.all(): Promise<Set[]>;` ](#setsall-promisset-)
|
|
19
|
-
- [`Sets.byCode(code: string): Promise<Set>;` ](#setsbycodecode-string-promisset-)
|
|
20
|
-
- [`Sets.byId(id: string): Promise<Set>;` ](#setsbyidid-string-promisset-)
|
|
21
|
-
- [`Sets.byTcgPlayerId(id: number): Promise<Set>;` ](#setsbytcgplayeridid-number-promisset-)
|
|
22
|
-
- [Rulings](#rulings)
|
|
23
|
-
- [`Rulings.byArenaId(id: number): Promise<Ruling[]>;` ](#rulingsbyarenaidid-number-promisruling-)
|
|
24
|
-
- [`Rulings.byId(id: string): Promise<Ruling[]>;` ](#rulingsbyidid-string-promisruling-)
|
|
25
|
-
- [`Rulings.byMtgoId(id: number): Promise<Ruling[]>;` ](#rulingsbymtgoidid-number-promisruling-)
|
|
26
|
-
- [`Rulings.byMultiverseId(id: number): Promise<Ruling[]>;` ](#rulingsbymultiverseidid-number-promisruling-)
|
|
27
|
-
- [`Rulings.bySet(code: string, collectorId: string | number): Promise<Ruling[]>;` ](#rulingsbysetcode-string-collectorid-string-number-promisruling-)
|
|
28
|
-
- [Symbology](#symbology)
|
|
29
|
-
- [`Symbology.all(): Promise<CardSymbol[]>;`](#symbologyall-promiscardsymbol-)
|
|
30
|
-
- [`Symbology.parseMana(mana: string): Promise<ManaCost>;` ](#symbologyparsemanamana-string-promismanacost-)
|
|
31
|
-
- [Catalogs](#catalogs)
|
|
32
|
-
- [`Catalog.artifactTypes(): Promise<string[]>;` ](#catalogartifacttypes-promisstring-)
|
|
33
|
-
- [`Catalog.artistNames(): Promise<string[]>;` ](#catalogartistnames-promisstring-)
|
|
34
|
-
- [`Catalog.cardNames(): Promise<string[]>;` ](#catalogcardnames-promisstring-)
|
|
35
|
-
- [`Catalog.creatureTypes(): Promise<string[]>;` ](#catalogcreaturetypes-promisstring-)
|
|
36
|
-
- [`Catalog.enchantmentTypes(): Promise<string[]>;` ](#catalogenchantmenttypes-promisstring-)
|
|
37
|
-
- [`Catalog.landTypes(): Promise<string[]>;`](#cataloglandtypes-promisstring-)
|
|
38
|
-
- [`Catalog.loyalties(): Promise<string[]>;` ](#catalogloyalties-promisstring-)
|
|
39
|
-
- [`Catalog.planeswalkerTypes(): Promise<string[]>;` ](#catalogplaneswalkertypes-promisstring-)
|
|
40
|
-
- [`Catalog.powers(): Promise<string[]>;` ](#catalogpowers-promisstring-)
|
|
41
|
-
- [`Catalog.spellTypes(): Promise<string[]>;` ](#catalogspelltypes-promisstring-)
|
|
42
|
-
- [`Catalog.toughnesses(): Promise<string[]>;`](#catalooughnesses-promisstring-)
|
|
43
|
-
- [`Catalog.watermarks(): Promise<string[]>;` ](#catalogwatermarks-promisstring-)
|
|
44
|
-
- [`Catalog.wordBank(): Promise<string[]>;`](#catalogwordbank-promisstring-)
|
|
45
|
-
- [Misc](#misc)
|
|
46
|
-
- [`Misc.homepageLinks(): Promise<string[]>;`](#mischomepagelinks-promisstring)
|
|
47
|
-
|
|
48
|
-
## Usage [↑](#table-of-contents)
|
|
49
|
-
|
|
50
|
-
In the documentation below, requiring the package is assumed.
|
|
51
|
-
|
|
52
|
-
```js
|
|
53
|
-
const Scry = require('scryfall-api');
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Or with TypeScrypt:
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
import * as Scry from 'scryfall-api';
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
If you only need Cards
|
|
63
|
-
|
|
64
|
-
```ts
|
|
65
|
-
import { Cards } from 'scryfall-api';
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Cards [↑](#table-of-contents)
|
|
69
|
-
|
|
70
|
-
### `Cards.autoCompleteName(name: string): Promise<string[]>;` [↑](#table-of-contents)
|
|
71
|
-
|
|
72
|
-
From the [Scryfall documentation](https://scryfall.com/docs/api/cards/autocomplete):
|
|
73
|
-
|
|
74
|
-
Returns [an array] containing up to 25 full card names that could be autocompletions of the given string parameter q.
|
|
75
|
-
|
|
76
|
-
This method is designed for creating assistive UI elements that allow users to free-type card names.
|
|
77
|
-
The names are sorted with the nearest match first.
|
|
78
|
-
|
|
79
|
-
Spaces, punctuation, and capitalization are ignored.
|
|
80
|
-
|
|
81
|
-
If q is less than 2 characters long, or if no names match, the Catalog will contain 0 items(instead of returning any errors).
|
|
82
|
-
|
|
83
|
-
```ts
|
|
84
|
-
import { Cards } from 'scryfall-api';
|
|
85
|
-
|
|
86
|
-
Cards.autoCompleteName('bloodsc').then(results => {
|
|
87
|
-
for (const result of results) {
|
|
88
|
-
console.log(result);
|
|
89
|
-
// Bloodscent
|
|
90
|
-
// Blood Scrivener
|
|
91
|
-
// Bloodscale Prowler
|
|
92
|
-
// Burning-Tree Bloodscale
|
|
93
|
-
// Ghor-Clan Bloodscale
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### `Cards.byArenaId(id: number): Promise<Card | undefined>;` [↑](#table-of-contents)
|
|
99
|
-
|
|
100
|
-
Gets a card based on its MTG Arena id.
|
|
101
|
-
|
|
102
|
-
```ts
|
|
103
|
-
import { Cards } from 'scryfall-api';
|
|
104
|
-
|
|
105
|
-
Cards.byArenaId(67330).then(result => console.log(result.name)); // Yargle, Glutton of Urborg
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### `Cards.byId(id: string): Promise<Card | undefined>;` [↑](#table-of-contents)
|
|
109
|
-
|
|
110
|
-
Gets a single card from its ID.
|
|
111
|
-
|
|
112
|
-
```ts
|
|
113
|
-
import { Cards } from 'scryfall-api';
|
|
114
|
-
|
|
115
|
-
Cards.byId('9ea8179a-d3c9-4cdc-a5b5-68cc73279050').then(result => console.log(result.name)); // Blood Scrivener
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### `Cards.byMtgoId(id: number): Promise<Card | undefined>;` [↑](#table-of-contents)
|
|
119
|
-
|
|
120
|
-
Gets a card based on its MTGO(sometimes called "Cat") id.
|
|
121
|
-
|
|
122
|
-
```ts
|
|
123
|
-
import { Cards } from 'scryfall-api';
|
|
124
|
-
|
|
125
|
-
Cards.byMtgoId(48338).then(result => console.log(result.name)); // Blood Scrivener
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### `Cards.byMultiverseId(id: number): Promise<Card | undefined>;` [↑](#table-of-contents)
|
|
129
|
-
|
|
130
|
-
Gets a card based on its multiverse id.
|
|
131
|
-
|
|
132
|
-
```ts
|
|
133
|
-
Cards.byMultiverseId(369030).then(result => console.log(result.name)); // Blood Scrivener
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### `Cards.byName(name: string, set?: string, fuzzy = false): Promise<Card | undefined>;` [↑](#table-of-contents)
|
|
137
|
-
|
|
138
|
-
Gets a card based on its name. Supports fuzzy searching, by 1-2 replacements/translations.
|
|
139
|
-
|
|
140
|
-
```ts
|
|
141
|
-
import { Cards } from 'scryfall-api';
|
|
142
|
-
|
|
143
|
-
Cards.byName('Blood Scrivener').then(result => console.log(result.name)); // Blood Scrivener
|
|
144
|
-
Cards.byName('Bliid Scrivener', true).then(result => console.log(result.name)); // Blood Scrivener
|
|
145
|
-
Cards.byName('Loxodon Warhammer', 'MRD').then(result => console.log(result.name, result.set)); // Loxodon Warhammer, mrd
|
|
146
|
-
Cards.byName('Warhammer', 'MRD', true).then(result => console.log(result.name, result.set)); // Loxodon Warhammer, mrd
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### `Cards.bySet(setCode: string, collectorNumber: number, lang?: string): Promise<Card | undefined>;` [↑](#table-of-contents)
|
|
150
|
-
|
|
151
|
-
Gets a card based on its set and collector id. You can use the optional `lang` argument to get cards in another language. See the [Scryfall Documentation for a list of all languages](https://scryfall.com/docs/api/languages).
|
|
152
|
-
|
|
153
|
-
```ts
|
|
154
|
-
import { Cards } from 'scryfall-api';
|
|
155
|
-
|
|
156
|
-
Cards.bySet('dgm', 22).then(result => console.log(result.name + ', ' + result.printed_name)); // Blood Scrivener, undefined
|
|
157
|
-
Cards.bySet('dgm', 22, 'ja').then(result => console.log(result.name + ', ' + result.printed_name)); // Blood Scrivener, 血の公証人
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### `Cards.byTcgPlayerId(id: number): Promise<Card | undefined>;` [↑](#table-of-contents)
|
|
161
|
-
|
|
162
|
-
Gets a card based on its TCG Player id.
|
|
163
|
-
|
|
164
|
-
```ts
|
|
165
|
-
import { Cards } from 'scryfall-api';
|
|
166
|
-
|
|
167
|
-
Cards.byTcgPlayerId(1030).then(result => console.log(result.name)); // Ankh of Mishra
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### `Cards.collection(...collection: CardIdentifier[]): Promise<Card[]>;` [↑](#table-of-contents)
|
|
171
|
-
|
|
172
|
-
Takes a list of "card identifiers", which describe a card, and returns their actual card objects.
|
|
173
|
-
|
|
174
|
-
This method is useful for decks and even entire collections. Scryfall has a limit of 75 cards, but this API will split your request into multiple API calls, allowing requests of _as many cards as you want_.
|
|
175
|
-
|
|
176
|
-
In order to assist with manual requests, this method comes with a new set of factories by the name `CardIdentifier`. These are:
|
|
177
|
-
|
|
178
|
-
- `CardIdentifier.byId(id: string): CardIdentifier;`
|
|
179
|
-
- `CardIdentifier.byMultiverseId(id: number): CardIdentifier;`
|
|
180
|
-
- `CardIdentifier.byMtgoId(id: number): CardIdentifier;`
|
|
181
|
-
- `CardIdentifier.byOracleId(id: string): CardIdentifier;`
|
|
182
|
-
- `CardIdentifier.byIllustrationId(id: string): CardIdentifier;`
|
|
183
|
-
- `CardIdentifier.byName(string: string, set?: string): CardIdentifier;`
|
|
184
|
-
- `CardIdentifier.byName(string: string, set?: string): CardIdentifier;`
|
|
185
|
-
- `CardIdentifier.bySet(set: string, collectorNumber: string | number): CardIdentifier;`
|
|
186
|
-
|
|
187
|
-
```ts
|
|
188
|
-
import { Cards, CardIdentifier } from 'scryfall-api';
|
|
189
|
-
|
|
190
|
-
const collection = [
|
|
191
|
-
CardIdentifier.byId('94c70f23-0ca9-425e-a53a-6c09921c0075'),
|
|
192
|
-
CardIdentifier.byMultiverseId(462293),
|
|
193
|
-
CardIdentifier.byMtgoId(71692),
|
|
194
|
-
CardIdentifier.byOracleId('394c6de5-7957-4a0b-a6b9-ee0c707cd022'),
|
|
195
|
-
CardIdentifier.byIllustrationId('99f43949-049e-41e2-bf4c-e22e11790012'),
|
|
196
|
-
CardIdentifier.byName('Blood Scrivener'),
|
|
197
|
-
CardIdentifier.byName('Lightning Bolt', 'prm'),
|
|
198
|
-
CardIdentifier.bySet('mrd', '150'),
|
|
199
|
-
];
|
|
200
|
-
|
|
201
|
-
const cards = await Cards.collection(...collection);
|
|
202
|
-
// every card identifier has been mapped to its real card object
|
|
203
|
-
|
|
204
|
-
for (const card of cards) {
|
|
205
|
-
console.log(card.name);
|
|
206
|
-
}
|
|
207
|
-
// Crush Dissent
|
|
208
|
-
// Contentious Plan
|
|
209
|
-
// Bond of Insight
|
|
210
|
-
// Forgotten Cave
|
|
211
|
-
// GO TO JAIL
|
|
212
|
-
// Blood Scrivener
|
|
213
|
-
// Lightning Bolt
|
|
214
|
-
// Chalice of the Void
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### `Cards.random(id: number): Promise<Card | undefined>;` [↑](#table-of-contents)
|
|
218
|
-
|
|
219
|
-
Gets a random card.
|
|
220
|
-
|
|
221
|
-
```ts
|
|
222
|
-
import { Cards } from 'scryfall-api';
|
|
223
|
-
|
|
224
|
-
Cards.random().then(result => console.log(result.name));
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
### `Cards.search(query: string, options?: SearchOptions | number): MagicPageResult<Card, Cards>;` [↑](#table-of-contents)
|
|
228
|
-
|
|
229
|
-
Queries for a card using the [Scryfall Search API](https://scryfall.com/docs/reference).
|
|
230
|
-
|
|
231
|
-
```ts
|
|
232
|
-
import { Cards } from 'scryfall-api';
|
|
233
|
-
|
|
234
|
-
Cards.search('type:planeswalker')
|
|
235
|
-
.all()
|
|
236
|
-
.then(result => console.log(result.name));
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
For information on how to provide extra options, see the [`/get/cards/search`](https://scryfall.com/docs/api/cards/search) page on Scryfall. You can also reference the [`SearchOptions`](src/types/SearchOptions.ts) interface
|
|
240
|
-
|
|
241
|
-
This query returns a [`MagicPageResult`](#magicemittert-).
|
|
242
|
-
|
|
243
|
-
The page parameter is the page of results that the query will begin at. A page is 175 cards, and cannot be changed. To get only the one page you requested, you can do the following:
|
|
244
|
-
|
|
245
|
-
```ts
|
|
246
|
-
import { Cards } from 'scryfall-api';
|
|
247
|
-
|
|
248
|
-
// Start in page 13
|
|
249
|
-
const result = Cards.search('type:planeswalker', 13);
|
|
250
|
-
|
|
251
|
-
// Get page 13
|
|
252
|
-
const cardsFromPage13 = await result.next(); // cardsFromPage13.lenth === 175
|
|
253
|
-
|
|
254
|
-
// Get page 14
|
|
255
|
-
const cardsFromPage14 = await result.next(); // cardsFromPage14.lenth === 175
|
|
256
|
-
|
|
257
|
-
// Or you can get any page directly by
|
|
258
|
-
const cardsFromPage15 = await result.page(15); // cardsFromPage15.lenth === 175
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
You can bypass the 175 card limit by using:
|
|
262
|
-
|
|
263
|
-
```ts
|
|
264
|
-
import { Cards } from 'scryfall-api';
|
|
265
|
-
|
|
266
|
-
// Get 300 cards starting on page 1
|
|
267
|
-
const result1 = await Cards.search('type:planeswalker').get(200); // result.lenth === 200
|
|
268
|
-
|
|
269
|
-
// Get 300 cards starting on page 13
|
|
270
|
-
const result2 = await Cards.search('type:planeswalker', 13).get(300); // result.lenth === 300
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
## Sets [↑](#table-of-contents)
|
|
274
|
-
|
|
275
|
-
### `Sets.all(): Promise<Set[]>;` [↑](#table-of-contents)
|
|
276
|
-
|
|
277
|
-
Gets all sets.
|
|
278
|
-
|
|
279
|
-
```ts
|
|
280
|
-
import { Sets } from 'scryfall-api';
|
|
281
|
-
|
|
282
|
-
Sets.all().then(result => console.log(result.lenh));
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### `Sets.byCode(code: string): Promise<Set>;` [↑](#table-of-contents)
|
|
286
|
-
|
|
287
|
-
Gets a set by its code.
|
|
288
|
-
|
|
289
|
-
```ts
|
|
290
|
-
import { Sets } from 'scryfall-api';
|
|
291
|
-
|
|
292
|
-
Sets.byCode('hou').then(set => console.log(set.name)); // Hour of Devastation
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
### `Sets.byId(id: string): Promise<Set>;` [↑](#table-of-contents)
|
|
296
|
-
|
|
297
|
-
Gets a set by its Scryfall ID.
|
|
298
|
-
|
|
299
|
-
```ts
|
|
300
|
-
import { Sets } from 'scryfall-api';
|
|
301
|
-
|
|
302
|
-
Sets.byId('65ff168b-bb94-47a5-a8f9-4ec6c213e768').then(set => console.log(set.name)); // Hour of Devastation
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
### `Sets.byTcgPlayerId(id: number): Promise<Set>;` [↑](#table-of-contents)
|
|
306
|
-
|
|
307
|
-
Gets a set by its TCG Player ID, also known as the `groupId` on [TCGPlayer's API](https://docs.tcgplayer.com/docs).
|
|
308
|
-
|
|
309
|
-
```ts
|
|
310
|
-
import { Sets } from 'scryfall-api';
|
|
311
|
-
|
|
312
|
-
Sets.byTcgPlayerId(1934).then(set => console.log(set.name)); // Hour of Devastation
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
## Rulings [↑](#table-of-contents)
|
|
316
|
-
|
|
317
|
-
### `Rulings.byArenaId(id: number): Promise<Ruling[]>;` [↑](#table-of-contents)
|
|
318
|
-
|
|
319
|
-
Gets the rulings for a card based on its Arena id.
|
|
320
|
-
|
|
321
|
-
```ts
|
|
322
|
-
import { Rulings } from 'scryfall-api';
|
|
323
|
-
|
|
324
|
-
Rulings.byArenaId(67204).then(result => console.log(result.lenh)); // 3
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
### `Rulings.byId(id: string): Promise<Ruling[]>;` [↑](#table-of-contents)
|
|
328
|
-
|
|
329
|
-
Gets the rulings for a single card from its ID.
|
|
330
|
-
|
|
331
|
-
```ts
|
|
332
|
-
import { Rulings } from 'scryfall-api';
|
|
333
|
-
|
|
334
|
-
Rulings.byId('9ea8179a-d3c9-4cdc-a5b5-68cc73279050').then(result => console.log(result.lenh)); // 2
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
### `Rulings.byMtgoId(id: number): Promise<Ruling[]>;` [↑](#table-of-contents)
|
|
338
|
-
|
|
339
|
-
Gets the rulings for a card based on its MTGO(sometimes called "Cat") id.
|
|
340
|
-
|
|
341
|
-
```ts
|
|
342
|
-
import { Rulings } from 'scryfall-api';
|
|
343
|
-
|
|
344
|
-
Rulings.byMtgoId(48338).then(result => console.log(result.lenh)); // 2
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
### `Rulings.byMultiverseId(id: number): Promise<Ruling[]>;` [↑](#table-of-contents)
|
|
348
|
-
|
|
349
|
-
Gets the rulings for a card based on its multiverse id.
|
|
350
|
-
|
|
351
|
-
```ts
|
|
352
|
-
import { Rulings } from 'scryfall-api';
|
|
353
|
-
|
|
354
|
-
Rulings.byMultiverseId(369030).then(result => console.log(result.lenh)); // 2
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
### `Rulings.bySet(code: string, collectorId: string | number): Promise<Ruling[]>;` [↑](#table-of-contents)
|
|
358
|
-
|
|
359
|
-
Gets the rulings for a card based on its set and collector id.
|
|
360
|
-
|
|
361
|
-
```ts
|
|
362
|
-
import { Rulings } from 'scryfall-api';
|
|
363
|
-
|
|
364
|
-
Rulings.bySet('dgm', '22').then(result => console.log(result.lenh)); // 2
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
## Symbology [↑](#table-of-contents)
|
|
368
|
-
|
|
369
|
-
### `Symbology.all(): Promise<CardSymbol[]>;` [↑](#table-of-contents)
|
|
370
|
-
|
|
371
|
-
Gets all [card symbols](https://scryfall.com/docs/api/card-symbols).
|
|
372
|
-
|
|
373
|
-
```ts
|
|
374
|
-
import { Symbology } from 'scryfall-api';
|
|
375
|
-
|
|
376
|
-
Symbology.all().then(result => console.log(result.lenh)); // 63
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
### `Symbology.parseMana(mana: string): Promise<ManaCost>;` [↑](#table-of-contents)
|
|
380
|
-
|
|
381
|
-
From the [Scryfall documentation](https://scryfall.com/docs/api/card-symbols/parse-mana):
|
|
382
|
-
|
|
383
|
-
Parses the given mana cost parameter and returns Scryfall’s interpretation.
|
|
384
|
-
|
|
385
|
-
The server understands most community shorthand for mana costs(such as `2WW` for `{2}{W}{W}`). Symbols can also be out of order, lowercase, or have multiple colorless costs(such as `2{g}2` for `{4}{G}`).
|
|
386
|
-
|
|
387
|
-
```ts
|
|
388
|
-
import { Symbology } from 'scryfall-api';
|
|
389
|
-
|
|
390
|
-
Symbology.parseMana('7wg').then(result => console.log(result.cost)); // {7}{W}{G}
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
## Catalogs [↑](#table-of-contents)
|
|
394
|
-
|
|
395
|
-
### `Catalog.cardNames(): Promise<string[]>;` [↑](#table-of-contents)
|
|
396
|
-
|
|
397
|
-
```ts
|
|
398
|
-
import { Catalog } from 'scryfall-api';
|
|
399
|
-
|
|
400
|
-
Catalog.cardNames().then(result => console.log(result.lenh)); // 18059
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
### `Catalog.artistNames(): Promise<string[]>;` [↑](#table-of-contents)
|
|
404
|
-
|
|
405
|
-
```ts
|
|
406
|
-
import { Catalog } from 'scryfall-api';
|
|
407
|
-
|
|
408
|
-
Catalog.artistNames().then(result => console.log(result.lenh)); // 676
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
### `Catalog.wordBank(): Promise<string[]>;` [↑](#table-of-contents)
|
|
412
|
-
|
|
413
|
-
```ts
|
|
414
|
-
import { Catalog } from 'scryfall-api';
|
|
415
|
-
|
|
416
|
-
Catalog.wordBank().then(result => console.log(result.lenh)); // 12892
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
### `Catalog.creatureTypes(): Promise<string[]>;` [↑](#table-of-contents)
|
|
420
|
-
|
|
421
|
-
```ts
|
|
422
|
-
import { Catalog } from 'scryfall-api';
|
|
423
|
-
|
|
424
|
-
Catalog.creatureTypes().then(result => console.log(result.lenh)); // 242
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
### `Catalog.planeswalkerTypes(): Promise<string[]>;` [↑](#table-of-contents)
|
|
428
|
-
|
|
429
|
-
```ts
|
|
430
|
-
import { Catalog } from 'scryfall-api';
|
|
431
|
-
|
|
432
|
-
Catalog.planeswalkerTypes().then(result => console.log(result.lenh)); // 42
|
|
433
|
-
```
|
|
434
|
-
|
|
435
|
-
### `Catalog.landTypes(): Promise<string[]>;` [↑](#table-of-contents)
|
|
436
|
-
|
|
437
|
-
```ts
|
|
438
|
-
import { Catalog } from 'scryfall-api';
|
|
439
|
-
|
|
440
|
-
Catalog.landTypes().then(result => console.log(result.lenh)); // 13
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
### `Catalog.artifactTypes(): Promise<string[]>;` [↑](#table-of-contents)
|
|
444
|
-
|
|
445
|
-
```ts
|
|
446
|
-
import { Catalog } from 'scryfall-api';
|
|
447
|
-
|
|
448
|
-
Catalog.artifactTypes().then(result => console.log(result.lenh)); // 6
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
### `Catalog.enchantmentTypes(): Promise<string[]>;` [↑](#table-of-contents)
|
|
452
|
-
|
|
453
|
-
```ts
|
|
454
|
-
import { Catalog } from 'scryfall-api';
|
|
455
|
-
|
|
456
|
-
Catalog.enchantmentTypes().then(result => console.log(result.lenh)); // 5
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
### `Catalog.spellTypes(): Promise<string[]>;` [↑](#table-of-contents)
|
|
460
|
-
|
|
461
|
-
```ts
|
|
462
|
-
import { Catalog } from 'scryfall-api';
|
|
463
|
-
|
|
464
|
-
Catalog.spellTypes().then(result => console.log(result.lenh)); // 2
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
### `Catalog.powers(): Promise<string[]>;` [↑](#table-of-contents)
|
|
468
|
-
|
|
469
|
-
```ts
|
|
470
|
-
import { Catalog } from 'scryfall-api';
|
|
471
|
-
|
|
472
|
-
Catalog.powers().then(result => console.log(result.lenh)); // 33
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
### `Catalog.toughnesses(): Promise<string[]>;` [↑](#table-of-contents)
|
|
476
|
-
|
|
477
|
-
```ts
|
|
478
|
-
import { Catalog } from 'scryfall-api';
|
|
479
|
-
|
|
480
|
-
Catalog.toughnesses().then(result => console.log(result.lenh)); // 35
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
### `Catalog.loyalties(): Promise<string[]>;` [↑](#table-of-contents)
|
|
484
|
-
|
|
485
|
-
```ts
|
|
486
|
-
import { Catalog } from 'scryfall-api';
|
|
487
|
-
|
|
488
|
-
Catalog.loyalties().then(result => console.log(result.lenh)); // 9
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
### `Catalog.watermarks(): Promise<string[]>;` [↑](#table-of-contents)
|
|
492
|
-
|
|
493
|
-
```ts
|
|
494
|
-
import { Catalog } from 'scryfall-api';
|
|
495
|
-
|
|
496
|
-
Catalog.watermarks().then(result => console.log(result.lenh)); // 50
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
## Misc [↑](#table-of-contents)
|
|
500
|
-
|
|
501
|
-
### `Misc.homepageLinks(): Promise<string[]>;` [↑](#table-of-contents)
|
|
502
|
-
|
|
503
|
-
```ts
|
|
504
|
-
Misc.homepageLinks().then(result => console.log(result.lenh)); // 4
|
|
505
|
-
```
|
package/SUPPORT.md
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
## Supported:
|
|
2
|
-
|
|
3
|
-
| Query | Result |
|
|
4
|
-
| --------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
|
|
5
|
-
| [`/cards/named?{fuzzy/exact}=<card name>`](DOCUMENTATION.md#cardsbyname-name-string-fuzzy--false-promisecard-) | Card |
|
|
6
|
-
| [`/cards/:id`](DOCUMENTATION.md#cardsbyid-id-string-promisecard-) | Card |
|
|
7
|
-
| [`/cards/:set/:collector_number(/:lang)`](DOCUMENTATION.md#cardsbyset-setcode-string-collectorid-number-lang-string-promisecard-) | Card |
|
|
8
|
-
| [`/cards/multiverse/:multiverse_id`](DOCUMENTATION.mdardsbymultiverseid-id-number-promisecard-) | Card |
|
|
9
|
-
| [`/cards/mtgo/:mtgo_id`](DOCUMENTATION.mdardsbymtgoid-id-number-promisecard-) | Card |
|
|
10
|
-
| [`/cards/arena/:id`](DOCUMENTATION.mdardsbyarenaid-id-number-promisecard-) | Card |
|
|
11
|
-
| [`/cards/tcgplayer/:id`](DOCUMENTATION.mdardsbytcgplayerid-id-number-promisecard-) | Card |
|
|
12
|
-
| [`/cards/random`](DOCUMENTATION.mdardsrandom-id-number-promisecard-) | Card |
|
|
13
|
-
| [`/cards/search?q=:query`](DOCUMENTATION.mdardssearch-query-string-magicemittercard-) | List\<Card\> |
|
|
14
|
-
| [`/cards/autocomplete?q=:query`](DOCUMENTATION.mdardsautocompletename-name-string-promisestring-) | Catalog |
|
|
15
|
-
| [`/cards/collection`](DOCUMENTATION.mdardscollection-collection-cardidentifier-magicemittercard-) | List\<Card\> |
|
|
16
|
-
| [`/sets`](DOCUMENTATION.mdetsall--promiseset-) | List\<Set\> |
|
|
17
|
-
| [`/sets/:code`](DOCUMENTATION.mdetsbycode-code-string-promiseset-) | Set |
|
|
18
|
-
| [`/sets/:id`](DOCUMENTATION.mdetsbyid-id-string-promiseset-) | Set |
|
|
19
|
-
| [`/sets/tcgplayer/:id`](DOCUMENTATION.mdetsbytcgplayerid-id-number-promiseset-) | Set |
|
|
20
|
-
| [`/cards/multiverse/:id/rulings`](DOCUMENTATION.mdulingsbymultiverseid-id-number-promiseruling-) | List\<Ruling\> |
|
|
21
|
-
| [`/cards/mtgo/:id/rulings`](DOCUMENTATION.mdulingsbymtgoid-id-number-promiseruling-) | List\<Ruling\> |
|
|
22
|
-
| [`/cards/arena/:id/rulings`](DOCUMENTATION.mdulingsbyarenaid-id-number-promiseruling-) | List\<Ruling\> |
|
|
23
|
-
| [`/cards/:code/:number/rulings`](DOCUMENTATION.mdulingsbyset-code-string-collectorid-string-promiseruling-) | List\<Ruling\> |
|
|
24
|
-
| [`/cards/:id/rulings`](DOCUMENTATION.mdulingsbyid-id-string-promiseruling-) | List\<Ruling\> |
|
|
25
|
-
| [`/symbology`](DOCUMENTATION.mdymbologyall--promisecardsymbol-) | List\<CardSymbol\> |
|
|
26
|
-
| [`/symbology/parse-mana?cost=:cost`](DOCUMENTATION.mdymbologyparsemana-mana-string-promisemanacost-) | ManaCost |
|
|
27
|
-
| [`/catalog/card-names`](DOCUMENTATION.mdatalogcardnames--promisestring-) | Catalog |
|
|
28
|
-
| [`/catalog/word-bank`](DOCUMENTATION.mdatalogwordbank--promisestring-) | Catalog |
|
|
29
|
-
| [`/catalog/creature-types`](DOCUMENTATION.mdatalogcreaturetypes--promisestring-) | Catalog |
|
|
30
|
-
| [`/catalog/planeswalker-types`](DOCUMENTATION.mdatalogplaneswalkertypes--promisestring-) | Catalog |
|
|
31
|
-
| [`/catalog/land-types`](DOCUMENTATION.mdataloglandtypes--promisestring-) | Catalog |
|
|
32
|
-
| [`/catalog/artifact-types`](DOCUMENTATION.mdatalogartifacttypes--promisestring-) | Catalog |
|
|
33
|
-
| [`/catalog/enchantment-types`](DOCUMENTATION.mdatalogenchantmenttypes--promisestring-) | Catalog |
|
|
34
|
-
| [`/catalog/spell-types`](DOCUMENTATION.mdatalogspelltypes--promisestring-) | Catalog |
|
|
35
|
-
| [`/catalog/powers`](DOCUMENTATION.mdatalogpowers--promisestring-) | Catalog |
|
|
36
|
-
| [`/catalog/toughnesses`](DOCUMENTATION.mdatalogtoughnesses--promisestring-) | Catalog |
|
|
37
|
-
| [`/catalog/loyalties`](DOCUMENTATION.mdatalogloyalties--promisestring-) | Catalog |
|
|
38
|
-
| [`/catalog/watermarks`](DOCUMENTATION.mdatalogwatermarks--promisestring-) | Catalog |
|