pub struct Client { /* private fields */ }
Implementations§
Source§impl Client
impl Client
Sourcepub async fn get_card(
&self,
request: GetCardRequest,
) -> Result<Card, ClientError>
pub async fn get_card( &self, request: GetCardRequest, ) -> Result<Card, ClientError>
Fetch the details of a single card.
https://docs.pokemontcg.io/api-reference/cards/get-card
Sourcepub async fn search_cards(
&self,
request: SearchCardsRequest,
) -> Result<Vec<Card>, ClientError>
pub async fn search_cards( &self, request: SearchCardsRequest, ) -> Result<Vec<Card>, ClientError>
Search for one or many cards given a search query.
https://docs.pokemontcg.io/api-reference/cards/search-cards
Sourcepub async fn get_all_cards(&self) -> Result<Vec<Card>, ClientError>
pub async fn get_all_cards(&self) -> Result<Vec<Card>, ClientError>
Get all cards (will take awhile, automatically pages through data)
Source§impl Client
impl Client
Sourcepub fn new(api_key: Option<&str>) -> Result<Self, ClientError>
pub fn new(api_key: Option<&str>) -> Result<Self, ClientError>
Constructs a new client
§Errors
This method fails if the API key is invalid (“\n” etc.) or if a TLS backend cannot be initialized, or the resolver cannot load the system configuration.
Sourcepub fn with_base_url(
base_url: &str,
api_key: Option<&str>,
) -> Result<Self, ClientError>
pub fn with_base_url( base_url: &str, api_key: Option<&str>, ) -> Result<Self, ClientError>
Constructs a client with a different base url than the default for the API.
§Errors
This method fails if the API key is invalid (“\n” etc.) or if a TLS backend cannot be initialized, or the resolver cannot load the system configuration.
Sourcepub fn with_api_key(api_key: &str) -> Result<Self, ClientError>
pub fn with_api_key(api_key: &str) -> Result<Self, ClientError>
Constructs a client with an API key that will be passed on every request.
§Errors
This method fails if the API key is invalid (“\n” etc.) or if a TLS backend cannot be initialized, or the resolver cannot load the system configuration.
Source§impl Client
impl Client
Sourcepub async fn get_set(&self, request: GetSetRequest) -> Result<Set, ClientError>
pub async fn get_set(&self, request: GetSetRequest) -> Result<Set, ClientError>
Fetch the details of a single set.
https://docs.pokemontcg.io/api-reference/sets/get-set
Sourcepub async fn search_sets(
&self,
request: SearchSetsRequest,
) -> Result<Vec<Set>, ClientError>
pub async fn search_sets( &self, request: SearchSetsRequest, ) -> Result<Vec<Set>, ClientError>
Search for one or many sets given a search query.
https://docs.pokemontcg.io/api-reference/sets/search-cards
Sourcepub async fn get_all_sets(&self) -> Result<Vec<Set>, ClientError>
pub async fn get_all_sets(&self) -> Result<Vec<Set>, ClientError>
Get all sets (automatically pages through data)
Source§impl Client
impl Client
Sourcepub async fn get_types(&self) -> Result<Vec<String>, ClientError>
pub async fn get_types(&self) -> Result<Vec<String>, ClientError>
Get all possible types
https://docs.pokemontcg.io/api-reference/types/get-types
Sourcepub async fn get_subtypes(&self) -> Result<Vec<String>, ClientError>
pub async fn get_subtypes(&self) -> Result<Vec<String>, ClientError>
Get all possible subtypes
https://docs.pokemontcg.io/api-reference/subtypes/get-subtypes
Sourcepub async fn get_supertypes(&self) -> Result<Vec<String>, ClientError>
pub async fn get_supertypes(&self) -> Result<Vec<String>, ClientError>
Get all possible supertypes
https://docs.pokemontcg.io/api-reference/supertypes/get-supertypes
Sourcepub async fn get_rarities(&self) -> Result<Vec<String>, ClientError>
pub async fn get_rarities(&self) -> Result<Vec<String>, ClientError>
Get all possible rarities
https://docs.pokemontcg.io/api-reference/rarities/get-rarities