twelve_data_client/apis/
regulatory_api.rs

1/*
2 * Twelve Data API
3 *
4 * ## Overview  Welcome to Twelve Data developer docs — your gateway to comprehensive financial market data through a powerful and easy-to-use API. Twelve Data provides access to financial markets across over 50 global countries, covering more than 1 million public instruments, including stocks, forex, ETFs, mutual funds, commodities, and cryptocurrencies.  ## Quickstart  To get started, you'll need to sign up for an API key. Once you have your API key, you can start making requests to the API.  ### Step 1: Create Twelve Data account  Sign up on the Twelve Data website to create your account [here](https://twelvedata.com/register). This gives you access to the API dashboard and your API key.  ### Step 2: Get your API key  After signing in, navigate to your [dashboard](https://twelvedata.com/account/api-keys) to find your unique API key. This key is required to authenticate all API and WebSocket requests.  ### Step 3: Make your first request  Try a simple API call with cURL to fetch the latest price for Apple (AAPL):  ``` curl \"https://api.twelvedata.com/price?symbol=AAPL&apikey=your_api_key\" ```  ### Step 4: Make a request from Python or Javascript  Use our client libraries or standard HTTP clients to make API calls programmatically. Here’s an example in [Python](https://github.com/twelvedata/twelvedata-python) and JavaScript:  #### Python (using official Twelve Data SDK):  ```python from twelvedata import TDClient  # Initialize client with your API key td = TDClient(apikey=\"your_api_key\")  # Get latest price for Apple price = td.price(symbol=\"AAPL\").as_json()  print(price) ```  #### JavaScript (Node.js):  ```javascript const fetch = require('node-fetch');  fetch('https://api.twelvedata.com/price?symbol=AAPL&apikey=your_api_key') &nbsp;&nbsp;.then(response => response.json()) &nbsp;&nbsp;.then(data => console.log(data)); ```  ### Step 5: Perform correlation analysis between Tesla and Microsoft prices  Fetch historical price data for Tesla (TSLA) and Microsoft (MSFT) and calculate the correlation of their closing prices:  ```python from twelvedata import TDClient import pandas as pd  # Initialize client with your API key td = TDClient(apikey=\"your_api_key\")  # Fetch historical price data for Tesla tsla_ts = td.time_series( &nbsp;&nbsp;&nbsp;&nbsp;symbol=\"TSLA\", &nbsp;&nbsp;&nbsp;&nbsp;interval=\"1day\", &nbsp;&nbsp;&nbsp;&nbsp;outputsize=100 ).as_pandas()  # Fetch historical price data for Microsoft msft_ts = td.time_series( &nbsp;&nbsp;&nbsp;&nbsp;symbol=\"MSFT\", &nbsp;&nbsp;&nbsp;&nbsp;interval=\"1day\", &nbsp;&nbsp;&nbsp;&nbsp;outputsize=100 ).as_pandas()  # Align data on datetime index combined = pd.concat( &nbsp;&nbsp;&nbsp;&nbsp;[tsla_ts['close'].astype(float), msft_ts['close'].astype(float)], &nbsp;&nbsp;&nbsp;&nbsp;axis=1, &nbsp;&nbsp;&nbsp;&nbsp;keys=[\"TSLA\", \"MSFT\"] ).dropna()  # Calculate correlation correlation = combined[\"TSLA\"].corr(combined[\"MSFT\"]) print(f\"Correlation of closing prices between TSLA and MSFT: {correlation:.2f}\") ```  ### Authentication  Authenticate your requests using one of these methods:  #### Query parameter method ``` GET https://api.twelvedata.com/endpoint?symbol=AAPL&apikey=your_api_key ```  #### HTTP header method (recommended) ``` Authorization: apikey your_api_key ```  ##### API key useful information <ul> <li> Demo API key (<code>apikey=demo</code>) available for demo requests</li> <li> Personal API key required for full access</li> <li> Premium endpoints and data require higher-tier plans (testable with <a href=\"https://twelvedata.com/exchanges\">trial symbols</a>)</li> </ul>  ### API endpoints   Service | Base URL | ---------|----------|  REST API | `https://api.twelvedata.com` |  WebSocket | `wss://ws.twelvedata.com` |  ### Parameter guidelines <ul> <li><b>Separator:</b> Use <code>&</code> to separate multiple parameters</li> <li><b>Case sensitivity:</b> Parameter names are case-insensitive</li>  <ul><li><code>symbol=AAPL</code> = <code>symbol=aapl</code></li></ul>  <li><b>Multiple values:</b> Separate with commas where supported</li> </ul>  ### Response handling  #### Default format All responses return JSON format by default unless otherwise specified.  #### Null values <b>Important:</b> Some response fields may contain `null` values when data is unavailable for specific metrics. This is expected behavior, not an error.  ##### Best Practices: <ul> <li>Always implement <code>null</code> value handling in your application</li> <li>Use defensive programming techniques for data processing</li> <li>Consider fallback values or error handling for critical metrics</li> </ul>  #### Error handling Structure your code to gracefully handle: <ul> <li>Network timeouts</li> <li>Rate limiting responses</li> <li>Invalid parameter errors</li> <li>Data unavailability periods</li> </ul>  ##### Best practices <ul> <li><b>Rate limits:</b> Adhere to your plan’s rate limits to avoid throttling. Check your dashboard for details.</li> <li><b>Error handling:</b> Implement retry logic for transient errors (e.g., <code>429 Too Many Requests</code>).</li> <li><b>Caching:</b> Cache responses for frequently accessed data to reduce API calls and improve performance.</li> <li><b>Secure storage:</b> Store your API key securely and never expose it in client-side code or public repositories.</li> </ul>  ## Errors  Twelve Data API employs a standardized error response format, delivering a JSON object with `code`, `message`, and `status` keys for clear and consistent error communication.  ### Codes  Below is a table of possible error codes, their HTTP status, meanings, and resolution steps:   Code | status | Meaning | Resolution |  --- | --- | --- | --- |  **400** | Bad Request | Invalid or incorrect parameter(s) provided. | Check the `message` in the response for details. Refer to the API Documenta­tion to correct the input. |  **401** | Unauthor­ized | Invalid or incorrect API key. | Verify your API key is correct. Sign up for a key <a href=\"https://twelvedata.com/account/api-keys\">here</a>. |  **403** | Forbidden | API key lacks permissions for the requested resource (upgrade required). | Upgrade your plan <a href=\"https://twelvedata.com/pricing\">here</a>. |  **404** | Not Found | Requested data could not be found. | Adjust parameters to be less strict as they may be too restrictive. |  **414** | Parameter Too Long | Input parameter array exceeds the allowed length. | Follow the `message` guidance to adjust the parameter length. |  **429** | Too Many Requests | API request limit reached for your key. | Wait briefly or upgrade your plan <a href=\"https://twelvedata.com/pricing\">here</a>. |  **500** | Internal Server Error | Server-side issue occurred; retry later. | Contact support <a href=\"https://twelvedata.com/contact\">here</a> for assistance. |  ### Example error response  Consider the following invalid request:  ``` https://api.twelvedata.com/time_series?symbol=AAPL&interval=0.99min&apikey=your_api_key ```  Due to the incorrect `interval` value, the API returns:  ```json { &nbsp;&nbsp;\"code\": 400, &nbsp;&nbsp;\"message\": \"Invalid **interval** provided: 0.99min. Supported intervals: 1min, 5min, 15min, 30min, 45min, 1h, 2h, 4h, 8h, 1day, 1week, 1month\", &nbsp;&nbsp;\"status\": \"error\" } ```  Refer to the API Documentation for valid parameter values to resolve such errors.  ## Libraries  Twelve Data provides a growing ecosystem of libraries and integrations to help you build faster and smarter in your preferred environment. Official libraries are actively maintained by the Twelve Data team, while selected community-built libraries offer additional flexibility.  A full list is available on our [GitHub profile](https://github.com/search?q=twelvedata).  ### Official SDKs <ul> <li><b>Python:</b> <a href=\"https://github.com/twelvedata/twelvedata-python\">twelvedata-python</a></li> <li><b>R:</b> <a href=\"https://github.com/twelvedata/twelvedata-r-sdk\">twelvedata-r-sdk</a></li> </ul>  ### AI integrations <ul> <li><b>Twelve Data MCP Server:</b> <a href=\"https://github.com/twelvedata/mcp\">Repository</a> — Model Context Protocol (MCP) server that provides seamless integration with AI assistants and language models, enabling direct access to Twelve Data's financial market data within conversational interfaces and AI workflows.</li> </ul>  ### Spreadsheet add-ons <ul> <li><b>Excel:</b> <a href=\"https://twelvedata.com/excel\">Excel Add-in</a></li> <li><b>Google Sheets:</b> <a href=\"https://twelvedata.com/google-sheets\">Google Sheets Add-on</a></li> </ul>  ### Community libraries  The community has developed libraries in several popular languages. You can explore more community libraries on [GitHub](https://github.com/search?q=twelvedata). <ul> <li><b>C#:</b> <a href=\"https://github.com/pseudomarkets/TwelveDataSharp\">TwelveDataSharp</a></li> <li><b>JavaScript:</b> <a href=\"https://github.com/evzaboun/twelvedata\">twelvedata</a></li> <li><b>PHP:</b> <a href=\"https://github.com/ingelby/twelvedata\">twelvedata</a></li> <li><b>Go:</b> <a href=\"https://github.com/soulgarden/twelvedata\">twelvedata</a></li> <li><b>TypeScript:</b> <a href=\"https://github.com/Clyde-Goodall/twelve-data-wrapper\">twelve-data-wrapper</a></li> </ul>  ### Other Twelve Data repositories <ul> <li><b>searchindex</b> <i>(Go)</i>: <a href=\"https://github.com/twelvedata/searchindex\">Repository</a> — In-memory search index by strings</li> <li><b>ws-tools</b> <i>(Python)</i>: <a href=\"https://github.com/twelvedata/ws-tools\">Repository</a> — Utility tools for WebSocket stream handling</li> </ul>  ### API specification <ul> <li><b>OpenAPI / Swagger:</b> Access the <a href=\"https://api.twelvedata.com/doc/swagger/openapi.json\">complete API specification</a> in OpenAPI format. You can use this file to automatically generate client libraries in your preferred programming language, explore the API interactively via Swagger tools, or integrate Twelve Data seamlessly into your AI and LLM workflows.</li> </ul>
5 *
6 * The version of the OpenAPI document: 0.0.1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17/// struct for passing parameters to the method [`get_direct_holders`]
18#[derive(Clone, Debug, Default)]
19pub struct GetDirectHoldersParams {
20    /// Symbol ticker of instrument. For preffered stocks use dot(.) delimiter. E.g. `BRK.A` or `BRK.B` will be correct
21    pub symbol: Option<String>,
22    /// Filter by financial instrument global identifier (FIGI)
23    pub figi: Option<String>,
24    /// Filter by international securities identification number (ISIN)
25    pub isin: Option<String>,
26    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
27    pub cusip: Option<String>,
28    /// Exchange where instrument is traded
29    pub exchange: Option<String>,
30    /// Market Identifier Code (MIC) under ISO 10383 standard
31    pub mic_code: Option<String>,
32    /// Country where instrument is traded, e.g., `United States` or `US`
33    pub country: Option<String>
34}
35
36impl GetDirectHoldersParams {
37    /// Create a new builder for this parameter struct
38    pub fn builder() -> GetDirectHoldersParamsBuilder {
39        GetDirectHoldersParamsBuilder::default()
40    }
41}
42
43/// Builder for [`GetDirectHoldersParams`]
44#[derive(Clone, Debug, Default)]
45pub struct GetDirectHoldersParamsBuilder {
46    /// Symbol ticker of instrument. For preffered stocks use dot(.) delimiter. E.g. `BRK.A` or `BRK.B` will be correct
47    symbol: Option<String>,
48    /// Filter by financial instrument global identifier (FIGI)
49    figi: Option<String>,
50    /// Filter by international securities identification number (ISIN)
51    isin: Option<String>,
52    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
53    cusip: Option<String>,
54    /// Exchange where instrument is traded
55    exchange: Option<String>,
56    /// Market Identifier Code (MIC) under ISO 10383 standard
57    mic_code: Option<String>,
58    /// Country where instrument is traded, e.g., `United States` or `US`
59    country: Option<String>
60}
61
62impl GetDirectHoldersParamsBuilder {
63    /// Symbol ticker of instrument. For preffered stocks use dot(.) delimiter. E.g. `BRK.A` or `BRK.B` will be correct
64    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
65        self.symbol = Some(symbol.into());
66        
67        self
68    }
69    /// Filter by financial instrument global identifier (FIGI)
70    pub fn figi(mut self, figi: impl Into<String>) -> Self {
71        self.figi = Some(figi.into());
72        
73        self
74    }
75    /// Filter by international securities identification number (ISIN)
76    pub fn isin(mut self, isin: impl Into<String>) -> Self {
77        self.isin = Some(isin.into());
78        
79        self
80    }
81    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
82    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
83        self.cusip = Some(cusip.into());
84        
85        self
86    }
87    /// Exchange where instrument is traded
88    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
89        self.exchange = Some(exchange.into());
90        
91        self
92    }
93    /// Market Identifier Code (MIC) under ISO 10383 standard
94    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    /// Country where instrument is traded, e.g., `United States` or `US`
100    pub fn country(mut self, country: impl Into<String>) -> Self {
101        self.country = Some(country.into());
102        
103        self
104    }
105
106    /// Build the parameter struct
107    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/// struct for passing parameters to the method [`get_fund_holders`]
121#[derive(Clone, Debug, Default)]
122pub struct GetFundHoldersParams {
123    /// Symbol ticker of instrument. For preffered stocks use dot(.) delimiter. E.g. `BRK.A` or `BRK.B` will be correct
124    pub symbol: Option<String>,
125    /// Filter by financial instrument global identifier (FIGI)
126    pub figi: Option<String>,
127    /// Filter by international securities identification number (ISIN)
128    pub isin: Option<String>,
129    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
130    pub cusip: Option<String>,
131    /// Exchange where instrument is traded
132    pub exchange: Option<String>,
133    /// Market Identifier Code (MIC) under ISO 10383 standard
134    pub mic_code: Option<String>,
135    /// Country where instrument is traded, e.g., `United States` or `US`
136    pub country: Option<String>
137}
138
139impl GetFundHoldersParams {
140    /// Create a new builder for this parameter struct
141    pub fn builder() -> GetFundHoldersParamsBuilder {
142        GetFundHoldersParamsBuilder::default()
143    }
144}
145
146/// Builder for [`GetFundHoldersParams`]
147#[derive(Clone, Debug, Default)]
148pub struct GetFundHoldersParamsBuilder {
149    /// Symbol ticker of instrument. For preffered stocks use dot(.) delimiter. E.g. `BRK.A` or `BRK.B` will be correct
150    symbol: Option<String>,
151    /// Filter by financial instrument global identifier (FIGI)
152    figi: Option<String>,
153    /// Filter by international securities identification number (ISIN)
154    isin: Option<String>,
155    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
156    cusip: Option<String>,
157    /// Exchange where instrument is traded
158    exchange: Option<String>,
159    /// Market Identifier Code (MIC) under ISO 10383 standard
160    mic_code: Option<String>,
161    /// Country where instrument is traded, e.g., `United States` or `US`
162    country: Option<String>
163}
164
165impl GetFundHoldersParamsBuilder {
166    /// Symbol ticker of instrument. For preffered stocks use dot(.) delimiter. E.g. `BRK.A` or `BRK.B` will be correct
167    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
168        self.symbol = Some(symbol.into());
169        
170        self
171    }
172    /// Filter by financial instrument global identifier (FIGI)
173    pub fn figi(mut self, figi: impl Into<String>) -> Self {
174        self.figi = Some(figi.into());
175        
176        self
177    }
178    /// Filter by international securities identification number (ISIN)
179    pub fn isin(mut self, isin: impl Into<String>) -> Self {
180        self.isin = Some(isin.into());
181        
182        self
183    }
184    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
185    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
186        self.cusip = Some(cusip.into());
187        
188        self
189    }
190    /// Exchange where instrument is traded
191    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
192        self.exchange = Some(exchange.into());
193        
194        self
195    }
196    /// Market Identifier Code (MIC) under ISO 10383 standard
197    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    /// Country where instrument is traded, e.g., `United States` or `US`
203    pub fn country(mut self, country: impl Into<String>) -> Self {
204        self.country = Some(country.into());
205        
206        self
207    }
208
209    /// Build the parameter struct
210    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/// struct for passing parameters to the method [`get_insider_transactions`]
224#[derive(Clone, Debug, Default)]
225pub struct GetInsiderTransactionsParams {
226    /// The ticker symbol of an instrument for which data is requested, e.g., `AAPL`, `TSLA`. For preffered stocks use dot(.) delimiter. E.g. `BRK.A` or `BRK.B` will be correct
227    pub symbol: Option<String>,
228    /// Filter by financial instrument global identifier (FIGI)
229    pub figi: Option<String>,
230    /// Filter by international securities identification number (ISIN)
231    pub isin: Option<String>,
232    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
233    pub cusip: Option<String>,
234    /// Exchange where instrument is traded, e.g., `Nasdaq`, `NSE`
235    pub exchange: Option<String>,
236    /// Market Identifier Code (MIC) under ISO 10383 standard
237    pub mic_code: Option<String>,
238    /// Country where instrument is traded, e.g., United States or US.
239    pub country: Option<String>
240}
241
242impl GetInsiderTransactionsParams {
243    /// Create a new builder for this parameter struct
244    pub fn builder() -> GetInsiderTransactionsParamsBuilder {
245        GetInsiderTransactionsParamsBuilder::default()
246    }
247}
248
249/// Builder for [`GetInsiderTransactionsParams`]
250#[derive(Clone, Debug, Default)]
251pub struct GetInsiderTransactionsParamsBuilder {
252    /// The ticker symbol of an instrument for which data is requested, e.g., `AAPL`, `TSLA`. For preffered stocks use dot(.) delimiter. E.g. `BRK.A` or `BRK.B` will be correct
253    symbol: Option<String>,
254    /// Filter by financial instrument global identifier (FIGI)
255    figi: Option<String>,
256    /// Filter by international securities identification number (ISIN)
257    isin: Option<String>,
258    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
259    cusip: Option<String>,
260    /// Exchange where instrument is traded, e.g., `Nasdaq`, `NSE`
261    exchange: Option<String>,
262    /// Market Identifier Code (MIC) under ISO 10383 standard
263    mic_code: Option<String>,
264    /// Country where instrument is traded, e.g., United States or US.
265    country: Option<String>
266}
267
268impl GetInsiderTransactionsParamsBuilder {
269    /// The ticker symbol of an instrument for which data is requested, e.g., `AAPL`, `TSLA`. For preffered stocks use dot(.) delimiter. E.g. `BRK.A` or `BRK.B` will be correct
270    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
271        self.symbol = Some(symbol.into());
272        
273        self
274    }
275    /// Filter by financial instrument global identifier (FIGI)
276    pub fn figi(mut self, figi: impl Into<String>) -> Self {
277        self.figi = Some(figi.into());
278        
279        self
280    }
281    /// Filter by international securities identification number (ISIN)
282    pub fn isin(mut self, isin: impl Into<String>) -> Self {
283        self.isin = Some(isin.into());
284        
285        self
286    }
287    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
288    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
289        self.cusip = Some(cusip.into());
290        
291        self
292    }
293    /// Exchange where instrument is traded, e.g., `Nasdaq`, `NSE`
294    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
295        self.exchange = Some(exchange.into());
296        
297        self
298    }
299    /// Market Identifier Code (MIC) under ISO 10383 standard
300    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    /// Country where instrument is traded, e.g., United States or US.
306    pub fn country(mut self, country: impl Into<String>) -> Self {
307        self.country = Some(country.into());
308        
309        self
310    }
311
312    /// Build the parameter struct
313    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/// struct for passing parameters to the method [`get_institutional_holders`]
327#[derive(Clone, Debug, Default)]
328pub struct GetInstitutionalHoldersParams {
329    /// Symbol ticker of instrument. For preffered stocks use dot(.) delimiter. E.g. `BRK.A` or `BRK.B` will be correct
330    pub symbol: Option<String>,
331    /// Filter by financial instrument global identifier (FIGI)
332    pub figi: Option<String>,
333    /// Filter by international securities identification number (ISIN)
334    pub isin: Option<String>,
335    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
336    pub cusip: Option<String>,
337    /// Exchange where instrument is traded
338    pub exchange: Option<String>,
339    /// Market Identifier Code (MIC) under ISO 10383 standard
340    pub mic_code: Option<String>,
341    /// Country where instrument is traded, e.g., `United States` or `US`
342    pub country: Option<String>
343}
344
345impl GetInstitutionalHoldersParams {
346    /// Create a new builder for this parameter struct
347    pub fn builder() -> GetInstitutionalHoldersParamsBuilder {
348        GetInstitutionalHoldersParamsBuilder::default()
349    }
350}
351
352/// Builder for [`GetInstitutionalHoldersParams`]
353#[derive(Clone, Debug, Default)]
354pub struct GetInstitutionalHoldersParamsBuilder {
355    /// Symbol ticker of instrument. For preffered stocks use dot(.) delimiter. E.g. `BRK.A` or `BRK.B` will be correct
356    symbol: Option<String>,
357    /// Filter by financial instrument global identifier (FIGI)
358    figi: Option<String>,
359    /// Filter by international securities identification number (ISIN)
360    isin: Option<String>,
361    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
362    cusip: Option<String>,
363    /// Exchange where instrument is traded
364    exchange: Option<String>,
365    /// Market Identifier Code (MIC) under ISO 10383 standard
366    mic_code: Option<String>,
367    /// Country where instrument is traded, e.g., `United States` or `US`
368    country: Option<String>
369}
370
371impl GetInstitutionalHoldersParamsBuilder {
372    /// Symbol ticker of instrument. For preffered stocks use dot(.) delimiter. E.g. `BRK.A` or `BRK.B` will be correct
373    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
374        self.symbol = Some(symbol.into());
375        
376        self
377    }
378    /// Filter by financial instrument global identifier (FIGI)
379    pub fn figi(mut self, figi: impl Into<String>) -> Self {
380        self.figi = Some(figi.into());
381        
382        self
383    }
384    /// Filter by international securities identification number (ISIN)
385    pub fn isin(mut self, isin: impl Into<String>) -> Self {
386        self.isin = Some(isin.into());
387        
388        self
389    }
390    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
391    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
392        self.cusip = Some(cusip.into());
393        
394        self
395    }
396    /// Exchange where instrument is traded
397    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
398        self.exchange = Some(exchange.into());
399        
400        self
401    }
402    /// Market Identifier Code (MIC) under ISO 10383 standard
403    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    /// Country where instrument is traded, e.g., `United States` or `US`
409    pub fn country(mut self, country: impl Into<String>) -> Self {
410        self.country = Some(country.into());
411        
412        self
413    }
414
415    /// Build the parameter struct
416    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/// struct for passing parameters to the method [`get_source_sanctioned_entities`]
430#[derive(Clone, Debug, Default)]
431pub struct GetSourceSanctionedEntitiesParams {
432    /// Sanctions source
433    pub source: String
434}
435
436impl GetSourceSanctionedEntitiesParams {
437    /// Create a new builder for this parameter struct
438    pub fn builder() -> GetSourceSanctionedEntitiesParamsBuilder {
439        GetSourceSanctionedEntitiesParamsBuilder::default()
440    }
441}
442
443/// Builder for [`GetSourceSanctionedEntitiesParams`]
444#[derive(Clone, Debug, Default)]
445pub struct GetSourceSanctionedEntitiesParamsBuilder {
446    /// Sanctions source
447    source: String
448}
449
450impl GetSourceSanctionedEntitiesParamsBuilder {
451    /// Sanctions source
452    pub fn source(mut self, source: impl Into<String>) -> Self {
453        self.source = source.into();
454        
455        self
456    }
457
458    /// Build the parameter struct
459    pub fn build(self) -> GetSourceSanctionedEntitiesParams {
460        GetSourceSanctionedEntitiesParams {
461            source: self.source
462        }
463    }
464}
465
466/// struct for passing parameters to the method [`get_tax_info`]
467#[derive(Clone, Debug, Default)]
468pub struct GetTaxInfoParams {
469    /// The ticker symbol of an instrument for which data is requested, e.g., `SKYQ`, `AIRE`, `ALM:BME`, `HSI:HKEX`.
470    pub symbol: Option<String>,
471    /// The ISIN of an instrument for which data is requested
472    pub isin: Option<String>,
473    /// The FIGI of an instrument for which data is requested
474    pub figi: Option<String>,
475    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
476    pub cusip: Option<String>,
477    /// The exchange name where the instrument is traded, e.g., `Nasdaq`, `Euronext`
478    pub exchange: Option<String>,
479    /// The Market Identifier Code (MIC) of the exchange where the instrument is traded, e.g., `XNAS`, `XLON`
480    pub mic_code: Option<String>
481}
482
483impl GetTaxInfoParams {
484    /// Create a new builder for this parameter struct
485    pub fn builder() -> GetTaxInfoParamsBuilder {
486        GetTaxInfoParamsBuilder::default()
487    }
488}
489
490/// Builder for [`GetTaxInfoParams`]
491#[derive(Clone, Debug, Default)]
492pub struct GetTaxInfoParamsBuilder {
493    /// The ticker symbol of an instrument for which data is requested, e.g., `SKYQ`, `AIRE`, `ALM:BME`, `HSI:HKEX`.
494    symbol: Option<String>,
495    /// The ISIN of an instrument for which data is requested
496    isin: Option<String>,
497    /// The FIGI of an instrument for which data is requested
498    figi: Option<String>,
499    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
500    cusip: Option<String>,
501    /// The exchange name where the instrument is traded, e.g., `Nasdaq`, `Euronext`
502    exchange: Option<String>,
503    /// The Market Identifier Code (MIC) of the exchange where the instrument is traded, e.g., `XNAS`, `XLON`
504    mic_code: Option<String>
505}
506
507impl GetTaxInfoParamsBuilder {
508    /// The ticker symbol of an instrument for which data is requested, e.g., `SKYQ`, `AIRE`, `ALM:BME`, `HSI:HKEX`.
509    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
510        self.symbol = Some(symbol.into());
511        
512        self
513    }
514    /// The ISIN of an instrument for which data is requested
515    pub fn isin(mut self, isin: impl Into<String>) -> Self {
516        self.isin = Some(isin.into());
517        
518        self
519    }
520    /// The FIGI of an instrument for which data is requested
521    pub fn figi(mut self, figi: impl Into<String>) -> Self {
522        self.figi = Some(figi.into());
523        
524        self
525    }
526    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
527    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
528        self.cusip = Some(cusip.into());
529        
530        self
531    }
532    /// The exchange name where the instrument is traded, e.g., `Nasdaq`, `Euronext`
533    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
534        self.exchange = Some(exchange.into());
535        
536        self
537    }
538    /// The Market Identifier Code (MIC) of the exchange where the instrument is traded, e.g., `XNAS`, `XLON`
539    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    /// Build the parameter struct
546    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/// struct for typed errors of method [`get_direct_holders`]
560#[derive(Debug, Clone, Serialize, Deserialize)]
561#[serde(untagged)]
562pub enum GetDirectHoldersError {
563    UnknownValue(serde_json::Value),
564}
565
566/// struct for typed errors of method [`get_fund_holders`]
567#[derive(Debug, Clone, Serialize, Deserialize)]
568#[serde(untagged)]
569pub enum GetFundHoldersError {
570    UnknownValue(serde_json::Value),
571}
572
573/// struct for typed errors of method [`get_insider_transactions`]
574#[derive(Debug, Clone, Serialize, Deserialize)]
575#[serde(untagged)]
576pub enum GetInsiderTransactionsError {
577    UnknownValue(serde_json::Value),
578}
579
580/// struct for typed errors of method [`get_institutional_holders`]
581#[derive(Debug, Clone, Serialize, Deserialize)]
582#[serde(untagged)]
583pub enum GetInstitutionalHoldersError {
584    UnknownValue(serde_json::Value),
585}
586
587/// struct for typed errors of method [`get_source_sanctioned_entities`]
588#[derive(Debug, Clone, Serialize, Deserialize)]
589#[serde(untagged)]
590pub enum GetSourceSanctionedEntitiesError {
591    UnknownValue(serde_json::Value),
592}
593
594/// struct for typed errors of method [`get_tax_info`]
595#[derive(Debug, Clone, Serialize, Deserialize)]
596#[serde(untagged)]
597pub enum GetTaxInfoError {
598    UnknownValue(serde_json::Value),
599}
600
601
602/// The direct holders endpoint provides detailed information about the number of shares directly held by individuals or entities as recorded in a company's official share registry. This data is essential for understanding the distribution of stock ownership within a company, helping users identify major shareholders and assess shareholder concentration.
603pub async fn get_direct_holders(configuration: &configuration::Configuration, params: GetDirectHoldersParams) -> Result<models::GetDirectHolders200Response, Error<GetDirectHoldersError>> {
604    // Extract parameters from params struct
605    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", &param_value.to_string())]);
618    }
619    if let Some(ref param_value) = p_query_figi {
620        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
621    }
622    if let Some(ref param_value) = p_query_isin {
623        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
624    }
625    if let Some(ref param_value) = p_query_cusip {
626        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
627    }
628    if let Some(ref param_value) = p_query_exchange {
629        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
630    }
631    if let Some(ref param_value) = p_query_mic_code {
632        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
633    }
634    if let Some(ref param_value) = p_query_country {
635        req_builder = req_builder.query(&[("country", &param_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
674/// The fund holders endpoint provides detailed information about the proportion of a company's stock that is owned by mutual fund holders. It returns data on the number of shares held, the percentage of total shares outstanding, and the names of the mutual funds involved. This endpoint is useful for users looking to understand mutual fund investment in a specific company.
675pub async fn get_fund_holders(configuration: &configuration::Configuration, params: GetFundHoldersParams) -> Result<models::GetFundHolders200Response, Error<GetFundHoldersError>> {
676    // Extract parameters from params struct
677    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", &param_value.to_string())]);
690    }
691    if let Some(ref param_value) = p_query_figi {
692        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
693    }
694    if let Some(ref param_value) = p_query_isin {
695        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
696    }
697    if let Some(ref param_value) = p_query_cusip {
698        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
699    }
700    if let Some(ref param_value) = p_query_exchange {
701        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
702    }
703    if let Some(ref param_value) = p_query_mic_code {
704        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
705    }
706    if let Some(ref param_value) = p_query_country {
707        req_builder = req_builder.query(&[("country", &param_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
746/// The insider transaction endpoint provides detailed data on trades executed by company insiders, such as executives and directors. It returns information including the insider's name, their role, the transaction type, the number of shares, the transaction date, and the price per share. This endpoint is useful for tracking insider activity and understanding potential insider sentiment towards a company's stock.
747pub async fn get_insider_transactions(configuration: &configuration::Configuration, params: GetInsiderTransactionsParams) -> Result<models::GetInsiderTransactions200Response, Error<GetInsiderTransactionsError>> {
748    // Extract parameters from params struct
749    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", &param_value.to_string())]);
762    }
763    if let Some(ref param_value) = p_query_figi {
764        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
765    }
766    if let Some(ref param_value) = p_query_isin {
767        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
768    }
769    if let Some(ref param_value) = p_query_cusip {
770        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
771    }
772    if let Some(ref param_value) = p_query_exchange {
773        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
774    }
775    if let Some(ref param_value) = p_query_mic_code {
776        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
777    }
778    if let Some(ref param_value) = p_query_country {
779        req_builder = req_builder.query(&[("country", &param_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
818/// The institutional holders endpoint provides detailed information on the percentage and amount of a company's stock owned by institutional investors, such as pension funds, insurance companies, and investment firms. This data is essential for understanding the influence and involvement of large entities in a company's ownership structure.
819pub async fn get_institutional_holders(configuration: &configuration::Configuration, params: GetInstitutionalHoldersParams) -> Result<models::GetInstitutionalHolders200Response, Error<GetInstitutionalHoldersError>> {
820    // Extract parameters from params struct
821    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", &param_value.to_string())]);
834    }
835    if let Some(ref param_value) = p_query_figi {
836        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
837    }
838    if let Some(ref param_value) = p_query_isin {
839        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
840    }
841    if let Some(ref param_value) = p_query_cusip {
842        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
843    }
844    if let Some(ref param_value) = p_query_exchange {
845        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
846    }
847    if let Some(ref param_value) = p_query_mic_code {
848        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
849    }
850    if let Some(ref param_value) = p_query_country {
851        req_builder = req_builder.query(&[("country", &param_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
890/// The sanctions entities endpoint provides a comprehensive list of entities sanctioned by a specified authority, such as OFAC, UK, EU, or AU. Users can retrieve detailed information about individuals, organizations, and other entities subject to sanctions from the chosen source, facilitating compliance and risk management processes.
891pub async fn get_source_sanctioned_entities(configuration: &configuration::Configuration, params: GetSourceSanctionedEntitiesParams) -> Result<models::GetSourceSanctionedEntities200Response, Error<GetSourceSanctionedEntitiesError>> {
892    // Extract parameters from params struct
893    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
935/// The tax information endpoint provides detailed tax-related data for a specified financial instrument, including applicable tax rates and relevant tax codes. This information is essential for users needing to understand the tax implications associated with trading or investing in specific instruments.
936pub async fn get_tax_info(configuration: &configuration::Configuration, params: GetTaxInfoParams) -> Result<models::GetTaxInfo200Response, Error<GetTaxInfoError>> {
937    // Extract parameters from params struct
938    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", &param_value.to_string())]);
950    }
951    if let Some(ref param_value) = p_query_isin {
952        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
953    }
954    if let Some(ref param_value) = p_query_figi {
955        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
956    }
957    if let Some(ref param_value) = p_query_cusip {
958        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
959    }
960    if let Some(ref param_value) = p_query_exchange {
961        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
962    }
963    if let Some(ref param_value) = p_query_mic_code {
964        req_builder = req_builder.query(&[("mic_code", &param_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