File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,36 @@ This library documents the definitive comprehensive typings of [the Scryfall API
44
55This library uses [ semver] for versioning. These versions only describe this library, not the Scryfall API as a whole.
66
7+ ## Examples
8+
9+ ### Fetching a card
10+
11+ ``` ts
12+ // CommonJS module syntax
13+ const { ScryfallCard } = require (" @scryfall/api-types" );
14+
15+ // ES module syntax
16+ import { ScryfallCard } from " @scryfall/api-types" ;
17+
18+ // Fetch a card
19+ const response = await fetch (" https://api.scryfall.com/cards/iko/275" );
20+ const godzilla: ScryfallCard .Any = await response .json ();
21+ ```
22+
23+ ### Fetching the list of sets
24+
25+ ``` ts
26+ // CommonJS module syntax
27+ const { ScryfallList } = require (" @scryfall/api-types" );
28+
29+ // ES module syntax
30+ import { ScryfallList } from " @scryfall/api-types" ;
31+
32+ // Fetch the list of all setss
33+ const response = await fetch (" https://api.scryfall.com/sets" );
34+ const sets: ScryfallList .Sets = await response .json ();
35+ ```
36+
737## Usage
838
939Each type and enum exported by this library corresponds to a Scryfall API object and its values.
You can’t perform that action at this time.
0 commit comments