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 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 self
67 }
68 pub fn figi(mut self, figi: impl Into<String>) -> Self {
70 self.figi = Some(figi.into());
71 self
72 }
73 pub fn isin(mut self, isin: impl Into<String>) -> Self {
75 self.isin = Some(isin.into());
76 self
77 }
78 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
80 self.cusip = Some(cusip.into());
81 self
82 }
83 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
85 self.exchange = Some(exchange.into());
86 self
87 }
88 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
90 self.mic_code = Some(mic_code.into());
91 self
92 }
93 pub fn country(mut self, country: impl Into<String>) -> Self {
95 self.country = Some(country.into());
96 self
97 }
98
99 pub fn build(self) -> GetDirectHoldersParams {
101 GetDirectHoldersParams {
102 symbol: self.symbol,
103 figi: self.figi,
104 isin: self.isin,
105 cusip: self.cusip,
106 exchange: self.exchange,
107 mic_code: self.mic_code,
108 country: self.country
109 }
110 }
111}
112
113#[derive(Clone, Debug, Default, Serialize, Deserialize)]
115pub struct GetFundHoldersParams {
116 pub symbol: Option<String>,
118 pub figi: Option<String>,
120 pub isin: Option<String>,
122 pub cusip: Option<String>,
124 pub exchange: Option<String>,
126 pub mic_code: Option<String>,
128 pub country: Option<String>
130}
131
132impl GetFundHoldersParams {
133 pub fn builder() -> GetFundHoldersParamsBuilder {
135 GetFundHoldersParamsBuilder::default()
136 }
137}
138
139#[derive(Clone, Debug, Default)]
141pub struct GetFundHoldersParamsBuilder {
142 symbol: Option<String>,
144 figi: Option<String>,
146 isin: Option<String>,
148 cusip: Option<String>,
150 exchange: Option<String>,
152 mic_code: Option<String>,
154 country: Option<String>
156}
157
158impl GetFundHoldersParamsBuilder {
159 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
161 self.symbol = Some(symbol.into());
162 self
163 }
164 pub fn figi(mut self, figi: impl Into<String>) -> Self {
166 self.figi = Some(figi.into());
167 self
168 }
169 pub fn isin(mut self, isin: impl Into<String>) -> Self {
171 self.isin = Some(isin.into());
172 self
173 }
174 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
176 self.cusip = Some(cusip.into());
177 self
178 }
179 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
181 self.exchange = Some(exchange.into());
182 self
183 }
184 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
186 self.mic_code = Some(mic_code.into());
187 self
188 }
189 pub fn country(mut self, country: impl Into<String>) -> Self {
191 self.country = Some(country.into());
192 self
193 }
194
195 pub fn build(self) -> GetFundHoldersParams {
197 GetFundHoldersParams {
198 symbol: self.symbol,
199 figi: self.figi,
200 isin: self.isin,
201 cusip: self.cusip,
202 exchange: self.exchange,
203 mic_code: self.mic_code,
204 country: self.country
205 }
206 }
207}
208
209#[derive(Clone, Debug, Default, Serialize, Deserialize)]
211pub struct GetInsiderTransactionsParams {
212 pub symbol: Option<String>,
214 pub figi: Option<String>,
216 pub isin: Option<String>,
218 pub cusip: Option<String>,
220 pub exchange: Option<String>,
222 pub mic_code: Option<String>,
224 pub country: Option<String>
226}
227
228impl GetInsiderTransactionsParams {
229 pub fn builder() -> GetInsiderTransactionsParamsBuilder {
231 GetInsiderTransactionsParamsBuilder::default()
232 }
233}
234
235#[derive(Clone, Debug, Default)]
237pub struct GetInsiderTransactionsParamsBuilder {
238 symbol: Option<String>,
240 figi: Option<String>,
242 isin: Option<String>,
244 cusip: Option<String>,
246 exchange: Option<String>,
248 mic_code: Option<String>,
250 country: Option<String>
252}
253
254impl GetInsiderTransactionsParamsBuilder {
255 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
257 self.symbol = Some(symbol.into());
258 self
259 }
260 pub fn figi(mut self, figi: impl Into<String>) -> Self {
262 self.figi = Some(figi.into());
263 self
264 }
265 pub fn isin(mut self, isin: impl Into<String>) -> Self {
267 self.isin = Some(isin.into());
268 self
269 }
270 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
272 self.cusip = Some(cusip.into());
273 self
274 }
275 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
277 self.exchange = Some(exchange.into());
278 self
279 }
280 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
282 self.mic_code = Some(mic_code.into());
283 self
284 }
285 pub fn country(mut self, country: impl Into<String>) -> Self {
287 self.country = Some(country.into());
288 self
289 }
290
291 pub fn build(self) -> GetInsiderTransactionsParams {
293 GetInsiderTransactionsParams {
294 symbol: self.symbol,
295 figi: self.figi,
296 isin: self.isin,
297 cusip: self.cusip,
298 exchange: self.exchange,
299 mic_code: self.mic_code,
300 country: self.country
301 }
302 }
303}
304
305#[derive(Clone, Debug, Default, Serialize, Deserialize)]
307pub struct GetInstitutionalHoldersParams {
308 pub symbol: Option<String>,
310 pub figi: Option<String>,
312 pub isin: Option<String>,
314 pub cusip: Option<String>,
316 pub exchange: Option<String>,
318 pub mic_code: Option<String>,
320 pub country: Option<String>
322}
323
324impl GetInstitutionalHoldersParams {
325 pub fn builder() -> GetInstitutionalHoldersParamsBuilder {
327 GetInstitutionalHoldersParamsBuilder::default()
328 }
329}
330
331#[derive(Clone, Debug, Default)]
333pub struct GetInstitutionalHoldersParamsBuilder {
334 symbol: Option<String>,
336 figi: Option<String>,
338 isin: Option<String>,
340 cusip: Option<String>,
342 exchange: Option<String>,
344 mic_code: Option<String>,
346 country: Option<String>
348}
349
350impl GetInstitutionalHoldersParamsBuilder {
351 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
353 self.symbol = Some(symbol.into());
354 self
355 }
356 pub fn figi(mut self, figi: impl Into<String>) -> Self {
358 self.figi = Some(figi.into());
359 self
360 }
361 pub fn isin(mut self, isin: impl Into<String>) -> Self {
363 self.isin = Some(isin.into());
364 self
365 }
366 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
368 self.cusip = Some(cusip.into());
369 self
370 }
371 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
373 self.exchange = Some(exchange.into());
374 self
375 }
376 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
378 self.mic_code = Some(mic_code.into());
379 self
380 }
381 pub fn country(mut self, country: impl Into<String>) -> Self {
383 self.country = Some(country.into());
384 self
385 }
386
387 pub fn build(self) -> GetInstitutionalHoldersParams {
389 GetInstitutionalHoldersParams {
390 symbol: self.symbol,
391 figi: self.figi,
392 isin: self.isin,
393 cusip: self.cusip,
394 exchange: self.exchange,
395 mic_code: self.mic_code,
396 country: self.country
397 }
398 }
399}
400
401#[derive(Clone, Debug, Default, Serialize, Deserialize)]
403pub struct GetSourceSanctionedEntitiesParams {
404 pub source: String
406}
407
408impl GetSourceSanctionedEntitiesParams {
409 pub fn builder() -> GetSourceSanctionedEntitiesParamsBuilder {
411 GetSourceSanctionedEntitiesParamsBuilder::default()
412 }
413}
414
415#[derive(Clone, Debug, Default)]
417pub struct GetSourceSanctionedEntitiesParamsBuilder {
418 source: String
420}
421
422impl GetSourceSanctionedEntitiesParamsBuilder {
423 pub fn source(mut self, source: impl Into<String>) -> Self {
425 self.source = source.into();
426 self
427 }
428
429 pub fn build(self) -> GetSourceSanctionedEntitiesParams {
431 GetSourceSanctionedEntitiesParams {
432 source: self.source
433 }
434 }
435}
436
437#[derive(Clone, Debug, Default, Serialize, Deserialize)]
439pub struct GetTaxInfoParams {
440 pub symbol: Option<String>,
442 pub isin: Option<String>,
444 pub figi: Option<String>,
446 pub cusip: Option<String>,
448 pub exchange: Option<String>,
450 pub mic_code: Option<String>
452}
453
454impl GetTaxInfoParams {
455 pub fn builder() -> GetTaxInfoParamsBuilder {
457 GetTaxInfoParamsBuilder::default()
458 }
459}
460
461#[derive(Clone, Debug, Default)]
463pub struct GetTaxInfoParamsBuilder {
464 symbol: Option<String>,
466 isin: Option<String>,
468 figi: Option<String>,
470 cusip: Option<String>,
472 exchange: Option<String>,
474 mic_code: Option<String>
476}
477
478impl GetTaxInfoParamsBuilder {
479 pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
481 self.symbol = Some(symbol.into());
482 self
483 }
484 pub fn isin(mut self, isin: impl Into<String>) -> Self {
486 self.isin = Some(isin.into());
487 self
488 }
489 pub fn figi(mut self, figi: impl Into<String>) -> Self {
491 self.figi = Some(figi.into());
492 self
493 }
494 pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
496 self.cusip = Some(cusip.into());
497 self
498 }
499 pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
501 self.exchange = Some(exchange.into());
502 self
503 }
504 pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
506 self.mic_code = Some(mic_code.into());
507 self
508 }
509
510 pub fn build(self) -> GetTaxInfoParams {
512 GetTaxInfoParams {
513 symbol: self.symbol,
514 isin: self.isin,
515 figi: self.figi,
516 cusip: self.cusip,
517 exchange: self.exchange,
518 mic_code: self.mic_code
519 }
520 }
521}
522
523
524#[derive(Debug, Clone, Serialize, Deserialize)]
526#[serde(untagged)]
527pub enum GetDirectHoldersError {
528 UnknownValue(serde_json::Value),
529}
530
531#[derive(Debug, Clone, Serialize, Deserialize)]
533#[serde(untagged)]
534pub enum GetFundHoldersError {
535 UnknownValue(serde_json::Value),
536}
537
538#[derive(Debug, Clone, Serialize, Deserialize)]
540#[serde(untagged)]
541pub enum GetInsiderTransactionsError {
542 UnknownValue(serde_json::Value),
543}
544
545#[derive(Debug, Clone, Serialize, Deserialize)]
547#[serde(untagged)]
548pub enum GetInstitutionalHoldersError {
549 UnknownValue(serde_json::Value),
550}
551
552#[derive(Debug, Clone, Serialize, Deserialize)]
554#[serde(untagged)]
555pub enum GetSourceSanctionedEntitiesError {
556 UnknownValue(serde_json::Value),
557}
558
559#[derive(Debug, Clone, Serialize, Deserialize)]
561#[serde(untagged)]
562pub enum GetTaxInfoError {
563 UnknownValue(serde_json::Value),
564}
565
566
567pub async fn get_direct_holders(configuration: &configuration::Configuration, params: GetDirectHoldersParams) -> Result<models::GetDirectHolders200Response, 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/plain` content type response that cannot be converted to `models::GetDirectHolders200Response`"))),
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::GetDirectHolders200Response`")))),
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 { status, content, entity }))
636 }
637}
638
639pub async fn get_fund_holders(configuration: &configuration::Configuration, params: GetFundHoldersParams) -> Result<models::GetFundHolders200Response, Error<GetFundHoldersError>> {
641 let p_query_symbol = params.symbol;
643 let p_query_figi = params.figi;
644 let p_query_isin = params.isin;
645 let p_query_cusip = params.cusip;
646 let p_query_exchange = params.exchange;
647 let p_query_mic_code = params.mic_code;
648 let p_query_country = params.country;
649
650 let uri_str = format!("{}/fund_holders", configuration.base_path);
651 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
652
653 if let Some(ref param_value) = p_query_symbol {
654 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
655 }
656 if let Some(ref param_value) = p_query_figi {
657 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
658 }
659 if let Some(ref param_value) = p_query_isin {
660 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
661 }
662 if let Some(ref param_value) = p_query_cusip {
663 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
664 }
665 if let Some(ref param_value) = p_query_exchange {
666 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
667 }
668 if let Some(ref param_value) = p_query_mic_code {
669 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
670 }
671 if let Some(ref param_value) = p_query_country {
672 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
673 }
674 if let Some(ref user_agent) = configuration.user_agent {
675 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
676 }
677 if let Some(ref apikey) = configuration.api_key {
678 let key = apikey.key.clone();
679 let value = match apikey.prefix {
680 Some(ref prefix) => format!("{} {}", prefix, key),
681 None => key,
682 };
683 req_builder = req_builder.header("Authorization", value);
684 };
685
686 let req = req_builder.build()?;
687 let resp = configuration.client.execute(req).await?;
688
689 let status = resp.status();
690 let content_type = resp
691 .headers()
692 .get("content-type")
693 .and_then(|v| v.to_str().ok())
694 .unwrap_or("application/octet-stream");
695 let content_type = super::ContentType::from(content_type);
696
697 if !status.is_client_error() && !status.is_server_error() {
698 let content = resp.text().await?;
699 match content_type {
700 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
701 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetFundHolders200Response`"))),
702 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`")))),
703 }
704 } else {
705 let content = resp.text().await?;
706 let entity: Option<GetFundHoldersError> = serde_json::from_str(&content).ok();
707 Err(Error::ResponseError(ResponseContent { status, content, entity }))
708 }
709}
710
711pub async fn get_insider_transactions(configuration: &configuration::Configuration, params: GetInsiderTransactionsParams) -> Result<models::GetInsiderTransactions200Response, Error<GetInsiderTransactionsError>> {
713 let p_query_symbol = params.symbol;
715 let p_query_figi = params.figi;
716 let p_query_isin = params.isin;
717 let p_query_cusip = params.cusip;
718 let p_query_exchange = params.exchange;
719 let p_query_mic_code = params.mic_code;
720 let p_query_country = params.country;
721
722 let uri_str = format!("{}/insider_transactions", configuration.base_path);
723 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
724
725 if let Some(ref param_value) = p_query_symbol {
726 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
727 }
728 if let Some(ref param_value) = p_query_figi {
729 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
730 }
731 if let Some(ref param_value) = p_query_isin {
732 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
733 }
734 if let Some(ref param_value) = p_query_cusip {
735 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
736 }
737 if let Some(ref param_value) = p_query_exchange {
738 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
739 }
740 if let Some(ref param_value) = p_query_mic_code {
741 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
742 }
743 if let Some(ref param_value) = p_query_country {
744 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
745 }
746 if let Some(ref user_agent) = configuration.user_agent {
747 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
748 }
749 if let Some(ref apikey) = configuration.api_key {
750 let key = apikey.key.clone();
751 let value = match apikey.prefix {
752 Some(ref prefix) => format!("{} {}", prefix, key),
753 None => key,
754 };
755 req_builder = req_builder.header("Authorization", value);
756 };
757
758 let req = req_builder.build()?;
759 let resp = configuration.client.execute(req).await?;
760
761 let status = resp.status();
762 let content_type = resp
763 .headers()
764 .get("content-type")
765 .and_then(|v| v.to_str().ok())
766 .unwrap_or("application/octet-stream");
767 let content_type = super::ContentType::from(content_type);
768
769 if !status.is_client_error() && !status.is_server_error() {
770 let content = resp.text().await?;
771 match content_type {
772 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
773 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetInsiderTransactions200Response`"))),
774 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`")))),
775 }
776 } else {
777 let content = resp.text().await?;
778 let entity: Option<GetInsiderTransactionsError> = serde_json::from_str(&content).ok();
779 Err(Error::ResponseError(ResponseContent { status, content, entity }))
780 }
781}
782
783pub async fn get_institutional_holders(configuration: &configuration::Configuration, params: GetInstitutionalHoldersParams) -> Result<models::GetInstitutionalHolders200Response, Error<GetInstitutionalHoldersError>> {
785 let p_query_symbol = params.symbol;
787 let p_query_figi = params.figi;
788 let p_query_isin = params.isin;
789 let p_query_cusip = params.cusip;
790 let p_query_exchange = params.exchange;
791 let p_query_mic_code = params.mic_code;
792 let p_query_country = params.country;
793
794 let uri_str = format!("{}/institutional_holders", 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_exchange {
810 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
811 }
812 if let Some(ref param_value) = p_query_mic_code {
813 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
814 }
815 if let Some(ref param_value) = p_query_country {
816 req_builder = req_builder.query(&[("country", ¶m_value.to_string())]);
817 }
818 if let Some(ref user_agent) = configuration.user_agent {
819 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
820 }
821 if let Some(ref apikey) = configuration.api_key {
822 let key = apikey.key.clone();
823 let value = match apikey.prefix {
824 Some(ref prefix) => format!("{} {}", prefix, key),
825 None => key,
826 };
827 req_builder = req_builder.header("Authorization", value);
828 };
829
830 let req = req_builder.build()?;
831 let resp = configuration.client.execute(req).await?;
832
833 let status = resp.status();
834 let content_type = resp
835 .headers()
836 .get("content-type")
837 .and_then(|v| v.to_str().ok())
838 .unwrap_or("application/octet-stream");
839 let content_type = super::ContentType::from(content_type);
840
841 if !status.is_client_error() && !status.is_server_error() {
842 let content = resp.text().await?;
843 match content_type {
844 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
845 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetInstitutionalHolders200Response`"))),
846 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`")))),
847 }
848 } else {
849 let content = resp.text().await?;
850 let entity: Option<GetInstitutionalHoldersError> = serde_json::from_str(&content).ok();
851 Err(Error::ResponseError(ResponseContent { status, content, entity }))
852 }
853}
854
855pub async fn get_source_sanctioned_entities(configuration: &configuration::Configuration, params: GetSourceSanctionedEntitiesParams) -> Result<models::GetSourceSanctionedEntities200Response, Error<GetSourceSanctionedEntitiesError>> {
857 let p_path_source = params.source;
859
860 let uri_str = format!("{}/sanctions/{source}", configuration.base_path, source=crate::apis::urlencode(p_path_source));
861 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
862
863 if let Some(ref user_agent) = configuration.user_agent {
864 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
865 }
866 if let Some(ref apikey) = configuration.api_key {
867 let key = apikey.key.clone();
868 let value = match apikey.prefix {
869 Some(ref prefix) => format!("{} {}", prefix, key),
870 None => key,
871 };
872 req_builder = req_builder.header("Authorization", value);
873 };
874
875 let req = req_builder.build()?;
876 let resp = configuration.client.execute(req).await?;
877
878 let status = resp.status();
879 let content_type = resp
880 .headers()
881 .get("content-type")
882 .and_then(|v| v.to_str().ok())
883 .unwrap_or("application/octet-stream");
884 let content_type = super::ContentType::from(content_type);
885
886 if !status.is_client_error() && !status.is_server_error() {
887 let content = resp.text().await?;
888 match content_type {
889 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
890 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetSourceSanctionedEntities200Response`"))),
891 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`")))),
892 }
893 } else {
894 let content = resp.text().await?;
895 let entity: Option<GetSourceSanctionedEntitiesError> = serde_json::from_str(&content).ok();
896 Err(Error::ResponseError(ResponseContent { status, content, entity }))
897 }
898}
899
900pub async fn get_tax_info(configuration: &configuration::Configuration, params: GetTaxInfoParams) -> Result<models::GetTaxInfo200Response, Error<GetTaxInfoError>> {
902 let p_query_symbol = params.symbol;
904 let p_query_isin = params.isin;
905 let p_query_figi = params.figi;
906 let p_query_cusip = params.cusip;
907 let p_query_exchange = params.exchange;
908 let p_query_mic_code = params.mic_code;
909
910 let uri_str = format!("{}/tax_info", configuration.base_path);
911 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
912
913 if let Some(ref param_value) = p_query_symbol {
914 req_builder = req_builder.query(&[("symbol", ¶m_value.to_string())]);
915 }
916 if let Some(ref param_value) = p_query_isin {
917 req_builder = req_builder.query(&[("isin", ¶m_value.to_string())]);
918 }
919 if let Some(ref param_value) = p_query_figi {
920 req_builder = req_builder.query(&[("figi", ¶m_value.to_string())]);
921 }
922 if let Some(ref param_value) = p_query_cusip {
923 req_builder = req_builder.query(&[("cusip", ¶m_value.to_string())]);
924 }
925 if let Some(ref param_value) = p_query_exchange {
926 req_builder = req_builder.query(&[("exchange", ¶m_value.to_string())]);
927 }
928 if let Some(ref param_value) = p_query_mic_code {
929 req_builder = req_builder.query(&[("mic_code", ¶m_value.to_string())]);
930 }
931 if let Some(ref user_agent) = configuration.user_agent {
932 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
933 }
934 if let Some(ref apikey) = configuration.api_key {
935 let key = apikey.key.clone();
936 let value = match apikey.prefix {
937 Some(ref prefix) => format!("{} {}", prefix, key),
938 None => key,
939 };
940 req_builder = req_builder.header("Authorization", value);
941 };
942
943 let req = req_builder.build()?;
944 let resp = configuration.client.execute(req).await?;
945
946 let status = resp.status();
947 let content_type = resp
948 .headers()
949 .get("content-type")
950 .and_then(|v| v.to_str().ok())
951 .unwrap_or("application/octet-stream");
952 let content_type = super::ContentType::from(content_type);
953
954 if !status.is_client_error() && !status.is_server_error() {
955 let content = resp.text().await?;
956 match content_type {
957 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
958 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetTaxInfo200Response`"))),
959 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`")))),
960 }
961 } else {
962 let content = resp.text().await?;
963 let entity: Option<GetTaxInfoError> = serde_json::from_str(&content).ok();
964 Err(Error::ResponseError(ResponseContent { status, content, entity }))
965 }
966}
967