eve-esi-api 0.0.4

This library provides an authentication to Eve-esi API and some endpoints to call.
Documentation
use crate::domain::universe::region::Region;
use crate::ApiClient;
use crate::Result;

/// Retrieve all regions id
pub async fn all_regions(client: &ApiClient) -> Result<Option<Vec<u32>>> {
    client.query_esi("universe/regions/".to_owned()).await
}

/// Retrieve the region with given id
pub async fn region(client: &ApiClient, id: u32) -> Result<Option<Region>> {
    client.query_esi(format!("universe/regions/{}/", id)).await
}

/// Retrieve all regions with given ids. Calls are not parallelized and will interrupt on error
pub async fn fetch_regions_serial(client: &ApiClient, ids: Vec<u32>) -> Result<Vec<Region>> {
    let mut v = vec![];

    for id in ids.into_iter() {
        if let Some(region) = region(client, id).await? {
            v.push(region);
        }
    }

    Ok(v)
}