Crate scryfall[−][src]
Scryfall provides a REST-like API for ingesting our card data programatically. The API exposes information available on the regular site in easy-to-consume formats.
Cards
The main way to fetch cards from this API is the Card
struct.
This allows you to get cards from scryfall
using all of their available
REST Apis
use scryfall::card::Card; match Card::named_fuzzy("Light Bolt") { Ok(card) => assert_eq!(card.name, "Lightning Bolt"), Err(e) => panic!(format!("{:?}", e)) }
Sets
You can also fetch information about a card set.
The available routes for this can be seen on Set
use scryfall::set::Set; assert_eq!(Set::code("mmq").unwrap().name, "Mercadian Masques")
Catalogs
Finally scryfall
also allows you to fetch catalogs which
are collections of Magic the Gathering data points.
For example, one could fetch all available card names.
use scryfall::catalog::Catalog; assert!(Catalog::card_names().unwrap().data.len() > 0)
Advanced Search
One of the main features of scryfall
is it's advanced search.
For this the card_searcher
module provides a type safe api
to interact and query the search engine.
Re-exports
pub use error::Result; |
Modules
bulk | Scryfall provides daily exports of their card data in bulk files. Each of these files is represented as a bulk_data object via the API. URLs for files change their timestamp each day, and can be fetched programmatically. |
card | This module provides a defenition of a Magic: The Gathering card, as well as, ways to fetch them from scryfall. |
card_searcher | This module provides an abstraction over the search parameters provided by
|
catalog | A Catalog object contains an array of Magic datapoints (words, card values, etc). Catalog objects are provided by the API as aids for building other Magic software and understanding possible values for a field on Card objects. |
error | This module exposes the possible errors this crate has, and ways to interact with them. |
format | The available magic the gathering formats. |
ruling | Rulings represent Oracle rulings, Wizards of the Coast set release notes, or Scryfall notes for a particular card. |
set | A Set object represents a group of related Magic cards. All Card objects on Scryfall belong to exactly one set. |
util | Module containing utility functions and structs. |