1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16#[derive(Clone, Debug, Default, Serialize, Deserialize)]
18pub struct GetEtfsWorldParams {
19 pub symbol: Option<String>,
21 pub figi: Option<String>,
23 pub isin: Option<String>,
25 pub cusip: Option<String>,
27 pub country: Option<String>,
29 pub dp: Option<i64>,
31}
32
33impl GetEtfsWorldParams {
34 pub fn builder() -> GetEtfsWorldParamsBuilder {
36 GetEtfsWorldParamsBuilder::default()
37 }
38}
39
40#[derive(Clone, Debug, Default)]
42pub struct GetEtfsWorldParamsBuilder {
43 symbol: Option<String>,
45 figi: Option<String>,
47 isin: Option<String>,
49 cusip: Option<String>,
51 country: Option<String>,
53 dp: Option<i64>,
55}
56
57impl GetEtfsWorldParamsBuilder {
58 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
60 self.symbol = Some(symbol.into());
61 self
62 }
63 pub fn figi(mut self, figi: impl Into<String>) -> Self {
65 self.figi = Some(figi.into());
66 self
67 }
68 pub fn isin(mut self, isin: impl Into<String>) -> Self {
70 self.isin = Some(isin.into());
71 self
72 }
73 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
75 self.cusip = Some(cusip.into());
76 self
77 }
78 pub fn country(mut self, country: impl Into<String>) -> Self {
80 self.country = Some(country.into());
81 self
82 }
83 pub fn dp(mut self, dp: i64) -> Self {
85 self.dp = Some(dp);
86 self
87 }
88
89 pub fn build(self) -> GetEtfsWorldParams {
91 GetEtfsWorldParams {
92 symbol: self.symbol,
93 figi: self.figi,
94 isin: self.isin,
95 cusip: self.cusip,
96 country: self.country,
97 dp: self.dp,
98 }
99 }
100}
101
102#[derive(Clone, Debug, Default, Serialize, Deserialize)]
104pub struct GetEtfsWorldCompositionParams {
105 pub symbol: Option<String>,
107 pub figi: Option<String>,
109 pub isin: Option<String>,
111 pub cusip: Option<String>,
113 pub country: Option<String>,
115 pub dp: Option<i64>,
117}
118
119impl GetEtfsWorldCompositionParams {
120 pub fn builder() -> GetEtfsWorldCompositionParamsBuilder {
122 GetEtfsWorldCompositionParamsBuilder::default()
123 }
124}
125
126#[derive(Clone, Debug, Default)]
128pub struct GetEtfsWorldCompositionParamsBuilder {
129 symbol: Option<String>,
131 figi: Option<String>,
133 isin: Option<String>,
135 cusip: Option<String>,
137 country: Option<String>,
139 dp: Option<i64>,
141}
142
143impl GetEtfsWorldCompositionParamsBuilder {
144 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
146 self.symbol = Some(symbol.into());
147 self
148 }
149 pub fn figi(mut self, figi: impl Into<String>) -> Self {
151 self.figi = Some(figi.into());
152 self
153 }
154 pub fn isin(mut self, isin: impl Into<String>) -> Self {
156 self.isin = Some(isin.into());
157 self
158 }
159 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
161 self.cusip = Some(cusip.into());
162 self
163 }
164 pub fn country(mut self, country: impl Into<String>) -> Self {
166 self.country = Some(country.into());
167 self
168 }
169 pub fn dp(mut self, dp: i64) -> Self {
171 self.dp = Some(dp);
172 self
173 }
174
175 pub fn build(self) -> GetEtfsWorldCompositionParams {
177 GetEtfsWorldCompositionParams {
178 symbol: self.symbol,
179 figi: self.figi,
180 isin: self.isin,
181 cusip: self.cusip,
182 country: self.country,
183 dp: self.dp,
184 }
185 }
186}
187
188#[derive(Clone, Debug, Default, Serialize, Deserialize)]
190pub struct GetEtfsWorldPerformanceParams {
191 pub symbol: Option<String>,
193 pub figi: Option<String>,
195 pub isin: Option<String>,
197 pub cusip: Option<String>,
199 pub country: Option<String>,
201 pub dp: Option<i64>,
203}
204
205impl GetEtfsWorldPerformanceParams {
206 pub fn builder() -> GetEtfsWorldPerformanceParamsBuilder {
208 GetEtfsWorldPerformanceParamsBuilder::default()
209 }
210}
211
212#[derive(Clone, Debug, Default)]
214pub struct GetEtfsWorldPerformanceParamsBuilder {
215 symbol: Option<String>,
217 figi: Option<String>,
219 isin: Option<String>,
221 cusip: Option<String>,
223 country: Option<String>,
225 dp: Option<i64>,
227}
228
229impl GetEtfsWorldPerformanceParamsBuilder {
230 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
232 self.symbol = Some(symbol.into());
233 self
234 }
235 pub fn figi(mut self, figi: impl Into<String>) -> Self {
237 self.figi = Some(figi.into());
238 self
239 }
240 pub fn isin(mut self, isin: impl Into<String>) -> Self {
242 self.isin = Some(isin.into());
243 self
244 }
245 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
247 self.cusip = Some(cusip.into());
248 self
249 }
250 pub fn country(mut self, country: impl Into<String>) -> Self {
252 self.country = Some(country.into());
253 self
254 }
255 pub fn dp(mut self, dp: i64) -> Self {
257 self.dp = Some(dp);
258 self
259 }
260
261 pub fn build(self) -> GetEtfsWorldPerformanceParams {
263 GetEtfsWorldPerformanceParams {
264 symbol: self.symbol,
265 figi: self.figi,
266 isin: self.isin,
267 cusip: self.cusip,
268 country: self.country,
269 dp: self.dp,
270 }
271 }
272}
273
274#[derive(Clone, Debug, Default, Serialize, Deserialize)]
276pub struct GetEtfsWorldRiskParams {
277 pub symbol: Option<String>,
279 pub figi: Option<String>,
281 pub isin: Option<String>,
283 pub cusip: Option<String>,
285 pub country: Option<String>,
287 pub dp: Option<i64>,
289}
290
291impl GetEtfsWorldRiskParams {
292 pub fn builder() -> GetEtfsWorldRiskParamsBuilder {
294 GetEtfsWorldRiskParamsBuilder::default()
295 }
296}
297
298#[derive(Clone, Debug, Default)]
300pub struct GetEtfsWorldRiskParamsBuilder {
301 symbol: Option<String>,
303 figi: Option<String>,
305 isin: Option<String>,
307 cusip: Option<String>,
309 country: Option<String>,
311 dp: Option<i64>,
313}
314
315impl GetEtfsWorldRiskParamsBuilder {
316 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
318 self.symbol = Some(symbol.into());
319 self
320 }
321 pub fn figi(mut self, figi: impl Into<String>) -> Self {
323 self.figi = Some(figi.into());
324 self
325 }
326 pub fn isin(mut self, isin: impl Into<String>) -> Self {
328 self.isin = Some(isin.into());
329 self
330 }
331 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
333 self.cusip = Some(cusip.into());
334 self
335 }
336 pub fn country(mut self, country: impl Into<String>) -> Self {
338 self.country = Some(country.into());
339 self
340 }
341 pub fn dp(mut self, dp: i64) -> Self {
343 self.dp = Some(dp);
344 self
345 }
346
347 pub fn build(self) -> GetEtfsWorldRiskParams {
349 GetEtfsWorldRiskParams {
350 symbol: self.symbol,
351 figi: self.figi,
352 isin: self.isin,
353 cusip: self.cusip,
354 country: self.country,
355 dp: self.dp,
356 }
357 }
358}
359
360#[derive(Clone, Debug, Default, Serialize, Deserialize)]
362pub struct GetEtfsWorldSummaryParams {
363 pub symbol: Option<String>,
365 pub figi: Option<String>,
367 pub isin: Option<String>,
369 pub cusip: Option<String>,
371 pub country: Option<String>,
373 pub dp: Option<i64>,
375}
376
377impl GetEtfsWorldSummaryParams {
378 pub fn builder() -> GetEtfsWorldSummaryParamsBuilder {
380 GetEtfsWorldSummaryParamsBuilder::default()
381 }
382}
383
384#[derive(Clone, Debug, Default)]
386pub struct GetEtfsWorldSummaryParamsBuilder {
387 symbol: Option<String>,
389 figi: Option<String>,
391 isin: Option<String>,
393 cusip: Option<String>,
395 country: Option<String>,
397 dp: Option<i64>,
399}
400
401impl GetEtfsWorldSummaryParamsBuilder {
402 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
404 self.symbol = Some(symbol.into());
405 self
406 }
407 pub fn figi(mut self, figi: impl Into<String>) -> Self {
409 self.figi = Some(figi.into());
410 self
411 }
412 pub fn isin(mut self, isin: impl Into<String>) -> Self {
414 self.isin = Some(isin.into());
415 self
416 }
417 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
419 self.cusip = Some(cusip.into());
420 self
421 }
422 pub fn country(mut self, country: impl Into<String>) -> Self {
424 self.country = Some(country.into());
425 self
426 }
427 pub fn dp(mut self, dp: i64) -> Self {
429 self.dp = Some(dp);
430 self
431 }
432
433 pub fn build(self) -> GetEtfsWorldSummaryParams {
435 GetEtfsWorldSummaryParams {
436 symbol: self.symbol,
437 figi: self.figi,
438 isin: self.isin,
439 cusip: self.cusip,
440 country: self.country,
441 dp: self.dp,
442 }
443 }
444}
445
446#[derive(Debug, Clone, Serialize, Deserialize)]
448#[serde(untagged)]
449pub enum GetEtfsWorldError {
450 UnknownValue(serde_json::Value),
451}
452
453#[derive(Debug, Clone, Serialize, Deserialize)]
455#[serde(untagged)]
456pub enum GetEtfsWorldCompositionError {
457 UnknownValue(serde_json::Value),
458}
459
460#[derive(Debug, Clone, Serialize, Deserialize)]
462#[serde(untagged)]
463pub enum GetEtfsWorldPerformanceError {
464 UnknownValue(serde_json::Value),
465}
466
467#[derive(Debug, Clone, Serialize, Deserialize)]
469#[serde(untagged)]
470pub enum GetEtfsWorldRiskError {
471 UnknownValue(serde_json::Value),
472}
473
474#[derive(Debug, Clone, Serialize, Deserialize)]
476#[serde(untagged)]
477pub enum GetEtfsWorldSummaryError {
478 UnknownValue(serde_json::Value),
479}
480
481pub async fn get_etfs_world(
483 configuration: &configuration::Configuration,
484 params: GetEtfsWorldParams,
485) -> Result<models::GetEtfsWorldResponse, 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/*` content type response that cannot be converted to `models::GetEtfsWorldResponse`"))),
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::GetEtfsWorldResponse`")))),
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 {
549 status,
550 content,
551 entity,
552 }))
553 }
554}
555
556pub async fn get_etfs_world_composition(
558 configuration: &configuration::Configuration,
559 params: GetEtfsWorldCompositionParams,
560) -> Result<models::GetEtfsWorldCompositionResponse, Error<GetEtfsWorldCompositionError>> {
561 let p_query_symbol = params.symbol;
563 let p_query_figi = params.figi;
564 let p_query_isin = params.isin;
565 let p_query_cusip = params.cusip;
566 let p_query_country = params.country;
567 let p_query_dp = params.dp;
568
569 let uri_str = format!("{}/etfs/world/composition", configuration.base_path);
570 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
571
572 if let Some(ref param_value) = p_query_symbol {
573 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
574 }
575 if let Some(ref param_value) = p_query_figi {
576 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
577 }
578 if let Some(ref param_value) = p_query_isin {
579 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
580 }
581 if let Some(ref param_value) = p_query_cusip {
582 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
583 }
584 if let Some(ref param_value) = p_query_country {
585 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
586 }
587 if let Some(ref param_value) = p_query_dp {
588 req_builder = req_builder.query(&[("dp", ¶m_value.to_string())]);
589 }
590 if let Some(ref user_agent) = configuration.user_agent {
591 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
592 }
593 if let Some(ref apikey) = configuration.api_key {
594 let key = apikey.key.clone();
595 let value = match apikey.prefix {
596 Some(ref prefix) => format!("{} {}", prefix, key),
597 None => key,
598 };
599 req_builder = req_builder.header("Authorization", value);
600 };
601
602 let req = req_builder.build()?;
603 let resp = configuration.client.execute(req).await?;
604
605 let status = resp.status();
606 let content_type = resp
607 .headers()
608 .get("content-type")
609 .and_then(|v| v.to_str().ok())
610 .unwrap_or("application/octet-stream");
611 let content_type = super::ContentType::from(content_type);
612
613 if !status.is_client_error() && !status.is_server_error() {
614 let content = resp.text().await?;
615 match content_type {
616 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
617 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEtfsWorldCompositionResponse`"))),
618 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::GetEtfsWorldCompositionResponse`")))),
619 }
620 } else {
621 let content = resp.text().await?;
622 let entity: Option<GetEtfsWorldCompositionError> = serde_json::from_str(&content).ok();
623 Err(Error::ResponseError(ResponseContent {
624 status,
625 content,
626 entity,
627 }))
628 }
629}
630
631pub async fn get_etfs_world_performance(
633 configuration: &configuration::Configuration,
634 params: GetEtfsWorldPerformanceParams,
635) -> Result<models::GetEtfsWorldPerformanceResponse, Error<GetEtfsWorldPerformanceError>> {
636 let p_query_symbol = params.symbol;
638 let p_query_figi = params.figi;
639 let p_query_isin = params.isin;
640 let p_query_cusip = params.cusip;
641 let p_query_country = params.country;
642 let p_query_dp = params.dp;
643
644 let uri_str = format!("{}/etfs/world/performance", configuration.base_path);
645 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
646
647 if let Some(ref param_value) = p_query_symbol {
648 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
649 }
650 if let Some(ref param_value) = p_query_figi {
651 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
652 }
653 if let Some(ref param_value) = p_query_isin {
654 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
655 }
656 if let Some(ref param_value) = p_query_cusip {
657 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
658 }
659 if let Some(ref param_value) = p_query_country {
660 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
661 }
662 if let Some(ref param_value) = p_query_dp {
663 req_builder = req_builder.query(&[("dp", ¶m_value.to_string())]);
664 }
665 if let Some(ref user_agent) = configuration.user_agent {
666 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
667 }
668 if let Some(ref apikey) = configuration.api_key {
669 let key = apikey.key.clone();
670 let value = match apikey.prefix {
671 Some(ref prefix) => format!("{} {}", prefix, key),
672 None => key,
673 };
674 req_builder = req_builder.header("Authorization", value);
675 };
676
677 let req = req_builder.build()?;
678 let resp = configuration.client.execute(req).await?;
679
680 let status = resp.status();
681 let content_type = resp
682 .headers()
683 .get("content-type")
684 .and_then(|v| v.to_str().ok())
685 .unwrap_or("application/octet-stream");
686 let content_type = super::ContentType::from(content_type);
687
688 if !status.is_client_error() && !status.is_server_error() {
689 let content = resp.text().await?;
690 match content_type {
691 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
692 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEtfsWorldPerformanceResponse`"))),
693 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::GetEtfsWorldPerformanceResponse`")))),
694 }
695 } else {
696 let content = resp.text().await?;
697 let entity: Option<GetEtfsWorldPerformanceError> = serde_json::from_str(&content).ok();
698 Err(Error::ResponseError(ResponseContent {
699 status,
700 content,
701 entity,
702 }))
703 }
704}
705
706pub async fn get_etfs_world_risk(
708 configuration: &configuration::Configuration,
709 params: GetEtfsWorldRiskParams,
710) -> Result<models::GetEtfsWorldRiskResponse, Error<GetEtfsWorldRiskError>> {
711 let p_query_symbol = params.symbol;
713 let p_query_figi = params.figi;
714 let p_query_isin = params.isin;
715 let p_query_cusip = params.cusip;
716 let p_query_country = params.country;
717 let p_query_dp = params.dp;
718
719 let uri_str = format!("{}/etfs/world/risk", configuration.base_path);
720 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
721
722 if let Some(ref param_value) = p_query_symbol {
723 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
724 }
725 if let Some(ref param_value) = p_query_figi {
726 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
727 }
728 if let Some(ref param_value) = p_query_isin {
729 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
730 }
731 if let Some(ref param_value) = p_query_cusip {
732 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
733 }
734 if let Some(ref param_value) = p_query_country {
735 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
736 }
737 if let Some(ref param_value) = p_query_dp {
738 req_builder = req_builder.query(&[("dp", ¶m_value.to_string())]);
739 }
740 if let Some(ref user_agent) = configuration.user_agent {
741 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
742 }
743 if let Some(ref apikey) = configuration.api_key {
744 let key = apikey.key.clone();
745 let value = match apikey.prefix {
746 Some(ref prefix) => format!("{} {}", prefix, key),
747 None => key,
748 };
749 req_builder = req_builder.header("Authorization", value);
750 };
751
752 let req = req_builder.build()?;
753 let resp = configuration.client.execute(req).await?;
754
755 let status = resp.status();
756 let content_type = resp
757 .headers()
758 .get("content-type")
759 .and_then(|v| v.to_str().ok())
760 .unwrap_or("application/octet-stream");
761 let content_type = super::ContentType::from(content_type);
762
763 if !status.is_client_error() && !status.is_server_error() {
764 let content = resp.text().await?;
765 match content_type {
766 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
767 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEtfsWorldRiskResponse`"))),
768 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::GetEtfsWorldRiskResponse`")))),
769 }
770 } else {
771 let content = resp.text().await?;
772 let entity: Option<GetEtfsWorldRiskError> = serde_json::from_str(&content).ok();
773 Err(Error::ResponseError(ResponseContent {
774 status,
775 content,
776 entity,
777 }))
778 }
779}
780
781pub async fn get_etfs_world_summary(
783 configuration: &configuration::Configuration,
784 params: GetEtfsWorldSummaryParams,
785) -> Result<models::GetEtfsWorldSummaryResponse, Error<GetEtfsWorldSummaryError>> {
786 let p_query_symbol = params.symbol;
788 let p_query_figi = params.figi;
789 let p_query_isin = params.isin;
790 let p_query_cusip = params.cusip;
791 let p_query_country = params.country;
792 let p_query_dp = params.dp;
793
794 let uri_str = format!("{}/etfs/world/summary", configuration.base_path);
795 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
796
797 if let Some(ref param_value) = p_query_symbol {
798 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
799 }
800 if let Some(ref param_value) = p_query_figi {
801 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
802 }
803 if let Some(ref param_value) = p_query_isin {
804 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
805 }
806 if let Some(ref param_value) = p_query_cusip {
807 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
808 }
809 if let Some(ref param_value) = p_query_country {
810 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
811 }
812 if let Some(ref param_value) = p_query_dp {
813 req_builder = req_builder.query(&[("dp", ¶m_value.to_string())]);
814 }
815 if let Some(ref user_agent) = configuration.user_agent {
816 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
817 }
818 if let Some(ref apikey) = configuration.api_key {
819 let key = apikey.key.clone();
820 let value = match apikey.prefix {
821 Some(ref prefix) => format!("{} {}", prefix, key),
822 None => key,
823 };
824 req_builder = req_builder.header("Authorization", value);
825 };
826
827 let req = req_builder.build()?;
828 let resp = configuration.client.execute(req).await?;
829
830 let status = resp.status();
831 let content_type = resp
832 .headers()
833 .get("content-type")
834 .and_then(|v| v.to_str().ok())
835 .unwrap_or("application/octet-stream");
836 let content_type = super::ContentType::from(content_type);
837
838 if !status.is_client_error() && !status.is_server_error() {
839 let content = resp.text().await?;
840 match content_type {
841 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
842 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEtfsWorldSummaryResponse`"))),
843 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::GetEtfsWorldSummaryResponse`")))),
844 }
845 } else {
846 let content = resp.text().await?;
847 let entity: Option<GetEtfsWorldSummaryError> = serde_json::from_str(&content).ok();
848 Err(Error::ResponseError(ResponseContent {
849 status,
850 content,
851 entity,
852 }))
853 }
854}