Created
April 4, 2017 02:55
-
-
Save mmlinford/668873c850bcb342a9c08fd5e07ef866 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate reqwest; | |
#[macro_use] | |
extern crate serde_derive; | |
#[derive(Debug, Deserialize)] | |
struct MarketGroup { | |
description: String, | |
market_group_id: u32, | |
name: String, | |
parent_group_id: Option<u32>, | |
types: Vec<u32>, | |
} | |
fn main() { | |
println!("starting"); | |
let ids = market_group_ids(); | |
for id in &ids { | |
println!("{:?}", market_group(id)); | |
} | |
println!("all done"); | |
} | |
fn market_group_ids() -> Vec<u32> { | |
reqwest::get("https://esi.tech.ccp.is/latest/markets/groups/") | |
.unwrap() | |
.json() | |
.unwrap() | |
} | |
fn market_group(market_group_id: &u32) -> MarketGroup { | |
let url = format!("https://esi.tech.ccp.is/latest/markets/groups/{}", | |
market_group_id); | |
reqwest::get(&url).unwrap().json().unwrap() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment