nea_rs/wind_direction/
parts.rs1use super::super::types::{
4 DataNotFoundError, InvalidParamsError, RateLimitError, WindDirectionResponse,
5};
6#[derive(Debug, Clone, PartialEq)]
16pub struct WindDirectionInput {
17 pub date: Option<satay_runtime::Date>,
19 pub pagination_token: Option<String>,
21 pub x_api_key: Option<String>,
23}
24impl WindDirectionInput {
25 pub fn new() -> Self {
26 Self {
27 date: None,
28 pagination_token: None,
29 x_api_key: None,
30 }
31 }
32 pub fn date(mut self, date: satay_runtime::Date) -> Self {
33 self.date = Some(date);
34 self
35 }
36 pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
37 self.pagination_token = Some(pagination_token.into());
38 self
39 }
40 pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
41 self.x_api_key = Some(x_api_key.into());
42 self
43 }
44}
45impl Default for WindDirectionInput {
46 fn default() -> Self {
47 Self::new()
48 }
49}
50#[derive(Debug, Clone, PartialEq)]
60pub enum WindDirectionOperationResponse {
61 Ok(WindDirectionResponse),
63 BadRequest(InvalidParamsError),
65 NotFound(DataNotFoundError),
67 Status429(RateLimitError),
69 UnexpectedStatus(http::StatusCode, Vec<u8>),
70}
71pub fn wind_direction_parts(
81 input: WindDirectionInput,
82) -> Result<satay_runtime::RequestParts<()>, satay_runtime::Error> {
83 let mut uri = String::with_capacity(15);
84 uri.push_str("/wind-direction");
85 let mut first_query = true;
86 if let Some(value) = &input.date {
87 satay_runtime::append_query_pair(
88 &mut uri,
89 &mut first_query,
90 "date",
91 &satay_runtime::format_date(value),
92 );
93 }
94 if let Some(value) = &input.pagination_token {
95 satay_runtime::append_query_pair(
96 &mut uri,
97 &mut first_query,
98 "paginationToken",
99 value.as_str(),
100 );
101 }
102 let mut headers = http::HeaderMap::new();
103 if let Some(value) = &input.x_api_key {
104 satay_runtime::insert_header(&mut headers, "x-api-key", value.as_str())?;
105 }
106 Ok(satay_runtime::RequestParts {
107 method: http::Method::GET,
108 uri,
109 headers,
110 body: (),
111 })
112}