diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 51b5b3b..442f2c3 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -12,10 +12,6 @@ jobs: publish: name: publish runs-on: ubuntu-latest - environment: pypi - permissions: - contents: read - id-token: write steps: - uses: actions/checkout@v6 @@ -28,3 +24,5 @@ jobs: - name: Publish to PyPI run: | bash ./bin/publish-pypi + env: + PYPI_TOKEN: ${{ secrets.X_TWITTER_SCRAPER_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 8c7b433..a19b2e1 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -17,3 +17,5 @@ jobs: - name: Check release environment run: | bash ./bin/check-release-environment + env: + PYPI_TOKEN: ${{ secrets.X_TWITTER_SCRAPER_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4c5a1a0..10f3091 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.3" + ".": "0.2.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 9f265c5..58aca93 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 115 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/xquik%2Fx-twitter-scraper-af60c455e2c8579c3d7f0e33c07c0b8332aa3fe8869688c47b2fbf151e271235.yml -openapi_spec_hash: a49d40286e54da6a4978a103b118d33f -config_hash: cec075ca53645b9620ec200be71bdc48 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/xquik%2Fx-twitter-scraper-3b2c6c771ad1da0bbfeb0af115972929ed2c7fcd5e47a79556d66cd21431b224.yml +openapi_spec_hash: de2890233b68387bf5f9b6d19e7d87dc +config_hash: 8894c96caeb6df84c9394518810221bd diff --git a/CHANGELOG.md b/CHANGELOG.md index 1584dfc..1d41f94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.2.0 (2026-04-01) + +Full Changelog: [v0.1.3...v0.2.0](https://github.com/Xquik-dev/x-twitter-scraper-python/compare/v0.1.3...v0.2.0) + +### Features + +* **api:** api update ([dcfbf4f](https://github.com/Xquik-dev/x-twitter-scraper-python/commit/dcfbf4f110165019fa851654c1911715009be8bb)) +* **api:** api update ([017a1e4](https://github.com/Xquik-dev/x-twitter-scraper-python/commit/017a1e4dd340690e38449cb036f40d3f6b1360b9)) + + +### Chores + +* update SDK settings ([3f45efe](https://github.com/Xquik-dev/x-twitter-scraper-python/commit/3f45efe97044b419663bd45d9f769bf2af860c0b)) + ## 0.1.3 (2026-03-30) Full Changelog: [v0.1.2...v0.1.3](https://github.com/Xquik-dev/x-twitter-scraper-python/compare/v0.1.2...v0.1.3) diff --git a/README.md b/README.md index 369d36c..fc7cafa 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,11 @@ client = XTwitterScraper( api_key=os.environ.get("X_TWITTER_SCRAPER_API_KEY"), # This is the default and can be omitted ) -paginated_tweets = client.x.tweets.search( +response = client.x.tweets.search( q="from:elonmusk", limit=10, ) -print(paginated_tweets.has_next_page) +print(response.has_next_page) ``` While you can provide an `api_key` keyword argument, @@ -59,11 +59,11 @@ client = AsyncXTwitterScraper( async def main() -> None: - paginated_tweets = await client.x.tweets.search( + response = await client.x.tweets.search( q="from:elonmusk", limit=10, ) - print(paginated_tweets.has_next_page) + print(response.has_next_page) asyncio.run(main()) @@ -98,11 +98,11 @@ async def main() -> None: ), # This is the default and can be omitted http_client=DefaultAioHttpClient(), ) as client: - paginated_tweets = await client.x.tweets.search( + response = await client.x.tweets.search( q="from:elonmusk", limit=10, ) - print(paginated_tweets.has_next_page) + print(response.has_next_page) asyncio.run(main()) diff --git a/api.md b/api.md index 0ff95cc..871189b 100644 --- a/api.md +++ b/api.md @@ -70,13 +70,19 @@ Methods: Types: ```python -from x_twitter_scraper.types import Draft, DraftDetail, DraftListResponse +from x_twitter_scraper.types import ( + Draft, + DraftDetail, + DraftCreateResponse, + DraftRetrieveResponse, + DraftListResponse, +) ``` Methods: -- client.drafts.create(\*\*params) -> DraftDetail -- client.drafts.retrieve(id) -> DraftDetail +- client.drafts.create(\*\*params) -> DraftCreateResponse +- client.drafts.retrieve(id) -> DraftRetrieveResponse - client.drafts.list(\*\*params) -> DraftListResponse - client.drafts.delete(id) -> None @@ -88,7 +94,10 @@ Types: from x_twitter_scraper.types import ( StyleProfile, StyleProfileSummary, + StyleRetrieveResponse, + StyleUpdateResponse, StyleListResponse, + StyleAnalyzeResponse, StyleCompareResponse, StyleGetPerformanceResponse, ) @@ -96,11 +105,11 @@ from x_twitter_scraper.types import ( Methods: -- client.styles.retrieve(username) -> StyleProfile -- client.styles.update(username, \*\*params) -> StyleProfile +- client.styles.retrieve(username) -> StyleRetrieveResponse +- client.styles.update(username, \*\*params) -> StyleUpdateResponse - client.styles.list() -> StyleListResponse - client.styles.delete(username) -> None -- client.styles.analyze(\*\*params) -> StyleProfile +- client.styles.analyze(\*\*params) -> StyleAnalyzeResponse - client.styles.compare(\*\*params) -> StyleCompareResponse - client.styles.get_performance(username) -> StyleGetPerformanceResponse @@ -124,6 +133,8 @@ Types: from x_twitter_scraper.types import ( Monitor, MonitorCreateResponse, + MonitorRetrieveResponse, + MonitorUpdateResponse, MonitorListResponse, MonitorDeactivateResponse, ) @@ -132,8 +143,8 @@ from x_twitter_scraper.types import ( Methods: - client.monitors.create(\*\*params) -> MonitorCreateResponse -- client.monitors.retrieve(id) -> Monitor -- client.monitors.update(id, \*\*params) -> Monitor +- client.monitors.retrieve(id) -> MonitorRetrieveResponse +- client.monitors.update(id, \*\*params) -> MonitorUpdateResponse - client.monitors.list() -> MonitorListResponse - client.monitors.deactivate(id) -> MonitorDeactivateResponse @@ -142,12 +153,12 @@ Methods: Types: ```python -from x_twitter_scraper.types import Event, EventDetail, EventListResponse +from x_twitter_scraper.types import Event, EventDetail, EventRetrieveResponse, EventListResponse ``` Methods: -- client.events.retrieve(id) -> EventDetail +- client.events.retrieve(id) -> EventRetrieveResponse - client.events.list(\*\*params) -> EventListResponse # Extractions @@ -203,6 +214,7 @@ from x_twitter_scraper.types import ( Delivery, Webhook, WebhookCreateResponse, + WebhookUpdateResponse, WebhookListResponse, WebhookDeactivateResponse, WebhookListDeliveriesResponse, @@ -213,7 +225,7 @@ from x_twitter_scraper.types import ( Methods: - client.webhooks.create(\*\*params) -> WebhookCreateResponse -- client.webhooks.update(id, \*\*params) -> Webhook +- client.webhooks.update(id, \*\*params) -> WebhookUpdateResponse - client.webhooks.list() -> WebhookListResponse - client.webhooks.deactivate(id) -> WebhookDeactivateResponse - client.webhooks.list_deliveries(id) -> WebhookListDeliveriesResponse @@ -227,6 +239,9 @@ Types: from x_twitter_scraper.types import ( Integration, IntegrationDelivery, + IntegrationCreateResponse, + IntegrationRetrieveResponse, + IntegrationUpdateResponse, IntegrationListResponse, IntegrationDeleteResponse, IntegrationListDeliveriesResponse, @@ -236,9 +251,9 @@ from x_twitter_scraper.types import ( Methods: -- client.integrations.create(\*\*params) -> Integration -- client.integrations.retrieve(id) -> Integration -- client.integrations.update(id, \*\*params) -> Integration +- client.integrations.create(\*\*params) -> IntegrationCreateResponse +- client.integrations.retrieve(id) -> IntegrationRetrieveResponse +- client.integrations.update(id, \*\*params) -> IntegrationUpdateResponse - client.integrations.list() -> IntegrationListResponse - client.integrations.delete(id) -> IntegrationDeleteResponse - client.integrations.list_deliveries(id, \*\*params) -> IntegrationListDeliveriesResponse @@ -249,13 +264,17 @@ Methods: Types: ```python -from x_twitter_scraper.types import XGetArticleResponse, XGetNotificationsResponse +from x_twitter_scraper.types import ( + XGetArticleResponse, + XGetHomeTimelineResponse, + XGetNotificationsResponse, +) ``` Methods: - client.x.get_article(tweet_id) -> XGetArticleResponse -- client.x.get_home_timeline(\*\*params) -> PaginatedTweets +- client.x.get_home_timeline(\*\*params) -> XGetHomeTimelineResponse - client.x.get_notifications(\*\*params) -> XGetNotificationsResponse - client.x.get_trends() -> None @@ -271,6 +290,12 @@ from x_twitter_scraper.types.x import ( TweetCreateResponse, TweetRetrieveResponse, TweetDeleteResponse, + TweetGetFavoritersResponse, + TweetGetQuotesResponse, + TweetGetRepliesResponse, + TweetGetRetweetersResponse, + TweetGetThreadResponse, + TweetSearchResponse, ) ``` @@ -280,12 +305,12 @@ Methods: - client.x.tweets.retrieve(tweet_id) -> TweetRetrieveResponse - client.x.tweets.list(\*\*params) -> None - client.x.tweets.delete(tweet_id, \*\*params) -> TweetDeleteResponse -- client.x.tweets.get_favoriters(id, \*\*params) -> PaginatedUsers -- client.x.tweets.get_quotes(id, \*\*params) -> PaginatedTweets -- client.x.tweets.get_replies(id, \*\*params) -> PaginatedTweets -- client.x.tweets.get_retweeters(id, \*\*params) -> PaginatedUsers -- client.x.tweets.get_thread(id, \*\*params) -> PaginatedTweets -- client.x.tweets.search(\*\*params) -> PaginatedTweets +- client.x.tweets.get_favoriters(id, \*\*params) -> TweetGetFavoritersResponse +- client.x.tweets.get_quotes(id, \*\*params) -> TweetGetQuotesResponse +- client.x.tweets.get_replies(id, \*\*params) -> TweetGetRepliesResponse +- client.x.tweets.get_retweeters(id, \*\*params) -> TweetGetRetweetersResponse +- client.x.tweets.get_thread(id, \*\*params) -> TweetGetThreadResponse +- client.x.tweets.search(\*\*params) -> TweetSearchResponse ### Like @@ -318,21 +343,28 @@ Methods: Types: ```python -from x_twitter_scraper.types.x import UserProfile +from x_twitter_scraper.types.x import ( + UserProfile, + UserRetrieveResponse, + UserRetrieveFollowersYouKnowResponse, + UserRetrieveLikesResponse, + UserRetrieveMediaResponse, + UserRetrieveTweetsResponse, +) ``` Methods: -- client.x.users.retrieve(username) -> UserProfile +- client.x.users.retrieve(username) -> UserRetrieveResponse - client.x.users.retrieve_batch(\*\*params) -> None - client.x.users.retrieve_followers(id, \*\*params) -> None -- client.x.users.retrieve_followers_you_know(id, \*\*params) -> PaginatedUsers +- client.x.users.retrieve_followers_you_know(id, \*\*params) -> UserRetrieveFollowersYouKnowResponse - client.x.users.retrieve_following(id, \*\*params) -> None -- client.x.users.retrieve_likes(id, \*\*params) -> PaginatedTweets -- client.x.users.retrieve_media(id, \*\*params) -> PaginatedTweets +- client.x.users.retrieve_likes(id, \*\*params) -> UserRetrieveLikesResponse +- client.x.users.retrieve_media(id, \*\*params) -> UserRetrieveMediaResponse - client.x.users.retrieve_mentions(id, \*\*params) -> None - client.x.users.retrieve_search(\*\*params) -> None -- client.x.users.retrieve_tweets(id, \*\*params) -> PaginatedTweets +- client.x.users.retrieve_tweets(id, \*\*params) -> UserRetrieveTweetsResponse - client.x.users.retrieve_verified_followers(id, \*\*params) -> None ### Follow @@ -428,10 +460,16 @@ Methods: ### Join +Types: + +```python +from x_twitter_scraper.types.x.communities import JoinCreateResponse, JoinDeleteAllResponse +``` + Methods: -- client.x.communities.join.create(id, \*\*params) -> CommunityActionResult -- client.x.communities.join.delete_all(id, \*\*params) -> CommunityActionResult +- client.x.communities.join.create(id, \*\*params) -> JoinCreateResponse +- client.x.communities.join.delete_all(id, \*\*params) -> JoinDeleteAllResponse ### Tweets @@ -448,6 +486,7 @@ from x_twitter_scraper.types.x import ( XAccount, XAccountDetail, AccountCreateResponse, + AccountRetrieveResponse, AccountListResponse, AccountDeleteResponse, AccountReauthResponse, @@ -457,7 +496,7 @@ from x_twitter_scraper.types.x import ( Methods: - client.x.accounts.create(\*\*params) -> AccountCreateResponse -- client.x.accounts.retrieve(id) -> XAccountDetail +- client.x.accounts.retrieve(id) -> AccountRetrieveResponse - client.x.accounts.list() -> AccountListResponse - client.x.accounts.delete(id) -> AccountDeleteResponse - client.x.accounts.reauth(id, \*\*params) -> AccountReauthResponse @@ -467,12 +506,12 @@ Methods: Types: ```python -from x_twitter_scraper.types.x import BookmarkRetrieveFoldersResponse +from x_twitter_scraper.types.x import BookmarkListResponse, BookmarkRetrieveFoldersResponse ``` Methods: -- client.x.bookmarks.list(\*\*params) -> PaginatedTweets +- client.x.bookmarks.list(\*\*params) -> BookmarkListResponse - client.x.bookmarks.retrieve_folders() -> BookmarkRetrieveFoldersResponse ## Lists diff --git a/bin/check-release-environment b/bin/check-release-environment index 1e951e9..b845b0f 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,6 +2,10 @@ errors=() +if [ -z "${PYPI_TOKEN}" ]; then + errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") +fi + lenErrors=${#errors[@]} if [[ lenErrors -gt 0 ]]; then diff --git a/bin/publish-pypi b/bin/publish-pypi index 5895700..e72ca2f 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -4,8 +4,4 @@ set -eux rm -rf dist mkdir -p dist uv build -if [ -n "${PYPI_TOKEN:-}" ]; then - uv publish --token=$PYPI_TOKEN -else - uv publish -fi +uv publish --token=$PYPI_TOKEN diff --git a/pyproject.toml b/pyproject.toml index 3dbbceb..5392fff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "x_twitter_scraper" -version = "0.1.3" +version = "0.2.0" description = "The official Python library for the x-twitter-scraper API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/x_twitter_scraper/_version.py b/src/x_twitter_scraper/_version.py index 4aa53c1..ce04647 100644 --- a/src/x_twitter_scraper/_version.py +++ b/src/x_twitter_scraper/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "x_twitter_scraper" -__version__ = "0.1.3" # x-release-please-version +__version__ = "0.2.0" # x-release-please-version diff --git a/src/x_twitter_scraper/resources/drafts.py b/src/x_twitter_scraper/resources/drafts.py index fa0c714..4b6a278 100644 --- a/src/x_twitter_scraper/resources/drafts.py +++ b/src/x_twitter_scraper/resources/drafts.py @@ -18,8 +18,9 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.draft_detail import DraftDetail from ..types.draft_list_response import DraftListResponse +from ..types.draft_create_response import DraftCreateResponse +from ..types.draft_retrieve_response import DraftRetrieveResponse __all__ = ["DraftsResource", "AsyncDraftsResource"] @@ -58,7 +59,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> DraftDetail: + ) -> DraftCreateResponse: """ Save a tweet draft @@ -84,7 +85,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DraftDetail, + cast_to=DraftCreateResponse, ) def retrieve( @@ -97,7 +98,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> DraftDetail: + ) -> DraftRetrieveResponse: """ Get draft by ID @@ -117,7 +118,7 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DraftDetail, + cast_to=DraftRetrieveResponse, ) def list( @@ -233,7 +234,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> DraftDetail: + ) -> DraftCreateResponse: """ Save a tweet draft @@ -259,7 +260,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DraftDetail, + cast_to=DraftCreateResponse, ) async def retrieve( @@ -272,7 +273,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> DraftDetail: + ) -> DraftRetrieveResponse: """ Get draft by ID @@ -292,7 +293,7 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DraftDetail, + cast_to=DraftRetrieveResponse, ) async def list( diff --git a/src/x_twitter_scraper/resources/events.py b/src/x_twitter_scraper/resources/events.py index 5b044e8..f603cf5 100644 --- a/src/x_twitter_scraper/resources/events.py +++ b/src/x_twitter_scraper/resources/events.py @@ -2,6 +2,8 @@ from __future__ import annotations +from typing_extensions import Literal + import httpx from ..types import event_list_params @@ -16,9 +18,8 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.event_detail import EventDetail -from ..types.shared.event_type import EventType from ..types.event_list_response import EventListResponse +from ..types.event_retrieve_response import EventRetrieveResponse __all__ = ["EventsResource", "AsyncEventsResource"] @@ -55,7 +56,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> EventDetail: + ) -> EventRetrieveResponse: """ Get event @@ -75,14 +76,17 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=EventDetail, + cast_to=EventRetrieveResponse, ) def list( self, *, after: str | Omit = omit, - event_type: EventType | Omit = omit, + event_type: Literal[ + "tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost" + ] + | Omit = omit, limit: int | Omit = omit, monitor_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -160,7 +164,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> EventDetail: + ) -> EventRetrieveResponse: """ Get event @@ -180,14 +184,17 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=EventDetail, + cast_to=EventRetrieveResponse, ) async def list( self, *, after: str | Omit = omit, - event_type: EventType | Omit = omit, + event_type: Literal[ + "tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost" + ] + | Omit = omit, limit: int | Omit = omit, monitor_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/x_twitter_scraper/resources/integrations.py b/src/x_twitter_scraper/resources/integrations.py index 5737f03..ce48230 100644 --- a/src/x_twitter_scraper/resources/integrations.py +++ b/src/x_twitter_scraper/resources/integrations.py @@ -19,10 +19,11 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.integration import Integration -from ..types.shared.event_type import EventType from ..types.integration_list_response import IntegrationListResponse +from ..types.integration_create_response import IntegrationCreateResponse from ..types.integration_delete_response import IntegrationDeleteResponse +from ..types.integration_update_response import IntegrationUpdateResponse +from ..types.integration_retrieve_response import IntegrationRetrieveResponse from ..types.integration_send_test_response import IntegrationSendTestResponse from ..types.integration_list_deliveries_response import IntegrationListDeliveriesResponse @@ -55,7 +56,9 @@ def create( self, *, config: integration_create_params.Config, - event_types: List[EventType], + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ], name: str, type: Literal["telegram"], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -64,7 +67,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Integration: + ) -> IntegrationCreateResponse: """Create integration Args: @@ -94,7 +97,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Integration, + cast_to=IntegrationCreateResponse, ) def retrieve( @@ -107,7 +110,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Integration: + ) -> IntegrationRetrieveResponse: """ Get integration details @@ -127,14 +130,17 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Integration, + cast_to=IntegrationRetrieveResponse, ) def update( self, id: str, *, - event_types: List[EventType] | Omit = omit, + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] + | Omit = omit, filters: Dict[str, object] | Omit = omit, is_active: bool | Omit = omit, message_template: Dict[str, object] | Omit = omit, @@ -147,7 +153,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Integration: + ) -> IntegrationUpdateResponse: """ Update integration @@ -179,7 +185,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Integration, + cast_to=IntegrationUpdateResponse, ) def list( @@ -334,7 +340,9 @@ async def create( self, *, config: integration_create_params.Config, - event_types: List[EventType], + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ], name: str, type: Literal["telegram"], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -343,7 +351,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Integration: + ) -> IntegrationCreateResponse: """Create integration Args: @@ -373,7 +381,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Integration, + cast_to=IntegrationCreateResponse, ) async def retrieve( @@ -386,7 +394,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Integration: + ) -> IntegrationRetrieveResponse: """ Get integration details @@ -406,14 +414,17 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Integration, + cast_to=IntegrationRetrieveResponse, ) async def update( self, id: str, *, - event_types: List[EventType] | Omit = omit, + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] + | Omit = omit, filters: Dict[str, object] | Omit = omit, is_active: bool | Omit = omit, message_template: Dict[str, object] | Omit = omit, @@ -426,7 +437,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Integration: + ) -> IntegrationUpdateResponse: """ Update integration @@ -458,7 +469,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Integration, + cast_to=IntegrationUpdateResponse, ) async def list( diff --git a/src/x_twitter_scraper/resources/monitors.py b/src/x_twitter_scraper/resources/monitors.py index 5294d61..9058daf 100644 --- a/src/x_twitter_scraper/resources/monitors.py +++ b/src/x_twitter_scraper/resources/monitors.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import List +from typing_extensions import Literal import httpx @@ -18,10 +19,10 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.monitor import Monitor -from ..types.shared.event_type import EventType from ..types.monitor_list_response import MonitorListResponse from ..types.monitor_create_response import MonitorCreateResponse +from ..types.monitor_update_response import MonitorUpdateResponse +from ..types.monitor_retrieve_response import MonitorRetrieveResponse from ..types.monitor_deactivate_response import MonitorDeactivateResponse __all__ = ["MonitorsResource", "AsyncMonitorsResource"] @@ -52,7 +53,9 @@ def with_streaming_response(self) -> MonitorsResourceWithStreamingResponse: def create( self, *, - event_types: List[EventType], + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ], username: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -100,7 +103,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Monitor: + ) -> MonitorRetrieveResponse: """ Get monitor @@ -120,14 +123,17 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Monitor, + cast_to=MonitorRetrieveResponse, ) def update( self, id: str, *, - event_types: List[EventType] | Omit = omit, + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] + | Omit = omit, is_active: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -135,7 +141,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Monitor: + ) -> MonitorUpdateResponse: """ Update monitor @@ -162,7 +168,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Monitor, + cast_to=MonitorUpdateResponse, ) def list( @@ -243,7 +249,9 @@ def with_streaming_response(self) -> AsyncMonitorsResourceWithStreamingResponse: async def create( self, *, - event_types: List[EventType], + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ], username: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -291,7 +299,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Monitor: + ) -> MonitorRetrieveResponse: """ Get monitor @@ -311,14 +319,17 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Monitor, + cast_to=MonitorRetrieveResponse, ) async def update( self, id: str, *, - event_types: List[EventType] | Omit = omit, + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] + | Omit = omit, is_active: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -326,7 +337,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Monitor: + ) -> MonitorUpdateResponse: """ Update monitor @@ -353,7 +364,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Monitor, + cast_to=MonitorUpdateResponse, ) async def list( diff --git a/src/x_twitter_scraper/resources/styles.py b/src/x_twitter_scraper/resources/styles.py index 180b13d..4f1eee3 100644 --- a/src/x_twitter_scraper/resources/styles.py +++ b/src/x_twitter_scraper/resources/styles.py @@ -18,9 +18,11 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.style_profile import StyleProfile from ..types.style_list_response import StyleListResponse +from ..types.style_update_response import StyleUpdateResponse +from ..types.style_analyze_response import StyleAnalyzeResponse from ..types.style_compare_response import StyleCompareResponse +from ..types.style_retrieve_response import StyleRetrieveResponse from ..types.style_get_performance_response import StyleGetPerformanceResponse __all__ = ["StylesResource", "AsyncStylesResource"] @@ -58,7 +60,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StyleProfile: + ) -> StyleRetrieveResponse: """ Get cached style profile @@ -78,7 +80,7 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StyleProfile, + cast_to=StyleRetrieveResponse, ) def update( @@ -93,7 +95,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StyleProfile: + ) -> StyleUpdateResponse: """ Save style profile with custom tweets @@ -124,7 +126,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StyleProfile, + cast_to=StyleUpdateResponse, ) def list( @@ -190,7 +192,7 @@ def analyze( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StyleProfile: + ) -> StyleAnalyzeResponse: """ Analyze writing style from recent tweets @@ -211,7 +213,7 @@ def analyze( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StyleProfile, + cast_to=StyleAnalyzeResponse, ) def compare( @@ -326,7 +328,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StyleProfile: + ) -> StyleRetrieveResponse: """ Get cached style profile @@ -346,7 +348,7 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StyleProfile, + cast_to=StyleRetrieveResponse, ) async def update( @@ -361,7 +363,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StyleProfile: + ) -> StyleUpdateResponse: """ Save style profile with custom tweets @@ -392,7 +394,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StyleProfile, + cast_to=StyleUpdateResponse, ) async def list( @@ -458,7 +460,7 @@ async def analyze( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StyleProfile: + ) -> StyleAnalyzeResponse: """ Analyze writing style from recent tweets @@ -479,7 +481,7 @@ async def analyze( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StyleProfile, + cast_to=StyleAnalyzeResponse, ) async def compare( diff --git a/src/x_twitter_scraper/resources/webhooks.py b/src/x_twitter_scraper/resources/webhooks.py index 1a9bf2d..60819e7 100644 --- a/src/x_twitter_scraper/resources/webhooks.py +++ b/src/x_twitter_scraper/resources/webhooks.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import List +from typing_extensions import Literal import httpx @@ -18,11 +19,10 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.webhook import Webhook -from ..types.shared.event_type import EventType from ..types.webhook_list_response import WebhookListResponse from ..types.webhook_test_response import WebhookTestResponse from ..types.webhook_create_response import WebhookCreateResponse +from ..types.webhook_update_response import WebhookUpdateResponse from ..types.webhook_deactivate_response import WebhookDeactivateResponse from ..types.webhook_list_deliveries_response import WebhookListDeliveriesResponse @@ -54,7 +54,9 @@ def with_streaming_response(self) -> WebhooksResourceWithStreamingResponse: def create( self, *, - event_types: List[EventType], + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ], url: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -96,7 +98,10 @@ def update( self, id: str, *, - event_types: List[EventType] | Omit = omit, + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] + | Omit = omit, is_active: bool | Omit = omit, url: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -105,7 +110,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Webhook: + ) -> WebhookUpdateResponse: """ Update webhook @@ -133,7 +138,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Webhook, + cast_to=WebhookUpdateResponse, ) def list( @@ -280,7 +285,9 @@ def with_streaming_response(self) -> AsyncWebhooksResourceWithStreamingResponse: async def create( self, *, - event_types: List[EventType], + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ], url: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -322,7 +329,10 @@ async def update( self, id: str, *, - event_types: List[EventType] | Omit = omit, + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] + | Omit = omit, is_active: bool | Omit = omit, url: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -331,7 +341,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Webhook: + ) -> WebhookUpdateResponse: """ Update webhook @@ -359,7 +369,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Webhook, + cast_to=WebhookUpdateResponse, ) async def list( diff --git a/src/x_twitter_scraper/resources/x/accounts.py b/src/x_twitter_scraper/resources/x/accounts.py index 89dcaa8..6ebfb38 100644 --- a/src/x_twitter_scraper/resources/x/accounts.py +++ b/src/x_twitter_scraper/resources/x/accounts.py @@ -16,11 +16,11 @@ async_to_streamed_response_wrapper, ) from ..._base_client import make_request_options -from ...types.x.x_account_detail import XAccountDetail from ...types.x.account_list_response import AccountListResponse from ...types.x.account_create_response import AccountCreateResponse from ...types.x.account_delete_response import AccountDeleteResponse from ...types.x.account_reauth_response import AccountReauthResponse +from ...types.x.account_retrieve_response import AccountRetrieveResponse __all__ = ["AccountsResource", "AsyncAccountsResource"] @@ -116,7 +116,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> XAccountDetail: + ) -> AccountRetrieveResponse: """ Get X account details @@ -140,7 +140,7 @@ def retrieve( timeout=timeout, security={}, ), - cast_to=XAccountDetail, + cast_to=AccountRetrieveResponse, ) def list( @@ -345,7 +345,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> XAccountDetail: + ) -> AccountRetrieveResponse: """ Get X account details @@ -369,7 +369,7 @@ async def retrieve( timeout=timeout, security={}, ), - cast_to=XAccountDetail, + cast_to=AccountRetrieveResponse, ) async def list( diff --git a/src/x_twitter_scraper/resources/x/bookmarks.py b/src/x_twitter_scraper/resources/x/bookmarks.py index 21298ac..b1be423 100644 --- a/src/x_twitter_scraper/resources/x/bookmarks.py +++ b/src/x_twitter_scraper/resources/x/bookmarks.py @@ -16,7 +16,7 @@ async_to_streamed_response_wrapper, ) from ..._base_client import make_request_options -from ...types.shared.paginated_tweets import PaginatedTweets +from ...types.x.bookmark_list_response import BookmarkListResponse from ...types.x.bookmark_retrieve_folders_response import BookmarkRetrieveFoldersResponse __all__ = ["BookmarksResource", "AsyncBookmarksResource"] @@ -55,7 +55,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> BookmarkListResponse: """ Get bookmarked tweets @@ -87,7 +87,7 @@ def list( bookmark_list_params.BookmarkListParams, ), ), - cast_to=PaginatedTweets, + cast_to=BookmarkListResponse, ) def retrieve_folders( @@ -143,7 +143,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> BookmarkListResponse: """ Get bookmarked tweets @@ -175,7 +175,7 @@ async def list( bookmark_list_params.BookmarkListParams, ), ), - cast_to=PaginatedTweets, + cast_to=BookmarkListResponse, ) async def retrieve_folders( diff --git a/src/x_twitter_scraper/resources/x/communities/join.py b/src/x_twitter_scraper/resources/x/communities/join.py index 1510490..21cbb68 100644 --- a/src/x_twitter_scraper/resources/x/communities/join.py +++ b/src/x_twitter_scraper/resources/x/communities/join.py @@ -16,7 +16,8 @@ ) from ...._base_client import make_request_options from ....types.x.communities import join_create_params, join_delete_all_params -from ....types.x.community_action_result import CommunityActionResult +from ....types.x.communities.join_create_response import JoinCreateResponse +from ....types.x.communities.join_delete_all_response import JoinDeleteAllResponse __all__ = ["JoinResource", "AsyncJoinResource"] @@ -54,7 +55,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CommunityActionResult: + ) -> JoinCreateResponse: """ Join community @@ -77,7 +78,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CommunityActionResult, + cast_to=JoinCreateResponse, ) def delete_all( @@ -91,7 +92,7 @@ def delete_all( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CommunityActionResult: + ) -> JoinDeleteAllResponse: """ Leave community @@ -114,7 +115,7 @@ def delete_all( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CommunityActionResult, + cast_to=JoinDeleteAllResponse, ) @@ -151,7 +152,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CommunityActionResult: + ) -> JoinCreateResponse: """ Join community @@ -174,7 +175,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CommunityActionResult, + cast_to=JoinCreateResponse, ) async def delete_all( @@ -188,7 +189,7 @@ async def delete_all( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CommunityActionResult: + ) -> JoinDeleteAllResponse: """ Leave community @@ -211,7 +212,7 @@ async def delete_all( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CommunityActionResult, + cast_to=JoinDeleteAllResponse, ) diff --git a/src/x_twitter_scraper/resources/x/tweets/tweets.py b/src/x_twitter_scraper/resources/x/tweets/tweets.py index 91e440a..173d77f 100644 --- a/src/x_twitter_scraper/resources/x/tweets/tweets.py +++ b/src/x_twitter_scraper/resources/x/tweets/tweets.py @@ -44,11 +44,15 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options -from ....types.shared.paginated_users import PaginatedUsers -from ....types.shared.paginated_tweets import PaginatedTweets from ....types.x.tweet_create_response import TweetCreateResponse from ....types.x.tweet_delete_response import TweetDeleteResponse +from ....types.x.tweet_search_response import TweetSearchResponse from ....types.x.tweet_retrieve_response import TweetRetrieveResponse +from ....types.x.tweet_get_quotes_response import TweetGetQuotesResponse +from ....types.x.tweet_get_thread_response import TweetGetThreadResponse +from ....types.x.tweet_get_replies_response import TweetGetRepliesResponse +from ....types.x.tweet_get_favoriters_response import TweetGetFavoritersResponse +from ....types.x.tweet_get_retweeters_response import TweetGetRetweetersResponse __all__ = ["TweetsResource", "AsyncTweetsResource"] @@ -253,7 +257,7 @@ def get_favoriters( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedUsers: + ) -> TweetGetFavoritersResponse: """ Get users who liked a tweet @@ -279,7 +283,7 @@ def get_favoriters( timeout=timeout, query=maybe_transform({"cursor": cursor}, tweet_get_favoriters_params.TweetGetFavoritersParams), ), - cast_to=PaginatedUsers, + cast_to=TweetGetFavoritersResponse, ) def get_quotes( @@ -296,7 +300,7 @@ def get_quotes( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> TweetGetQuotesResponse: """ Get quote tweets of a tweet @@ -336,7 +340,7 @@ def get_quotes( tweet_get_quotes_params.TweetGetQuotesParams, ), ), - cast_to=PaginatedTweets, + cast_to=TweetGetQuotesResponse, ) def get_replies( @@ -352,7 +356,7 @@ def get_replies( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> TweetGetRepliesResponse: """ Get replies to a tweet @@ -389,7 +393,7 @@ def get_replies( tweet_get_replies_params.TweetGetRepliesParams, ), ), - cast_to=PaginatedTweets, + cast_to=TweetGetRepliesResponse, ) def get_retweeters( @@ -403,7 +407,7 @@ def get_retweeters( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedUsers: + ) -> TweetGetRetweetersResponse: """ Get users who retweeted a tweet @@ -429,7 +433,7 @@ def get_retweeters( timeout=timeout, query=maybe_transform({"cursor": cursor}, tweet_get_retweeters_params.TweetGetRetweetersParams), ), - cast_to=PaginatedUsers, + cast_to=TweetGetRetweetersResponse, ) def get_thread( @@ -443,7 +447,7 @@ def get_thread( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> TweetGetThreadResponse: """ Get thread context for a tweet @@ -469,7 +473,7 @@ def get_thread( timeout=timeout, query=maybe_transform({"cursor": cursor}, tweet_get_thread_params.TweetGetThreadParams), ), - cast_to=PaginatedTweets, + cast_to=TweetGetThreadResponse, ) def search( @@ -487,7 +491,7 @@ def search( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> TweetSearchResponse: """ Search tweets @@ -531,7 +535,7 @@ def search( tweet_search_params.TweetSearchParams, ), ), - cast_to=PaginatedTweets, + cast_to=TweetSearchResponse, ) @@ -735,7 +739,7 @@ async def get_favoriters( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedUsers: + ) -> TweetGetFavoritersResponse: """ Get users who liked a tweet @@ -763,7 +767,7 @@ async def get_favoriters( {"cursor": cursor}, tweet_get_favoriters_params.TweetGetFavoritersParams ), ), - cast_to=PaginatedUsers, + cast_to=TweetGetFavoritersResponse, ) async def get_quotes( @@ -780,7 +784,7 @@ async def get_quotes( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> TweetGetQuotesResponse: """ Get quote tweets of a tweet @@ -820,7 +824,7 @@ async def get_quotes( tweet_get_quotes_params.TweetGetQuotesParams, ), ), - cast_to=PaginatedTweets, + cast_to=TweetGetQuotesResponse, ) async def get_replies( @@ -836,7 +840,7 @@ async def get_replies( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> TweetGetRepliesResponse: """ Get replies to a tweet @@ -873,7 +877,7 @@ async def get_replies( tweet_get_replies_params.TweetGetRepliesParams, ), ), - cast_to=PaginatedTweets, + cast_to=TweetGetRepliesResponse, ) async def get_retweeters( @@ -887,7 +891,7 @@ async def get_retweeters( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedUsers: + ) -> TweetGetRetweetersResponse: """ Get users who retweeted a tweet @@ -915,7 +919,7 @@ async def get_retweeters( {"cursor": cursor}, tweet_get_retweeters_params.TweetGetRetweetersParams ), ), - cast_to=PaginatedUsers, + cast_to=TweetGetRetweetersResponse, ) async def get_thread( @@ -929,7 +933,7 @@ async def get_thread( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> TweetGetThreadResponse: """ Get thread context for a tweet @@ -955,7 +959,7 @@ async def get_thread( timeout=timeout, query=await async_maybe_transform({"cursor": cursor}, tweet_get_thread_params.TweetGetThreadParams), ), - cast_to=PaginatedTweets, + cast_to=TweetGetThreadResponse, ) async def search( @@ -973,7 +977,7 @@ async def search( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> TweetSearchResponse: """ Search tweets @@ -1017,7 +1021,7 @@ async def search( tweet_search_params.TweetSearchParams, ), ), - cast_to=PaginatedTweets, + cast_to=TweetSearchResponse, ) diff --git a/src/x_twitter_scraper/resources/x/users/users.py b/src/x_twitter_scraper/resources/x/users/users.py index c415646..3c8cfa2 100644 --- a/src/x_twitter_scraper/resources/x/users/users.py +++ b/src/x_twitter_scraper/resources/x/users/users.py @@ -35,9 +35,11 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options -from ....types.x.user_profile import UserProfile -from ....types.shared.paginated_users import PaginatedUsers -from ....types.shared.paginated_tweets import PaginatedTweets +from ....types.x.user_retrieve_response import UserRetrieveResponse +from ....types.x.user_retrieve_likes_response import UserRetrieveLikesResponse +from ....types.x.user_retrieve_media_response import UserRetrieveMediaResponse +from ....types.x.user_retrieve_tweets_response import UserRetrieveTweetsResponse +from ....types.x.user_retrieve_followers_you_know_response import UserRetrieveFollowersYouKnowResponse __all__ = ["UsersResource", "AsyncUsersResource"] @@ -79,7 +81,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserProfile: + ) -> UserRetrieveResponse: """ Look up X user @@ -99,7 +101,7 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=UserProfile, + cast_to=UserRetrieveResponse, ) def retrieve_batch( @@ -201,7 +203,7 @@ def retrieve_followers_you_know( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedUsers: + ) -> UserRetrieveFollowersYouKnowResponse: """ Get followers you know for a user @@ -229,7 +231,7 @@ def retrieve_followers_you_know( {"cursor": cursor}, user_retrieve_followers_you_know_params.UserRetrieveFollowersYouKnowParams ), ), - cast_to=PaginatedUsers, + cast_to=UserRetrieveFollowersYouKnowResponse, ) def retrieve_following( @@ -293,7 +295,7 @@ def retrieve_likes( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> UserRetrieveLikesResponse: """ Get tweets liked by a user @@ -319,7 +321,7 @@ def retrieve_likes( timeout=timeout, query=maybe_transform({"cursor": cursor}, user_retrieve_likes_params.UserRetrieveLikesParams), ), - cast_to=PaginatedTweets, + cast_to=UserRetrieveLikesResponse, ) def retrieve_media( @@ -333,7 +335,7 @@ def retrieve_media( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> UserRetrieveMediaResponse: """ Get media tweets by a user @@ -359,7 +361,7 @@ def retrieve_media( timeout=timeout, query=maybe_transform({"cursor": cursor}, user_retrieve_media_params.UserRetrieveMediaParams), ), - cast_to=PaginatedTweets, + cast_to=UserRetrieveMediaResponse, ) def retrieve_mentions( @@ -476,7 +478,7 @@ def retrieve_tweets( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> UserRetrieveTweetsResponse: """ Get recent tweets by a user @@ -513,7 +515,7 @@ def retrieve_tweets( user_retrieve_tweets_params.UserRetrieveTweetsParams, ), ), - cast_to=PaginatedTweets, + cast_to=UserRetrieveTweetsResponse, ) def retrieve_verified_followers( @@ -597,7 +599,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserProfile: + ) -> UserRetrieveResponse: """ Look up X user @@ -617,7 +619,7 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=UserProfile, + cast_to=UserRetrieveResponse, ) async def retrieve_batch( @@ -719,7 +721,7 @@ async def retrieve_followers_you_know( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedUsers: + ) -> UserRetrieveFollowersYouKnowResponse: """ Get followers you know for a user @@ -747,7 +749,7 @@ async def retrieve_followers_you_know( {"cursor": cursor}, user_retrieve_followers_you_know_params.UserRetrieveFollowersYouKnowParams ), ), - cast_to=PaginatedUsers, + cast_to=UserRetrieveFollowersYouKnowResponse, ) async def retrieve_following( @@ -811,7 +813,7 @@ async def retrieve_likes( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> UserRetrieveLikesResponse: """ Get tweets liked by a user @@ -839,7 +841,7 @@ async def retrieve_likes( {"cursor": cursor}, user_retrieve_likes_params.UserRetrieveLikesParams ), ), - cast_to=PaginatedTweets, + cast_to=UserRetrieveLikesResponse, ) async def retrieve_media( @@ -853,7 +855,7 @@ async def retrieve_media( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> UserRetrieveMediaResponse: """ Get media tweets by a user @@ -881,7 +883,7 @@ async def retrieve_media( {"cursor": cursor}, user_retrieve_media_params.UserRetrieveMediaParams ), ), - cast_to=PaginatedTweets, + cast_to=UserRetrieveMediaResponse, ) async def retrieve_mentions( @@ -998,7 +1000,7 @@ async def retrieve_tweets( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> UserRetrieveTweetsResponse: """ Get recent tweets by a user @@ -1035,7 +1037,7 @@ async def retrieve_tweets( user_retrieve_tweets_params.UserRetrieveTweetsParams, ), ), - cast_to=PaginatedTweets, + cast_to=UserRetrieveTweetsResponse, ) async def retrieve_verified_followers( diff --git a/src/x_twitter_scraper/resources/x/x.py b/src/x_twitter_scraper/resources/x/x.py index ef543e6..4169ca6 100644 --- a/src/x_twitter_scraper/resources/x/x.py +++ b/src/x_twitter_scraper/resources/x/x.py @@ -99,7 +99,7 @@ AsyncCommunitiesResourceWithStreamingResponse, ) from ...types.x_get_article_response import XGetArticleResponse -from ...types.shared.paginated_tweets import PaginatedTweets +from ...types.x_get_home_timeline_response import XGetHomeTimelineResponse from ...types.x_get_notifications_response import XGetNotificationsResponse __all__ = ["XResource", "AsyncXResource"] @@ -218,7 +218,7 @@ def get_home_timeline( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> XGetHomeTimelineResponse: """ Get home timeline @@ -250,7 +250,7 @@ def get_home_timeline( x_get_home_timeline_params.XGetHomeTimelineParams, ), ), - cast_to=PaginatedTweets, + cast_to=XGetHomeTimelineResponse, ) def get_notifications( @@ -433,7 +433,7 @@ async def get_home_timeline( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaginatedTweets: + ) -> XGetHomeTimelineResponse: """ Get home timeline @@ -465,7 +465,7 @@ async def get_home_timeline( x_get_home_timeline_params.XGetHomeTimelineParams, ), ), - cast_to=PaginatedTweets, + cast_to=XGetHomeTimelineResponse, ) async def get_notifications( diff --git a/src/x_twitter_scraper/types/__init__.py b/src/x_twitter_scraper/types/__init__.py index 20f3419..692f59f 100644 --- a/src/x_twitter_scraper/types/__init__.py +++ b/src/x_twitter_scraper/types/__init__.py @@ -2,27 +2,12 @@ from __future__ import annotations -from .draft import Draft as Draft -from .event import Event as Event from .shared import ( Error as Error, EventType as EventType, PaginatedUsers as PaginatedUsers, PaginatedTweets as PaginatedTweets, ) -from .winner import Winner as Winner -from .api_key import APIKey as APIKey -from .monitor import Monitor as Monitor -from .webhook import Webhook as Webhook -from .delivery import Delivery as Delivery -from .radar_item import RadarItem as RadarItem -from .draw_detail import DrawDetail as DrawDetail -from .integration import Integration as Integration -from .draft_detail import DraftDetail as DraftDetail -from .event_detail import EventDetail as EventDetail -from .style_profile import StyleProfile as StyleProfile -from .draw_list_item import DrawListItem as DrawListItem -from .extraction_job import ExtractionJob as ExtractionJob from .draw_run_params import DrawRunParams as DrawRunParams from .draw_list_params import DrawListParams as DrawListParams from .draft_list_params import DraftListParams as DraftListParams @@ -37,49 +22,60 @@ from .style_list_response import StyleListResponse as StyleListResponse from .style_update_params import StyleUpdateParams as StyleUpdateParams from .trend_list_response import TrendListResponse as TrendListResponse -from .integration_delivery import IntegrationDelivery as IntegrationDelivery from .style_analyze_params import StyleAnalyzeParams as StyleAnalyzeParams from .style_compare_params import StyleCompareParams as StyleCompareParams from .api_key_create_params import APIKeyCreateParams as APIKeyCreateParams from .api_key_list_response import APIKeyListResponse as APIKeyListResponse from .compose_create_params import ComposeCreateParams as ComposeCreateParams +from .draft_create_response import DraftCreateResponse as DraftCreateResponse from .extraction_run_params import ExtractionRunParams as ExtractionRunParams from .monitor_create_params import MonitorCreateParams as MonitorCreateParams from .monitor_list_response import MonitorListResponse as MonitorListResponse from .monitor_update_params import MonitorUpdateParams as MonitorUpdateParams -from .style_profile_summary import StyleProfileSummary as StyleProfileSummary +from .style_update_response import StyleUpdateResponse as StyleUpdateResponse from .webhook_create_params import WebhookCreateParams as WebhookCreateParams from .webhook_list_response import WebhookListResponse as WebhookListResponse from .webhook_test_response import WebhookTestResponse as WebhookTestResponse from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams from .draw_retrieve_response import DrawRetrieveResponse as DrawRetrieveResponse from .extraction_list_params import ExtractionListParams as ExtractionListParams +from .style_analyze_response import StyleAnalyzeResponse as StyleAnalyzeResponse from .style_compare_response import StyleCompareResponse as StyleCompareResponse from .x_get_article_response import XGetArticleResponse as XGetArticleResponse from .api_key_create_response import APIKeyCreateResponse as APIKeyCreateResponse from .api_key_revoke_response import APIKeyRevokeResponse as APIKeyRevokeResponse from .compose_create_response import ComposeCreateResponse as ComposeCreateResponse +from .draft_retrieve_response import DraftRetrieveResponse as DraftRetrieveResponse +from .event_retrieve_response import EventRetrieveResponse as EventRetrieveResponse from .extraction_run_response import ExtractionRunResponse as ExtractionRunResponse from .monitor_create_response import MonitorCreateResponse as MonitorCreateResponse +from .monitor_update_response import MonitorUpdateResponse as MonitorUpdateResponse +from .style_retrieve_response import StyleRetrieveResponse as StyleRetrieveResponse from .webhook_create_response import WebhookCreateResponse as WebhookCreateResponse +from .webhook_update_response import WebhookUpdateResponse as WebhookUpdateResponse from .extraction_list_response import ExtractionListResponse as ExtractionListResponse from .account_retrieve_response import AccountRetrieveResponse as AccountRetrieveResponse from .integration_create_params import IntegrationCreateParams as IntegrationCreateParams from .integration_list_response import IntegrationListResponse as IntegrationListResponse from .integration_update_params import IntegrationUpdateParams as IntegrationUpdateParams +from .monitor_retrieve_response import MonitorRetrieveResponse as MonitorRetrieveResponse from .subscribe_create_response import SubscribeCreateResponse as SubscribeCreateResponse from .extraction_retrieve_params import ExtractionRetrieveParams as ExtractionRetrieveParams from .x_get_home_timeline_params import XGetHomeTimelineParams as XGetHomeTimelineParams from .x_get_notifications_params import XGetNotificationsParams as XGetNotificationsParams from .credit_topup_balance_params import CreditTopupBalanceParams as CreditTopupBalanceParams +from .integration_create_response import IntegrationCreateResponse as IntegrationCreateResponse from .integration_delete_response import IntegrationDeleteResponse as IntegrationDeleteResponse +from .integration_update_response import IntegrationUpdateResponse as IntegrationUpdateResponse from .monitor_deactivate_response import MonitorDeactivateResponse as MonitorDeactivateResponse from .webhook_deactivate_response import WebhookDeactivateResponse as WebhookDeactivateResponse from .account_update_locale_params import AccountUpdateLocaleParams as AccountUpdateLocaleParams from .extraction_retrieve_response import ExtractionRetrieveResponse as ExtractionRetrieveResponse +from .x_get_home_timeline_response import XGetHomeTimelineResponse as XGetHomeTimelineResponse from .x_get_notifications_response import XGetNotificationsResponse as XGetNotificationsResponse from .account_set_x_username_params import AccountSetXUsernameParams as AccountSetXUsernameParams from .credit_topup_balance_response import CreditTopupBalanceResponse as CreditTopupBalanceResponse +from .integration_retrieve_response import IntegrationRetrieveResponse as IntegrationRetrieveResponse from .account_update_locale_response import AccountUpdateLocaleResponse as AccountUpdateLocaleResponse from .integration_send_test_response import IntegrationSendTestResponse as IntegrationSendTestResponse from .style_get_performance_response import StyleGetPerformanceResponse as StyleGetPerformanceResponse diff --git a/src/x_twitter_scraper/types/api_key.py b/src/x_twitter_scraper/types/api_key.py deleted file mode 100644 index 66154df..0000000 --- a/src/x_twitter_scraper/types/api_key.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["APIKey"] - - -class APIKey(BaseModel): - id: str - - created_at: datetime = FieldInfo(alias="createdAt") - - is_active: bool = FieldInfo(alias="isActive") - - name: str - - prefix: str - - last_used_at: Optional[datetime] = FieldInfo(alias="lastUsedAt", default=None) diff --git a/src/x_twitter_scraper/types/api_key_list_response.py b/src/x_twitter_scraper/types/api_key_list_response.py index fdf4cc1..2c78c5e 100644 --- a/src/x_twitter_scraper/types/api_key_list_response.py +++ b/src/x_twitter_scraper/types/api_key_list_response.py @@ -1,12 +1,28 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo -from .api_key import APIKey from .._models import BaseModel -__all__ = ["APIKeyListResponse"] +__all__ = ["APIKeyListResponse", "Key"] + + +class Key(BaseModel): + id: str + + created_at: datetime = FieldInfo(alias="createdAt") + + is_active: bool = FieldInfo(alias="isActive") + + name: str + + prefix: str + + last_used_at: Optional[datetime] = FieldInfo(alias="lastUsedAt", default=None) class APIKeyListResponse(BaseModel): - keys: List[APIKey] + keys: List[Key] diff --git a/src/x_twitter_scraper/types/delivery.py b/src/x_twitter_scraper/types/delivery.py deleted file mode 100644 index 2a78572..0000000 --- a/src/x_twitter_scraper/types/delivery.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["Delivery"] - - -class Delivery(BaseModel): - id: str - - attempts: int - - created_at: datetime = FieldInfo(alias="createdAt") - - status: str - - stream_event_id: str = FieldInfo(alias="streamEventId") - - delivered_at: Optional[datetime] = FieldInfo(alias="deliveredAt", default=None) - - last_error: Optional[str] = FieldInfo(alias="lastError", default=None) - - last_status_code: Optional[int] = FieldInfo(alias="lastStatusCode", default=None) diff --git a/src/x_twitter_scraper/types/draft_detail.py b/src/x_twitter_scraper/types/draft_create_response.py similarity index 85% rename from src/x_twitter_scraper/types/draft_detail.py rename to src/x_twitter_scraper/types/draft_create_response.py index 0ccc147..201aa42 100644 --- a/src/x_twitter_scraper/types/draft_detail.py +++ b/src/x_twitter_scraper/types/draft_create_response.py @@ -7,10 +7,10 @@ from .._models import BaseModel -__all__ = ["DraftDetail"] +__all__ = ["DraftCreateResponse"] -class DraftDetail(BaseModel): +class DraftCreateResponse(BaseModel): id: str created_at: datetime = FieldInfo(alias="createdAt") diff --git a/src/x_twitter_scraper/types/draft_list_response.py b/src/x_twitter_scraper/types/draft_list_response.py index 61dc9a0..cf8abbc 100644 --- a/src/x_twitter_scraper/types/draft_list_response.py +++ b/src/x_twitter_scraper/types/draft_list_response.py @@ -1,13 +1,25 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Optional +from datetime import datetime from pydantic import Field as FieldInfo -from .draft import Draft from .._models import BaseModel -__all__ = ["DraftListResponse"] +__all__ = ["DraftListResponse", "Draft"] + + +class Draft(BaseModel): + id: str + + created_at: datetime = FieldInfo(alias="createdAt") + + text: str + + goal: Optional[str] = None + + topic: Optional[str] = None class DraftListResponse(BaseModel): diff --git a/src/x_twitter_scraper/types/draft.py b/src/x_twitter_scraper/types/draft_retrieve_response.py similarity index 73% rename from src/x_twitter_scraper/types/draft.py rename to src/x_twitter_scraper/types/draft_retrieve_response.py index 055a0ba..77e4c2e 100644 --- a/src/x_twitter_scraper/types/draft.py +++ b/src/x_twitter_scraper/types/draft_retrieve_response.py @@ -7,16 +7,18 @@ from .._models import BaseModel -__all__ = ["Draft"] +__all__ = ["DraftRetrieveResponse"] -class Draft(BaseModel): +class DraftRetrieveResponse(BaseModel): id: str created_at: datetime = FieldInfo(alias="createdAt") text: str + updated_at: datetime = FieldInfo(alias="updatedAt") + goal: Optional[str] = None topic: Optional[str] = None diff --git a/src/x_twitter_scraper/types/draw_detail.py b/src/x_twitter_scraper/types/draw_detail.py deleted file mode 100644 index e1ab88b..0000000 --- a/src/x_twitter_scraper/types/draw_detail.py +++ /dev/null @@ -1,40 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["DrawDetail"] - - -class DrawDetail(BaseModel): - id: str - - created_at: datetime = FieldInfo(alias="createdAt") - - status: str - - total_entries: int = FieldInfo(alias="totalEntries") - - tweet_author_username: str = FieldInfo(alias="tweetAuthorUsername") - - tweet_id: str = FieldInfo(alias="tweetId") - - tweet_like_count: int = FieldInfo(alias="tweetLikeCount") - - tweet_quote_count: int = FieldInfo(alias="tweetQuoteCount") - - tweet_reply_count: int = FieldInfo(alias="tweetReplyCount") - - tweet_retweet_count: int = FieldInfo(alias="tweetRetweetCount") - - tweet_text: str = FieldInfo(alias="tweetText") - - tweet_url: str = FieldInfo(alias="tweetUrl") - - valid_entries: int = FieldInfo(alias="validEntries") - - drawn_at: Optional[datetime] = FieldInfo(alias="drawnAt", default=None) diff --git a/src/x_twitter_scraper/types/draw_list_item.py b/src/x_twitter_scraper/types/draw_list_item.py deleted file mode 100644 index 8932337..0000000 --- a/src/x_twitter_scraper/types/draw_list_item.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["DrawListItem"] - - -class DrawListItem(BaseModel): - id: str - - created_at: datetime = FieldInfo(alias="createdAt") - - status: str - - total_entries: int = FieldInfo(alias="totalEntries") - - tweet_url: str = FieldInfo(alias="tweetUrl") - - valid_entries: int = FieldInfo(alias="validEntries") - - drawn_at: Optional[datetime] = FieldInfo(alias="drawnAt", default=None) diff --git a/src/x_twitter_scraper/types/draw_list_response.py b/src/x_twitter_scraper/types/draw_list_response.py index 6bf59c9..ccc029d 100644 --- a/src/x_twitter_scraper/types/draw_list_response.py +++ b/src/x_twitter_scraper/types/draw_list_response.py @@ -1,17 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Optional +from datetime import datetime from pydantic import Field as FieldInfo from .._models import BaseModel -from .draw_list_item import DrawListItem -__all__ = ["DrawListResponse"] +__all__ = ["DrawListResponse", "Draw"] + + +class Draw(BaseModel): + id: str + + created_at: datetime = FieldInfo(alias="createdAt") + + status: str + + total_entries: int = FieldInfo(alias="totalEntries") + + tweet_url: str = FieldInfo(alias="tweetUrl") + + valid_entries: int = FieldInfo(alias="validEntries") + + drawn_at: Optional[datetime] = FieldInfo(alias="drawnAt", default=None) class DrawListResponse(BaseModel): - draws: List[DrawListItem] + draws: List[Draw] has_more: bool = FieldInfo(alias="hasMore") diff --git a/src/x_twitter_scraper/types/draw_retrieve_response.py b/src/x_twitter_scraper/types/draw_retrieve_response.py index 7737b8b..f071282 100644 --- a/src/x_twitter_scraper/types/draw_retrieve_response.py +++ b/src/x_twitter_scraper/types/draw_retrieve_response.py @@ -1,15 +1,56 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo -from .winner import Winner from .._models import BaseModel -from .draw_detail import DrawDetail -__all__ = ["DrawRetrieveResponse"] +__all__ = ["DrawRetrieveResponse", "Draw", "Winner"] + + +class Draw(BaseModel): + id: str + + created_at: datetime = FieldInfo(alias="createdAt") + + status: str + + total_entries: int = FieldInfo(alias="totalEntries") + + tweet_author_username: str = FieldInfo(alias="tweetAuthorUsername") + + tweet_id: str = FieldInfo(alias="tweetId") + + tweet_like_count: int = FieldInfo(alias="tweetLikeCount") + + tweet_quote_count: int = FieldInfo(alias="tweetQuoteCount") + + tweet_reply_count: int = FieldInfo(alias="tweetReplyCount") + + tweet_retweet_count: int = FieldInfo(alias="tweetRetweetCount") + + tweet_text: str = FieldInfo(alias="tweetText") + + tweet_url: str = FieldInfo(alias="tweetUrl") + + valid_entries: int = FieldInfo(alias="validEntries") + + drawn_at: Optional[datetime] = FieldInfo(alias="drawnAt", default=None) + + +class Winner(BaseModel): + author_username: str = FieldInfo(alias="authorUsername") + + is_backup: bool = FieldInfo(alias="isBackup") + + position: int + + tweet_id: str = FieldInfo(alias="tweetId") class DrawRetrieveResponse(BaseModel): - draw: DrawDetail + draw: Draw winners: List[Winner] diff --git a/src/x_twitter_scraper/types/draw_run_response.py b/src/x_twitter_scraper/types/draw_run_response.py index 639ef6a..8baa853 100644 --- a/src/x_twitter_scraper/types/draw_run_response.py +++ b/src/x_twitter_scraper/types/draw_run_response.py @@ -4,10 +4,19 @@ from pydantic import Field as FieldInfo -from .winner import Winner from .._models import BaseModel -__all__ = ["DrawRunResponse"] +__all__ = ["DrawRunResponse", "Winner"] + + +class Winner(BaseModel): + author_username: str = FieldInfo(alias="authorUsername") + + is_backup: bool = FieldInfo(alias="isBackup") + + position: int + + tweet_id: str = FieldInfo(alias="tweetId") class DrawRunResponse(BaseModel): diff --git a/src/x_twitter_scraper/types/event.py b/src/x_twitter_scraper/types/event.py deleted file mode 100644 index d1e64cc..0000000 --- a/src/x_twitter_scraper/types/event.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel -from .shared.event_type import EventType - -__all__ = ["Event"] - - -class Event(BaseModel): - id: str - - data: Dict[str, object] - - monitor_id: str = FieldInfo(alias="monitorId") - - occurred_at: datetime = FieldInfo(alias="occurredAt") - - type: EventType - - username: str diff --git a/src/x_twitter_scraper/types/event_list_params.py b/src/x_twitter_scraper/types/event_list_params.py index 2b9d2e0..f4e3b5c 100644 --- a/src/x_twitter_scraper/types/event_list_params.py +++ b/src/x_twitter_scraper/types/event_list_params.py @@ -2,10 +2,9 @@ from __future__ import annotations -from typing_extensions import Annotated, TypedDict +from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -from .shared.event_type import EventType __all__ = ["EventListParams"] @@ -14,7 +13,10 @@ class EventListParams(TypedDict, total=False): after: str """Cursor for pagination""" - event_type: Annotated[EventType, PropertyInfo(alias="eventType")] + event_type: Annotated[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"], + PropertyInfo(alias="eventType"), + ] limit: int diff --git a/src/x_twitter_scraper/types/event_list_response.py b/src/x_twitter_scraper/types/event_list_response.py index 6558dd7..1d28103 100644 --- a/src/x_twitter_scraper/types/event_list_response.py +++ b/src/x_twitter_scraper/types/event_list_response.py @@ -1,13 +1,28 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal from pydantic import Field as FieldInfo -from .event import Event from .._models import BaseModel -__all__ = ["EventListResponse"] +__all__ = ["EventListResponse", "Event"] + + +class Event(BaseModel): + id: str + + data: Dict[str, object] + + monitor_id: str = FieldInfo(alias="monitorId") + + occurred_at: datetime = FieldInfo(alias="occurredAt") + + type: Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + + username: str class EventListResponse(BaseModel): diff --git a/src/x_twitter_scraper/types/event_detail.py b/src/x_twitter_scraper/types/event_retrieve_response.py similarity index 67% rename from src/x_twitter_scraper/types/event_detail.py rename to src/x_twitter_scraper/types/event_retrieve_response.py index 3b433e7..e986a96 100644 --- a/src/x_twitter_scraper/types/event_detail.py +++ b/src/x_twitter_scraper/types/event_retrieve_response.py @@ -2,16 +2,16 @@ from typing import Dict, Optional from datetime import datetime +from typing_extensions import Literal from pydantic import Field as FieldInfo from .._models import BaseModel -from .shared.event_type import EventType -__all__ = ["EventDetail"] +__all__ = ["EventRetrieveResponse"] -class EventDetail(BaseModel): +class EventRetrieveResponse(BaseModel): id: str data: Dict[str, object] @@ -20,7 +20,7 @@ class EventDetail(BaseModel): occurred_at: datetime = FieldInfo(alias="occurredAt") - type: EventType + type: Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] username: str diff --git a/src/x_twitter_scraper/types/extraction_job.py b/src/x_twitter_scraper/types/extraction_job.py deleted file mode 100644 index 2705f3e..0000000 --- a/src/x_twitter_scraper/types/extraction_job.py +++ /dev/null @@ -1,46 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["ExtractionJob"] - - -class ExtractionJob(BaseModel): - id: str - - created_at: datetime = FieldInfo(alias="createdAt") - - status: Literal["running", "completed", "failed"] - - tool_type: Literal[ - "article_extractor", - "community_extractor", - "community_moderator_explorer", - "community_post_extractor", - "community_search", - "follower_explorer", - "following_explorer", - "list_follower_explorer", - "list_member_extractor", - "list_post_extractor", - "mention_extractor", - "people_search", - "post_extractor", - "quote_extractor", - "reply_extractor", - "repost_extractor", - "space_explorer", - "thread_extractor", - "tweet_search_extractor", - "verified_follower_explorer", - ] = FieldInfo(alias="toolType") - - total_results: int = FieldInfo(alias="totalResults") - - completed_at: Optional[datetime] = FieldInfo(alias="completedAt", default=None) diff --git a/src/x_twitter_scraper/types/extraction_list_response.py b/src/x_twitter_scraper/types/extraction_list_response.py index b48e34f..a1117f6 100644 --- a/src/x_twitter_scraper/types/extraction_list_response.py +++ b/src/x_twitter_scraper/types/extraction_list_response.py @@ -1,17 +1,53 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal from pydantic import Field as FieldInfo from .._models import BaseModel -from .extraction_job import ExtractionJob -__all__ = ["ExtractionListResponse"] +__all__ = ["ExtractionListResponse", "Extraction"] + + +class Extraction(BaseModel): + id: str + + created_at: datetime = FieldInfo(alias="createdAt") + + status: Literal["running", "completed", "failed"] + + tool_type: Literal[ + "article_extractor", + "community_extractor", + "community_moderator_explorer", + "community_post_extractor", + "community_search", + "follower_explorer", + "following_explorer", + "list_follower_explorer", + "list_member_extractor", + "list_post_extractor", + "mention_extractor", + "people_search", + "post_extractor", + "quote_extractor", + "reply_extractor", + "repost_extractor", + "space_explorer", + "thread_extractor", + "tweet_search_extractor", + "verified_follower_explorer", + ] = FieldInfo(alias="toolType") + + total_results: int = FieldInfo(alias="totalResults") + + completed_at: Optional[datetime] = FieldInfo(alias="completedAt", default=None) class ExtractionListResponse(BaseModel): - extractions: List[ExtractionJob] + extractions: List[Extraction] has_more: bool = FieldInfo(alias="hasMore") diff --git a/src/x_twitter_scraper/types/integration_create_params.py b/src/x_twitter_scraper/types/integration_create_params.py index b7cf7a6..3954529 100644 --- a/src/x_twitter_scraper/types/integration_create_params.py +++ b/src/x_twitter_scraper/types/integration_create_params.py @@ -6,7 +6,6 @@ from typing_extensions import Literal, Required, Annotated, TypedDict from .._utils import PropertyInfo -from .shared.event_type import EventType __all__ = ["IntegrationCreateParams", "Config"] @@ -15,7 +14,14 @@ class IntegrationCreateParams(TypedDict, total=False): config: Required[Config] """Integration config (e.g. Telegram chatId)""" - event_types: Required[Annotated[List[EventType], PropertyInfo(alias="eventTypes")]] + event_types: Required[ + Annotated[ + List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ], + PropertyInfo(alias="eventTypes"), + ] + ] name: Required[str] diff --git a/src/x_twitter_scraper/types/integration.py b/src/x_twitter_scraper/types/integration_create_response.py similarity index 75% rename from src/x_twitter_scraper/types/integration.py rename to src/x_twitter_scraper/types/integration_create_response.py index f92fd15..8b78408 100644 --- a/src/x_twitter_scraper/types/integration.py +++ b/src/x_twitter_scraper/types/integration_create_response.py @@ -7,19 +7,20 @@ from pydantic import Field as FieldInfo from .._models import BaseModel -from .shared.event_type import EventType -__all__ = ["Integration"] +__all__ = ["IntegrationCreateResponse"] -class Integration(BaseModel): +class IntegrationCreateResponse(BaseModel): id: str config: Dict[str, object] created_at: datetime = FieldInfo(alias="createdAt") - event_types: List[EventType] = FieldInfo(alias="eventTypes") + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] = FieldInfo(alias="eventTypes") is_active: bool = FieldInfo(alias="isActive") diff --git a/src/x_twitter_scraper/types/integration_delivery.py b/src/x_twitter_scraper/types/integration_delivery.py deleted file mode 100644 index 43e43ac..0000000 --- a/src/x_twitter_scraper/types/integration_delivery.py +++ /dev/null @@ -1,32 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["IntegrationDelivery"] - - -class IntegrationDelivery(BaseModel): - id: str - - attempts: int - - created_at: datetime = FieldInfo(alias="createdAt") - - event_type: str = FieldInfo(alias="eventType") - - status: str - - delivered_at: Optional[datetime] = FieldInfo(alias="deliveredAt", default=None) - - last_error: Optional[str] = FieldInfo(alias="lastError", default=None) - - last_status_code: Optional[int] = FieldInfo(alias="lastStatusCode", default=None) - - source_id: Optional[str] = FieldInfo(alias="sourceId", default=None) - - source_type: Optional[str] = FieldInfo(alias="sourceType", default=None) diff --git a/src/x_twitter_scraper/types/integration_list_deliveries_response.py b/src/x_twitter_scraper/types/integration_list_deliveries_response.py index ec5a8ed..eaca518 100644 --- a/src/x_twitter_scraper/types/integration_list_deliveries_response.py +++ b/src/x_twitter_scraper/types/integration_list_deliveries_response.py @@ -1,12 +1,36 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo from .._models import BaseModel -from .integration_delivery import IntegrationDelivery -__all__ = ["IntegrationListDeliveriesResponse"] +__all__ = ["IntegrationListDeliveriesResponse", "Delivery"] + + +class Delivery(BaseModel): + id: str + + attempts: int + + created_at: datetime = FieldInfo(alias="createdAt") + + event_type: str = FieldInfo(alias="eventType") + + status: str + + delivered_at: Optional[datetime] = FieldInfo(alias="deliveredAt", default=None) + + last_error: Optional[str] = FieldInfo(alias="lastError", default=None) + + last_status_code: Optional[int] = FieldInfo(alias="lastStatusCode", default=None) + + source_id: Optional[str] = FieldInfo(alias="sourceId", default=None) + + source_type: Optional[str] = FieldInfo(alias="sourceType", default=None) class IntegrationListDeliveriesResponse(BaseModel): - deliveries: List[IntegrationDelivery] + deliveries: List[Delivery] diff --git a/src/x_twitter_scraper/types/integration_list_response.py b/src/x_twitter_scraper/types/integration_list_response.py index 95aa13a..d8abdb4 100644 --- a/src/x_twitter_scraper/types/integration_list_response.py +++ b/src/x_twitter_scraper/types/integration_list_response.py @@ -1,11 +1,40 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo from .._models import BaseModel -from .integration import Integration -__all__ = ["IntegrationListResponse"] +__all__ = ["IntegrationListResponse", "Integration"] + + +class Integration(BaseModel): + id: str + + config: Dict[str, object] + + created_at: datetime = FieldInfo(alias="createdAt") + + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] = FieldInfo(alias="eventTypes") + + is_active: bool = FieldInfo(alias="isActive") + + name: str + + type: Literal["telegram"] + + filters: Optional[Dict[str, object]] = None + + message_template: Optional[str] = FieldInfo(alias="messageTemplate", default=None) + + scope_all_monitors: Optional[bool] = FieldInfo(alias="scopeAllMonitors", default=None) + + silent_push: Optional[bool] = FieldInfo(alias="silentPush", default=None) class IntegrationListResponse(BaseModel): diff --git a/src/x_twitter_scraper/types/integration_retrieve_response.py b/src/x_twitter_scraper/types/integration_retrieve_response.py new file mode 100644 index 0000000..84ee679 --- /dev/null +++ b/src/x_twitter_scraper/types/integration_retrieve_response.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["IntegrationRetrieveResponse"] + + +class IntegrationRetrieveResponse(BaseModel): + id: str + + config: Dict[str, object] + + created_at: datetime = FieldInfo(alias="createdAt") + + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] = FieldInfo(alias="eventTypes") + + is_active: bool = FieldInfo(alias="isActive") + + name: str + + type: Literal["telegram"] + + filters: Optional[Dict[str, object]] = None + + message_template: Optional[str] = FieldInfo(alias="messageTemplate", default=None) + + scope_all_monitors: Optional[bool] = FieldInfo(alias="scopeAllMonitors", default=None) + + silent_push: Optional[bool] = FieldInfo(alias="silentPush", default=None) diff --git a/src/x_twitter_scraper/types/integration_update_params.py b/src/x_twitter_scraper/types/integration_update_params.py index 1df2849..32634b2 100644 --- a/src/x_twitter_scraper/types/integration_update_params.py +++ b/src/x_twitter_scraper/types/integration_update_params.py @@ -3,16 +3,18 @@ from __future__ import annotations from typing import Dict, List -from typing_extensions import Annotated, TypedDict +from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -from .shared.event_type import EventType __all__ = ["IntegrationUpdateParams"] class IntegrationUpdateParams(TypedDict, total=False): - event_types: Annotated[List[EventType], PropertyInfo(alias="eventTypes")] + event_types: Annotated[ + List[Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"]], + PropertyInfo(alias="eventTypes"), + ] filters: Dict[str, object] diff --git a/src/x_twitter_scraper/types/integration_update_response.py b/src/x_twitter_scraper/types/integration_update_response.py new file mode 100644 index 0000000..c8a6ff8 --- /dev/null +++ b/src/x_twitter_scraper/types/integration_update_response.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["IntegrationUpdateResponse"] + + +class IntegrationUpdateResponse(BaseModel): + id: str + + config: Dict[str, object] + + created_at: datetime = FieldInfo(alias="createdAt") + + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] = FieldInfo(alias="eventTypes") + + is_active: bool = FieldInfo(alias="isActive") + + name: str + + type: Literal["telegram"] + + filters: Optional[Dict[str, object]] = None + + message_template: Optional[str] = FieldInfo(alias="messageTemplate", default=None) + + scope_all_monitors: Optional[bool] = FieldInfo(alias="scopeAllMonitors", default=None) + + silent_push: Optional[bool] = FieldInfo(alias="silentPush", default=None) diff --git a/src/x_twitter_scraper/types/monitor_create_params.py b/src/x_twitter_scraper/types/monitor_create_params.py index 60d1e12..633eb86 100644 --- a/src/x_twitter_scraper/types/monitor_create_params.py +++ b/src/x_twitter_scraper/types/monitor_create_params.py @@ -3,16 +3,22 @@ from __future__ import annotations from typing import List -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from .._utils import PropertyInfo -from .shared.event_type import EventType __all__ = ["MonitorCreateParams"] class MonitorCreateParams(TypedDict, total=False): - event_types: Required[Annotated[List[EventType], PropertyInfo(alias="eventTypes")]] + event_types: Required[ + Annotated[ + List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ], + PropertyInfo(alias="eventTypes"), + ] + ] username: Required[str] """X username (without @)""" diff --git a/src/x_twitter_scraper/types/monitor_create_response.py b/src/x_twitter_scraper/types/monitor_create_response.py index a7f2a2c..45688d4 100644 --- a/src/x_twitter_scraper/types/monitor_create_response.py +++ b/src/x_twitter_scraper/types/monitor_create_response.py @@ -2,11 +2,11 @@ from typing import List from datetime import datetime +from typing_extensions import Literal from pydantic import Field as FieldInfo from .._models import BaseModel -from .shared.event_type import EventType __all__ = ["MonitorCreateResponse"] @@ -16,7 +16,9 @@ class MonitorCreateResponse(BaseModel): created_at: datetime = FieldInfo(alias="createdAt") - event_types: List[EventType] = FieldInfo(alias="eventTypes") + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] = FieldInfo(alias="eventTypes") username: str diff --git a/src/x_twitter_scraper/types/monitor_list_response.py b/src/x_twitter_scraper/types/monitor_list_response.py index 8300e1d..09eb8af 100644 --- a/src/x_twitter_scraper/types/monitor_list_response.py +++ b/src/x_twitter_scraper/types/monitor_list_response.py @@ -1,11 +1,30 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo -from .monitor import Monitor from .._models import BaseModel -__all__ = ["MonitorListResponse"] +__all__ = ["MonitorListResponse", "Monitor"] + + +class Monitor(BaseModel): + id: str + + created_at: datetime = FieldInfo(alias="createdAt") + + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] = FieldInfo(alias="eventTypes") + + is_active: bool = FieldInfo(alias="isActive") + + username: str + + x_user_id: str = FieldInfo(alias="xUserId") class MonitorListResponse(BaseModel): diff --git a/src/x_twitter_scraper/types/monitor_retrieve_response.py b/src/x_twitter_scraper/types/monitor_retrieve_response.py new file mode 100644 index 0000000..749fb72 --- /dev/null +++ b/src/x_twitter_scraper/types/monitor_retrieve_response.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["MonitorRetrieveResponse"] + + +class MonitorRetrieveResponse(BaseModel): + id: str + + created_at: datetime = FieldInfo(alias="createdAt") + + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] = FieldInfo(alias="eventTypes") + + is_active: bool = FieldInfo(alias="isActive") + + username: str + + x_user_id: str = FieldInfo(alias="xUserId") diff --git a/src/x_twitter_scraper/types/monitor_update_params.py b/src/x_twitter_scraper/types/monitor_update_params.py index 6b17eaa..1b9a7e6 100644 --- a/src/x_twitter_scraper/types/monitor_update_params.py +++ b/src/x_twitter_scraper/types/monitor_update_params.py @@ -3,15 +3,17 @@ from __future__ import annotations from typing import List -from typing_extensions import Annotated, TypedDict +from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -from .shared.event_type import EventType __all__ = ["MonitorUpdateParams"] class MonitorUpdateParams(TypedDict, total=False): - event_types: Annotated[List[EventType], PropertyInfo(alias="eventTypes")] + event_types: Annotated[ + List[Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"]], + PropertyInfo(alias="eventTypes"), + ] is_active: Annotated[bool, PropertyInfo(alias="isActive")] diff --git a/src/x_twitter_scraper/types/monitor.py b/src/x_twitter_scraper/types/monitor_update_response.py similarity index 58% rename from src/x_twitter_scraper/types/monitor.py rename to src/x_twitter_scraper/types/monitor_update_response.py index 9b20d46..3b3c352 100644 --- a/src/x_twitter_scraper/types/monitor.py +++ b/src/x_twitter_scraper/types/monitor_update_response.py @@ -2,21 +2,23 @@ from typing import List from datetime import datetime +from typing_extensions import Literal from pydantic import Field as FieldInfo from .._models import BaseModel -from .shared.event_type import EventType -__all__ = ["Monitor"] +__all__ = ["MonitorUpdateResponse"] -class Monitor(BaseModel): +class MonitorUpdateResponse(BaseModel): id: str created_at: datetime = FieldInfo(alias="createdAt") - event_types: List[EventType] = FieldInfo(alias="eventTypes") + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] = FieldInfo(alias="eventTypes") is_active: bool = FieldInfo(alias="isActive") diff --git a/src/x_twitter_scraper/types/radar_item.py b/src/x_twitter_scraper/types/radar_item.py deleted file mode 100644 index 51142d3..0000000 --- a/src/x_twitter_scraper/types/radar_item.py +++ /dev/null @@ -1,30 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["RadarItem"] - - -class RadarItem(BaseModel): - category: str - - published_at: datetime = FieldInfo(alias="publishedAt") - - region: str - - score: float - - source: str - - title: str - - description: Optional[str] = None - - image_url: Optional[str] = FieldInfo(alias="imageUrl", default=None) - - url: Optional[str] = None diff --git a/src/x_twitter_scraper/types/radar_retrieve_trending_topics_response.py b/src/x_twitter_scraper/types/radar_retrieve_trending_topics_response.py index a786b57..b8e25ed 100644 --- a/src/x_twitter_scraper/types/radar_retrieve_trending_topics_response.py +++ b/src/x_twitter_scraper/types/radar_retrieve_trending_topics_response.py @@ -1,14 +1,36 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo from .._models import BaseModel -from .radar_item import RadarItem -__all__ = ["RadarRetrieveTrendingTopicsResponse"] +__all__ = ["RadarRetrieveTrendingTopicsResponse", "Item"] + + +class Item(BaseModel): + category: str + + published_at: datetime = FieldInfo(alias="publishedAt") + + region: str + + score: float + + source: str + + title: str + + description: Optional[str] = None + + image_url: Optional[str] = FieldInfo(alias="imageUrl", default=None) + + url: Optional[str] = None class RadarRetrieveTrendingTopicsResponse(BaseModel): - items: List[RadarItem] + items: List[Item] total: int diff --git a/src/x_twitter_scraper/types/shared/paginated_tweets.py b/src/x_twitter_scraper/types/shared/paginated_tweets.py index 167bc2c..72c25d8 100644 --- a/src/x_twitter_scraper/types/shared/paginated_tweets.py +++ b/src/x_twitter_scraper/types/shared/paginated_tweets.py @@ -1,11 +1,44 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional + +from pydantic import Field as FieldInfo from ..._models import BaseModel -from ..x.search_tweet import SearchTweet -__all__ = ["PaginatedTweets"] +__all__ = ["PaginatedTweets", "Tweet", "TweetAuthor"] + + +class TweetAuthor(BaseModel): + id: str + + name: str + + username: str + + verified: Optional[bool] = None + + +class Tweet(BaseModel): + id: str + + text: str + + author: Optional[TweetAuthor] = None + + bookmark_count: Optional[int] = FieldInfo(alias="bookmarkCount", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + like_count: Optional[int] = FieldInfo(alias="likeCount", default=None) + + quote_count: Optional[int] = FieldInfo(alias="quoteCount", default=None) + + reply_count: Optional[int] = FieldInfo(alias="replyCount", default=None) + + retweet_count: Optional[int] = FieldInfo(alias="retweetCount", default=None) + + view_count: Optional[int] = FieldInfo(alias="viewCount", default=None) class PaginatedTweets(BaseModel): @@ -13,4 +46,4 @@ class PaginatedTweets(BaseModel): next_cursor: str - tweets: List[SearchTweet] + tweets: List[Tweet] diff --git a/src/x_twitter_scraper/types/shared/paginated_users.py b/src/x_twitter_scraper/types/shared/paginated_users.py index 3e3252a..1278d05 100644 --- a/src/x_twitter_scraper/types/shared/paginated_users.py +++ b/src/x_twitter_scraper/types/shared/paginated_users.py @@ -1,11 +1,36 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional + +from pydantic import Field as FieldInfo from ..._models import BaseModel -from ..x.user_profile import UserProfile -__all__ = ["PaginatedUsers"] +__all__ = ["PaginatedUsers", "User"] + + +class User(BaseModel): + id: str + + name: str + + username: str + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + description: Optional[str] = None + + followers: Optional[int] = None + + following: Optional[int] = None + + location: Optional[str] = None + + profile_picture: Optional[str] = FieldInfo(alias="profilePicture", default=None) + + statuses_count: Optional[int] = FieldInfo(alias="statusesCount", default=None) + + verified: Optional[bool] = None class PaginatedUsers(BaseModel): @@ -13,4 +38,4 @@ class PaginatedUsers(BaseModel): next_cursor: str - users: List[UserProfile] + users: List[User] diff --git a/src/x_twitter_scraper/types/shared_params/__init__.py b/src/x_twitter_scraper/types/shared_params/__init__.py deleted file mode 100644 index 2fb8a63..0000000 --- a/src/x_twitter_scraper/types/shared_params/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .event_type import EventType as EventType diff --git a/src/x_twitter_scraper/types/shared_params/event_type.py b/src/x_twitter_scraper/types/shared_params/event_type.py deleted file mode 100644 index ed5adaa..0000000 --- a/src/x_twitter_scraper/types/shared_params/event_type.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypeAlias - -__all__ = ["EventType"] - -EventType: TypeAlias = Literal[ - "tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost" -] diff --git a/src/x_twitter_scraper/types/style_profile_summary.py b/src/x_twitter_scraper/types/style_analyze_response.py similarity index 53% rename from src/x_twitter_scraper/types/style_profile_summary.py rename to src/x_twitter_scraper/types/style_analyze_response.py index 3e73bf0..80c4032 100644 --- a/src/x_twitter_scraper/types/style_profile_summary.py +++ b/src/x_twitter_scraper/types/style_analyze_response.py @@ -1,19 +1,32 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import List, Optional from datetime import datetime from pydantic import Field as FieldInfo from .._models import BaseModel -__all__ = ["StyleProfileSummary"] +__all__ = ["StyleAnalyzeResponse", "Tweet"] -class StyleProfileSummary(BaseModel): +class Tweet(BaseModel): + id: str + + text: str + + author_username: Optional[str] = FieldInfo(alias="authorUsername", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + +class StyleAnalyzeResponse(BaseModel): fetched_at: datetime = FieldInfo(alias="fetchedAt") is_own_account: bool = FieldInfo(alias="isOwnAccount") tweet_count: int = FieldInfo(alias="tweetCount") + tweets: List[Tweet] + x_username: str = FieldInfo(alias="xUsername") diff --git a/src/x_twitter_scraper/types/style_compare_response.py b/src/x_twitter_scraper/types/style_compare_response.py index bdc02e8..b53c47d 100644 --- a/src/x_twitter_scraper/types/style_compare_response.py +++ b/src/x_twitter_scraper/types/style_compare_response.py @@ -1,12 +1,60 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + from .._models import BaseModel -from .style_profile import StyleProfile -__all__ = ["StyleCompareResponse"] +__all__ = ["StyleCompareResponse", "Style1", "Style1Tweet", "Style2", "Style2Tweet"] + + +class Style1Tweet(BaseModel): + id: str + + text: str + + author_username: Optional[str] = FieldInfo(alias="authorUsername", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + +class Style1(BaseModel): + fetched_at: datetime = FieldInfo(alias="fetchedAt") + + is_own_account: bool = FieldInfo(alias="isOwnAccount") + + tweet_count: int = FieldInfo(alias="tweetCount") + + tweets: List[Style1Tweet] + + x_username: str = FieldInfo(alias="xUsername") + + +class Style2Tweet(BaseModel): + id: str + + text: str + + author_username: Optional[str] = FieldInfo(alias="authorUsername", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + +class Style2(BaseModel): + fetched_at: datetime = FieldInfo(alias="fetchedAt") + + is_own_account: bool = FieldInfo(alias="isOwnAccount") + + tweet_count: int = FieldInfo(alias="tweetCount") + + tweets: List[Style2Tweet] + + x_username: str = FieldInfo(alias="xUsername") class StyleCompareResponse(BaseModel): - style1: StyleProfile + style1: Style1 - style2: StyleProfile + style2: Style2 diff --git a/src/x_twitter_scraper/types/style_list_response.py b/src/x_twitter_scraper/types/style_list_response.py index 798e5d5..c746e7a 100644 --- a/src/x_twitter_scraper/types/style_list_response.py +++ b/src/x_twitter_scraper/types/style_list_response.py @@ -1,12 +1,24 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List +from datetime import datetime + +from pydantic import Field as FieldInfo from .._models import BaseModel -from .style_profile_summary import StyleProfileSummary -__all__ = ["StyleListResponse"] +__all__ = ["StyleListResponse", "Style"] + + +class Style(BaseModel): + fetched_at: datetime = FieldInfo(alias="fetchedAt") + + is_own_account: bool = FieldInfo(alias="isOwnAccount") + + tweet_count: int = FieldInfo(alias="tweetCount") + + x_username: str = FieldInfo(alias="xUsername") class StyleListResponse(BaseModel): - styles: List[StyleProfileSummary] + styles: List[Style] diff --git a/src/x_twitter_scraper/types/style_retrieve_response.py b/src/x_twitter_scraper/types/style_retrieve_response.py new file mode 100644 index 0000000..7f2ee7b --- /dev/null +++ b/src/x_twitter_scraper/types/style_retrieve_response.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["StyleRetrieveResponse", "Tweet"] + + +class Tweet(BaseModel): + id: str + + text: str + + author_username: Optional[str] = FieldInfo(alias="authorUsername", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + +class StyleRetrieveResponse(BaseModel): + fetched_at: datetime = FieldInfo(alias="fetchedAt") + + is_own_account: bool = FieldInfo(alias="isOwnAccount") + + tweet_count: int = FieldInfo(alias="tweetCount") + + tweets: List[Tweet] + + x_username: str = FieldInfo(alias="xUsername") diff --git a/src/x_twitter_scraper/types/style_profile.py b/src/x_twitter_scraper/types/style_update_response.py similarity index 89% rename from src/x_twitter_scraper/types/style_profile.py rename to src/x_twitter_scraper/types/style_update_response.py index fd35bc9..977ef52 100644 --- a/src/x_twitter_scraper/types/style_profile.py +++ b/src/x_twitter_scraper/types/style_update_response.py @@ -7,7 +7,7 @@ from .._models import BaseModel -__all__ = ["StyleProfile", "Tweet"] +__all__ = ["StyleUpdateResponse", "Tweet"] class Tweet(BaseModel): @@ -20,7 +20,7 @@ class Tweet(BaseModel): created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) -class StyleProfile(BaseModel): +class StyleUpdateResponse(BaseModel): fetched_at: datetime = FieldInfo(alias="fetchedAt") is_own_account: bool = FieldInfo(alias="isOwnAccount") diff --git a/src/x_twitter_scraper/types/webhook_create_params.py b/src/x_twitter_scraper/types/webhook_create_params.py index 91122c8..1a7afe1 100644 --- a/src/x_twitter_scraper/types/webhook_create_params.py +++ b/src/x_twitter_scraper/types/webhook_create_params.py @@ -3,16 +3,22 @@ from __future__ import annotations from typing import List -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from .._utils import PropertyInfo -from .shared.event_type import EventType __all__ = ["WebhookCreateParams"] class WebhookCreateParams(TypedDict, total=False): - event_types: Required[Annotated[List[EventType], PropertyInfo(alias="eventTypes")]] + event_types: Required[ + Annotated[ + List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ], + PropertyInfo(alias="eventTypes"), + ] + ] url: Required[str] """HTTPS URL""" diff --git a/src/x_twitter_scraper/types/webhook_create_response.py b/src/x_twitter_scraper/types/webhook_create_response.py index c72f25d..c6f2ccc 100644 --- a/src/x_twitter_scraper/types/webhook_create_response.py +++ b/src/x_twitter_scraper/types/webhook_create_response.py @@ -2,11 +2,11 @@ from typing import List from datetime import datetime +from typing_extensions import Literal from pydantic import Field as FieldInfo from .._models import BaseModel -from .shared.event_type import EventType __all__ = ["WebhookCreateResponse"] @@ -16,7 +16,9 @@ class WebhookCreateResponse(BaseModel): created_at: datetime = FieldInfo(alias="createdAt") - event_types: List[EventType] = FieldInfo(alias="eventTypes") + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] = FieldInfo(alias="eventTypes") secret: str diff --git a/src/x_twitter_scraper/types/webhook_list_deliveries_response.py b/src/x_twitter_scraper/types/webhook_list_deliveries_response.py index 9b13c4c..19b89c2 100644 --- a/src/x_twitter_scraper/types/webhook_list_deliveries_response.py +++ b/src/x_twitter_scraper/types/webhook_list_deliveries_response.py @@ -1,11 +1,31 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo from .._models import BaseModel -from .delivery import Delivery -__all__ = ["WebhookListDeliveriesResponse"] +__all__ = ["WebhookListDeliveriesResponse", "Delivery"] + + +class Delivery(BaseModel): + id: str + + attempts: int + + created_at: datetime = FieldInfo(alias="createdAt") + + status: str + + stream_event_id: str = FieldInfo(alias="streamEventId") + + delivered_at: Optional[datetime] = FieldInfo(alias="deliveredAt", default=None) + + last_error: Optional[str] = FieldInfo(alias="lastError", default=None) + + last_status_code: Optional[int] = FieldInfo(alias="lastStatusCode", default=None) class WebhookListDeliveriesResponse(BaseModel): diff --git a/src/x_twitter_scraper/types/webhook_list_response.py b/src/x_twitter_scraper/types/webhook_list_response.py index c2502dc..430fe3c 100644 --- a/src/x_twitter_scraper/types/webhook_list_response.py +++ b/src/x_twitter_scraper/types/webhook_list_response.py @@ -1,11 +1,28 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo -from .webhook import Webhook from .._models import BaseModel -__all__ = ["WebhookListResponse"] +__all__ = ["WebhookListResponse", "Webhook"] + + +class Webhook(BaseModel): + id: str + + created_at: datetime = FieldInfo(alias="createdAt") + + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] = FieldInfo(alias="eventTypes") + + is_active: bool = FieldInfo(alias="isActive") + + url: str class WebhookListResponse(BaseModel): diff --git a/src/x_twitter_scraper/types/webhook_update_params.py b/src/x_twitter_scraper/types/webhook_update_params.py index 81491d1..0b97cb4 100644 --- a/src/x_twitter_scraper/types/webhook_update_params.py +++ b/src/x_twitter_scraper/types/webhook_update_params.py @@ -3,16 +3,18 @@ from __future__ import annotations from typing import List -from typing_extensions import Annotated, TypedDict +from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -from .shared.event_type import EventType __all__ = ["WebhookUpdateParams"] class WebhookUpdateParams(TypedDict, total=False): - event_types: Annotated[List[EventType], PropertyInfo(alias="eventTypes")] + event_types: Annotated[ + List[Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"]], + PropertyInfo(alias="eventTypes"), + ] is_active: Annotated[bool, PropertyInfo(alias="isActive")] diff --git a/src/x_twitter_scraper/types/webhook.py b/src/x_twitter_scraper/types/webhook_update_response.py similarity index 55% rename from src/x_twitter_scraper/types/webhook.py rename to src/x_twitter_scraper/types/webhook_update_response.py index ab547c5..a164fd2 100644 --- a/src/x_twitter_scraper/types/webhook.py +++ b/src/x_twitter_scraper/types/webhook_update_response.py @@ -2,21 +2,23 @@ from typing import List from datetime import datetime +from typing_extensions import Literal from pydantic import Field as FieldInfo from .._models import BaseModel -from .shared.event_type import EventType -__all__ = ["Webhook"] +__all__ = ["WebhookUpdateResponse"] -class Webhook(BaseModel): +class WebhookUpdateResponse(BaseModel): id: str created_at: datetime = FieldInfo(alias="createdAt") - event_types: List[EventType] = FieldInfo(alias="eventTypes") + event_types: List[ + Literal["tweet.new", "tweet.reply", "tweet.retweet", "tweet.quote", "follower.gained", "follower.lost"] + ] = FieldInfo(alias="eventTypes") is_active: bool = FieldInfo(alias="isActive") diff --git a/src/x_twitter_scraper/types/winner.py b/src/x_twitter_scraper/types/winner.py deleted file mode 100644 index 1f86458..0000000 --- a/src/x_twitter_scraper/types/winner.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["Winner"] - - -class Winner(BaseModel): - author_username: str = FieldInfo(alias="authorUsername") - - is_backup: bool = FieldInfo(alias="isBackup") - - position: int - - tweet_id: str = FieldInfo(alias="tweetId") diff --git a/src/x_twitter_scraper/types/x/__init__.py b/src/x_twitter_scraper/types/x/__init__.py index 68c5308..85c7b30 100644 --- a/src/x_twitter_scraper/types/x/__init__.py +++ b/src/x_twitter_scraper/types/x/__init__.py @@ -2,14 +2,8 @@ from __future__ import annotations -from .x_account import XAccount as XAccount -from .search_tweet import SearchTweet as SearchTweet -from .tweet_author import TweetAuthor as TweetAuthor -from .tweet_detail import TweetDetail as TweetDetail -from .user_profile import UserProfile as UserProfile from .dm_send_params import DmSendParams as DmSendParams from .dm_send_response import DmSendResponse as DmSendResponse -from .x_account_detail import XAccountDetail as XAccountDetail from .tweet_list_params import TweetListParams as TweetListParams from .media_upload_params import MediaUploadParams as MediaUploadParams from .tweet_create_params import TweetCreateParams as TweetCreateParams @@ -25,10 +19,12 @@ from .profile_update_params import ProfileUpdateParams as ProfileUpdateParams from .tweet_create_response import TweetCreateResponse as TweetCreateResponse from .tweet_delete_response import TweetDeleteResponse as TweetDeleteResponse +from .tweet_search_response import TweetSearchResponse as TweetSearchResponse +from .bookmark_list_response import BookmarkListResponse as BookmarkListResponse +from .user_retrieve_response import UserRetrieveResponse as UserRetrieveResponse from .account_create_response import AccountCreateResponse as AccountCreateResponse from .account_delete_response import AccountDeleteResponse as AccountDeleteResponse from .account_reauth_response import AccountReauthResponse as AccountReauthResponse -from .community_action_result import CommunityActionResult as CommunityActionResult from .community_create_params import CommunityCreateParams as CommunityCreateParams from .community_delete_params import CommunityDeleteParams as CommunityDeleteParams from .follower_check_response import FollowerCheckResponse as FollowerCheckResponse @@ -38,9 +34,13 @@ from .tweet_get_thread_params import TweetGetThreadParams as TweetGetThreadParams from .tweet_retrieve_response import TweetRetrieveResponse as TweetRetrieveResponse from .tweet_get_replies_params import TweetGetRepliesParams as TweetGetRepliesParams +from .account_retrieve_response import AccountRetrieveResponse as AccountRetrieveResponse from .community_create_response import CommunityCreateResponse as CommunityCreateResponse from .community_delete_response import CommunityDeleteResponse as CommunityDeleteResponse +from .tweet_get_quotes_response import TweetGetQuotesResponse as TweetGetQuotesResponse +from .tweet_get_thread_response import TweetGetThreadResponse as TweetGetThreadResponse from .dm_retrieve_history_params import DmRetrieveHistoryParams as DmRetrieveHistoryParams +from .tweet_get_replies_response import TweetGetRepliesResponse as TweetGetRepliesResponse from .user_retrieve_batch_params import UserRetrieveBatchParams as UserRetrieveBatchParams from .user_retrieve_likes_params import UserRetrieveLikesParams as UserRetrieveLikesParams from .user_retrieve_media_params import UserRetrieveMediaParams as UserRetrieveMediaParams @@ -53,7 +53,12 @@ from .list_retrieve_members_params import ListRetrieveMembersParams as ListRetrieveMembersParams from .profile_update_avatar_params import ProfileUpdateAvatarParams as ProfileUpdateAvatarParams from .profile_update_banner_params import ProfileUpdateBannerParams as ProfileUpdateBannerParams +from .user_retrieve_likes_response import UserRetrieveLikesResponse as UserRetrieveLikesResponse +from .user_retrieve_media_response import UserRetrieveMediaResponse as UserRetrieveMediaResponse +from .tweet_get_favoriters_response import TweetGetFavoritersResponse as TweetGetFavoritersResponse +from .tweet_get_retweeters_response import TweetGetRetweetersResponse as TweetGetRetweetersResponse from .user_retrieve_mentions_params import UserRetrieveMentionsParams as UserRetrieveMentionsParams +from .user_retrieve_tweets_response import UserRetrieveTweetsResponse as UserRetrieveTweetsResponse from .list_retrieve_followers_params import ListRetrieveFollowersParams as ListRetrieveFollowersParams from .profile_update_avatar_response import ProfileUpdateAvatarResponse as ProfileUpdateAvatarResponse from .profile_update_banner_response import ProfileUpdateBannerResponse as ProfileUpdateBannerResponse @@ -70,3 +75,6 @@ from .user_retrieve_verified_followers_params import ( UserRetrieveVerifiedFollowersParams as UserRetrieveVerifiedFollowersParams, ) +from .user_retrieve_followers_you_know_response import ( + UserRetrieveFollowersYouKnowResponse as UserRetrieveFollowersYouKnowResponse, +) diff --git a/src/x_twitter_scraper/types/x/account_list_response.py b/src/x_twitter_scraper/types/x/account_list_response.py index f70c0aa..5edd3ca 100644 --- a/src/x_twitter_scraper/types/x/account_list_response.py +++ b/src/x_twitter_scraper/types/x/account_list_response.py @@ -1,12 +1,26 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List +from datetime import datetime + +from pydantic import Field as FieldInfo from ..._models import BaseModel -from .x_account import XAccount -__all__ = ["AccountListResponse"] +__all__ = ["AccountListResponse", "Account"] + + +class Account(BaseModel): + id: str + + created_at: datetime = FieldInfo(alias="createdAt") + + status: str + + x_user_id: str = FieldInfo(alias="xUserId") + + x_username: str = FieldInfo(alias="xUsername") class AccountListResponse(BaseModel): - accounts: List[XAccount] + accounts: List[Account] diff --git a/src/x_twitter_scraper/types/x/x_account_detail.py b/src/x_twitter_scraper/types/x/account_retrieve_response.py similarity index 89% rename from src/x_twitter_scraper/types/x/x_account_detail.py rename to src/x_twitter_scraper/types/x/account_retrieve_response.py index 3d86643..ebd2440 100644 --- a/src/x_twitter_scraper/types/x/x_account_detail.py +++ b/src/x_twitter_scraper/types/x/account_retrieve_response.py @@ -7,10 +7,10 @@ from ..._models import BaseModel -__all__ = ["XAccountDetail"] +__all__ = ["AccountRetrieveResponse"] -class XAccountDetail(BaseModel): +class AccountRetrieveResponse(BaseModel): id: str created_at: datetime = FieldInfo(alias="createdAt") diff --git a/src/x_twitter_scraper/types/x/bookmark_list_response.py b/src/x_twitter_scraper/types/x/bookmark_list_response.py new file mode 100644 index 0000000..e3f78ec --- /dev/null +++ b/src/x_twitter_scraper/types/x/bookmark_list_response.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["BookmarkListResponse", "Tweet", "TweetAuthor"] + + +class TweetAuthor(BaseModel): + id: str + + name: str + + username: str + + verified: Optional[bool] = None + + +class Tweet(BaseModel): + id: str + + text: str + + author: Optional[TweetAuthor] = None + + bookmark_count: Optional[int] = FieldInfo(alias="bookmarkCount", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + like_count: Optional[int] = FieldInfo(alias="likeCount", default=None) + + quote_count: Optional[int] = FieldInfo(alias="quoteCount", default=None) + + reply_count: Optional[int] = FieldInfo(alias="replyCount", default=None) + + retweet_count: Optional[int] = FieldInfo(alias="retweetCount", default=None) + + view_count: Optional[int] = FieldInfo(alias="viewCount", default=None) + + +class BookmarkListResponse(BaseModel): + has_next_page: bool + + next_cursor: str + + tweets: List[Tweet] diff --git a/src/x_twitter_scraper/types/x/communities/__init__.py b/src/x_twitter_scraper/types/x/communities/__init__.py index 4bac4d4..004ae9b 100644 --- a/src/x_twitter_scraper/types/x/communities/__init__.py +++ b/src/x_twitter_scraper/types/x/communities/__init__.py @@ -4,4 +4,6 @@ from .tweet_list_params import TweetListParams as TweetListParams from .join_create_params import JoinCreateParams as JoinCreateParams +from .join_create_response import JoinCreateResponse as JoinCreateResponse from .join_delete_all_params import JoinDeleteAllParams as JoinDeleteAllParams +from .join_delete_all_response import JoinDeleteAllResponse as JoinDeleteAllResponse diff --git a/src/x_twitter_scraper/types/x/community_action_result.py b/src/x_twitter_scraper/types/x/communities/join_create_response.py similarity index 74% rename from src/x_twitter_scraper/types/x/community_action_result.py rename to src/x_twitter_scraper/types/x/communities/join_create_response.py index 2af05ce..0950654 100644 --- a/src/x_twitter_scraper/types/x/community_action_result.py +++ b/src/x_twitter_scraper/types/x/communities/join_create_response.py @@ -4,12 +4,12 @@ from pydantic import Field as FieldInfo -from ..._models import BaseModel +from ...._models import BaseModel -__all__ = ["CommunityActionResult"] +__all__ = ["JoinCreateResponse"] -class CommunityActionResult(BaseModel): +class JoinCreateResponse(BaseModel): community_id: str = FieldInfo(alias="communityId") community_name: str = FieldInfo(alias="communityName") diff --git a/src/x_twitter_scraper/types/x/communities/join_delete_all_response.py b/src/x_twitter_scraper/types/x/communities/join_delete_all_response.py new file mode 100644 index 0000000..120392c --- /dev/null +++ b/src/x_twitter_scraper/types/x/communities/join_delete_all_response.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["JoinDeleteAllResponse"] + + +class JoinDeleteAllResponse(BaseModel): + community_id: str = FieldInfo(alias="communityId") + + community_name: str = FieldInfo(alias="communityName") + + success: Literal[True] diff --git a/src/x_twitter_scraper/types/x/tweet_author.py b/src/x_twitter_scraper/types/x/tweet_author.py deleted file mode 100644 index 2ba064f..0000000 --- a/src/x_twitter_scraper/types/x/tweet_author.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["TweetAuthor"] - - -class TweetAuthor(BaseModel): - id: str - - followers: int - - username: str - - verified: bool - - profile_picture: Optional[str] = FieldInfo(alias="profilePicture", default=None) diff --git a/src/x_twitter_scraper/types/x/tweet_detail.py b/src/x_twitter_scraper/types/x/tweet_detail.py deleted file mode 100644 index 44bc0db..0000000 --- a/src/x_twitter_scraper/types/x/tweet_detail.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["TweetDetail"] - - -class TweetDetail(BaseModel): - id: str - - bookmark_count: int = FieldInfo(alias="bookmarkCount") - - like_count: int = FieldInfo(alias="likeCount") - - quote_count: int = FieldInfo(alias="quoteCount") - - reply_count: int = FieldInfo(alias="replyCount") - - retweet_count: int = FieldInfo(alias="retweetCount") - - text: str - - view_count: int = FieldInfo(alias="viewCount") - - created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) diff --git a/src/x_twitter_scraper/types/x/tweet_get_favoriters_response.py b/src/x_twitter_scraper/types/x/tweet_get_favoriters_response.py new file mode 100644 index 0000000..fe3f9e0 --- /dev/null +++ b/src/x_twitter_scraper/types/x/tweet_get_favoriters_response.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["TweetGetFavoritersResponse", "User"] + + +class User(BaseModel): + id: str + + name: str + + username: str + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + description: Optional[str] = None + + followers: Optional[int] = None + + following: Optional[int] = None + + location: Optional[str] = None + + profile_picture: Optional[str] = FieldInfo(alias="profilePicture", default=None) + + statuses_count: Optional[int] = FieldInfo(alias="statusesCount", default=None) + + verified: Optional[bool] = None + + +class TweetGetFavoritersResponse(BaseModel): + has_next_page: bool + + next_cursor: str + + users: List[User] diff --git a/src/x_twitter_scraper/types/x/tweet_get_quotes_response.py b/src/x_twitter_scraper/types/x/tweet_get_quotes_response.py new file mode 100644 index 0000000..a23f482 --- /dev/null +++ b/src/x_twitter_scraper/types/x/tweet_get_quotes_response.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["TweetGetQuotesResponse", "Tweet", "TweetAuthor"] + + +class TweetAuthor(BaseModel): + id: str + + name: str + + username: str + + verified: Optional[bool] = None + + +class Tweet(BaseModel): + id: str + + text: str + + author: Optional[TweetAuthor] = None + + bookmark_count: Optional[int] = FieldInfo(alias="bookmarkCount", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + like_count: Optional[int] = FieldInfo(alias="likeCount", default=None) + + quote_count: Optional[int] = FieldInfo(alias="quoteCount", default=None) + + reply_count: Optional[int] = FieldInfo(alias="replyCount", default=None) + + retweet_count: Optional[int] = FieldInfo(alias="retweetCount", default=None) + + view_count: Optional[int] = FieldInfo(alias="viewCount", default=None) + + +class TweetGetQuotesResponse(BaseModel): + has_next_page: bool + + next_cursor: str + + tweets: List[Tweet] diff --git a/src/x_twitter_scraper/types/x/tweet_get_replies_response.py b/src/x_twitter_scraper/types/x/tweet_get_replies_response.py new file mode 100644 index 0000000..4169574 --- /dev/null +++ b/src/x_twitter_scraper/types/x/tweet_get_replies_response.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["TweetGetRepliesResponse", "Tweet", "TweetAuthor"] + + +class TweetAuthor(BaseModel): + id: str + + name: str + + username: str + + verified: Optional[bool] = None + + +class Tweet(BaseModel): + id: str + + text: str + + author: Optional[TweetAuthor] = None + + bookmark_count: Optional[int] = FieldInfo(alias="bookmarkCount", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + like_count: Optional[int] = FieldInfo(alias="likeCount", default=None) + + quote_count: Optional[int] = FieldInfo(alias="quoteCount", default=None) + + reply_count: Optional[int] = FieldInfo(alias="replyCount", default=None) + + retweet_count: Optional[int] = FieldInfo(alias="retweetCount", default=None) + + view_count: Optional[int] = FieldInfo(alias="viewCount", default=None) + + +class TweetGetRepliesResponse(BaseModel): + has_next_page: bool + + next_cursor: str + + tweets: List[Tweet] diff --git a/src/x_twitter_scraper/types/x/tweet_get_retweeters_response.py b/src/x_twitter_scraper/types/x/tweet_get_retweeters_response.py new file mode 100644 index 0000000..de218ef --- /dev/null +++ b/src/x_twitter_scraper/types/x/tweet_get_retweeters_response.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["TweetGetRetweetersResponse", "User"] + + +class User(BaseModel): + id: str + + name: str + + username: str + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + description: Optional[str] = None + + followers: Optional[int] = None + + following: Optional[int] = None + + location: Optional[str] = None + + profile_picture: Optional[str] = FieldInfo(alias="profilePicture", default=None) + + statuses_count: Optional[int] = FieldInfo(alias="statusesCount", default=None) + + verified: Optional[bool] = None + + +class TweetGetRetweetersResponse(BaseModel): + has_next_page: bool + + next_cursor: str + + users: List[User] diff --git a/src/x_twitter_scraper/types/x/tweet_get_thread_response.py b/src/x_twitter_scraper/types/x/tweet_get_thread_response.py new file mode 100644 index 0000000..641898e --- /dev/null +++ b/src/x_twitter_scraper/types/x/tweet_get_thread_response.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["TweetGetThreadResponse", "Tweet", "TweetAuthor"] + + +class TweetAuthor(BaseModel): + id: str + + name: str + + username: str + + verified: Optional[bool] = None + + +class Tweet(BaseModel): + id: str + + text: str + + author: Optional[TweetAuthor] = None + + bookmark_count: Optional[int] = FieldInfo(alias="bookmarkCount", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + like_count: Optional[int] = FieldInfo(alias="likeCount", default=None) + + quote_count: Optional[int] = FieldInfo(alias="quoteCount", default=None) + + reply_count: Optional[int] = FieldInfo(alias="replyCount", default=None) + + retweet_count: Optional[int] = FieldInfo(alias="retweetCount", default=None) + + view_count: Optional[int] = FieldInfo(alias="viewCount", default=None) + + +class TweetGetThreadResponse(BaseModel): + has_next_page: bool + + next_cursor: str + + tweets: List[Tweet] diff --git a/src/x_twitter_scraper/types/x/tweet_retrieve_response.py b/src/x_twitter_scraper/types/x/tweet_retrieve_response.py index cdffa27..c5215f3 100644 --- a/src/x_twitter_scraper/types/x/tweet_retrieve_response.py +++ b/src/x_twitter_scraper/types/x/tweet_retrieve_response.py @@ -2,14 +2,46 @@ from typing import Optional +from pydantic import Field as FieldInfo + from ..._models import BaseModel -from .tweet_author import TweetAuthor -from .tweet_detail import TweetDetail -__all__ = ["TweetRetrieveResponse"] +__all__ = ["TweetRetrieveResponse", "Tweet", "Author"] + + +class Tweet(BaseModel): + id: str + + bookmark_count: int = FieldInfo(alias="bookmarkCount") + + like_count: int = FieldInfo(alias="likeCount") + + quote_count: int = FieldInfo(alias="quoteCount") + + reply_count: int = FieldInfo(alias="replyCount") + + retweet_count: int = FieldInfo(alias="retweetCount") + + text: str + + view_count: int = FieldInfo(alias="viewCount") + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + +class Author(BaseModel): + id: str + + followers: int + + username: str + + verified: bool + + profile_picture: Optional[str] = FieldInfo(alias="profilePicture", default=None) class TweetRetrieveResponse(BaseModel): - tweet: TweetDetail + tweet: Tweet - author: Optional[TweetAuthor] = None + author: Optional[Author] = None diff --git a/src/x_twitter_scraper/types/x/search_tweet.py b/src/x_twitter_scraper/types/x/tweet_search_response.py similarity index 73% rename from src/x_twitter_scraper/types/x/search_tweet.py rename to src/x_twitter_scraper/types/x/tweet_search_response.py index 7530903..fc721e2 100644 --- a/src/x_twitter_scraper/types/x/search_tweet.py +++ b/src/x_twitter_scraper/types/x/tweet_search_response.py @@ -1,15 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Optional from pydantic import Field as FieldInfo from ..._models import BaseModel -__all__ = ["SearchTweet", "Author"] +__all__ = ["TweetSearchResponse", "Tweet", "TweetAuthor"] -class Author(BaseModel): +class TweetAuthor(BaseModel): id: str name: str @@ -19,12 +19,12 @@ class Author(BaseModel): verified: Optional[bool] = None -class SearchTweet(BaseModel): +class Tweet(BaseModel): id: str text: str - author: Optional[Author] = None + author: Optional[TweetAuthor] = None bookmark_count: Optional[int] = FieldInfo(alias="bookmarkCount", default=None) @@ -39,3 +39,11 @@ class SearchTweet(BaseModel): retweet_count: Optional[int] = FieldInfo(alias="retweetCount", default=None) view_count: Optional[int] = FieldInfo(alias="viewCount", default=None) + + +class TweetSearchResponse(BaseModel): + has_next_page: bool + + next_cursor: str + + tweets: List[Tweet] diff --git a/src/x_twitter_scraper/types/x/user_retrieve_followers_you_know_response.py b/src/x_twitter_scraper/types/x/user_retrieve_followers_you_know_response.py new file mode 100644 index 0000000..2c325f2 --- /dev/null +++ b/src/x_twitter_scraper/types/x/user_retrieve_followers_you_know_response.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["UserRetrieveFollowersYouKnowResponse", "User"] + + +class User(BaseModel): + id: str + + name: str + + username: str + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + description: Optional[str] = None + + followers: Optional[int] = None + + following: Optional[int] = None + + location: Optional[str] = None + + profile_picture: Optional[str] = FieldInfo(alias="profilePicture", default=None) + + statuses_count: Optional[int] = FieldInfo(alias="statusesCount", default=None) + + verified: Optional[bool] = None + + +class UserRetrieveFollowersYouKnowResponse(BaseModel): + has_next_page: bool + + next_cursor: str + + users: List[User] diff --git a/src/x_twitter_scraper/types/x/user_retrieve_likes_response.py b/src/x_twitter_scraper/types/x/user_retrieve_likes_response.py new file mode 100644 index 0000000..2364e68 --- /dev/null +++ b/src/x_twitter_scraper/types/x/user_retrieve_likes_response.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["UserRetrieveLikesResponse", "Tweet", "TweetAuthor"] + + +class TweetAuthor(BaseModel): + id: str + + name: str + + username: str + + verified: Optional[bool] = None + + +class Tweet(BaseModel): + id: str + + text: str + + author: Optional[TweetAuthor] = None + + bookmark_count: Optional[int] = FieldInfo(alias="bookmarkCount", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + like_count: Optional[int] = FieldInfo(alias="likeCount", default=None) + + quote_count: Optional[int] = FieldInfo(alias="quoteCount", default=None) + + reply_count: Optional[int] = FieldInfo(alias="replyCount", default=None) + + retweet_count: Optional[int] = FieldInfo(alias="retweetCount", default=None) + + view_count: Optional[int] = FieldInfo(alias="viewCount", default=None) + + +class UserRetrieveLikesResponse(BaseModel): + has_next_page: bool + + next_cursor: str + + tweets: List[Tweet] diff --git a/src/x_twitter_scraper/types/x/user_retrieve_media_response.py b/src/x_twitter_scraper/types/x/user_retrieve_media_response.py new file mode 100644 index 0000000..fc4656c --- /dev/null +++ b/src/x_twitter_scraper/types/x/user_retrieve_media_response.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["UserRetrieveMediaResponse", "Tweet", "TweetAuthor"] + + +class TweetAuthor(BaseModel): + id: str + + name: str + + username: str + + verified: Optional[bool] = None + + +class Tweet(BaseModel): + id: str + + text: str + + author: Optional[TweetAuthor] = None + + bookmark_count: Optional[int] = FieldInfo(alias="bookmarkCount", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + like_count: Optional[int] = FieldInfo(alias="likeCount", default=None) + + quote_count: Optional[int] = FieldInfo(alias="quoteCount", default=None) + + reply_count: Optional[int] = FieldInfo(alias="replyCount", default=None) + + retweet_count: Optional[int] = FieldInfo(alias="retweetCount", default=None) + + view_count: Optional[int] = FieldInfo(alias="viewCount", default=None) + + +class UserRetrieveMediaResponse(BaseModel): + has_next_page: bool + + next_cursor: str + + tweets: List[Tweet] diff --git a/src/x_twitter_scraper/types/x/user_profile.py b/src/x_twitter_scraper/types/x/user_retrieve_response.py similarity index 90% rename from src/x_twitter_scraper/types/x/user_profile.py rename to src/x_twitter_scraper/types/x/user_retrieve_response.py index e0d0a0c..04cb475 100644 --- a/src/x_twitter_scraper/types/x/user_profile.py +++ b/src/x_twitter_scraper/types/x/user_retrieve_response.py @@ -6,10 +6,10 @@ from ..._models import BaseModel -__all__ = ["UserProfile"] +__all__ = ["UserRetrieveResponse"] -class UserProfile(BaseModel): +class UserRetrieveResponse(BaseModel): id: str name: str diff --git a/src/x_twitter_scraper/types/x/user_retrieve_tweets_response.py b/src/x_twitter_scraper/types/x/user_retrieve_tweets_response.py new file mode 100644 index 0000000..b9d5f67 --- /dev/null +++ b/src/x_twitter_scraper/types/x/user_retrieve_tweets_response.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["UserRetrieveTweetsResponse", "Tweet", "TweetAuthor"] + + +class TweetAuthor(BaseModel): + id: str + + name: str + + username: str + + verified: Optional[bool] = None + + +class Tweet(BaseModel): + id: str + + text: str + + author: Optional[TweetAuthor] = None + + bookmark_count: Optional[int] = FieldInfo(alias="bookmarkCount", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + like_count: Optional[int] = FieldInfo(alias="likeCount", default=None) + + quote_count: Optional[int] = FieldInfo(alias="quoteCount", default=None) + + reply_count: Optional[int] = FieldInfo(alias="replyCount", default=None) + + retweet_count: Optional[int] = FieldInfo(alias="retweetCount", default=None) + + view_count: Optional[int] = FieldInfo(alias="viewCount", default=None) + + +class UserRetrieveTweetsResponse(BaseModel): + has_next_page: bool + + next_cursor: str + + tweets: List[Tweet] diff --git a/src/x_twitter_scraper/types/x/x_account.py b/src/x_twitter_scraper/types/x/x_account.py deleted file mode 100644 index 4b8b5dd..0000000 --- a/src/x_twitter_scraper/types/x/x_account.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from datetime import datetime - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["XAccount"] - - -class XAccount(BaseModel): - id: str - - created_at: datetime = FieldInfo(alias="createdAt") - - status: str - - x_user_id: str = FieldInfo(alias="xUserId") - - x_username: str = FieldInfo(alias="xUsername") diff --git a/src/x_twitter_scraper/types/x_get_article_response.py b/src/x_twitter_scraper/types/x_get_article_response.py index ab885b3..f42ab88 100644 --- a/src/x_twitter_scraper/types/x_get_article_response.py +++ b/src/x_twitter_scraper/types/x_get_article_response.py @@ -5,9 +5,8 @@ from pydantic import Field as FieldInfo from .._models import BaseModel -from .x.tweet_author import TweetAuthor -__all__ = ["XGetArticleResponse", "Article", "ArticleContent"] +__all__ = ["XGetArticleResponse", "Article", "ArticleContent", "Author"] class ArticleContent(BaseModel): @@ -47,7 +46,19 @@ class Article(BaseModel): view_count: Optional[int] = FieldInfo(alias="viewCount", default=None) +class Author(BaseModel): + id: str + + followers: int + + username: str + + verified: bool + + profile_picture: Optional[str] = FieldInfo(alias="profilePicture", default=None) + + class XGetArticleResponse(BaseModel): article: Article - author: Optional[TweetAuthor] = None + author: Optional[Author] = None diff --git a/src/x_twitter_scraper/types/x_get_home_timeline_response.py b/src/x_twitter_scraper/types/x_get_home_timeline_response.py new file mode 100644 index 0000000..26f9f7a --- /dev/null +++ b/src/x_twitter_scraper/types/x_get_home_timeline_response.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["XGetHomeTimelineResponse", "Tweet", "TweetAuthor"] + + +class TweetAuthor(BaseModel): + id: str + + name: str + + username: str + + verified: Optional[bool] = None + + +class Tweet(BaseModel): + id: str + + text: str + + author: Optional[TweetAuthor] = None + + bookmark_count: Optional[int] = FieldInfo(alias="bookmarkCount", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + like_count: Optional[int] = FieldInfo(alias="likeCount", default=None) + + quote_count: Optional[int] = FieldInfo(alias="quoteCount", default=None) + + reply_count: Optional[int] = FieldInfo(alias="replyCount", default=None) + + retweet_count: Optional[int] = FieldInfo(alias="retweetCount", default=None) + + view_count: Optional[int] = FieldInfo(alias="viewCount", default=None) + + +class XGetHomeTimelineResponse(BaseModel): + has_next_page: bool + + next_cursor: str + + tweets: List[Tweet] diff --git a/tests/api_resources/test_drafts.py b/tests/api_resources/test_drafts.py index 7b177f2..d92f2cf 100644 --- a/tests/api_resources/test_drafts.py +++ b/tests/api_resources/test_drafts.py @@ -9,7 +9,11 @@ from tests.utils import assert_matches_type from x_twitter_scraper import XTwitterScraper, AsyncXTwitterScraper -from x_twitter_scraper.types import DraftDetail, DraftListResponse +from x_twitter_scraper.types import ( + DraftListResponse, + DraftCreateResponse, + DraftRetrieveResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +27,7 @@ def test_method_create(self, client: XTwitterScraper) -> None: draft = client.drafts.create( text="text", ) - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftCreateResponse, draft, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -33,7 +37,7 @@ def test_method_create_with_all_params(self, client: XTwitterScraper) -> None: goal="engagement", topic="topic", ) - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftCreateResponse, draft, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -45,7 +49,7 @@ def test_raw_response_create(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" draft = response.parse() - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftCreateResponse, draft, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -57,7 +61,7 @@ def test_streaming_response_create(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" draft = response.parse() - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftCreateResponse, draft, path=["response"]) assert cast(Any, response.is_closed) is True @@ -67,7 +71,7 @@ def test_method_retrieve(self, client: XTwitterScraper) -> None: draft = client.drafts.retrieve( "id", ) - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftRetrieveResponse, draft, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -79,7 +83,7 @@ def test_raw_response_retrieve(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" draft = response.parse() - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftRetrieveResponse, draft, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -91,7 +95,7 @@ def test_streaming_response_retrieve(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" draft = response.parse() - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftRetrieveResponse, draft, path=["response"]) assert cast(Any, response.is_closed) is True @@ -194,7 +198,7 @@ async def test_method_create(self, async_client: AsyncXTwitterScraper) -> None: draft = await async_client.drafts.create( text="text", ) - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftCreateResponse, draft, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -204,7 +208,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncXTwitterSc goal="engagement", topic="topic", ) - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftCreateResponse, draft, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -216,7 +220,7 @@ async def test_raw_response_create(self, async_client: AsyncXTwitterScraper) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" draft = await response.parse() - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftCreateResponse, draft, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -228,7 +232,7 @@ async def test_streaming_response_create(self, async_client: AsyncXTwitterScrape assert response.http_request.headers.get("X-Stainless-Lang") == "python" draft = await response.parse() - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftCreateResponse, draft, path=["response"]) assert cast(Any, response.is_closed) is True @@ -238,7 +242,7 @@ async def test_method_retrieve(self, async_client: AsyncXTwitterScraper) -> None draft = await async_client.drafts.retrieve( "id", ) - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftRetrieveResponse, draft, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -250,7 +254,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncXTwitterScraper) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" draft = await response.parse() - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftRetrieveResponse, draft, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -262,7 +266,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncXTwitterScra assert response.http_request.headers.get("X-Stainless-Lang") == "python" draft = await response.parse() - assert_matches_type(DraftDetail, draft, path=["response"]) + assert_matches_type(DraftRetrieveResponse, draft, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_events.py b/tests/api_resources/test_events.py index 04e9832..163ae6d 100644 --- a/tests/api_resources/test_events.py +++ b/tests/api_resources/test_events.py @@ -9,7 +9,7 @@ from tests.utils import assert_matches_type from x_twitter_scraper import XTwitterScraper, AsyncXTwitterScraper -from x_twitter_scraper.types import EventDetail, EventListResponse +from x_twitter_scraper.types import EventListResponse, EventRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_retrieve(self, client: XTwitterScraper) -> None: event = client.events.retrieve( "id", ) - assert_matches_type(EventDetail, event, path=["response"]) + assert_matches_type(EventRetrieveResponse, event, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -35,7 +35,7 @@ def test_raw_response_retrieve(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(EventDetail, event, path=["response"]) + assert_matches_type(EventRetrieveResponse, event, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -47,7 +47,7 @@ def test_streaming_response_retrieve(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(EventDetail, event, path=["response"]) + assert_matches_type(EventRetrieveResponse, event, path=["response"]) assert cast(Any, response.is_closed) is True @@ -110,7 +110,7 @@ async def test_method_retrieve(self, async_client: AsyncXTwitterScraper) -> None event = await async_client.events.retrieve( "id", ) - assert_matches_type(EventDetail, event, path=["response"]) + assert_matches_type(EventRetrieveResponse, event, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -122,7 +122,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncXTwitterScraper) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(EventDetail, event, path=["response"]) + assert_matches_type(EventRetrieveResponse, event, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -134,7 +134,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncXTwitterScra assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(EventDetail, event, path=["response"]) + assert_matches_type(EventRetrieveResponse, event, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_integrations.py b/tests/api_resources/test_integrations.py index d24c963..1d31b16 100644 --- a/tests/api_resources/test_integrations.py +++ b/tests/api_resources/test_integrations.py @@ -10,9 +10,11 @@ from tests.utils import assert_matches_type from x_twitter_scraper import XTwitterScraper, AsyncXTwitterScraper from x_twitter_scraper.types import ( - Integration, IntegrationListResponse, + IntegrationCreateResponse, IntegrationDeleteResponse, + IntegrationUpdateResponse, + IntegrationRetrieveResponse, IntegrationSendTestResponse, IntegrationListDeliveriesResponse, ) @@ -32,7 +34,7 @@ def test_method_create(self, client: XTwitterScraper) -> None: name="name", type="telegram", ) - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationCreateResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -47,7 +49,7 @@ def test_raw_response_create(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationCreateResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -62,7 +64,7 @@ def test_streaming_response_create(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationCreateResponse, integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +74,7 @@ def test_method_retrieve(self, client: XTwitterScraper) -> None: integration = client.integrations.retrieve( "id", ) - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationRetrieveResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -84,7 +86,7 @@ def test_raw_response_retrieve(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationRetrieveResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -96,7 +98,7 @@ def test_streaming_response_retrieve(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationRetrieveResponse, integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -114,7 +116,7 @@ def test_method_update(self, client: XTwitterScraper) -> None: integration = client.integrations.update( id="id", ) - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationUpdateResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -129,7 +131,7 @@ def test_method_update_with_all_params(self, client: XTwitterScraper) -> None: scope_all_monitors=True, silent_push=True, ) - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationUpdateResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -141,7 +143,7 @@ def test_raw_response_update(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationUpdateResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -153,7 +155,7 @@ def test_streaming_response_update(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationUpdateResponse, integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -343,7 +345,7 @@ async def test_method_create(self, async_client: AsyncXTwitterScraper) -> None: name="name", type="telegram", ) - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationCreateResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -358,7 +360,7 @@ async def test_raw_response_create(self, async_client: AsyncXTwitterScraper) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationCreateResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -373,7 +375,7 @@ async def test_streaming_response_create(self, async_client: AsyncXTwitterScrape assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationCreateResponse, integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -383,7 +385,7 @@ async def test_method_retrieve(self, async_client: AsyncXTwitterScraper) -> None integration = await async_client.integrations.retrieve( "id", ) - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationRetrieveResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -395,7 +397,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncXTwitterScraper) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationRetrieveResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -407,7 +409,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncXTwitterScra assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationRetrieveResponse, integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -425,7 +427,7 @@ async def test_method_update(self, async_client: AsyncXTwitterScraper) -> None: integration = await async_client.integrations.update( id="id", ) - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationUpdateResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -440,7 +442,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncXTwitterSc scope_all_monitors=True, silent_push=True, ) - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationUpdateResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -452,7 +454,7 @@ async def test_raw_response_update(self, async_client: AsyncXTwitterScraper) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationUpdateResponse, integration, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -464,7 +466,7 @@ async def test_streaming_response_update(self, async_client: AsyncXTwitterScrape assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(Integration, integration, path=["response"]) + assert_matches_type(IntegrationUpdateResponse, integration, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_monitors.py b/tests/api_resources/test_monitors.py index ff06d2a..09ef867 100644 --- a/tests/api_resources/test_monitors.py +++ b/tests/api_resources/test_monitors.py @@ -10,9 +10,10 @@ from tests.utils import assert_matches_type from x_twitter_scraper import XTwitterScraper, AsyncXTwitterScraper from x_twitter_scraper.types import ( - Monitor, MonitorListResponse, MonitorCreateResponse, + MonitorUpdateResponse, + MonitorRetrieveResponse, MonitorDeactivateResponse, ) @@ -65,7 +66,7 @@ def test_method_retrieve(self, client: XTwitterScraper) -> None: monitor = client.monitors.retrieve( "id", ) - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorRetrieveResponse, monitor, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -77,7 +78,7 @@ def test_raw_response_retrieve(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorRetrieveResponse, monitor, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -89,7 +90,7 @@ def test_streaming_response_retrieve(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorRetrieveResponse, monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -107,7 +108,7 @@ def test_method_update(self, client: XTwitterScraper) -> None: monitor = client.monitors.update( id="id", ) - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorUpdateResponse, monitor, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -117,7 +118,7 @@ def test_method_update_with_all_params(self, client: XTwitterScraper) -> None: event_types=["tweet.new"], is_active=True, ) - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorUpdateResponse, monitor, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -129,7 +130,7 @@ def test_raw_response_update(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorUpdateResponse, monitor, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -141,7 +142,7 @@ def test_streaming_response_update(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorUpdateResponse, monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -272,7 +273,7 @@ async def test_method_retrieve(self, async_client: AsyncXTwitterScraper) -> None monitor = await async_client.monitors.retrieve( "id", ) - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorRetrieveResponse, monitor, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -284,7 +285,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncXTwitterScraper) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorRetrieveResponse, monitor, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -296,7 +297,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncXTwitterScra assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorRetrieveResponse, monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -314,7 +315,7 @@ async def test_method_update(self, async_client: AsyncXTwitterScraper) -> None: monitor = await async_client.monitors.update( id="id", ) - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorUpdateResponse, monitor, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -324,7 +325,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncXTwitterSc event_types=["tweet.new"], is_active=True, ) - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorUpdateResponse, monitor, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -336,7 +337,7 @@ async def test_raw_response_update(self, async_client: AsyncXTwitterScraper) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorUpdateResponse, monitor, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -348,7 +349,7 @@ async def test_streaming_response_update(self, async_client: AsyncXTwitterScrape assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(Monitor, monitor, path=["response"]) + assert_matches_type(MonitorUpdateResponse, monitor, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_styles.py b/tests/api_resources/test_styles.py index 104dcfd..c6a142e 100644 --- a/tests/api_resources/test_styles.py +++ b/tests/api_resources/test_styles.py @@ -10,9 +10,11 @@ from tests.utils import assert_matches_type from x_twitter_scraper import XTwitterScraper, AsyncXTwitterScraper from x_twitter_scraper.types import ( - StyleProfile, StyleListResponse, + StyleUpdateResponse, + StyleAnalyzeResponse, StyleCompareResponse, + StyleRetrieveResponse, StyleGetPerformanceResponse, ) @@ -28,7 +30,7 @@ def test_method_retrieve(self, client: XTwitterScraper) -> None: style = client.styles.retrieve( "username", ) - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleRetrieveResponse, style, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -40,7 +42,7 @@ def test_raw_response_retrieve(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" style = response.parse() - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleRetrieveResponse, style, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -52,7 +54,7 @@ def test_streaming_response_retrieve(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" style = response.parse() - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleRetrieveResponse, style, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +74,7 @@ def test_method_update(self, client: XTwitterScraper) -> None: label="label", tweets=[{"text": "text"}], ) - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleUpdateResponse, style, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -86,7 +88,7 @@ def test_raw_response_update(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" style = response.parse() - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleUpdateResponse, style, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -100,7 +102,7 @@ def test_streaming_response_update(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" style = response.parse() - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleUpdateResponse, style, path=["response"]) assert cast(Any, response.is_closed) is True @@ -190,7 +192,7 @@ def test_method_analyze(self, client: XTwitterScraper) -> None: style = client.styles.analyze( username="username", ) - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleAnalyzeResponse, style, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -202,7 +204,7 @@ def test_raw_response_analyze(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" style = response.parse() - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleAnalyzeResponse, style, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -214,7 +216,7 @@ def test_streaming_response_analyze(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" style = response.parse() - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleAnalyzeResponse, style, path=["response"]) assert cast(Any, response.is_closed) is True @@ -309,7 +311,7 @@ async def test_method_retrieve(self, async_client: AsyncXTwitterScraper) -> None style = await async_client.styles.retrieve( "username", ) - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleRetrieveResponse, style, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -321,7 +323,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncXTwitterScraper) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" style = await response.parse() - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleRetrieveResponse, style, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -333,7 +335,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncXTwitterScra assert response.http_request.headers.get("X-Stainless-Lang") == "python" style = await response.parse() - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleRetrieveResponse, style, path=["response"]) assert cast(Any, response.is_closed) is True @@ -353,7 +355,7 @@ async def test_method_update(self, async_client: AsyncXTwitterScraper) -> None: label="label", tweets=[{"text": "text"}], ) - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleUpdateResponse, style, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -367,7 +369,7 @@ async def test_raw_response_update(self, async_client: AsyncXTwitterScraper) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" style = await response.parse() - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleUpdateResponse, style, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -381,7 +383,7 @@ async def test_streaming_response_update(self, async_client: AsyncXTwitterScrape assert response.http_request.headers.get("X-Stainless-Lang") == "python" style = await response.parse() - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleUpdateResponse, style, path=["response"]) assert cast(Any, response.is_closed) is True @@ -471,7 +473,7 @@ async def test_method_analyze(self, async_client: AsyncXTwitterScraper) -> None: style = await async_client.styles.analyze( username="username", ) - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleAnalyzeResponse, style, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -483,7 +485,7 @@ async def test_raw_response_analyze(self, async_client: AsyncXTwitterScraper) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" style = await response.parse() - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleAnalyzeResponse, style, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -495,7 +497,7 @@ async def test_streaming_response_analyze(self, async_client: AsyncXTwitterScrap assert response.http_request.headers.get("X-Stainless-Lang") == "python" style = await response.parse() - assert_matches_type(StyleProfile, style, path=["response"]) + assert_matches_type(StyleAnalyzeResponse, style, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_webhooks.py b/tests/api_resources/test_webhooks.py index e3ea33c..4faa1ae 100644 --- a/tests/api_resources/test_webhooks.py +++ b/tests/api_resources/test_webhooks.py @@ -10,10 +10,10 @@ from tests.utils import assert_matches_type from x_twitter_scraper import XTwitterScraper, AsyncXTwitterScraper from x_twitter_scraper.types import ( - Webhook, WebhookListResponse, WebhookTestResponse, WebhookCreateResponse, + WebhookUpdateResponse, WebhookDeactivateResponse, WebhookListDeliveriesResponse, ) @@ -67,7 +67,7 @@ def test_method_update(self, client: XTwitterScraper) -> None: webhook = client.webhooks.update( id="id", ) - assert_matches_type(Webhook, webhook, path=["response"]) + assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -78,7 +78,7 @@ def test_method_update_with_all_params(self, client: XTwitterScraper) -> None: is_active=True, url="https://example.com", ) - assert_matches_type(Webhook, webhook, path=["response"]) + assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -90,7 +90,7 @@ def test_raw_response_update(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(Webhook, webhook, path=["response"]) + assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -102,7 +102,7 @@ def test_streaming_response_update(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(Webhook, webhook, path=["response"]) + assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -317,7 +317,7 @@ async def test_method_update(self, async_client: AsyncXTwitterScraper) -> None: webhook = await async_client.webhooks.update( id="id", ) - assert_matches_type(Webhook, webhook, path=["response"]) + assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -328,7 +328,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncXTwitterSc is_active=True, url="https://example.com", ) - assert_matches_type(Webhook, webhook, path=["response"]) + assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -340,7 +340,7 @@ async def test_raw_response_update(self, async_client: AsyncXTwitterScraper) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(Webhook, webhook, path=["response"]) + assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -352,7 +352,7 @@ async def test_streaming_response_update(self, async_client: AsyncXTwitterScrape assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(Webhook, webhook, path=["response"]) + assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_x.py b/tests/api_resources/test_x.py index 6b2a662..09264c7 100644 --- a/tests/api_resources/test_x.py +++ b/tests/api_resources/test_x.py @@ -11,9 +11,9 @@ from x_twitter_scraper import XTwitterScraper, AsyncXTwitterScraper from x_twitter_scraper.types import ( XGetArticleResponse, + XGetHomeTimelineResponse, XGetNotificationsResponse, ) -from x_twitter_scraper.types.shared import PaginatedTweets base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -67,7 +67,7 @@ def test_path_params_get_article(self, client: XTwitterScraper) -> None: @parametrize def test_method_get_home_timeline(self, client: XTwitterScraper) -> None: x = client.x.get_home_timeline() - assert_matches_type(PaginatedTweets, x, path=["response"]) + assert_matches_type(XGetHomeTimelineResponse, x, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -76,7 +76,7 @@ def test_method_get_home_timeline_with_all_params(self, client: XTwitterScraper) cursor="cursor", seen_tweet_ids="seenTweetIds", ) - assert_matches_type(PaginatedTweets, x, path=["response"]) + assert_matches_type(XGetHomeTimelineResponse, x, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -86,7 +86,7 @@ def test_raw_response_get_home_timeline(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" x = response.parse() - assert_matches_type(PaginatedTweets, x, path=["response"]) + assert_matches_type(XGetHomeTimelineResponse, x, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -96,7 +96,7 @@ def test_streaming_response_get_home_timeline(self, client: XTwitterScraper) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" x = response.parse() - assert_matches_type(PaginatedTweets, x, path=["response"]) + assert_matches_type(XGetHomeTimelineResponse, x, path=["response"]) assert cast(Any, response.is_closed) is True @@ -217,7 +217,7 @@ async def test_path_params_get_article(self, async_client: AsyncXTwitterScraper) @parametrize async def test_method_get_home_timeline(self, async_client: AsyncXTwitterScraper) -> None: x = await async_client.x.get_home_timeline() - assert_matches_type(PaginatedTweets, x, path=["response"]) + assert_matches_type(XGetHomeTimelineResponse, x, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -226,7 +226,7 @@ async def test_method_get_home_timeline_with_all_params(self, async_client: Asyn cursor="cursor", seen_tweet_ids="seenTweetIds", ) - assert_matches_type(PaginatedTweets, x, path=["response"]) + assert_matches_type(XGetHomeTimelineResponse, x, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -236,7 +236,7 @@ async def test_raw_response_get_home_timeline(self, async_client: AsyncXTwitterS assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" x = await response.parse() - assert_matches_type(PaginatedTweets, x, path=["response"]) + assert_matches_type(XGetHomeTimelineResponse, x, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -246,7 +246,7 @@ async def test_streaming_response_get_home_timeline(self, async_client: AsyncXTw assert response.http_request.headers.get("X-Stainless-Lang") == "python" x = await response.parse() - assert_matches_type(PaginatedTweets, x, path=["response"]) + assert_matches_type(XGetHomeTimelineResponse, x, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/x/communities/test_join.py b/tests/api_resources/x/communities/test_join.py index db30722..d7c0a38 100644 --- a/tests/api_resources/x/communities/test_join.py +++ b/tests/api_resources/x/communities/test_join.py @@ -9,7 +9,10 @@ from tests.utils import assert_matches_type from x_twitter_scraper import XTwitterScraper, AsyncXTwitterScraper -from x_twitter_scraper.types.x import CommunityActionResult +from x_twitter_scraper.types.x.communities import ( + JoinCreateResponse, + JoinDeleteAllResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +27,7 @@ def test_method_create(self, client: XTwitterScraper) -> None: id="id", account="account", ) - assert_matches_type(CommunityActionResult, join, path=["response"]) + assert_matches_type(JoinCreateResponse, join, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -37,7 +40,7 @@ def test_raw_response_create(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" join = response.parse() - assert_matches_type(CommunityActionResult, join, path=["response"]) + assert_matches_type(JoinCreateResponse, join, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -50,7 +53,7 @@ def test_streaming_response_create(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" join = response.parse() - assert_matches_type(CommunityActionResult, join, path=["response"]) + assert_matches_type(JoinCreateResponse, join, path=["response"]) assert cast(Any, response.is_closed) is True @@ -70,7 +73,7 @@ def test_method_delete_all(self, client: XTwitterScraper) -> None: id="id", account="account", ) - assert_matches_type(CommunityActionResult, join, path=["response"]) + assert_matches_type(JoinDeleteAllResponse, join, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -83,7 +86,7 @@ def test_raw_response_delete_all(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" join = response.parse() - assert_matches_type(CommunityActionResult, join, path=["response"]) + assert_matches_type(JoinDeleteAllResponse, join, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -96,7 +99,7 @@ def test_streaming_response_delete_all(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" join = response.parse() - assert_matches_type(CommunityActionResult, join, path=["response"]) + assert_matches_type(JoinDeleteAllResponse, join, path=["response"]) assert cast(Any, response.is_closed) is True @@ -122,7 +125,7 @@ async def test_method_create(self, async_client: AsyncXTwitterScraper) -> None: id="id", account="account", ) - assert_matches_type(CommunityActionResult, join, path=["response"]) + assert_matches_type(JoinCreateResponse, join, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -135,7 +138,7 @@ async def test_raw_response_create(self, async_client: AsyncXTwitterScraper) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" join = await response.parse() - assert_matches_type(CommunityActionResult, join, path=["response"]) + assert_matches_type(JoinCreateResponse, join, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -148,7 +151,7 @@ async def test_streaming_response_create(self, async_client: AsyncXTwitterScrape assert response.http_request.headers.get("X-Stainless-Lang") == "python" join = await response.parse() - assert_matches_type(CommunityActionResult, join, path=["response"]) + assert_matches_type(JoinCreateResponse, join, path=["response"]) assert cast(Any, response.is_closed) is True @@ -168,7 +171,7 @@ async def test_method_delete_all(self, async_client: AsyncXTwitterScraper) -> No id="id", account="account", ) - assert_matches_type(CommunityActionResult, join, path=["response"]) + assert_matches_type(JoinDeleteAllResponse, join, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -181,7 +184,7 @@ async def test_raw_response_delete_all(self, async_client: AsyncXTwitterScraper) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" join = await response.parse() - assert_matches_type(CommunityActionResult, join, path=["response"]) + assert_matches_type(JoinDeleteAllResponse, join, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -194,7 +197,7 @@ async def test_streaming_response_delete_all(self, async_client: AsyncXTwitterSc assert response.http_request.headers.get("X-Stainless-Lang") == "python" join = await response.parse() - assert_matches_type(CommunityActionResult, join, path=["response"]) + assert_matches_type(JoinDeleteAllResponse, join, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/x/test_accounts.py b/tests/api_resources/x/test_accounts.py index 66080a7..d27f952 100644 --- a/tests/api_resources/x/test_accounts.py +++ b/tests/api_resources/x/test_accounts.py @@ -10,11 +10,11 @@ from tests.utils import assert_matches_type from x_twitter_scraper import XTwitterScraper, AsyncXTwitterScraper from x_twitter_scraper.types.x import ( - XAccountDetail, AccountListResponse, AccountCreateResponse, AccountDeleteResponse, AccountReauthResponse, + AccountRetrieveResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -81,7 +81,7 @@ def test_method_retrieve(self, client: XTwitterScraper) -> None: account = client.x.accounts.retrieve( "id", ) - assert_matches_type(XAccountDetail, account, path=["response"]) + assert_matches_type(AccountRetrieveResponse, account, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -93,7 +93,7 @@ def test_raw_response_retrieve(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" account = response.parse() - assert_matches_type(XAccountDetail, account, path=["response"]) + assert_matches_type(AccountRetrieveResponse, account, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -105,7 +105,7 @@ def test_streaming_response_retrieve(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" account = response.parse() - assert_matches_type(XAccountDetail, account, path=["response"]) + assert_matches_type(AccountRetrieveResponse, account, path=["response"]) assert cast(Any, response.is_closed) is True @@ -307,7 +307,7 @@ async def test_method_retrieve(self, async_client: AsyncXTwitterScraper) -> None account = await async_client.x.accounts.retrieve( "id", ) - assert_matches_type(XAccountDetail, account, path=["response"]) + assert_matches_type(AccountRetrieveResponse, account, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -319,7 +319,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncXTwitterScraper) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" account = await response.parse() - assert_matches_type(XAccountDetail, account, path=["response"]) + assert_matches_type(AccountRetrieveResponse, account, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -331,7 +331,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncXTwitterScra assert response.http_request.headers.get("X-Stainless-Lang") == "python" account = await response.parse() - assert_matches_type(XAccountDetail, account, path=["response"]) + assert_matches_type(AccountRetrieveResponse, account, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/x/test_bookmarks.py b/tests/api_resources/x/test_bookmarks.py index 8626f40..91ec077 100644 --- a/tests/api_resources/x/test_bookmarks.py +++ b/tests/api_resources/x/test_bookmarks.py @@ -9,8 +9,7 @@ from tests.utils import assert_matches_type from x_twitter_scraper import XTwitterScraper, AsyncXTwitterScraper -from x_twitter_scraper.types.x import BookmarkRetrieveFoldersResponse -from x_twitter_scraper.types.shared import PaginatedTweets +from x_twitter_scraper.types.x import BookmarkListResponse, BookmarkRetrieveFoldersResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,7 +21,7 @@ class TestBookmarks: @parametrize def test_method_list(self, client: XTwitterScraper) -> None: bookmark = client.x.bookmarks.list() - assert_matches_type(PaginatedTweets, bookmark, path=["response"]) + assert_matches_type(BookmarkListResponse, bookmark, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -31,7 +30,7 @@ def test_method_list_with_all_params(self, client: XTwitterScraper) -> None: cursor="cursor", folder_id="folderId", ) - assert_matches_type(PaginatedTweets, bookmark, path=["response"]) + assert_matches_type(BookmarkListResponse, bookmark, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -41,7 +40,7 @@ def test_raw_response_list(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = response.parse() - assert_matches_type(PaginatedTweets, bookmark, path=["response"]) + assert_matches_type(BookmarkListResponse, bookmark, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -51,7 +50,7 @@ def test_streaming_response_list(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = response.parse() - assert_matches_type(PaginatedTweets, bookmark, path=["response"]) + assert_matches_type(BookmarkListResponse, bookmark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +92,7 @@ class TestAsyncBookmarks: @parametrize async def test_method_list(self, async_client: AsyncXTwitterScraper) -> None: bookmark = await async_client.x.bookmarks.list() - assert_matches_type(PaginatedTweets, bookmark, path=["response"]) + assert_matches_type(BookmarkListResponse, bookmark, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -102,7 +101,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncXTwitterScra cursor="cursor", folder_id="folderId", ) - assert_matches_type(PaginatedTweets, bookmark, path=["response"]) + assert_matches_type(BookmarkListResponse, bookmark, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -112,7 +111,7 @@ async def test_raw_response_list(self, async_client: AsyncXTwitterScraper) -> No assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = await response.parse() - assert_matches_type(PaginatedTweets, bookmark, path=["response"]) + assert_matches_type(BookmarkListResponse, bookmark, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -122,7 +121,7 @@ async def test_streaming_response_list(self, async_client: AsyncXTwitterScraper) assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = await response.parse() - assert_matches_type(PaginatedTweets, bookmark, path=["response"]) + assert_matches_type(BookmarkListResponse, bookmark, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/x/test_tweets.py b/tests/api_resources/x/test_tweets.py index 7d1f858..27249ed 100644 --- a/tests/api_resources/x/test_tweets.py +++ b/tests/api_resources/x/test_tweets.py @@ -12,9 +12,14 @@ from x_twitter_scraper.types.x import ( TweetCreateResponse, TweetDeleteResponse, + TweetSearchResponse, TweetRetrieveResponse, + TweetGetQuotesResponse, + TweetGetThreadResponse, + TweetGetRepliesResponse, + TweetGetFavoritersResponse, + TweetGetRetweetersResponse, ) -from x_twitter_scraper.types.shared import PaginatedUsers, PaginatedTweets base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -201,7 +206,7 @@ def test_method_get_favoriters(self, client: XTwitterScraper) -> None: tweet = client.x.tweets.get_favoriters( id="id", ) - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetFavoritersResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -210,7 +215,7 @@ def test_method_get_favoriters_with_all_params(self, client: XTwitterScraper) -> id="id", cursor="cursor", ) - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetFavoritersResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -222,7 +227,7 @@ def test_raw_response_get_favoriters(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = response.parse() - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetFavoritersResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -234,7 +239,7 @@ def test_streaming_response_get_favoriters(self, client: XTwitterScraper) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = response.parse() - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetFavoritersResponse, tweet, path=["response"]) assert cast(Any, response.is_closed) is True @@ -252,7 +257,7 @@ def test_method_get_quotes(self, client: XTwitterScraper) -> None: tweet = client.x.tweets.get_quotes( id="id", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetQuotesResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -264,7 +269,7 @@ def test_method_get_quotes_with_all_params(self, client: XTwitterScraper) -> Non since_time="sinceTime", until_time="untilTime", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetQuotesResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -276,7 +281,7 @@ def test_raw_response_get_quotes(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetQuotesResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -288,7 +293,7 @@ def test_streaming_response_get_quotes(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetQuotesResponse, tweet, path=["response"]) assert cast(Any, response.is_closed) is True @@ -306,7 +311,7 @@ def test_method_get_replies(self, client: XTwitterScraper) -> None: tweet = client.x.tweets.get_replies( id="id", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetRepliesResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -317,7 +322,7 @@ def test_method_get_replies_with_all_params(self, client: XTwitterScraper) -> No since_time="sinceTime", until_time="untilTime", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetRepliesResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -329,7 +334,7 @@ def test_raw_response_get_replies(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetRepliesResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -341,7 +346,7 @@ def test_streaming_response_get_replies(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetRepliesResponse, tweet, path=["response"]) assert cast(Any, response.is_closed) is True @@ -359,7 +364,7 @@ def test_method_get_retweeters(self, client: XTwitterScraper) -> None: tweet = client.x.tweets.get_retweeters( id="id", ) - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetRetweetersResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -368,7 +373,7 @@ def test_method_get_retweeters_with_all_params(self, client: XTwitterScraper) -> id="id", cursor="cursor", ) - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetRetweetersResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -380,7 +385,7 @@ def test_raw_response_get_retweeters(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = response.parse() - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetRetweetersResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -392,7 +397,7 @@ def test_streaming_response_get_retweeters(self, client: XTwitterScraper) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = response.parse() - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetRetweetersResponse, tweet, path=["response"]) assert cast(Any, response.is_closed) is True @@ -410,7 +415,7 @@ def test_method_get_thread(self, client: XTwitterScraper) -> None: tweet = client.x.tweets.get_thread( id="id", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetThreadResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -419,7 +424,7 @@ def test_method_get_thread_with_all_params(self, client: XTwitterScraper) -> Non id="id", cursor="cursor", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetThreadResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -431,7 +436,7 @@ def test_raw_response_get_thread(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetThreadResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -443,7 +448,7 @@ def test_streaming_response_get_thread(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetThreadResponse, tweet, path=["response"]) assert cast(Any, response.is_closed) is True @@ -461,7 +466,7 @@ def test_method_search(self, client: XTwitterScraper) -> None: tweet = client.x.tweets.search( q="q", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetSearchResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -474,7 +479,7 @@ def test_method_search_with_all_params(self, client: XTwitterScraper) -> None: since_time="sinceTime", until_time="untilTime", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetSearchResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -486,7 +491,7 @@ def test_raw_response_search(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetSearchResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -498,7 +503,7 @@ def test_streaming_response_search(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetSearchResponse, tweet, path=["response"]) assert cast(Any, response.is_closed) is True @@ -687,7 +692,7 @@ async def test_method_get_favoriters(self, async_client: AsyncXTwitterScraper) - tweet = await async_client.x.tweets.get_favoriters( id="id", ) - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetFavoritersResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -696,7 +701,7 @@ async def test_method_get_favoriters_with_all_params(self, async_client: AsyncXT id="id", cursor="cursor", ) - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetFavoritersResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -708,7 +713,7 @@ async def test_raw_response_get_favoriters(self, async_client: AsyncXTwitterScra assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = await response.parse() - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetFavoritersResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -720,7 +725,7 @@ async def test_streaming_response_get_favoriters(self, async_client: AsyncXTwitt assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = await response.parse() - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetFavoritersResponse, tweet, path=["response"]) assert cast(Any, response.is_closed) is True @@ -738,7 +743,7 @@ async def test_method_get_quotes(self, async_client: AsyncXTwitterScraper) -> No tweet = await async_client.x.tweets.get_quotes( id="id", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetQuotesResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -750,7 +755,7 @@ async def test_method_get_quotes_with_all_params(self, async_client: AsyncXTwitt since_time="sinceTime", until_time="untilTime", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetQuotesResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -762,7 +767,7 @@ async def test_raw_response_get_quotes(self, async_client: AsyncXTwitterScraper) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = await response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetQuotesResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -774,7 +779,7 @@ async def test_streaming_response_get_quotes(self, async_client: AsyncXTwitterSc assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = await response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetQuotesResponse, tweet, path=["response"]) assert cast(Any, response.is_closed) is True @@ -792,7 +797,7 @@ async def test_method_get_replies(self, async_client: AsyncXTwitterScraper) -> N tweet = await async_client.x.tweets.get_replies( id="id", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetRepliesResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -803,7 +808,7 @@ async def test_method_get_replies_with_all_params(self, async_client: AsyncXTwit since_time="sinceTime", until_time="untilTime", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetRepliesResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -815,7 +820,7 @@ async def test_raw_response_get_replies(self, async_client: AsyncXTwitterScraper assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = await response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetRepliesResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -827,7 +832,7 @@ async def test_streaming_response_get_replies(self, async_client: AsyncXTwitterS assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = await response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetRepliesResponse, tweet, path=["response"]) assert cast(Any, response.is_closed) is True @@ -845,7 +850,7 @@ async def test_method_get_retweeters(self, async_client: AsyncXTwitterScraper) - tweet = await async_client.x.tweets.get_retweeters( id="id", ) - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetRetweetersResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -854,7 +859,7 @@ async def test_method_get_retweeters_with_all_params(self, async_client: AsyncXT id="id", cursor="cursor", ) - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetRetweetersResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -866,7 +871,7 @@ async def test_raw_response_get_retweeters(self, async_client: AsyncXTwitterScra assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = await response.parse() - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetRetweetersResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -878,7 +883,7 @@ async def test_streaming_response_get_retweeters(self, async_client: AsyncXTwitt assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = await response.parse() - assert_matches_type(PaginatedUsers, tweet, path=["response"]) + assert_matches_type(TweetGetRetweetersResponse, tweet, path=["response"]) assert cast(Any, response.is_closed) is True @@ -896,7 +901,7 @@ async def test_method_get_thread(self, async_client: AsyncXTwitterScraper) -> No tweet = await async_client.x.tweets.get_thread( id="id", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetThreadResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -905,7 +910,7 @@ async def test_method_get_thread_with_all_params(self, async_client: AsyncXTwitt id="id", cursor="cursor", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetThreadResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -917,7 +922,7 @@ async def test_raw_response_get_thread(self, async_client: AsyncXTwitterScraper) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = await response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetThreadResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -929,7 +934,7 @@ async def test_streaming_response_get_thread(self, async_client: AsyncXTwitterSc assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = await response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetGetThreadResponse, tweet, path=["response"]) assert cast(Any, response.is_closed) is True @@ -947,7 +952,7 @@ async def test_method_search(self, async_client: AsyncXTwitterScraper) -> None: tweet = await async_client.x.tweets.search( q="q", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetSearchResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -960,7 +965,7 @@ async def test_method_search_with_all_params(self, async_client: AsyncXTwitterSc since_time="sinceTime", until_time="untilTime", ) - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetSearchResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -972,7 +977,7 @@ async def test_raw_response_search(self, async_client: AsyncXTwitterScraper) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = await response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetSearchResponse, tweet, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -984,6 +989,6 @@ async def test_streaming_response_search(self, async_client: AsyncXTwitterScrape assert response.http_request.headers.get("X-Stainless-Lang") == "python" tweet = await response.parse() - assert_matches_type(PaginatedTweets, tweet, path=["response"]) + assert_matches_type(TweetSearchResponse, tweet, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/x/test_users.py b/tests/api_resources/x/test_users.py index 80f0f90..3d63e3a 100644 --- a/tests/api_resources/x/test_users.py +++ b/tests/api_resources/x/test_users.py @@ -10,9 +10,12 @@ from tests.utils import assert_matches_type from x_twitter_scraper import XTwitterScraper, AsyncXTwitterScraper from x_twitter_scraper.types.x import ( - UserProfile, + UserRetrieveResponse, + UserRetrieveLikesResponse, + UserRetrieveMediaResponse, + UserRetrieveTweetsResponse, + UserRetrieveFollowersYouKnowResponse, ) -from x_twitter_scraper.types.shared import PaginatedUsers, PaginatedTweets base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +29,7 @@ def test_method_retrieve(self, client: XTwitterScraper) -> None: user = client.x.users.retrieve( "username", ) - assert_matches_type(UserProfile, user, path=["response"]) + assert_matches_type(UserRetrieveResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -38,7 +41,7 @@ def test_raw_response_retrieve(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(UserProfile, user, path=["response"]) + assert_matches_type(UserRetrieveResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -50,7 +53,7 @@ def test_streaming_response_retrieve(self, client: XTwitterScraper) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(UserProfile, user, path=["response"]) + assert_matches_type(UserRetrieveResponse, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -154,7 +157,7 @@ def test_method_retrieve_followers_you_know(self, client: XTwitterScraper) -> No user = client.x.users.retrieve_followers_you_know( id="id", ) - assert_matches_type(PaginatedUsers, user, path=["response"]) + assert_matches_type(UserRetrieveFollowersYouKnowResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -163,7 +166,7 @@ def test_method_retrieve_followers_you_know_with_all_params(self, client: XTwitt id="id", cursor="cursor", ) - assert_matches_type(PaginatedUsers, user, path=["response"]) + assert_matches_type(UserRetrieveFollowersYouKnowResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -175,7 +178,7 @@ def test_raw_response_retrieve_followers_you_know(self, client: XTwitterScraper) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(PaginatedUsers, user, path=["response"]) + assert_matches_type(UserRetrieveFollowersYouKnowResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -187,7 +190,7 @@ def test_streaming_response_retrieve_followers_you_know(self, client: XTwitterSc assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(PaginatedUsers, user, path=["response"]) + assert_matches_type(UserRetrieveFollowersYouKnowResponse, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -257,7 +260,7 @@ def test_method_retrieve_likes(self, client: XTwitterScraper) -> None: user = client.x.users.retrieve_likes( id="id", ) - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveLikesResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -266,7 +269,7 @@ def test_method_retrieve_likes_with_all_params(self, client: XTwitterScraper) -> id="id", cursor="cursor", ) - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveLikesResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -278,7 +281,7 @@ def test_raw_response_retrieve_likes(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveLikesResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -290,7 +293,7 @@ def test_streaming_response_retrieve_likes(self, client: XTwitterScraper) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveLikesResponse, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -308,7 +311,7 @@ def test_method_retrieve_media(self, client: XTwitterScraper) -> None: user = client.x.users.retrieve_media( id="id", ) - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveMediaResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -317,7 +320,7 @@ def test_method_retrieve_media_with_all_params(self, client: XTwitterScraper) -> id="id", cursor="cursor", ) - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveMediaResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -329,7 +332,7 @@ def test_raw_response_retrieve_media(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveMediaResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -341,7 +344,7 @@ def test_streaming_response_retrieve_media(self, client: XTwitterScraper) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveMediaResponse, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -455,7 +458,7 @@ def test_method_retrieve_tweets(self, client: XTwitterScraper) -> None: user = client.x.users.retrieve_tweets( id="id", ) - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveTweetsResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -466,7 +469,7 @@ def test_method_retrieve_tweets_with_all_params(self, client: XTwitterScraper) - include_parent_tweet=True, include_replies=True, ) - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveTweetsResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -478,7 +481,7 @@ def test_raw_response_retrieve_tweets(self, client: XTwitterScraper) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveTweetsResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -490,7 +493,7 @@ def test_streaming_response_retrieve_tweets(self, client: XTwitterScraper) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveTweetsResponse, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -565,7 +568,7 @@ async def test_method_retrieve(self, async_client: AsyncXTwitterScraper) -> None user = await async_client.x.users.retrieve( "username", ) - assert_matches_type(UserProfile, user, path=["response"]) + assert_matches_type(UserRetrieveResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -577,7 +580,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncXTwitterScraper) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(UserProfile, user, path=["response"]) + assert_matches_type(UserRetrieveResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -589,7 +592,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncXTwitterScra assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(UserProfile, user, path=["response"]) + assert_matches_type(UserRetrieveResponse, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -693,7 +696,7 @@ async def test_method_retrieve_followers_you_know(self, async_client: AsyncXTwit user = await async_client.x.users.retrieve_followers_you_know( id="id", ) - assert_matches_type(PaginatedUsers, user, path=["response"]) + assert_matches_type(UserRetrieveFollowersYouKnowResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -702,7 +705,7 @@ async def test_method_retrieve_followers_you_know_with_all_params(self, async_cl id="id", cursor="cursor", ) - assert_matches_type(PaginatedUsers, user, path=["response"]) + assert_matches_type(UserRetrieveFollowersYouKnowResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -714,7 +717,7 @@ async def test_raw_response_retrieve_followers_you_know(self, async_client: Asyn assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(PaginatedUsers, user, path=["response"]) + assert_matches_type(UserRetrieveFollowersYouKnowResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -726,7 +729,7 @@ async def test_streaming_response_retrieve_followers_you_know(self, async_client assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(PaginatedUsers, user, path=["response"]) + assert_matches_type(UserRetrieveFollowersYouKnowResponse, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -796,7 +799,7 @@ async def test_method_retrieve_likes(self, async_client: AsyncXTwitterScraper) - user = await async_client.x.users.retrieve_likes( id="id", ) - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveLikesResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -805,7 +808,7 @@ async def test_method_retrieve_likes_with_all_params(self, async_client: AsyncXT id="id", cursor="cursor", ) - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveLikesResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -817,7 +820,7 @@ async def test_raw_response_retrieve_likes(self, async_client: AsyncXTwitterScra assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveLikesResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -829,7 +832,7 @@ async def test_streaming_response_retrieve_likes(self, async_client: AsyncXTwitt assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveLikesResponse, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -847,7 +850,7 @@ async def test_method_retrieve_media(self, async_client: AsyncXTwitterScraper) - user = await async_client.x.users.retrieve_media( id="id", ) - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveMediaResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -856,7 +859,7 @@ async def test_method_retrieve_media_with_all_params(self, async_client: AsyncXT id="id", cursor="cursor", ) - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveMediaResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -868,7 +871,7 @@ async def test_raw_response_retrieve_media(self, async_client: AsyncXTwitterScra assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveMediaResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -880,7 +883,7 @@ async def test_streaming_response_retrieve_media(self, async_client: AsyncXTwitt assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveMediaResponse, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -994,7 +997,7 @@ async def test_method_retrieve_tweets(self, async_client: AsyncXTwitterScraper) user = await async_client.x.users.retrieve_tweets( id="id", ) - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveTweetsResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -1005,7 +1008,7 @@ async def test_method_retrieve_tweets_with_all_params(self, async_client: AsyncX include_parent_tweet=True, include_replies=True, ) - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveTweetsResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -1017,7 +1020,7 @@ async def test_raw_response_retrieve_tweets(self, async_client: AsyncXTwitterScr assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveTweetsResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -1029,7 +1032,7 @@ async def test_streaming_response_retrieve_tweets(self, async_client: AsyncXTwit assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(PaginatedTweets, user, path=["response"]) + assert_matches_type(UserRetrieveTweetsResponse, user, path=["response"]) assert cast(Any, response.is_closed) is True