Got most of the fields I think
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
use serde::Deserialize;
|
||||
use serde_json::Value;
|
||||
use uuid::Uuid;
|
||||
use chrono::NaiveDate;
|
||||
|
||||
// Info from here:
|
||||
// https://scryfall.com/docs/api/cards
|
||||
@@ -86,10 +88,32 @@ struct ScryfallCard {
|
||||
pub printed_text: Option<String>,
|
||||
pub printed_type_line: Option<String>,
|
||||
pub promo: bool,
|
||||
pub promo_types: Option<Vec<String>>, // TODO: Check what types exist - could be a enumeratable selection
|
||||
//pub purchase_uris: Option<Vec<bool>>, // FIXME
|
||||
pub promo_types: Option<Vec<String>>, // TODO enum?
|
||||
pub purchase_uris: Option<PurchaseUris>,
|
||||
pub rarity: Rarity,
|
||||
// TODO - the rest (and the purachase URIs above)
|
||||
pub related_uris: Value, // TODO: - list all the URIs? Maybe? Who cares?
|
||||
pub released_at: NaiveDate,
|
||||
pub reprint: bool,
|
||||
pub scryfall_set_uri: String, // URI
|
||||
pub set_name: String,
|
||||
pub set_search_uri: String, // URI
|
||||
pub set_type: String, // TODO: Enum?
|
||||
pub set_uri: String, // URI
|
||||
pub set: String,
|
||||
pub set_id: Uuid,
|
||||
pub story_spotlight: bool,
|
||||
pub textless: bool,
|
||||
pub variation: bool,
|
||||
pub variation_of: Option<Uuid>,
|
||||
pub security_stamp: Option<SecurityStamp>,
|
||||
pub watermark: Option<String>,
|
||||
#[serde(rename = "preview.previewed_at")]
|
||||
pub preview_previewed_at: Option<NaiveDate>,
|
||||
#[serde(rename = "preview.source_uri")]
|
||||
pub preview_source_uri: Option<String>, // URI
|
||||
#[serde(rename = "preview.source")]
|
||||
pub preview_source: Option<String>
|
||||
|
||||
}
|
||||
|
||||
// https://scryfall.com/docs/api/cards#card-face-objects
|
||||
@@ -106,7 +130,23 @@ struct ScryfallCardFaceObject {
|
||||
#[serde(rename = "colors")]
|
||||
pub colours: Option<Vec<Colour>>,
|
||||
pub defence: Option<String>,
|
||||
// TODO: Complete
|
||||
pub flavour_text: Option<String>,
|
||||
pub illustration_id: Option<Uuid>,
|
||||
pub image_uris: ImageURIs,
|
||||
pub layout: Option<String>,
|
||||
pub loyalty: Option<String>,
|
||||
pub mana_cost: Option<String>,
|
||||
pub name: String,
|
||||
pub object: String,
|
||||
pub oracle_id: Option<Uuid>,
|
||||
pub oracle_text: Option<String>,
|
||||
pub power: Option<String>,
|
||||
pub printed_name: Option<String>,
|
||||
pub printed_text: Option<String>,
|
||||
pub printed_type_line: Option<String>,
|
||||
pub toughness: Option<String>,
|
||||
pub type_line: Option<String>,
|
||||
pub watermark: Option<String>
|
||||
}
|
||||
|
||||
// https://scryfall.com/docs/api/cards#related-card-objects
|
||||
@@ -115,7 +155,7 @@ struct ScryfallCardFaceObject {
|
||||
struct ScryfallRelatedCardObject {
|
||||
pub id: Uuid,
|
||||
pub object: String, // Always "related_card"
|
||||
pub component: String, // One of token, meld_part, meld_result, combo_piece
|
||||
pub component: Component,
|
||||
pub name: String,
|
||||
pub type_line: String,
|
||||
pub uri: String // URI
|
||||
@@ -214,7 +254,7 @@ enum Frame {
|
||||
#[serde(rename = "2003")]
|
||||
OhThree,
|
||||
#[serde(rename = "2015")]
|
||||
OhFifteen,
|
||||
Fifteen,
|
||||
#[serde(rename = "future")]
|
||||
Future
|
||||
}
|
||||
@@ -336,6 +376,44 @@ enum Rarity {
|
||||
Bonus
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct PurchaseUris {
|
||||
tcgplayer: String, // Option?
|
||||
cardmarket: String,
|
||||
cardhoarder: String,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Deserialize, Debug)]
|
||||
enum SecurityStamp {
|
||||
#[serde(rename = "oval")]
|
||||
Oval,
|
||||
#[serde(rename = "triangle")]
|
||||
Triangle,
|
||||
#[serde(rename = "acorn")]
|
||||
Acorn,
|
||||
#[serde(rename = "circle")]
|
||||
Circle,
|
||||
#[serde(rename = "arena")]
|
||||
Arena,
|
||||
#[serde(rename = "heart")]
|
||||
Heart
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Deserialize, Debug)]
|
||||
enum Component {
|
||||
#[serde(rename = "token")]
|
||||
Token,
|
||||
#[serde(rename = "meld_part")]
|
||||
MeldPart,
|
||||
#[serde(rename = "meld_result")]
|
||||
MeldResult,
|
||||
#[serde(rename = "combo_piece")]
|
||||
ComboPiece,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user