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 GetDirectHoldersParams {
19 pub symbol: Option<String>,
21 pub figi: Option<String>,
23 pub isin: Option<String>,
25 pub cusip: Option<String>,
27 pub exchange: Option<String>,
29 pub mic_code: Option<String>,
31 pub country: Option<String>,
33}
34
35impl GetDirectHoldersParams {
36 pub fn builder() -> GetDirectHoldersParamsBuilder {
38 GetDirectHoldersParamsBuilder::default()
39 }
40}
41
42#[derive(Clone, Debug, Default)]
44pub struct GetDirectHoldersParamsBuilder {
45 symbol: Option<String>,
47 figi: Option<String>,
49 isin: Option<String>,
51 cusip: Option<String>,
53 exchange: Option<String>,
55 mic_code: Option<String>,
57 country: Option<String>,
59}
60
61impl GetDirectHoldersParamsBuilder {
62 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
64 self.symbol = Some(symbol.into());
65 self
66 }
67 pub fn figi(mut self, figi: impl Into<String>) -> Self {
69 self.figi = Some(figi.into());
70 self
71 }
72 pub fn isin(mut self, isin: impl Into<String>) -> Self {
74 self.isin = Some(isin.into());
75 self
76 }
77 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
79 self.cusip = Some(cusip.into());
80 self
81 }
82 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
84 self.exchange = Some(exchange.into());
85 self
86 }
87 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
89 self.mic_code = Some(mic_code.into());
90 self
91 }
92 pub fn country(mut self, country: impl Into<String>) -> Self {
94 self.country = Some(country.into());
95 self
96 }
97
98 pub fn build(self) -> GetDirectHoldersParams {
100 GetDirectHoldersParams {
101 symbol: self.symbol,
102 figi: self.figi,
103 isin: self.isin,
104 cusip: self.cusip,
105 exchange: self.exchange,
106 mic_code: self.mic_code,
107 country: self.country,
108 }
109 }
110}
111
112#[derive(Clone, Debug, Default, Serialize, Deserialize)]
114pub struct GetFundHoldersParams {
115 pub symbol: Option<String>,
117 pub figi: Option<String>,
119 pub isin: Option<String>,
121 pub cusip: Option<String>,
123 pub exchange: Option<String>,
125 pub mic_code: Option<String>,
127 pub country: Option<String>,
129}
130
131impl GetFundHoldersParams {
132 pub fn builder() -> GetFundHoldersParamsBuilder {
134 GetFundHoldersParamsBuilder::default()
135 }
136}
137
138#[derive(Clone, Debug, Default)]
140pub struct GetFundHoldersParamsBuilder {
141 symbol: Option<String>,
143 figi: Option<String>,
145 isin: Option<String>,
147 cusip: Option<String>,
149 exchange: Option<String>,
151 mic_code: Option<String>,
153 country: Option<String>,
155}
156
157impl GetFundHoldersParamsBuilder {
158 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
160 self.symbol = Some(symbol.into());
161 self
162 }
163 pub fn figi(mut self, figi: impl Into<String>) -> Self {
165 self.figi = Some(figi.into());
166 self
167 }
168 pub fn isin(mut self, isin: impl Into<String>) -> Self {
170 self.isin = Some(isin.into());
171 self
172 }
173 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
175 self.cusip = Some(cusip.into());
176 self
177 }
178 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
180 self.exchange = Some(exchange.into());
181 self
182 }
183 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
185 self.mic_code = Some(mic_code.into());
186 self
187 }
188 pub fn country(mut self, country: impl Into<String>) -> Self {
190 self.country = Some(country.into());
191 self
192 }
193
194 pub fn build(self) -> GetFundHoldersParams {
196 GetFundHoldersParams {
197 symbol: self.symbol,
198 figi: self.figi,
199 isin: self.isin,
200 cusip: self.cusip,
201 exchange: self.exchange,
202 mic_code: self.mic_code,
203 country: self.country,
204 }
205 }
206}
207
208#[derive(Clone, Debug, Default, Serialize, Deserialize)]
210pub struct GetInsiderTransactionsParams {
211 pub symbol: Option<String>,
213 pub figi: Option<String>,
215 pub isin: Option<String>,
217 pub cusip: Option<String>,
219 pub exchange: Option<String>,
221 pub mic_code: Option<String>,
223 pub country: Option<String>,
225}
226
227impl GetInsiderTransactionsParams {
228 pub fn builder() -> GetInsiderTransactionsParamsBuilder {
230 GetInsiderTransactionsParamsBuilder::default()
231 }
232}
233
234#[derive(Clone, Debug, Default)]
236pub struct GetInsiderTransactionsParamsBuilder {
237 symbol: Option<String>,
239 figi: Option<String>,
241 isin: Option<String>,
243 cusip: Option<String>,
245 exchange: Option<String>,
247 mic_code: Option<String>,
249 country: Option<String>,
251}
252
253impl GetInsiderTransactionsParamsBuilder {
254 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
256 self.symbol = Some(symbol.into());
257 self
258 }
259 pub fn figi(mut self, figi: impl Into<String>) -> Self {
261 self.figi = Some(figi.into());
262 self
263 }
264 pub fn isin(mut self, isin: impl Into<String>) -> Self {
266 self.isin = Some(isin.into());
267 self
268 }
269 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
271 self.cusip = Some(cusip.into());
272 self
273 }
274 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
276 self.exchange = Some(exchange.into());
277 self
278 }
279 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
281 self.mic_code = Some(mic_code.into());
282 self
283 }
284 pub fn country(mut self, country: impl Into<String>) -> Self {
286 self.country = Some(country.into());
287 self
288 }
289
290 pub fn build(self) -> GetInsiderTransactionsParams {
292 GetInsiderTransactionsParams {
293 symbol: self.symbol,
294 figi: self.figi,
295 isin: self.isin,
296 cusip: self.cusip,
297 exchange: self.exchange,
298 mic_code: self.mic_code,
299 country: self.country,
300 }
301 }
302}
303
304#[derive(Clone, Debug, Default, Serialize, Deserialize)]
306pub struct GetInstitutionalHoldersParams {
307 pub symbol: Option<String>,
309 pub figi: Option<String>,
311 pub isin: Option<String>,
313 pub cusip: Option<String>,
315 pub exchange: Option<String>,
317 pub mic_code: Option<String>,
319 pub country: Option<String>,
321}
322
323impl GetInstitutionalHoldersParams {
324 pub fn builder() -> GetInstitutionalHoldersParamsBuilder {
326 GetInstitutionalHoldersParamsBuilder::default()
327 }
328}
329
330#[derive(Clone, Debug, Default)]
332pub struct GetInstitutionalHoldersParamsBuilder {
333 symbol: Option<String>,
335 figi: Option<String>,
337 isin: Option<String>,
339 cusip: Option<String>,
341 exchange: Option<String>,
343 mic_code: Option<String>,
345 country: Option<String>,
347}
348
349impl GetInstitutionalHoldersParamsBuilder {
350 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
352 self.symbol = Some(symbol.into());
353 self
354 }
355 pub fn figi(mut self, figi: impl Into<String>) -> Self {
357 self.figi = Some(figi.into());
358 self
359 }
360 pub fn isin(mut self, isin: impl Into<String>) -> Self {
362 self.isin = Some(isin.into());
363 self
364 }
365 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
367 self.cusip = Some(cusip.into());
368 self
369 }
370 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
372 self.exchange = Some(exchange.into());
373 self
374 }
375 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
377 self.mic_code = Some(mic_code.into());
378 self
379 }
380 pub fn country(mut self, country: impl Into<String>) -> Self {
382 self.country = Some(country.into());
383 self
384 }
385
386 pub fn build(self) -> GetInstitutionalHoldersParams {
388 GetInstitutionalHoldersParams {
389 symbol: self.symbol,
390 figi: self.figi,
391 isin: self.isin,
392 cusip: self.cusip,
393 exchange: self.exchange,
394 mic_code: self.mic_code,
395 country: self.country,
396 }
397 }
398}
399
400#[derive(Clone, Debug, Default, Serialize, Deserialize)]
402pub struct GetSourceSanctionedEntitiesParams {
403 pub source: String,
405}
406
407impl GetSourceSanctionedEntitiesParams {
408 pub fn builder() -> GetSourceSanctionedEntitiesParamsBuilder {
410 GetSourceSanctionedEntitiesParamsBuilder::default()
411 }
412}
413
414#[derive(Clone, Debug, Default)]
416pub struct GetSourceSanctionedEntitiesParamsBuilder {
417 source: String,
419}
420
421impl GetSourceSanctionedEntitiesParamsBuilder {
422 pub fn source(mut self, source: impl Into<String>) -> Self {
424 self.source = source.into();
425 self
426 }
427
428 pub fn build(self) -> GetSourceSanctionedEntitiesParams {
430 GetSourceSanctionedEntitiesParams {
431 source: self.source,
432 }
433 }
434}
435
436#[derive(Clone, Debug, Default, Serialize, Deserialize)]
438pub struct GetTaxInfoParams {
439 pub symbol: Option<String>,
441 pub isin: Option<String>,
443 pub figi: Option<String>,
445 pub cusip: Option<String>,
447 pub exchange: Option<String>,
449 pub mic_code: Option<String>,
451}
452
453impl GetTaxInfoParams {
454 pub fn builder() -> GetTaxInfoParamsBuilder {
456 GetTaxInfoParamsBuilder::default()
457 }
458}
459
460#[derive(Clone, Debug, Default)]
462pub struct GetTaxInfoParamsBuilder {
463 symbol: Option<String>,
465 isin: Option<String>,
467 figi: Option<String>,
469 cusip: Option<String>,
471 exchange: Option<String>,
473 mic_code: Option<String>,
475}
476
477impl GetTaxInfoParamsBuilder {
478 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
480 self.symbol = Some(symbol.into());
481 self
482 }
483 pub fn isin(mut self, isin: impl Into<String>) -> Self {
485 self.isin = Some(isin.into());
486 self
487 }
488 pub fn figi(mut self, figi: impl Into<String>) -> Self {
490 self.figi = Some(figi.into());
491 self
492 }
493 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
495 self.cusip = Some(cusip.into());
496 self
497 }
498 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
500 self.exchange = Some(exchange.into());
501 self
502 }
503 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
505 self.mic_code = Some(mic_code.into());
506 self
507 }
508
509 pub fn build(self) -> GetTaxInfoParams {
511 GetTaxInfoParams {
512 symbol: self.symbol,
513 isin: self.isin,
514 figi: self.figi,
515 cusip: self.cusip,
516 exchange: self.exchange,
517 mic_code: self.mic_code,
518 }
519 }
520}
521
522#[derive(Debug, Clone, Serialize, Deserialize)]
524#[serde(untagged)]
525pub enum GetDirectHoldersError {
526 UnknownValue(serde_json::Value),
527}
528
529#[derive(Debug, Clone, Serialize, Deserialize)]
531#[serde(untagged)]
532pub enum GetFundHoldersError {
533 UnknownValue(serde_json::Value),
534}
535
536#[derive(Debug, Clone, Serialize, Deserialize)]
538#[serde(untagged)]
539pub enum GetInsiderTransactionsError {
540 UnknownValue(serde_json::Value),
541}
542
543#[derive(Debug, Clone, Serialize, Deserialize)]
545#[serde(untagged)]
546pub enum GetInstitutionalHoldersError {
547 UnknownValue(serde_json::Value),
548}
549
550#[derive(Debug, Clone, Serialize, Deserialize)]
552#[serde(untagged)]
553pub enum GetSourceSanctionedEntitiesError {
554 UnknownValue(serde_json::Value),
555}
556
557#[derive(Debug, Clone, Serialize, Deserialize)]
559#[serde(untagged)]
560pub enum GetTaxInfoError {
561 UnknownValue(serde_json::Value),
562}
563
564pub async fn get_direct_holders(
566 configuration: &configuration::Configuration,
567 params: GetDirectHoldersParams,
568) -> Result<models::GetDirectHoldersResponse, Error<GetDirectHoldersError>> {
569 let p_query_symbol = params.symbol;
571 let p_query_figi = params.figi;
572 let p_query_isin = params.isin;
573 let p_query_cusip = params.cusip;
574 let p_query_exchange = params.exchange;
575 let p_query_mic_code = params.mic_code;
576 let p_query_country = params.country;
577
578 let uri_str = format!("{}/direct_holders", configuration.base_path);
579 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
580
581 if let Some(ref param_value) = p_query_symbol {
582 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
583 }
584 if let Some(ref param_value) = p_query_figi {
585 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
586 }
587 if let Some(ref param_value) = p_query_isin {
588 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
589 }
590 if let Some(ref param_value) = p_query_cusip {
591 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
592 }
593 if let Some(ref param_value) = p_query_exchange {
594 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
595 }
596 if let Some(ref param_value) = p_query_mic_code {
597 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
598 }
599 if let Some(ref param_value) = p_query_country {
600 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
601 }
602 if let Some(ref user_agent) = configuration.user_agent {
603 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
604 }
605 if let Some(ref apikey) = configuration.api_key {
606 let key = apikey.key.clone();
607 let value = match apikey.prefix {
608 Some(ref prefix) => format!("{} {}", prefix, key),
609 None => key,
610 };
611 req_builder = req_builder.header("Authorization", value);
612 };
613
614 let req = req_builder.build()?;
615 let resp = configuration.client.execute(req).await?;
616
617 let status = resp.status();
618 let content_type = resp
619 .headers()
620 .get("content-type")
621 .and_then(|v| v.to_str().ok())
622 .unwrap_or("application/octet-stream");
623 let content_type = super::ContentType::from(content_type);
624
625 if !status.is_client_error() && !status.is_server_error() {
626 let content = resp.text().await?;
627 match content_type {
628 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
629 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetDirectHoldersResponse`"))),
630 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::GetDirectHoldersResponse`")))),
631 }
632 } else {
633 let content = resp.text().await?;
634 let entity: Option<GetDirectHoldersError> = serde_json::from_str(&content).ok();
635 Err(Error::ResponseError(ResponseContent {
636 status,
637 content,
638 entity,
639 }))
640 }
641}
642
643pub async fn get_fund_holders(
645 configuration: &configuration::Configuration,
646 params: GetFundHoldersParams,
647) -> Result<models::GetFundHoldersResponse, Error<GetFundHoldersError>> {
648 let p_query_symbol = params.symbol;
650 let p_query_figi = params.figi;
651 let p_query_isin = params.isin;
652 let p_query_cusip = params.cusip;
653 let p_query_exchange = params.exchange;
654 let p_query_mic_code = params.mic_code;
655 let p_query_country = params.country;
656
657 let uri_str = format!("{}/fund_holders", configuration.base_path);
658 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
659
660 if let Some(ref param_value) = p_query_symbol {
661 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
662 }
663 if let Some(ref param_value) = p_query_figi {
664 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
665 }
666 if let Some(ref param_value) = p_query_isin {
667 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
668 }
669 if let Some(ref param_value) = p_query_cusip {
670 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
671 }
672 if let Some(ref param_value) = p_query_exchange {
673 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
674 }
675 if let Some(ref param_value) = p_query_mic_code {
676 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
677 }
678 if let Some(ref param_value) = p_query_country {
679 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
680 }
681 if let Some(ref user_agent) = configuration.user_agent {
682 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
683 }
684 if let Some(ref apikey) = configuration.api_key {
685 let key = apikey.key.clone();
686 let value = match apikey.prefix {
687 Some(ref prefix) => format!("{} {}", prefix, key),
688 None => key,
689 };
690 req_builder = req_builder.header("Authorization", value);
691 };
692
693 let req = req_builder.build()?;
694 let resp = configuration.client.execute(req).await?;
695
696 let status = resp.status();
697 let content_type = resp
698 .headers()
699 .get("content-type")
700 .and_then(|v| v.to_str().ok())
701 .unwrap_or("application/octet-stream");
702 let content_type = super::ContentType::from(content_type);
703
704 if !status.is_client_error() && !status.is_server_error() {
705 let content = resp.text().await?;
706 match content_type {
707 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
708 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetFundHoldersResponse`"))),
709 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::GetFundHoldersResponse`")))),
710 }
711 } else {
712 let content = resp.text().await?;
713 let entity: Option<GetFundHoldersError> = serde_json::from_str(&content).ok();
714 Err(Error::ResponseError(ResponseContent {
715 status,
716 content,
717 entity,
718 }))
719 }
720}
721
722pub async fn get_insider_transactions(
724 configuration: &configuration::Configuration,
725 params: GetInsiderTransactionsParams,
726) -> Result<models::GetInsiderTransactionsResponse, Error<GetInsiderTransactionsError>> {
727 let p_query_symbol = params.symbol;
729 let p_query_figi = params.figi;
730 let p_query_isin = params.isin;
731 let p_query_cusip = params.cusip;
732 let p_query_exchange = params.exchange;
733 let p_query_mic_code = params.mic_code;
734 let p_query_country = params.country;
735
736 let uri_str = format!("{}/insider_transactions", configuration.base_path);
737 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
738
739 if let Some(ref param_value) = p_query_symbol {
740 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
741 }
742 if let Some(ref param_value) = p_query_figi {
743 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
744 }
745 if let Some(ref param_value) = p_query_isin {
746 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
747 }
748 if let Some(ref param_value) = p_query_cusip {
749 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
750 }
751 if let Some(ref param_value) = p_query_exchange {
752 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
753 }
754 if let Some(ref param_value) = p_query_mic_code {
755 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
756 }
757 if let Some(ref param_value) = p_query_country {
758 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
759 }
760 if let Some(ref user_agent) = configuration.user_agent {
761 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
762 }
763 if let Some(ref apikey) = configuration.api_key {
764 let key = apikey.key.clone();
765 let value = match apikey.prefix {
766 Some(ref prefix) => format!("{} {}", prefix, key),
767 None => key,
768 };
769 req_builder = req_builder.header("Authorization", value);
770 };
771
772 let req = req_builder.build()?;
773 let resp = configuration.client.execute(req).await?;
774
775 let status = resp.status();
776 let content_type = resp
777 .headers()
778 .get("content-type")
779 .and_then(|v| v.to_str().ok())
780 .unwrap_or("application/octet-stream");
781 let content_type = super::ContentType::from(content_type);
782
783 if !status.is_client_error() && !status.is_server_error() {
784 let content = resp.text().await?;
785 match content_type {
786 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
787 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetInsiderTransactionsResponse`"))),
788 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::GetInsiderTransactionsResponse`")))),
789 }
790 } else {
791 let content = resp.text().await?;
792 let entity: Option<GetInsiderTransactionsError> = serde_json::from_str(&content).ok();
793 Err(Error::ResponseError(ResponseContent {
794 status,
795 content,
796 entity,
797 }))
798 }
799}
800
801pub async fn get_institutional_holders(
803 configuration: &configuration::Configuration,
804 params: GetInstitutionalHoldersParams,
805) -> Result<models::GetInstitutionalHoldersResponse, Error<GetInstitutionalHoldersError>> {
806 let p_query_symbol = params.symbol;
808 let p_query_figi = params.figi;
809 let p_query_isin = params.isin;
810 let p_query_cusip = params.cusip;
811 let p_query_exchange = params.exchange;
812 let p_query_mic_code = params.mic_code;
813 let p_query_country = params.country;
814
815 let uri_str = format!("{}/institutional_holders", configuration.base_path);
816 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
817
818 if let Some(ref param_value) = p_query_symbol {
819 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
820 }
821 if let Some(ref param_value) = p_query_figi {
822 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
823 }
824 if let Some(ref param_value) = p_query_isin {
825 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
826 }
827 if let Some(ref param_value) = p_query_cusip {
828 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
829 }
830 if let Some(ref param_value) = p_query_exchange {
831 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
832 }
833 if let Some(ref param_value) = p_query_mic_code {
834 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
835 }
836 if let Some(ref param_value) = p_query_country {
837 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
838 }
839 if let Some(ref user_agent) = configuration.user_agent {
840 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
841 }
842 if let Some(ref apikey) = configuration.api_key {
843 let key = apikey.key.clone();
844 let value = match apikey.prefix {
845 Some(ref prefix) => format!("{} {}", prefix, key),
846 None => key,
847 };
848 req_builder = req_builder.header("Authorization", value);
849 };
850
851 let req = req_builder.build()?;
852 let resp = configuration.client.execute(req).await?;
853
854 let status = resp.status();
855 let content_type = resp
856 .headers()
857 .get("content-type")
858 .and_then(|v| v.to_str().ok())
859 .unwrap_or("application/octet-stream");
860 let content_type = super::ContentType::from(content_type);
861
862 if !status.is_client_error() && !status.is_server_error() {
863 let content = resp.text().await?;
864 match content_type {
865 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
866 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetInstitutionalHoldersResponse`"))),
867 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::GetInstitutionalHoldersResponse`")))),
868 }
869 } else {
870 let content = resp.text().await?;
871 let entity: Option<GetInstitutionalHoldersError> = serde_json::from_str(&content).ok();
872 Err(Error::ResponseError(ResponseContent {
873 status,
874 content,
875 entity,
876 }))
877 }
878}
879
880pub async fn get_source_sanctioned_entities(
882 configuration: &configuration::Configuration,
883 params: GetSourceSanctionedEntitiesParams,
884) -> Result<models::GetSourceSanctionedEntitiesResponse, Error<GetSourceSanctionedEntitiesError>> {
885 let p_path_source = params.source;
887
888 let uri_str = format!(
889 "{}/sanctions/{source}",
890 configuration.base_path,
891 source = crate::apis::urlencode(p_path_source)
892 );
893 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
894
895 if let Some(ref user_agent) = configuration.user_agent {
896 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
897 }
898 if let Some(ref apikey) = configuration.api_key {
899 let key = apikey.key.clone();
900 let value = match apikey.prefix {
901 Some(ref prefix) => format!("{} {}", prefix, key),
902 None => key,
903 };
904 req_builder = req_builder.header("Authorization", value);
905 };
906
907 let req = req_builder.build()?;
908 let resp = configuration.client.execute(req).await?;
909
910 let status = resp.status();
911 let content_type = resp
912 .headers()
913 .get("content-type")
914 .and_then(|v| v.to_str().ok())
915 .unwrap_or("application/octet-stream");
916 let content_type = super::ContentType::from(content_type);
917
918 if !status.is_client_error() && !status.is_server_error() {
919 let content = resp.text().await?;
920 match content_type {
921 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
922 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetSourceSanctionedEntitiesResponse`"))),
923 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::GetSourceSanctionedEntitiesResponse`")))),
924 }
925 } else {
926 let content = resp.text().await?;
927 let entity: Option<GetSourceSanctionedEntitiesError> = serde_json::from_str(&content).ok();
928 Err(Error::ResponseError(ResponseContent {
929 status,
930 content,
931 entity,
932 }))
933 }
934}
935
936pub async fn get_tax_info(
938 configuration: &configuration::Configuration,
939 params: GetTaxInfoParams,
940) -> Result<models::GetTaxInfoResponse, Error<GetTaxInfoError>> {
941 let p_query_symbol = params.symbol;
943 let p_query_isin = params.isin;
944 let p_query_figi = params.figi;
945 let p_query_cusip = params.cusip;
946 let p_query_exchange = params.exchange;
947 let p_query_mic_code = params.mic_code;
948
949 let uri_str = format!("{}/tax_info", configuration.base_path);
950 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
951
952 if let Some(ref param_value) = p_query_symbol {
953 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
954 }
955 if let Some(ref param_value) = p_query_isin {
956 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
957 }
958 if let Some(ref param_value) = p_query_figi {
959 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
960 }
961 if let Some(ref param_value) = p_query_cusip {
962 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
963 }
964 if let Some(ref param_value) = p_query_exchange {
965 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
966 }
967 if let Some(ref param_value) = p_query_mic_code {
968 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
969 }
970 if let Some(ref user_agent) = configuration.user_agent {
971 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
972 }
973 if let Some(ref apikey) = configuration.api_key {
974 let key = apikey.key.clone();
975 let value = match apikey.prefix {
976 Some(ref prefix) => format!("{} {}", prefix, key),
977 None => key,
978 };
979 req_builder = req_builder.header("Authorization", value);
980 };
981
982 let req = req_builder.build()?;
983 let resp = configuration.client.execute(req).await?;
984
985 let status = resp.status();
986 let content_type = resp
987 .headers()
988 .get("content-type")
989 .and_then(|v| v.to_str().ok())
990 .unwrap_or("application/octet-stream");
991 let content_type = super::ContentType::from(content_type);
992
993 if !status.is_client_error() && !status.is_server_error() {
994 let content = resp.text().await?;
995 match content_type {
996 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
997 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetTaxInfoResponse`"))),
998 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::GetTaxInfoResponse`")))),
999 }
1000 } else {
1001 let content = resp.text().await?;
1002 let entity: Option<GetTaxInfoError> = serde_json::from_str(&content).ok();
1003 Err(Error::ResponseError(ResponseContent {
1004 status,
1005 content,
1006 entity,
1007 }))
1008 }
1009}