use super::super::types::{
DataNotFoundError, InvalidParamsError, RateLimitError, RelativeHumidityResponse,
};
#[derive(Debug, Clone, PartialEq)]
pub struct RelativeHumidityInput {
pub date: Option<satay_runtime::Date>,
pub pagination_token: Option<String>,
pub x_api_key: Option<String>,
}
impl RelativeHumidityInput {
pub fn new() -> Self {
Self {
date: None,
pagination_token: None,
x_api_key: None,
}
}
pub fn date(mut self, date: satay_runtime::Date) -> Self {
self.date = Some(date);
self
}
pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
self.pagination_token = Some(pagination_token.into());
self
}
pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
self.x_api_key = Some(x_api_key.into());
self
}
}
impl Default for RelativeHumidityInput {
fn default() -> Self {
Self::new()
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum RelativeHumidityOperationResponse {
Ok(RelativeHumidityResponse),
BadRequest(InvalidParamsError),
NotFound(DataNotFoundError),
Status429(RateLimitError),
UnexpectedStatus(http::StatusCode, Vec<u8>),
}
pub fn relative_humidity_parts(
input: RelativeHumidityInput,
) -> Result<satay_runtime::RequestParts<()>, satay_runtime::Error> {
let mut uri = String::with_capacity(18);
uri.push_str("/relative-humidity");
let mut first_query = true;
if let Some(value) = &input.date {
satay_runtime::append_query_pair(
&mut uri,
&mut first_query,
"date",
&satay_runtime::format_date(value),
);
}
if let Some(value) = &input.pagination_token {
satay_runtime::append_query_pair(
&mut uri,
&mut first_query,
"paginationToken",
value.as_str(),
);
}
let mut headers = http::HeaderMap::new();
if let Some(value) = &input.x_api_key {
satay_runtime::insert_header(&mut headers, "x-api-key", value.as_str())?;
}
Ok(satay_runtime::RequestParts {
method: http::Method::GET,
uri,
headers,
body: (),
})
}