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)]
19pub struct GetDirectHoldersParams {
20 pub symbol: Option<String>,
22 pub figi: Option<String>,
24 pub isin: Option<String>,
26 pub cusip: Option<String>,
28 pub exchange: Option<String>,
30 pub mic_code: Option<String>,
32 pub country: Option<String>
34}
35
36impl GetDirectHoldersParams {
37 pub fn builder() -> GetDirectHoldersParamsBuilder {
39 GetDirectHoldersParamsBuilder::default()
40 }
41}
42
43#[derive(Clone, Debug, Default)]
45pub struct GetDirectHoldersParamsBuilder {
46 symbol: Option<String>,
48 figi: Option<String>,
50 isin: Option<String>,
52 cusip: Option<String>,
54 exchange: Option<String>,
56 mic_code: Option<String>,
58 country: Option<String>
60}
61
62impl GetDirectHoldersParamsBuilder {
63 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
65 self.symbol = Some(symbol.into());
66
67 self
68 }
69 pub fn figi(mut self, figi: impl Into<String>) -> Self {
71 self.figi = Some(figi.into());
72
73 self
74 }
75 pub fn isin(mut self, isin: impl Into<String>) -> Self {
77 self.isin = Some(isin.into());
78
79 self
80 }
81 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
83 self.cusip = Some(cusip.into());
84
85 self
86 }
87 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
89 self.exchange = Some(exchange.into());
90
91 self
92 }
93 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
95 self.mic_code = Some(mic_code.into());
96
97 self
98 }
99 pub fn country(mut self, country: impl Into<String>) -> Self {
101 self.country = Some(country.into());
102
103 self
104 }
105
106 pub fn build(self) -> GetDirectHoldersParams {
108 GetDirectHoldersParams {
109 symbol: self.symbol,
110 figi: self.figi,
111 isin: self.isin,
112 cusip: self.cusip,
113 exchange: self.exchange,
114 mic_code: self.mic_code,
115 country: self.country
116 }
117 }
118}
119
120#[derive(Clone, Debug, Default)]
122pub struct GetFundHoldersParams {
123 pub symbol: Option<String>,
125 pub figi: Option<String>,
127 pub isin: Option<String>,
129 pub cusip: Option<String>,
131 pub exchange: Option<String>,
133 pub mic_code: Option<String>,
135 pub country: Option<String>
137}
138
139impl GetFundHoldersParams {
140 pub fn builder() -> GetFundHoldersParamsBuilder {
142 GetFundHoldersParamsBuilder::default()
143 }
144}
145
146#[derive(Clone, Debug, Default)]
148pub struct GetFundHoldersParamsBuilder {
149 symbol: Option<String>,
151 figi: Option<String>,
153 isin: Option<String>,
155 cusip: Option<String>,
157 exchange: Option<String>,
159 mic_code: Option<String>,
161 country: Option<String>
163}
164
165impl GetFundHoldersParamsBuilder {
166 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
168 self.symbol = Some(symbol.into());
169
170 self
171 }
172 pub fn figi(mut self, figi: impl Into<String>) -> Self {
174 self.figi = Some(figi.into());
175
176 self
177 }
178 pub fn isin(mut self, isin: impl Into<String>) -> Self {
180 self.isin = Some(isin.into());
181
182 self
183 }
184 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
186 self.cusip = Some(cusip.into());
187
188 self
189 }
190 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
192 self.exchange = Some(exchange.into());
193
194 self
195 }
196 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
198 self.mic_code = Some(mic_code.into());
199
200 self
201 }
202 pub fn country(mut self, country: impl Into<String>) -> Self {
204 self.country = Some(country.into());
205
206 self
207 }
208
209 pub fn build(self) -> GetFundHoldersParams {
211 GetFundHoldersParams {
212 symbol: self.symbol,
213 figi: self.figi,
214 isin: self.isin,
215 cusip: self.cusip,
216 exchange: self.exchange,
217 mic_code: self.mic_code,
218 country: self.country
219 }
220 }
221}
222
223#[derive(Clone, Debug, Default)]
225pub struct GetInsiderTransactionsParams {
226 pub symbol: Option<String>,
228 pub figi: Option<String>,
230 pub isin: Option<String>,
232 pub cusip: Option<String>,
234 pub exchange: Option<String>,
236 pub mic_code: Option<String>,
238 pub country: Option<String>
240}
241
242impl GetInsiderTransactionsParams {
243 pub fn builder() -> GetInsiderTransactionsParamsBuilder {
245 GetInsiderTransactionsParamsBuilder::default()
246 }
247}
248
249#[derive(Clone, Debug, Default)]
251pub struct GetInsiderTransactionsParamsBuilder {
252 symbol: Option<String>,
254 figi: Option<String>,
256 isin: Option<String>,
258 cusip: Option<String>,
260 exchange: Option<String>,
262 mic_code: Option<String>,
264 country: Option<String>
266}
267
268impl GetInsiderTransactionsParamsBuilder {
269 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
271 self.symbol = Some(symbol.into());
272
273 self
274 }
275 pub fn figi(mut self, figi: impl Into<String>) -> Self {
277 self.figi = Some(figi.into());
278
279 self
280 }
281 pub fn isin(mut self, isin: impl Into<String>) -> Self {
283 self.isin = Some(isin.into());
284
285 self
286 }
287 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
289 self.cusip = Some(cusip.into());
290
291 self
292 }
293 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
295 self.exchange = Some(exchange.into());
296
297 self
298 }
299 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
301 self.mic_code = Some(mic_code.into());
302
303 self
304 }
305 pub fn country(mut self, country: impl Into<String>) -> Self {
307 self.country = Some(country.into());
308
309 self
310 }
311
312 pub fn build(self) -> GetInsiderTransactionsParams {
314 GetInsiderTransactionsParams {
315 symbol: self.symbol,
316 figi: self.figi,
317 isin: self.isin,
318 cusip: self.cusip,
319 exchange: self.exchange,
320 mic_code: self.mic_code,
321 country: self.country
322 }
323 }
324}
325
326#[derive(Clone, Debug, Default)]
328pub struct GetInstitutionalHoldersParams {
329 pub symbol: Option<String>,
331 pub figi: Option<String>,
333 pub isin: Option<String>,
335 pub cusip: Option<String>,
337 pub exchange: Option<String>,
339 pub mic_code: Option<String>,
341 pub country: Option<String>
343}
344
345impl GetInstitutionalHoldersParams {
346 pub fn builder() -> GetInstitutionalHoldersParamsBuilder {
348 GetInstitutionalHoldersParamsBuilder::default()
349 }
350}
351
352#[derive(Clone, Debug, Default)]
354pub struct GetInstitutionalHoldersParamsBuilder {
355 symbol: Option<String>,
357 figi: Option<String>,
359 isin: Option<String>,
361 cusip: Option<String>,
363 exchange: Option<String>,
365 mic_code: Option<String>,
367 country: Option<String>
369}
370
371impl GetInstitutionalHoldersParamsBuilder {
372 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
374 self.symbol = Some(symbol.into());
375
376 self
377 }
378 pub fn figi(mut self, figi: impl Into<String>) -> Self {
380 self.figi = Some(figi.into());
381
382 self
383 }
384 pub fn isin(mut self, isin: impl Into<String>) -> Self {
386 self.isin = Some(isin.into());
387
388 self
389 }
390 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
392 self.cusip = Some(cusip.into());
393
394 self
395 }
396 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
398 self.exchange = Some(exchange.into());
399
400 self
401 }
402 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
404 self.mic_code = Some(mic_code.into());
405
406 self
407 }
408 pub fn country(mut self, country: impl Into<String>) -> Self {
410 self.country = Some(country.into());
411
412 self
413 }
414
415 pub fn build(self) -> GetInstitutionalHoldersParams {
417 GetInstitutionalHoldersParams {
418 symbol: self.symbol,
419 figi: self.figi,
420 isin: self.isin,
421 cusip: self.cusip,
422 exchange: self.exchange,
423 mic_code: self.mic_code,
424 country: self.country
425 }
426 }
427}
428
429#[derive(Clone, Debug, Default)]
431pub struct GetSourceSanctionedEntitiesParams {
432 pub source: String
434}
435
436impl GetSourceSanctionedEntitiesParams {
437 pub fn builder() -> GetSourceSanctionedEntitiesParamsBuilder {
439 GetSourceSanctionedEntitiesParamsBuilder::default()
440 }
441}
442
443#[derive(Clone, Debug, Default)]
445pub struct GetSourceSanctionedEntitiesParamsBuilder {
446 source: String
448}
449
450impl GetSourceSanctionedEntitiesParamsBuilder {
451 pub fn source(mut self, source: impl Into<String>) -> Self {
453 self.source = source.into();
454
455 self
456 }
457
458 pub fn build(self) -> GetSourceSanctionedEntitiesParams {
460 GetSourceSanctionedEntitiesParams {
461 source: self.source
462 }
463 }
464}
465
466#[derive(Clone, Debug, Default)]
468pub struct GetTaxInfoParams {
469 pub symbol: Option<String>,
471 pub isin: Option<String>,
473 pub figi: Option<String>,
475 pub cusip: Option<String>,
477 pub exchange: Option<String>,
479 pub mic_code: Option<String>
481}
482
483impl GetTaxInfoParams {
484 pub fn builder() -> GetTaxInfoParamsBuilder {
486 GetTaxInfoParamsBuilder::default()
487 }
488}
489
490#[derive(Clone, Debug, Default)]
492pub struct GetTaxInfoParamsBuilder {
493 symbol: Option<String>,
495 isin: Option<String>,
497 figi: Option<String>,
499 cusip: Option<String>,
501 exchange: Option<String>,
503 mic_code: Option<String>
505}
506
507impl GetTaxInfoParamsBuilder {
508 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
510 self.symbol = Some(symbol.into());
511
512 self
513 }
514 pub fn isin(mut self, isin: impl Into<String>) -> Self {
516 self.isin = Some(isin.into());
517
518 self
519 }
520 pub fn figi(mut self, figi: impl Into<String>) -> Self {
522 self.figi = Some(figi.into());
523
524 self
525 }
526 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
528 self.cusip = Some(cusip.into());
529
530 self
531 }
532 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
534 self.exchange = Some(exchange.into());
535
536 self
537 }
538 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
540 self.mic_code = Some(mic_code.into());
541
542 self
543 }
544
545 pub fn build(self) -> GetTaxInfoParams {
547 GetTaxInfoParams {
548 symbol: self.symbol,
549 isin: self.isin,
550 figi: self.figi,
551 cusip: self.cusip,
552 exchange: self.exchange,
553 mic_code: self.mic_code
554 }
555 }
556}
557
558
559#[derive(Debug, Clone, Serialize, Deserialize)]
561#[serde(untagged)]
562pub enum GetDirectHoldersError {
563 UnknownValue(serde_json::Value),
564}
565
566#[derive(Debug, Clone, Serialize, Deserialize)]
568#[serde(untagged)]
569pub enum GetFundHoldersError {
570 UnknownValue(serde_json::Value),
571}
572
573#[derive(Debug, Clone, Serialize, Deserialize)]
575#[serde(untagged)]
576pub enum GetInsiderTransactionsError {
577 UnknownValue(serde_json::Value),
578}
579
580#[derive(Debug, Clone, Serialize, Deserialize)]
582#[serde(untagged)]
583pub enum GetInstitutionalHoldersError {
584 UnknownValue(serde_json::Value),
585}
586
587#[derive(Debug, Clone, Serialize, Deserialize)]
589#[serde(untagged)]
590pub enum GetSourceSanctionedEntitiesError {
591 UnknownValue(serde_json::Value),
592}
593
594#[derive(Debug, Clone, Serialize, Deserialize)]
596#[serde(untagged)]
597pub enum GetTaxInfoError {
598 UnknownValue(serde_json::Value),
599}
600
601
602pub async fn get_direct_holders(configuration: &configuration::Configuration, params: GetDirectHoldersParams) -> Result<models::GetDirectHolders200Response, Error<GetDirectHoldersError>> {
604 let p_query_symbol = params.symbol;
606 let p_query_figi = params.figi;
607 let p_query_isin = params.isin;
608 let p_query_cusip = params.cusip;
609 let p_query_exchange = params.exchange;
610 let p_query_mic_code = params.mic_code;
611 let p_query_country = params.country;
612
613 let uri_str = format!("{}/direct_holders", configuration.base_path);
614 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
615
616 if let Some(ref param_value) = p_query_symbol {
617 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
618 }
619 if let Some(ref param_value) = p_query_figi {
620 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
621 }
622 if let Some(ref param_value) = p_query_isin {
623 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
624 }
625 if let Some(ref param_value) = p_query_cusip {
626 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
627 }
628 if let Some(ref param_value) = p_query_exchange {
629 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
630 }
631 if let Some(ref param_value) = p_query_mic_code {
632 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
633 }
634 if let Some(ref param_value) = p_query_country {
635 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
636 }
637 if let Some(ref user_agent) = configuration.user_agent {
638 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
639 }
640 if let Some(ref apikey) = configuration.api_key {
641 let key = apikey.key.clone();
642 let value = match apikey.prefix {
643 Some(ref prefix) => format!("{} {}", prefix, key),
644 None => key,
645 };
646 req_builder = req_builder.header("Authorization", value);
647 };
648
649 let req = req_builder.build()?;
650 let resp = configuration.client.execute(req).await?;
651
652 let status = resp.status();
653 let content_type = resp
654 .headers()
655 .get("content-type")
656 .and_then(|v| v.to_str().ok())
657 .unwrap_or("application/octet-stream");
658 let content_type = super::ContentType::from(content_type);
659
660 if !status.is_client_error() && !status.is_server_error() {
661 let content = resp.text().await?;
662 match content_type {
663 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
664 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetDirectHolders200Response`"))),
665 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::GetDirectHolders200Response`")))),
666 }
667 } else {
668 let content = resp.text().await?;
669 let entity: Option<GetDirectHoldersError> = serde_json::from_str(&content).ok();
670 Err(Error::ResponseError(ResponseContent { status, content, entity }))
671 }
672}
673
674pub async fn get_fund_holders(configuration: &configuration::Configuration, params: GetFundHoldersParams) -> Result<models::GetFundHolders200Response, Error<GetFundHoldersError>> {
676 let p_query_symbol = params.symbol;
678 let p_query_figi = params.figi;
679 let p_query_isin = params.isin;
680 let p_query_cusip = params.cusip;
681 let p_query_exchange = params.exchange;
682 let p_query_mic_code = params.mic_code;
683 let p_query_country = params.country;
684
685 let uri_str = format!("{}/fund_holders", configuration.base_path);
686 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
687
688 if let Some(ref param_value) = p_query_symbol {
689 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
690 }
691 if let Some(ref param_value) = p_query_figi {
692 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
693 }
694 if let Some(ref param_value) = p_query_isin {
695 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
696 }
697 if let Some(ref param_value) = p_query_cusip {
698 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
699 }
700 if let Some(ref param_value) = p_query_exchange {
701 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
702 }
703 if let Some(ref param_value) = p_query_mic_code {
704 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
705 }
706 if let Some(ref param_value) = p_query_country {
707 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
708 }
709 if let Some(ref user_agent) = configuration.user_agent {
710 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
711 }
712 if let Some(ref apikey) = configuration.api_key {
713 let key = apikey.key.clone();
714 let value = match apikey.prefix {
715 Some(ref prefix) => format!("{} {}", prefix, key),
716 None => key,
717 };
718 req_builder = req_builder.header("Authorization", value);
719 };
720
721 let req = req_builder.build()?;
722 let resp = configuration.client.execute(req).await?;
723
724 let status = resp.status();
725 let content_type = resp
726 .headers()
727 .get("content-type")
728 .and_then(|v| v.to_str().ok())
729 .unwrap_or("application/octet-stream");
730 let content_type = super::ContentType::from(content_type);
731
732 if !status.is_client_error() && !status.is_server_error() {
733 let content = resp.text().await?;
734 match content_type {
735 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
736 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetFundHolders200Response`"))),
737 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::GetFundHolders200Response`")))),
738 }
739 } else {
740 let content = resp.text().await?;
741 let entity: Option<GetFundHoldersError> = serde_json::from_str(&content).ok();
742 Err(Error::ResponseError(ResponseContent { status, content, entity }))
743 }
744}
745
746pub async fn get_insider_transactions(configuration: &configuration::Configuration, params: GetInsiderTransactionsParams) -> Result<models::GetInsiderTransactions200Response, Error<GetInsiderTransactionsError>> {
748 let p_query_symbol = params.symbol;
750 let p_query_figi = params.figi;
751 let p_query_isin = params.isin;
752 let p_query_cusip = params.cusip;
753 let p_query_exchange = params.exchange;
754 let p_query_mic_code = params.mic_code;
755 let p_query_country = params.country;
756
757 let uri_str = format!("{}/insider_transactions", configuration.base_path);
758 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
759
760 if let Some(ref param_value) = p_query_symbol {
761 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
762 }
763 if let Some(ref param_value) = p_query_figi {
764 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
765 }
766 if let Some(ref param_value) = p_query_isin {
767 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
768 }
769 if let Some(ref param_value) = p_query_cusip {
770 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
771 }
772 if let Some(ref param_value) = p_query_exchange {
773 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
774 }
775 if let Some(ref param_value) = p_query_mic_code {
776 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
777 }
778 if let Some(ref param_value) = p_query_country {
779 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
780 }
781 if let Some(ref user_agent) = configuration.user_agent {
782 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
783 }
784 if let Some(ref apikey) = configuration.api_key {
785 let key = apikey.key.clone();
786 let value = match apikey.prefix {
787 Some(ref prefix) => format!("{} {}", prefix, key),
788 None => key,
789 };
790 req_builder = req_builder.header("Authorization", value);
791 };
792
793 let req = req_builder.build()?;
794 let resp = configuration.client.execute(req).await?;
795
796 let status = resp.status();
797 let content_type = resp
798 .headers()
799 .get("content-type")
800 .and_then(|v| v.to_str().ok())
801 .unwrap_or("application/octet-stream");
802 let content_type = super::ContentType::from(content_type);
803
804 if !status.is_client_error() && !status.is_server_error() {
805 let content = resp.text().await?;
806 match content_type {
807 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
808 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetInsiderTransactions200Response`"))),
809 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::GetInsiderTransactions200Response`")))),
810 }
811 } else {
812 let content = resp.text().await?;
813 let entity: Option<GetInsiderTransactionsError> = serde_json::from_str(&content).ok();
814 Err(Error::ResponseError(ResponseContent { status, content, entity }))
815 }
816}
817
818pub async fn get_institutional_holders(configuration: &configuration::Configuration, params: GetInstitutionalHoldersParams) -> Result<models::GetInstitutionalHolders200Response, Error<GetInstitutionalHoldersError>> {
820 let p_query_symbol = params.symbol;
822 let p_query_figi = params.figi;
823 let p_query_isin = params.isin;
824 let p_query_cusip = params.cusip;
825 let p_query_exchange = params.exchange;
826 let p_query_mic_code = params.mic_code;
827 let p_query_country = params.country;
828
829 let uri_str = format!("{}/institutional_holders", configuration.base_path);
830 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
831
832 if let Some(ref param_value) = p_query_symbol {
833 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
834 }
835 if let Some(ref param_value) = p_query_figi {
836 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
837 }
838 if let Some(ref param_value) = p_query_isin {
839 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
840 }
841 if let Some(ref param_value) = p_query_cusip {
842 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
843 }
844 if let Some(ref param_value) = p_query_exchange {
845 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
846 }
847 if let Some(ref param_value) = p_query_mic_code {
848 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
849 }
850 if let Some(ref param_value) = p_query_country {
851 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
852 }
853 if let Some(ref user_agent) = configuration.user_agent {
854 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
855 }
856 if let Some(ref apikey) = configuration.api_key {
857 let key = apikey.key.clone();
858 let value = match apikey.prefix {
859 Some(ref prefix) => format!("{} {}", prefix, key),
860 None => key,
861 };
862 req_builder = req_builder.header("Authorization", value);
863 };
864
865 let req = req_builder.build()?;
866 let resp = configuration.client.execute(req).await?;
867
868 let status = resp.status();
869 let content_type = resp
870 .headers()
871 .get("content-type")
872 .and_then(|v| v.to_str().ok())
873 .unwrap_or("application/octet-stream");
874 let content_type = super::ContentType::from(content_type);
875
876 if !status.is_client_error() && !status.is_server_error() {
877 let content = resp.text().await?;
878 match content_type {
879 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
880 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetInstitutionalHolders200Response`"))),
881 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::GetInstitutionalHolders200Response`")))),
882 }
883 } else {
884 let content = resp.text().await?;
885 let entity: Option<GetInstitutionalHoldersError> = serde_json::from_str(&content).ok();
886 Err(Error::ResponseError(ResponseContent { status, content, entity }))
887 }
888}
889
890pub async fn get_source_sanctioned_entities(configuration: &configuration::Configuration, params: GetSourceSanctionedEntitiesParams) -> Result<models::GetSourceSanctionedEntities200Response, Error<GetSourceSanctionedEntitiesError>> {
892 let p_path_source = params.source;
894
895 let uri_str = format!("{}/sanctions/{source}", configuration.base_path, source=crate::apis::urlencode(p_path_source));
896 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
897
898 if let Some(ref user_agent) = configuration.user_agent {
899 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
900 }
901 if let Some(ref apikey) = configuration.api_key {
902 let key = apikey.key.clone();
903 let value = match apikey.prefix {
904 Some(ref prefix) => format!("{} {}", prefix, key),
905 None => key,
906 };
907 req_builder = req_builder.header("Authorization", value);
908 };
909
910 let req = req_builder.build()?;
911 let resp = configuration.client.execute(req).await?;
912
913 let status = resp.status();
914 let content_type = resp
915 .headers()
916 .get("content-type")
917 .and_then(|v| v.to_str().ok())
918 .unwrap_or("application/octet-stream");
919 let content_type = super::ContentType::from(content_type);
920
921 if !status.is_client_error() && !status.is_server_error() {
922 let content = resp.text().await?;
923 match content_type {
924 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
925 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSourceSanctionedEntities200Response`"))),
926 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::GetSourceSanctionedEntities200Response`")))),
927 }
928 } else {
929 let content = resp.text().await?;
930 let entity: Option<GetSourceSanctionedEntitiesError> = serde_json::from_str(&content).ok();
931 Err(Error::ResponseError(ResponseContent { status, content, entity }))
932 }
933}
934
935pub async fn get_tax_info(configuration: &configuration::Configuration, params: GetTaxInfoParams) -> Result<models::GetTaxInfo200Response, Error<GetTaxInfoError>> {
937 let p_query_symbol = params.symbol;
939 let p_query_isin = params.isin;
940 let p_query_figi = params.figi;
941 let p_query_cusip = params.cusip;
942 let p_query_exchange = params.exchange;
943 let p_query_mic_code = params.mic_code;
944
945 let uri_str = format!("{}/tax_info", configuration.base_path);
946 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
947
948 if let Some(ref param_value) = p_query_symbol {
949 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
950 }
951 if let Some(ref param_value) = p_query_isin {
952 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
953 }
954 if let Some(ref param_value) = p_query_figi {
955 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
956 }
957 if let Some(ref param_value) = p_query_cusip {
958 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
959 }
960 if let Some(ref param_value) = p_query_exchange {
961 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
962 }
963 if let Some(ref param_value) = p_query_mic_code {
964 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
965 }
966 if let Some(ref user_agent) = configuration.user_agent {
967 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
968 }
969 if let Some(ref apikey) = configuration.api_key {
970 let key = apikey.key.clone();
971 let value = match apikey.prefix {
972 Some(ref prefix) => format!("{} {}", prefix, key),
973 None => key,
974 };
975 req_builder = req_builder.header("Authorization", value);
976 };
977
978 let req = req_builder.build()?;
979 let resp = configuration.client.execute(req).await?;
980
981 let status = resp.status();
982 let content_type = resp
983 .headers()
984 .get("content-type")
985 .and_then(|v| v.to_str().ok())
986 .unwrap_or("application/octet-stream");
987 let content_type = super::ContentType::from(content_type);
988
989 if !status.is_client_error() && !status.is_server_error() {
990 let content = resp.text().await?;
991 match content_type {
992 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
993 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetTaxInfo200Response`"))),
994 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::GetTaxInfo200Response`")))),
995 }
996 } else {
997 let content = resp.text().await?;
998 let entity: Option<GetTaxInfoError> = serde_json::from_str(&content).ok();
999 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1000 }
1001}
1002