13 unstable releases (4 breaking)

0.5.1 Nov 30, 2023
0.5.0 Nov 29, 2023
0.4.0 Jun 29, 2023
0.3.5 May 22, 2023
0.1.1 Aug 28, 2022

#623 in Web programming

47 downloads per month

Custom license

195KB
3K SLoC

tetr-ch-rs Latest release version Codecov

tetr-ch-rs is a Rust library for the TETRA CHANNEL API.

You can get the following from the TETRA CHANNEL API with this library:

  • Public details for each user.
  • Some single player records.
  • Some statistics about the TETR.IO.
  • Graph of user activity.
  • Some streams.
  • TETRA LEAGUE Leaderboard.
  • XP Leaderboard.
  • The latest news.

Also you can search for TETR.IO accounts by Discord account.

But TETRA CHANNEL API is in alpha. So this library may not work properly in the future:(

* This library is NOT official.

Installation

Run the following Cargo command in your project directory:

cargo add tetr_ch

Examples

The following example is a template for getting user details.

use tetr_ch::client::Client;

#[tokio::main]
async fn main() {
    // Set the user (name or id).
    let user = "rinrin-rs";

    // Create a new client.
    let client = Client::new();

    // Get the user details.
    // And send the requested data or error message.
    match client.get_user(user).await {
        Ok(u) => {
            println!("{:?}\n", u);
        }
        Err(err) => {
            eprintln!("Error: {}\n", err.to_string());
        }
    }
}

See full examples.

And see the docs.

MIT

Dependencies

~5–21MB
~243K SLoC