Crate tappet

source ·
Expand description

Provides a wrapper around documented and some undocumented Steam API endpoints.

The tappet crate provides a practical way to query the Steam Web API using strongly typed methods.

§Endpoints

You can check the available interfaces for querying from the QueryBuilder structs.

Each time you “select” a interface, such as the GetQueryBuilder, a new struct is created where all methods are endpoints available.

§Usage

use tappet::{SteamAPI, Executor};
use tappet::response_types;
use anyhow::Result;

async fn main() -> Result<()> {
    let client = SteamAPI::new(std::env!("STEAM_API"));
    let generic_response = client
        .get()
        .ISteamUser()
        .GetPlayerSummaries(vec!["789451224515".to_string()])
        .execute()
        .await?;
    Ok(())
}

§Reuse

There are some endpoints that only returns information for the account vinculated with the api key that you are using at the moment. tappet has a convenience function that circunvents this, allow the user to inject a custom api key before the request is made.

This can be useful if you don’t want to keep instantiating new clients every time you want to call with a different api keys, but still need to to call agnostic methods that doesn’t return api specific information.

But a “master” api key is still needed to instantiate SteamAPI in order to avoid panics.

use tappet::{SteamAPI, Executor};
use tappet::response_types;
use anyhow::Result;

async fn main() -> Result<()> {
    let client = SteamAPI::new(std::env!("STEAM_API"));
    client
        .get()
        .ISteamUser()
        .GetPlayerSummaries(vec!["789451224515".to_string()])
        .inject_custom_key("C704578DF5E380C5F8A89B8F8A0814B8")
        .execute()
        .await?;
    Ok(())
}

Modules§

  • This module contains responses for some endpoints, to be used with ExecutorResponse trait. If you can’t find it your method deserialized response, feel free to contribute and add it here!

Structs§

Traits§

  • Requests the endpoint and returns the raw response.
  • Requests the endpoint and returns the proper deserialized response. Response types are exposed on tappet::response_types.

Type Aliases§