use super::Service;
use crate::{ApiError, Error, ServiceClient};
use maybe_async::maybe_async;
mod request;
mod response;
pub use request::{ConvertTimeRequest, DSTListRequest, TimeserviceRequest};
pub use response::{ConvertTimeResponse, DSTListResponse, TimeserviceResponse};
struct ConvertTimeService;
struct DSTListService;
struct TimeserviceService;
impl Service for ConvertTimeService {
const PATH: &'static str = "converttime";
type Request = ConvertTimeRequest;
type Response = ConvertTimeResponse;
}
impl Service for DSTListService {
const PATH: &'static str = "dstlist";
type Request = DSTListRequest;
type Response = DSTListResponse;
}
impl Service for TimeserviceService {
const PATH: &'static str = "timeservice";
type Request = TimeserviceRequest;
type Response = TimeserviceResponse;
}
impl ServiceClient {
#[maybe_async]
pub async fn convert_time(
&self,
request: &ConvertTimeRequest,
) -> Result<Result<ConvertTimeResponse, ApiError>, Error> {
self.call::<ConvertTimeService>(request).await
}
#[maybe_async]
pub async fn get_daylight_savings_time(
&self,
request: &DSTListRequest,
) -> Result<Result<DSTListResponse, ApiError>, Error> {
self.call::<DSTListService>(request).await
}
#[maybe_async]
pub async fn get_current_time(
&self,
request: &TimeserviceRequest,
) -> Result<Result<TimeserviceResponse, ApiError>, Error> {
self.call::<TimeserviceService>(request).await
}
}