Skip to main content

lta/
bus.rs

1// @generated by satay. Do not edit by hand.
2#![allow(
3    clippy::doc_markdown,
4    clippy::missing_errors_doc,
5    clippy::must_use_candidate,
6    clippy::needless_pass_by_value,
7    clippy::return_self_not_must_use,
8    clippy::single_match_else
9)]
10
11use super::{Api as RootApi, GetBusArrivalAction, GetBusStopsAction};
12/// Bus related operations.
13#[derive(Debug, Clone, Copy)]
14pub struct Api<'a> {
15    pub(crate) api: &'a RootApi,
16}
17impl<'a> Api<'a> {
18    /// Returns real-time Bus Arrival information of Bus Services at a queried Bus Stop, including
19    /// - Estimated Arrival Time
20    /// - Estimated Current Location
21    /// - Estimated Current Load.
22    ///
23    /// **Update freq**: 20s
24    ///
25    /// # Arguments
26    ///
27    /// - `bus_stop_code`: Bus stop reference code.
28    ///
29    /// # Optional request settings
30    ///
31    /// - [`service_no`](GetBusArrivalAction::service_no): Optional bus service number filter.
32    ///
33    /// # Example
34    ///
35    /// ```rust,ignore
36    /// let request = api
37    ///     .bus()
38    ///     .get_arrival(bus_stop_code)
39    ///     .service_no(service_no)
40    ///     .request()?;
41    /// ```
42    pub fn get_arrival(&self, bus_stop_code: u32) -> GetBusArrivalAction<'a> {
43        GetBusArrivalAction::new(self.api, bus_stop_code)
44    }
45    /// Returns detailed information for all bus stops currently being serviced by buses, including bus stop codes and location coordinates.
46    ///
47    /// **Update freq**: Ad-Hoc
48    ///
49    /// # Optional request settings
50    ///
51    /// - [`skip`](GetBusStopsAction::skip): Number of records to skip for pagination.
52    ///
53    /// # Example
54    ///
55    /// ```rust,ignore
56    /// let request = api
57    ///     .bus()
58    ///     .get_stops()
59    ///     .skip(skip)
60    ///     .request()?;
61    /// ```
62    pub fn get_stops(&self) -> GetBusStopsAction<'a> {
63        GetBusStopsAction::new(self.api)
64    }
65}