1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17#[derive(Clone, Debug, Default, Serialize, Deserialize)]
19pub struct GetEtfsWorldParams {
20 pub symbol: Option<String>,
22 pub figi: Option<String>,
24 pub isin: Option<String>,
26 pub cusip: Option<String>,
28 pub country: Option<String>,
30 pub dp: Option<i64>
32}
33
34impl GetEtfsWorldParams {
35 pub fn builder() -> GetEtfsWorldParamsBuilder {
37 GetEtfsWorldParamsBuilder::default()
38 }
39}
40
41#[derive(Clone, Debug, Default)]
43pub struct GetEtfsWorldParamsBuilder {
44 symbol: Option<String>,
46 figi: Option<String>,
48 isin: Option<String>,
50 cusip: Option<String>,
52 country: Option<String>,
54 dp: Option<i64>
56}
57
58impl GetEtfsWorldParamsBuilder {
59 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
61 self.symbol = Some(symbol.into());
62 self
63 }
64 pub fn figi(mut self, figi: impl Into<String>) -> Self {
66 self.figi = Some(figi.into());
67 self
68 }
69 pub fn isin(mut self, isin: impl Into<String>) -> Self {
71 self.isin = Some(isin.into());
72 self
73 }
74 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
76 self.cusip = Some(cusip.into());
77 self
78 }
79 pub fn country(mut self, country: impl Into<String>) -> Self {
81 self.country = Some(country.into());
82 self
83 }
84 pub fn dp(mut self, dp: i64) -> Self {
86 self.dp = Some(dp);
87 self
88 }
89
90 pub fn build(self) -> GetEtfsWorldParams {
92 GetEtfsWorldParams {
93 symbol: self.symbol,
94 figi: self.figi,
95 isin: self.isin,
96 cusip: self.cusip,
97 country: self.country,
98 dp: self.dp
99 }
100 }
101}
102
103#[derive(Clone, Debug, Default, Serialize, Deserialize)]
105pub struct GetEtfsWorldCompositionParams {
106 pub symbol: Option<String>,
108 pub figi: Option<String>,
110 pub isin: Option<String>,
112 pub cusip: Option<String>,
114 pub country: Option<String>,
116 pub dp: Option<i64>
118}
119
120impl GetEtfsWorldCompositionParams {
121 pub fn builder() -> GetEtfsWorldCompositionParamsBuilder {
123 GetEtfsWorldCompositionParamsBuilder::default()
124 }
125}
126
127#[derive(Clone, Debug, Default)]
129pub struct GetEtfsWorldCompositionParamsBuilder {
130 symbol: Option<String>,
132 figi: Option<String>,
134 isin: Option<String>,
136 cusip: Option<String>,
138 country: Option<String>,
140 dp: Option<i64>
142}
143
144impl GetEtfsWorldCompositionParamsBuilder {
145 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
147 self.symbol = Some(symbol.into());
148 self
149 }
150 pub fn figi(mut self, figi: impl Into<String>) -> Self {
152 self.figi = Some(figi.into());
153 self
154 }
155 pub fn isin(mut self, isin: impl Into<String>) -> Self {
157 self.isin = Some(isin.into());
158 self
159 }
160 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
162 self.cusip = Some(cusip.into());
163 self
164 }
165 pub fn country(mut self, country: impl Into<String>) -> Self {
167 self.country = Some(country.into());
168 self
169 }
170 pub fn dp(mut self, dp: i64) -> Self {
172 self.dp = Some(dp);
173 self
174 }
175
176 pub fn build(self) -> GetEtfsWorldCompositionParams {
178 GetEtfsWorldCompositionParams {
179 symbol: self.symbol,
180 figi: self.figi,
181 isin: self.isin,
182 cusip: self.cusip,
183 country: self.country,
184 dp: self.dp
185 }
186 }
187}
188
189#[derive(Clone, Debug, Default, Serialize, Deserialize)]
191pub struct GetEtfsWorldPerformanceParams {
192 pub symbol: Option<String>,
194 pub figi: Option<String>,
196 pub isin: Option<String>,
198 pub cusip: Option<String>,
200 pub country: Option<String>,
202 pub dp: Option<i64>
204}
205
206impl GetEtfsWorldPerformanceParams {
207 pub fn builder() -> GetEtfsWorldPerformanceParamsBuilder {
209 GetEtfsWorldPerformanceParamsBuilder::default()
210 }
211}
212
213#[derive(Clone, Debug, Default)]
215pub struct GetEtfsWorldPerformanceParamsBuilder {
216 symbol: Option<String>,
218 figi: Option<String>,
220 isin: Option<String>,
222 cusip: Option<String>,
224 country: Option<String>,
226 dp: Option<i64>
228}
229
230impl GetEtfsWorldPerformanceParamsBuilder {
231 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
233 self.symbol = Some(symbol.into());
234 self
235 }
236 pub fn figi(mut self, figi: impl Into<String>) -> Self {
238 self.figi = Some(figi.into());
239 self
240 }
241 pub fn isin(mut self, isin: impl Into<String>) -> Self {
243 self.isin = Some(isin.into());
244 self
245 }
246 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
248 self.cusip = Some(cusip.into());
249 self
250 }
251 pub fn country(mut self, country: impl Into<String>) -> Self {
253 self.country = Some(country.into());
254 self
255 }
256 pub fn dp(mut self, dp: i64) -> Self {
258 self.dp = Some(dp);
259 self
260 }
261
262 pub fn build(self) -> GetEtfsWorldPerformanceParams {
264 GetEtfsWorldPerformanceParams {
265 symbol: self.symbol,
266 figi: self.figi,
267 isin: self.isin,
268 cusip: self.cusip,
269 country: self.country,
270 dp: self.dp
271 }
272 }
273}
274
275#[derive(Clone, Debug, Default, Serialize, Deserialize)]
277pub struct GetEtfsWorldRiskParams {
278 pub symbol: Option<String>,
280 pub figi: Option<String>,
282 pub isin: Option<String>,
284 pub cusip: Option<String>,
286 pub country: Option<String>,
288 pub dp: Option<i64>
290}
291
292impl GetEtfsWorldRiskParams {
293 pub fn builder() -> GetEtfsWorldRiskParamsBuilder {
295 GetEtfsWorldRiskParamsBuilder::default()
296 }
297}
298
299#[derive(Clone, Debug, Default)]
301pub struct GetEtfsWorldRiskParamsBuilder {
302 symbol: Option<String>,
304 figi: Option<String>,
306 isin: Option<String>,
308 cusip: Option<String>,
310 country: Option<String>,
312 dp: Option<i64>
314}
315
316impl GetEtfsWorldRiskParamsBuilder {
317 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
319 self.symbol = Some(symbol.into());
320 self
321 }
322 pub fn figi(mut self, figi: impl Into<String>) -> Self {
324 self.figi = Some(figi.into());
325 self
326 }
327 pub fn isin(mut self, isin: impl Into<String>) -> Self {
329 self.isin = Some(isin.into());
330 self
331 }
332 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
334 self.cusip = Some(cusip.into());
335 self
336 }
337 pub fn country(mut self, country: impl Into<String>) -> Self {
339 self.country = Some(country.into());
340 self
341 }
342 pub fn dp(mut self, dp: i64) -> Self {
344 self.dp = Some(dp);
345 self
346 }
347
348 pub fn build(self) -> GetEtfsWorldRiskParams {
350 GetEtfsWorldRiskParams {
351 symbol: self.symbol,
352 figi: self.figi,
353 isin: self.isin,
354 cusip: self.cusip,
355 country: self.country,
356 dp: self.dp
357 }
358 }
359}
360
361#[derive(Clone, Debug, Default, Serialize, Deserialize)]
363pub struct GetEtfsWorldSummaryParams {
364 pub symbol: Option<String>,
366 pub figi: Option<String>,
368 pub isin: Option<String>,
370 pub cusip: Option<String>,
372 pub country: Option<String>,
374 pub dp: Option<i64>
376}
377
378impl GetEtfsWorldSummaryParams {
379 pub fn builder() -> GetEtfsWorldSummaryParamsBuilder {
381 GetEtfsWorldSummaryParamsBuilder::default()
382 }
383}
384
385#[derive(Clone, Debug, Default)]
387pub struct GetEtfsWorldSummaryParamsBuilder {
388 symbol: Option<String>,
390 figi: Option<String>,
392 isin: Option<String>,
394 cusip: Option<String>,
396 country: Option<String>,
398 dp: Option<i64>
400}
401
402impl GetEtfsWorldSummaryParamsBuilder {
403 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
405 self.symbol = Some(symbol.into());
406 self
407 }
408 pub fn figi(mut self, figi: impl Into<String>) -> Self {
410 self.figi = Some(figi.into());
411 self
412 }
413 pub fn isin(mut self, isin: impl Into<String>) -> Self {
415 self.isin = Some(isin.into());
416 self
417 }
418 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
420 self.cusip = Some(cusip.into());
421 self
422 }
423 pub fn country(mut self, country: impl Into<String>) -> Self {
425 self.country = Some(country.into());
426 self
427 }
428 pub fn dp(mut self, dp: i64) -> Self {
430 self.dp = Some(dp);
431 self
432 }
433
434 pub fn build(self) -> GetEtfsWorldSummaryParams {
436 GetEtfsWorldSummaryParams {
437 symbol: self.symbol,
438 figi: self.figi,
439 isin: self.isin,
440 cusip: self.cusip,
441 country: self.country,
442 dp: self.dp
443 }
444 }
445}
446
447
448#[derive(Debug, Clone, Serialize, Deserialize)]
450#[serde(untagged)]
451pub enum GetEtfsWorldError {
452 UnknownValue(serde_json::Value),
453}
454
455#[derive(Debug, Clone, Serialize, Deserialize)]
457#[serde(untagged)]
458pub enum GetEtfsWorldCompositionError {
459 UnknownValue(serde_json::Value),
460}
461
462#[derive(Debug, Clone, Serialize, Deserialize)]
464#[serde(untagged)]
465pub enum GetEtfsWorldPerformanceError {
466 UnknownValue(serde_json::Value),
467}
468
469#[derive(Debug, Clone, Serialize, Deserialize)]
471#[serde(untagged)]
472pub enum GetEtfsWorldRiskError {
473 UnknownValue(serde_json::Value),
474}
475
476#[derive(Debug, Clone, Serialize, Deserialize)]
478#[serde(untagged)]
479pub enum GetEtfsWorldSummaryError {
480 UnknownValue(serde_json::Value),
481}
482
483
484pub async fn get_etfs_world(configuration: &configuration::Configuration, params: GetEtfsWorldParams) -> Result<models::GetEtfsWorld200Response, Error<GetEtfsWorldError>> {
486 let p_query_symbol = params.symbol;
488 let p_query_figi = params.figi;
489 let p_query_isin = params.isin;
490 let p_query_cusip = params.cusip;
491 let p_query_country = params.country;
492 let p_query_dp = params.dp;
493
494 let uri_str = format!("{}/etfs/world", configuration.base_path);
495 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
496
497 if let Some(ref param_value) = p_query_symbol {
498 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
499 }
500 if let Some(ref param_value) = p_query_figi {
501 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
502 }
503 if let Some(ref param_value) = p_query_isin {
504 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
505 }
506 if let Some(ref param_value) = p_query_cusip {
507 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
508 }
509 if let Some(ref param_value) = p_query_country {
510 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
511 }
512 if let Some(ref param_value) = p_query_dp {
513 req_builder = req_builder.query(&[("dp", ¶m_value.to_string())]);
514 }
515 if let Some(ref user_agent) = configuration.user_agent {
516 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
517 }
518 if let Some(ref apikey) = configuration.api_key {
519 let key = apikey.key.clone();
520 let value = match apikey.prefix {
521 Some(ref prefix) => format!("{} {}", prefix, key),
522 None => key,
523 };
524 req_builder = req_builder.header("Authorization", value);
525 };
526
527 let req = req_builder.build()?;
528 let resp = configuration.client.execute(req).await?;
529
530 let status = resp.status();
531 let content_type = resp
532 .headers()
533 .get("content-type")
534 .and_then(|v| v.to_str().ok())
535 .unwrap_or("application/octet-stream");
536 let content_type = super::ContentType::from(content_type);
537
538 if !status.is_client_error() && !status.is_server_error() {
539 let content = resp.text().await?;
540 match content_type {
541 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
542 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEtfsWorld200Response`"))),
543 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetEtfsWorld200Response`")))),
544 }
545 } else {
546 let content = resp.text().await?;
547 let entity: Option<GetEtfsWorldError> = serde_json::from_str(&content).ok();
548 Err(Error::ResponseError(ResponseContent { status, content, entity }))
549 }
550}
551
552pub async fn get_etfs_world_composition(configuration: &configuration::Configuration, params: GetEtfsWorldCompositionParams) -> Result<models::GetEtfsWorldComposition200Response, Error<GetEtfsWorldCompositionError>> {
554 let p_query_symbol = params.symbol;
556 let p_query_figi = params.figi;
557 let p_query_isin = params.isin;
558 let p_query_cusip = params.cusip;
559 let p_query_country = params.country;
560 let p_query_dp = params.dp;
561
562 let uri_str = format!("{}/etfs/world/composition", configuration.base_path);
563 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
564
565 if let Some(ref param_value) = p_query_symbol {
566 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
567 }
568 if let Some(ref param_value) = p_query_figi {
569 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
570 }
571 if let Some(ref param_value) = p_query_isin {
572 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
573 }
574 if let Some(ref param_value) = p_query_cusip {
575 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
576 }
577 if let Some(ref param_value) = p_query_country {
578 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
579 }
580 if let Some(ref param_value) = p_query_dp {
581 req_builder = req_builder.query(&[("dp", ¶m_value.to_string())]);
582 }
583 if let Some(ref user_agent) = configuration.user_agent {
584 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
585 }
586 if let Some(ref apikey) = configuration.api_key {
587 let key = apikey.key.clone();
588 let value = match apikey.prefix {
589 Some(ref prefix) => format!("{} {}", prefix, key),
590 None => key,
591 };
592 req_builder = req_builder.header("Authorization", value);
593 };
594
595 let req = req_builder.build()?;
596 let resp = configuration.client.execute(req).await?;
597
598 let status = resp.status();
599 let content_type = resp
600 .headers()
601 .get("content-type")
602 .and_then(|v| v.to_str().ok())
603 .unwrap_or("application/octet-stream");
604 let content_type = super::ContentType::from(content_type);
605
606 if !status.is_client_error() && !status.is_server_error() {
607 let content = resp.text().await?;
608 match content_type {
609 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
610 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEtfsWorldComposition200Response`"))),
611 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetEtfsWorldComposition200Response`")))),
612 }
613 } else {
614 let content = resp.text().await?;
615 let entity: Option<GetEtfsWorldCompositionError> = serde_json::from_str(&content).ok();
616 Err(Error::ResponseError(ResponseContent { status, content, entity }))
617 }
618}
619
620pub async fn get_etfs_world_performance(configuration: &configuration::Configuration, params: GetEtfsWorldPerformanceParams) -> Result<models::GetEtfsWorldPerformance200Response, Error<GetEtfsWorldPerformanceError>> {
622 let p_query_symbol = params.symbol;
624 let p_query_figi = params.figi;
625 let p_query_isin = params.isin;
626 let p_query_cusip = params.cusip;
627 let p_query_country = params.country;
628 let p_query_dp = params.dp;
629
630 let uri_str = format!("{}/etfs/world/performance", configuration.base_path);
631 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
632
633 if let Some(ref param_value) = p_query_symbol {
634 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
635 }
636 if let Some(ref param_value) = p_query_figi {
637 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
638 }
639 if let Some(ref param_value) = p_query_isin {
640 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
641 }
642 if let Some(ref param_value) = p_query_cusip {
643 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
644 }
645 if let Some(ref param_value) = p_query_country {
646 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
647 }
648 if let Some(ref param_value) = p_query_dp {
649 req_builder = req_builder.query(&[("dp", ¶m_value.to_string())]);
650 }
651 if let Some(ref user_agent) = configuration.user_agent {
652 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
653 }
654 if let Some(ref apikey) = configuration.api_key {
655 let key = apikey.key.clone();
656 let value = match apikey.prefix {
657 Some(ref prefix) => format!("{} {}", prefix, key),
658 None => key,
659 };
660 req_builder = req_builder.header("Authorization", value);
661 };
662
663 let req = req_builder.build()?;
664 let resp = configuration.client.execute(req).await?;
665
666 let status = resp.status();
667 let content_type = resp
668 .headers()
669 .get("content-type")
670 .and_then(|v| v.to_str().ok())
671 .unwrap_or("application/octet-stream");
672 let content_type = super::ContentType::from(content_type);
673
674 if !status.is_client_error() && !status.is_server_error() {
675 let content = resp.text().await?;
676 match content_type {
677 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
678 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEtfsWorldPerformance200Response`"))),
679 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetEtfsWorldPerformance200Response`")))),
680 }
681 } else {
682 let content = resp.text().await?;
683 let entity: Option<GetEtfsWorldPerformanceError> = serde_json::from_str(&content).ok();
684 Err(Error::ResponseError(ResponseContent { status, content, entity }))
685 }
686}
687
688pub async fn get_etfs_world_risk(configuration: &configuration::Configuration, params: GetEtfsWorldRiskParams) -> Result<models::GetEtfsWorldRisk200Response, Error<GetEtfsWorldRiskError>> {
690 let p_query_symbol = params.symbol;
692 let p_query_figi = params.figi;
693 let p_query_isin = params.isin;
694 let p_query_cusip = params.cusip;
695 let p_query_country = params.country;
696 let p_query_dp = params.dp;
697
698 let uri_str = format!("{}/etfs/world/risk", configuration.base_path);
699 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
700
701 if let Some(ref param_value) = p_query_symbol {
702 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
703 }
704 if let Some(ref param_value) = p_query_figi {
705 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
706 }
707 if let Some(ref param_value) = p_query_isin {
708 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
709 }
710 if let Some(ref param_value) = p_query_cusip {
711 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
712 }
713 if let Some(ref param_value) = p_query_country {
714 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
715 }
716 if let Some(ref param_value) = p_query_dp {
717 req_builder = req_builder.query(&[("dp", ¶m_value.to_string())]);
718 }
719 if let Some(ref user_agent) = configuration.user_agent {
720 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
721 }
722 if let Some(ref apikey) = configuration.api_key {
723 let key = apikey.key.clone();
724 let value = match apikey.prefix {
725 Some(ref prefix) => format!("{} {}", prefix, key),
726 None => key,
727 };
728 req_builder = req_builder.header("Authorization", value);
729 };
730
731 let req = req_builder.build()?;
732 let resp = configuration.client.execute(req).await?;
733
734 let status = resp.status();
735 let content_type = resp
736 .headers()
737 .get("content-type")
738 .and_then(|v| v.to_str().ok())
739 .unwrap_or("application/octet-stream");
740 let content_type = super::ContentType::from(content_type);
741
742 if !status.is_client_error() && !status.is_server_error() {
743 let content = resp.text().await?;
744 match content_type {
745 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
746 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEtfsWorldRisk200Response`"))),
747 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetEtfsWorldRisk200Response`")))),
748 }
749 } else {
750 let content = resp.text().await?;
751 let entity: Option<GetEtfsWorldRiskError> = serde_json::from_str(&content).ok();
752 Err(Error::ResponseError(ResponseContent { status, content, entity }))
753 }
754}
755
756pub async fn get_etfs_world_summary(configuration: &configuration::Configuration, params: GetEtfsWorldSummaryParams) -> Result<models::GetEtfsWorldSummary200Response, Error<GetEtfsWorldSummaryError>> {
758 let p_query_symbol = params.symbol;
760 let p_query_figi = params.figi;
761 let p_query_isin = params.isin;
762 let p_query_cusip = params.cusip;
763 let p_query_country = params.country;
764 let p_query_dp = params.dp;
765
766 let uri_str = format!("{}/etfs/world/summary", configuration.base_path);
767 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
768
769 if let Some(ref param_value) = p_query_symbol {
770 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
771 }
772 if let Some(ref param_value) = p_query_figi {
773 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
774 }
775 if let Some(ref param_value) = p_query_isin {
776 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
777 }
778 if let Some(ref param_value) = p_query_cusip {
779 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
780 }
781 if let Some(ref param_value) = p_query_country {
782 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
783 }
784 if let Some(ref param_value) = p_query_dp {
785 req_builder = req_builder.query(&[("dp", ¶m_value.to_string())]);
786 }
787 if let Some(ref user_agent) = configuration.user_agent {
788 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
789 }
790 if let Some(ref apikey) = configuration.api_key {
791 let key = apikey.key.clone();
792 let value = match apikey.prefix {
793 Some(ref prefix) => format!("{} {}", prefix, key),
794 None => key,
795 };
796 req_builder = req_builder.header("Authorization", value);
797 };
798
799 let req = req_builder.build()?;
800 let resp = configuration.client.execute(req).await?;
801
802 let status = resp.status();
803 let content_type = resp
804 .headers()
805 .get("content-type")
806 .and_then(|v| v.to_str().ok())
807 .unwrap_or("application/octet-stream");
808 let content_type = super::ContentType::from(content_type);
809
810 if !status.is_client_error() && !status.is_server_error() {
811 let content = resp.text().await?;
812 match content_type {
813 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
814 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEtfsWorldSummary200Response`"))),
815 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetEtfsWorldSummary200Response`")))),
816 }
817 } else {
818 let content = resp.text().await?;
819 let entity: Option<GetEtfsWorldSummaryError> = serde_json::from_str(&content).ok();
820 Err(Error::ResponseError(ResponseContent { status, content, entity }))
821 }
822}
823