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::GetAnalystRatingsLightResponse, 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::GetAnalystRatingsLightResponse`"))),
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::GetAnalystRatingsLightResponse`")))),
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<models::GetAnalystRatingsUsEquitiesResponse, Error<GetAnalystRatingsUsEquitiesError>> {
1134    // Extract parameters from params struct
1135    let p_query_symbol = params.symbol;
1136    let p_query_figi = params.figi;
1137    let p_query_isin = params.isin;
1138    let p_query_cusip = params.cusip;
1139    let p_query_exchange = params.exchange;
1140    let p_query_rating_change = params.rating_change;
1141    let p_query_outputsize = params.outputsize;
1142
1143    let uri_str = format!("{}/analyst_ratings/us_equities", configuration.base_path);
1144    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1145
1146    if let Some(ref param_value) = p_query_symbol {
1147        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1148    }
1149    if let Some(ref param_value) = p_query_figi {
1150        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1151    }
1152    if let Some(ref param_value) = p_query_isin {
1153        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1154    }
1155    if let Some(ref param_value) = p_query_cusip {
1156        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1157    }
1158    if let Some(ref param_value) = p_query_exchange {
1159        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1160    }
1161    if let Some(ref param_value) = p_query_rating_change {
1162        req_builder = req_builder.query(&[("rating_change", &param_value.to_string())]);
1163    }
1164    if let Some(ref param_value) = p_query_outputsize {
1165        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
1166    }
1167    if let Some(ref user_agent) = configuration.user_agent {
1168        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1169    }
1170    if let Some(ref apikey) = configuration.api_key {
1171        let key = apikey.key.clone();
1172        let value = match apikey.prefix {
1173            Some(ref prefix) => format!("{} {}", prefix, key),
1174            None => key,
1175        };
1176        req_builder = req_builder.header("Authorization", value);
1177    };
1178
1179    let req = req_builder.build()?;
1180    let resp = configuration.client.execute(req).await?;
1181
1182    let status = resp.status();
1183    let content_type = resp
1184        .headers()
1185        .get("content-type")
1186        .and_then(|v| v.to_str().ok())
1187        .unwrap_or("application/octet-stream");
1188    let content_type = super::ContentType::from(content_type);
1189
1190    if !status.is_client_error() && !status.is_server_error() {
1191        let content = resp.text().await?;
1192        match content_type {
1193            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1194            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetAnalystRatingsUsEquitiesResponse`"))),
1195            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::GetAnalystRatingsUsEquitiesResponse`")))),
1196        }
1197    } else {
1198        let content = resp.text().await?;
1199        let entity: Option<GetAnalystRatingsUsEquitiesError> = serde_json::from_str(&content).ok();
1200        Err(Error::ResponseError(ResponseContent {
1201            status,
1202            content,
1203            entity,
1204        }))
1205    }
1206}
1207
1208/// 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.
1209pub async fn get_earnings_estimate(
1210    configuration: &configuration::Configuration,
1211    params: GetEarningsEstimateParams,
1212) -> Result<models::GetEarningsEstimateResponse, Error<GetEarningsEstimateError>> {
1213    // Extract parameters from params struct
1214    let p_query_symbol = params.symbol;
1215    let p_query_figi = params.figi;
1216    let p_query_isin = params.isin;
1217    let p_query_cusip = params.cusip;
1218    let p_query_country = params.country;
1219    let p_query_exchange = params.exchange;
1220
1221    let uri_str = format!("{}/earnings_estimate", configuration.base_path);
1222    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1223
1224    if let Some(ref param_value) = p_query_symbol {
1225        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1226    }
1227    if let Some(ref param_value) = p_query_figi {
1228        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1229    }
1230    if let Some(ref param_value) = p_query_isin {
1231        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1232    }
1233    if let Some(ref param_value) = p_query_cusip {
1234        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1235    }
1236    if let Some(ref param_value) = p_query_country {
1237        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1238    }
1239    if let Some(ref param_value) = p_query_exchange {
1240        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1241    }
1242    if let Some(ref user_agent) = configuration.user_agent {
1243        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1244    }
1245    if let Some(ref apikey) = configuration.api_key {
1246        let key = apikey.key.clone();
1247        let value = match apikey.prefix {
1248            Some(ref prefix) => format!("{} {}", prefix, key),
1249            None => key,
1250        };
1251        req_builder = req_builder.header("Authorization", value);
1252    };
1253
1254    let req = req_builder.build()?;
1255    let resp = configuration.client.execute(req).await?;
1256
1257    let status = resp.status();
1258    let content_type = resp
1259        .headers()
1260        .get("content-type")
1261        .and_then(|v| v.to_str().ok())
1262        .unwrap_or("application/octet-stream");
1263    let content_type = super::ContentType::from(content_type);
1264
1265    if !status.is_client_error() && !status.is_server_error() {
1266        let content = resp.text().await?;
1267        match content_type {
1268            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1269            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEarningsEstimateResponse`"))),
1270            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::GetEarningsEstimateResponse`")))),
1271        }
1272    } else {
1273        let content = resp.text().await?;
1274        let entity: Option<GetEarningsEstimateError> = serde_json::from_str(&content).ok();
1275        Err(Error::ResponseError(ResponseContent {
1276            status,
1277            content,
1278            entity,
1279        }))
1280    }
1281}
1282
1283/// 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.
1284pub async fn get_edgar_filings_archive(
1285    configuration: &configuration::Configuration,
1286    params: GetEdgarFilingsArchiveParams,
1287) -> Result<models::GetEdgarFilingsArchiveResponse, Error<GetEdgarFilingsArchiveError>> {
1288    // Extract parameters from params struct
1289    let p_query_symbol = params.symbol;
1290    let p_query_figi = params.figi;
1291    let p_query_isin = params.isin;
1292    let p_query_cusip = params.cusip;
1293    let p_query_exchange = params.exchange;
1294    let p_query_mic_code = params.mic_code;
1295    let p_query_country = params.country;
1296    let p_query_form_type = params.form_type;
1297    let p_query_filled_from = params.filled_from;
1298    let p_query_filled_to = params.filled_to;
1299    let p_query_page = params.page;
1300    let p_query_page_size = params.page_size;
1301
1302    let uri_str = format!("{}/edgar_filings/archive", configuration.base_path);
1303    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1304
1305    if let Some(ref param_value) = p_query_symbol {
1306        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1307    }
1308    if let Some(ref param_value) = p_query_figi {
1309        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1310    }
1311    if let Some(ref param_value) = p_query_isin {
1312        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1313    }
1314    if let Some(ref param_value) = p_query_cusip {
1315        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1316    }
1317    if let Some(ref param_value) = p_query_exchange {
1318        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1319    }
1320    if let Some(ref param_value) = p_query_mic_code {
1321        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
1322    }
1323    if let Some(ref param_value) = p_query_country {
1324        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1325    }
1326    if let Some(ref param_value) = p_query_form_type {
1327        req_builder = req_builder.query(&[("form_type", &param_value.to_string())]);
1328    }
1329    if let Some(ref param_value) = p_query_filled_from {
1330        req_builder = req_builder.query(&[("filled_from", &param_value.to_string())]);
1331    }
1332    if let Some(ref param_value) = p_query_filled_to {
1333        req_builder = req_builder.query(&[("filled_to", &param_value.to_string())]);
1334    }
1335    if let Some(ref param_value) = p_query_page {
1336        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
1337    }
1338    if let Some(ref param_value) = p_query_page_size {
1339        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
1340    }
1341    if let Some(ref user_agent) = configuration.user_agent {
1342        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1343    }
1344    if let Some(ref apikey) = configuration.api_key {
1345        let key = apikey.key.clone();
1346        let value = match apikey.prefix {
1347            Some(ref prefix) => format!("{} {}", prefix, key),
1348            None => key,
1349        };
1350        req_builder = req_builder.header("Authorization", value);
1351    };
1352
1353    let req = req_builder.build()?;
1354    let resp = configuration.client.execute(req).await?;
1355
1356    let status = resp.status();
1357    let content_type = resp
1358        .headers()
1359        .get("content-type")
1360        .and_then(|v| v.to_str().ok())
1361        .unwrap_or("application/octet-stream");
1362    let content_type = super::ContentType::from(content_type);
1363
1364    if !status.is_client_error() && !status.is_server_error() {
1365        let content = resp.text().await?;
1366        match content_type {
1367            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1368            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEdgarFilingsArchiveResponse`"))),
1369            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::GetEdgarFilingsArchiveResponse`")))),
1370        }
1371    } else {
1372        let content = resp.text().await?;
1373        let entity: Option<GetEdgarFilingsArchiveError> = serde_json::from_str(&content).ok();
1374        Err(Error::ResponseError(ResponseContent {
1375            status,
1376            content,
1377            entity,
1378        }))
1379    }
1380}
1381
1382/// 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.
1383pub async fn get_eps_revisions(
1384    configuration: &configuration::Configuration,
1385    params: GetEpsRevisionsParams,
1386) -> Result<models::GetEpsRevisionsResponse, Error<GetEpsRevisionsError>> {
1387    // Extract parameters from params struct
1388    let p_query_symbol = params.symbol;
1389    let p_query_figi = params.figi;
1390    let p_query_isin = params.isin;
1391    let p_query_cusip = params.cusip;
1392    let p_query_country = params.country;
1393    let p_query_exchange = params.exchange;
1394
1395    let uri_str = format!("{}/eps_revisions", configuration.base_path);
1396    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1397
1398    if let Some(ref param_value) = p_query_symbol {
1399        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1400    }
1401    if let Some(ref param_value) = p_query_figi {
1402        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1403    }
1404    if let Some(ref param_value) = p_query_isin {
1405        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1406    }
1407    if let Some(ref param_value) = p_query_cusip {
1408        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1409    }
1410    if let Some(ref param_value) = p_query_country {
1411        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1412    }
1413    if let Some(ref param_value) = p_query_exchange {
1414        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1415    }
1416    if let Some(ref user_agent) = configuration.user_agent {
1417        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1418    }
1419    if let Some(ref apikey) = configuration.api_key {
1420        let key = apikey.key.clone();
1421        let value = match apikey.prefix {
1422            Some(ref prefix) => format!("{} {}", prefix, key),
1423            None => key,
1424        };
1425        req_builder = req_builder.header("Authorization", value);
1426    };
1427
1428    let req = req_builder.build()?;
1429    let resp = configuration.client.execute(req).await?;
1430
1431    let status = resp.status();
1432    let content_type = resp
1433        .headers()
1434        .get("content-type")
1435        .and_then(|v| v.to_str().ok())
1436        .unwrap_or("application/octet-stream");
1437    let content_type = super::ContentType::from(content_type);
1438
1439    if !status.is_client_error() && !status.is_server_error() {
1440        let content = resp.text().await?;
1441        match content_type {
1442            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1443            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEpsRevisionsResponse`"))),
1444            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::GetEpsRevisionsResponse`")))),
1445        }
1446    } else {
1447        let content = resp.text().await?;
1448        let entity: Option<GetEpsRevisionsError> = serde_json::from_str(&content).ok();
1449        Err(Error::ResponseError(ResponseContent {
1450            status,
1451            content,
1452            entity,
1453        }))
1454    }
1455}
1456
1457/// 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.
1458pub async fn get_eps_trend(
1459    configuration: &configuration::Configuration,
1460    params: GetEpsTrendParams,
1461) -> Result<models::GetEpsTrendResponse, Error<GetEpsTrendError>> {
1462    // Extract parameters from params struct
1463    let p_query_symbol = params.symbol;
1464    let p_query_figi = params.figi;
1465    let p_query_isin = params.isin;
1466    let p_query_cusip = params.cusip;
1467    let p_query_country = params.country;
1468    let p_query_exchange = params.exchange;
1469
1470    let uri_str = format!("{}/eps_trend", configuration.base_path);
1471    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1472
1473    if let Some(ref param_value) = p_query_symbol {
1474        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1475    }
1476    if let Some(ref param_value) = p_query_figi {
1477        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1478    }
1479    if let Some(ref param_value) = p_query_isin {
1480        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1481    }
1482    if let Some(ref param_value) = p_query_cusip {
1483        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1484    }
1485    if let Some(ref param_value) = p_query_country {
1486        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1487    }
1488    if let Some(ref param_value) = p_query_exchange {
1489        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1490    }
1491    if let Some(ref user_agent) = configuration.user_agent {
1492        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1493    }
1494    if let Some(ref apikey) = configuration.api_key {
1495        let key = apikey.key.clone();
1496        let value = match apikey.prefix {
1497            Some(ref prefix) => format!("{} {}", prefix, key),
1498            None => key,
1499        };
1500        req_builder = req_builder.header("Authorization", value);
1501    };
1502
1503    let req = req_builder.build()?;
1504    let resp = configuration.client.execute(req).await?;
1505
1506    let status = resp.status();
1507    let content_type = resp
1508        .headers()
1509        .get("content-type")
1510        .and_then(|v| v.to_str().ok())
1511        .unwrap_or("application/octet-stream");
1512    let content_type = super::ContentType::from(content_type);
1513
1514    if !status.is_client_error() && !status.is_server_error() {
1515        let content = resp.text().await?;
1516        match content_type {
1517            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1518            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEpsTrendResponse`"))),
1519            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::GetEpsTrendResponse`")))),
1520        }
1521    } else {
1522        let content = resp.text().await?;
1523        let entity: Option<GetEpsTrendError> = serde_json::from_str(&content).ok();
1524        Err(Error::ResponseError(ResponseContent {
1525            status,
1526            content,
1527            entity,
1528        }))
1529    }
1530}
1531
1532/// 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.
1533pub async fn get_growth_estimates(
1534    configuration: &configuration::Configuration,
1535    params: GetGrowthEstimatesParams,
1536) -> Result<models::GetGrowthEstimatesResponse, Error<GetGrowthEstimatesError>> {
1537    // Extract parameters from params struct
1538    let p_query_symbol = params.symbol;
1539    let p_query_figi = params.figi;
1540    let p_query_isin = params.isin;
1541    let p_query_cusip = params.cusip;
1542    let p_query_country = params.country;
1543    let p_query_exchange = params.exchange;
1544
1545    let uri_str = format!("{}/growth_estimates", configuration.base_path);
1546    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1547
1548    if let Some(ref param_value) = p_query_symbol {
1549        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1550    }
1551    if let Some(ref param_value) = p_query_figi {
1552        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1553    }
1554    if let Some(ref param_value) = p_query_isin {
1555        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1556    }
1557    if let Some(ref param_value) = p_query_cusip {
1558        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1559    }
1560    if let Some(ref param_value) = p_query_country {
1561        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1562    }
1563    if let Some(ref param_value) = p_query_exchange {
1564        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1565    }
1566    if let Some(ref user_agent) = configuration.user_agent {
1567        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1568    }
1569    if let Some(ref apikey) = configuration.api_key {
1570        let key = apikey.key.clone();
1571        let value = match apikey.prefix {
1572            Some(ref prefix) => format!("{} {}", prefix, key),
1573            None => key,
1574        };
1575        req_builder = req_builder.header("Authorization", value);
1576    };
1577
1578    let req = req_builder.build()?;
1579    let resp = configuration.client.execute(req).await?;
1580
1581    let status = resp.status();
1582    let content_type = resp
1583        .headers()
1584        .get("content-type")
1585        .and_then(|v| v.to_str().ok())
1586        .unwrap_or("application/octet-stream");
1587    let content_type = super::ContentType::from(content_type);
1588
1589    if !status.is_client_error() && !status.is_server_error() {
1590        let content = resp.text().await?;
1591        match content_type {
1592            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1593            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetGrowthEstimatesResponse`"))),
1594            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::GetGrowthEstimatesResponse`")))),
1595        }
1596    } else {
1597        let content = resp.text().await?;
1598        let entity: Option<GetGrowthEstimatesError> = serde_json::from_str(&content).ok();
1599        Err(Error::ResponseError(ResponseContent {
1600            status,
1601            content,
1602            entity,
1603        }))
1604    }
1605}
1606
1607/// 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.
1608pub async fn get_price_target(
1609    configuration: &configuration::Configuration,
1610    params: GetPriceTargetParams,
1611) -> Result<models::GetPriceTargetResponse, Error<GetPriceTargetError>> {
1612    // Extract parameters from params struct
1613    let p_query_symbol = params.symbol;
1614    let p_query_figi = params.figi;
1615    let p_query_isin = params.isin;
1616    let p_query_cusip = params.cusip;
1617    let p_query_country = params.country;
1618    let p_query_exchange = params.exchange;
1619
1620    let uri_str = format!("{}/price_target", configuration.base_path);
1621    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1622
1623    if let Some(ref param_value) = p_query_symbol {
1624        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1625    }
1626    if let Some(ref param_value) = p_query_figi {
1627        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1628    }
1629    if let Some(ref param_value) = p_query_isin {
1630        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1631    }
1632    if let Some(ref param_value) = p_query_cusip {
1633        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1634    }
1635    if let Some(ref param_value) = p_query_country {
1636        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1637    }
1638    if let Some(ref param_value) = p_query_exchange {
1639        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1640    }
1641    if let Some(ref user_agent) = configuration.user_agent {
1642        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1643    }
1644    if let Some(ref apikey) = configuration.api_key {
1645        let key = apikey.key.clone();
1646        let value = match apikey.prefix {
1647            Some(ref prefix) => format!("{} {}", prefix, key),
1648            None => key,
1649        };
1650        req_builder = req_builder.header("Authorization", value);
1651    };
1652
1653    let req = req_builder.build()?;
1654    let resp = configuration.client.execute(req).await?;
1655
1656    let status = resp.status();
1657    let content_type = resp
1658        .headers()
1659        .get("content-type")
1660        .and_then(|v| v.to_str().ok())
1661        .unwrap_or("application/octet-stream");
1662    let content_type = super::ContentType::from(content_type);
1663
1664    if !status.is_client_error() && !status.is_server_error() {
1665        let content = resp.text().await?;
1666        match content_type {
1667            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1668            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetPriceTargetResponse`"))),
1669            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::GetPriceTargetResponse`")))),
1670        }
1671    } else {
1672        let content = resp.text().await?;
1673        let entity: Option<GetPriceTargetError> = serde_json::from_str(&content).ok();
1674        Err(Error::ResponseError(ResponseContent {
1675            status,
1676            content,
1677            entity,
1678        }))
1679    }
1680}
1681
1682/// 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.
1683pub async fn get_recommendations(
1684    configuration: &configuration::Configuration,
1685    params: GetRecommendationsParams,
1686) -> Result<models::GetRecommendationsResponse, Error<GetRecommendationsError>> {
1687    // Extract parameters from params struct
1688    let p_query_symbol = params.symbol;
1689    let p_query_figi = params.figi;
1690    let p_query_isin = params.isin;
1691    let p_query_cusip = params.cusip;
1692    let p_query_country = params.country;
1693    let p_query_exchange = params.exchange;
1694
1695    let uri_str = format!("{}/recommendations", configuration.base_path);
1696    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1697
1698    if let Some(ref param_value) = p_query_symbol {
1699        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1700    }
1701    if let Some(ref param_value) = p_query_figi {
1702        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1703    }
1704    if let Some(ref param_value) = p_query_isin {
1705        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1706    }
1707    if let Some(ref param_value) = p_query_cusip {
1708        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1709    }
1710    if let Some(ref param_value) = p_query_country {
1711        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1712    }
1713    if let Some(ref param_value) = p_query_exchange {
1714        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1715    }
1716    if let Some(ref user_agent) = configuration.user_agent {
1717        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1718    }
1719    if let Some(ref apikey) = configuration.api_key {
1720        let key = apikey.key.clone();
1721        let value = match apikey.prefix {
1722            Some(ref prefix) => format!("{} {}", prefix, key),
1723            None => key,
1724        };
1725        req_builder = req_builder.header("Authorization", value);
1726    };
1727
1728    let req = req_builder.build()?;
1729    let resp = configuration.client.execute(req).await?;
1730
1731    let status = resp.status();
1732    let content_type = resp
1733        .headers()
1734        .get("content-type")
1735        .and_then(|v| v.to_str().ok())
1736        .unwrap_or("application/octet-stream");
1737    let content_type = super::ContentType::from(content_type);
1738
1739    if !status.is_client_error() && !status.is_server_error() {
1740        let content = resp.text().await?;
1741        match content_type {
1742            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1743            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetRecommendationsResponse`"))),
1744            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::GetRecommendationsResponse`")))),
1745        }
1746    } else {
1747        let content = resp.text().await?;
1748        let entity: Option<GetRecommendationsError> = serde_json::from_str(&content).ok();
1749        Err(Error::ResponseError(ResponseContent {
1750            status,
1751            content,
1752            entity,
1753        }))
1754    }
1755}
1756
1757/// 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.
1758pub async fn get_revenue_estimate(
1759    configuration: &configuration::Configuration,
1760    params: GetRevenueEstimateParams,
1761) -> Result<models::GetRevenueEstimateResponse, Error<GetRevenueEstimateError>> {
1762    // Extract parameters from params struct
1763    let p_query_symbol = params.symbol;
1764    let p_query_figi = params.figi;
1765    let p_query_isin = params.isin;
1766    let p_query_cusip = params.cusip;
1767    let p_query_country = params.country;
1768    let p_query_exchange = params.exchange;
1769    let p_query_dp = params.dp;
1770
1771    let uri_str = format!("{}/revenue_estimate", configuration.base_path);
1772    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1773
1774    if let Some(ref param_value) = p_query_symbol {
1775        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1776    }
1777    if let Some(ref param_value) = p_query_figi {
1778        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1779    }
1780    if let Some(ref param_value) = p_query_isin {
1781        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1782    }
1783    if let Some(ref param_value) = p_query_cusip {
1784        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1785    }
1786    if let Some(ref param_value) = p_query_country {
1787        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1788    }
1789    if let Some(ref param_value) = p_query_exchange {
1790        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1791    }
1792    if let Some(ref param_value) = p_query_dp {
1793        req_builder = req_builder.query(&[("dp", &param_value.to_string())]);
1794    }
1795    if let Some(ref user_agent) = configuration.user_agent {
1796        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1797    }
1798    if let Some(ref apikey) = configuration.api_key {
1799        let key = apikey.key.clone();
1800        let value = match apikey.prefix {
1801            Some(ref prefix) => format!("{} {}", prefix, key),
1802            None => key,
1803        };
1804        req_builder = req_builder.header("Authorization", value);
1805    };
1806
1807    let req = req_builder.build()?;
1808    let resp = configuration.client.execute(req).await?;
1809
1810    let status = resp.status();
1811    let content_type = resp
1812        .headers()
1813        .get("content-type")
1814        .and_then(|v| v.to_str().ok())
1815        .unwrap_or("application/octet-stream");
1816    let content_type = super::ContentType::from(content_type);
1817
1818    if !status.is_client_error() && !status.is_server_error() {
1819        let content = resp.text().await?;
1820        match content_type {
1821            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1822            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetRevenueEstimateResponse`"))),
1823            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::GetRevenueEstimateResponse`")))),
1824        }
1825    } else {
1826        let content = resp.text().await?;
1827        let entity: Option<GetRevenueEstimateError> = serde_json::from_str(&content).ok();
1828        Err(Error::ResponseError(ResponseContent {
1829            status,
1830            content,
1831            entity,
1832        }))
1833    }
1834}