|
|
@ -1,4 +1,3 @@ |
|
|
|
use serde::Deserialize; |
|
|
|
|
|
|
|
use serde_json::Value; |
|
|
|
use serde_json::Value; |
|
|
|
use std::env; |
|
|
|
use std::env; |
|
|
|
|
|
|
|
|
|
|
@ -9,13 +8,6 @@ const STATUS_URL: &str = |
|
|
|
const INCIDENTS_URL: &str = |
|
|
|
const INCIDENTS_URL: &str = |
|
|
|
"https://status.robertsspaceindustries.com/static/content/api/v0/incidents/timeline.en.json"; |
|
|
|
"https://status.robertsspaceindustries.com/static/content/api/v0/incidents/timeline.en.json"; |
|
|
|
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)] |
|
|
|
|
|
|
|
struct Status { |
|
|
|
|
|
|
|
name: String, |
|
|
|
|
|
|
|
status: String, |
|
|
|
|
|
|
|
order: u8, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn get_incidents() -> Result<(), reqwest::Error> { |
|
|
|
fn get_incidents() -> Result<(), reqwest::Error> { |
|
|
|
let res = reqwest::blocking::get(INCIDENTS_URL)?; |
|
|
|
let res = reqwest::blocking::get(INCIDENTS_URL)?; |
|
|
|
let data: Value = res.json()?; |
|
|
|
let data: Value = res.json()?; |
|
|
@ -46,10 +38,10 @@ fn get_incidents() -> Result<(), reqwest::Error> { |
|
|
|
|
|
|
|
|
|
|
|
fn get_status() -> Result<(), reqwest::Error> { |
|
|
|
fn get_status() -> Result<(), reqwest::Error> { |
|
|
|
let res = reqwest::blocking::get(STATUS_URL)?; |
|
|
|
let res = reqwest::blocking::get(STATUS_URL)?; |
|
|
|
let data = res.json::<Vec<Status>>()?; |
|
|
|
let data: Value = res.json()?; |
|
|
|
let pu = &data[1]; |
|
|
|
let pu = &data[1]; |
|
|
|
let ea = &data[2]; |
|
|
|
let ea = &data[2]; |
|
|
|
println!("Persistent Universe: {}\nEA: {}", pu.status, ea.status); |
|
|
|
println!("Persistent Universe: {}\nEA: {}", pu["status"], ea["status"]); |
|
|
|
Ok(()) |
|
|
|
Ok(()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|