| 1 | use chrono::DateTime; |
| 2 | use chrono_tz::Tz; |
| 3 | |
| 4 | use crate::{Accessibility, Leg, ProductsSelection}; |
| 5 | |
| 6 | /// The type of station board (departures, arrivals) |
| 7 | pub enum StationBoardKind { |
| 8 | Departures, |
| 9 | Arrivals, |
| 10 | } |
| 11 | |
| 12 | #[derive(Debug, Clone)] |
| 13 | /// The options for [`Provider::station_board`](crate::Provider::station_board) |
| 14 | /// |
| 15 | /// A provider can also ignore some of the options if this is not supported by the API. |
| 16 | pub struct StationBoardOptions { |
| 17 | /// How many results to include. |
| 18 | pub results: u64, |
| 19 | /// When should the station board start. |
| 20 | pub when: Option<DateTime<Tz>>, |
| 21 | /// How accessible the journey must be. |
| 22 | pub accessibility: Accessibility, |
| 23 | /// What products to route with. |
| 24 | pub products: ProductsSelection, |
| 25 | /// What language to query with. |
| 26 | pub language: Option<String>, |
| 27 | } |
| 28 | |
| 29 | impl Default for StationBoardOptions { |
| 30 | fn default() -> Self { |
| 31 | StationBoardOptions { |
| 32 | results: 5, |
| 33 | when: Default::default(), |
| 34 | accessibility: Default::default(), |
| 35 | products: Default::default(), |
| 36 | language: Default::default(), |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | /// The response for [`Provider::station_board`](crate::Provider::station_board) |
| 42 | #[derive(Debug, Clone)] |
| 43 | pub struct StationBoardResponse { |
| 44 | /// The list of legs which is the result of the request. |
| 45 | pub legs: Vec<Leg>, |
| 46 | } |