//! @generated by satay. Do not edit by hand.

use super::{
    AirTemperatureInput, AirTemperatureOperationResponse, FourDayOutlookInput,
    FourDayOutlookOperationResponse, NeaWeatherSubApi, Pm25Input, Pm25OperationResponse, PsiInput,
    PsiOperationResponse, RainfallInput, RainfallOperationResponse, RelativeHumidityInput,
    RelativeHumidityOperationResponse, TwentyFourHrForecastInput,
    TwentyFourHrForecastOperationResponse, TwoHrForecastInput, TwoHrForecastOperationResponse,
    UvInput, UvOperationResponse, WeatherSubApiInput, WeatherSubApiOperationResponse,
    WindDirectionInput, WindDirectionOperationResponse, WindSpeedInput, WindSpeedOperationResponse,
    air_temperature_parts, decode_air_temperature_response, decode_four_day_outlook_response,
    decode_pm25_response, decode_psi_response, decode_rainfall_response,
    decode_relative_humidity_response, decode_twenty_four_hr_forecast_response,
    decode_two_hr_forecast_response, decode_uv_response, decode_weather_sub_api_response,
    decode_wind_direction_response, decode_wind_speed_response, four_day_outlook_parts, pm25_parts,
    psi_parts, rainfall_parts, relative_humidity_parts, twenty_four_hr_forecast_parts,
    two_hr_forecast_parts, uv_parts, weather_sub_api_parts, wind_direction_parts, wind_speed_parts,
};
#[derive(Debug, Clone)]
pub struct Api {
    base_url: String,
    x_api_key: Option<String>,
}
impl Default for Api {
    fn default() -> Self {
        Self::new()
    }
}
impl Api {
    pub fn new() -> Self {
        Self {
            base_url: super::SERVER_URL.to_owned(),
            x_api_key: None,
        }
    }
    pub fn base_url(mut self, base_url: impl Into<String>) -> Self {
        self.base_url = base_url.into();
        self
    }
    pub fn x_api_key(mut self, value: impl Into<String>) -> Self {
        self.x_api_key = Some(value.into());
        self
    }
    /// <https://api-open.data.gov.sg/v2/real-time/api/psi>
    ///
    /// - Readings are provided for each major region in Singapore
    ///
    /// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
    ///
    /// - example: `?date=2024-07-16`
    ///
    /// - If `date` is not provided in query parameter, API will return the latest reading
    ///
    /// - The `region_metadata` field in the response provides longitude/latitude information for the regions. You can use that to place the readings on a map.
    ///
    /// - Unit of measure for readings is `PSI Value`
    pub fn psi(&self) -> PsiAction<'_> {
        PsiAction {
            api: self,
            input: PsiInput::new(),
        }
    }
    /// <https://api-open.data.gov.sg/v2/real-time/api/pm25>
    ///
    /// - Readings are provided for each major region in Singapore
    ///
    /// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
    ///
    /// - example: `?date=2024-07-16`
    ///
    /// - If `date` is not provided in query parameter, API will return the latest reading
    ///
    /// - The `region_metadata` field in the response provides longitude/latitude information for the regions. You can use that to place the readings on a map.
    ///
    /// - Unit of measure for readings is `µg/m3`.
    pub fn pm25(&self) -> Pm25Action<'_> {
        Pm25Action {
            api: self,
            input: Pm25Input::new(),
        }
    }
    /// <https://api-open.data.gov.sg/v2/real-time/api/air-temperature>
    ///
    /// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
    ///
    /// - example: `?date=2024-07-16`
    ///
    /// - If `date` is not provided in query parameter, API will return the latest reading
    ///
    /// - Unit of measure for readings is `°C`
    pub fn air_temperature(&self) -> AirTemperatureAction<'_> {
        AirTemperatureAction {
            api: self,
            input: AirTemperatureInput::new(),
        }
    }
    /// <https://api-open.data.gov.sg/v2/real-time/api/relative-humidity>
    ///
    /// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
    ///
    /// - example: `?date=2024-07-16`
    ///
    /// - If `date` is not provided in query parameter, API will return the latest reading
    ///
    /// - Unit of measure for readings is `%`
    pub fn relative_humidity(&self) -> RelativeHumidityAction<'_> {
        RelativeHumidityAction {
            api: self,
            input: RelativeHumidityInput::new(),
        }
    }
    /// <https://api-open.data.gov.sg/v2/real-time/api/wind-speed>
    ///
    /// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
    ///
    /// - example: `?date=2024-07-16`
    ///
    /// - If `date` is not provided in query parameter, API will return the latest reading
    ///
    /// - Unit of measure for readings is `Knots`
    pub fn wind_speed(&self) -> WindSpeedAction<'_> {
        WindSpeedAction {
            api: self,
            input: WindSpeedInput::new(),
        }
    }
    /// <https://api-open.data.gov.sg/v2/real-time/api/wind-direction>
    ///
    /// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
    ///
    /// - example: `?date=2024-07-16`
    ///
    /// - If `date` is not provided in query parameter, API will return the latest reading
    ///
    /// - Unit of measure for readings is `°`
    pub fn wind_direction(&self) -> WindDirectionAction<'_> {
        WindDirectionAction {
            api: self,
            input: WindDirectionInput::new(),
        }
    }
    /// <https://api-open.data.gov.sg/v2/real-time/api/rainfall>
    ///
    /// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
    ///
    /// - example: `?date=2024-07-16`
    ///
    /// - If `date` is not provided in query parameter, API will return the latest reading
    ///
    /// - Unit of measure for readings is `mm`
    pub fn rainfall(&self) -> RainfallAction<'_> {
        RainfallAction {
            api: self,
            input: RainfallInput::new(),
        }
    }
    /// <https://api-open.data.gov.sg/v2/real-time/api/two-hr-forecast>
    ///
    /// - Forecasts are given for multiple areas in Singapore
    ///
    /// - Filter for specific date or date-time by providing `date` in query parameter (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS).
    ///
    /// - example: `?date=2024-07-16` or `?date=2024-07-16T23:59:00`
    ///
    /// - Forecasts are valid for two hours, for example, the validity period of the forecast at 1pm is 1pm to 3pm
    ///
    /// - If `date` is not provided in query parameter, API will return the latest reading
    pub fn two_hr_forecast(&self) -> TwoHrForecastAction<'_> {
        TwoHrForecastAction {
            api: self,
            input: TwoHrForecastInput::new(),
        }
    }
    /// <https://api-open.data.gov.sg/v2/real-time/api/twenty-four-hr-forecast>
    ///
    /// - Updated multiple times throughout the day
    ///
    /// - Filter for specific date or date-time by providing `date` in query parameter (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS).
    ///
    /// - example: `?date=2024-07-16` or `?date=2024-07-16T23:59:00`
    ///
    /// - Forecasts are valid for twenty four hours, for example, the validity period of the forecast at 1st Jan 1pm is from 1st Jan 1pm to 2nd Jan 1pm
    ///
    /// - If `date` is not provided in query parameter, API will return the latest reading
    pub fn twenty_four_hr_forecast(&self) -> TwentyFourHrForecastAction<'_> {
        TwentyFourHrForecastAction {
            api: self,
            input: TwentyFourHrForecastInput::new(),
        }
    }
    /// <https://api-open.data.gov.sg/v2/real-time/api/four-day-outlook>
    ///
    /// - The forecast is for the next 4 days.
    ///
    /// - Filter for specific date or date-time by providing `date` in query parameter (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS).
    ///
    /// - example: `?date=2024-07-16` or `?date=2024-07-16T23:59:00`
    ///
    /// - Forecasts are valid for four days, for example, the validity period of the forecast at 1st Jan 1pm is from 1st Jan 1pm to 5th Jan 1pm
    ///
    /// - If `date` is not provided in query parameter, API will return the latest reading
    pub fn four_day_outlook(&self) -> FourDayOutlookAction<'_> {
        FourDayOutlookAction {
            api: self,
            input: FourDayOutlookInput::new(),
        }
    }
    /// <https://api-open.data.gov.sg/v2/real-time/api/uv>
    ///
    /// - Updated between 7 AM and 7 PM everyday
    ///
    /// - The UV index value is averaged over the preceding hour
    ///
    /// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
    ///
    /// - example: `?date=2024-07-16`
    ///
    /// - If `date` is not provided in query parameter, API will return the latest reading
    ///
    /// - Unit of measure for readings is `Ultraviolet Index`
    pub fn uv(&self) -> UvAction<'_> {
        UvAction {
            api: self,
            input: UvInput::new(),
        }
    }
    /// Unified weather sub-API endpoint.
    ///
    /// - `?api=lightning` — Cloud-to-ground and cloud-to-cloud lightning strikes. Updated every ~2–3 minutes.
    ///
    /// - `?api=wbgt` — Wet Bulb Globe Temperature heat stress readings. Updated every 15 minutes.
    ///
    /// <https://api-open.data.gov.sg/v2/real-time/api/weather?api=lightning>
    ///
    /// - Updated multiple times throughout the day
    ///
    /// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
    ///
    /// - example: `?date=2025-01-16`
    ///
    /// - If `date` is not provided in query parameter, API will return the latest lightning observation
    pub fn weather_sub_api(&self, api: NeaWeatherSubApi) -> WeatherSubApiAction<'_> {
        WeatherSubApiAction {
            api: self,
            input: WeatherSubApiInput::new(api),
        }
    }
    fn apply<B>(
        &self,
        parts: &mut satay_runtime::RequestParts<B>,
    ) -> Result<(), satay_runtime::Error> {
        if let Some(value) = &self.x_api_key {
            satay_runtime::insert_header(&mut parts.headers, "x-api-key", value)?;
        }
        if self.base_url.is_empty() {
            return Ok(());
        }
        let path_and_query = parts.uri.as_str();
        let base_url = self.base_url.trim_end_matches('/');
        let separator = if path_and_query.starts_with('/') {
            ""
        } else {
            "/"
        };
        parts.uri = format!("{base_url}{separator}{path_and_query}");
        Ok(())
    }
}
/// <https://api-open.data.gov.sg/v2/real-time/api/psi>
///
/// - Readings are provided for each major region in Singapore
///
/// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
///
/// - example: `?date=2024-07-16`
///
/// - If `date` is not provided in query parameter, API will return the latest reading
///
/// - The `region_metadata` field in the response provides longitude/latitude information for the regions. You can use that to place the readings on a map.
///
/// - Unit of measure for readings is `PSI Value`
#[derive(Debug, Clone)]
pub struct PsiAction<'a> {
    api: &'a Api,
    input: PsiInput,
}
impl PsiAction<'_> {
    pub fn date(mut self, date: satay_runtime::Date) -> Self {
        self.input = self.input.date(date);
        self
    }
    pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
        self.input = self.input.pagination_token(pagination_token);
        self
    }
    pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
        self.input = self.input.x_api_key(x_api_key);
        self
    }
    pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        let api = self.api;
        let mut parts = psi_parts(self.input)?;
        api.apply(&mut parts)?;
        satay_runtime::into_empty_request(parts)
    }
    pub fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<PsiOperationResponse, satay_runtime::Error> {
        decode_psi_response(response)
    }
}
impl satay_runtime::Action for PsiAction<'_> {
    type Response = PsiOperationResponse;
    fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        self.request()
    }
    fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<Self::Response, satay_runtime::Error> {
        Self::decode(response)
    }
}
/// <https://api-open.data.gov.sg/v2/real-time/api/pm25>
///
/// - Readings are provided for each major region in Singapore
///
/// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
///
/// - example: `?date=2024-07-16`
///
/// - If `date` is not provided in query parameter, API will return the latest reading
///
/// - The `region_metadata` field in the response provides longitude/latitude information for the regions. You can use that to place the readings on a map.
///
/// - Unit of measure for readings is `µg/m3`.
#[derive(Debug, Clone)]
pub struct Pm25Action<'a> {
    api: &'a Api,
    input: Pm25Input,
}
impl Pm25Action<'_> {
    pub fn date(mut self, date: satay_runtime::Date) -> Self {
        self.input = self.input.date(date);
        self
    }
    pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
        self.input = self.input.pagination_token(pagination_token);
        self
    }
    pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
        self.input = self.input.x_api_key(x_api_key);
        self
    }
    pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        let api = self.api;
        let mut parts = pm25_parts(self.input)?;
        api.apply(&mut parts)?;
        satay_runtime::into_empty_request(parts)
    }
    pub fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<Pm25OperationResponse, satay_runtime::Error> {
        decode_pm25_response(response)
    }
}
impl satay_runtime::Action for Pm25Action<'_> {
    type Response = Pm25OperationResponse;
    fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        self.request()
    }
    fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<Self::Response, satay_runtime::Error> {
        Self::decode(response)
    }
}
/// <https://api-open.data.gov.sg/v2/real-time/api/air-temperature>
///
/// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
///
/// - example: `?date=2024-07-16`
///
/// - If `date` is not provided in query parameter, API will return the latest reading
///
/// - Unit of measure for readings is `°C`
#[derive(Debug, Clone)]
pub struct AirTemperatureAction<'a> {
    api: &'a Api,
    input: AirTemperatureInput,
}
impl AirTemperatureAction<'_> {
    pub fn date(mut self, date: satay_runtime::Date) -> Self {
        self.input = self.input.date(date);
        self
    }
    pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
        self.input = self.input.pagination_token(pagination_token);
        self
    }
    pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
        self.input = self.input.x_api_key(x_api_key);
        self
    }
    pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        let api = self.api;
        let mut parts = air_temperature_parts(self.input)?;
        api.apply(&mut parts)?;
        satay_runtime::into_empty_request(parts)
    }
    pub fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<AirTemperatureOperationResponse, satay_runtime::Error> {
        decode_air_temperature_response(response)
    }
}
impl satay_runtime::Action for AirTemperatureAction<'_> {
    type Response = AirTemperatureOperationResponse;
    fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        self.request()
    }
    fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<Self::Response, satay_runtime::Error> {
        Self::decode(response)
    }
}
/// <https://api-open.data.gov.sg/v2/real-time/api/relative-humidity>
///
/// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
///
/// - example: `?date=2024-07-16`
///
/// - If `date` is not provided in query parameter, API will return the latest reading
///
/// - Unit of measure for readings is `%`
#[derive(Debug, Clone)]
pub struct RelativeHumidityAction<'a> {
    api: &'a Api,
    input: RelativeHumidityInput,
}
impl RelativeHumidityAction<'_> {
    pub fn date(mut self, date: satay_runtime::Date) -> Self {
        self.input = self.input.date(date);
        self
    }
    pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
        self.input = self.input.pagination_token(pagination_token);
        self
    }
    pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
        self.input = self.input.x_api_key(x_api_key);
        self
    }
    pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        let api = self.api;
        let mut parts = relative_humidity_parts(self.input)?;
        api.apply(&mut parts)?;
        satay_runtime::into_empty_request(parts)
    }
    pub fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<RelativeHumidityOperationResponse, satay_runtime::Error> {
        decode_relative_humidity_response(response)
    }
}
impl satay_runtime::Action for RelativeHumidityAction<'_> {
    type Response = RelativeHumidityOperationResponse;
    fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        self.request()
    }
    fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<Self::Response, satay_runtime::Error> {
        Self::decode(response)
    }
}
/// <https://api-open.data.gov.sg/v2/real-time/api/wind-speed>
///
/// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
///
/// - example: `?date=2024-07-16`
///
/// - If `date` is not provided in query parameter, API will return the latest reading
///
/// - Unit of measure for readings is `Knots`
#[derive(Debug, Clone)]
pub struct WindSpeedAction<'a> {
    api: &'a Api,
    input: WindSpeedInput,
}
impl WindSpeedAction<'_> {
    pub fn date(mut self, date: satay_runtime::Date) -> Self {
        self.input = self.input.date(date);
        self
    }
    pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
        self.input = self.input.pagination_token(pagination_token);
        self
    }
    pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
        self.input = self.input.x_api_key(x_api_key);
        self
    }
    pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        let api = self.api;
        let mut parts = wind_speed_parts(self.input)?;
        api.apply(&mut parts)?;
        satay_runtime::into_empty_request(parts)
    }
    pub fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<WindSpeedOperationResponse, satay_runtime::Error> {
        decode_wind_speed_response(response)
    }
}
impl satay_runtime::Action for WindSpeedAction<'_> {
    type Response = WindSpeedOperationResponse;
    fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        self.request()
    }
    fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<Self::Response, satay_runtime::Error> {
        Self::decode(response)
    }
}
/// <https://api-open.data.gov.sg/v2/real-time/api/wind-direction>
///
/// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
///
/// - example: `?date=2024-07-16`
///
/// - If `date` is not provided in query parameter, API will return the latest reading
///
/// - Unit of measure for readings is `°`
#[derive(Debug, Clone)]
pub struct WindDirectionAction<'a> {
    api: &'a Api,
    input: WindDirectionInput,
}
impl WindDirectionAction<'_> {
    pub fn date(mut self, date: satay_runtime::Date) -> Self {
        self.input = self.input.date(date);
        self
    }
    pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
        self.input = self.input.pagination_token(pagination_token);
        self
    }
    pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
        self.input = self.input.x_api_key(x_api_key);
        self
    }
    pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        let api = self.api;
        let mut parts = wind_direction_parts(self.input)?;
        api.apply(&mut parts)?;
        satay_runtime::into_empty_request(parts)
    }
    pub fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<WindDirectionOperationResponse, satay_runtime::Error> {
        decode_wind_direction_response(response)
    }
}
impl satay_runtime::Action for WindDirectionAction<'_> {
    type Response = WindDirectionOperationResponse;
    fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        self.request()
    }
    fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<Self::Response, satay_runtime::Error> {
        Self::decode(response)
    }
}
/// <https://api-open.data.gov.sg/v2/real-time/api/rainfall>
///
/// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
///
/// - example: `?date=2024-07-16`
///
/// - If `date` is not provided in query parameter, API will return the latest reading
///
/// - Unit of measure for readings is `mm`
#[derive(Debug, Clone)]
pub struct RainfallAction<'a> {
    api: &'a Api,
    input: RainfallInput,
}
impl RainfallAction<'_> {
    pub fn date(mut self, date: satay_runtime::Date) -> Self {
        self.input = self.input.date(date);
        self
    }
    pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
        self.input = self.input.pagination_token(pagination_token);
        self
    }
    pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
        self.input = self.input.x_api_key(x_api_key);
        self
    }
    pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        let api = self.api;
        let mut parts = rainfall_parts(self.input)?;
        api.apply(&mut parts)?;
        satay_runtime::into_empty_request(parts)
    }
    pub fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<RainfallOperationResponse, satay_runtime::Error> {
        decode_rainfall_response(response)
    }
}
impl satay_runtime::Action for RainfallAction<'_> {
    type Response = RainfallOperationResponse;
    fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        self.request()
    }
    fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<Self::Response, satay_runtime::Error> {
        Self::decode(response)
    }
}
/// <https://api-open.data.gov.sg/v2/real-time/api/two-hr-forecast>
///
/// - Forecasts are given for multiple areas in Singapore
///
/// - Filter for specific date or date-time by providing `date` in query parameter (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS).
///
/// - example: `?date=2024-07-16` or `?date=2024-07-16T23:59:00`
///
/// - Forecasts are valid for two hours, for example, the validity period of the forecast at 1pm is 1pm to 3pm
///
/// - If `date` is not provided in query parameter, API will return the latest reading
#[derive(Debug, Clone)]
pub struct TwoHrForecastAction<'a> {
    api: &'a Api,
    input: TwoHrForecastInput,
}
impl TwoHrForecastAction<'_> {
    pub fn date(mut self, date: satay_runtime::Date) -> Self {
        self.input = self.input.date(date);
        self
    }
    pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
        self.input = self.input.pagination_token(pagination_token);
        self
    }
    pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
        self.input = self.input.x_api_key(x_api_key);
        self
    }
    pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        let api = self.api;
        let mut parts = two_hr_forecast_parts(self.input)?;
        api.apply(&mut parts)?;
        satay_runtime::into_empty_request(parts)
    }
    pub fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<TwoHrForecastOperationResponse, satay_runtime::Error> {
        decode_two_hr_forecast_response(response)
    }
}
impl satay_runtime::Action for TwoHrForecastAction<'_> {
    type Response = TwoHrForecastOperationResponse;
    fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        self.request()
    }
    fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<Self::Response, satay_runtime::Error> {
        Self::decode(response)
    }
}
/// <https://api-open.data.gov.sg/v2/real-time/api/twenty-four-hr-forecast>
///
/// - Updated multiple times throughout the day
///
/// - Filter for specific date or date-time by providing `date` in query parameter (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS).
///
/// - example: `?date=2024-07-16` or `?date=2024-07-16T23:59:00`
///
/// - Forecasts are valid for twenty four hours, for example, the validity period of the forecast at 1st Jan 1pm is from 1st Jan 1pm to 2nd Jan 1pm
///
/// - If `date` is not provided in query parameter, API will return the latest reading
#[derive(Debug, Clone)]
pub struct TwentyFourHrForecastAction<'a> {
    api: &'a Api,
    input: TwentyFourHrForecastInput,
}
impl TwentyFourHrForecastAction<'_> {
    pub fn date(mut self, date: satay_runtime::Date) -> Self {
        self.input = self.input.date(date);
        self
    }
    pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
        self.input = self.input.pagination_token(pagination_token);
        self
    }
    pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
        self.input = self.input.x_api_key(x_api_key);
        self
    }
    pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        let api = self.api;
        let mut parts = twenty_four_hr_forecast_parts(self.input)?;
        api.apply(&mut parts)?;
        satay_runtime::into_empty_request(parts)
    }
    pub fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<TwentyFourHrForecastOperationResponse, satay_runtime::Error> {
        decode_twenty_four_hr_forecast_response(response)
    }
}
impl satay_runtime::Action for TwentyFourHrForecastAction<'_> {
    type Response = TwentyFourHrForecastOperationResponse;
    fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        self.request()
    }
    fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<Self::Response, satay_runtime::Error> {
        Self::decode(response)
    }
}
/// <https://api-open.data.gov.sg/v2/real-time/api/four-day-outlook>
///
/// - The forecast is for the next 4 days.
///
/// - Filter for specific date or date-time by providing `date` in query parameter (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS).
///
/// - example: `?date=2024-07-16` or `?date=2024-07-16T23:59:00`
///
/// - Forecasts are valid for four days, for example, the validity period of the forecast at 1st Jan 1pm is from 1st Jan 1pm to 5th Jan 1pm
///
/// - If `date` is not provided in query parameter, API will return the latest reading
#[derive(Debug, Clone)]
pub struct FourDayOutlookAction<'a> {
    api: &'a Api,
    input: FourDayOutlookInput,
}
impl FourDayOutlookAction<'_> {
    pub fn date(mut self, date: satay_runtime::Date) -> Self {
        self.input = self.input.date(date);
        self
    }
    pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
        self.input = self.input.pagination_token(pagination_token);
        self
    }
    pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
        self.input = self.input.x_api_key(x_api_key);
        self
    }
    pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        let api = self.api;
        let mut parts = four_day_outlook_parts(self.input)?;
        api.apply(&mut parts)?;
        satay_runtime::into_empty_request(parts)
    }
    pub fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<FourDayOutlookOperationResponse, satay_runtime::Error> {
        decode_four_day_outlook_response(response)
    }
}
impl satay_runtime::Action for FourDayOutlookAction<'_> {
    type Response = FourDayOutlookOperationResponse;
    fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        self.request()
    }
    fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<Self::Response, satay_runtime::Error> {
        Self::decode(response)
    }
}
/// <https://api-open.data.gov.sg/v2/real-time/api/uv>
///
/// - Updated between 7 AM and 7 PM everyday
///
/// - The UV index value is averaged over the preceding hour
///
/// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
///
/// - example: `?date=2024-07-16`
///
/// - If `date` is not provided in query parameter, API will return the latest reading
///
/// - Unit of measure for readings is `Ultraviolet Index`
#[derive(Debug, Clone)]
pub struct UvAction<'a> {
    api: &'a Api,
    input: UvInput,
}
impl UvAction<'_> {
    pub fn date(mut self, date: satay_runtime::Date) -> Self {
        self.input = self.input.date(date);
        self
    }
    pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
        self.input = self.input.pagination_token(pagination_token);
        self
    }
    pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
        self.input = self.input.x_api_key(x_api_key);
        self
    }
    pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        let api = self.api;
        let mut parts = uv_parts(self.input)?;
        api.apply(&mut parts)?;
        satay_runtime::into_empty_request(parts)
    }
    pub fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<UvOperationResponse, satay_runtime::Error> {
        decode_uv_response(response)
    }
}
impl satay_runtime::Action for UvAction<'_> {
    type Response = UvOperationResponse;
    fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        self.request()
    }
    fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<Self::Response, satay_runtime::Error> {
        Self::decode(response)
    }
}
/// Unified weather sub-API endpoint.
///
/// - `?api=lightning` — Cloud-to-ground and cloud-to-cloud lightning strikes. Updated every ~2–3 minutes.
///
/// - `?api=wbgt` — Wet Bulb Globe Temperature heat stress readings. Updated every 15 minutes.
///
/// <https://api-open.data.gov.sg/v2/real-time/api/weather?api=lightning>
///
/// - Updated multiple times throughout the day
///
/// - Filter for a specific date by providing `date` in query parameter (YYYY-MM-DD).
///
/// - example: `?date=2025-01-16`
///
/// - If `date` is not provided in query parameter, API will return the latest lightning observation
#[derive(Debug, Clone)]
pub struct WeatherSubApiAction<'a> {
    api: &'a Api,
    input: WeatherSubApiInput,
}
impl WeatherSubApiAction<'_> {
    pub fn date(mut self, date: satay_runtime::Date) -> Self {
        self.input = self.input.date(date);
        self
    }
    pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
        self.input = self.input.pagination_token(pagination_token);
        self
    }
    pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
        self.input = self.input.x_api_key(x_api_key);
        self
    }
    pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        let api = self.api;
        let mut parts = weather_sub_api_parts(self.input)?;
        api.apply(&mut parts)?;
        satay_runtime::into_empty_request(parts)
    }
    pub fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<WeatherSubApiOperationResponse, satay_runtime::Error> {
        decode_weather_sub_api_response(response)
    }
}
impl satay_runtime::Action for WeatherSubApiAction<'_> {
    type Response = WeatherSubApiOperationResponse;
    fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
        self.request()
    }
    fn decode<B: AsRef<[u8]>>(
        response: satay_runtime::ResponseParts<B>,
    ) -> Result<Self::Response, satay_runtime::Error> {
        Self::decode(response)
    }
}
