1#![allow(
3 clippy::doc_markdown,
4 clippy::missing_errors_doc,
5 clippy::must_use_candidate,
6 clippy::needless_pass_by_value,
7 clippy::return_self_not_must_use,
8 clippy::single_match_else
9)]
10
11use super::air_temperature::{air_temperature_parts, decode_air_temperature_response};
12use super::four_day_outlook::{decode_four_day_outlook_response, four_day_outlook_parts};
13use super::pm25::{decode_pm25_response, pm25_parts};
14use super::psi::{decode_psi_response, psi_parts};
15use super::rainfall::{decode_rainfall_response, rainfall_parts};
16use super::relative_humidity::{decode_relative_humidity_response, relative_humidity_parts};
17use super::twenty_four_hr_forecast::{
18 decode_twenty_four_hr_forecast_response, twenty_four_hr_forecast_parts,
19};
20use super::two_hr_forecast::{decode_two_hr_forecast_response, two_hr_forecast_parts};
21use super::uv::{decode_uv_response, uv_parts};
22use super::weather_sub_api::{decode_weather_sub_api_response, weather_sub_api_parts};
23use super::wind_direction::{decode_wind_direction_response, wind_direction_parts};
24use super::wind_speed::{decode_wind_speed_response, wind_speed_parts};
25use super::{
26 AirTemperatureInput, AirTemperatureOperationResponse, FourDayOutlookInput,
27 FourDayOutlookOperationResponse, NeaWeatherSubApi, Pm25Input, Pm25OperationResponse, PsiInput,
28 PsiOperationResponse, RainfallInput, RainfallOperationResponse, RelativeHumidityInput,
29 RelativeHumidityOperationResponse, TwentyFourHrForecastInput,
30 TwentyFourHrForecastOperationResponse, TwoHrForecastInput, TwoHrForecastOperationResponse,
31 UvInput, UvOperationResponse, WeatherSubApiInput, WeatherSubApiOperationResponse,
32 WindDirectionInput, WindDirectionOperationResponse, WindSpeedInput, WindSpeedOperationResponse,
33};
34use crate::air_quality;
35use crate::environment;
36use crate::weather_forecast;
37use crate::weather_readings;
38#[derive(Debug, Clone)]
39pub struct Api {
40 base_url: String,
41 x_api_key: Option<String>,
42}
43impl Default for Api {
44 fn default() -> Self {
45 Self::new()
46 }
47}
48impl Api {
49 pub fn new() -> Self {
50 Self {
51 base_url: super::SERVER_URL.to_owned(),
52 x_api_key: None,
53 }
54 }
55 pub fn base_url(mut self, base_url: impl Into<String>) -> Self {
56 self.base_url = base_url.into();
57 self
58 }
59 pub fn x_api_key(mut self, value: impl Into<String>) -> Self {
60 self.x_api_key = Some(value.into());
61 self
62 }
63 pub fn air_quality(&self) -> air_quality::Api<'_> {
65 air_quality::Api { api: self }
66 }
67 pub fn weather_readings(&self) -> weather_readings::Api<'_> {
69 weather_readings::Api { api: self }
70 }
71 pub fn weather_forecast(&self) -> weather_forecast::Api<'_> {
73 weather_forecast::Api { api: self }
74 }
75 pub fn environment(&self) -> environment::Api<'_> {
77 environment::Api { api: self }
78 }
79 fn apply<B>(
80 &self,
81 parts: &mut satay_runtime::RequestParts<B>,
82 ) -> Result<(), satay_runtime::Error> {
83 if let Some(value) = &self.x_api_key {
84 satay_runtime::insert_header(&mut parts.headers, "x-api-key", value)?;
85 }
86 if self.base_url.is_empty() {
87 return Ok(());
88 }
89 let path_and_query = parts.uri.as_str();
90 let base_url = self.base_url.trim_end_matches('/');
91 let separator = if path_and_query.starts_with('/') {
92 ""
93 } else {
94 "/"
95 };
96 parts.uri = format!("{base_url}{separator}{path_and_query}");
97 Ok(())
98 }
99}
100#[must_use = "configure this action and execute it or call `.request()`"]
116#[derive(Debug, Clone)]
117pub struct PsiAction<'a> {
118 api: &'a Api,
119 input: PsiInput,
120}
121impl<'a> PsiAction<'a> {
122 pub(crate) fn new(api: &'a Api) -> Self {
123 Self {
124 api,
125 input: PsiInput::new(),
126 }
127 }
128 #[must_use = "builder methods return the configured action"]
130 pub fn date(mut self, date: satay_runtime::Date) -> Self {
131 self.input = self.input.date(date);
132 self
133 }
134 #[must_use = "builder methods return the configured action"]
136 pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
137 self.input = self.input.pagination_token(pagination_token);
138 self
139 }
140 #[must_use = "builder methods return the configured action"]
142 pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
143 self.input = self.input.x_api_key(x_api_key);
144 self
145 }
146 pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
147 let api = self.api;
148 let mut parts = psi_parts(self.input)?;
149 api.apply(&mut parts)?;
150 satay_runtime::into_empty_request(parts)
151 }
152 pub fn decode<B: AsRef<[u8]>>(
153 response: satay_runtime::ResponseParts<B>,
154 ) -> Result<PsiOperationResponse, satay_runtime::Error> {
155 decode_psi_response(response)
156 }
157}
158impl satay_runtime::Action for PsiAction<'_> {
159 type Response = PsiOperationResponse;
160 fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
161 self.request()
162 }
163 fn decode<B: AsRef<[u8]>>(
164 response: satay_runtime::ResponseParts<B>,
165 ) -> Result<Self::Response, satay_runtime::Error> {
166 Self::decode(response)
167 }
168}
169#[must_use = "configure this action and execute it or call `.request()`"]
185#[derive(Debug, Clone)]
186pub struct Pm25Action<'a> {
187 api: &'a Api,
188 input: Pm25Input,
189}
190impl<'a> Pm25Action<'a> {
191 pub(crate) fn new(api: &'a Api) -> Self {
192 Self {
193 api,
194 input: Pm25Input::new(),
195 }
196 }
197 #[must_use = "builder methods return the configured action"]
199 pub fn date(mut self, date: satay_runtime::Date) -> Self {
200 self.input = self.input.date(date);
201 self
202 }
203 #[must_use = "builder methods return the configured action"]
205 pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
206 self.input = self.input.pagination_token(pagination_token);
207 self
208 }
209 #[must_use = "builder methods return the configured action"]
211 pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
212 self.input = self.input.x_api_key(x_api_key);
213 self
214 }
215 pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
216 let api = self.api;
217 let mut parts = pm25_parts(self.input)?;
218 api.apply(&mut parts)?;
219 satay_runtime::into_empty_request(parts)
220 }
221 pub fn decode<B: AsRef<[u8]>>(
222 response: satay_runtime::ResponseParts<B>,
223 ) -> Result<Pm25OperationResponse, satay_runtime::Error> {
224 decode_pm25_response(response)
225 }
226}
227impl satay_runtime::Action for Pm25Action<'_> {
228 type Response = Pm25OperationResponse;
229 fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
230 self.request()
231 }
232 fn decode<B: AsRef<[u8]>>(
233 response: satay_runtime::ResponseParts<B>,
234 ) -> Result<Self::Response, satay_runtime::Error> {
235 Self::decode(response)
236 }
237}
238#[must_use = "configure this action and execute it or call `.request()`"]
250#[derive(Debug, Clone)]
251pub struct AirTemperatureAction<'a> {
252 api: &'a Api,
253 input: AirTemperatureInput,
254}
255impl<'a> AirTemperatureAction<'a> {
256 pub(crate) fn new(api: &'a Api) -> Self {
257 Self {
258 api,
259 input: AirTemperatureInput::new(),
260 }
261 }
262 #[must_use = "builder methods return the configured action"]
264 pub fn date(mut self, date: satay_runtime::Date) -> Self {
265 self.input = self.input.date(date);
266 self
267 }
268 #[must_use = "builder methods return the configured action"]
270 pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
271 self.input = self.input.pagination_token(pagination_token);
272 self
273 }
274 #[must_use = "builder methods return the configured action"]
276 pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
277 self.input = self.input.x_api_key(x_api_key);
278 self
279 }
280 pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
281 let api = self.api;
282 let mut parts = air_temperature_parts(self.input)?;
283 api.apply(&mut parts)?;
284 satay_runtime::into_empty_request(parts)
285 }
286 pub fn decode<B: AsRef<[u8]>>(
287 response: satay_runtime::ResponseParts<B>,
288 ) -> Result<AirTemperatureOperationResponse, satay_runtime::Error> {
289 decode_air_temperature_response(response)
290 }
291}
292impl satay_runtime::Action for AirTemperatureAction<'_> {
293 type Response = AirTemperatureOperationResponse;
294 fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
295 self.request()
296 }
297 fn decode<B: AsRef<[u8]>>(
298 response: satay_runtime::ResponseParts<B>,
299 ) -> Result<Self::Response, satay_runtime::Error> {
300 Self::decode(response)
301 }
302}
303#[must_use = "configure this action and execute it or call `.request()`"]
315#[derive(Debug, Clone)]
316pub struct RelativeHumidityAction<'a> {
317 api: &'a Api,
318 input: RelativeHumidityInput,
319}
320impl<'a> RelativeHumidityAction<'a> {
321 pub(crate) fn new(api: &'a Api) -> Self {
322 Self {
323 api,
324 input: RelativeHumidityInput::new(),
325 }
326 }
327 #[must_use = "builder methods return the configured action"]
329 pub fn date(mut self, date: satay_runtime::Date) -> Self {
330 self.input = self.input.date(date);
331 self
332 }
333 #[must_use = "builder methods return the configured action"]
335 pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
336 self.input = self.input.pagination_token(pagination_token);
337 self
338 }
339 #[must_use = "builder methods return the configured action"]
341 pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
342 self.input = self.input.x_api_key(x_api_key);
343 self
344 }
345 pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
346 let api = self.api;
347 let mut parts = relative_humidity_parts(self.input)?;
348 api.apply(&mut parts)?;
349 satay_runtime::into_empty_request(parts)
350 }
351 pub fn decode<B: AsRef<[u8]>>(
352 response: satay_runtime::ResponseParts<B>,
353 ) -> Result<RelativeHumidityOperationResponse, satay_runtime::Error> {
354 decode_relative_humidity_response(response)
355 }
356}
357impl satay_runtime::Action for RelativeHumidityAction<'_> {
358 type Response = RelativeHumidityOperationResponse;
359 fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
360 self.request()
361 }
362 fn decode<B: AsRef<[u8]>>(
363 response: satay_runtime::ResponseParts<B>,
364 ) -> Result<Self::Response, satay_runtime::Error> {
365 Self::decode(response)
366 }
367}
368#[must_use = "configure this action and execute it or call `.request()`"]
380#[derive(Debug, Clone)]
381pub struct WindSpeedAction<'a> {
382 api: &'a Api,
383 input: WindSpeedInput,
384}
385impl<'a> WindSpeedAction<'a> {
386 pub(crate) fn new(api: &'a Api) -> Self {
387 Self {
388 api,
389 input: WindSpeedInput::new(),
390 }
391 }
392 #[must_use = "builder methods return the configured action"]
394 pub fn date(mut self, date: satay_runtime::Date) -> Self {
395 self.input = self.input.date(date);
396 self
397 }
398 #[must_use = "builder methods return the configured action"]
400 pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
401 self.input = self.input.pagination_token(pagination_token);
402 self
403 }
404 #[must_use = "builder methods return the configured action"]
406 pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
407 self.input = self.input.x_api_key(x_api_key);
408 self
409 }
410 pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
411 let api = self.api;
412 let mut parts = wind_speed_parts(self.input)?;
413 api.apply(&mut parts)?;
414 satay_runtime::into_empty_request(parts)
415 }
416 pub fn decode<B: AsRef<[u8]>>(
417 response: satay_runtime::ResponseParts<B>,
418 ) -> Result<WindSpeedOperationResponse, satay_runtime::Error> {
419 decode_wind_speed_response(response)
420 }
421}
422impl satay_runtime::Action for WindSpeedAction<'_> {
423 type Response = WindSpeedOperationResponse;
424 fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
425 self.request()
426 }
427 fn decode<B: AsRef<[u8]>>(
428 response: satay_runtime::ResponseParts<B>,
429 ) -> Result<Self::Response, satay_runtime::Error> {
430 Self::decode(response)
431 }
432}
433#[must_use = "configure this action and execute it or call `.request()`"]
445#[derive(Debug, Clone)]
446pub struct WindDirectionAction<'a> {
447 api: &'a Api,
448 input: WindDirectionInput,
449}
450impl<'a> WindDirectionAction<'a> {
451 pub(crate) fn new(api: &'a Api) -> Self {
452 Self {
453 api,
454 input: WindDirectionInput::new(),
455 }
456 }
457 #[must_use = "builder methods return the configured action"]
459 pub fn date(mut self, date: satay_runtime::Date) -> Self {
460 self.input = self.input.date(date);
461 self
462 }
463 #[must_use = "builder methods return the configured action"]
465 pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
466 self.input = self.input.pagination_token(pagination_token);
467 self
468 }
469 #[must_use = "builder methods return the configured action"]
471 pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
472 self.input = self.input.x_api_key(x_api_key);
473 self
474 }
475 pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
476 let api = self.api;
477 let mut parts = wind_direction_parts(self.input)?;
478 api.apply(&mut parts)?;
479 satay_runtime::into_empty_request(parts)
480 }
481 pub fn decode<B: AsRef<[u8]>>(
482 response: satay_runtime::ResponseParts<B>,
483 ) -> Result<WindDirectionOperationResponse, satay_runtime::Error> {
484 decode_wind_direction_response(response)
485 }
486}
487impl satay_runtime::Action for WindDirectionAction<'_> {
488 type Response = WindDirectionOperationResponse;
489 fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
490 self.request()
491 }
492 fn decode<B: AsRef<[u8]>>(
493 response: satay_runtime::ResponseParts<B>,
494 ) -> Result<Self::Response, satay_runtime::Error> {
495 Self::decode(response)
496 }
497}
498#[must_use = "configure this action and execute it or call `.request()`"]
510#[derive(Debug, Clone)]
511pub struct RainfallAction<'a> {
512 api: &'a Api,
513 input: RainfallInput,
514}
515impl<'a> RainfallAction<'a> {
516 pub(crate) fn new(api: &'a Api) -> Self {
517 Self {
518 api,
519 input: RainfallInput::new(),
520 }
521 }
522 #[must_use = "builder methods return the configured action"]
524 pub fn date(mut self, date: satay_runtime::Date) -> Self {
525 self.input = self.input.date(date);
526 self
527 }
528 #[must_use = "builder methods return the configured action"]
530 pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
531 self.input = self.input.pagination_token(pagination_token);
532 self
533 }
534 #[must_use = "builder methods return the configured action"]
536 pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
537 self.input = self.input.x_api_key(x_api_key);
538 self
539 }
540 pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
541 let api = self.api;
542 let mut parts = rainfall_parts(self.input)?;
543 api.apply(&mut parts)?;
544 satay_runtime::into_empty_request(parts)
545 }
546 pub fn decode<B: AsRef<[u8]>>(
547 response: satay_runtime::ResponseParts<B>,
548 ) -> Result<RainfallOperationResponse, satay_runtime::Error> {
549 decode_rainfall_response(response)
550 }
551}
552impl satay_runtime::Action for RainfallAction<'_> {
553 type Response = RainfallOperationResponse;
554 fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
555 self.request()
556 }
557 fn decode<B: AsRef<[u8]>>(
558 response: satay_runtime::ResponseParts<B>,
559 ) -> Result<Self::Response, satay_runtime::Error> {
560 Self::decode(response)
561 }
562}
563#[must_use = "configure this action and execute it or call `.request()`"]
577#[derive(Debug, Clone)]
578pub struct TwoHrForecastAction<'a> {
579 api: &'a Api,
580 input: TwoHrForecastInput,
581}
582impl<'a> TwoHrForecastAction<'a> {
583 pub(crate) fn new(api: &'a Api) -> Self {
584 Self {
585 api,
586 input: TwoHrForecastInput::new(),
587 }
588 }
589 #[must_use = "builder methods return the configured action"]
591 pub fn date(mut self, date: satay_runtime::Date) -> Self {
592 self.input = self.input.date(date);
593 self
594 }
595 #[must_use = "builder methods return the configured action"]
597 pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
598 self.input = self.input.pagination_token(pagination_token);
599 self
600 }
601 #[must_use = "builder methods return the configured action"]
603 pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
604 self.input = self.input.x_api_key(x_api_key);
605 self
606 }
607 pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
608 let api = self.api;
609 let mut parts = two_hr_forecast_parts(self.input)?;
610 api.apply(&mut parts)?;
611 satay_runtime::into_empty_request(parts)
612 }
613 pub fn decode<B: AsRef<[u8]>>(
614 response: satay_runtime::ResponseParts<B>,
615 ) -> Result<TwoHrForecastOperationResponse, satay_runtime::Error> {
616 decode_two_hr_forecast_response(response)
617 }
618}
619impl satay_runtime::Action for TwoHrForecastAction<'_> {
620 type Response = TwoHrForecastOperationResponse;
621 fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
622 self.request()
623 }
624 fn decode<B: AsRef<[u8]>>(
625 response: satay_runtime::ResponseParts<B>,
626 ) -> Result<Self::Response, satay_runtime::Error> {
627 Self::decode(response)
628 }
629}
630#[must_use = "configure this action and execute it or call `.request()`"]
644#[derive(Debug, Clone)]
645pub struct TwentyFourHrForecastAction<'a> {
646 api: &'a Api,
647 input: TwentyFourHrForecastInput,
648}
649impl<'a> TwentyFourHrForecastAction<'a> {
650 pub(crate) fn new(api: &'a Api) -> Self {
651 Self {
652 api,
653 input: TwentyFourHrForecastInput::new(),
654 }
655 }
656 #[must_use = "builder methods return the configured action"]
658 pub fn date(mut self, date: satay_runtime::Date) -> Self {
659 self.input = self.input.date(date);
660 self
661 }
662 #[must_use = "builder methods return the configured action"]
664 pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
665 self.input = self.input.pagination_token(pagination_token);
666 self
667 }
668 #[must_use = "builder methods return the configured action"]
670 pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
671 self.input = self.input.x_api_key(x_api_key);
672 self
673 }
674 pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
675 let api = self.api;
676 let mut parts = twenty_four_hr_forecast_parts(self.input)?;
677 api.apply(&mut parts)?;
678 satay_runtime::into_empty_request(parts)
679 }
680 pub fn decode<B: AsRef<[u8]>>(
681 response: satay_runtime::ResponseParts<B>,
682 ) -> Result<TwentyFourHrForecastOperationResponse, satay_runtime::Error> {
683 decode_twenty_four_hr_forecast_response(response)
684 }
685}
686impl satay_runtime::Action for TwentyFourHrForecastAction<'_> {
687 type Response = TwentyFourHrForecastOperationResponse;
688 fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
689 self.request()
690 }
691 fn decode<B: AsRef<[u8]>>(
692 response: satay_runtime::ResponseParts<B>,
693 ) -> Result<Self::Response, satay_runtime::Error> {
694 Self::decode(response)
695 }
696}
697#[must_use = "configure this action and execute it or call `.request()`"]
711#[derive(Debug, Clone)]
712pub struct FourDayOutlookAction<'a> {
713 api: &'a Api,
714 input: FourDayOutlookInput,
715}
716impl<'a> FourDayOutlookAction<'a> {
717 pub(crate) fn new(api: &'a Api) -> Self {
718 Self {
719 api,
720 input: FourDayOutlookInput::new(),
721 }
722 }
723 #[must_use = "builder methods return the configured action"]
725 pub fn date(mut self, date: satay_runtime::Date) -> Self {
726 self.input = self.input.date(date);
727 self
728 }
729 #[must_use = "builder methods return the configured action"]
731 pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
732 self.input = self.input.pagination_token(pagination_token);
733 self
734 }
735 #[must_use = "builder methods return the configured action"]
737 pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
738 self.input = self.input.x_api_key(x_api_key);
739 self
740 }
741 pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
742 let api = self.api;
743 let mut parts = four_day_outlook_parts(self.input)?;
744 api.apply(&mut parts)?;
745 satay_runtime::into_empty_request(parts)
746 }
747 pub fn decode<B: AsRef<[u8]>>(
748 response: satay_runtime::ResponseParts<B>,
749 ) -> Result<FourDayOutlookOperationResponse, satay_runtime::Error> {
750 decode_four_day_outlook_response(response)
751 }
752}
753impl satay_runtime::Action for FourDayOutlookAction<'_> {
754 type Response = FourDayOutlookOperationResponse;
755 fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
756 self.request()
757 }
758 fn decode<B: AsRef<[u8]>>(
759 response: satay_runtime::ResponseParts<B>,
760 ) -> Result<Self::Response, satay_runtime::Error> {
761 Self::decode(response)
762 }
763}
764#[must_use = "configure this action and execute it or call `.request()`"]
780#[derive(Debug, Clone)]
781pub struct UvAction<'a> {
782 api: &'a Api,
783 input: UvInput,
784}
785impl<'a> UvAction<'a> {
786 pub(crate) fn new(api: &'a Api) -> Self {
787 Self {
788 api,
789 input: UvInput::new(),
790 }
791 }
792 #[must_use = "builder methods return the configured action"]
794 pub fn date(mut self, date: satay_runtime::Date) -> Self {
795 self.input = self.input.date(date);
796 self
797 }
798 #[must_use = "builder methods return the configured action"]
800 pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
801 self.input = self.input.pagination_token(pagination_token);
802 self
803 }
804 #[must_use = "builder methods return the configured action"]
806 pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
807 self.input = self.input.x_api_key(x_api_key);
808 self
809 }
810 pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
811 let api = self.api;
812 let mut parts = uv_parts(self.input)?;
813 api.apply(&mut parts)?;
814 satay_runtime::into_empty_request(parts)
815 }
816 pub fn decode<B: AsRef<[u8]>>(
817 response: satay_runtime::ResponseParts<B>,
818 ) -> Result<UvOperationResponse, satay_runtime::Error> {
819 decode_uv_response(response)
820 }
821}
822impl satay_runtime::Action for UvAction<'_> {
823 type Response = UvOperationResponse;
824 fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
825 self.request()
826 }
827 fn decode<B: AsRef<[u8]>>(
828 response: satay_runtime::ResponseParts<B>,
829 ) -> Result<Self::Response, satay_runtime::Error> {
830 Self::decode(response)
831 }
832}
833#[must_use = "configure this action and execute it or call `.request()`"]
851#[derive(Debug, Clone)]
852pub struct WeatherSubApiAction<'a> {
853 api: &'a Api,
854 input: WeatherSubApiInput,
855}
856impl<'a> WeatherSubApiAction<'a> {
857 pub(crate) fn new(api_2: &'a Api, api: NeaWeatherSubApi) -> Self {
858 Self {
859 api: api_2,
860 input: WeatherSubApiInput::new(api),
861 }
862 }
863 #[must_use = "builder methods return the configured action"]
865 pub fn date(mut self, date: satay_runtime::Date) -> Self {
866 self.input = self.input.date(date);
867 self
868 }
869 #[must_use = "builder methods return the configured action"]
871 pub fn pagination_token(mut self, pagination_token: impl Into<String>) -> Self {
872 self.input = self.input.pagination_token(pagination_token);
873 self
874 }
875 #[must_use = "builder methods return the configured action"]
877 pub fn x_api_key(mut self, x_api_key: impl Into<String>) -> Self {
878 self.input = self.input.x_api_key(x_api_key);
879 self
880 }
881 pub fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
882 let api = self.api;
883 let mut parts = weather_sub_api_parts(self.input)?;
884 api.apply(&mut parts)?;
885 satay_runtime::into_empty_request(parts)
886 }
887 pub fn decode<B: AsRef<[u8]>>(
888 response: satay_runtime::ResponseParts<B>,
889 ) -> Result<WeatherSubApiOperationResponse, satay_runtime::Error> {
890 decode_weather_sub_api_response(response)
891 }
892}
893impl satay_runtime::Action for WeatherSubApiAction<'_> {
894 type Response = WeatherSubApiOperationResponse;
895 fn request(self) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
896 self.request()
897 }
898 fn decode<B: AsRef<[u8]>>(
899 response: satay_runtime::ResponseParts<B>,
900 ) -> Result<Self::Response, satay_runtime::Error> {
901 Self::decode(response)
902 }
903}