diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ca5a60..6a0eaee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to the Adanos Python SDK will be documented in this file. Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) Versioning: [Semantic Versioning](https://semver.org/spec/v2.0.0.html) +## [2.5.0] - 2026-05-31 + +### Added +- Synced generated client and wrapper coverage with Adanos Market Sentiment API `1.40.0`. +- Added generated `InvalidPeriodError` models for structured 422 period-window errors. +- Added generated `XTopAuthor` and `XStockDetailResponse.top_authors` for X/Twitter contributor metrics. + ## [2.4.0] - 2026-05-25 ### Changed diff --git a/src/adanos/__init__.py b/src/adanos/__init__.py index db5ca5d..65ad05d 100644 --- a/src/adanos/__init__.py +++ b/src/adanos/__init__.py @@ -1,6 +1,6 @@ """Adanos Market Sentiment API — Python SDK.""" -__version__ = "2.4.0" +__version__ = "2.5.0" from ._wrapper import AdanosClient, StockSentimentClient diff --git a/src/adanos/_generated/api/news_stocks/compare_news_stocks.py b/src/adanos/_generated/api/news_stocks/compare_news_stocks.py index 80f3262..4f5f6f6 100644 --- a/src/adanos/_generated/api/news_stocks/compare_news_stocks.py +++ b/src/adanos/_generated/api/news_stocks/compare_news_stocks.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.news_compare_response import NewsCompareResponse from ...types import UNSET, Response, Unset @@ -46,6 +47,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | NewsCompareResponse | None @@ -70,7 +72,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -91,6 +113,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | NewsCompareResponse ]: @@ -113,6 +136,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | NewsCompareResponse ]: @@ -131,7 +155,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsCompareResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsCompareResponse] """ kwargs = _get_kwargs( @@ -159,6 +183,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | NewsCompareResponse | None @@ -178,7 +203,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsCompareResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsCompareResponse """ return sync_detailed( @@ -201,6 +226,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | NewsCompareResponse ]: @@ -219,7 +245,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsCompareResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsCompareResponse] """ kwargs = _get_kwargs( @@ -245,6 +271,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | NewsCompareResponse | None @@ -264,7 +291,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsCompareResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsCompareResponse """ return ( diff --git a/src/adanos/_generated/api/news_stocks/get_news_market_sentiment.py b/src/adanos/_generated/api/news_stocks/get_news_market_sentiment.py index 7e3dcad..348f59a 100644 --- a/src/adanos/_generated/api/news_stocks/get_news_market_sentiment.py +++ b/src/adanos/_generated/api/news_stocks/get_news_market_sentiment.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.news_market_sentiment_response import NewsMarketSentimentResponse from ...models.rate_limit_error import RateLimitError from ...types import UNSET, Response, Unset @@ -41,7 +42,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError | None: if response.status_code == 200: response_200 = NewsMarketSentimentResponse.from_dict(response.json()) @@ -58,7 +59,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -76,7 +97,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError ]: return Response( status_code=HTTPStatus(response.status_code), @@ -93,7 +114,7 @@ def sync_detailed( from_: str | Unset = UNSET, to: str | Unset = UNSET, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError ]: """Market Sentiment @@ -126,7 +147,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError] """ kwargs = _get_kwargs( @@ -148,7 +169,7 @@ def sync( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError | None: """Market Sentiment Returns the service-level News market sentiment snapshot across all tracked stocks. @@ -180,7 +201,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError """ return sync_detailed( @@ -198,7 +219,7 @@ async def asyncio_detailed( from_: str | Unset = UNSET, to: str | Unset = UNSET, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError ]: """Market Sentiment @@ -231,7 +252,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError] """ kwargs = _get_kwargs( @@ -251,7 +272,7 @@ async def asyncio( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError | None: """Market Sentiment Returns the service-level News market sentiment snapshot across all tracked stocks. @@ -283,7 +304,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsMarketSentimentResponse | RateLimitError """ return ( diff --git a/src/adanos/_generated/api/news_stocks/get_news_stock_explanation.py b/src/adanos/_generated/api/news_stocks/get_news_stock_explanation.py index 99178e3..86ef88d 100644 --- a/src/adanos/_generated/api/news_stocks/get_news_stock_explanation.py +++ b/src/adanos/_generated/api/news_stocks/get_news_stock_explanation.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.stock_explanation_response import StockExplanationResponse from ...types import Response @@ -32,6 +33,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse | None @@ -56,7 +58,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -81,6 +103,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse ]: @@ -100,6 +123,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse ]: @@ -115,7 +139,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockExplanationResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse] """ kwargs = _get_kwargs( @@ -137,6 +161,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse | None @@ -153,7 +178,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockExplanationResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse """ return sync_detailed( @@ -170,6 +195,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse ]: @@ -185,7 +211,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockExplanationResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse] """ kwargs = _get_kwargs( @@ -205,6 +231,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse | None @@ -221,7 +248,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockExplanationResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse """ return ( diff --git a/src/adanos/_generated/api/news_stocks/get_news_stock_mentions.py b/src/adanos/_generated/api/news_stocks/get_news_stock_mentions.py index 521e5cc..454b05a 100644 --- a/src/adanos/_generated/api/news_stocks/get_news_stock_mentions.py +++ b/src/adanos/_generated/api/news_stocks/get_news_stock_mentions.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.news_raw_mentions_response import NewsRawMentionsResponse from ...models.rate_limit_error import RateLimitError from ...types import UNSET, Response, Unset @@ -51,7 +52,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError | None: if response.status_code == 200: response_200 = NewsRawMentionsResponse.from_dict(response.json()) @@ -68,7 +69,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -85,7 +106,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -103,7 +124,7 @@ def sync_detailed( to: str | Unset = UNSET, limit: int | Unset = 50, offset: int | Unset = 0, -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError]: """Raw Mentions Return the stored raw news mention rows for one stock ticker. @@ -129,7 +150,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError] """ kwargs = _get_kwargs( @@ -157,7 +178,7 @@ def sync( to: str | Unset = UNSET, limit: int | Unset = 50, offset: int | Unset = 0, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError | None: """Raw Mentions Return the stored raw news mention rows for one stock ticker. @@ -183,7 +204,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError """ return sync_detailed( @@ -206,7 +227,7 @@ async def asyncio_detailed( to: str | Unset = UNSET, limit: int | Unset = 50, offset: int | Unset = 0, -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError]: """Raw Mentions Return the stored raw news mention rows for one stock ticker. @@ -232,7 +253,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError] """ kwargs = _get_kwargs( @@ -258,7 +279,7 @@ async def asyncio( to: str | Unset = UNSET, limit: int | Unset = 50, offset: int | Unset = 0, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError | None: """Raw Mentions Return the stored raw news mention rows for one stock ticker. @@ -284,7 +305,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsRawMentionsResponse | RateLimitError """ return ( diff --git a/src/adanos/_generated/api/news_stocks/get_news_stock_sentiment.py b/src/adanos/_generated/api/news_stocks/get_news_stock_sentiment.py index 86fd14f..4601327 100644 --- a/src/adanos/_generated/api/news_stocks/get_news_stock_sentiment.py +++ b/src/adanos/_generated/api/news_stocks/get_news_stock_sentiment.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.news_stock_sentiment import NewsStockSentiment from ...types import UNSET, Response, Unset @@ -47,6 +48,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | NewsStockSentiment | None @@ -71,7 +73,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -92,6 +114,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | NewsStockSentiment ]: @@ -114,6 +137,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | NewsStockSentiment ]: @@ -132,7 +156,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsStockSentiment] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsStockSentiment] """ kwargs = _get_kwargs( @@ -160,6 +184,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | NewsStockSentiment | None @@ -179,7 +204,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsStockSentiment + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsStockSentiment """ return sync_detailed( @@ -202,6 +227,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | NewsStockSentiment ]: @@ -220,7 +246,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsStockSentiment] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsStockSentiment] """ kwargs = _get_kwargs( @@ -246,6 +272,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | NewsStockSentiment | None @@ -265,7 +292,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsStockSentiment + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsStockSentiment """ return ( diff --git a/src/adanos/_generated/api/news_stocks/get_news_trending_countries.py b/src/adanos/_generated/api/news_stocks/get_news_trending_countries.py index 28e5681..a914bf7 100644 --- a/src/adanos/_generated/api/news_stocks/get_news_trending_countries.py +++ b/src/adanos/_generated/api/news_stocks/get_news_trending_countries.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.news_trending_country import NewsTrendingCountry from ...types import UNSET, Response, Unset @@ -57,6 +58,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingCountry] | None @@ -86,7 +88,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -107,6 +129,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingCountry] ]: @@ -131,6 +154,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingCountry] ]: @@ -152,7 +176,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[NewsTrendingCountry]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingCountry]] """ kwargs = _get_kwargs( @@ -184,6 +208,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingCountry] | None @@ -206,7 +231,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[NewsTrendingCountry] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingCountry] """ return sync_detailed( @@ -233,6 +258,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingCountry] ]: @@ -254,7 +280,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[NewsTrendingCountry]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingCountry]] """ kwargs = _get_kwargs( @@ -284,6 +310,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingCountry] | None @@ -306,7 +333,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[NewsTrendingCountry] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingCountry] """ return ( diff --git a/src/adanos/_generated/api/news_stocks/get_news_trending_sectors.py b/src/adanos/_generated/api/news_stocks/get_news_trending_sectors.py index ecc3f61..4a99aaf 100644 --- a/src/adanos/_generated/api/news_stocks/get_news_trending_sectors.py +++ b/src/adanos/_generated/api/news_stocks/get_news_trending_sectors.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.news_trending_sector import NewsTrendingSector from ...types import UNSET, Response, Unset @@ -57,6 +58,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingSector] | None @@ -86,7 +88,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -107,6 +129,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingSector] ]: @@ -131,6 +154,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingSector] ]: @@ -152,7 +176,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[NewsTrendingSector]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingSector]] """ kwargs = _get_kwargs( @@ -184,6 +208,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingSector] | None @@ -206,7 +231,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[NewsTrendingSector] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingSector] """ return sync_detailed( @@ -233,6 +258,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingSector] ]: @@ -254,7 +280,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[NewsTrendingSector]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingSector]] """ kwargs = _get_kwargs( @@ -284,6 +310,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingSector] | None @@ -306,7 +333,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[NewsTrendingSector] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingSector] """ return ( diff --git a/src/adanos/_generated/api/news_stocks/get_news_trending_stocks.py b/src/adanos/_generated/api/news_stocks/get_news_trending_stocks.py index 46634da..8f2c787 100644 --- a/src/adanos/_generated/api/news_stocks/get_news_trending_stocks.py +++ b/src/adanos/_generated/api/news_stocks/get_news_trending_stocks.py @@ -11,6 +11,7 @@ ) from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.news_trending_stock import NewsTrendingStock from ...types import UNSET, Response, Unset @@ -70,6 +71,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingStock] | None @@ -99,7 +101,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -120,6 +142,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingStock] ]: @@ -145,6 +168,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingStock] ]: @@ -169,7 +193,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[NewsTrendingStock]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingStock]] """ kwargs = _get_kwargs( @@ -203,6 +227,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingStock] | None @@ -228,7 +253,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[NewsTrendingStock] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingStock] """ return sync_detailed( @@ -257,6 +282,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingStock] ]: @@ -281,7 +307,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[NewsTrendingStock]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingStock]] """ kwargs = _get_kwargs( @@ -313,6 +339,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingStock] | None @@ -338,7 +365,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[NewsTrendingStock] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[NewsTrendingStock] """ return ( diff --git a/src/adanos/_generated/api/news_stocks/search_news_stocks.py b/src/adanos/_generated/api/news_stocks/search_news_stocks.py index c8e554d..19cba94 100644 --- a/src/adanos/_generated/api/news_stocks/search_news_stocks.py +++ b/src/adanos/_generated/api/news_stocks/search_news_stocks.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.news_search_response import NewsSearchResponse from ...models.rate_limit_error import RateLimitError from ...types import UNSET, Response, Unset @@ -39,7 +40,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsSearchResponse | RateLimitError | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsSearchResponse | RateLimitError | None: if response.status_code == 200: response_200 = NewsSearchResponse.from_dict(response.json()) @@ -56,7 +57,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -73,7 +94,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsSearchResponse | RateLimitError]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsSearchResponse | RateLimitError]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -87,7 +108,7 @@ def sync_detailed( client: AuthenticatedClient, q: str, limit: int | Unset = 20, -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsSearchResponse | RateLimitError]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsSearchResponse | RateLimitError]: """Search stocks Search stocks by ticker, company name, or alias within the news platform universe. @@ -105,7 +126,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsSearchResponse | RateLimitError] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsSearchResponse | RateLimitError] """ kwargs = _get_kwargs( @@ -125,7 +146,7 @@ def sync( client: AuthenticatedClient, q: str, limit: int | Unset = 20, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsSearchResponse | RateLimitError | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsSearchResponse | RateLimitError | None: """Search stocks Search stocks by ticker, company name, or alias within the news platform universe. @@ -143,7 +164,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsSearchResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsSearchResponse | RateLimitError """ return sync_detailed( @@ -158,7 +179,7 @@ async def asyncio_detailed( client: AuthenticatedClient, q: str, limit: int | Unset = 20, -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsSearchResponse | RateLimitError]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsSearchResponse | RateLimitError]: """Search stocks Search stocks by ticker, company name, or alias within the news platform universe. @@ -176,7 +197,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsSearchResponse | RateLimitError] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsSearchResponse | RateLimitError] """ kwargs = _get_kwargs( @@ -194,7 +215,7 @@ async def asyncio( client: AuthenticatedClient, q: str, limit: int | Unset = 20, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsSearchResponse | RateLimitError | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsSearchResponse | RateLimitError | None: """Search stocks Search stocks by ticker, company name, or alias within the news platform universe. @@ -212,7 +233,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | NewsSearchResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | NewsSearchResponse | RateLimitError """ return ( diff --git a/src/adanos/_generated/api/polymarket_stocks/compare_polymarket_stocks.py b/src/adanos/_generated/api/polymarket_stocks/compare_polymarket_stocks.py index f642120..7ca0add 100644 --- a/src/adanos/_generated/api/polymarket_stocks/compare_polymarket_stocks.py +++ b/src/adanos/_generated/api/polymarket_stocks/compare_polymarket_stocks.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.polymarket_compare_response import PolymarketCompareResponse from ...types import UNSET, Response, Unset @@ -46,6 +47,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketCompareResponse | None @@ -70,7 +72,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -91,6 +113,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketCompareResponse ]: @@ -113,6 +136,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketCompareResponse ]: @@ -131,7 +155,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketCompareResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketCompareResponse] """ kwargs = _get_kwargs( @@ -159,6 +183,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketCompareResponse | None @@ -178,7 +203,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketCompareResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketCompareResponse """ return sync_detailed( @@ -201,6 +226,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketCompareResponse ]: @@ -219,7 +245,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketCompareResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketCompareResponse] """ kwargs = _get_kwargs( @@ -245,6 +271,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketCompareResponse | None @@ -264,7 +291,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketCompareResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketCompareResponse """ return ( diff --git a/src/adanos/_generated/api/polymarket_stocks/get_polymarket_market_sentiment.py b/src/adanos/_generated/api/polymarket_stocks/get_polymarket_market_sentiment.py index f4131fc..b39a0fb 100644 --- a/src/adanos/_generated/api/polymarket_stocks/get_polymarket_market_sentiment.py +++ b/src/adanos/_generated/api/polymarket_stocks/get_polymarket_market_sentiment.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.polymarket_market_sentiment_response import PolymarketMarketSentimentResponse from ...models.rate_limit_error import RateLimitError from ...types import UNSET, Response, Unset @@ -44,6 +45,7 @@ def _parse_response( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError @@ -65,7 +67,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -83,7 +105,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError ]: return Response( status_code=HTTPStatus(response.status_code), @@ -100,7 +122,7 @@ def sync_detailed( from_: str | Unset = UNSET, to: str | Unset = UNSET, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError ]: """Market Sentiment @@ -135,7 +157,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError] """ kwargs = _get_kwargs( @@ -160,6 +182,7 @@ def sync( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError @@ -198,7 +221,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError """ return sync_detailed( @@ -216,7 +239,7 @@ async def asyncio_detailed( from_: str | Unset = UNSET, to: str | Unset = UNSET, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError ]: """Market Sentiment @@ -251,7 +274,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError] """ kwargs = _get_kwargs( @@ -274,6 +297,7 @@ async def asyncio( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError @@ -312,7 +336,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketMarketSentimentResponse | RateLimitError """ return ( diff --git a/src/adanos/_generated/api/polymarket_stocks/get_polymarket_stock.py b/src/adanos/_generated/api/polymarket_stocks/get_polymarket_stock.py index cd0bb58..923e7c7 100644 --- a/src/adanos/_generated/api/polymarket_stocks/get_polymarket_stock.py +++ b/src/adanos/_generated/api/polymarket_stocks/get_polymarket_stock.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.polymarket_stock_detail_response import PolymarketStockDetailResponse from ...types import UNSET, Response, Unset @@ -47,6 +48,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketStockDetailResponse | None @@ -71,7 +73,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -92,6 +114,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketStockDetailResponse ]: @@ -114,6 +137,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketStockDetailResponse ]: @@ -132,7 +156,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketStockDetailResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketStockDetailResponse] """ kwargs = _get_kwargs( @@ -160,6 +184,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketStockDetailResponse | None @@ -179,7 +204,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketStockDetailResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketStockDetailResponse """ return sync_detailed( @@ -202,6 +227,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketStockDetailResponse ]: @@ -220,7 +246,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketStockDetailResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketStockDetailResponse] """ kwargs = _get_kwargs( @@ -246,6 +272,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketStockDetailResponse | None @@ -265,7 +292,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketStockDetailResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketStockDetailResponse """ return ( diff --git a/src/adanos/_generated/api/polymarket_stocks/get_polymarket_stock_raw_mentions.py b/src/adanos/_generated/api/polymarket_stocks/get_polymarket_stock_raw_mentions.py index 77aa24c..be20aef 100644 --- a/src/adanos/_generated/api/polymarket_stocks/get_polymarket_stock_raw_mentions.py +++ b/src/adanos/_generated/api/polymarket_stocks/get_polymarket_stock_raw_mentions.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.polymarket_raw_mentions_response import PolymarketRawMentionsResponse from ...models.rate_limit_error import RateLimitError from ...types import UNSET, Response, Unset @@ -51,7 +52,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError | None: if response.status_code == 200: response_200 = PolymarketRawMentionsResponse.from_dict(response.json()) @@ -68,7 +69,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -86,7 +107,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError ]: return Response( status_code=HTTPStatus(response.status_code), @@ -106,7 +127,7 @@ def sync_detailed( limit: int | Unset = 50, offset: int | Unset = 0, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError ]: """Raw Mentions @@ -145,7 +166,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError] """ kwargs = _get_kwargs( @@ -173,7 +194,7 @@ def sync( to: str | Unset = UNSET, limit: int | Unset = 50, offset: int | Unset = 0, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError | None: """Raw Mentions Returns raw Polymarket market snapshot rows for a specific ticker within the live raw-data retention @@ -211,7 +232,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError """ return sync_detailed( @@ -235,7 +256,7 @@ async def asyncio_detailed( limit: int | Unset = 50, offset: int | Unset = 0, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError ]: """Raw Mentions @@ -274,7 +295,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError] """ kwargs = _get_kwargs( @@ -300,7 +321,7 @@ async def asyncio( to: str | Unset = UNSET, limit: int | Unset = 50, offset: int | Unset = 0, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError | None: """Raw Mentions Returns raw Polymarket market snapshot rows for a specific ticker within the live raw-data retention @@ -338,7 +359,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketRawMentionsResponse | RateLimitError """ return ( diff --git a/src/adanos/_generated/api/polymarket_stocks/get_polymarket_trending_countries.py b/src/adanos/_generated/api/polymarket_stocks/get_polymarket_trending_countries.py index 026d9b4..e47afc4 100644 --- a/src/adanos/_generated/api/polymarket_stocks/get_polymarket_trending_countries.py +++ b/src/adanos/_generated/api/polymarket_stocks/get_polymarket_trending_countries.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.polymarket_trending_country import PolymarketTrendingCountry from ...types import UNSET, Response, Unset @@ -48,6 +49,7 @@ def _parse_response( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingCountry] | None @@ -75,7 +77,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -95,6 +117,7 @@ def _build_response( ) -> Response[ ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingCountry] ]: @@ -117,6 +140,7 @@ def sync_detailed( ) -> Response[ ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingCountry] ]: @@ -136,7 +160,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | list[PolymarketTrendingCountry]] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingCountry]] """ kwargs = _get_kwargs( @@ -165,6 +189,7 @@ def sync( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingCountry] | None @@ -185,7 +210,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[PolymarketTrendingCountry] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingCountry] """ return sync_detailed( @@ -209,6 +234,7 @@ async def asyncio_detailed( ) -> Response[ ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingCountry] ]: @@ -228,7 +254,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | list[PolymarketTrendingCountry]] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingCountry]] """ kwargs = _get_kwargs( @@ -255,6 +281,7 @@ async def asyncio( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingCountry] | None @@ -275,7 +302,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[PolymarketTrendingCountry] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingCountry] """ return ( diff --git a/src/adanos/_generated/api/polymarket_stocks/get_polymarket_trending_sectors.py b/src/adanos/_generated/api/polymarket_stocks/get_polymarket_trending_sectors.py index e646ba2..b48f699 100644 --- a/src/adanos/_generated/api/polymarket_stocks/get_polymarket_trending_sectors.py +++ b/src/adanos/_generated/api/polymarket_stocks/get_polymarket_trending_sectors.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.polymarket_trending_sector import PolymarketTrendingSector from ...types import UNSET, Response, Unset @@ -48,6 +49,7 @@ def _parse_response( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingSector] | None @@ -75,7 +77,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -95,6 +117,7 @@ def _build_response( ) -> Response[ ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingSector] ]: @@ -117,6 +140,7 @@ def sync_detailed( ) -> Response[ ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingSector] ]: @@ -136,7 +160,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | list[PolymarketTrendingSector]] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingSector]] """ kwargs = _get_kwargs( @@ -165,6 +189,7 @@ def sync( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingSector] | None @@ -185,7 +210,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[PolymarketTrendingSector] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingSector] """ return sync_detailed( @@ -209,6 +234,7 @@ async def asyncio_detailed( ) -> Response[ ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingSector] ]: @@ -228,7 +254,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | list[PolymarketTrendingSector]] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingSector]] """ kwargs = _get_kwargs( @@ -255,6 +281,7 @@ async def asyncio( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingSector] | None @@ -275,7 +302,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[PolymarketTrendingSector] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingSector] """ return ( diff --git a/src/adanos/_generated/api/polymarket_stocks/get_polymarket_trending_stocks.py b/src/adanos/_generated/api/polymarket_stocks/get_polymarket_trending_stocks.py index 86b727e..6dbbba3 100644 --- a/src/adanos/_generated/api/polymarket_stocks/get_polymarket_trending_stocks.py +++ b/src/adanos/_generated/api/polymarket_stocks/get_polymarket_trending_stocks.py @@ -11,6 +11,7 @@ ) from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.polymarket_trending_stock import PolymarketTrendingStock from ...types import UNSET, Response, Unset @@ -61,6 +62,7 @@ def _parse_response( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingStock] | None @@ -88,7 +90,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -108,6 +130,7 @@ def _build_response( ) -> Response[ ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingStock] ]: @@ -131,6 +154,7 @@ def sync_detailed( ) -> Response[ ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingStock] ]: @@ -152,7 +176,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | list[PolymarketTrendingStock]] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingStock]] """ kwargs = _get_kwargs( @@ -183,6 +207,7 @@ def sync( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingStock] | None @@ -205,7 +230,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[PolymarketTrendingStock] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingStock] """ return sync_detailed( @@ -231,6 +256,7 @@ async def asyncio_detailed( ) -> Response[ ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingStock] ]: @@ -252,7 +278,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | list[PolymarketTrendingStock]] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingStock]] """ kwargs = _get_kwargs( @@ -281,6 +307,7 @@ async def asyncio( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingStock] | None @@ -303,7 +330,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[PolymarketTrendingStock] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[PolymarketTrendingStock] """ return ( diff --git a/src/adanos/_generated/api/polymarket_stocks/search_polymarket_stocks.py b/src/adanos/_generated/api/polymarket_stocks/search_polymarket_stocks.py index cf2f8a6..86f7b02 100644 --- a/src/adanos/_generated/api/polymarket_stocks/search_polymarket_stocks.py +++ b/src/adanos/_generated/api/polymarket_stocks/search_polymarket_stocks.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.polymarket_search_response import PolymarketSearchResponse from ...types import UNSET, Response @@ -38,6 +39,7 @@ def _parse_response( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketSearchResponse | None @@ -58,7 +60,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -78,6 +100,7 @@ def _build_response( ) -> Response[ ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketSearchResponse ]: @@ -97,6 +120,7 @@ def sync_detailed( ) -> Response[ ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketSearchResponse ]: @@ -113,7 +137,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketSearchResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketSearchResponse] """ kwargs = _get_kwargs( @@ -136,6 +160,7 @@ def sync( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketSearchResponse | None @@ -153,7 +178,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketSearchResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketSearchResponse """ return sync_detailed( @@ -171,6 +196,7 @@ async def asyncio_detailed( ) -> Response[ ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketSearchResponse ]: @@ -187,7 +213,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketSearchResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketSearchResponse] """ kwargs = _get_kwargs( @@ -208,6 +234,7 @@ async def asyncio( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | PolymarketSearchResponse | None @@ -225,7 +252,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | PolymarketSearchResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | PolymarketSearchResponse """ return ( diff --git a/src/adanos/_generated/api/reddit_crypto/compare_reddit_crypto_tokens.py b/src/adanos/_generated/api/reddit_crypto/compare_reddit_crypto_tokens.py index 208964d..285d079 100644 --- a/src/adanos/_generated/api/reddit_crypto/compare_reddit_crypto_tokens.py +++ b/src/adanos/_generated/api/reddit_crypto/compare_reddit_crypto_tokens.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...types import UNSET, Response, Unset @@ -47,6 +48,7 @@ def _parse_response( | CryptoCompareResponse | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | None ): @@ -70,7 +72,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -92,6 +114,7 @@ def _build_response( | CryptoCompareResponse | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError ]: return Response( @@ -114,6 +137,7 @@ def sync_detailed( | CryptoCompareResponse | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError ]: """Compare multiple crypto tokens @@ -131,7 +155,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | CryptoCompareResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError] + Response[Any | CryptoCompareResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError] """ kwargs = _get_kwargs( @@ -160,6 +184,7 @@ def sync( | CryptoCompareResponse | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | None ): @@ -178,7 +203,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | CryptoCompareResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError + Any | CryptoCompareResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError """ return sync_detailed( @@ -202,6 +227,7 @@ async def asyncio_detailed( | CryptoCompareResponse | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError ]: """Compare multiple crypto tokens @@ -219,7 +245,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | CryptoCompareResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError] + Response[Any | CryptoCompareResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError] """ kwargs = _get_kwargs( @@ -246,6 +272,7 @@ async def asyncio( | CryptoCompareResponse | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | None ): @@ -264,7 +291,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | CryptoCompareResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError + Any | CryptoCompareResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError """ return ( diff --git a/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_market_sentiment.py b/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_market_sentiment.py index 5d8ebd2..d5b6cce 100644 --- a/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_market_sentiment.py +++ b/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_market_sentiment.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.rate_limit_error import RateLimitError from ...types import UNSET, Response, Unset @@ -41,7 +42,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | None: +) -> CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | None: if response.status_code == 200: response_200 = CryptoMarketSentimentResponse.from_dict(response.json()) @@ -58,7 +59,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -76,7 +97,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[ - CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError + CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError ]: return Response( status_code=HTTPStatus(response.status_code), @@ -93,7 +114,7 @@ def sync_detailed( from_: str | Unset = UNSET, to: str | Unset = UNSET, ) -> Response[ - CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError + CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError ]: """Market Sentiment @@ -128,7 +149,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError] + Response[CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError] """ kwargs = _get_kwargs( @@ -150,7 +171,7 @@ def sync( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | None: +) -> CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | None: """Market Sentiment Returns the service-level Reddit Crypto market sentiment snapshot across all tracked assets. @@ -184,7 +205,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError + CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError """ return sync_detailed( @@ -202,7 +223,7 @@ async def asyncio_detailed( from_: str | Unset = UNSET, to: str | Unset = UNSET, ) -> Response[ - CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError + CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError ]: """Market Sentiment @@ -237,7 +258,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError] + Response[CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError] """ kwargs = _get_kwargs( @@ -257,7 +278,7 @@ async def asyncio( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | None: +) -> CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | None: """Market Sentiment Returns the service-level Reddit Crypto market sentiment snapshot across all tracked assets. @@ -291,7 +312,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError + CryptoMarketSentimentResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError """ return ( diff --git a/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_token.py b/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_token.py index dd2a6af..47e91a6 100644 --- a/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_token.py +++ b/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_token.py @@ -10,6 +10,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...types import UNSET, Response, Unset @@ -48,6 +49,7 @@ def _parse_response( | CryptoTokenSentiment | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | None ): @@ -71,7 +73,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -93,6 +115,7 @@ def _build_response( | CryptoTokenSentiment | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError ]: return Response( @@ -115,6 +138,7 @@ def sync_detailed( | CryptoTokenSentiment | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError ]: """Get Reddit sentiment for one crypto token @@ -132,7 +156,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | CryptoTokenSentiment | ErrorResponse | HTTPValidationError | HistoricalLimitError] + Response[Any | CryptoTokenSentiment | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError] """ kwargs = _get_kwargs( @@ -161,6 +185,7 @@ def sync( | CryptoTokenSentiment | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | None ): @@ -179,7 +204,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | CryptoTokenSentiment | ErrorResponse | HTTPValidationError | HistoricalLimitError + Any | CryptoTokenSentiment | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError """ return sync_detailed( @@ -203,6 +228,7 @@ async def asyncio_detailed( | CryptoTokenSentiment | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError ]: """Get Reddit sentiment for one crypto token @@ -220,7 +246,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | CryptoTokenSentiment | ErrorResponse | HTTPValidationError | HistoricalLimitError] + Response[Any | CryptoTokenSentiment | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError] """ kwargs = _get_kwargs( @@ -247,6 +273,7 @@ async def asyncio( | CryptoTokenSentiment | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | None ): @@ -265,7 +292,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | CryptoTokenSentiment | ErrorResponse | HTTPValidationError | HistoricalLimitError + Any | CryptoTokenSentiment | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError """ return ( diff --git a/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_token_mentions.py b/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_token_mentions.py index 2037adf..d692c4d 100644 --- a/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_token_mentions.py +++ b/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_token_mentions.py @@ -10,6 +10,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.rate_limit_error import RateLimitError from ...types import UNSET, Response, Unset @@ -54,7 +55,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | None: +) -> CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | None: if response.status_code == 200: response_200 = CryptoRawMentionsResponse.from_dict(response.json()) @@ -71,7 +72,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -88,7 +109,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError]: +) -> Response[CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -107,7 +128,7 @@ def sync_detailed( limit: int | Unset = 50, offset: int | Unset = 0, include_inherited: bool | Unset = False, -) -> Response[CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError]: +) -> Response[CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError]: """Raw Mentions Return stored raw Reddit mention rows for one crypto symbol. @@ -137,7 +158,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError] + Response[CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError] """ kwargs = _get_kwargs( @@ -167,7 +188,7 @@ def sync( limit: int | Unset = 50, offset: int | Unset = 0, include_inherited: bool | Unset = False, -) -> CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | None: +) -> CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | None: """Raw Mentions Return stored raw Reddit mention rows for one crypto symbol. @@ -197,7 +218,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError + CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError """ return sync_detailed( @@ -222,7 +243,7 @@ async def asyncio_detailed( limit: int | Unset = 50, offset: int | Unset = 0, include_inherited: bool | Unset = False, -) -> Response[CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError]: +) -> Response[CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError]: """Raw Mentions Return stored raw Reddit mention rows for one crypto symbol. @@ -252,7 +273,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError] + Response[CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError] """ kwargs = _get_kwargs( @@ -280,7 +301,7 @@ async def asyncio( limit: int | Unset = 50, offset: int | Unset = 0, include_inherited: bool | Unset = False, -) -> CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | None: +) -> CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | None: """Raw Mentions Return stored raw Reddit mention rows for one crypto symbol. @@ -310,7 +331,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError + CryptoRawMentionsResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError """ return ( diff --git a/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_trending.py b/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_trending.py index 7a93d9b..8c77b8f 100644 --- a/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_trending.py +++ b/src/adanos/_generated/api/reddit_crypto/get_reddit_crypto_trending.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...types import UNSET, Response, Unset @@ -49,6 +50,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[CryptoTrendingToken] | None @@ -78,7 +80,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -99,6 +121,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[CryptoTrendingToken] ]: @@ -122,6 +145,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[CryptoTrendingToken] ]: @@ -141,7 +165,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[CryptoTrendingToken]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[CryptoTrendingToken]] """ kwargs = _get_kwargs( @@ -171,6 +195,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[CryptoTrendingToken] | None @@ -191,7 +216,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[CryptoTrendingToken] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[CryptoTrendingToken] """ return sync_detailed( @@ -216,6 +241,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[CryptoTrendingToken] ]: @@ -235,7 +261,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[CryptoTrendingToken]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[CryptoTrendingToken]] """ kwargs = _get_kwargs( @@ -263,6 +289,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[CryptoTrendingToken] | None @@ -283,7 +310,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[CryptoTrendingToken] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[CryptoTrendingToken] """ return ( diff --git a/src/adanos/_generated/api/reddit_crypto/search_reddit_crypto.py b/src/adanos/_generated/api/reddit_crypto/search_reddit_crypto.py index 15c6b97..65ae45a 100644 --- a/src/adanos/_generated/api/reddit_crypto/search_reddit_crypto.py +++ b/src/adanos/_generated/api/reddit_crypto/search_reddit_crypto.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...types import UNSET, Response @@ -39,6 +40,7 @@ def _parse_response( CryptoSearchResponse | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | None ): @@ -58,7 +60,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -76,7 +98,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[ - CryptoSearchResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError + CryptoSearchResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError ]: return Response( status_code=HTTPStatus(response.status_code), @@ -92,7 +114,7 @@ def sync_detailed( q: str, limit: int | Any = UNSET, ) -> Response[ - CryptoSearchResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError + CryptoSearchResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError ]: """Search crypto symbols @@ -107,7 +129,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[CryptoSearchResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError] + Response[CryptoSearchResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError] """ kwargs = _get_kwargs( @@ -131,6 +153,7 @@ def sync( CryptoSearchResponse | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | None ): @@ -147,7 +170,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - CryptoSearchResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError + CryptoSearchResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError """ return sync_detailed( @@ -163,7 +186,7 @@ async def asyncio_detailed( q: str, limit: int | Any = UNSET, ) -> Response[ - CryptoSearchResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError + CryptoSearchResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError ]: """Search crypto symbols @@ -178,7 +201,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[CryptoSearchResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError] + Response[CryptoSearchResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError] """ kwargs = _get_kwargs( @@ -200,6 +223,7 @@ async def asyncio( CryptoSearchResponse | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | None ): @@ -216,7 +240,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - CryptoSearchResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError + CryptoSearchResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError """ return ( diff --git a/src/adanos/_generated/api/reddit_stocks/compare_stocks.py b/src/adanos/_generated/api/reddit_stocks/compare_stocks.py index 466801c..a74702d 100644 --- a/src/adanos/_generated/api/reddit_stocks/compare_stocks.py +++ b/src/adanos/_generated/api/reddit_stocks/compare_stocks.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...types import UNSET, Response, Unset @@ -47,6 +48,7 @@ def _parse_response( | CompareResponse | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | None ): @@ -70,7 +72,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -88,7 +110,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[ - Any | CompareResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError + Any | CompareResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError ]: return Response( status_code=HTTPStatus(response.status_code), @@ -106,7 +128,7 @@ def sync_detailed( from_: str | Unset = UNSET, to: str | Unset = UNSET, ) -> Response[ - Any | CompareResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError + Any | CompareResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError ]: """Compare multiple stocks @@ -123,7 +145,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | CompareResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError] + Response[Any | CompareResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError] """ kwargs = _get_kwargs( @@ -152,6 +174,7 @@ def sync( | CompareResponse | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | None ): @@ -170,7 +193,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | CompareResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError + Any | CompareResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError """ return sync_detailed( @@ -190,7 +213,7 @@ async def asyncio_detailed( from_: str | Unset = UNSET, to: str | Unset = UNSET, ) -> Response[ - Any | CompareResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError + Any | CompareResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError ]: """Compare multiple stocks @@ -207,7 +230,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | CompareResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError] + Response[Any | CompareResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError] """ kwargs = _get_kwargs( @@ -234,6 +257,7 @@ async def asyncio( | CompareResponse | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | None ): @@ -252,7 +276,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | CompareResponse | ErrorResponse | HTTPValidationError | HistoricalLimitError + Any | CompareResponse | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError """ return ( diff --git a/src/adanos/_generated/api/reddit_stocks/get_reddit_market_sentiment.py b/src/adanos/_generated/api/reddit_stocks/get_reddit_market_sentiment.py index 3260824..68aad4b 100644 --- a/src/adanos/_generated/api/reddit_stocks/get_reddit_market_sentiment.py +++ b/src/adanos/_generated/api/reddit_stocks/get_reddit_market_sentiment.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.rate_limit_error import RateLimitError from ...models.reddit_market_sentiment_response import RedditMarketSentimentResponse from ...types import UNSET, Response, Unset @@ -41,7 +42,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse | None: if response.status_code == 200: response_200 = RedditMarketSentimentResponse.from_dict(response.json()) @@ -58,7 +59,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -76,7 +97,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse ]: return Response( status_code=HTTPStatus(response.status_code), @@ -93,7 +114,7 @@ def sync_detailed( from_: str | Unset = UNSET, to: str | Unset = UNSET, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse ]: """Market Sentiment @@ -126,7 +147,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse] """ kwargs = _get_kwargs( @@ -148,7 +169,7 @@ def sync( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse | None: """Market Sentiment Returns the service-level Reddit market sentiment snapshot across all tracked stocks. @@ -180,7 +201,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse """ return sync_detailed( @@ -198,7 +219,7 @@ async def asyncio_detailed( from_: str | Unset = UNSET, to: str | Unset = UNSET, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse ]: """Market Sentiment @@ -231,7 +252,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse] """ kwargs = _get_kwargs( @@ -251,7 +272,7 @@ async def asyncio( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse | None: """Market Sentiment Returns the service-level Reddit market sentiment snapshot across all tracked stocks. @@ -283,7 +304,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditMarketSentimentResponse """ return ( diff --git a/src/adanos/_generated/api/reddit_stocks/get_stock_explanation.py b/src/adanos/_generated/api/reddit_stocks/get_stock_explanation.py index fdd4c16..5401df2 100644 --- a/src/adanos/_generated/api/reddit_stocks/get_stock_explanation.py +++ b/src/adanos/_generated/api/reddit_stocks/get_stock_explanation.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.stock_explanation_response import StockExplanationResponse from ...types import Response @@ -32,6 +33,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse | None @@ -56,7 +58,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -81,6 +103,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse ]: @@ -100,6 +123,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse ]: @@ -126,7 +150,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockExplanationResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse] """ kwargs = _get_kwargs( @@ -148,6 +172,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse | None @@ -175,7 +200,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockExplanationResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse """ return sync_detailed( @@ -192,6 +217,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse ]: @@ -218,7 +244,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockExplanationResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse] """ kwargs = _get_kwargs( @@ -238,6 +264,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse | None @@ -265,7 +292,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockExplanationResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockExplanationResponse """ return ( diff --git a/src/adanos/_generated/api/reddit_stocks/get_stock_raw_mentions.py b/src/adanos/_generated/api/reddit_stocks/get_stock_raw_mentions.py index e6bc83e..2e99a51 100644 --- a/src/adanos/_generated/api/reddit_stocks/get_stock_raw_mentions.py +++ b/src/adanos/_generated/api/reddit_stocks/get_stock_raw_mentions.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.rate_limit_error import RateLimitError from ...models.reddit_raw_mentions_response import RedditRawMentionsResponse from ...types import UNSET, Response, Unset @@ -54,7 +55,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse | None: if response.status_code == 200: response_200 = RedditRawMentionsResponse.from_dict(response.json()) @@ -71,7 +72,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -88,7 +109,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -107,7 +128,7 @@ def sync_detailed( limit: int | Unset = 50, offset: int | Unset = 0, include_inherited: bool | Unset = False, -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse]: """Raw Mentions Returns raw mention rows for a specific stock ticker within the live raw-data retention window. @@ -143,7 +164,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse] """ kwargs = _get_kwargs( @@ -173,7 +194,7 @@ def sync( limit: int | Unset = 50, offset: int | Unset = 0, include_inherited: bool | Unset = False, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse | None: """Raw Mentions Returns raw mention rows for a specific stock ticker within the live raw-data retention window. @@ -209,7 +230,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse """ return sync_detailed( @@ -234,7 +255,7 @@ async def asyncio_detailed( limit: int | Unset = 50, offset: int | Unset = 0, include_inherited: bool | Unset = False, -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse]: """Raw Mentions Returns raw mention rows for a specific stock ticker within the live raw-data retention window. @@ -270,7 +291,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse] """ kwargs = _get_kwargs( @@ -298,7 +319,7 @@ async def asyncio( limit: int | Unset = 50, offset: int | Unset = 0, include_inherited: bool | Unset = False, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse | None: """Raw Mentions Returns raw mention rows for a specific stock ticker within the live raw-data retention window. @@ -334,7 +355,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | RedditRawMentionsResponse """ return ( diff --git a/src/adanos/_generated/api/reddit_stocks/get_stock_sentiment.py b/src/adanos/_generated/api/reddit_stocks/get_stock_sentiment.py index d8ada18..11a687a 100644 --- a/src/adanos/_generated/api/reddit_stocks/get_stock_sentiment.py +++ b/src/adanos/_generated/api/reddit_stocks/get_stock_sentiment.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.stock_sentiment import StockSentiment from ...types import UNSET, Response, Unset @@ -47,6 +48,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockSentiment | None @@ -71,7 +73,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -89,7 +111,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[ - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockSentiment + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockSentiment ]: return Response( status_code=HTTPStatus(response.status_code), @@ -107,7 +129,7 @@ def sync_detailed( from_: str | Unset = UNSET, to: str | Unset = UNSET, ) -> Response[ - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockSentiment + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockSentiment ]: """Get sentiment for a stock @@ -131,7 +153,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockSentiment] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockSentiment] """ kwargs = _get_kwargs( @@ -159,6 +181,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockSentiment | None @@ -185,7 +208,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockSentiment + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockSentiment """ return sync_detailed( @@ -205,7 +228,7 @@ async def asyncio_detailed( from_: str | Unset = UNSET, to: str | Unset = UNSET, ) -> Response[ - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockSentiment + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockSentiment ]: """Get sentiment for a stock @@ -229,7 +252,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockSentiment] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockSentiment] """ kwargs = _get_kwargs( @@ -255,6 +278,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | StockSentiment | None @@ -281,7 +305,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | StockSentiment + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | StockSentiment """ return ( diff --git a/src/adanos/_generated/api/reddit_stocks/get_trending_countries.py b/src/adanos/_generated/api/reddit_stocks/get_trending_countries.py index 997eae5..e33539c 100644 --- a/src/adanos/_generated/api/reddit_stocks/get_trending_countries.py +++ b/src/adanos/_generated/api/reddit_stocks/get_trending_countries.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.trending_country import TrendingCountry from ...types import UNSET, Response, Unset @@ -49,6 +50,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingCountry] | None @@ -78,7 +80,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -99,6 +121,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingCountry] ]: @@ -122,6 +145,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingCountry] ]: @@ -153,7 +177,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[TrendingCountry]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[TrendingCountry]] """ kwargs = _get_kwargs( @@ -183,6 +207,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingCountry] | None @@ -215,7 +240,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[TrendingCountry] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[TrendingCountry] """ return sync_detailed( @@ -240,6 +265,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingCountry] ]: @@ -271,7 +297,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[TrendingCountry]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[TrendingCountry]] """ kwargs = _get_kwargs( @@ -299,6 +325,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingCountry] | None @@ -331,7 +358,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[TrendingCountry] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[TrendingCountry] """ return ( diff --git a/src/adanos/_generated/api/reddit_stocks/get_trending_sectors.py b/src/adanos/_generated/api/reddit_stocks/get_trending_sectors.py index 468ffcf..4cc549d 100644 --- a/src/adanos/_generated/api/reddit_stocks/get_trending_sectors.py +++ b/src/adanos/_generated/api/reddit_stocks/get_trending_sectors.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.trending_sector import TrendingSector from ...types import UNSET, Response, Unset @@ -49,6 +50,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingSector] | None @@ -78,7 +80,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -99,6 +121,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingSector] ]: @@ -122,6 +145,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingSector] ]: @@ -153,7 +177,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[TrendingSector]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[TrendingSector]] """ kwargs = _get_kwargs( @@ -183,6 +207,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingSector] | None @@ -215,7 +240,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[TrendingSector] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[TrendingSector] """ return sync_detailed( @@ -240,6 +265,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingSector] ]: @@ -271,7 +297,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[TrendingSector]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[TrendingSector]] """ kwargs = _get_kwargs( @@ -299,6 +325,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingSector] | None @@ -331,7 +358,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[TrendingSector] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[TrendingSector] """ return ( diff --git a/src/adanos/_generated/api/reddit_stocks/get_trending_stocks.py b/src/adanos/_generated/api/reddit_stocks/get_trending_stocks.py index d6c349f..f0f490e 100644 --- a/src/adanos/_generated/api/reddit_stocks/get_trending_stocks.py +++ b/src/adanos/_generated/api/reddit_stocks/get_trending_stocks.py @@ -9,6 +9,7 @@ from ...models.get_trending_stocks_type_type_0 import GetTrendingStocksTypeType0 from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.trending_stock import TrendingStock from ...types import UNSET, Response, Unset @@ -60,6 +61,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingStock] | None @@ -89,7 +91,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -110,6 +132,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingStock] ]: @@ -134,6 +157,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingStock] ]: @@ -174,7 +198,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[TrendingStock]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[TrendingStock]] """ kwargs = _get_kwargs( @@ -206,6 +230,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingStock] | None @@ -247,7 +272,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[TrendingStock] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[TrendingStock] """ return sync_detailed( @@ -274,6 +299,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingStock] ]: @@ -314,7 +340,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[TrendingStock]] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[TrendingStock]] """ kwargs = _get_kwargs( @@ -344,6 +370,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[TrendingStock] | None @@ -385,7 +412,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | list[TrendingStock] + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[TrendingStock] """ return ( diff --git a/src/adanos/_generated/api/reddit_stocks/search_stocks.py b/src/adanos/_generated/api/reddit_stocks/search_stocks.py index 9b502e6..eb4e202 100644 --- a/src/adanos/_generated/api/reddit_stocks/search_stocks.py +++ b/src/adanos/_generated/api/reddit_stocks/search_stocks.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.search_response import SearchResponse from ...types import UNSET, Response @@ -35,7 +36,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | SearchResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | SearchResponse | None: if response.status_code == 200: response_200 = SearchResponse.from_dict(response.json()) @@ -52,7 +53,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -70,7 +91,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | SearchResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | SearchResponse ]: return Response( status_code=HTTPStatus(response.status_code), @@ -86,7 +107,7 @@ def sync_detailed( q: str, limit: int | Any = UNSET, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | SearchResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | SearchResponse ]: """Search for stocks @@ -102,7 +123,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | SearchResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | SearchResponse] """ kwargs = _get_kwargs( @@ -122,7 +143,7 @@ def sync( client: AuthenticatedClient, q: str, limit: int | Any = UNSET, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | SearchResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | SearchResponse | None: """Search for stocks Search for stocks by ticker symbol or company name. Results include a platform-specific `summary` @@ -137,7 +158,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | SearchResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | SearchResponse """ return sync_detailed( @@ -153,7 +174,7 @@ async def asyncio_detailed( q: str, limit: int | Any = UNSET, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | SearchResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | SearchResponse ]: """Search for stocks @@ -169,7 +190,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | SearchResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | SearchResponse] """ kwargs = _get_kwargs( @@ -187,7 +208,7 @@ async def asyncio( client: AuthenticatedClient, q: str, limit: int | Any = UNSET, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | SearchResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | SearchResponse | None: """Search for stocks Search for stocks by ticker symbol or company name. Results include a platform-specific `summary` @@ -202,7 +223,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | SearchResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | SearchResponse """ return ( diff --git a/src/adanos/_generated/api/x_twitter_stocks/compare_x_stocks.py b/src/adanos/_generated/api/x_twitter_stocks/compare_x_stocks.py index 5ae7495..e443e32 100644 --- a/src/adanos/_generated/api/x_twitter_stocks/compare_x_stocks.py +++ b/src/adanos/_generated/api/x_twitter_stocks/compare_x_stocks.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.rate_limit_error import RateLimitError from ...models.x_compare_response import XCompareResponse from ...types import UNSET, Response, Unset @@ -44,7 +45,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XCompareResponse | None: +) -> Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XCompareResponse | None: if response.status_code == 200: response_200 = XCompareResponse.from_dict(response.json()) @@ -65,7 +66,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -82,7 +103,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XCompareResponse]: +) -> Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XCompareResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -98,7 +119,7 @@ def sync_detailed( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XCompareResponse]: +) -> Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XCompareResponse]: """Compare stocks Compare up to 10 stocks side by side using X/Twitter metrics over the same UTC calendar-day period. @@ -120,7 +141,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XCompareResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XCompareResponse] """ kwargs = _get_kwargs( @@ -144,7 +165,7 @@ def sync( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XCompareResponse | None: +) -> Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XCompareResponse | None: """Compare stocks Compare up to 10 stocks side by side using X/Twitter metrics over the same UTC calendar-day period. @@ -166,7 +187,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XCompareResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XCompareResponse """ return sync_detailed( @@ -185,7 +206,7 @@ async def asyncio_detailed( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XCompareResponse]: +) -> Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XCompareResponse]: """Compare stocks Compare up to 10 stocks side by side using X/Twitter metrics over the same UTC calendar-day period. @@ -207,7 +228,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XCompareResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XCompareResponse] """ kwargs = _get_kwargs( @@ -229,7 +250,7 @@ async def asyncio( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XCompareResponse | None: +) -> Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XCompareResponse | None: """Compare stocks Compare up to 10 stocks side by side using X/Twitter metrics over the same UTC calendar-day period. @@ -251,7 +272,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XCompareResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XCompareResponse """ return ( diff --git a/src/adanos/_generated/api/x_twitter_stocks/get_x_market_sentiment.py b/src/adanos/_generated/api/x_twitter_stocks/get_x_market_sentiment.py index 9b5478f..4f3054c 100644 --- a/src/adanos/_generated/api/x_twitter_stocks/get_x_market_sentiment.py +++ b/src/adanos/_generated/api/x_twitter_stocks/get_x_market_sentiment.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.rate_limit_error import RateLimitError from ...models.x_market_sentiment_response import XMarketSentimentResponse from ...types import UNSET, Response, Unset @@ -41,7 +42,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse | None: if response.status_code == 200: response_200 = XMarketSentimentResponse.from_dict(response.json()) @@ -58,7 +59,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -75,7 +96,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -90,7 +111,7 @@ def sync_detailed( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse]: """Market Sentiment Returns the service-level X/Twitter market sentiment snapshot across all tracked stocks. @@ -121,7 +142,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse] """ kwargs = _get_kwargs( @@ -143,7 +164,7 @@ def sync( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse | None: """Market Sentiment Returns the service-level X/Twitter market sentiment snapshot across all tracked stocks. @@ -174,7 +195,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse """ return sync_detailed( @@ -191,7 +212,7 @@ async def asyncio_detailed( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse]: """Market Sentiment Returns the service-level X/Twitter market sentiment snapshot across all tracked stocks. @@ -222,7 +243,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse] """ kwargs = _get_kwargs( @@ -242,7 +263,7 @@ async def asyncio( days: int | Unset = UNSET, from_: str | Unset = UNSET, to: str | Unset = UNSET, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse | None: """Market Sentiment Returns the service-level X/Twitter market sentiment snapshot across all tracked stocks. @@ -273,7 +294,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XMarketSentimentResponse """ return ( diff --git a/src/adanos/_generated/api/x_twitter_stocks/get_x_stock_explanation.py b/src/adanos/_generated/api/x_twitter_stocks/get_x_stock_explanation.py index 7fe1ea6..6b71d48 100644 --- a/src/adanos/_generated/api/x_twitter_stocks/get_x_stock_explanation.py +++ b/src/adanos/_generated/api/x_twitter_stocks/get_x_stock_explanation.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.rate_limit_error import RateLimitError from ...models.stock_explanation_response import StockExplanationResponse from ...types import Response @@ -31,7 +32,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> ( - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | StockExplanationResponse | None + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | StockExplanationResponse | None ): if response.status_code == 200: response_200 = StockExplanationResponse.from_dict(response.json()) @@ -53,7 +54,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -75,7 +96,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[ - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | StockExplanationResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | StockExplanationResponse ]: return Response( status_code=HTTPStatus(response.status_code), @@ -90,7 +111,7 @@ def sync_detailed( *, client: AuthenticatedClient, ) -> Response[ - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | StockExplanationResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | StockExplanationResponse ]: """AI explanation @@ -115,7 +136,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | StockExplanationResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | StockExplanationResponse] """ kwargs = _get_kwargs( @@ -134,7 +155,7 @@ def sync( *, client: AuthenticatedClient, ) -> ( - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | StockExplanationResponse | None + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | StockExplanationResponse | None ): """AI explanation @@ -159,7 +180,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | StockExplanationResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | StockExplanationResponse """ return sync_detailed( @@ -173,7 +194,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, ) -> Response[ - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | StockExplanationResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | StockExplanationResponse ]: """AI explanation @@ -198,7 +219,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | StockExplanationResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | StockExplanationResponse] """ kwargs = _get_kwargs( @@ -215,7 +236,7 @@ async def asyncio( *, client: AuthenticatedClient, ) -> ( - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | StockExplanationResponse | None + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | StockExplanationResponse | None ): """AI explanation @@ -240,7 +261,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | StockExplanationResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | StockExplanationResponse """ return ( diff --git a/src/adanos/_generated/api/x_twitter_stocks/get_x_stock_raw_mentions.py b/src/adanos/_generated/api/x_twitter_stocks/get_x_stock_raw_mentions.py index 520306a..6ccf6ee 100644 --- a/src/adanos/_generated/api/x_twitter_stocks/get_x_stock_raw_mentions.py +++ b/src/adanos/_generated/api/x_twitter_stocks/get_x_stock_raw_mentions.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.rate_limit_error import RateLimitError from ...models.x_raw_mentions_response import XRawMentionsResponse from ...types import UNSET, Response, Unset @@ -51,7 +52,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XRawMentionsResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XRawMentionsResponse | None: if response.status_code == 200: response_200 = XRawMentionsResponse.from_dict(response.json()) @@ -68,7 +69,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -85,7 +106,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XRawMentionsResponse]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XRawMentionsResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -103,7 +124,7 @@ def sync_detailed( to: str | Unset = UNSET, limit: int | Unset = 50, offset: int | Unset = 0, -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XRawMentionsResponse]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XRawMentionsResponse]: """Raw Mentions Returns raw tweet rows for a specific ticker within the live raw-data retention window. @@ -136,7 +157,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XRawMentionsResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XRawMentionsResponse] """ kwargs = _get_kwargs( @@ -164,7 +185,7 @@ def sync( to: str | Unset = UNSET, limit: int | Unset = 50, offset: int | Unset = 0, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XRawMentionsResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XRawMentionsResponse | None: """Raw Mentions Returns raw tweet rows for a specific ticker within the live raw-data retention window. @@ -197,7 +218,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XRawMentionsResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XRawMentionsResponse """ return sync_detailed( @@ -220,7 +241,7 @@ async def asyncio_detailed( to: str | Unset = UNSET, limit: int | Unset = 50, offset: int | Unset = 0, -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XRawMentionsResponse]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XRawMentionsResponse]: """Raw Mentions Returns raw tweet rows for a specific ticker within the live raw-data retention window. @@ -253,7 +274,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XRawMentionsResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XRawMentionsResponse] """ kwargs = _get_kwargs( @@ -279,7 +300,7 @@ async def asyncio( to: str | Unset = UNSET, limit: int | Unset = 50, offset: int | Unset = 0, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XRawMentionsResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XRawMentionsResponse | None: """Raw Mentions Returns raw tweet rows for a specific ticker within the live raw-data retention window. @@ -312,7 +333,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XRawMentionsResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XRawMentionsResponse """ return ( diff --git a/src/adanos/_generated/api/x_twitter_stocks/get_x_stock_sentiment.py b/src/adanos/_generated/api/x_twitter_stocks/get_x_stock_sentiment.py index d2b9a6d..4dc4bb8 100644 --- a/src/adanos/_generated/api/x_twitter_stocks/get_x_stock_sentiment.py +++ b/src/adanos/_generated/api/x_twitter_stocks/get_x_stock_sentiment.py @@ -9,6 +9,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.x_stock_detail_response import XStockDetailResponse from ...types import UNSET, Response, Unset @@ -47,6 +48,7 @@ def _parse_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | XStockDetailResponse | None @@ -71,7 +73,27 @@ def _parse_response( return response_404 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -92,6 +114,7 @@ def _build_response( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | XStockDetailResponse ]: @@ -114,6 +137,7 @@ def sync_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | XStockDetailResponse ]: @@ -142,7 +166,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | XStockDetailResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | XStockDetailResponse] """ kwargs = _get_kwargs( @@ -170,6 +194,7 @@ def sync( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | XStockDetailResponse | None @@ -199,7 +224,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | XStockDetailResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | XStockDetailResponse """ return sync_detailed( @@ -222,6 +247,7 @@ async def asyncio_detailed( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | XStockDetailResponse ]: @@ -250,7 +276,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | XStockDetailResponse] + Response[Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | XStockDetailResponse] """ kwargs = _get_kwargs( @@ -276,6 +302,7 @@ async def asyncio( Any | ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | XStockDetailResponse | None @@ -305,7 +332,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | ErrorResponse | HTTPValidationError | HistoricalLimitError | XStockDetailResponse + Any | ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | XStockDetailResponse """ return ( diff --git a/src/adanos/_generated/api/x_twitter_stocks/get_x_trending_countries.py b/src/adanos/_generated/api/x_twitter_stocks/get_x_trending_countries.py index 73ddb25..af6152e 100644 --- a/src/adanos/_generated/api/x_twitter_stocks/get_x_trending_countries.py +++ b/src/adanos/_generated/api/x_twitter_stocks/get_x_trending_countries.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.x_trending_country import XTrendingCountry from ...types import UNSET, Response, Unset @@ -48,6 +49,7 @@ def _parse_response( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[XTrendingCountry] | None @@ -73,7 +75,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -91,7 +113,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingCountry] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingCountry] ]: return Response( status_code=HTTPStatus(response.status_code), @@ -110,7 +132,7 @@ def sync_detailed( limit: int | Unset = 20, offset: int | Unset = 0, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingCountry] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingCountry] ]: """Get trending countries on X/Twitter @@ -141,7 +163,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingCountry]] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingCountry]] """ kwargs = _get_kwargs( @@ -170,6 +192,7 @@ def sync( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[XTrendingCountry] | None @@ -203,7 +226,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingCountry] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingCountry] """ return sync_detailed( @@ -225,7 +248,7 @@ async def asyncio_detailed( limit: int | Unset = 20, offset: int | Unset = 0, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingCountry] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingCountry] ]: """Get trending countries on X/Twitter @@ -256,7 +279,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingCountry]] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingCountry]] """ kwargs = _get_kwargs( @@ -283,6 +306,7 @@ async def asyncio( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[XTrendingCountry] | None @@ -316,7 +340,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingCountry] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingCountry] """ return ( diff --git a/src/adanos/_generated/api/x_twitter_stocks/get_x_trending_sectors.py b/src/adanos/_generated/api/x_twitter_stocks/get_x_trending_sectors.py index bc3df3b..092e020 100644 --- a/src/adanos/_generated/api/x_twitter_stocks/get_x_trending_sectors.py +++ b/src/adanos/_generated/api/x_twitter_stocks/get_x_trending_sectors.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.x_trending_sector import XTrendingSector from ...types import UNSET, Response, Unset @@ -48,6 +49,7 @@ def _parse_response( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[XTrendingSector] | None @@ -73,7 +75,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -91,7 +113,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingSector] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingSector] ]: return Response( status_code=HTTPStatus(response.status_code), @@ -110,7 +132,7 @@ def sync_detailed( limit: int | Unset = 20, offset: int | Unset = 0, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingSector] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingSector] ]: """Get trending sectors on X/Twitter @@ -141,7 +163,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingSector]] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingSector]] """ kwargs = _get_kwargs( @@ -170,6 +192,7 @@ def sync( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[XTrendingSector] | None @@ -203,7 +226,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingSector] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingSector] """ return sync_detailed( @@ -225,7 +248,7 @@ async def asyncio_detailed( limit: int | Unset = 20, offset: int | Unset = 0, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingSector] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingSector] ]: """Get trending sectors on X/Twitter @@ -256,7 +279,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingSector]] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingSector]] """ kwargs = _get_kwargs( @@ -283,6 +306,7 @@ async def asyncio( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[XTrendingSector] | None @@ -316,7 +340,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingSector] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingSector] """ return ( diff --git a/src/adanos/_generated/api/x_twitter_stocks/get_x_trending_stocks.py b/src/adanos/_generated/api/x_twitter_stocks/get_x_trending_stocks.py index 7ec0a9e..b0b0baf 100644 --- a/src/adanos/_generated/api/x_twitter_stocks/get_x_trending_stocks.py +++ b/src/adanos/_generated/api/x_twitter_stocks/get_x_trending_stocks.py @@ -9,6 +9,7 @@ from ...models.get_x_trending_stocks_type_type_0 import GetXTrendingStocksTypeType0 from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.x_trending_stock import XTrendingStock from ...types import UNSET, Response, Unset @@ -59,6 +60,7 @@ def _parse_response( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[XTrendingStock] | None @@ -84,7 +86,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -102,7 +124,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingStock] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingStock] ]: return Response( status_code=HTTPStatus(response.status_code), @@ -122,7 +144,7 @@ def sync_detailed( offset: int | Unset = 0, type_: GetXTrendingStocksTypeType0 | None | Unset = UNSET, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingStock] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingStock] ]: """Get trending stocks on X/Twitter @@ -162,7 +184,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingStock]] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingStock]] """ kwargs = _get_kwargs( @@ -193,6 +215,7 @@ def sync( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[XTrendingStock] | None @@ -235,7 +258,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingStock] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingStock] """ return sync_detailed( @@ -259,7 +282,7 @@ async def asyncio_detailed( offset: int | Unset = 0, type_: GetXTrendingStocksTypeType0 | None | Unset = UNSET, ) -> Response[ - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingStock] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingStock] ]: """Get trending stocks on X/Twitter @@ -299,7 +322,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingStock]] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingStock]] """ kwargs = _get_kwargs( @@ -328,6 +351,7 @@ async def asyncio( ) -> ( ErrorResponse | HTTPValidationError + | InvalidPeriodError | HistoricalLimitError | list[XTrendingStock] | None @@ -370,7 +394,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | list[XTrendingStock] + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | list[XTrendingStock] """ return ( diff --git a/src/adanos/_generated/api/x_twitter_stocks/search_x_stocks.py b/src/adanos/_generated/api/x_twitter_stocks/search_x_stocks.py index c3af2ef..7acaa33 100644 --- a/src/adanos/_generated/api/x_twitter_stocks/search_x_stocks.py +++ b/src/adanos/_generated/api/x_twitter_stocks/search_x_stocks.py @@ -8,6 +8,7 @@ from ...models.error_response import ErrorResponse from ...models.historical_limit_error import HistoricalLimitError from ...models.http_validation_error import HTTPValidationError +from ...models.invalid_period_error import InvalidPeriodError from ...models.rate_limit_error import RateLimitError from ...models.x_search_response import XSearchResponse from ...types import UNSET, Response, Unset @@ -39,7 +40,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XSearchResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XSearchResponse | None: if response.status_code == 200: response_200 = XSearchResponse.from_dict(response.json()) @@ -56,7 +57,27 @@ def _parse_response( return response_403 if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) + + def _parse_response_422(data: object) -> HTTPValidationError | InvalidPeriodError: + try: + if not isinstance(data, dict): + raise TypeError() + detail = data.get("detail") + error = str(detail.get("error", "")).lower().replace(" ", "_") if isinstance(detail, dict) else "" + if error != "invalid_period": + raise TypeError() + response_422_type_0 = InvalidPeriodError.from_dict(data) + + return response_422_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not isinstance(data, dict): + raise TypeError() + response_422_type_1 = HTTPValidationError.from_dict(data) + + return response_422_type_1 + + response_422 = _parse_response_422(response.json()) return response_422 @@ -73,7 +94,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XSearchResponse]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XSearchResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -87,7 +108,7 @@ def sync_detailed( client: AuthenticatedClient, q: str, limit: int | Unset = 20, -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XSearchResponse]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XSearchResponse]: """Search stocks Search for stocks by ticker symbol, company name, or alias in the X/Twitter universe. @@ -105,7 +126,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XSearchResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XSearchResponse] """ kwargs = _get_kwargs( @@ -125,7 +146,7 @@ def sync( client: AuthenticatedClient, q: str, limit: int | Unset = 20, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XSearchResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XSearchResponse | None: """Search stocks Search for stocks by ticker symbol, company name, or alias in the X/Twitter universe. @@ -143,7 +164,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XSearchResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XSearchResponse """ return sync_detailed( @@ -158,7 +179,7 @@ async def asyncio_detailed( client: AuthenticatedClient, q: str, limit: int | Unset = 20, -) -> Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XSearchResponse]: +) -> Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XSearchResponse]: """Search stocks Search for stocks by ticker symbol, company name, or alias in the X/Twitter universe. @@ -176,7 +197,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XSearchResponse] + Response[ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XSearchResponse] """ kwargs = _get_kwargs( @@ -194,7 +215,7 @@ async def asyncio( client: AuthenticatedClient, q: str, limit: int | Unset = 20, -) -> ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XSearchResponse | None: +) -> ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XSearchResponse | None: """Search stocks Search for stocks by ticker symbol, company name, or alias in the X/Twitter universe. @@ -212,7 +233,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - ErrorResponse | HTTPValidationError | HistoricalLimitError | RateLimitError | XSearchResponse + ErrorResponse | HTTPValidationError | InvalidPeriodError | HistoricalLimitError | RateLimitError | XSearchResponse """ return ( diff --git a/src/adanos/_generated/models/__init__.py b/src/adanos/_generated/models/__init__.py index 67ba01d..7fa6bd0 100644 --- a/src/adanos/_generated/models/__init__.py +++ b/src/adanos/_generated/models/__init__.py @@ -35,6 +35,8 @@ from .historical_limit_error import HistoricalLimitError from .historical_limit_error_detail import HistoricalLimitErrorDetail from .http_validation_error import HTTPValidationError +from .invalid_period_error import InvalidPeriodError +from .invalid_period_error_detail import InvalidPeriodErrorDetail from .news_compare_response import NewsCompareResponse from .news_compare_stock_item import NewsCompareStockItem from .news_compare_stock_item_trend_type_0 import NewsCompareStockItemTrendType0 @@ -132,6 +134,7 @@ from .x_stats_response import XStatsResponse from .x_stock_detail_response import XStockDetailResponse from .x_stock_detail_response_trend_type_0 import XStockDetailResponseTrendType0 +from .x_top_author import XTopAuthor from .x_top_tweet import XTopTweet from .x_trending_country import XTrendingCountry from .x_trending_country_trend import XTrendingCountryTrend @@ -175,6 +178,8 @@ "HistoricalLimitError", "HistoricalLimitErrorDetail", "HTTPValidationError", + "InvalidPeriodError", + "InvalidPeriodErrorDetail", "NewsCompareResponse", "NewsCompareStockItem", "NewsCompareStockItemTrendType0", @@ -272,6 +277,7 @@ "XStatsResponse", "XStockDetailResponse", "XStockDetailResponseTrendType0", + "XTopAuthor", "XTopTweet", "XTrendingCountry", "XTrendingCountryTrend", diff --git a/src/adanos/_generated/models/invalid_period_error.py b/src/adanos/_generated/models/invalid_period_error.py new file mode 100644 index 0000000..bf9c9bc --- /dev/null +++ b/src/adanos/_generated/models/invalid_period_error.py @@ -0,0 +1,68 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.invalid_period_error_detail import InvalidPeriodErrorDetail + + +T = TypeVar("T", bound="InvalidPeriodError") + + +@_attrs_define +class InvalidPeriodError: + """Error response for invalid period requests (HTTP 422). + + Attributes: + detail (InvalidPeriodErrorDetail): Structured error detail for invalid period windows. + """ + + detail: InvalidPeriodErrorDetail + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + detail = self.detail.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "detail": detail, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.invalid_period_error_detail import InvalidPeriodErrorDetail + + d = dict(src_dict) + detail = InvalidPeriodErrorDetail.from_dict(d.pop("detail")) + + invalid_period_error = cls( + detail=detail, + ) + + invalid_period_error.additional_properties = d + return invalid_period_error + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/src/adanos/_generated/models/invalid_period_error_detail.py b/src/adanos/_generated/models/invalid_period_error_detail.py new file mode 100644 index 0000000..74b04c8 --- /dev/null +++ b/src/adanos/_generated/models/invalid_period_error_detail.py @@ -0,0 +1,153 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="InvalidPeriodErrorDetail") + + +@_attrs_define +class InvalidPeriodErrorDetail: + """Structured error detail for invalid period windows. + + Attributes: + error (str): Error type identifier + message (str): Human-readable error message + period_from (datetime.date | None | Unset): Resolved inclusive UTC start date + available_since (datetime.date | None | Unset): Earliest public data date for the platform + platform (None | str | Unset): Platform identifier + """ + + error: str + message: str + period_from: datetime.date | None | Unset = UNSET + available_since: datetime.date | None | Unset = UNSET + platform: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + error = self.error + + message = self.message + + period_from: None | str | Unset + if isinstance(self.period_from, Unset): + period_from = UNSET + elif isinstance(self.period_from, datetime.date): + period_from = self.period_from.isoformat() + else: + period_from = self.period_from + + available_since: None | str | Unset + if isinstance(self.available_since, Unset): + available_since = UNSET + elif isinstance(self.available_since, datetime.date): + available_since = self.available_since.isoformat() + else: + available_since = self.available_since + + platform: None | str | Unset + if isinstance(self.platform, Unset): + platform = UNSET + else: + platform = self.platform + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "error": error, + "message": message, + } + ) + if period_from is not UNSET: + field_dict["period_from"] = period_from + if available_since is not UNSET: + field_dict["available_since"] = available_since + if platform is not UNSET: + field_dict["platform"] = platform + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + error = d.pop("error") + + message = d.pop("message") + + def _parse_period_from(data: object) -> datetime.date | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + period_from_type_0 = datetime.date.fromisoformat(data) + + return period_from_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.date | None | Unset, data) + + period_from = _parse_period_from(d.pop("period_from", UNSET)) + + def _parse_available_since(data: object) -> datetime.date | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + available_since_type_0 = datetime.date.fromisoformat(data) + + return available_since_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.date | None | Unset, data) + + available_since = _parse_available_since(d.pop("available_since", UNSET)) + + def _parse_platform(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + platform = _parse_platform(d.pop("platform", UNSET)) + + invalid_period_error_detail = cls( + error=error, + message=message, + period_from=period_from, + available_since=available_since, + platform=platform, + ) + + invalid_period_error_detail.additional_properties = d + return invalid_period_error_detail + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/src/adanos/_generated/models/x_stock_detail_response.py b/src/adanos/_generated/models/x_stock_detail_response.py index b067f25..bc8efda 100644 --- a/src/adanos/_generated/models/x_stock_detail_response.py +++ b/src/adanos/_generated/models/x_stock_detail_response.py @@ -11,6 +11,7 @@ if TYPE_CHECKING: from ..models.x_daily_trend_item import XDailyTrendItem + from ..models.x_top_author import XTopAuthor from ..models.x_top_tweet import XTopTweet @@ -43,6 +44,7 @@ class XStockDetailResponse: period_days (int | None | Unset): Analysis period in days daily_trend (list[XDailyTrendItem] | None | Unset): Daily trend data with avg_rank (X-specific) top_tweets (list[XTopTweet] | None | Unset): Top 10 tweets by engagement (likes + retweets) + top_authors (list[XTopAuthor] | None | Unset): Top X authors in the selected period. """ ticker: str @@ -62,6 +64,7 @@ class XStockDetailResponse: period_days: int | None | Unset = UNSET daily_trend: list[XDailyTrendItem] | None | Unset = UNSET top_tweets: list[XTopTweet] | None | Unset = UNSET + top_authors: list[XTopAuthor] | None | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -173,6 +176,18 @@ def to_dict(self) -> dict[str, Any]: else: top_tweets = self.top_tweets + top_authors: list[dict[str, Any]] | None | Unset + if isinstance(self.top_authors, Unset): + top_authors = UNSET + elif isinstance(self.top_authors, list): + top_authors = [] + for top_authors_type_0_item_data in self.top_authors: + top_authors_type_0_item = top_authors_type_0_item_data.to_dict() + top_authors.append(top_authors_type_0_item) + + else: + top_authors = self.top_authors + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -212,11 +227,14 @@ def to_dict(self) -> dict[str, Any]: field_dict["daily_trend"] = daily_trend if top_tweets is not UNSET: field_dict["top_tweets"] = top_tweets + if top_authors is not UNSET: + field_dict["top_authors"] = top_authors return field_dict @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.x_daily_trend_item import XDailyTrendItem + from ..models.x_top_author import XTopAuthor from ..models.x_top_tweet import XTopTweet d = dict(src_dict) @@ -397,6 +415,28 @@ def _parse_top_tweets(data: object) -> list[XTopTweet] | None | Unset: top_tweets = _parse_top_tweets(d.pop("top_tweets", UNSET)) + def _parse_top_authors(data: object) -> list[XTopAuthor] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + top_authors_type_0 = [] + _top_authors_type_0 = data + for top_authors_type_0_item_data in _top_authors_type_0: + top_authors_type_0_item = XTopAuthor.from_dict(top_authors_type_0_item_data) + + top_authors_type_0.append(top_authors_type_0_item) + + return top_authors_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[XTopAuthor] | None | Unset, data) + + top_authors = _parse_top_authors(d.pop("top_authors", UNSET)) + x_stock_detail_response = cls( ticker=ticker, company_name=company_name, @@ -415,6 +455,7 @@ def _parse_top_tweets(data: object) -> list[XTopTweet] | None | Unset: period_days=period_days, daily_trend=daily_trend, top_tweets=top_tweets, + top_authors=top_authors, ) x_stock_detail_response.additional_properties = d diff --git a/src/adanos/_generated/models/x_top_author.py b/src/adanos/_generated/models/x_top_author.py new file mode 100644 index 0000000..a6fdfd0 --- /dev/null +++ b/src/adanos/_generated/models/x_top_author.py @@ -0,0 +1,121 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="XTopAuthor") + + +@_attrs_define +class XTopAuthor: + """X author contributor metrics for a stock detail response. + + Attributes: + author (str): Public X/Twitter username + mentions (int): Tweet mentions by this author in the selected period + count (int): Deprecated API alias for mentions. Use mentions instead. + sentiment_score (float | None | Unset): Average sentiment score for this author's mentions in the selected + period + buzz_score (float | None | Unset): Contributor-level buzz score for this author in the selected period + """ + + author: str + mentions: int + count: int + sentiment_score: float | None | Unset = UNSET + buzz_score: float | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + author = self.author + + mentions = self.mentions + + count = self.count + + sentiment_score: float | None | Unset + if isinstance(self.sentiment_score, Unset): + sentiment_score = UNSET + else: + sentiment_score = self.sentiment_score + + buzz_score: float | None | Unset + if isinstance(self.buzz_score, Unset): + buzz_score = UNSET + else: + buzz_score = self.buzz_score + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "author": author, + "mentions": mentions, + "count": count, + } + ) + if sentiment_score is not UNSET: + field_dict["sentiment_score"] = sentiment_score + if buzz_score is not UNSET: + field_dict["buzz_score"] = buzz_score + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + author = d.pop("author") + + mentions = d.pop("mentions") + + count = d.pop("count") + + def _parse_sentiment_score(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + sentiment_score = _parse_sentiment_score(d.pop("sentiment_score", UNSET)) + + def _parse_buzz_score(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + buzz_score = _parse_buzz_score(d.pop("buzz_score", UNSET)) + + x_top_author = cls( + author=author, + mentions=mentions, + count=count, + sentiment_score=sentiment_score, + buzz_score=buzz_score, + ) + + x_top_author.additional_properties = d + return x_top_author + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/tests/test_wrapper.py b/tests/test_wrapper.py index 2a20c65..b43f984 100644 --- a/tests/test_wrapper.py +++ b/tests/test_wrapper.py @@ -232,6 +232,15 @@ def request_params(route) -> dict: "buzz_score": 74.1, } ], + "top_authors": [ + { + "author": "marketwatcher", + "mentions": 24, + "sentiment_score": 0.41, + "buzz_score": 61.8, + "count": 24, + } + ], } POLYMARKET_TRENDING_STOCK = { @@ -973,6 +982,8 @@ def test_stock(self, client): assert "is_validated" not in result.to_dict() assert not hasattr(result, "is_validated") assert result.daily_trend[0].sentiment_score == 0.244 + assert result.top_authors[0].author == "marketwatcher" + assert result.top_authors[0].mentions == 24 @respx.mock def test_mentions(self, client): @@ -1271,16 +1282,54 @@ def test_429_returns_error_response(self, client): assert result.detail == "Rate limit exceeded" @respx.mock - def test_422_dict_detail_returns_validation_response(self, client): - """Custom 422 envelopes should not crash the generated validation parser.""" - payload = {"detail": {"error": "Invalid period", "message": "Use either from or days, not both."}} + def test_422_invalid_period_returns_structured_error(self, client): + """API 1.40 invalid-period envelopes should parse as InvalidPeriodError.""" + from adanos._generated.models import InvalidPeriodError + + payload = { + "detail": { + "error": "Invalid period", + "message": "Use either from or days, not both.", + "period_from": "2026-01-01", + "available_since": "2026-03-01", + "platform": "reddit-stocks", + } + } respx.get(f"{BASE_URL}/reddit/stocks/v1/trending").mock( return_value=httpx.Response(422, json=payload) ) result = client.reddit.trending(from_="2026-05-01", to="2026-05-07", days=7) + assert isinstance(result, InvalidPeriodError) + assert result.detail.available_since.isoformat() == "2026-03-01" + assert result.to_dict() == payload + + @respx.mock + def test_422_non_period_dict_detail_is_preserved(self, client): + """Non-period custom 422 envelopes should remain generic validation responses.""" + payload = {"detail": {"error": "bad_query", "message": "Query is invalid."}} + respx.get(f"{BASE_URL}/reddit/stocks/v1/search").mock( + return_value=httpx.Response(422, json=payload) + ) + result = client.reddit.search("bad") assert result.to_dict() == payload assert result["detail"] == payload["detail"] + def test_invalid_period_error_model_round_trips_dates(self): + from adanos._generated.models import InvalidPeriodError + + payload = { + "detail": { + "error": "invalid_period", + "message": "Requested period predates available data.", + "period_from": "2026-01-01", + "available_since": "2026-03-01", + "platform": "x-stocks", + } + } + result = InvalidPeriodError.from_dict(payload) + assert result.detail.period_from.isoformat() == "2026-01-01" + assert result.to_dict() == payload + @respx.mock def test_422_non_validation_list_detail_is_preserved(self, client): """Unexpected 422 list envelopes should be preserved instead of parsed as validation errors."""