mtgjson-sdk 0.1.2

Official MTGJSON Rust SDK — Query Magic: The Gathering card data via DuckDB
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

// ---------------------------------------------------------------------------
// Meta
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct Meta {
    pub date: String,
    pub version: String,
}

// ---------------------------------------------------------------------------
// Identifiers
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct Identifiers {
    pub abu_id: Option<String>,
    pub cardtrader_id: Option<String>,
    pub csi_id: Option<String>,
    pub miniaturemarket_id: Option<String>,
    pub mvp_id: Option<String>,
    pub scg_id: Option<String>,
    pub tnt_id: Option<String>,
    pub card_kingdom_etched_id: Option<String>,
    pub card_kingdom_foil_id: Option<String>,
    pub card_kingdom_id: Option<String>,
    pub cardsphere_id: Option<String>,
    pub cardsphere_foil_id: Option<String>,
    pub deckbox_id: Option<String>,
    pub mcm_id: Option<String>,
    pub mcm_meta_id: Option<String>,
    pub mtg_arena_id: Option<String>,
    pub mtgjson_foil_version_id: Option<String>,
    pub mtgjson_non_foil_version_id: Option<String>,
    #[serde(rename = "mtgjsonV4Id")]
    pub mtgjson_v4_id: Option<String>,
    pub mtgo_foil_id: Option<String>,
    pub mtgo_id: Option<String>,
    pub multiverse_id: Option<String>,
    pub scryfall_id: Option<String>,
    pub scryfall_card_back_id: Option<String>,
    pub scryfall_illustration_id: Option<String>,
    pub scryfall_oracle_id: Option<String>,
    pub tcgplayer_etched_product_id: Option<String>,
    pub tcgplayer_product_id: Option<String>,
}

// ---------------------------------------------------------------------------
// LeadershipSkills
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct LeadershipSkills {
    pub brawl: bool,
    pub commander: bool,
    pub oathbreaker: bool,
}

// ---------------------------------------------------------------------------
// Legalities
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct Legalities {
    pub alchemy: Option<String>,
    pub brawl: Option<String>,
    pub commander: Option<String>,
    pub duel: Option<String>,
    pub explorer: Option<String>,
    pub future: Option<String>,
    pub gladiator: Option<String>,
    pub historic: Option<String>,
    pub historicbrawl: Option<String>,
    pub legacy: Option<String>,
    pub modern: Option<String>,
    pub oathbreaker: Option<String>,
    pub oldschool: Option<String>,
    pub pauper: Option<String>,
    pub paupercommander: Option<String>,
    pub penny: Option<String>,
    pub pioneer: Option<String>,
    pub predh: Option<String>,
    pub premodern: Option<String>,
    pub standard: Option<String>,
    pub standardbrawl: Option<String>,
    pub timeless: Option<String>,
    pub vintage: Option<String>,
}

// ---------------------------------------------------------------------------
// PurchaseUrls
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct PurchaseUrls {
    pub card_kingdom: Option<String>,
    pub card_kingdom_etched: Option<String>,
    pub card_kingdom_foil: Option<String>,
    pub cardmarket: Option<String>,
    pub tcgplayer: Option<String>,
    pub tcgplayer_etched: Option<String>,
}

// ---------------------------------------------------------------------------
// RelatedCards
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RelatedCards {
    #[serde(default)]
    pub reverse_related: Vec<String>,
    #[serde(default)]
    pub spellbook: Vec<String>,
    #[serde(default)]
    pub tokens: Vec<String>,
}

// ---------------------------------------------------------------------------
// Rulings
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct Rulings {
    pub date: String,
    pub text: String,
}

// ---------------------------------------------------------------------------
// SourceProducts
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct SourceProducts {
    #[serde(default)]
    pub etched: Vec<String>,
    #[serde(default)]
    pub foil: Vec<String>,
    #[serde(default)]
    pub nonfoil: Vec<String>,
}

// ---------------------------------------------------------------------------
// ForeignDataIdentifiers
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ForeignDataIdentifiers {
    pub multiverse_id: Option<String>,
    pub scryfall_id: Option<String>,
}

// ---------------------------------------------------------------------------
// ForeignData
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ForeignData {
    pub language: String,
    pub face_name: Option<String>,
    pub flavor_text: Option<String>,
    pub identifiers: Option<ForeignDataIdentifiers>,
    pub multiverse_id: Option<i64>,
    pub name: Option<String>,
    pub text: Option<String>,
    #[serde(rename = "type")]
    pub type_field: Option<String>,
    pub uuid: Option<String>,
}

// ---------------------------------------------------------------------------
// Translations
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct Translations {
    #[serde(rename = "Ancient Greek")]
    pub ancient_greek: Option<String>,
    #[serde(rename = "Arabic")]
    pub arabic: Option<String>,
    #[serde(rename = "Chinese Simplified")]
    pub chinese_simplified: Option<String>,
    #[serde(rename = "Chinese Traditional")]
    pub chinese_traditional: Option<String>,
    #[serde(rename = "French")]
    pub french: Option<String>,
    #[serde(rename = "German")]
    pub german: Option<String>,
    #[serde(rename = "Hebrew")]
    pub hebrew: Option<String>,
    #[serde(rename = "Italian")]
    pub italian: Option<String>,
    #[serde(rename = "Japanese")]
    pub japanese: Option<String>,
    #[serde(rename = "Korean")]
    pub korean: Option<String>,
    #[serde(rename = "Latin")]
    pub latin: Option<String>,
    #[serde(rename = "Phyrexian")]
    pub phyrexian: Option<String>,
    #[serde(rename = "Portuguese (Brazil)")]
    pub portuguese_brazil: Option<String>,
    #[serde(rename = "Russian")]
    pub russian: Option<String>,
    #[serde(rename = "Sanskrit")]
    pub sanskrit: Option<String>,
    #[serde(rename = "Spanish")]
    pub spanish: Option<String>,
}

// ---------------------------------------------------------------------------
// TcgplayerSkus
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TcgplayerSkus {
    pub condition: String,
    pub finish: Option<String>,
    pub language: String,
    pub printing: String,
    pub product_id: i64,
    pub sku_id: i64,
}

// ---------------------------------------------------------------------------
// Keywords
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct Keywords {
    #[serde(default)]
    pub ability_words: Vec<String>,
    #[serde(default)]
    pub keyword_abilities: Vec<String>,
    #[serde(default)]
    pub keyword_actions: Vec<String>,
}

// ---------------------------------------------------------------------------
// CardType
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CardType {
    #[serde(default)]
    pub sub_types: Vec<String>,
    #[serde(default)]
    pub super_types: Vec<String>,
}

// ---------------------------------------------------------------------------
// BoosterSheet
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BoosterSheet {
    pub allow_duplicates: Option<bool>,
    pub balance_colors: Option<bool>,
    #[serde(default)]
    pub cards: HashMap<String, i64>,
    pub foil: bool,
    pub fixed: Option<bool>,
    pub total_weight: i64,
}

// ---------------------------------------------------------------------------
// BoosterPack
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BoosterPack {
    #[serde(default)]
    pub contents: HashMap<String, i64>,
    pub weight: i64,
}

// ---------------------------------------------------------------------------
// BoosterConfig
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BoosterConfig {
    #[serde(default)]
    pub boosters: Vec<BoosterPack>,
    pub boosters_total_weight: i64,
    pub name: Option<String>,
    #[serde(default)]
    pub sheets: HashMap<String, BoosterSheet>,
    #[serde(default)]
    pub source_set_codes: Vec<String>,
}

// ---------------------------------------------------------------------------
// PricePoints
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct PricePoints {
    #[serde(default)]
    pub etched: HashMap<String, f64>,
    #[serde(default)]
    pub foil: HashMap<String, f64>,
    #[serde(default)]
    pub normal: HashMap<String, f64>,
}

// ---------------------------------------------------------------------------
// PriceList
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PriceList {
    pub buylist: Option<PricePoints>,
    pub currency: String,
    pub retail: Option<PricePoints>,
}

// ---------------------------------------------------------------------------
// PriceFormats
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct PriceFormats {
    pub mtgo: Option<HashMap<String, PriceList>>,
    pub paper: Option<HashMap<String, PriceList>>,
}

// ---------------------------------------------------------------------------
// SealedProductCard
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SealedProductCard {
    pub finishes: Option<Vec<String>>,
    pub foil: Option<bool>,
    pub name: String,
    pub number: String,
    pub set: String,
    pub uuid: String,
}

// ---------------------------------------------------------------------------
// SealedProductDeck
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SealedProductDeck {
    pub name: String,
    pub set: String,
}

// ---------------------------------------------------------------------------
// SealedProductOther
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SealedProductOther {
    pub name: String,
}

// ---------------------------------------------------------------------------
// SealedProductPack
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SealedProductPack {
    pub code: String,
    pub set: String,
}

// ---------------------------------------------------------------------------
// SealedProductSealed
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SealedProductSealed {
    pub count: i64,
    pub name: String,
    pub set: String,
    pub uuid: Option<String>,
}

// ---------------------------------------------------------------------------
// SealedProductContents
// ---------------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct SealedProductContents {
    pub card: Option<Vec<SealedProductCard>>,
    pub deck: Option<Vec<SealedProductDeck>>,
    pub other: Option<Vec<SealedProductOther>>,
    pub pack: Option<Vec<SealedProductPack>>,
    pub sealed: Option<Vec<SealedProductSealed>>,
    pub variable: Option<Vec<serde_json::Value>>,
}