Crates.io | tcgdex_api |
lib.rs | tcgdex_api |
version | 0.1.0 |
source | src |
created_at | 2024-11-08 10:23:23.826983 |
updated_at | 2024-11-08 10:23:23.826983 |
description | This API allows to interact with tcgdex Pokémon cards database. |
homepage | |
repository | https://github.com/LudSoc/tcgdex_api |
max_upload_size | |
id | 1441061 |
size | 40,521 |
This is a Pokémon TCG SDK wrapper around the API of tcgdex.
Create a unique instance of Tcgdex.
let tcgdex = Tcgdex::new();
English is default language. You can change it like this :
let tcgdex = Tcgdex::new();
tcgdex.set_lang(Lang::FR);
Tcgdex instance must be used for all requests.
All requests are blocking for the moment.
let filter = Query::new().with_id("swsh3-136");
let card: Card = tcgdex
.cards()
.fetch(Some(&filter))
.unwrap();
let filter = Query::new().with_filtering(vec!["name=furret", "id=ex"]);
let cards: Vec<CardBrief> = tcgdex
.cards()
.fetch(Some(&filter))
.unwrap();
let cards: Vec<CardBrief> = tcgdex
.cards()
.fetch(None)
.unwrap();
let filter = Query::new().with_id("swsh3");
let set: Set = tcgdex
.sets()
.fetch(Some(&filter))
.unwrap();
let query: Query = Query::new()
.with_q("legalities.standard:legal")
.with_order_by("-releaseDate")
.with_select("id,name,releaseDate");
let sets_list = pkmn_tcg.sets().where_(&query).unwrap();
let sets: Vec<SetBrief> = tcgdex
.sets()
.fetch(None)
.unwrap();
The principle is the same than for set and card. You can get a serie by id, or all series or a filtered list of series.
let types: Types = tcgdex.types().fetch().unwrap();
You can do the same for rarities, hp, illustrators, retreat costs and categories.