Struct mtgapi_client::api::card::filter::CardFilterBuilder[][src]

pub struct CardFilterBuilder { /* fields omitted */ }

Builder for filtered card requests

Methods

impl CardFilterBuilder
[src]

Creates a CardFilter with the specified filter parameters

let builder = CardFilter::builder();
let filter = builder
    .color(CardColor::Red)
    .converted_mana_cost(2)
    .cardtype(CardType::Instant)
    .build();
assert!(filter == CardFilter("colors=Red&cmc=2&types=Instant".to_string()))

Create a custom filter

let builder = CardFilter::builder();
let filter = builder.custom("name", "Shock|Mountain")
    .build();
assert!(filter == CardFilter("name=Shock|Mountain".to_string()))

Every card that (partially) matches the specified name will match the filter

let builder = CardFilter::builder();
let filter = builder.name("Shock")
    .build();
assert!(filter == CardFilter("name=Shock".to_string()))

Every card that (partially) matches one of the specified names will match the filter

let builder = CardFilter::builder();
let filter = builder.names(&vec!["Shock", "Mountain"])
    .build();
assert!(filter == CardFilter("name=Shock|Mountain".to_string()));

Every card that (partially) matches the specified name will match the filter

let builder = CardFilter::builder();
let filter = builder.name_with_language("Schock", CardLanguage::German)
    .build();
assert!(filter == CardFilter("name=Schock&language=German".to_string()))

Every card that (partially) matches one of the specified names will match the filter

let builder = CardFilter::builder();
let filter = builder.names_with_language(&vec!["Schock", "Gebirge"], CardLanguage::German)
    .build();
assert!(filter == CardFilter("name=Schock|Gebirge&language=German".to_string()));

Every card name that has the specified layout will match the filter

let builder = CardFilter::builder();
let filter = builder.layout(CardLayout::DoubleFaced)
    .build();
assert!(filter == CardFilter("layout=Double-Faced".to_string()));

Every card that has one of the specified layouts will match the filter

let builder = CardFilter::builder();
let filter = builder.layouts(&vec![CardLayout::Normal, CardLayout::DoubleFaced])
    .build();
assert!(filter == CardFilter("layout=Normal|Double-Faced".to_string()));

Every card name that has the specified converted mana cost will match the filter

let builder = CardFilter::builder();
let filter = builder.converted_mana_cost(3)
    .build();
assert!(filter == CardFilter("cmc=3".to_string()));

Every card that includes the specified color will match the filter

let builder = CardFilter::builder();
let filter = builder.color(CardColor::Red)
    .build();
assert!(filter == CardFilter("colors=Red".to_string()));

Every card that includes one the specified colors will match the filter

let builder = CardFilter::builder();
let filter = builder.colors_or(&vec![CardColor::Red, CardColor::Blue])
    .build();
assert!(filter == CardFilter("colors=Red|Blue".to_string()));

Every card that includes all the specified colors will match the filter

let builder = CardFilter::builder();
let filter = builder.colors_and(&vec![CardColor::Red, CardColor::Blue])
    .build();
assert!(filter == CardFilter("colors=Red,Blue".to_string()));

Every card that includes the specified color code will match the filter

let builder = CardFilter::builder();
let filter = builder.color_identity(CardColorIdentity::R)
    .build();
assert!(filter == CardFilter("colorIdentity=R".to_string()));

Every card that includes one of the specified color codes will match the filter

let builder = CardFilter::builder();
let filter = builder.color_identities_or(&vec![CardColorIdentity::R, CardColorIdentity::U])
    .build();
assert!(filter == CardFilter("colorIdentity=R|U".to_string()));

Every card that includes all of the specified color codes will match the filter

let builder = CardFilter::builder();
let filter = builder.color_identities_and(&vec![CardColorIdentity::R, CardColorIdentity::U])
    .build();
assert!(filter == CardFilter("colorIdentity=R,U".to_string()));

Every card that (partially) matches the specified types will match the filter

let builder = CardFilter::builder();
let filter = builder.fulltype("Legendary Creature")
    .build();
assert!(filter == CardFilter("types=Legendary Creature".to_string()));

Every card that (partially) matches one of the specified types will match the filter

let builder = CardFilter::builder();
let filter = builder.fulltypes_or(&vec!["Legendary Creature", "Human"])
    .build();
assert!(filter == CardFilter("types=Legendary Creature|Human".to_string()));

Every card that (partially) matches all of the specified types will match the filter

let builder = CardFilter::builder();
let filter = builder.fulltypes_and(&vec!["Legendary", "Creature", "Human"])
    .build();
assert!(filter == CardFilter("types=Legendary,Creature,Human".to_string()));

Every card that is of the specified supertype will match the filter

let builder = CardFilter::builder();
let filter = builder.supertype(CardSuperType::Legendary)
    .build();
assert!(filter == CardFilter("supertypes=Legendary".to_string()));

Every card that is one of the specified supertypes will match the filter

let builder = CardFilter::builder();
let filter = builder.supertypes_or(&vec![CardSuperType::Basic, CardSuperType::Legendary])
    .build();
assert!(filter == CardFilter("supertypes=Basic|Legendary".to_string()));

Every card that is all of the specified supertypes will match the filter

let builder = CardFilter::builder();
let filter = builder.supertypes_and(&vec![CardSuperType::Basic, CardSuperType::Legendary])
    .build();
assert!(filter == CardFilter("supertypes=Basic,Legendary".to_string()));

Every card that is of the specified types will match the filter

let builder = CardFilter::builder();
let filter = builder.cardtype(CardType::Creature)
    .build();
assert!(filter == CardFilter("types=Creature".to_string()));

Every card that is of one of the specified types will match the filter

let builder = CardFilter::builder();
let filter = builder.cardtypes_or(&vec![CardType::Creature, CardType::Artifact])
    .build();
assert!(filter == CardFilter("types=Creature|Artifact".to_string()));

Every card that is of all of the specified types will match the filter

let builder = CardFilter::builder();
let filter = builder.cardtypes_and(&vec![CardType::Creature, CardType::Artifact])
    .build();
assert!(filter == CardFilter("types=Creature,Artifact".to_string()));

Every card that is of the specified subtype will match the filter

let builder = CardFilter::builder();
let filter = builder.subtype("Human")
    .build();
assert!(filter == CardFilter("subtypes=Human".to_string()));

Every card that is of one of the specified subtypes will match the filter

let builder = CardFilter::builder();
let filter = builder.subtypes_or(&vec!["Human", "Soldier"])
    .build();
assert!(filter == CardFilter("subtypes=Human|Soldier".to_string()));

Every card that is of all of the specified subtypes will match the filter

let builder = CardFilter::builder();
let filter = builder.subtypes_and(&vec!["Human", "Soldier"])
    .build();
assert!(filter == CardFilter("subtypes=Human,Soldier".to_string()));

Every card that is of the specified rarity will match the filter

let builder = CardFilter::builder();
let filter = builder.rarity(CardRarity::Rare)
    .build();
assert!(filter == CardFilter("rarity=Rare".to_string()));

Every card that is of one of the specified rarities will match the filter

let builder = CardFilter::builder();
let filter = builder.rarities(&vec![CardRarity::Rare, CardRarity::MythicRare])
    .build();
assert!(filter == CardFilter("rarity=Rare|Mythic Rare".to_string()));

Every card that is in the specified set will match the filter

let builder = CardFilter::builder();
let filter = builder.set("AER")
    .build();
assert!(filter == CardFilter("set=AER".to_string()));

Every card that is in one of the specified sets will match the filter

let builder = CardFilter::builder();
let filter = builder.sets(&vec!["AER", "M19"])
    .build();
assert!(filter == CardFilter("set=AER|M19".to_string()));

Every card that (partially) matches the specified set name will match the filter

let builder = CardFilter::builder();
let filter = builder.set_name("Core Set 2019")
    .build();
assert!(filter == CardFilter("setName=Core Set 2019".to_string()));

Every card that (partially) matches one of the specified set names will match the filter

let builder = CardFilter::builder();
let filter = builder.set_names(&vec!["Core Set 2019", "Aether Revolt"])
    .build();
assert!(filter == CardFilter("setName=Core Set 2019|Aether Revolt".to_string()));

Every card that (partially) matches the specified oracle text will match the filter

let builder = CardFilter::builder();
let filter = builder.text("deals 2 damage")
    .build();
assert!(filter == CardFilter("text=deals 2 damage".to_string()));

Every card that (partially) matches one of the specified oracle texts will match the filter

let builder = CardFilter::builder();
let filter = builder.texts_or(&vec!["deals", "damage"])
    .build();
assert!(filter == CardFilter("text=deals|damage".to_string()));

Every card that (partially) matches all of the specified oracle texts will match the filter

let builder = CardFilter::builder();
let filter = builder.texts_and(&vec!["deals", "damage"])
    .build();
assert!(filter == CardFilter("text=deals,damage".to_string()));

Every card that (partially) matches the specified flavour text will match the filter

let builder = CardFilter::builder();
let filter = builder.flavor("S.N.E.A.K.")
    .build();
assert!(filter == CardFilter("flavor=S.N.E.A.K.".to_string()));

Every card that (partially) matches one of the specified flavour texts will match the filter

let builder = CardFilter::builder();
let filter = builder.flavors_or(&vec!["Espionage", "Kidnapping"])
    .build();
assert!(filter == CardFilter("flavor=Espionage|Kidnapping".to_string()));

Every card that (partially) matches all of the specified flavour texts will match the filter

let builder = CardFilter::builder();
let filter = builder.flavors_and(&vec!["Serious", "Nonstop Espionage and Kidnapping"])
    .build();
assert!(filter == CardFilter("flavor=Serious,Nonstop Espionage and Kidnapping".to_string()));

Every card that is drawn by the specified artist will match the filter

let builder = CardFilter::builder();
let filter = builder.artist("Kev Walker")
    .build();
assert!(filter == CardFilter("artist=Kev Walker".to_string()));

Every card that is drawn by one of the specified artists will match the filter

let builder = CardFilter::builder();
let filter = builder.artists(&vec!["Kev Walker", "Pete Venters"])
    .build();
assert!(filter == CardFilter("artist=Kev Walker|Pete Venters".to_string()));

Every card with the specified card number will match the filter

The card number may contain letters

let builder = CardFilter::builder();
let filter = builder.number("1")
    .build();
assert!(filter == CardFilter("number=1".to_string()));

Every card with one of the specified card numbers will match the filter

The card number may contain letters

let builder = CardFilter::builder();
let filter = builder.numbers(&vec!["1", "2"])
    .build();
assert!(filter == CardFilter("number=1|2".to_string()));

Every card with the specified power will match the filter

Some cards have powers like: “1+*”

let builder = CardFilter::builder();
let filter = builder.power("1")
    .build();
assert!(filter == CardFilter("power=1".to_string()));

Every card with one of the specified powers will match the filter

Some cards have powers like: “1+*”

let builder = CardFilter::builder();
let filter = builder.powers(&vec!["1", "2"])
    .build();
assert!(filter == CardFilter("power=1|2".to_string()));

Every card with the specified toughness will match the filter

Some cards have toughness like: “1+*”

let builder = CardFilter::builder();
let filter = builder.toughness("1")
    .build();
assert!(filter == CardFilter("toughness=1".to_string()));

Every card with one of the specified toughnesses will match the filter

Some cards have toughnesses like: “1+*”

let builder = CardFilter::builder();
let filter = builder.toughnesses(&vec!["1", "2"])
    .build();
assert!(filter == CardFilter("toughness=1|2".to_string()));

Every card with the specified loyality will match the filter

This is only present for planeswalkers

let builder = CardFilter::builder();
let filter = builder.loyality("3")
    .build();
assert!(filter == CardFilter("loyality=3".to_string()));

Every card with one of the specified loyalities will match the filter

This is only present for planeswalkers

let builder = CardFilter::builder();
let filter = builder.loyalities(&vec!["3", "5"])
    .build();
assert!(filter == CardFilter("loyality=3|5".to_string()));

Every card that is legal in the specified game format will match the filter

let builder = CardFilter::builder();
let filter = builder.game_format(GameFormat::Standard)
    .build();
assert!(filter == CardFilter("gameFormat=Standard".to_string()));

Every card that is legal in the specified game formats will match the filter

let builder = CardFilter::builder();
let filter = builder.game_format(GameFormat::Standard)
    .build();
assert!(filter == CardFilter("gameFormat=Standard".to_string()));

Every card that is of the specified legality in the specified game format will match the filter

let builder = CardFilter::builder();
let filter = builder.game_format_with_legality(GameFormat::Commander, CardLegality::Banned)
    .build();
assert!(filter == CardFilter("gameFormat=Commander&legality=Banned".to_string()));

Every card that is of the specified legality in the specified game formats will match the filter

let builder = CardFilter::builder();
let filter = builder.game_formats_with_legality(&vec![GameFormat::Standard, GameFormat::Commander], CardLegality::Banned)
    .build();
assert!(filter == CardFilter("gameFormat=Standard|Commander&legality=Banned".to_string()));

Every card with the specified multiverse Id will match the filter

This is only present for planeswalkers

let builder = CardFilter::builder();
let filter = builder.multiverse_id("409741")
    .build();
assert!(filter == CardFilter("multiverseid=409741".to_string()));

Every card with one of the specified multiverse Ids will match the filter

This is only present for planeswalkers

let builder = CardFilter::builder();
let filter = builder.multiverse_ids(&vec!["409741", "409742"])
    .build();
assert!(filter == CardFilter("multiverseid=409741|409742".to_string()));

Every card that contains the specified field in the response will match the filter

let builder = CardFilter::builder();
let filter = builder.contains_field(CardResponseField::ImageUrl)
    .build();
assert!(filter == CardFilter("contains=imageUrl".to_string()));

Every card that contains one of the specified fields in the response will match the filter

let builder = CardFilter::builder();
let filter = builder.contains_fields(&vec![CardResponseField::ImageUrl, CardResponseField::MultiverseId])
    .build();
assert!(filter == CardFilter("contains=imageUrl|multiverseid".to_string()));

Trait Implementations

impl Clone for CardFilterBuilder
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for CardFilterBuilder
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations