use rte_france::api::consumption::ConsumptionForecast; use rte_france::api::consumption::ShortTermForecastType; struct CachedApi {} impl rte_france::ApiClient for CachedApi { fn http_get( &self, _path: &str, _query_string: &[(String, String)], ) -> std::result::Result { // Simulated JSON data let _json_data = r#"{"short_term":[{"type":"D-2","start_date":"2024-10-24T00:00:00+02:00","end_date":"2024-10-25T00:00:00+02:00","values":[{"start_date":"2024-10-24T00:00:00+02:00","end_date":"2024-10-24T00:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":46147},{"start_date":"2024-10-24T00:30:00+02:00","end_date":"2024-10-24T01:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":44347},{"start_date":"2024-10-24T01:00:00+02:00","end_date":"2024-10-24T01:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":42455},{"start_date":"2024-10-24T01:30:00+02:00","end_date":"2024-10-24T02:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":42743},{"start_date":"2024-10-24T02:00:00+02:00","end_date":"2024-10-24T02:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":42241},{"start_date":"2024-10-24T02:30:00+02:00","end_date":"2024-10-24T03:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":40843},{"start_date":"2024-10-24T03:00:00+02:00","end_date":"2024-10-24T03:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":39721},{"start_date":"2024-10-24T03:30:00+02:00","end_date":"2024-10-24T04:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":39013},{"start_date":"2024-10-24T04:00:00+02:00","end_date":"2024-10-24T04:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":38209},{"start_date":"2024-10-24T04:30:00+02:00","end_date":"2024-10-24T05:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":37957},{"start_date":"2024-10-24T05:00:00+02:00","end_date":"2024-10-24T05:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":38579},{"start_date":"2024-10-24T05:30:00+02:00","end_date":"2024-10-24T06:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":40050},{"start_date":"2024-10-24T06:00:00+02:00","end_date":"2024-10-24T06:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":41790},{"start_date":"2024-10-24T06:30:00+02:00","end_date":"2024-10-24T07:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":44556},{"start_date":"2024-10-24T07:00:00+02:00","end_date":"2024-10-24T07:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":47725},{"start_date":"2024-10-24T07:30:00+02:00","end_date":"2024-10-24T08:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":50286},{"start_date":"2024-10-24T08:00:00+02:00","end_date":"2024-10-24T08:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":51826},{"start_date":"2024-10-24T08:30:00+02:00","end_date":"2024-10-24T09:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":52039},{"start_date":"2024-10-24T09:00:00+02:00","end_date":"2024-10-24T09:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":52375},{"start_date":"2024-10-24T09:30:00+02:00","end_date":"2024-10-24T10:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":52879},{"start_date":"2024-10-24T10:00:00+02:00","end_date":"2024-10-24T10:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":52800},{"start_date":"2024-10-24T10:30:00+02:00","end_date":"2024-10-24T11:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":52910},{"start_date":"2024-10-24T11:00:00+02:00","end_date":"2024-10-24T11:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":52874},{"start_date":"2024-10-24T11:30:00+02:00","end_date":"2024-10-24T12:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":53051},{"start_date":"2024-10-24T12:00:00+02:00","end_date":"2024-10-24T12:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":53696},{"start_date":"2024-10-24T12:30:00+02:00","end_date":"2024-10-24T13:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":52632},{"start_date":"2024-10-24T13:00:00+02:00","end_date":"2024-10-24T13:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":53547},{"start_date":"2024-10-24T13:30:00+02:00","end_date":"2024-10-24T14:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":51565},{"start_date":"2024-10-24T14:00:00+02:00","end_date":"2024-10-24T14:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":50744},{"start_date":"2024-10-24T14:30:00+02:00","end_date":"2024-10-24T15:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":50050},{"start_date":"2024-10-24T15:00:00+02:00","end_date":"2024-10-24T15:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":48993},{"start_date":"2024-10-24T15:30:00+02:00","end_date":"2024-10-24T16:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":48116},{"start_date":"2024-10-24T16:00:00+02:00","end_date":"2024-10-24T16:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":47513},{"start_date":"2024-10-24T16:30:00+02:00","end_date":"2024-10-24T17:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":46912},{"start_date":"2024-10-24T17:00:00+02:00","end_date":"2024-10-24T17:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":46630},{"start_date":"2024-10-24T17:30:00+02:00","end_date":"2024-10-24T18:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":46318},{"start_date":"2024-10-24T18:00:00+02:00","end_date":"2024-10-24T18:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":47329},{"start_date":"2024-10-24T18:30:00+02:00","end_date":"2024-10-24T19:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":48888},{"start_date":"2024-10-24T19:00:00+02:00","end_date":"2024-10-24T19:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":52311},{"start_date":"2024-10-24T19:30:00+02:00","end_date":"2024-10-24T20:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":53239},{"start_date":"2024-10-24T20:00:00+02:00","end_date":"2024-10-24T20:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":51505},{"start_date":"2024-10-24T20:30:00+02:00","end_date":"2024-10-24T21:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":49248},{"start_date":"2024-10-24T21:00:00+02:00","end_date":"2024-10-24T21:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":47384},{"start_date":"2024-10-24T21:30:00+02:00","end_date":"2024-10-24T22:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":46279},{"start_date":"2024-10-24T22:00:00+02:00","end_date":"2024-10-24T22:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":45347},{"start_date":"2024-10-24T22:30:00+02:00","end_date":"2024-10-24T23:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":46486},{"start_date":"2024-10-24T23:00:00+02:00","end_date":"2024-10-24T23:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":47374},{"start_date":"2024-10-24T23:30:00+02:00","end_date":"2024-10-25T00:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":46334}]}]}"#; let _json_data = r#"{"short_term":[{"type":"D-2","start_date":"2024-10-24T00:00:00+02:00","end_date":"2024-10-25T00:00:00+02:00","values":[{"start_date":"2024-10-24T00:00:00+02:00","end_date":"2024-10-24T00:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":46147},{"start_date":"2024-10-24T00:30:00+02:00","end_date":"2024-10-24T01:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":44347},{"start_date":"2024-10-24T01:00:00+02:00","end_date":"2024-10-24T01:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":42455},{"start_date":"2024-10-24T01:30:00+02:00","end_date":"2024-10-24T02:00:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":42743},{"start_date":"2024-10-24T02:00:00+02:00","end_date":"2024-10-24T02:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":42241}]}]}"#; let json_data = r#"{"short_term":[{"type":"D-2","start_date":"2024-10-24T00:00:00+02:00","end_date":"2024-10-25T00:00:00+02:00","values":[{"start_date":"2024-10-24T00:00:00+02:00","end_date":"2024-10-24T00:30:00+02:00","updated_date":"2024-10-23T00:21:44+02:00","value":46147}]}]}"#; // Return the fake response as Ok Ok(json_data.to_string()) } } fn main() { /* let client_id = std::env::var("CLIENT_ID").expect("CLIENT_ID must be set"); let client_secret = std::env::var("CLIENT_SECRET").expect("CLIENT_SECRET must be set"); let mut rte_api = RteApi::new(client_id, client_secret); println!("rte_api: {:?}", rte_api); rte_api.authenticate().expect("Failed to authenticate"); */ let rte_api = CachedApi {}; println!("Will gen cf"); let consumption_forecast = ConsumptionForecast::new(&rte_api); println!("Will gen data"); let data = consumption_forecast.short_term(ShortTermForecastType::DayAfterTomorrow, None); println!("data: {:?}", data); println!("{}", data.unwrap().as_polars_df().unwrap()); }