First set of commits for realtime support

This commit is contained in:
2026-06-06 19:02:02 +01:00
parent cba2b17f57
commit 40f8c46d80
3 changed files with 43 additions and 2 deletions
+36
View File
@@ -0,0 +1,36 @@
/***
* Implementation of GTFS-R polling
*/
use std::{str::FromStr, time::Duration};
use reqwest::{blocking::Client, header::{HeaderName, HeaderValue}};
use crate::gtfs::structs::{Arrival, Error, Gtfs};
impl Gtfs<'_> {
fn realtime_update (&self, arrivals: Vec<Arrival<'_>>) -> Result<bool, Error>{
// Poll GTFS-R API
let client = Client::builder()
.timeout(Duration::from_secs(10))
.connect_timeout(Duration::from_secs(5))
.build()?;
let mut response = client
.get(self.preferences.realtime_url)
.header("x-api-key", self.preferences.realtime_api_key)
.send()?;
// Parse response
let response = json::rdr
// Match deltas to existing arrivals
// Update the arrival times
}
}