diff options
Diffstat (limited to '')
-rw-r--r-- | src/main.rs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 1782953..7e1c85a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,7 +41,8 @@ enum Command { /// Undo the last checkin (if any). Undo, /// Query iceportal.de (for testing) - ICEPortal + ICEPortal, + Zugportal } #[derive(Deserialize)] @@ -213,6 +214,29 @@ fn main() -> Result<(), ureq::Error> { } } } + Command::Zugportal => { + match get_request::<traveltext::zugportal::Journey>( + // "https://iceportal.de/api1/rs/tripInfo/trip" + "https://zugportal.de/prd/zupo-travel-information/api/public/ri/journey" + ) { + Ok(resp) => { + println!( + "{}: Currently in {}\n", + traveltext, + resp.get_train_ref().to_string().green() + ); + // println!("guessing last stop was: {:?}\n", resp.guess_last_station()); + println!("Stops:\n{}", resp.trip()) + } + Err(err) => { + if cli.debug { + eprintln!("{:?}", err); + } + println!("either this tool or the zugportal broke or you're not actually on an ICE\n\ + (get a response but couldn't parse it)"); + } + } + } } Ok(()) } |