Crates.io | apiety |
lib.rs | apiety |
version | 0.0.2 |
source | src |
created_at | 2017-10-03 00:58:07.80072 |
updated_at | 2017-10-20 21:31:01.61512 |
description | Thin wrapper around GGG's API for http://www.pathofexile.com/ |
homepage | https://gitlab.com/quarry-map/apiety |
repository | https://gitlab.com/quarry-map/apiety.git |
max_upload_size | |
id | 34214 |
size | 15,725 |
Thin wrapper around GGG's API for Path of Exile
Goal of this library is it to provide an easy way to get started writing tools for Path of Exile. It provides statically typed structs to deserialize the json responses. Those structs can be used to get started but should probably be replaced later to only contain the data that you care about.
apiety provides fn cache_body<T: Endpoint>(endpoint: &T) -> Result<String>
which can be
used to test your code without downloading the same data over and over.
NOTE this will serve from cache if it finds a file with the same url as the passed
endpoint, even if it would not make sense. E.g. id?=42 returning next_change_id=42
let mut endpoint = apiety::stash::public::Endpoint::new("0");
for _ in 0..100 {
// can be later changed to get_body for production ready code
let body = apiety::cache_body(&endpoint).unwrap();
let response = apiety::stash::public::Endpoint::deserialize(body.as_str()).unwrap();
endpoint = apiety::stash::public::Endpoint::new(response.next_change_id.as_str());
for stash in response.stashes {
//try stuff
println!("{}", stash.id);
}
}
Only the endpoint for public stash tabs is implemented. Check the wiki for more informations about endpoints.
Any form of contribution is welcome. Opening issues, requesting features, sending pull requests, etc...