5 unstable releases
0.3.1 | Jun 10, 2022 |
---|---|
0.3.0 | May 12, 2022 |
0.2.1 | May 12, 2022 |
0.2.0 | Sep 15, 2021 |
0.1.3 | Aug 27, 2021 |
#1377 in Web programming
32 downloads per month
66KB
1.5K
SLoC
A Rust client for steamgriddb.com
This project is a wrapper for the steamgriddb api, written in Rust.
Getting started
The easiest way to get started is using the Client.
use steamgriddb_api::Client;
use steamgriddb_api::query_parameters::QueryType::Grid;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new("my_auth_key");
let games = client.search("Celeste").await?;
let first_game = games.iter().next().ok_or("No games found")?;
assert_eq!("Celeste", first_game.name);
let images = client.get_images_for_id(first_game.id, &Grid(None)).await?;
Ok(())
}
The client calls the API using the reqwest crate and parses the results using the serde crate.
It is possible to use library without the client, if you want to use a different way of calling the API.
use steamgriddb_api::images::*;
use steamgriddb_api::query_parameters::*;
let url = get_images_by_platform_ids_url("https://www.steamgriddb.com/api/v2", &Platform::Steam, &["107500", "107510"], &QueryType::Grid(None));
Use an Auth Key
In the examples above the client is given a "my_auth_key"
, you need to substitute this string with your own key.
You can get a key here:
https://www.steamgriddb.com/profile/preferences/api
Progress
This crate currently only supports getting data from the steamgriddb api. Uploading will come in a later version.
Dependencies
~4–15MB
~218K SLoC