gw2rs 0.0.1

A Rust library for the Guild Wars 2 API.
Documentation

GW2 RS

GW2RS is an api wrapper around the ArenaNet Guild Wars 2 API, for Rust.

It makes heavy use of futures, in part due to the hyper backend. wrapped api calls return the GW2Result<T> type, which is just an alias for boxed futures with the crate's custom APIError type.

In general, you can use the library by first spinning up a tokio core, then passing a handle into the GW2 struct. This is necessary due to the HTTP calls being offloaded to hyper, and part of the instantiation of that code needs a handle to the event loop that everything will eventually run.

Examples / Demo

I try to include a quick cargo doc test example for every endpoint, but as things get pulled in they might not all have one.

extern crate gw2rs;
extern crate futures;
extern crate tokio_core;

use tokio_core::reactor::Core;
use futures::Future;
use gw2rs::prelude::*;

fn main() {
    let mut reactor = Core::new().unwrap();
    let gw2_client = GW2::new(String::from("B5A035FF-EBE0-7A46-B615-F910431D9D6F190E6C87-2FCF-4EA3-81BD-79A73A7C9704"), Locale::EN, reactor.handle());
    
    let token_info = gw2_client.token_info().map(|res| {
        println!("Your token is: {} - {}", res.name(), res.id());
    });
    
    reactor.run(token_info).unwrap();
}