pub struct LTAClient<T> {
pub api_key: String,
pub client: T,
pub base_url: String,
}
Expand description
A Client
to make requests with
The Client
holds a connection pool internally, so it is advised that you create one and reuse it
There are some instance where you might need to customise your client due to certain limitations.
The Client
trait has a general constructor method and you should use the reqwest
re-export
to build you own customised client from the ground up.
Fields§
§api_key: String
§client: T
§base_url: String
Trait Implementations§
source§impl BusRequests<LTAClient<Client>> for Bus
impl BusRequests<LTAClient<Client>> for Bus
source§async fn get_arrival<'a, S>(
client: <AClient<ReqwestAsync>,
bus_stop_code: u32,
service_no: S
) -> LTAResult<BusArrivalResp>
async fn get_arrival<'a, S>( client: <AClient<ReqwestAsync>, bus_stop_code: u32, service_no: S ) -> LTAResult<BusArrivalResp>
Returns real-time Bus Arrival information of Bus Services at a queried Bus Stop,
including Read more
source§async fn get_bus_services<S>(client: &C, skip: S) -> LTAResult<Vec<BusService>>
async fn get_bus_services<S>(client: &C, skip: S) -> LTAResult<Vec<BusService>>
Returns detailed service information for all buses currently in
operation, including: first stop, last stop, peak / offpeak frequency of
dispatch. Read more
source§impl Client for LTAClient<Client>
impl Client for LTAClient<Client>
§type InternalClient = Client
type InternalClient = Client
Any backend Client
source§fn new(
api_key: impl Into<String>,
client: Self::InternalClient,
base_url: impl Into<String>
) -> Self
fn new( api_key: impl Into<String>, client: Self::InternalClient, base_url: impl Into<String> ) -> Self
General constructor for
Self
source§fn with_api_key(
api_key: impl Into<String>,
base_url: impl Into<String>
) -> LTAResult<Self>
fn with_api_key( api_key: impl Into<String>, base_url: impl Into<String> ) -> LTAResult<Self>
This method not assign the
api_key
in struct if the provided key is empty or whitespaces
Instead, assign None
source§fn req_builder(&self, url: &str) -> Self::RB
fn req_builder(&self, url: &str) -> Self::RB
Returns
Self::RB
source§impl ClientExt for LTAClient<ReqwestAsync>
impl ClientExt for LTAClient<ReqwestAsync>
async fn build_req_with_skip<T, T2>(
&self,
url: &str,
skip: Option<u32>
) -> LTAResult<T2>where
for<'de> T: Deserialize<'de> + Into<T2>,
async fn build_req_with_query<T, T2, F>( &self, url: &str, query: F ) -> LTAResult<T2>
source§impl CrowdRequests<LTAClient<Client>> for Crowd
impl CrowdRequests<LTAClient<Client>> for Crowd
source§async fn get_passenger_vol_by<S, D>(
client: <AClient<ReqwestAsync>,
vol_type: VolType,
date: D,
skip: S
) -> LTAResult<Vec<String>>
async fn get_passenger_vol_by<S, D>( client: <AClient<ReqwestAsync>, vol_type: VolType, date: D, skip: S ) -> LTAResult<Vec<String>>
Update freq: By 15th of every month, the passenger volume for previous month data
will be generated Read more
source§async fn get_crowd_density_rt(
client: <AClient<ReqwestAsync>,
train_line: MrtLine
) -> LTAResult<Vec<StationCrowdLevel>>
async fn get_crowd_density_rt( client: <AClient<ReqwestAsync>, train_line: MrtLine ) -> LTAResult<Vec<StationCrowdLevel>>
Returns real-time platform crowdedness level for the MRT/LRT stations of a
particular train network line Read more
source§async fn get_crowd_density_forecast(
client: <AClient<ReqwestAsync>,
train_line: MrtLine
) -> LTAResult<CrowdDensityForecast>
async fn get_crowd_density_forecast( client: <AClient<ReqwestAsync>, train_line: MrtLine ) -> LTAResult<CrowdDensityForecast>
Returns forecasted platform crowdedness level for the MRT/LRT stations of a
particular train network line at 30 minutes interval Read more
source§impl FacilityRequests<LTAClient<Client>> for Facility
impl FacilityRequests<LTAClient<Client>> for Facility
source§async fn get_facilities_maintenance(
client: <AClient<ReqwestAsync>,
station_code: StationCode
) -> LTAResult<Vec<String>>
async fn get_facilities_maintenance( client: <AClient<ReqwestAsync>, station_code: StationCode ) -> LTAResult<Vec<String>>
Returns pre-signed links to JSON file containing facilities maintenance schedules of the particular station Read more
source§impl GeoRequests<LTAClient<Client>> for Geo
impl GeoRequests<LTAClient<Client>> for Geo
source§async fn get_geospatial_whole_island(
client: <AClient<ReqwestAsync>,
id: GeospatialLayerId
) -> LTAResult<Vec<String>>
async fn get_geospatial_whole_island( client: <AClient<ReqwestAsync>, id: GeospatialLayerId ) -> LTAResult<Vec<String>>
Returns the SHP files of the requested geospatial layer Read more
source§impl TaxiRequests<LTAClient<Client>> for Taxi
impl TaxiRequests<LTAClient<Client>> for Taxi
source§impl TrafficRequests<LTAClient<Client>> for Traffic
impl TrafficRequests<LTAClient<Client>> for Traffic
source§async fn get_bike_parking<D>(
client: <AClient<ReqwestAsync>,
lat: f64,
long: f64,
dist: D
) -> LTAResult<Vec<BikeParking>>
async fn get_bike_parking<D>( client: <AClient<ReqwestAsync>, lat: f64, long: f64, dist: D ) -> LTAResult<Vec<BikeParking>>
Returns bicycle parking locations within a radius Read more
source§async fn get_erp_rates<S>(client: &C, skip: S) -> LTAResult<Vec<ErpRate>>
async fn get_erp_rates<S>(client: &C, skip: S) -> LTAResult<Vec<ErpRate>>
Returns ERP rates of all vehicle types across all timings for each
zone. Read more
source§async fn get_carpark_avail<S>(client: &C, skip: S) -> LTAResult<Vec<CarPark>>
async fn get_carpark_avail<S>(client: &C, skip: S) -> LTAResult<Vec<CarPark>>
Returns no. of available lots for HDB, LTA and URA carpark data.
The LTA carpark data consist of major shopping malls and developments within
Orchard, Marina, HarbourFront, Jurong Lake District.
(Note: list of LTA carpark data available on this API is subset of those listed on
One.Motoring and MyTransport Portals) Read more
source§async fn get_est_travel_time<S>(
client: &C,
skip: S
) -> LTAResult<Vec<EstTravelTime>>
async fn get_est_travel_time<S>( client: &C, skip: S ) -> LTAResult<Vec<EstTravelTime>>
Returns estimated travel times of expressways (in segments). Read more
source§async fn get_faulty_traffic_lights<S>(
client: &C,
skip: S
) -> LTAResult<Vec<FaultyTrafficLight>>
async fn get_faulty_traffic_lights<S>( client: &C, skip: S ) -> LTAResult<Vec<FaultyTrafficLight>>
Returns alerts of traffic lights that are currently faulty, or currently
undergoing scheduled maintenance. Read more
source§async fn get_road_details<S>(
client: &C,
road_details_type: RoadDetailsType,
skip: S
) -> LTAResult<Vec<RoadDetails>>
async fn get_road_details<S>( client: &C, road_details_type: RoadDetailsType, skip: S ) -> LTAResult<Vec<RoadDetails>>
Returns all planned road openings or road works depending on the
RoadDetailsType
supplied Read moresource§async fn get_traffic_speed_band<S>(
client: &C,
skip: S
) -> LTAResult<Vec<TrafficSpeedBand>>
async fn get_traffic_speed_band<S>( client: &C, skip: S ) -> LTAResult<Vec<TrafficSpeedBand>>
Returns current traffic speeds on expressways and arterial roads,
expressed in speed bands. Read more
source§async fn get_traffic_images<S>(
client: &C,
skip: S
) -> LTAResult<Vec<TrafficImage>>
async fn get_traffic_images<S>( client: &C, skip: S ) -> LTAResult<Vec<TrafficImage>>
Returns links to images of live traffic conditions along expressways and
Woodlands & Tuas Checkpoints. Read more
source§async fn get_traffic_incidents<S>(
client: &C,
skip: S
) -> LTAResult<Vec<TrafficIncident>>
async fn get_traffic_incidents<S>( client: &C, skip: S ) -> LTAResult<Vec<TrafficIncident>>
Returns current traffic speeds on expressways and arterial roads,
expressed in speed bands. Read more
Auto Trait Implementations§
impl<T> RefUnwindSafe for LTAClient<T>where
T: RefUnwindSafe,
impl<T> Send for LTAClient<T>where
T: Send,
impl<T> Sync for LTAClient<T>where
T: Sync,
impl<T> Unpin for LTAClient<T>where
T: Unpin,
impl<T> UnwindSafe for LTAClient<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more