scryfall-api 2.2.1 → 3.0.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/LICENSE +18 -4
- package/README.md +8 -14
- package/{lib → dist/declarations/src}/api/CardIdentifierBuilder.d.ts +10 -10
- package/{lib → dist/declarations/src}/api/Cards.d.ts +19 -19
- package/{lib → dist/declarations/src}/api/Catalog.d.ts +18 -18
- package/{lib → dist/declarations/src}/api/Misc.d.ts +7 -7
- package/{lib → dist/declarations/src}/api/Rulings.d.ts +11 -11
- package/{lib → dist/declarations/src}/api/Sets.d.ts +10 -10
- package/{lib → dist/declarations/src}/api/Symbology.d.ts +8 -8
- package/{lib → dist/declarations/src}/error/MagicQueryError.d.ts +5 -5
- package/{lib → dist/declarations/src}/index.d.ts +11 -11
- package/{lib → dist/declarations/src}/query/MagicPageResult.d.ts +18 -18
- package/{lib → dist/declarations/src}/query/MagicQuery.d.ts +13 -13
- package/{lib → dist/declarations/src}/types/Border.d.ts +7 -7
- package/{lib → dist/declarations/src}/types/BulkDataDefinition.d.ts +14 -14
- package/{lib → dist/declarations/src}/types/BulkDataType.d.ts +2 -2
- package/{lib → dist/declarations/src}/types/BulkDataTypes.d.ts +7 -7
- package/{lib → dist/declarations/src}/types/Card.d.ts +91 -91
- package/{lib → dist/declarations/src}/types/CardFace.d.ts +22 -22
- package/{lib → dist/declarations/src}/types/CardIdentifier.d.ts +10 -10
- package/{lib → dist/declarations/src}/types/CardSymbol.d.ts +13 -13
- package/{lib → dist/declarations/src}/types/Color.d.ts +9 -9
- package/{lib → dist/declarations/src}/types/Format.d.ts +15 -15
- package/{lib → dist/declarations/src}/types/FrameEffect.d.ts +17 -17
- package/{lib → dist/declarations/src}/types/Game.d.ts +5 -5
- package/{lib → dist/declarations/src}/types/HomepageLink.d.ts +9 -9
- package/{lib → dist/declarations/src}/types/ImageUris.d.ts +8 -8
- package/{lib → dist/declarations/src}/types/Layout.d.ts +20 -20
- package/{lib → dist/declarations/src}/types/Legalties.d.ts +5 -5
- package/{lib → dist/declarations/src}/types/Legalty.d.ts +6 -6
- package/{lib → dist/declarations/src}/types/ManaCost.d.ts +9 -9
- package/{lib → dist/declarations/src}/types/PageQuery.d.ts +5 -5
- package/{lib → dist/declarations/src}/types/PageQueryValue.d.ts +1 -1
- package/{lib → dist/declarations/src}/types/Preview.d.ts +5 -5
- package/{lib → dist/declarations/src}/types/Prices.d.ts +6 -6
- package/{lib → dist/declarations/src}/types/PromoType.d.ts +27 -27
- package/{lib → dist/declarations/src}/types/PurchaseUris.d.ts +6 -6
- package/{lib → dist/declarations/src}/types/Query.d.ts +4 -4
- package/{lib → dist/declarations/src}/types/Rarity.d.ts +6 -6
- package/{lib → dist/declarations/src}/types/RelatedCard.d.ts +9 -9
- package/{lib → dist/declarations/src}/types/RelatedCardComponent.d.ts +6 -6
- package/{lib → dist/declarations/src}/types/RelatedUris.d.ts +7 -7
- package/{lib → dist/declarations/src}/types/ResultCatalog.d.ts +2 -2
- package/{lib → dist/declarations/src}/types/ResultData.d.ts +4 -4
- package/{lib → dist/declarations/src}/types/ResultList.d.ts +7 -7
- package/{lib → dist/declarations/src}/types/RetryStrategy.d.ts +11 -11
- package/{lib → dist/declarations/src}/types/Ruling.d.ts +5 -5
- package/{lib → dist/declarations/src}/types/SearchError.d.ts +7 -7
- package/{lib → dist/declarations/src}/types/SearchOptions.d.ts +15 -15
- package/{lib → dist/declarations/src}/types/Set.d.ts +20 -20
- package/{lib → dist/declarations/src}/types/SetType.d.ts +22 -22
- package/{lib → dist/declarations/src}/types/Sort.d.ts +15 -15
- package/{lib → dist/declarations/src}/types/SortDirection.d.ts +5 -5
- package/{lib → dist/declarations/src}/types/TOrArrayOfT.d.ts +1 -1
- package/{lib → dist/declarations/src}/types/UniqueStrategy.d.ts +5 -5
- package/{lib → dist/declarations/src}/types/index.d.ts +42 -42
- package/dist/scryfall-api.cjs.d.ts +1 -0
- package/dist/scryfall-api.cjs.dev.js +653 -0
- package/dist/scryfall-api.cjs.js +7 -0
- package/dist/scryfall-api.cjs.prod.js +653 -0
- package/dist/scryfall-api.esm.js +638 -0
- package/dist/scryfall-api.umd.min.js +2 -0
- package/dist/scryfall-api.umd.min.js.map +1 -0
- package/package.json +39 -91
- package/CHANGELOG.md +0 -47
- package/lib/api/Cards.spec.d.ts +0 -1
- package/lib/api/Catalog.spec.d.ts +0 -1
- package/lib/api/Misc.spec.d.ts +0 -1
- package/lib/api/Rulings.spec.d.ts +0 -1
- package/lib/api/Sets.spec.d.ts +0 -1
- package/lib/api/Symbology.spec.d.ts +0 -1
- package/lib/skryfall.es5.js +0 -660
- package/lib/skryfall.es5.js.map +0 -1
- package/lib/skryfall.es5.min.js +0 -16
- package/lib/skryfall.es5.min.js.map +0 -1
- package/lib/skryfall.umd.js +0 -679
- package/lib/skryfall.umd.js.map +0 -1
- package/lib/skryfall.umd.min.js +0 -16
- package/lib/skryfall.umd.min.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copyright (c) 2021-2022 Mario Menéndez
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# scryfall-api
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/scryfall-api)
|
|
4
|
+
[](https://github.com/MarioMH8/scryfall-api)
|
|
5
5
|
|
|
6
|
-
A
|
|
6
|
+
A Javascript library for [Scryfall](https://scryfall.com/docs/api) written in Typescript.
|
|
7
7
|
|
|
8
|
-
As of [
|
|
8
|
+
As of [January 29th, 2022](./CHANGELOG.md), almost 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
|
|
|
@@ -22,9 +22,9 @@ Link to [documentation.](./DOCUMENTATION.md)
|
|
|
22
22
|
Thanks for wanting to help out! Here's the setup you'll have to do:
|
|
23
23
|
|
|
24
24
|
```bat
|
|
25
|
-
git clone
|
|
25
|
+
git clone git@github.com:MarioMH8/scryfall-api.git
|
|
26
26
|
cd scryfall-api
|
|
27
|
-
|
|
27
|
+
yarn install
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
You can now make changes to the repository.
|
|
@@ -32,15 +32,9 @@ You can now make changes to the repository.
|
|
|
32
32
|
To compile:
|
|
33
33
|
|
|
34
34
|
```bat
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
To compile on every file change:
|
|
39
|
-
|
|
40
|
-
```bat
|
|
41
|
-
npm run build:watch
|
|
35
|
+
yarn build
|
|
42
36
|
```
|
|
43
37
|
|
|
44
38
|
## MIT License
|
|
45
39
|
|
|
46
|
-
[Copyright
|
|
40
|
+
[Copyright 2021-2022 Mario Menéndez](./LICENSE)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CardIdentifier } from '../types';
|
|
2
|
-
export declare class CardIdentifierBuilder {
|
|
3
|
-
static byId(id: string): CardIdentifier;
|
|
4
|
-
static byIllustrationId(id: string): CardIdentifier;
|
|
5
|
-
static byMtgoId(id: number): CardIdentifier;
|
|
6
|
-
static byMultiverseId(id: number): CardIdentifier;
|
|
7
|
-
static byName(name: string, set?: string): CardIdentifier;
|
|
8
|
-
static byOracleId(id: string): CardIdentifier;
|
|
9
|
-
static bySet(set: string, collectorNumber: string | number): CardIdentifier;
|
|
10
|
-
}
|
|
1
|
+
import { CardIdentifier } from '../types';
|
|
2
|
+
export declare class CardIdentifierBuilder {
|
|
3
|
+
static byId(id: string): CardIdentifier;
|
|
4
|
+
static byIllustrationId(id: string): CardIdentifier;
|
|
5
|
+
static byMtgoId(id: number): CardIdentifier;
|
|
6
|
+
static byMultiverseId(id: number): CardIdentifier;
|
|
7
|
+
static byName(name: string, set?: string): CardIdentifier;
|
|
8
|
+
static byOracleId(id: string): CardIdentifier;
|
|
9
|
+
static bySet(set: string, collectorNumber: string | number): CardIdentifier;
|
|
10
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
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 {
|
|
5
|
-
autoCompleteName(name: string): Promise<string[]>;
|
|
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>;
|
|
17
|
-
}
|
|
18
|
-
declare const _default: Cards;
|
|
19
|
-
export default _default;
|
|
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 {
|
|
5
|
+
autoCompleteName(name: string): Promise<string[]>;
|
|
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>;
|
|
17
|
+
}
|
|
18
|
+
declare const _default: Cards;
|
|
19
|
+
export default _default;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import MagicQuery from '../query/MagicQuery';
|
|
2
|
-
declare class Catalog extends MagicQuery {
|
|
3
|
-
artifactTypes(): Promise<string[]>;
|
|
4
|
-
artistNames(): Promise<string[]>;
|
|
5
|
-
cardNames(): Promise<string[]>;
|
|
6
|
-
creatureTypes(): Promise<string[]>;
|
|
7
|
-
enchantmentTypes(): Promise<string[]>;
|
|
8
|
-
landTypes(): Promise<string[]>;
|
|
9
|
-
loyalties(): Promise<string[]>;
|
|
10
|
-
planeswalkerTypes(): Promise<string[]>;
|
|
11
|
-
powers(): Promise<string[]>;
|
|
12
|
-
spellTypes(): Promise<string[]>;
|
|
13
|
-
toughnesses(): Promise<string[]>;
|
|
14
|
-
watermarks(): Promise<string[]>;
|
|
15
|
-
wordBank(): Promise<string[]>;
|
|
16
|
-
}
|
|
17
|
-
declare const _default: Catalog;
|
|
18
|
-
export default _default;
|
|
1
|
+
import MagicQuery from '../query/MagicQuery';
|
|
2
|
+
declare class Catalog extends MagicQuery {
|
|
3
|
+
artifactTypes(): Promise<string[]>;
|
|
4
|
+
artistNames(): Promise<string[]>;
|
|
5
|
+
cardNames(): Promise<string[]>;
|
|
6
|
+
creatureTypes(): Promise<string[]>;
|
|
7
|
+
enchantmentTypes(): Promise<string[]>;
|
|
8
|
+
landTypes(): Promise<string[]>;
|
|
9
|
+
loyalties(): Promise<string[]>;
|
|
10
|
+
planeswalkerTypes(): Promise<string[]>;
|
|
11
|
+
powers(): Promise<string[]>;
|
|
12
|
+
spellTypes(): Promise<string[]>;
|
|
13
|
+
toughnesses(): Promise<string[]>;
|
|
14
|
+
watermarks(): Promise<string[]>;
|
|
15
|
+
wordBank(): Promise<string[]>;
|
|
16
|
+
}
|
|
17
|
+
declare const _default: Catalog;
|
|
18
|
+
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import MagicQuery from '../query/MagicQuery';
|
|
2
|
-
import { HomepageLink } from '../types';
|
|
3
|
-
declare class Misc extends MagicQuery {
|
|
4
|
-
homepageLinks(): Promise<HomepageLink[]>;
|
|
5
|
-
}
|
|
6
|
-
declare const _default: Misc;
|
|
7
|
-
export default _default;
|
|
1
|
+
import MagicQuery from '../query/MagicQuery';
|
|
2
|
+
import { HomepageLink } from '../types';
|
|
3
|
+
declare class Misc extends MagicQuery {
|
|
4
|
+
homepageLinks(): Promise<HomepageLink[]>;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: Misc;
|
|
7
|
+
export default _default;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import MagicQuery from '../query/MagicQuery';
|
|
2
|
-
import { Ruling } from '../types';
|
|
3
|
-
declare class Rulings extends MagicQuery {
|
|
4
|
-
byArenaId(id: number): Promise<Ruling[]>;
|
|
5
|
-
byId(id: string): Promise<Ruling[]>;
|
|
6
|
-
byMtgoId(id: number): Promise<Ruling[]>;
|
|
7
|
-
byMultiverseId(id: number): Promise<Ruling[]>;
|
|
8
|
-
bySet(setCode: string, collectorNumber: string | number): Promise<Ruling[]>;
|
|
9
|
-
}
|
|
10
|
-
declare const _default: Rulings;
|
|
11
|
-
export default _default;
|
|
1
|
+
import MagicQuery from '../query/MagicQuery';
|
|
2
|
+
import { Ruling } from '../types';
|
|
3
|
+
declare class Rulings extends MagicQuery {
|
|
4
|
+
byArenaId(id: number): Promise<Ruling[]>;
|
|
5
|
+
byId(id: string): Promise<Ruling[]>;
|
|
6
|
+
byMtgoId(id: number): Promise<Ruling[]>;
|
|
7
|
+
byMultiverseId(id: number): Promise<Ruling[]>;
|
|
8
|
+
bySet(setCode: string, collectorNumber: string | number): Promise<Ruling[]>;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: Rulings;
|
|
11
|
+
export default _default;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import MagicQuery from '../query/MagicQuery';
|
|
2
|
-
import { Set } from '../types';
|
|
3
|
-
declare class Sets extends MagicQuery {
|
|
4
|
-
all(): Promise<Set[]>;
|
|
5
|
-
byCode(code: string): Promise<Set | undefined>;
|
|
6
|
-
byId(id: string): Promise<Set | undefined>;
|
|
7
|
-
byTcgPlayerId(id: number): Promise<Set | undefined>;
|
|
8
|
-
}
|
|
9
|
-
declare const _default: Sets;
|
|
10
|
-
export default _default;
|
|
1
|
+
import MagicQuery from '../query/MagicQuery';
|
|
2
|
+
import { Set } from '../types';
|
|
3
|
+
declare class Sets extends MagicQuery {
|
|
4
|
+
all(): Promise<Set[]>;
|
|
5
|
+
byCode(code: string): Promise<Set | undefined>;
|
|
6
|
+
byId(id: string): Promise<Set | undefined>;
|
|
7
|
+
byTcgPlayerId(id: number): Promise<Set | undefined>;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: Sets;
|
|
10
|
+
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import MagicQuery from '../query/MagicQuery';
|
|
2
|
-
import { CardSymbol, ManaCost } from '../types';
|
|
3
|
-
declare class Symbology extends MagicQuery {
|
|
4
|
-
all(): Promise<CardSymbol[]>;
|
|
5
|
-
parseMana(shorthand: string): Promise<ManaCost | undefined>;
|
|
6
|
-
}
|
|
7
|
-
declare const _default: Symbology;
|
|
8
|
-
export default _default;
|
|
1
|
+
import MagicQuery from '../query/MagicQuery';
|
|
2
|
+
import { CardSymbol, ManaCost } from '../types';
|
|
3
|
+
declare class Symbology extends MagicQuery {
|
|
4
|
+
all(): Promise<CardSymbol[]>;
|
|
5
|
+
parseMana(shorthand: string): Promise<ManaCost | undefined>;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: Symbology;
|
|
8
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SearchError } from '../types/SearchError';
|
|
2
|
-
export declare class MagicQueryError extends Error {
|
|
3
|
-
readonly data?: SearchError | undefined;
|
|
4
|
-
constructor(data?: SearchError | undefined);
|
|
5
|
-
}
|
|
1
|
+
import { SearchError } from '../types/SearchError';
|
|
2
|
+
export declare class MagicQueryError extends Error {
|
|
3
|
+
readonly data?: SearchError | undefined;
|
|
4
|
+
constructor(data?: SearchError | undefined);
|
|
5
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { default as Cards } from './api/Cards';
|
|
2
|
-
export { default as Catalog } from './api/Catalog';
|
|
3
|
-
export { default as Misc } from './api/Misc';
|
|
4
|
-
export { default as Rulings } from './api/Rulings';
|
|
5
|
-
export { default as Sets } from './api/Sets';
|
|
6
|
-
export { default as Symbology } from './api/Symbology';
|
|
7
|
-
export * from './api/CardIdentifierBuilder';
|
|
8
|
-
export * from './error/MagicQueryError';
|
|
9
|
-
export * from './query/MagicQuery';
|
|
10
|
-
export * from './query/MagicPageResult';
|
|
11
|
-
export * from './types';
|
|
1
|
+
export { default as Cards } from './api/Cards';
|
|
2
|
+
export { default as Catalog } from './api/Catalog';
|
|
3
|
+
export { default as Misc } from './api/Misc';
|
|
4
|
+
export { default as Rulings } from './api/Rulings';
|
|
5
|
+
export { default as Sets } from './api/Sets';
|
|
6
|
+
export { default as Symbology } from './api/Symbology';
|
|
7
|
+
export * from './api/CardIdentifierBuilder';
|
|
8
|
+
export * from './error/MagicQueryError';
|
|
9
|
+
export * from './query/MagicQuery';
|
|
10
|
+
export * from './query/MagicPageResult';
|
|
11
|
+
export * from './types';
|
|
@@ -1,18 +1,18 @@
|
|
|
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
|
-
private _count
|
|
10
|
-
constructor(q: Q, apiPath: string, query: PageQuery, post?: P | undefined);
|
|
11
|
-
get count(): number
|
|
12
|
-
get hasMore(): boolean;
|
|
13
|
-
all(): Promise<T[]>;
|
|
14
|
-
get(limit: number): Promise<T[]>;
|
|
15
|
-
next(): Promise<T[]>;
|
|
16
|
-
page(page: number): Promise<T[]>;
|
|
17
|
-
private setNextPage;
|
|
18
|
-
}
|
|
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
|
+
private _count;
|
|
10
|
+
constructor(q: Q, apiPath: string, query: PageQuery, post?: P | undefined);
|
|
11
|
+
get count(): number;
|
|
12
|
+
get hasMore(): boolean;
|
|
13
|
+
all(): Promise<T[]>;
|
|
14
|
+
get(limit: number): Promise<T[]>;
|
|
15
|
+
next(): Promise<T[]>;
|
|
16
|
+
page(page: number): Promise<T[]>;
|
|
17
|
+
private setNextPage;
|
|
18
|
+
}
|
|
@@ -1,13 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare enum Border {
|
|
2
|
-
black = 0,
|
|
3
|
-
borderless = 1,
|
|
4
|
-
gold = 2,
|
|
5
|
-
silver = 3,
|
|
6
|
-
white = 4
|
|
7
|
-
}
|
|
1
|
+
export declare enum Border {
|
|
2
|
+
black = 0,
|
|
3
|
+
borderless = 1,
|
|
4
|
+
gold = 2,
|
|
5
|
+
silver = 3,
|
|
6
|
+
white = 4
|
|
7
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { BulkDataType } from './BulkDataType';
|
|
2
|
-
export interface BulkDataDefinition {
|
|
3
|
-
compressed_size: number;
|
|
4
|
-
content_encoding: string;
|
|
5
|
-
content_type: string;
|
|
6
|
-
description: string;
|
|
7
|
-
download_uri: string;
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
object: 'bulk_data';
|
|
11
|
-
type: BulkDataType;
|
|
12
|
-
updated_at: string;
|
|
13
|
-
uri: string;
|
|
14
|
-
}
|
|
1
|
+
import { BulkDataType } from './BulkDataType';
|
|
2
|
+
export interface BulkDataDefinition {
|
|
3
|
+
compressed_size: number;
|
|
4
|
+
content_encoding: string;
|
|
5
|
+
content_type: string;
|
|
6
|
+
description: string;
|
|
7
|
+
download_uri: string;
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
object: 'bulk_data';
|
|
11
|
+
type: BulkDataType;
|
|
12
|
+
updated_at: string;
|
|
13
|
+
uri: string;
|
|
14
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BulkDataTypes } from './BulkDataTypes';
|
|
2
|
-
export declare type BulkDataType = keyof typeof BulkDataTypes;
|
|
1
|
+
import { BulkDataTypes } from './BulkDataTypes';
|
|
2
|
+
export declare type BulkDataType = keyof typeof BulkDataTypes;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare enum BulkDataTypes {
|
|
2
|
-
oracle_cards = 0,
|
|
3
|
-
unique_artwork = 1,
|
|
4
|
-
default_cards = 2,
|
|
5
|
-
all_cards = 3,
|
|
6
|
-
rulings = 4
|
|
7
|
-
}
|
|
1
|
+
export declare enum BulkDataTypes {
|
|
2
|
+
oracle_cards = 0,
|
|
3
|
+
unique_artwork = 1,
|
|
4
|
+
default_cards = 2,
|
|
5
|
+
all_cards = 3,
|
|
6
|
+
rulings = 4
|
|
7
|
+
}
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import { Border } from './Border';
|
|
2
|
-
import { CardFace } from './CardFace';
|
|
3
|
-
import { Color } from './Color';
|
|
4
|
-
import { FrameEffect } from './FrameEffect';
|
|
5
|
-
import { Game } from './Game';
|
|
6
|
-
import { ImageUris } from './ImageUris';
|
|
7
|
-
import { Layout } from './Layout';
|
|
8
|
-
import { Legalities } from './Legalties';
|
|
9
|
-
import { Preview } from './Preview';
|
|
10
|
-
import { Prices } from './Prices';
|
|
11
|
-
import { PromoType } from './PromoType';
|
|
12
|
-
import { PurchaseUris } from './PurchaseUris';
|
|
13
|
-
import { Rarity } from './Rarity';
|
|
14
|
-
import { RelatedCard } from './RelatedCard';
|
|
15
|
-
import { RelatedUris } from './RelatedUris';
|
|
16
|
-
import { Set as ScryfallSet } from './Set';
|
|
17
|
-
export interface Card {
|
|
18
|
-
object: 'card';
|
|
19
|
-
arena_id?: number;
|
|
20
|
-
id: string;
|
|
21
|
-
lang: string;
|
|
22
|
-
mtgo_id?: number;
|
|
23
|
-
mtgo_foil_id?: number;
|
|
24
|
-
multiverse_ids?: number[];
|
|
25
|
-
tcgplayer_id?: number;
|
|
26
|
-
oracle_id: string;
|
|
27
|
-
prints_search_uri: string;
|
|
28
|
-
rulings_uri: string;
|
|
29
|
-
scryfall_uri: string;
|
|
30
|
-
uri: string;
|
|
31
|
-
all_parts?: RelatedCard[];
|
|
32
|
-
card_faces?: CardFace[];
|
|
33
|
-
cmc: number;
|
|
34
|
-
colors?: Color[];
|
|
35
|
-
color_identity: Color[];
|
|
36
|
-
color_indicator?: Color[];
|
|
37
|
-
edhrec_rank?: number;
|
|
38
|
-
foil: boolean;
|
|
39
|
-
hand_modifier?: string;
|
|
40
|
-
layout: keyof typeof Layout;
|
|
41
|
-
legalities: Legalities;
|
|
42
|
-
life_modifier?: string;
|
|
43
|
-
loyalty?: string;
|
|
44
|
-
mana_cost?: string;
|
|
45
|
-
name: string;
|
|
46
|
-
nonfoil: boolean;
|
|
47
|
-
oracle_text?: string;
|
|
48
|
-
oversized: boolean;
|
|
49
|
-
power?: string;
|
|
50
|
-
reserved: boolean;
|
|
51
|
-
toughness?: string;
|
|
52
|
-
type_line: string;
|
|
53
|
-
artist?: string;
|
|
54
|
-
artist_ids?: string[];
|
|
55
|
-
booster: boolean;
|
|
56
|
-
border_color: keyof typeof Border;
|
|
57
|
-
card_back_id: string;
|
|
58
|
-
collector_number: string;
|
|
59
|
-
digital: boolean;
|
|
60
|
-
flavor_text?: string;
|
|
61
|
-
frame_effects?: (keyof typeof FrameEffect)[];
|
|
62
|
-
frame: '1993' | '1997' | '2003' | '2015' | 'Future';
|
|
63
|
-
full_art: boolean;
|
|
64
|
-
games: (keyof typeof Game)[];
|
|
65
|
-
highres_image: boolean;
|
|
66
|
-
illustration_id?: string;
|
|
67
|
-
image_uris?: ImageUris;
|
|
68
|
-
prices: Prices;
|
|
69
|
-
printed_name?: string;
|
|
70
|
-
printed_text?: string;
|
|
71
|
-
printed_type_line?: string;
|
|
72
|
-
promo: boolean;
|
|
73
|
-
promo_types?: (keyof typeof PromoType)[];
|
|
74
|
-
purchase_uris: PurchaseUris;
|
|
75
|
-
rarity: keyof typeof Rarity;
|
|
76
|
-
related_uris: RelatedUris;
|
|
77
|
-
released_at: string;
|
|
78
|
-
reprint: boolean;
|
|
79
|
-
scryfall_set_uri: string;
|
|
80
|
-
set_name: string;
|
|
81
|
-
set_search_uri: string;
|
|
82
|
-
set_type: ScryfallSet['set_type'];
|
|
83
|
-
set_uri: string;
|
|
84
|
-
set: string;
|
|
85
|
-
story_spotlight: boolean;
|
|
86
|
-
textless: boolean;
|
|
87
|
-
variation: boolean;
|
|
88
|
-
variation_of?: string;
|
|
89
|
-
watermark?: string;
|
|
90
|
-
preview?: Preview;
|
|
91
|
-
}
|
|
1
|
+
import { Border } from './Border';
|
|
2
|
+
import { CardFace } from './CardFace';
|
|
3
|
+
import { Color } from './Color';
|
|
4
|
+
import { FrameEffect } from './FrameEffect';
|
|
5
|
+
import { Game } from './Game';
|
|
6
|
+
import { ImageUris } from './ImageUris';
|
|
7
|
+
import { Layout } from './Layout';
|
|
8
|
+
import { Legalities } from './Legalties';
|
|
9
|
+
import { Preview } from './Preview';
|
|
10
|
+
import { Prices } from './Prices';
|
|
11
|
+
import { PromoType } from './PromoType';
|
|
12
|
+
import { PurchaseUris } from './PurchaseUris';
|
|
13
|
+
import { Rarity } from './Rarity';
|
|
14
|
+
import { RelatedCard } from './RelatedCard';
|
|
15
|
+
import { RelatedUris } from './RelatedUris';
|
|
16
|
+
import { Set as ScryfallSet } from './Set';
|
|
17
|
+
export interface Card {
|
|
18
|
+
object: 'card';
|
|
19
|
+
arena_id?: number;
|
|
20
|
+
id: string;
|
|
21
|
+
lang: string;
|
|
22
|
+
mtgo_id?: number;
|
|
23
|
+
mtgo_foil_id?: number;
|
|
24
|
+
multiverse_ids?: number[];
|
|
25
|
+
tcgplayer_id?: number;
|
|
26
|
+
oracle_id: string;
|
|
27
|
+
prints_search_uri: string;
|
|
28
|
+
rulings_uri: string;
|
|
29
|
+
scryfall_uri: string;
|
|
30
|
+
uri: string;
|
|
31
|
+
all_parts?: RelatedCard[];
|
|
32
|
+
card_faces?: CardFace[];
|
|
33
|
+
cmc: number;
|
|
34
|
+
colors?: Color[];
|
|
35
|
+
color_identity: Color[];
|
|
36
|
+
color_indicator?: Color[];
|
|
37
|
+
edhrec_rank?: number;
|
|
38
|
+
foil: boolean;
|
|
39
|
+
hand_modifier?: string;
|
|
40
|
+
layout: keyof typeof Layout;
|
|
41
|
+
legalities: Legalities;
|
|
42
|
+
life_modifier?: string;
|
|
43
|
+
loyalty?: string;
|
|
44
|
+
mana_cost?: string;
|
|
45
|
+
name: string;
|
|
46
|
+
nonfoil: boolean;
|
|
47
|
+
oracle_text?: string;
|
|
48
|
+
oversized: boolean;
|
|
49
|
+
power?: string;
|
|
50
|
+
reserved: boolean;
|
|
51
|
+
toughness?: string;
|
|
52
|
+
type_line: string;
|
|
53
|
+
artist?: string;
|
|
54
|
+
artist_ids?: string[];
|
|
55
|
+
booster: boolean;
|
|
56
|
+
border_color: keyof typeof Border;
|
|
57
|
+
card_back_id: string;
|
|
58
|
+
collector_number: string;
|
|
59
|
+
digital: boolean;
|
|
60
|
+
flavor_text?: string;
|
|
61
|
+
frame_effects?: (keyof typeof FrameEffect)[];
|
|
62
|
+
frame: '1993' | '1997' | '2003' | '2015' | 'Future';
|
|
63
|
+
full_art: boolean;
|
|
64
|
+
games: (keyof typeof Game)[];
|
|
65
|
+
highres_image: boolean;
|
|
66
|
+
illustration_id?: string;
|
|
67
|
+
image_uris?: ImageUris;
|
|
68
|
+
prices: Prices;
|
|
69
|
+
printed_name?: string;
|
|
70
|
+
printed_text?: string;
|
|
71
|
+
printed_type_line?: string;
|
|
72
|
+
promo: boolean;
|
|
73
|
+
promo_types?: (keyof typeof PromoType)[];
|
|
74
|
+
purchase_uris: PurchaseUris;
|
|
75
|
+
rarity: keyof typeof Rarity;
|
|
76
|
+
related_uris: RelatedUris;
|
|
77
|
+
released_at: string;
|
|
78
|
+
reprint: boolean;
|
|
79
|
+
scryfall_set_uri: string;
|
|
80
|
+
set_name: string;
|
|
81
|
+
set_search_uri: string;
|
|
82
|
+
set_type: ScryfallSet['set_type'];
|
|
83
|
+
set_uri: string;
|
|
84
|
+
set: string;
|
|
85
|
+
story_spotlight: boolean;
|
|
86
|
+
textless: boolean;
|
|
87
|
+
variation: boolean;
|
|
88
|
+
variation_of?: string;
|
|
89
|
+
watermark?: string;
|
|
90
|
+
preview?: Preview;
|
|
91
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Color } from './Color';
|
|
2
|
-
import { ImageUris } from './ImageUris';
|
|
3
|
-
export interface CardFace {
|
|
4
|
-
object: 'card_face';
|
|
5
|
-
artist?: string;
|
|
6
|
-
color_indicator?: Color[];
|
|
7
|
-
colors: Color[];
|
|
8
|
-
flavor_text?: string;
|
|
9
|
-
illustration_id?: string;
|
|
10
|
-
image_uris?: ImageUris;
|
|
11
|
-
loyalty?: string;
|
|
12
|
-
mana_cost: string;
|
|
13
|
-
name: string;
|
|
14
|
-
oracle_text?: string;
|
|
15
|
-
power?: string;
|
|
16
|
-
printed_name?: string;
|
|
17
|
-
printed_text?: string;
|
|
18
|
-
printed_type_line?: string;
|
|
19
|
-
toughness?: string;
|
|
20
|
-
type_line: string;
|
|
21
|
-
watermark?: string;
|
|
22
|
-
}
|
|
1
|
+
import { Color } from './Color';
|
|
2
|
+
import { ImageUris } from './ImageUris';
|
|
3
|
+
export interface CardFace {
|
|
4
|
+
object: 'card_face';
|
|
5
|
+
artist?: string;
|
|
6
|
+
color_indicator?: Color[];
|
|
7
|
+
colors: Color[];
|
|
8
|
+
flavor_text?: string;
|
|
9
|
+
illustration_id?: string;
|
|
10
|
+
image_uris?: ImageUris;
|
|
11
|
+
loyalty?: string;
|
|
12
|
+
mana_cost: string;
|
|
13
|
+
name: string;
|
|
14
|
+
oracle_text?: string;
|
|
15
|
+
power?: string;
|
|
16
|
+
printed_name?: string;
|
|
17
|
+
printed_text?: string;
|
|
18
|
+
printed_type_line?: string;
|
|
19
|
+
toughness?: string;
|
|
20
|
+
type_line: string;
|
|
21
|
+
watermark?: string;
|
|
22
|
+
}
|