| Crates.io | igdb_provider |
| lib.rs | igdb_provider |
| version | 0.1.0 |
| created_at | 2022-01-25 20:55:03.231891+00 |
| updated_at | 2022-01-25 20:55:03.231891+00 |
| description | IGDB API client |
| homepage | https://git.sr.ht/~alosarjos/igdb-provider |
| repository | https://git.sr.ht/~alosarjos/igdb-provider |
| max_upload_size | |
| id | 521069 |
| size | 16,673 |
This crate is intended to fetch data from the IGDB API as deserialized objects.
First you will need a Twitch Client ID and Secret. You can get both from https://dev.twitch.tv/ for free.
Once you have them, you create an APIAuth object either passing both variables or by setting them as environment vars (TWITCH_CLIENT_ID and TWITCH_CLIENT_SECRET).
Call to the request_token method to get the OAuth data required for the client requests.
Create a Client object and make requests for the supported models. (More queries and options to come on the future)
let mut auth = APIAuth::new_from_env().unwrap();
auth.request_token().await.unwrap();
let client = Client::new(auth);
let games: Vec<Game> = client.query_by_name("The Witcher 3").await.unwrap();
You can either request Collections by ID or Games by ID or name.
Items can't be filled recursively to avoid infinite recursion. Reference to another games or content inside a Game or a Collection is offered as the ID of the item and not it's data.