Skip to content

Instantly share code, notes, and snippets.

@mmlinford
Created April 4, 2017 02:55
Show Gist options
  • Save mmlinford/668873c850bcb342a9c08fd5e07ef866 to your computer and use it in GitHub Desktop.
Save mmlinford/668873c850bcb342a9c08fd5e07ef866 to your computer and use it in GitHub Desktop.
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