lta/async/
train.rs

1use crate::api_url;
2use crate::models::train::prelude::*;
3use crate::r#async::{build_req_with_skip, LTAClient};
4use crate::{Client, LTAResult, Train};
5use async_trait::async_trait;
6
7#[async_trait]
8pub trait TrainRequests<C: Client> {
9    /// Returns detailed information on train service unavailability during scheduled
10    /// operating hours, such as affected line and stations etc.
11    ///
12    /// **Update freq**: ad-hoc
13    async fn get_train_service_alert<S>(client: &C, skip: S) -> LTAResult<TrainServiceAlert>
14    where
15        S: Into<Option<u32>> + Send;
16}
17
18#[async_trait]
19impl TrainRequests<LTAClient> for Train {
20    async fn get_train_service_alert<S>(client: &LTAClient, skip: S) -> LTAResult<TrainServiceAlert>
21    where
22        S: Into<Option<u32>> + Send,
23    {
24        build_req_with_skip::<TrainServiceAlertResp, _, _>(
25            client,
26            api_url!("/TrainServiceAlerts"),
27            skip.into(),
28        )
29        .await
30    }
31}