Pokémon TCG SDK - Rust

Overview

Pokémon TCG SDK - Rust

This is the Pokémon TCG SDK Rust implementation. It is a wrapper around the Pokémon TCG API of pokemontcg.io.

Usage

Configuration

[dependencies]
pokemon-tcg-sdk = "0.2.0"

Using an API Key

// This method fails for the same reasons a reqwest::ClientBuilder would fail (TLS, system config)
// or if your API key contains invalid characters for a header.
let client = Client::with_api_key("YOUR_API_KEY")?;

Cards

Get a single card by ID

let client = Client::default();
let card = client.get_card(GetCardRequest::new("base1-1")).await;

match card {
    // Card
    Ok(c) => println!("{:?}", c),
    // Will be a 'ClientError' enum
    Err(e) => println!("{:?}", e),
}

Filter cards via the q parameter

let client = Client::default();
let cards = client.search_cards(SearchCardsRequest::new("name:celebi")).await;

match cards {
    // Vec<Card>
    Ok(c) => println!("{:?}", c),
    // Will be a 'ClientError' enum
    Err(e) => println!("{:?}", e),
}

// You can also construct a SearchCardsRequest with more parameters
let search_request = SearchCardsRequest {
    query: Some(String::from("name:celebi")),
    page: Some(10),
    page_size: None,
    order_by: None,
}

Automatically page through card data

let client = Client::default();
let cards = client.get_all_cards().await;

match cards {
    // Vec<Card>
    Ok(c) => println!("{:?}", c),
    // Will be a 'ClientError' enum
    Err(e) => println!("{:?}", e),
}

Sets

Get a single set by ID

let client = Client::default();
let set = client.get_set(GetSetRequest::new("base1")).await;

match set {
    // Set
    Ok(s) => println!("{:?}", s),
    // Will be a 'ClientError' enum
    Err(e) => println!("{:?}", e),
}

Filter sets via the q parameter

let client = Client::default();
let sets = client.search_sets(SearchSetsRequest::new("series:base")).await;

match sets {
    // Vec<Set>
    Ok(s) => println!("{:?}", s),
    // Will be a 'ClientError' enum
    Err(e) => println!("{:?}", e),
}

// You can also construct a SearchSetsRequest with more parameters
let search_request = SearchSetsRequest {
    query: Some(String::from("series:base")),
    page: Some(2),
    page_size: None,
    order_by: None,
}

Automatically page through set data

let client = Client::default();
let sets = client.get_all_sets().await;

match sets {
    // Vec<Set>
    Ok(s) => println!("{:?}", s),
    // Will be a 'ClientError' enum
    Err(e) => println!("{:?}", e),
}

Supertypes

let client = Client::default();
let types = client.get_supertypes().await;

match types {
    // Vec<String>
    Ok(c) => println!("{:?}", c),
    // Will be a 'ClientError' enum
    Err(e) => println!("{:?}", e),
}

Subtypes

let client = Client::default();
let types = client.get_subtypes().await;

match types {
    // Vec<String>
    Ok(c) => println!("{:?}", c),
    // Will be a 'ClientError' enum
    Err(e) => println!("{:?}", e),
}

Types

let client = Client::default();
let types = client.get_types().await;

match types {
    // Vec<String>
    Ok(c) => println!("{:?}", c),
    // Will be a 'ClientError' enum
    Err(e) => println!("{:?}", e),
}

Rarities

let client = Client::default();
let types = client.get_rarities().await;

match types {
    // Vec<String>
    Ok(c) => println!("{:?}", c),
    // Will be a 'ClientError' enum
    Err(e) => println!("{:?}", e),
}
You might also like...
An unofficial Rust SDK for Clerk.dev

An unofficial clerk.dev SDK for rust Note: This SDK is updated frequently to keep up with any changes to the actual Clerk API. If you see anything tha

Kryptokrona SDK in Rust for building decentralized private communication and payment systems.

Kryptokrona Rust SDK Kryptokrona is a decentralized blockchain from the Nordic based on CryptoNote, which forms the basis for Monero, among others. Cr

Unofficial Rust SDK library for Uniswap smart contracts.

uniswap-rs Unofficial Rust SDK library for Uniswap smart contracts. Quickstart Add this to your Cargo.toml: [dependencies] uniswap-rs = { git = "https

Avalanche APIs/VM SDK in Rust

avalanche-rs ⚠️ avalanche-rs is alpha-level software and is not ready for production use. Do not use avalanche-rs to run production workloads. See the

Unofficial Rust SDK library for Uniswap smart contracts.

uniswap-rs Unofficial Rust SDK library for Uniswap smart contracts. Quickstart Add this to your Cargo.toml: [dependencies] uniswap-rs = { git = "https

Rust bindings and SDK for the ELSTER Rich Client (ERiC)

Eric Rust bindings and SDK for the ELSTER Rich Client (ERiC) What is ELSTER? What is ERiC? Requirements Rust bindings Select bindings Generate binding

A Software Development Kit (SDK) for Zero-Knowledge Transactions

Aleo SDK The Aleo SDK is a developer framework to make it simple to create a new account, craft a transaction, and broadcast it to the network. Table

A Minimal Windows SDK.

Minimal Windows 10 SDK Installs only the necessary Windows 10 .lib files to save you having to download the full Visual Studio package. You can either

Helper library for interacting with Terra assets (SDK coins and CW20 tokens)

terra-asset Helpers for interacting with Terra assets, including native coins and CW20 tokens Usage This crate contains two struct types: AssetInfo st

Owner
Pokémon TCG Developers
Pokémon TCG API and Developer SDKs
Pokémon TCG Developers
A template to build smart contracts in Rust to run inside a Cosmos SDK module on all chains that enable it.

CosmWasm Starter Pack This is a template to build smart contracts in Rust to run inside a Cosmos SDK module on all chains that enable it. To understan

null 1 Mar 7, 2022
Smart Contract built in Rust to run inside Cosmos SDK module on all chains that enable it

CoinSwap is a Smart Contract that is built on the terra blockchain and can be used to swap cryptocurrencies such as LUNA, UST, TerraUSD, Anchor, Mirror Protocol, LUNI and other CW20 tokens. The Project also contains a smart contract which works as a analysis tool for the gas fees on the Terra Blockchain.

Prajjwal Chittori 9 Oct 11, 2022
Lazerpay SDK for Rust 🦀

?? Lazerpay Rust SDK This crate integrates the Lazerpay payment gateway for accepting cryptocurrency payments. Usage Add the following to your cargo d

Lord_Sarcastic 15 Sep 21, 2022
This crate reimplements Gelato's Relay SDK in Rust

Gelato Relay SDK This crate reimplements Gelato's Relay SDK in Rust. It simply wraps Gelato Relay requests and responses to/from Gelato endpoints with

Nomad 30 Oct 20, 2022
A universal SDK for FDU. Powered by Rust.

libfdu A universal SDK for FDU. Building You need Rust Nightly installed: $ rustup default nightly Build the library by running: $ cargo build or $ ca

旦夕开发组 6 Sep 11, 2022
mirrorworld-sdk-rust

Usage Clone project code. git clone [email protected]:mirrorworld-universe/mirrorworld-sdk-rust.git cd mirrorworld-sdk-rust run. cargo run test. cargo te

Mirror World 17 Nov 12, 2022
Rust SDK for interacting with the Nile.

Nile API Rust Client This is a POC Rust client for the Nile API. Usage Source the Nile environment variables into your environment. export NILE_DEVELO

coredb-io 4 Jan 12, 2023
Rust for the DirectStorage SDK (unofficial)

Rust for the DirectStorage SDK (unofficial) This crate lets you call any DirectStorage SDK API using code generated from the metadata describing the A

Rafael Rivera 5 Jan 13, 2023
🦀 Hop server side SDK for Rust

hop-rs (wip) Hop's Rust library. Requires Rust 1.61+ Installation [dependencies] hop = "0.0.0" Usage Create a project token or personal access token.

Tom 17 Jan 31, 2023
Minimal flashloan borrower contracts with an extensible rust sdk to abstract wrapping generic onchain calls (similar to multicall3) with flashloans.

flashloan-rs • Minimal flashloan borrower contracts with an extensible rust sdk. Getting Started Flashloan-rs is published to crates.io as flashloan-r

White Noise 71 Apr 15, 2023