Crate apiety [] [src]

apiety

Thin wrapper around GGG's API for Path of Exile

Examples

Get Public Stash Tab Api with id 0

let endpoint = apiety::stash::public::Endpoint::new("0");
let body = apiety::get_body(&endpoint).unwrap();
let _response = apiety::stash::public::Endpoint::deserialize(body.as_str()).unwrap();

Try stuff on multiple response bodies and cache them

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);
    }
}

Modules

stash

Endpoint for the public stash api and a sample structs to statically deserialize it

Traits

Endpoint

Provides the second part of a url required to perform the request for the endpoint which implements this trait

Functions

cache_body

Checks the folder ./data for a cached response, if it can't find it, it will perform the request and save it to ./cache

get_body

Sends a request and returns the response body in a String