twelve_data_client/apis/
analysis_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
11use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16/// struct for passing parameters to the method [`get_analyst_ratings_light`]
17#[derive(Clone, Debug, Default, Serialize, Deserialize)]
18pub struct GetAnalystRatingsLightParams {
19    /// Filter by symbol
20    pub symbol: Option<String>,
21    /// Filter by financial instrument global identifier (FIGI)
22    pub figi: Option<String>,
23    /// Filter by international securities identification number (ISIN)
24    pub isin: Option<String>,
25    /// 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
26    pub cusip: Option<String>,
27    /// Filter by exchange name
28    pub exchange: Option<String>,
29    /// Filter by rating change action
30    pub rating_change: Option<String>,
31    /// Number of records in response
32    pub outputsize: Option<i64>,
33    /// Filter by country name or alpha code, e.g., `United States` or `US`
34    pub country: Option<String>,
35}
36
37impl GetAnalystRatingsLightParams {
38    /// Create a new builder for this parameter struct
39    pub fn builder() -> GetAnalystRatingsLightParamsBuilder {
40        GetAnalystRatingsLightParamsBuilder::default()
41    }
42}
43
44/// Builder for [`GetAnalystRatingsLightParams`]
45#[derive(Clone, Debug, Default)]
46pub struct GetAnalystRatingsLightParamsBuilder {
47    /// Filter by symbol
48    symbol: Option<String>,
49    /// Filter by financial instrument global identifier (FIGI)
50    figi: Option<String>,
51    /// Filter by international securities identification number (ISIN)
52    isin: Option<String>,
53    /// 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
54    cusip: Option<String>,
55    /// Filter by exchange name
56    exchange: Option<String>,
57    /// Filter by rating change action
58    rating_change: Option<String>,
59    /// Number of records in response
60    outputsize: Option<i64>,
61    /// Filter by country name or alpha code, e.g., `United States` or `US`
62    country: Option<String>,
63}
64
65impl GetAnalystRatingsLightParamsBuilder {
66    /// Filter by symbol
67    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
68        self.symbol = Some(symbol.into());
69        self
70    }
71    /// Filter by financial instrument global identifier (FIGI)
72    pub fn figi(mut self, figi: impl Into<String>) -> Self {
73        self.figi = Some(figi.into());
74        self
75    }
76    /// Filter by international securities identification number (ISIN)
77    pub fn isin(mut self, isin: impl Into<String>) -> Self {
78        self.isin = Some(isin.into());
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        self
85    }
86    /// Filter by exchange name
87    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
88        self.exchange = Some(exchange.into());
89        self
90    }
91    /// Filter by rating change action
92    pub fn rating_change(mut self, rating_change: impl Into<String>) -> Self {
93        self.rating_change = Some(rating_change.into());
94        self
95    }
96    /// Number of records in response
97    pub fn outputsize(mut self, outputsize: i64) -> Self {
98        self.outputsize = Some(outputsize);
99        self
100    }
101    /// Filter by country name or alpha code, e.g., `United States` or `US`
102    pub fn country(mut self, country: impl Into<String>) -> Self {
103        self.country = Some(country.into());
104        self
105    }
106
107    /// Build the parameter struct
108    pub fn build(self) -> GetAnalystRatingsLightParams {
109        GetAnalystRatingsLightParams {
110            symbol: self.symbol,
111            figi: self.figi,
112            isin: self.isin,
113            cusip: self.cusip,
114            exchange: self.exchange,
115            rating_change: self.rating_change,
116            outputsize: self.outputsize,
117            country: self.country,
118        }
119    }
120}
121
122/// struct for passing parameters to the method [`get_analyst_ratings_us_equities`]
123#[derive(Clone, Debug, Default, Serialize, Deserialize)]
124pub struct GetAnalystRatingsUsEquitiesParams {
125    /// Filter by symbol
126    pub symbol: Option<String>,
127    /// Filter by financial instrument global identifier (FIGI)
128    pub figi: Option<String>,
129    /// Filter by international securities identification number (ISIN)
130    pub isin: Option<String>,
131    /// 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
132    pub cusip: Option<String>,
133    /// Filter by exchange name
134    pub exchange: Option<String>,
135    /// Filter by rating change action
136    pub rating_change: Option<String>,
137    /// Number of records in response
138    pub outputsize: Option<i64>,
139}
140
141impl GetAnalystRatingsUsEquitiesParams {
142    /// Create a new builder for this parameter struct
143    pub fn builder() -> GetAnalystRatingsUsEquitiesParamsBuilder {
144        GetAnalystRatingsUsEquitiesParamsBuilder::default()
145    }
146}
147
148/// Builder for [`GetAnalystRatingsUsEquitiesParams`]
149#[derive(Clone, Debug, Default)]
150pub struct GetAnalystRatingsUsEquitiesParamsBuilder {
151    /// Filter by symbol
152    symbol: Option<String>,
153    /// Filter by financial instrument global identifier (FIGI)
154    figi: Option<String>,
155    /// Filter by international securities identification number (ISIN)
156    isin: Option<String>,
157    /// 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
158    cusip: Option<String>,
159    /// Filter by exchange name
160    exchange: Option<String>,
161    /// Filter by rating change action
162    rating_change: Option<String>,
163    /// Number of records in response
164    outputsize: Option<i64>,
165}
166
167impl GetAnalystRatingsUsEquitiesParamsBuilder {
168    /// Filter by symbol
169    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
170        self.symbol = Some(symbol.into());
171        self
172    }
173    /// Filter by financial instrument global identifier (FIGI)
174    pub fn figi(mut self, figi: impl Into<String>) -> Self {
175        self.figi = Some(figi.into());
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        self
182    }
183    /// 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
184    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
185        self.cusip = Some(cusip.into());
186        self
187    }
188    /// Filter by exchange name
189    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
190        self.exchange = Some(exchange.into());
191        self
192    }
193    /// Filter by rating change action
194    pub fn rating_change(mut self, rating_change: impl Into<String>) -> Self {
195        self.rating_change = Some(rating_change.into());
196        self
197    }
198    /// Number of records in response
199    pub fn outputsize(mut self, outputsize: i64) -> Self {
200        self.outputsize = Some(outputsize);
201        self
202    }
203
204    /// Build the parameter struct
205    pub fn build(self) -> GetAnalystRatingsUsEquitiesParams {
206        GetAnalystRatingsUsEquitiesParams {
207            symbol: self.symbol,
208            figi: self.figi,
209            isin: self.isin,
210            cusip: self.cusip,
211            exchange: self.exchange,
212            rating_change: self.rating_change,
213            outputsize: self.outputsize,
214        }
215    }
216}
217
218/// struct for passing parameters to the method [`get_earnings_estimate`]
219#[derive(Clone, Debug, Default, Serialize, Deserialize)]
220pub struct GetEarningsEstimateParams {
221    /// Filter by symbol
222    pub symbol: Option<String>,
223    /// The FIGI of an instrument for which data is requested
224    pub figi: Option<String>,
225    /// Filter by international securities identification number (ISIN)
226    pub isin: Option<String>,
227    /// 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
228    pub cusip: Option<String>,
229    /// The country where the instrument is traded, e.g., `United States` or `US`
230    pub country: Option<String>,
231    /// Exchange where instrument is traded
232    pub exchange: Option<String>,
233}
234
235impl GetEarningsEstimateParams {
236    /// Create a new builder for this parameter struct
237    pub fn builder() -> GetEarningsEstimateParamsBuilder {
238        GetEarningsEstimateParamsBuilder::default()
239    }
240}
241
242/// Builder for [`GetEarningsEstimateParams`]
243#[derive(Clone, Debug, Default)]
244pub struct GetEarningsEstimateParamsBuilder {
245    /// Filter by symbol
246    symbol: Option<String>,
247    /// The FIGI of an instrument for which data is requested
248    figi: Option<String>,
249    /// Filter by international securities identification number (ISIN)
250    isin: Option<String>,
251    /// 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
252    cusip: Option<String>,
253    /// The country where the instrument is traded, e.g., `United States` or `US`
254    country: Option<String>,
255    /// Exchange where instrument is traded
256    exchange: Option<String>,
257}
258
259impl GetEarningsEstimateParamsBuilder {
260    /// Filter by symbol
261    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
262        self.symbol = Some(symbol.into());
263        self
264    }
265    /// The FIGI of an instrument for which data is requested
266    pub fn figi(mut self, figi: impl Into<String>) -> Self {
267        self.figi = Some(figi.into());
268        self
269    }
270    /// Filter by international securities identification number (ISIN)
271    pub fn isin(mut self, isin: impl Into<String>) -> Self {
272        self.isin = Some(isin.into());
273        self
274    }
275    /// 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
276    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
277        self.cusip = Some(cusip.into());
278        self
279    }
280    /// The country where the instrument is traded, e.g., `United States` or `US`
281    pub fn country(mut self, country: impl Into<String>) -> Self {
282        self.country = Some(country.into());
283        self
284    }
285    /// Exchange where instrument is traded
286    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
287        self.exchange = Some(exchange.into());
288        self
289    }
290
291    /// Build the parameter struct
292    pub fn build(self) -> GetEarningsEstimateParams {
293        GetEarningsEstimateParams {
294            symbol: self.symbol,
295            figi: self.figi,
296            isin: self.isin,
297            cusip: self.cusip,
298            country: self.country,
299            exchange: self.exchange,
300        }
301    }
302}
303
304/// struct for passing parameters to the method [`get_edgar_filings_archive`]
305#[derive(Clone, Debug, Default, Serialize, Deserialize)]
306pub struct GetEdgarFilingsArchiveParams {
307    /// The ticker symbol of an instrument for which data is requested
308    pub symbol: Option<String>,
309    /// Filter by financial instrument global identifier (FIGI)
310    pub figi: Option<String>,
311    /// Filter by international securities identification number (ISIN)
312    pub isin: Option<String>,
313    /// 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
314    pub cusip: Option<String>,
315    /// Filter by exchange name
316    pub exchange: Option<String>,
317    /// Filter by market identifier code (MIC) under ISO 10383 standard
318    pub mic_code: Option<String>,
319    /// Filter by country name or alpha code, e.g., `United States` or `US`
320    pub country: Option<String>,
321    /// Filter by form types, example `8-K`, `EX-1.1`
322    pub form_type: Option<String>,
323    /// Filter by filled time from
324    pub filled_from: Option<String>,
325    /// Filter by filled time to
326    pub filled_to: Option<String>,
327    /// Page number
328    pub page: Option<i64>,
329    /// Number of records in response
330    pub page_size: Option<i64>,
331}
332
333impl GetEdgarFilingsArchiveParams {
334    /// Create a new builder for this parameter struct
335    pub fn builder() -> GetEdgarFilingsArchiveParamsBuilder {
336        GetEdgarFilingsArchiveParamsBuilder::default()
337    }
338}
339
340/// Builder for [`GetEdgarFilingsArchiveParams`]
341#[derive(Clone, Debug, Default)]
342pub struct GetEdgarFilingsArchiveParamsBuilder {
343    /// The ticker symbol of an instrument for which data is requested
344    symbol: Option<String>,
345    /// Filter by financial instrument global identifier (FIGI)
346    figi: Option<String>,
347    /// Filter by international securities identification number (ISIN)
348    isin: Option<String>,
349    /// 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
350    cusip: Option<String>,
351    /// Filter by exchange name
352    exchange: Option<String>,
353    /// Filter by market identifier code (MIC) under ISO 10383 standard
354    mic_code: Option<String>,
355    /// Filter by country name or alpha code, e.g., `United States` or `US`
356    country: Option<String>,
357    /// Filter by form types, example `8-K`, `EX-1.1`
358    form_type: Option<String>,
359    /// Filter by filled time from
360    filled_from: Option<String>,
361    /// Filter by filled time to
362    filled_to: Option<String>,
363    /// Page number
364    page: Option<i64>,
365    /// Number of records in response
366    page_size: Option<i64>,
367}
368
369impl GetEdgarFilingsArchiveParamsBuilder {
370    /// The ticker symbol of an instrument for which data is requested
371    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
372        self.symbol = Some(symbol.into());
373        self
374    }
375    /// Filter by financial instrument global identifier (FIGI)
376    pub fn figi(mut self, figi: impl Into<String>) -> Self {
377        self.figi = Some(figi.into());
378        self
379    }
380    /// Filter by international securities identification number (ISIN)
381    pub fn isin(mut self, isin: impl Into<String>) -> Self {
382        self.isin = Some(isin.into());
383        self
384    }
385    /// 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
386    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
387        self.cusip = Some(cusip.into());
388        self
389    }
390    /// Filter by exchange name
391    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
392        self.exchange = Some(exchange.into());
393        self
394    }
395    /// Filter by market identifier code (MIC) under ISO 10383 standard
396    pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
397        self.mic_code = Some(mic_code.into());
398        self
399    }
400    /// Filter by country name or alpha code, e.g., `United States` or `US`
401    pub fn country(mut self, country: impl Into<String>) -> Self {
402        self.country = Some(country.into());
403        self
404    }
405    /// Filter by form types, example `8-K`, `EX-1.1`
406    pub fn form_type(mut self, form_type: impl Into<String>) -> Self {
407        self.form_type = Some(form_type.into());
408        self
409    }
410    /// Filter by filled time from
411    pub fn filled_from(mut self, filled_from: impl Into<String>) -> Self {
412        self.filled_from = Some(filled_from.into());
413        self
414    }
415    /// Filter by filled time to
416    pub fn filled_to(mut self, filled_to: impl Into<String>) -> Self {
417        self.filled_to = Some(filled_to.into());
418        self
419    }
420    /// Page number
421    pub fn page(mut self, page: i64) -> Self {
422        self.page = Some(page);
423        self
424    }
425    /// Number of records in response
426    pub fn page_size(mut self, page_size: i64) -> Self {
427        self.page_size = Some(page_size);
428        self
429    }
430
431    /// Build the parameter struct
432    pub fn build(self) -> GetEdgarFilingsArchiveParams {
433        GetEdgarFilingsArchiveParams {
434            symbol: self.symbol,
435            figi: self.figi,
436            isin: self.isin,
437            cusip: self.cusip,
438            exchange: self.exchange,
439            mic_code: self.mic_code,
440            country: self.country,
441            form_type: self.form_type,
442            filled_from: self.filled_from,
443            filled_to: self.filled_to,
444            page: self.page,
445            page_size: self.page_size,
446        }
447    }
448}
449
450/// struct for passing parameters to the method [`get_eps_revisions`]
451#[derive(Clone, Debug, Default, Serialize, Deserialize)]
452pub struct GetEpsRevisionsParams {
453    /// Filter by symbol
454    pub symbol: Option<String>,
455    /// Filter by financial instrument global identifier (FIGI)
456    pub figi: Option<String>,
457    /// Filter by international securities identification number (ISIN)
458    pub isin: Option<String>,
459    /// 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
460    pub cusip: Option<String>,
461    /// Filter by country name or alpha code, e.g., `United States` or `US`
462    pub country: Option<String>,
463    /// Filter by exchange name
464    pub exchange: Option<String>,
465}
466
467impl GetEpsRevisionsParams {
468    /// Create a new builder for this parameter struct
469    pub fn builder() -> GetEpsRevisionsParamsBuilder {
470        GetEpsRevisionsParamsBuilder::default()
471    }
472}
473
474/// Builder for [`GetEpsRevisionsParams`]
475#[derive(Clone, Debug, Default)]
476pub struct GetEpsRevisionsParamsBuilder {
477    /// Filter by symbol
478    symbol: Option<String>,
479    /// Filter by financial instrument global identifier (FIGI)
480    figi: Option<String>,
481    /// Filter by international securities identification number (ISIN)
482    isin: Option<String>,
483    /// 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
484    cusip: Option<String>,
485    /// Filter by country name or alpha code, e.g., `United States` or `US`
486    country: Option<String>,
487    /// Filter by exchange name
488    exchange: Option<String>,
489}
490
491impl GetEpsRevisionsParamsBuilder {
492    /// Filter by symbol
493    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
494        self.symbol = Some(symbol.into());
495        self
496    }
497    /// Filter by financial instrument global identifier (FIGI)
498    pub fn figi(mut self, figi: impl Into<String>) -> Self {
499        self.figi = Some(figi.into());
500        self
501    }
502    /// Filter by international securities identification number (ISIN)
503    pub fn isin(mut self, isin: impl Into<String>) -> Self {
504        self.isin = Some(isin.into());
505        self
506    }
507    /// 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
508    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
509        self.cusip = Some(cusip.into());
510        self
511    }
512    /// Filter by country name or alpha code, e.g., `United States` or `US`
513    pub fn country(mut self, country: impl Into<String>) -> Self {
514        self.country = Some(country.into());
515        self
516    }
517    /// Filter by exchange name
518    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
519        self.exchange = Some(exchange.into());
520        self
521    }
522
523    /// Build the parameter struct
524    pub fn build(self) -> GetEpsRevisionsParams {
525        GetEpsRevisionsParams {
526            symbol: self.symbol,
527            figi: self.figi,
528            isin: self.isin,
529            cusip: self.cusip,
530            country: self.country,
531            exchange: self.exchange,
532        }
533    }
534}
535
536/// struct for passing parameters to the method [`get_eps_trend`]
537#[derive(Clone, Debug, Default, Serialize, Deserialize)]
538pub struct GetEpsTrendParams {
539    /// Filter by symbol
540    pub symbol: Option<String>,
541    /// Filter by financial instrument global identifier (FIGI)
542    pub figi: Option<String>,
543    /// Filter by international securities identification number (ISIN)
544    pub isin: Option<String>,
545    /// 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
546    pub cusip: Option<String>,
547    /// Filter by country name or alpha code, e.g., `United States` or `US`
548    pub country: Option<String>,
549    /// Filter by exchange name
550    pub exchange: Option<String>,
551}
552
553impl GetEpsTrendParams {
554    /// Create a new builder for this parameter struct
555    pub fn builder() -> GetEpsTrendParamsBuilder {
556        GetEpsTrendParamsBuilder::default()
557    }
558}
559
560/// Builder for [`GetEpsTrendParams`]
561#[derive(Clone, Debug, Default)]
562pub struct GetEpsTrendParamsBuilder {
563    /// Filter by symbol
564    symbol: Option<String>,
565    /// Filter by financial instrument global identifier (FIGI)
566    figi: Option<String>,
567    /// Filter by international securities identification number (ISIN)
568    isin: Option<String>,
569    /// 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
570    cusip: Option<String>,
571    /// Filter by country name or alpha code, e.g., `United States` or `US`
572    country: Option<String>,
573    /// Filter by exchange name
574    exchange: Option<String>,
575}
576
577impl GetEpsTrendParamsBuilder {
578    /// Filter by symbol
579    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
580        self.symbol = Some(symbol.into());
581        self
582    }
583    /// Filter by financial instrument global identifier (FIGI)
584    pub fn figi(mut self, figi: impl Into<String>) -> Self {
585        self.figi = Some(figi.into());
586        self
587    }
588    /// Filter by international securities identification number (ISIN)
589    pub fn isin(mut self, isin: impl Into<String>) -> Self {
590        self.isin = Some(isin.into());
591        self
592    }
593    /// 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
594    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
595        self.cusip = Some(cusip.into());
596        self
597    }
598    /// Filter by country name or alpha code, e.g., `United States` or `US`
599    pub fn country(mut self, country: impl Into<String>) -> Self {
600        self.country = Some(country.into());
601        self
602    }
603    /// Filter by exchange name
604    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
605        self.exchange = Some(exchange.into());
606        self
607    }
608
609    /// Build the parameter struct
610    pub fn build(self) -> GetEpsTrendParams {
611        GetEpsTrendParams {
612            symbol: self.symbol,
613            figi: self.figi,
614            isin: self.isin,
615            cusip: self.cusip,
616            country: self.country,
617            exchange: self.exchange,
618        }
619    }
620}
621
622/// struct for passing parameters to the method [`get_growth_estimates`]
623#[derive(Clone, Debug, Default, Serialize, Deserialize)]
624pub struct GetGrowthEstimatesParams {
625    /// Filter by symbol
626    pub symbol: Option<String>,
627    /// The FIGI of an instrument for which data is requested
628    pub figi: Option<String>,
629    /// Filter by international securities identification number (ISIN)
630    pub isin: Option<String>,
631    /// 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
632    pub cusip: Option<String>,
633    /// The country where the instrument is traded, e.g., `United States` or `US`
634    pub country: Option<String>,
635    /// Exchange where instrument is traded
636    pub exchange: Option<String>,
637}
638
639impl GetGrowthEstimatesParams {
640    /// Create a new builder for this parameter struct
641    pub fn builder() -> GetGrowthEstimatesParamsBuilder {
642        GetGrowthEstimatesParamsBuilder::default()
643    }
644}
645
646/// Builder for [`GetGrowthEstimatesParams`]
647#[derive(Clone, Debug, Default)]
648pub struct GetGrowthEstimatesParamsBuilder {
649    /// Filter by symbol
650    symbol: Option<String>,
651    /// The FIGI of an instrument for which data is requested
652    figi: Option<String>,
653    /// Filter by international securities identification number (ISIN)
654    isin: Option<String>,
655    /// 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
656    cusip: Option<String>,
657    /// The country where the instrument is traded, e.g., `United States` or `US`
658    country: Option<String>,
659    /// Exchange where instrument is traded
660    exchange: Option<String>,
661}
662
663impl GetGrowthEstimatesParamsBuilder {
664    /// Filter by symbol
665    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
666        self.symbol = Some(symbol.into());
667        self
668    }
669    /// The FIGI of an instrument for which data is requested
670    pub fn figi(mut self, figi: impl Into<String>) -> Self {
671        self.figi = Some(figi.into());
672        self
673    }
674    /// Filter by international securities identification number (ISIN)
675    pub fn isin(mut self, isin: impl Into<String>) -> Self {
676        self.isin = Some(isin.into());
677        self
678    }
679    /// 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
680    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
681        self.cusip = Some(cusip.into());
682        self
683    }
684    /// The country where the instrument is traded, e.g., `United States` or `US`
685    pub fn country(mut self, country: impl Into<String>) -> Self {
686        self.country = Some(country.into());
687        self
688    }
689    /// Exchange where instrument is traded
690    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
691        self.exchange = Some(exchange.into());
692        self
693    }
694
695    /// Build the parameter struct
696    pub fn build(self) -> GetGrowthEstimatesParams {
697        GetGrowthEstimatesParams {
698            symbol: self.symbol,
699            figi: self.figi,
700            isin: self.isin,
701            cusip: self.cusip,
702            country: self.country,
703            exchange: self.exchange,
704        }
705    }
706}
707
708/// struct for passing parameters to the method [`get_price_target`]
709#[derive(Clone, Debug, Default, Serialize, Deserialize)]
710pub struct GetPriceTargetParams {
711    /// Filter by symbol
712    pub symbol: Option<String>,
713    /// Filter by financial instrument global identifier (FIGI)
714    pub figi: Option<String>,
715    /// Filter by international securities identification number (ISIN)
716    pub isin: Option<String>,
717    /// 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
718    pub cusip: Option<String>,
719    /// Filter by country name or alpha code, e.g., `United States` or `US`
720    pub country: Option<String>,
721    /// Filter by exchange name
722    pub exchange: Option<String>,
723}
724
725impl GetPriceTargetParams {
726    /// Create a new builder for this parameter struct
727    pub fn builder() -> GetPriceTargetParamsBuilder {
728        GetPriceTargetParamsBuilder::default()
729    }
730}
731
732/// Builder for [`GetPriceTargetParams`]
733#[derive(Clone, Debug, Default)]
734pub struct GetPriceTargetParamsBuilder {
735    /// Filter by symbol
736    symbol: Option<String>,
737    /// Filter by financial instrument global identifier (FIGI)
738    figi: Option<String>,
739    /// Filter by international securities identification number (ISIN)
740    isin: Option<String>,
741    /// 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
742    cusip: Option<String>,
743    /// Filter by country name or alpha code, e.g., `United States` or `US`
744    country: Option<String>,
745    /// Filter by exchange name
746    exchange: Option<String>,
747}
748
749impl GetPriceTargetParamsBuilder {
750    /// Filter by symbol
751    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
752        self.symbol = Some(symbol.into());
753        self
754    }
755    /// Filter by financial instrument global identifier (FIGI)
756    pub fn figi(mut self, figi: impl Into<String>) -> Self {
757        self.figi = Some(figi.into());
758        self
759    }
760    /// Filter by international securities identification number (ISIN)
761    pub fn isin(mut self, isin: impl Into<String>) -> Self {
762        self.isin = Some(isin.into());
763        self
764    }
765    /// 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
766    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
767        self.cusip = Some(cusip.into());
768        self
769    }
770    /// Filter by country name or alpha code, e.g., `United States` or `US`
771    pub fn country(mut self, country: impl Into<String>) -> Self {
772        self.country = Some(country.into());
773        self
774    }
775    /// Filter by exchange name
776    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
777        self.exchange = Some(exchange.into());
778        self
779    }
780
781    /// Build the parameter struct
782    pub fn build(self) -> GetPriceTargetParams {
783        GetPriceTargetParams {
784            symbol: self.symbol,
785            figi: self.figi,
786            isin: self.isin,
787            cusip: self.cusip,
788            country: self.country,
789            exchange: self.exchange,
790        }
791    }
792}
793
794/// struct for passing parameters to the method [`get_recommendations`]
795#[derive(Clone, Debug, Default, Serialize, Deserialize)]
796pub struct GetRecommendationsParams {
797    /// Filter by symbol
798    pub symbol: Option<String>,
799    /// The FIGI of an instrument for which data is requested
800    pub figi: Option<String>,
801    /// Filter by international securities identification number (ISIN)
802    pub isin: Option<String>,
803    /// 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
804    pub cusip: Option<String>,
805    /// The country where the instrument is traded, e.g., `United States` or `US`
806    pub country: Option<String>,
807    /// The exchange name where the instrument is traded, e.g., `Nasdaq`, `NSE`.
808    pub exchange: Option<String>,
809}
810
811impl GetRecommendationsParams {
812    /// Create a new builder for this parameter struct
813    pub fn builder() -> GetRecommendationsParamsBuilder {
814        GetRecommendationsParamsBuilder::default()
815    }
816}
817
818/// Builder for [`GetRecommendationsParams`]
819#[derive(Clone, Debug, Default)]
820pub struct GetRecommendationsParamsBuilder {
821    /// Filter by symbol
822    symbol: Option<String>,
823    /// The FIGI of an instrument for which data is requested
824    figi: Option<String>,
825    /// Filter by international securities identification number (ISIN)
826    isin: Option<String>,
827    /// 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
828    cusip: Option<String>,
829    /// The country where the instrument is traded, e.g., `United States` or `US`
830    country: Option<String>,
831    /// The exchange name where the instrument is traded, e.g., `Nasdaq`, `NSE`.
832    exchange: Option<String>,
833}
834
835impl GetRecommendationsParamsBuilder {
836    /// Filter by symbol
837    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
838        self.symbol = Some(symbol.into());
839        self
840    }
841    /// The FIGI of an instrument for which data is requested
842    pub fn figi(mut self, figi: impl Into<String>) -> Self {
843        self.figi = Some(figi.into());
844        self
845    }
846    /// Filter by international securities identification number (ISIN)
847    pub fn isin(mut self, isin: impl Into<String>) -> Self {
848        self.isin = Some(isin.into());
849        self
850    }
851    /// 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
852    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
853        self.cusip = Some(cusip.into());
854        self
855    }
856    /// The country where the instrument is traded, e.g., `United States` or `US`
857    pub fn country(mut self, country: impl Into<String>) -> Self {
858        self.country = Some(country.into());
859        self
860    }
861    /// The exchange name where the instrument is traded, e.g., `Nasdaq`, `NSE`.
862    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
863        self.exchange = Some(exchange.into());
864        self
865    }
866
867    /// Build the parameter struct
868    pub fn build(self) -> GetRecommendationsParams {
869        GetRecommendationsParams {
870            symbol: self.symbol,
871            figi: self.figi,
872            isin: self.isin,
873            cusip: self.cusip,
874            country: self.country,
875            exchange: self.exchange,
876        }
877    }
878}
879
880/// struct for passing parameters to the method [`get_revenue_estimate`]
881#[derive(Clone, Debug, Default, Serialize, Deserialize)]
882pub struct GetRevenueEstimateParams {
883    /// Filter by symbol
884    pub symbol: Option<String>,
885    /// Filter by financial instrument global identifier (FIGI)
886    pub figi: Option<String>,
887    /// Filter by international securities identification number (ISIN)
888    pub isin: Option<String>,
889    /// 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
890    pub cusip: Option<String>,
891    /// Filter by country name or alpha code, e.g., `United States` or `US`
892    pub country: Option<String>,
893    /// Filter by exchange name
894    pub exchange: Option<String>,
895    /// Number of decimal places for floating values. Should be in range [0,11] inclusive
896    pub dp: Option<i64>,
897}
898
899impl GetRevenueEstimateParams {
900    /// Create a new builder for this parameter struct
901    pub fn builder() -> GetRevenueEstimateParamsBuilder {
902        GetRevenueEstimateParamsBuilder::default()
903    }
904}
905
906/// Builder for [`GetRevenueEstimateParams`]
907#[derive(Clone, Debug, Default)]
908pub struct GetRevenueEstimateParamsBuilder {
909    /// Filter by symbol
910    symbol: Option<String>,
911    /// Filter by financial instrument global identifier (FIGI)
912    figi: Option<String>,
913    /// Filter by international securities identification number (ISIN)
914    isin: Option<String>,
915    /// 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
916    cusip: Option<String>,
917    /// Filter by country name or alpha code, e.g., `United States` or `US`
918    country: Option<String>,
919    /// Filter by exchange name
920    exchange: Option<String>,
921    /// Number of decimal places for floating values. Should be in range [0,11] inclusive
922    dp: Option<i64>,
923}
924
925impl GetRevenueEstimateParamsBuilder {
926    /// Filter by symbol
927    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
928        self.symbol = Some(symbol.into());
929        self
930    }
931    /// Filter by financial instrument global identifier (FIGI)
932    pub fn figi(mut self, figi: impl Into<String>) -> Self {
933        self.figi = Some(figi.into());
934        self
935    }
936    /// Filter by international securities identification number (ISIN)
937    pub fn isin(mut self, isin: impl Into<String>) -> Self {
938        self.isin = Some(isin.into());
939        self
940    }
941    /// 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
942    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
943        self.cusip = Some(cusip.into());
944        self
945    }
946    /// Filter by country name or alpha code, e.g., `United States` or `US`
947    pub fn country(mut self, country: impl Into<String>) -> Self {
948        self.country = Some(country.into());
949        self
950    }
951    /// Filter by exchange name
952    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
953        self.exchange = Some(exchange.into());
954        self
955    }
956    /// Number of decimal places for floating values. Should be in range [0,11] inclusive
957    pub fn dp(mut self, dp: i64) -> Self {
958        self.dp = Some(dp);
959        self
960    }
961
962    /// Build the parameter struct
963    pub fn build(self) -> GetRevenueEstimateParams {
964        GetRevenueEstimateParams {
965            symbol: self.symbol,
966            figi: self.figi,
967            isin: self.isin,
968            cusip: self.cusip,
969            country: self.country,
970            exchange: self.exchange,
971            dp: self.dp,
972        }
973    }
974}
975
976/// struct for typed errors of method [`get_analyst_ratings_light`]
977#[derive(Debug, Clone, Serialize, Deserialize)]
978#[serde(untagged)]
979pub enum GetAnalystRatingsLightError {
980    UnknownValue(serde_json::Value),
981}
982
983/// struct for typed errors of method [`get_analyst_ratings_us_equities`]
984#[derive(Debug, Clone, Serialize, Deserialize)]
985#[serde(untagged)]
986pub enum GetAnalystRatingsUsEquitiesError {
987    UnknownValue(serde_json::Value),
988}
989
990/// struct for typed errors of method [`get_earnings_estimate`]
991#[derive(Debug, Clone, Serialize, Deserialize)]
992#[serde(untagged)]
993pub enum GetEarningsEstimateError {
994    UnknownValue(serde_json::Value),
995}
996
997/// struct for typed errors of method [`get_edgar_filings_archive`]
998#[derive(Debug, Clone, Serialize, Deserialize)]
999#[serde(untagged)]
1000pub enum GetEdgarFilingsArchiveError {
1001    UnknownValue(serde_json::Value),
1002}
1003
1004/// struct for typed errors of method [`get_eps_revisions`]
1005#[derive(Debug, Clone, Serialize, Deserialize)]
1006#[serde(untagged)]
1007pub enum GetEpsRevisionsError {
1008    UnknownValue(serde_json::Value),
1009}
1010
1011/// struct for typed errors of method [`get_eps_trend`]
1012#[derive(Debug, Clone, Serialize, Deserialize)]
1013#[serde(untagged)]
1014pub enum GetEpsTrendError {
1015    UnknownValue(serde_json::Value),
1016}
1017
1018/// struct for typed errors of method [`get_growth_estimates`]
1019#[derive(Debug, Clone, Serialize, Deserialize)]
1020#[serde(untagged)]
1021pub enum GetGrowthEstimatesError {
1022    UnknownValue(serde_json::Value),
1023}
1024
1025/// struct for typed errors of method [`get_price_target`]
1026#[derive(Debug, Clone, Serialize, Deserialize)]
1027#[serde(untagged)]
1028pub enum GetPriceTargetError {
1029    UnknownValue(serde_json::Value),
1030}
1031
1032/// struct for typed errors of method [`get_recommendations`]
1033#[derive(Debug, Clone, Serialize, Deserialize)]
1034#[serde(untagged)]
1035pub enum GetRecommendationsError {
1036    UnknownValue(serde_json::Value),
1037}
1038
1039/// struct for typed errors of method [`get_revenue_estimate`]
1040#[derive(Debug, Clone, Serialize, Deserialize)]
1041#[serde(untagged)]
1042pub enum GetRevenueEstimateError {
1043    UnknownValue(serde_json::Value),
1044}
1045
1046/// The analyst ratings snapshot endpoint provides a streamlined summary of ratings from analyst firms for both US and international markets. It delivers essential data on analyst recommendations, including buy, hold, and sell ratings, allowing users to quickly assess the general sentiment of analysts towards a particular stock.
1047pub async fn get_analyst_ratings_light(
1048    configuration: &configuration::Configuration,
1049    params: GetAnalystRatingsLightParams,
1050) -> Result<models::GetAnalystRatingsLight200ResponseEnum, Error<GetAnalystRatingsLightError>> {
1051    // Extract parameters from params struct
1052    let p_query_symbol = params.symbol;
1053    let p_query_figi = params.figi;
1054    let p_query_isin = params.isin;
1055    let p_query_cusip = params.cusip;
1056    let p_query_exchange = params.exchange;
1057    let p_query_rating_change = params.rating_change;
1058    let p_query_outputsize = params.outputsize;
1059    let p_query_country = params.country;
1060
1061    let uri_str = format!("{}/analyst_ratings/light", configuration.base_path);
1062    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1063
1064    if let Some(ref param_value) = p_query_symbol {
1065        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1066    }
1067    if let Some(ref param_value) = p_query_figi {
1068        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1069    }
1070    if let Some(ref param_value) = p_query_isin {
1071        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1072    }
1073    if let Some(ref param_value) = p_query_cusip {
1074        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1075    }
1076    if let Some(ref param_value) = p_query_exchange {
1077        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1078    }
1079    if let Some(ref param_value) = p_query_rating_change {
1080        req_builder = req_builder.query(&[("rating_change", &param_value.to_string())]);
1081    }
1082    if let Some(ref param_value) = p_query_outputsize {
1083        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
1084    }
1085    if let Some(ref param_value) = p_query_country {
1086        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1087    }
1088    if let Some(ref user_agent) = configuration.user_agent {
1089        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1090    }
1091    if let Some(ref apikey) = configuration.api_key {
1092        let key = apikey.key.clone();
1093        let value = match apikey.prefix {
1094            Some(ref prefix) => format!("{} {}", prefix, key),
1095            None => key,
1096        };
1097        req_builder = req_builder.header("Authorization", value);
1098    };
1099
1100    let req = req_builder.build()?;
1101    let resp = configuration.client.execute(req).await?;
1102
1103    let status = resp.status();
1104    let content_type = resp
1105        .headers()
1106        .get("content-type")
1107        .and_then(|v| v.to_str().ok())
1108        .unwrap_or("application/octet-stream");
1109    let content_type = super::ContentType::from(content_type);
1110
1111    if !status.is_client_error() && !status.is_server_error() {
1112        let content = resp.text().await?;
1113        match content_type {
1114            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1115            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetAnalystRatingsLight200ResponseEnum`"))),
1116            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::GetAnalystRatingsLight200ResponseEnum`")))),
1117        }
1118    } else {
1119        let content = resp.text().await?;
1120        let entity: Option<GetAnalystRatingsLightError> = serde_json::from_str(&content).ok();
1121        Err(Error::ResponseError(ResponseContent {
1122            status,
1123            content,
1124            entity,
1125        }))
1126    }
1127}
1128
1129/// The analyst ratings US equities endpoint provides detailed information on analyst ratings for U.S. stocks. It returns data on the latest ratings issued by various analyst firms, including the rating itself, the firm issuing the rating, and any changes in the rating. This endpoint is useful for users tracking analyst opinions on U.S. equities, allowing them to see how professional analysts view the potential performance of specific stocks.
1130pub async fn get_analyst_ratings_us_equities(
1131    configuration: &configuration::Configuration,
1132    params: GetAnalystRatingsUsEquitiesParams,
1133) -> Result<
1134    models::GetAnalystRatingsUsEquities200ResponseEnum,
1135    Error<GetAnalystRatingsUsEquitiesError>,
1136> {
1137    // Extract parameters from params struct
1138    let p_query_symbol = params.symbol;
1139    let p_query_figi = params.figi;
1140    let p_query_isin = params.isin;
1141    let p_query_cusip = params.cusip;
1142    let p_query_exchange = params.exchange;
1143    let p_query_rating_change = params.rating_change;
1144    let p_query_outputsize = params.outputsize;
1145
1146    let uri_str = format!("{}/analyst_ratings/us_equities", configuration.base_path);
1147    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1148
1149    if let Some(ref param_value) = p_query_symbol {
1150        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1151    }
1152    if let Some(ref param_value) = p_query_figi {
1153        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1154    }
1155    if let Some(ref param_value) = p_query_isin {
1156        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1157    }
1158    if let Some(ref param_value) = p_query_cusip {
1159        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1160    }
1161    if let Some(ref param_value) = p_query_exchange {
1162        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1163    }
1164    if let Some(ref param_value) = p_query_rating_change {
1165        req_builder = req_builder.query(&[("rating_change", &param_value.to_string())]);
1166    }
1167    if let Some(ref param_value) = p_query_outputsize {
1168        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
1169    }
1170    if let Some(ref user_agent) = configuration.user_agent {
1171        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1172    }
1173    if let Some(ref apikey) = configuration.api_key {
1174        let key = apikey.key.clone();
1175        let value = match apikey.prefix {
1176            Some(ref prefix) => format!("{} {}", prefix, key),
1177            None => key,
1178        };
1179        req_builder = req_builder.header("Authorization", value);
1180    };
1181
1182    let req = req_builder.build()?;
1183    let resp = configuration.client.execute(req).await?;
1184
1185    let status = resp.status();
1186    let content_type = resp
1187        .headers()
1188        .get("content-type")
1189        .and_then(|v| v.to_str().ok())
1190        .unwrap_or("application/octet-stream");
1191    let content_type = super::ContentType::from(content_type);
1192
1193    if !status.is_client_error() && !status.is_server_error() {
1194        let content = resp.text().await?;
1195        match content_type {
1196            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1197            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetAnalystRatingsUsEquities200ResponseEnum`"))),
1198            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::GetAnalystRatingsUsEquities200ResponseEnum`")))),
1199        }
1200    } else {
1201        let content = resp.text().await?;
1202        let entity: Option<GetAnalystRatingsUsEquitiesError> = serde_json::from_str(&content).ok();
1203        Err(Error::ResponseError(ResponseContent {
1204            status,
1205            content,
1206            entity,
1207        }))
1208    }
1209}
1210
1211/// The earnings estimate endpoint provides access to analysts' projected earnings per share (EPS) for a specific company, covering both upcoming quarterly and annual periods. This data is crucial for users who need to track and compare expected financial performance across different timeframes, aiding in the evaluation of a company's future profitability.
1212pub async fn get_earnings_estimate(
1213    configuration: &configuration::Configuration,
1214    params: GetEarningsEstimateParams,
1215) -> Result<models::GetEarningsEstimate200ResponseEnum, Error<GetEarningsEstimateError>> {
1216    // Extract parameters from params struct
1217    let p_query_symbol = params.symbol;
1218    let p_query_figi = params.figi;
1219    let p_query_isin = params.isin;
1220    let p_query_cusip = params.cusip;
1221    let p_query_country = params.country;
1222    let p_query_exchange = params.exchange;
1223
1224    let uri_str = format!("{}/earnings_estimate", configuration.base_path);
1225    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1226
1227    if let Some(ref param_value) = p_query_symbol {
1228        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1229    }
1230    if let Some(ref param_value) = p_query_figi {
1231        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1232    }
1233    if let Some(ref param_value) = p_query_isin {
1234        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1235    }
1236    if let Some(ref param_value) = p_query_cusip {
1237        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1238    }
1239    if let Some(ref param_value) = p_query_country {
1240        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1241    }
1242    if let Some(ref param_value) = p_query_exchange {
1243        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1244    }
1245    if let Some(ref user_agent) = configuration.user_agent {
1246        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1247    }
1248    if let Some(ref apikey) = configuration.api_key {
1249        let key = apikey.key.clone();
1250        let value = match apikey.prefix {
1251            Some(ref prefix) => format!("{} {}", prefix, key),
1252            None => key,
1253        };
1254        req_builder = req_builder.header("Authorization", value);
1255    };
1256
1257    let req = req_builder.build()?;
1258    let resp = configuration.client.execute(req).await?;
1259
1260    let status = resp.status();
1261    let content_type = resp
1262        .headers()
1263        .get("content-type")
1264        .and_then(|v| v.to_str().ok())
1265        .unwrap_or("application/octet-stream");
1266    let content_type = super::ContentType::from(content_type);
1267
1268    if !status.is_client_error() && !status.is_server_error() {
1269        let content = resp.text().await?;
1270        match content_type {
1271            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1272            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEarningsEstimate200ResponseEnum`"))),
1273            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::GetEarningsEstimate200ResponseEnum`")))),
1274        }
1275    } else {
1276        let content = resp.text().await?;
1277        let entity: Option<GetEarningsEstimateError> = serde_json::from_str(&content).ok();
1278        Err(Error::ResponseError(ResponseContent {
1279            status,
1280            content,
1281            entity,
1282        }))
1283    }
1284}
1285
1286/// The EDGAR fillings endpoint provides access to a comprehensive collection of financial documents submitted to the SEC, including real-time and historical forms, filings, and exhibits. Users can retrieve detailed information about company disclosures, financial statements, and regulatory submissions, enabling them to access essential compliance and financial data directly from the SEC's EDGAR system.
1287pub async fn get_edgar_filings_archive(
1288    configuration: &configuration::Configuration,
1289    params: GetEdgarFilingsArchiveParams,
1290) -> Result<models::GetEdgarFilingsArchive200ResponseEnum, Error<GetEdgarFilingsArchiveError>> {
1291    // Extract parameters from params struct
1292    let p_query_symbol = params.symbol;
1293    let p_query_figi = params.figi;
1294    let p_query_isin = params.isin;
1295    let p_query_cusip = params.cusip;
1296    let p_query_exchange = params.exchange;
1297    let p_query_mic_code = params.mic_code;
1298    let p_query_country = params.country;
1299    let p_query_form_type = params.form_type;
1300    let p_query_filled_from = params.filled_from;
1301    let p_query_filled_to = params.filled_to;
1302    let p_query_page = params.page;
1303    let p_query_page_size = params.page_size;
1304
1305    let uri_str = format!("{}/edgar_filings/archive", configuration.base_path);
1306    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1307
1308    if let Some(ref param_value) = p_query_symbol {
1309        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1310    }
1311    if let Some(ref param_value) = p_query_figi {
1312        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1313    }
1314    if let Some(ref param_value) = p_query_isin {
1315        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1316    }
1317    if let Some(ref param_value) = p_query_cusip {
1318        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1319    }
1320    if let Some(ref param_value) = p_query_exchange {
1321        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1322    }
1323    if let Some(ref param_value) = p_query_mic_code {
1324        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
1325    }
1326    if let Some(ref param_value) = p_query_country {
1327        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1328    }
1329    if let Some(ref param_value) = p_query_form_type {
1330        req_builder = req_builder.query(&[("form_type", &param_value.to_string())]);
1331    }
1332    if let Some(ref param_value) = p_query_filled_from {
1333        req_builder = req_builder.query(&[("filled_from", &param_value.to_string())]);
1334    }
1335    if let Some(ref param_value) = p_query_filled_to {
1336        req_builder = req_builder.query(&[("filled_to", &param_value.to_string())]);
1337    }
1338    if let Some(ref param_value) = p_query_page {
1339        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
1340    }
1341    if let Some(ref param_value) = p_query_page_size {
1342        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
1343    }
1344    if let Some(ref user_agent) = configuration.user_agent {
1345        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1346    }
1347    if let Some(ref apikey) = configuration.api_key {
1348        let key = apikey.key.clone();
1349        let value = match apikey.prefix {
1350            Some(ref prefix) => format!("{} {}", prefix, key),
1351            None => key,
1352        };
1353        req_builder = req_builder.header("Authorization", value);
1354    };
1355
1356    let req = req_builder.build()?;
1357    let resp = configuration.client.execute(req).await?;
1358
1359    let status = resp.status();
1360    let content_type = resp
1361        .headers()
1362        .get("content-type")
1363        .and_then(|v| v.to_str().ok())
1364        .unwrap_or("application/octet-stream");
1365    let content_type = super::ContentType::from(content_type);
1366
1367    if !status.is_client_error() && !status.is_server_error() {
1368        let content = resp.text().await?;
1369        match content_type {
1370            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1371            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEdgarFilingsArchive200ResponseEnum`"))),
1372            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::GetEdgarFilingsArchive200ResponseEnum`")))),
1373        }
1374    } else {
1375        let content = resp.text().await?;
1376        let entity: Option<GetEdgarFilingsArchiveError> = serde_json::from_str(&content).ok();
1377        Err(Error::ResponseError(ResponseContent {
1378            status,
1379            content,
1380            entity,
1381        }))
1382    }
1383}
1384
1385/// The EPS revisions endpoint provides updated analyst forecasts for a company's earnings per share (EPS) on both a quarterly and annual basis. It delivers data on how these EPS predictions have changed over the past week and month, allowing users to track recent adjustments in analyst expectations. This endpoint is useful for monitoring shifts in market sentiment regarding a company's financial performance.
1386pub async fn get_eps_revisions(
1387    configuration: &configuration::Configuration,
1388    params: GetEpsRevisionsParams,
1389) -> Result<models::GetEpsRevisions200ResponseEnum, Error<GetEpsRevisionsError>> {
1390    // Extract parameters from params struct
1391    let p_query_symbol = params.symbol;
1392    let p_query_figi = params.figi;
1393    let p_query_isin = params.isin;
1394    let p_query_cusip = params.cusip;
1395    let p_query_country = params.country;
1396    let p_query_exchange = params.exchange;
1397
1398    let uri_str = format!("{}/eps_revisions", configuration.base_path);
1399    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1400
1401    if let Some(ref param_value) = p_query_symbol {
1402        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1403    }
1404    if let Some(ref param_value) = p_query_figi {
1405        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1406    }
1407    if let Some(ref param_value) = p_query_isin {
1408        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1409    }
1410    if let Some(ref param_value) = p_query_cusip {
1411        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1412    }
1413    if let Some(ref param_value) = p_query_country {
1414        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1415    }
1416    if let Some(ref param_value) = p_query_exchange {
1417        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1418    }
1419    if let Some(ref user_agent) = configuration.user_agent {
1420        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1421    }
1422    if let Some(ref apikey) = configuration.api_key {
1423        let key = apikey.key.clone();
1424        let value = match apikey.prefix {
1425            Some(ref prefix) => format!("{} {}", prefix, key),
1426            None => key,
1427        };
1428        req_builder = req_builder.header("Authorization", value);
1429    };
1430
1431    let req = req_builder.build()?;
1432    let resp = configuration.client.execute(req).await?;
1433
1434    let status = resp.status();
1435    let content_type = resp
1436        .headers()
1437        .get("content-type")
1438        .and_then(|v| v.to_str().ok())
1439        .unwrap_or("application/octet-stream");
1440    let content_type = super::ContentType::from(content_type);
1441
1442    if !status.is_client_error() && !status.is_server_error() {
1443        let content = resp.text().await?;
1444        match content_type {
1445            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1446            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEpsRevisions200ResponseEnum`"))),
1447            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::GetEpsRevisions200ResponseEnum`")))),
1448        }
1449    } else {
1450        let content = resp.text().await?;
1451        let entity: Option<GetEpsRevisionsError> = serde_json::from_str(&content).ok();
1452        Err(Error::ResponseError(ResponseContent {
1453            status,
1454            content,
1455            entity,
1456        }))
1457    }
1458}
1459
1460/// The EPS trend endpoint provides detailed historical data on Earnings Per Share (EPS) trends over specified periods. It returns a comprehensive breakdown of estimated EPS changes, allowing users to track and analyze the progression of a company's earnings performance over time. This endpoint is ideal for users seeking to understand historical EPS fluctuations and assess financial growth patterns.
1461pub async fn get_eps_trend(
1462    configuration: &configuration::Configuration,
1463    params: GetEpsTrendParams,
1464) -> Result<models::GetEpsTrend200ResponseEnum, Error<GetEpsTrendError>> {
1465    // Extract parameters from params struct
1466    let p_query_symbol = params.symbol;
1467    let p_query_figi = params.figi;
1468    let p_query_isin = params.isin;
1469    let p_query_cusip = params.cusip;
1470    let p_query_country = params.country;
1471    let p_query_exchange = params.exchange;
1472
1473    let uri_str = format!("{}/eps_trend", configuration.base_path);
1474    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1475
1476    if let Some(ref param_value) = p_query_symbol {
1477        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1478    }
1479    if let Some(ref param_value) = p_query_figi {
1480        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1481    }
1482    if let Some(ref param_value) = p_query_isin {
1483        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1484    }
1485    if let Some(ref param_value) = p_query_cusip {
1486        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1487    }
1488    if let Some(ref param_value) = p_query_country {
1489        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1490    }
1491    if let Some(ref param_value) = p_query_exchange {
1492        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1493    }
1494    if let Some(ref user_agent) = configuration.user_agent {
1495        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1496    }
1497    if let Some(ref apikey) = configuration.api_key {
1498        let key = apikey.key.clone();
1499        let value = match apikey.prefix {
1500            Some(ref prefix) => format!("{} {}", prefix, key),
1501            None => key,
1502        };
1503        req_builder = req_builder.header("Authorization", value);
1504    };
1505
1506    let req = req_builder.build()?;
1507    let resp = configuration.client.execute(req).await?;
1508
1509    let status = resp.status();
1510    let content_type = resp
1511        .headers()
1512        .get("content-type")
1513        .and_then(|v| v.to_str().ok())
1514        .unwrap_or("application/octet-stream");
1515    let content_type = super::ContentType::from(content_type);
1516
1517    if !status.is_client_error() && !status.is_server_error() {
1518        let content = resp.text().await?;
1519        match content_type {
1520            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1521            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEpsTrend200ResponseEnum`"))),
1522            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::GetEpsTrend200ResponseEnum`")))),
1523        }
1524    } else {
1525        let content = resp.text().await?;
1526        let entity: Option<GetEpsTrendError> = serde_json::from_str(&content).ok();
1527        Err(Error::ResponseError(ResponseContent {
1528            status,
1529            content,
1530            entity,
1531        }))
1532    }
1533}
1534
1535/// The growth estimates endpoint provides consensus analyst projections on a company's growth rates over various timeframes. It aggregates and averages estimates from multiple analysts, focusing on key financial metrics such as earnings per share and revenue. This endpoint is useful for obtaining a comprehensive view of expected company performance based on expert analysis.
1536pub async fn get_growth_estimates(
1537    configuration: &configuration::Configuration,
1538    params: GetGrowthEstimatesParams,
1539) -> Result<models::GetGrowthEstimates200ResponseEnum, Error<GetGrowthEstimatesError>> {
1540    // Extract parameters from params struct
1541    let p_query_symbol = params.symbol;
1542    let p_query_figi = params.figi;
1543    let p_query_isin = params.isin;
1544    let p_query_cusip = params.cusip;
1545    let p_query_country = params.country;
1546    let p_query_exchange = params.exchange;
1547
1548    let uri_str = format!("{}/growth_estimates", configuration.base_path);
1549    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1550
1551    if let Some(ref param_value) = p_query_symbol {
1552        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1553    }
1554    if let Some(ref param_value) = p_query_figi {
1555        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1556    }
1557    if let Some(ref param_value) = p_query_isin {
1558        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1559    }
1560    if let Some(ref param_value) = p_query_cusip {
1561        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1562    }
1563    if let Some(ref param_value) = p_query_country {
1564        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1565    }
1566    if let Some(ref param_value) = p_query_exchange {
1567        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1568    }
1569    if let Some(ref user_agent) = configuration.user_agent {
1570        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1571    }
1572    if let Some(ref apikey) = configuration.api_key {
1573        let key = apikey.key.clone();
1574        let value = match apikey.prefix {
1575            Some(ref prefix) => format!("{} {}", prefix, key),
1576            None => key,
1577        };
1578        req_builder = req_builder.header("Authorization", value);
1579    };
1580
1581    let req = req_builder.build()?;
1582    let resp = configuration.client.execute(req).await?;
1583
1584    let status = resp.status();
1585    let content_type = resp
1586        .headers()
1587        .get("content-type")
1588        .and_then(|v| v.to_str().ok())
1589        .unwrap_or("application/octet-stream");
1590    let content_type = super::ContentType::from(content_type);
1591
1592    if !status.is_client_error() && !status.is_server_error() {
1593        let content = resp.text().await?;
1594        match content_type {
1595            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1596            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetGrowthEstimates200ResponseEnum`"))),
1597            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::GetGrowthEstimates200ResponseEnum`")))),
1598        }
1599    } else {
1600        let content = resp.text().await?;
1601        let entity: Option<GetGrowthEstimatesError> = serde_json::from_str(&content).ok();
1602        Err(Error::ResponseError(ResponseContent {
1603            status,
1604            content,
1605            entity,
1606        }))
1607    }
1608}
1609
1610/// The price target endpoint provides detailed projections of a security's future price as estimated by financial analysts. It returns data including the high, low, and average price targets. This endpoint is useful for users seeking to understand potential future valuations of specific securities based on expert analysis.
1611pub async fn get_price_target(
1612    configuration: &configuration::Configuration,
1613    params: GetPriceTargetParams,
1614) -> Result<models::GetPriceTarget200ResponseEnum, Error<GetPriceTargetError>> {
1615    // Extract parameters from params struct
1616    let p_query_symbol = params.symbol;
1617    let p_query_figi = params.figi;
1618    let p_query_isin = params.isin;
1619    let p_query_cusip = params.cusip;
1620    let p_query_country = params.country;
1621    let p_query_exchange = params.exchange;
1622
1623    let uri_str = format!("{}/price_target", configuration.base_path);
1624    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1625
1626    if let Some(ref param_value) = p_query_symbol {
1627        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1628    }
1629    if let Some(ref param_value) = p_query_figi {
1630        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1631    }
1632    if let Some(ref param_value) = p_query_isin {
1633        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1634    }
1635    if let Some(ref param_value) = p_query_cusip {
1636        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1637    }
1638    if let Some(ref param_value) = p_query_country {
1639        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1640    }
1641    if let Some(ref param_value) = p_query_exchange {
1642        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1643    }
1644    if let Some(ref user_agent) = configuration.user_agent {
1645        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1646    }
1647    if let Some(ref apikey) = configuration.api_key {
1648        let key = apikey.key.clone();
1649        let value = match apikey.prefix {
1650            Some(ref prefix) => format!("{} {}", prefix, key),
1651            None => key,
1652        };
1653        req_builder = req_builder.header("Authorization", value);
1654    };
1655
1656    let req = req_builder.build()?;
1657    let resp = configuration.client.execute(req).await?;
1658
1659    let status = resp.status();
1660    let content_type = resp
1661        .headers()
1662        .get("content-type")
1663        .and_then(|v| v.to_str().ok())
1664        .unwrap_or("application/octet-stream");
1665    let content_type = super::ContentType::from(content_type);
1666
1667    if !status.is_client_error() && !status.is_server_error() {
1668        let content = resp.text().await?;
1669        match content_type {
1670            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1671            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetPriceTarget200ResponseEnum`"))),
1672            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::GetPriceTarget200ResponseEnum`")))),
1673        }
1674    } else {
1675        let content = resp.text().await?;
1676        let entity: Option<GetPriceTargetError> = serde_json::from_str(&content).ok();
1677        Err(Error::ResponseError(ResponseContent {
1678            status,
1679            content,
1680            entity,
1681        }))
1682    }
1683}
1684
1685/// The recommendations endpoint provides a summary of analyst opinions for a specific stock, delivering an average recommendation categorized as Strong Buy, Buy, Hold, or Sell. It also includes a numerical recommendation score, offering a quick overview of market sentiment based on expert analysis.
1686pub async fn get_recommendations(
1687    configuration: &configuration::Configuration,
1688    params: GetRecommendationsParams,
1689) -> Result<models::GetRecommendations200ResponseEnum, Error<GetRecommendationsError>> {
1690    // Extract parameters from params struct
1691    let p_query_symbol = params.symbol;
1692    let p_query_figi = params.figi;
1693    let p_query_isin = params.isin;
1694    let p_query_cusip = params.cusip;
1695    let p_query_country = params.country;
1696    let p_query_exchange = params.exchange;
1697
1698    let uri_str = format!("{}/recommendations", configuration.base_path);
1699    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1700
1701    if let Some(ref param_value) = p_query_symbol {
1702        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1703    }
1704    if let Some(ref param_value) = p_query_figi {
1705        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1706    }
1707    if let Some(ref param_value) = p_query_isin {
1708        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1709    }
1710    if let Some(ref param_value) = p_query_cusip {
1711        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1712    }
1713    if let Some(ref param_value) = p_query_country {
1714        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1715    }
1716    if let Some(ref param_value) = p_query_exchange {
1717        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1718    }
1719    if let Some(ref user_agent) = configuration.user_agent {
1720        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1721    }
1722    if let Some(ref apikey) = configuration.api_key {
1723        let key = apikey.key.clone();
1724        let value = match apikey.prefix {
1725            Some(ref prefix) => format!("{} {}", prefix, key),
1726            None => key,
1727        };
1728        req_builder = req_builder.header("Authorization", value);
1729    };
1730
1731    let req = req_builder.build()?;
1732    let resp = configuration.client.execute(req).await?;
1733
1734    let status = resp.status();
1735    let content_type = resp
1736        .headers()
1737        .get("content-type")
1738        .and_then(|v| v.to_str().ok())
1739        .unwrap_or("application/octet-stream");
1740    let content_type = super::ContentType::from(content_type);
1741
1742    if !status.is_client_error() && !status.is_server_error() {
1743        let content = resp.text().await?;
1744        match content_type {
1745            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1746            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetRecommendations200ResponseEnum`"))),
1747            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::GetRecommendations200ResponseEnum`")))),
1748        }
1749    } else {
1750        let content = resp.text().await?;
1751        let entity: Option<GetRecommendationsError> = serde_json::from_str(&content).ok();
1752        Err(Error::ResponseError(ResponseContent {
1753            status,
1754            content,
1755            entity,
1756        }))
1757    }
1758}
1759
1760/// The revenue estimate endpoint provides a company's projected quarterly and annual revenue figures based on analysts' estimates. This data is useful for users seeking insights into expected company performance, allowing them to compare forecasted sales with historical data or other companies' estimates.
1761pub async fn get_revenue_estimate(
1762    configuration: &configuration::Configuration,
1763    params: GetRevenueEstimateParams,
1764) -> Result<models::GetRevenueEstimate200ResponseEnum, Error<GetRevenueEstimateError>> {
1765    // Extract parameters from params struct
1766    let p_query_symbol = params.symbol;
1767    let p_query_figi = params.figi;
1768    let p_query_isin = params.isin;
1769    let p_query_cusip = params.cusip;
1770    let p_query_country = params.country;
1771    let p_query_exchange = params.exchange;
1772    let p_query_dp = params.dp;
1773
1774    let uri_str = format!("{}/revenue_estimate", configuration.base_path);
1775    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1776
1777    if let Some(ref param_value) = p_query_symbol {
1778        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1779    }
1780    if let Some(ref param_value) = p_query_figi {
1781        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1782    }
1783    if let Some(ref param_value) = p_query_isin {
1784        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1785    }
1786    if let Some(ref param_value) = p_query_cusip {
1787        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1788    }
1789    if let Some(ref param_value) = p_query_country {
1790        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1791    }
1792    if let Some(ref param_value) = p_query_exchange {
1793        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1794    }
1795    if let Some(ref param_value) = p_query_dp {
1796        req_builder = req_builder.query(&[("dp", &param_value.to_string())]);
1797    }
1798    if let Some(ref user_agent) = configuration.user_agent {
1799        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1800    }
1801    if let Some(ref apikey) = configuration.api_key {
1802        let key = apikey.key.clone();
1803        let value = match apikey.prefix {
1804            Some(ref prefix) => format!("{} {}", prefix, key),
1805            None => key,
1806        };
1807        req_builder = req_builder.header("Authorization", value);
1808    };
1809
1810    let req = req_builder.build()?;
1811    let resp = configuration.client.execute(req).await?;
1812
1813    let status = resp.status();
1814    let content_type = resp
1815        .headers()
1816        .get("content-type")
1817        .and_then(|v| v.to_str().ok())
1818        .unwrap_or("application/octet-stream");
1819    let content_type = super::ContentType::from(content_type);
1820
1821    if !status.is_client_error() && !status.is_server_error() {
1822        let content = resp.text().await?;
1823        match content_type {
1824            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1825            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetRevenueEstimate200ResponseEnum`"))),
1826            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::GetRevenueEstimate200ResponseEnum`")))),
1827        }
1828    } else {
1829        let content = resp.text().await?;
1830        let entity: Option<GetRevenueEstimateError> = serde_json::from_str(&content).ok();
1831        Err(Error::ResponseError(ResponseContent {
1832            status,
1833            content,
1834            entity,
1835        }))
1836    }
1837}