twitter-openapi-python-generated 0.0.9__py3-none-any.whl → 0.0.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- twitter_openapi_python_generated/__init__.py +59 -2
- twitter_openapi_python_generated/api/default_api.py +5 -13
- twitter_openapi_python_generated/api/other_api.py +4 -11
- twitter_openapi_python_generated/api/post_api.py +10 -19
- twitter_openapi_python_generated/api/tweet_api.py +14 -22
- twitter_openapi_python_generated/api/user_api.py +5 -13
- twitter_openapi_python_generated/api/user_list_api.py +8 -16
- twitter_openapi_python_generated/api/users_api.py +4 -12
- twitter_openapi_python_generated/api/v11_get_api.py +5 -13
- twitter_openapi_python_generated/api/v11_post_api.py +5 -13
- twitter_openapi_python_generated/api/v20_get_api.py +4 -12
- twitter_openapi_python_generated/api_client.py +45 -18
- twitter_openapi_python_generated/api_response.py +3 -3
- twitter_openapi_python_generated/configuration.py +5 -3
- twitter_openapi_python_generated/exceptions.py +0 -1
- twitter_openapi_python_generated/models/__init__.py +58 -1
- twitter_openapi_python_generated/models/additional_media_info.py +30 -13
- twitter_openapi_python_generated/models/additional_media_info_call_to_actions.py +92 -0
- twitter_openapi_python_generated/models/additional_media_info_call_to_actions_visit_site.py +88 -0
- twitter_openapi_python_generated/models/author_community_relationship.py +110 -0
- twitter_openapi_python_generated/models/birdwatch_entity.py +10 -12
- twitter_openapi_python_generated/models/birdwatch_entity_ref.py +11 -13
- twitter_openapi_python_generated/models/birdwatch_pivot.py +21 -17
- twitter_openapi_python_generated/models/birdwatch_pivot_call_to_action.py +92 -0
- twitter_openapi_python_generated/models/birdwatch_pivot_footer.py +10 -11
- twitter_openapi_python_generated/models/birdwatch_pivot_note.py +9 -11
- twitter_openapi_python_generated/models/birdwatch_pivot_subtitle.py +10 -11
- twitter_openapi_python_generated/models/bookmarks_response.py +10 -11
- twitter_openapi_python_generated/models/bookmarks_response_data.py +10 -11
- twitter_openapi_python_generated/models/bookmarks_timeline.py +10 -11
- twitter_openapi_python_generated/models/callback.py +9 -10
- twitter_openapi_python_generated/models/client_event_info.py +9 -10
- twitter_openapi_python_generated/models/communities_actions.py +9 -10
- twitter_openapi_python_generated/models/community.py +92 -0
- twitter_openapi_python_generated/models/community_actions.py +110 -0
- twitter_openapi_python_generated/models/community_data.py +210 -0
- twitter_openapi_python_generated/models/community_delete_action_result.py +98 -0
- twitter_openapi_python_generated/models/community_invites_result.py +100 -0
- twitter_openapi_python_generated/models/community_join_action_result.py +89 -0
- twitter_openapi_python_generated/models/community_join_requests_result.py +89 -0
- twitter_openapi_python_generated/models/community_leave_action_result.py +100 -0
- twitter_openapi_python_generated/models/community_pin_action_result.py +89 -0
- twitter_openapi_python_generated/models/community_rule.py +100 -0
- twitter_openapi_python_generated/models/community_urls.py +92 -0
- twitter_openapi_python_generated/models/community_urls_permalink.py +88 -0
- twitter_openapi_python_generated/models/content_entry_type.py +1 -9
- twitter_openapi_python_generated/models/content_item_type.py +1 -9
- twitter_openapi_python_generated/models/content_union.py +8 -17
- twitter_openapi_python_generated/models/cover_cta.py +13 -15
- twitter_openapi_python_generated/models/create_retweet.py +10 -11
- twitter_openapi_python_generated/models/create_retweet_response.py +10 -11
- twitter_openapi_python_generated/models/create_retweet_response_data.py +10 -11
- twitter_openapi_python_generated/models/create_retweet_response_result.py +10 -11
- twitter_openapi_python_generated/models/create_tweet.py +10 -11
- twitter_openapi_python_generated/models/create_tweet_response.py +10 -11
- twitter_openapi_python_generated/models/create_tweet_response_data.py +10 -11
- twitter_openapi_python_generated/models/create_tweet_response_result.py +10 -11
- twitter_openapi_python_generated/models/cta_client_event_info.py +10 -11
- twitter_openapi_python_generated/models/cursor_type.py +1 -9
- twitter_openapi_python_generated/models/delete_retweet.py +10 -11
- twitter_openapi_python_generated/models/delete_retweet_response.py +10 -11
- twitter_openapi_python_generated/models/delete_retweet_response_data.py +10 -11
- twitter_openapi_python_generated/models/delete_retweet_response_result.py +10 -11
- twitter_openapi_python_generated/models/delete_tweet_response.py +10 -11
- twitter_openapi_python_generated/models/delete_tweet_response_data.py +10 -11
- twitter_openapi_python_generated/models/delete_tweet_response_result.py +9 -10
- twitter_openapi_python_generated/models/display_treatment.py +88 -0
- twitter_openapi_python_generated/models/display_type.py +40 -0
- twitter_openapi_python_generated/models/entities.py +11 -12
- twitter_openapi_python_generated/models/error.py +12 -13
- twitter_openapi_python_generated/models/error_extensions.py +10 -11
- twitter_openapi_python_generated/models/error_response.py +10 -11
- twitter_openapi_python_generated/models/errors.py +10 -11
- twitter_openapi_python_generated/models/ext_media_availability.py +10 -11
- twitter_openapi_python_generated/models/extended_entities.py +10 -11
- twitter_openapi_python_generated/models/extensions.py +10 -11
- twitter_openapi_python_generated/models/favorite_tweet.py +9 -10
- twitter_openapi_python_generated/models/favorite_tweet_response_data.py +10 -11
- twitter_openapi_python_generated/models/{social_context.py → feedback_info.py} +17 -23
- twitter_openapi_python_generated/models/follow_response.py +10 -11
- twitter_openapi_python_generated/models/follow_response_data.py +10 -11
- twitter_openapi_python_generated/models/follow_response_result.py +10 -12
- twitter_openapi_python_generated/models/follow_response_user.py +10 -11
- twitter_openapi_python_generated/models/follow_timeline.py +10 -11
- twitter_openapi_python_generated/models/get_bookmarks200_response.py +8 -17
- twitter_openapi_python_generated/models/get_favoriters200_response.py +8 -17
- twitter_openapi_python_generated/models/get_followers200_response.py +8 -17
- twitter_openapi_python_generated/models/get_home_latest_timeline200_response.py +8 -17
- twitter_openapi_python_generated/models/get_likes200_response.py +8 -17
- twitter_openapi_python_generated/models/get_list_latest_tweets_timeline200_response.py +8 -17
- twitter_openapi_python_generated/models/get_profile_spotlights_query200_response.py +8 -17
- twitter_openapi_python_generated/models/get_retweeters200_response.py +8 -17
- twitter_openapi_python_generated/models/get_search_timeline200_response.py +8 -17
- twitter_openapi_python_generated/models/get_tweet_detail200_response.py +8 -17
- twitter_openapi_python_generated/models/get_tweet_result_by_rest_id200_response.py +8 -17
- twitter_openapi_python_generated/models/get_user_by_rest_id200_response.py +8 -17
- twitter_openapi_python_generated/models/get_user_highlights_tweets200_response.py +8 -17
- twitter_openapi_python_generated/models/get_users_by_rest_ids200_response.py +8 -17
- twitter_openapi_python_generated/models/highlight.py +96 -0
- twitter_openapi_python_generated/models/home_timeline_home.py +10 -11
- twitter_openapi_python_generated/models/home_timeline_response_data.py +10 -11
- twitter_openapi_python_generated/models/instruction_type.py +1 -9
- twitter_openapi_python_generated/models/instruction_union.py +8 -17
- twitter_openapi_python_generated/models/item_content_union.py +8 -17
- twitter_openapi_python_generated/models/item_result.py +10 -12
- twitter_openapi_python_generated/models/list_latest_tweets_timeline_response.py +10 -11
- twitter_openapi_python_generated/models/list_tweets_timeline.py +10 -11
- twitter_openapi_python_generated/models/list_tweets_timeline_data.py +10 -11
- twitter_openapi_python_generated/models/list_tweets_timeline_list.py +10 -11
- twitter_openapi_python_generated/models/location.py +9 -10
- twitter_openapi_python_generated/models/media.py +52 -16
- twitter_openapi_python_generated/models/media_extended.py +43 -19
- twitter_openapi_python_generated/models/media_original_info.py +10 -11
- twitter_openapi_python_generated/models/media_original_info_focus_rect.py +9 -10
- twitter_openapi_python_generated/models/media_size.py +10 -11
- twitter_openapi_python_generated/models/media_sizes.py +13 -14
- twitter_openapi_python_generated/models/media_stats.py +9 -11
- twitter_openapi_python_generated/models/media_video_info.py +10 -11
- twitter_openapi_python_generated/models/media_video_info_variant.py +9 -10
- twitter_openapi_python_generated/models/module_entry.py +11 -13
- twitter_openapi_python_generated/models/module_item.py +10 -12
- twitter_openapi_python_generated/models/note_tweet.py +10 -11
- twitter_openapi_python_generated/models/note_tweet_result.py +10 -11
- twitter_openapi_python_generated/models/note_tweet_result_data.py +12 -14
- twitter_openapi_python_generated/models/note_tweet_result_media.py +10 -11
- twitter_openapi_python_generated/models/note_tweet_result_media_inline_media.py +9 -11
- twitter_openapi_python_generated/models/note_tweet_result_rich_text.py +10 -11
- twitter_openapi_python_generated/models/note_tweet_result_rich_text_tag.py +10 -11
- twitter_openapi_python_generated/models/one_factor_login_eligibility.py +9 -11
- twitter_openapi_python_generated/models/other200_response.py +8 -17
- twitter_openapi_python_generated/models/other_response.py +10 -12
- twitter_openapi_python_generated/models/post_create_retweet200_response.py +8 -17
- twitter_openapi_python_generated/models/post_create_retweet_request.py +10 -12
- twitter_openapi_python_generated/models/post_create_retweet_request_variables.py +9 -10
- twitter_openapi_python_generated/models/post_create_tweet200_response.py +8 -17
- twitter_openapi_python_generated/models/post_create_tweet_request.py +12 -14
- twitter_openapi_python_generated/models/post_create_tweet_request_features.py +15 -12
- twitter_openapi_python_generated/models/post_create_tweet_request_variables.py +11 -12
- twitter_openapi_python_generated/models/post_create_tweet_request_variables_media.py +10 -11
- twitter_openapi_python_generated/models/post_create_tweet_request_variables_media_media_entities_inner.py +9 -10
- twitter_openapi_python_generated/models/post_create_tweet_request_variables_reply.py +9 -10
- twitter_openapi_python_generated/models/post_delete_retweet200_response.py +8 -17
- twitter_openapi_python_generated/models/post_delete_retweet_request.py +10 -12
- twitter_openapi_python_generated/models/post_delete_retweet_request_variables.py +9 -10
- twitter_openapi_python_generated/models/post_delete_tweet200_response.py +8 -17
- twitter_openapi_python_generated/models/post_delete_tweet_request.py +10 -12
- twitter_openapi_python_generated/models/post_favorite_tweet200_response.py +8 -17
- twitter_openapi_python_generated/models/post_favorite_tweet_request.py +10 -12
- twitter_openapi_python_generated/models/post_unfavorite_tweet200_response.py +8 -17
- twitter_openapi_python_generated/models/post_unfavorite_tweet_request.py +10 -12
- twitter_openapi_python_generated/models/primary_community_topic.py +98 -0
- twitter_openapi_python_generated/models/profile_response.py +10 -11
- twitter_openapi_python_generated/models/profile_response_data.py +10 -11
- twitter_openapi_python_generated/models/quoted_ref_result.py +92 -0
- twitter_openapi_python_generated/models/quoted_ref_result_data.py +99 -0
- twitter_openapi_python_generated/models/quoted_status_permalink.py +92 -0
- twitter_openapi_python_generated/models/retweet.py +10 -12
- twitter_openapi_python_generated/models/retweet_legacy.py +9 -10
- twitter_openapi_python_generated/models/search_by_raw_query.py +10 -11
- twitter_openapi_python_generated/models/search_timeline.py +10 -11
- twitter_openapi_python_generated/models/search_timeline_data.py +10 -11
- twitter_openapi_python_generated/models/search_timeline_response.py +10 -11
- twitter_openapi_python_generated/models/self_thread.py +9 -11
- twitter_openapi_python_generated/models/session.py +13 -15
- twitter_openapi_python_generated/models/social_context_landing_url.py +106 -0
- twitter_openapi_python_generated/models/social_context_union.py +156 -0
- twitter_openapi_python_generated/models/social_context_union_type.py +38 -0
- twitter_openapi_python_generated/models/super_follows_reply_user_result.py +92 -0
- twitter_openapi_python_generated/models/super_follows_reply_user_result_data.py +95 -0
- twitter_openapi_python_generated/models/super_follows_reply_user_result_legacy.py +88 -0
- twitter_openapi_python_generated/models/text.py +10 -11
- twitter_openapi_python_generated/models/text_entity.py +10 -12
- twitter_openapi_python_generated/models/text_entity_ref.py +11 -13
- twitter_openapi_python_generated/models/text_highlight.py +90 -0
- twitter_openapi_python_generated/models/timeline.py +10 -12
- twitter_openapi_python_generated/models/timeline_add_entries.py +10 -11
- twitter_openapi_python_generated/models/timeline_add_entry.py +10 -12
- twitter_openapi_python_generated/models/timeline_add_to_module.py +10 -12
- twitter_openapi_python_generated/models/timeline_clear_cache.py +9 -10
- twitter_openapi_python_generated/models/timeline_community.py +10 -12
- twitter_openapi_python_generated/models/timeline_cover_behavior.py +10 -11
- twitter_openapi_python_generated/models/timeline_general_context.py +109 -0
- twitter_openapi_python_generated/models/timeline_half_cover.py +15 -17
- twitter_openapi_python_generated/models/timeline_message_prompt.py +10 -12
- twitter_openapi_python_generated/models/timeline_pin_entry.py +10 -11
- twitter_openapi_python_generated/models/timeline_prompt.py +10 -12
- twitter_openapi_python_generated/models/timeline_replace_entry.py +10 -11
- twitter_openapi_python_generated/models/timeline_response.py +10 -11
- twitter_openapi_python_generated/models/timeline_show_alert.py +13 -15
- twitter_openapi_python_generated/models/timeline_show_alert_rich_text.py +9 -10
- twitter_openapi_python_generated/models/timeline_show_cover.py +11 -13
- twitter_openapi_python_generated/models/timeline_terminate_timeline.py +10 -11
- twitter_openapi_python_generated/models/timeline_timeline_cursor.py +18 -12
- twitter_openapi_python_generated/models/timeline_timeline_item.py +11 -13
- twitter_openapi_python_generated/models/timeline_timeline_module.py +21 -21
- twitter_openapi_python_generated/models/timeline_topic_context.py +107 -0
- twitter_openapi_python_generated/models/timeline_tweet.py +21 -17
- twitter_openapi_python_generated/models/timeline_user.py +16 -18
- twitter_openapi_python_generated/models/timeline_v2.py +10 -11
- twitter_openapi_python_generated/models/topic_context.py +100 -0
- twitter_openapi_python_generated/models/tracing.py +9 -11
- twitter_openapi_python_generated/models/tweet.py +51 -21
- twitter_openapi_python_generated/models/tweet_card.py +10 -11
- twitter_openapi_python_generated/models/tweet_card_legacy.py +28 -13
- twitter_openapi_python_generated/models/tweet_card_legacy_binding_value.py +10 -11
- twitter_openapi_python_generated/models/tweet_card_legacy_binding_value_data.py +25 -12
- twitter_openapi_python_generated/models/tweet_card_legacy_binding_value_data_image.py +94 -0
- twitter_openapi_python_generated/models/tweet_card_platform.py +98 -0
- twitter_openapi_python_generated/models/tweet_card_platform_audience.py +95 -0
- twitter_openapi_python_generated/models/tweet_card_platform_data.py +92 -0
- twitter_openapi_python_generated/models/tweet_card_platform_device.py +98 -0
- twitter_openapi_python_generated/models/tweet_detail_response.py +10 -11
- twitter_openapi_python_generated/models/tweet_detail_response_data.py +10 -11
- twitter_openapi_python_generated/models/tweet_edit_control.py +10 -12
- twitter_openapi_python_generated/models/tweet_edit_control_initial.py +9 -11
- twitter_openapi_python_generated/models/tweet_edit_prespective.py +9 -10
- twitter_openapi_python_generated/models/tweet_favoriters_response.py +10 -11
- twitter_openapi_python_generated/models/tweet_favoriters_response_data.py +10 -11
- twitter_openapi_python_generated/models/tweet_interstitial.py +110 -0
- twitter_openapi_python_generated/models/tweet_interstitial_reveal_text.py +100 -0
- twitter_openapi_python_generated/models/tweet_interstitial_text.py +100 -0
- twitter_openapi_python_generated/models/tweet_interstitial_text_entity.py +96 -0
- twitter_openapi_python_generated/models/tweet_interstitial_text_entity_ref.py +106 -0
- twitter_openapi_python_generated/models/tweet_legacy.py +80 -16
- twitter_openapi_python_generated/models/tweet_legacy_scopes.py +88 -0
- twitter_openapi_python_generated/models/tweet_previous_counts.py +96 -0
- twitter_openapi_python_generated/models/tweet_result_by_rest_id_data.py +10 -12
- twitter_openapi_python_generated/models/tweet_result_by_rest_id_response.py +10 -11
- twitter_openapi_python_generated/models/tweet_retweeters_response.py +10 -11
- twitter_openapi_python_generated/models/tweet_retweeters_response_data.py +10 -11
- twitter_openapi_python_generated/models/tweet_tombstone.py +10 -12
- twitter_openapi_python_generated/models/tweet_union.py +8 -17
- twitter_openapi_python_generated/models/tweet_view.py +10 -12
- twitter_openapi_python_generated/models/tweet_with_visibility_results.py +20 -14
- twitter_openapi_python_generated/models/type_name.py +9 -9
- twitter_openapi_python_generated/models/unfavorite_tweet.py +9 -10
- twitter_openapi_python_generated/models/unfavorite_tweet_response_data.py +10 -11
- twitter_openapi_python_generated/models/unified_card.py +95 -0
- twitter_openapi_python_generated/models/url.py +9 -10
- twitter_openapi_python_generated/models/urt_endpoint_options.py +98 -0
- twitter_openapi_python_generated/models/urt_endpoint_request_params.py +90 -0
- twitter_openapi_python_generated/models/user.py +45 -14
- twitter_openapi_python_generated/models/user_features.py +9 -10
- twitter_openapi_python_generated/models/user_highlights_info.py +90 -0
- twitter_openapi_python_generated/models/user_highlights_tweets_data.py +10 -11
- twitter_openapi_python_generated/models/user_highlights_tweets_response.py +10 -11
- twitter_openapi_python_generated/models/user_highlights_tweets_result.py +10 -12
- twitter_openapi_python_generated/models/user_highlights_tweets_timeline.py +10 -11
- twitter_openapi_python_generated/models/user_highlights_tweets_user.py +10 -11
- twitter_openapi_python_generated/models/user_legacy.py +25 -13
- twitter_openapi_python_generated/models/user_professional.py +115 -0
- twitter_openapi_python_generated/models/user_professional_category.py +92 -0
- twitter_openapi_python_generated/models/user_response.py +10 -11
- twitter_openapi_python_generated/models/user_response_data.py +10 -11
- twitter_openapi_python_generated/models/user_result_by_screen_name.py +10 -12
- twitter_openapi_python_generated/models/user_result_by_screen_name_legacy.py +9 -10
- twitter_openapi_python_generated/models/user_result_by_screen_name_result.py +10 -12
- twitter_openapi_python_generated/models/user_result_core.py +10 -11
- twitter_openapi_python_generated/models/user_results.py +10 -11
- twitter_openapi_python_generated/models/user_tweets_data.py +10 -11
- twitter_openapi_python_generated/models/user_tweets_response.py +10 -11
- twitter_openapi_python_generated/models/user_tweets_result.py +10 -12
- twitter_openapi_python_generated/models/user_tweets_user.py +10 -11
- twitter_openapi_python_generated/models/user_unavailable.py +9 -11
- twitter_openapi_python_generated/models/user_union.py +8 -17
- twitter_openapi_python_generated/models/user_value.py +96 -0
- twitter_openapi_python_generated/models/user_verification_info.py +94 -0
- twitter_openapi_python_generated/models/user_verification_info_reason.py +104 -0
- twitter_openapi_python_generated/models/user_verification_info_reason_description.py +98 -0
- twitter_openapi_python_generated/models/user_verification_info_reason_description_entities.py +96 -0
- twitter_openapi_python_generated/models/user_verification_info_reason_description_entities_ref.py +97 -0
- twitter_openapi_python_generated/models/users_response.py +10 -11
- twitter_openapi_python_generated/models/users_response_data.py +10 -11
- twitter_openapi_python_generated/rest.py +23 -35
- {twitter_openapi_python_generated-0.0.9.dist-info → twitter_openapi_python_generated-0.0.11.dist-info}/METADATA +1 -1
- twitter_openapi_python_generated-0.0.11.dist-info/RECORD +282 -0
- twitter_openapi_python_generated-0.0.9.dist-info/RECORD +0 -225
- {twitter_openapi_python_generated-0.0.9.dist-info → twitter_openapi_python_generated-0.0.11.dist-info}/LICENSE +0 -0
- {twitter_openapi_python_generated-0.0.9.dist-info → twitter_openapi_python_generated-0.0.11.dist-info}/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.0.9.dist-info → twitter_openapi_python_generated-0.0.11.dist-info}/WHEEL +0 -0
- {twitter_openapi_python_generated-0.0.9.dist-info → twitter_openapi_python_generated-0.0.11.dist-info}/top_level.txt +0 -0
|
@@ -18,17 +18,14 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
from pydantic import BaseModel, Field, StrictBool, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
-
from pydantic import BaseModel, StrictStr
|
|
24
|
-
from pydantic import Field
|
|
25
23
|
from twitter_openapi_python_generated.models.content_entry_type import ContentEntryType
|
|
26
24
|
from twitter_openapi_python_generated.models.cursor_type import CursorType
|
|
25
|
+
from twitter_openapi_python_generated.models.display_treatment import DisplayTreatment
|
|
27
26
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
except ImportError:
|
|
31
|
-
from typing_extensions import Self
|
|
27
|
+
from typing import Optional, Set
|
|
28
|
+
from typing_extensions import Self
|
|
32
29
|
|
|
33
30
|
class TimelineTimelineCursor(BaseModel):
|
|
34
31
|
"""
|
|
@@ -36,10 +33,12 @@ class TimelineTimelineCursor(BaseModel):
|
|
|
36
33
|
""" # noqa: E501
|
|
37
34
|
typename: TypeName = Field(alias="__typename")
|
|
38
35
|
cursor_type: CursorType = Field(alias="cursorType")
|
|
36
|
+
display_treatment: Optional[DisplayTreatment] = Field(default=None, alias="displayTreatment")
|
|
39
37
|
entry_type: Optional[ContentEntryType] = Field(default=None, alias="entryType")
|
|
40
38
|
item_type: Optional[ContentEntryType] = Field(default=None, alias="itemType")
|
|
39
|
+
stop_on_empty_response: StrictBool = Field(alias="stopOnEmptyResponse")
|
|
41
40
|
value: StrictStr
|
|
42
|
-
__properties: ClassVar[List[str]] = ["__typename", "cursorType", "entryType", "itemType", "value"]
|
|
41
|
+
__properties: ClassVar[List[str]] = ["__typename", "cursorType", "displayTreatment", "entryType", "itemType", "stopOnEmptyResponse", "value"]
|
|
43
42
|
|
|
44
43
|
model_config = {
|
|
45
44
|
"populate_by_name": True,
|
|
@@ -58,7 +57,7 @@ class TimelineTimelineCursor(BaseModel):
|
|
|
58
57
|
return json.dumps(self.to_dict())
|
|
59
58
|
|
|
60
59
|
@classmethod
|
|
61
|
-
def from_json(cls, json_str: str) -> Self:
|
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
62
61
|
"""Create an instance of TimelineTimelineCursor from a JSON string"""
|
|
63
62
|
return cls.from_dict(json.loads(json_str))
|
|
64
63
|
|
|
@@ -72,16 +71,21 @@ class TimelineTimelineCursor(BaseModel):
|
|
|
72
71
|
were set at model initialization. Other fields with value `None`
|
|
73
72
|
are ignored.
|
|
74
73
|
"""
|
|
74
|
+
excluded_fields: Set[str] = set([
|
|
75
|
+
])
|
|
76
|
+
|
|
75
77
|
_dict = self.model_dump(
|
|
76
78
|
by_alias=True,
|
|
77
|
-
exclude=
|
|
78
|
-
},
|
|
79
|
+
exclude=excluded_fields,
|
|
79
80
|
exclude_none=True,
|
|
80
81
|
)
|
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of display_treatment
|
|
83
|
+
if self.display_treatment:
|
|
84
|
+
_dict['displayTreatment'] = self.display_treatment.to_dict()
|
|
81
85
|
return _dict
|
|
82
86
|
|
|
83
87
|
@classmethod
|
|
84
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
88
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
85
89
|
"""Create an instance of TimelineTimelineCursor from a dict"""
|
|
86
90
|
if obj is None:
|
|
87
91
|
return None
|
|
@@ -92,8 +96,10 @@ class TimelineTimelineCursor(BaseModel):
|
|
|
92
96
|
_obj = cls.model_validate({
|
|
93
97
|
"__typename": obj.get("__typename"),
|
|
94
98
|
"cursorType": obj.get("cursorType"),
|
|
99
|
+
"displayTreatment": DisplayTreatment.from_dict(obj["displayTreatment"]) if obj.get("displayTreatment") is not None else None,
|
|
95
100
|
"entryType": obj.get("entryType"),
|
|
96
101
|
"itemType": obj.get("itemType"),
|
|
102
|
+
"stopOnEmptyResponse": obj.get("stopOnEmptyResponse") if obj.get("stopOnEmptyResponse") is not None else False,
|
|
97
103
|
"value": obj.get("value")
|
|
98
104
|
})
|
|
99
105
|
return _obj
|
|
@@ -18,18 +18,14 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
from pydantic import BaseModel, Field
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
-
from pydantic import BaseModel
|
|
24
|
-
from pydantic import Field
|
|
25
23
|
from twitter_openapi_python_generated.models.client_event_info import ClientEventInfo
|
|
26
24
|
from twitter_openapi_python_generated.models.content_entry_type import ContentEntryType
|
|
27
25
|
from twitter_openapi_python_generated.models.item_content_union import ItemContentUnion
|
|
28
26
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
except ImportError:
|
|
32
|
-
from typing_extensions import Self
|
|
27
|
+
from typing import Optional, Set
|
|
28
|
+
from typing_extensions import Self
|
|
33
29
|
|
|
34
30
|
class TimelineTimelineItem(BaseModel):
|
|
35
31
|
"""
|
|
@@ -59,7 +55,7 @@ class TimelineTimelineItem(BaseModel):
|
|
|
59
55
|
return json.dumps(self.to_dict())
|
|
60
56
|
|
|
61
57
|
@classmethod
|
|
62
|
-
def from_json(cls, json_str: str) -> Self:
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
63
59
|
"""Create an instance of TimelineTimelineItem from a JSON string"""
|
|
64
60
|
return cls.from_dict(json.loads(json_str))
|
|
65
61
|
|
|
@@ -73,10 +69,12 @@ class TimelineTimelineItem(BaseModel):
|
|
|
73
69
|
were set at model initialization. Other fields with value `None`
|
|
74
70
|
are ignored.
|
|
75
71
|
"""
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
74
|
+
|
|
76
75
|
_dict = self.model_dump(
|
|
77
76
|
by_alias=True,
|
|
78
|
-
exclude=
|
|
79
|
-
},
|
|
77
|
+
exclude=excluded_fields,
|
|
80
78
|
exclude_none=True,
|
|
81
79
|
)
|
|
82
80
|
# override the default output from pydantic by calling `to_dict()` of client_event_info
|
|
@@ -88,7 +86,7 @@ class TimelineTimelineItem(BaseModel):
|
|
|
88
86
|
return _dict
|
|
89
87
|
|
|
90
88
|
@classmethod
|
|
91
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
89
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
92
90
|
"""Create an instance of TimelineTimelineItem from a dict"""
|
|
93
91
|
if obj is None:
|
|
94
92
|
return None
|
|
@@ -98,10 +96,10 @@ class TimelineTimelineItem(BaseModel):
|
|
|
98
96
|
|
|
99
97
|
_obj = cls.model_validate({
|
|
100
98
|
"__typename": obj.get("__typename"),
|
|
101
|
-
"clientEventInfo": ClientEventInfo.from_dict(obj
|
|
99
|
+
"clientEventInfo": ClientEventInfo.from_dict(obj["clientEventInfo"]) if obj.get("clientEventInfo") is not None else None,
|
|
102
100
|
"entryType": obj.get("entryType"),
|
|
103
101
|
"feedbackInfo": obj.get("feedbackInfo"),
|
|
104
|
-
"itemContent": ItemContentUnion.from_dict(obj
|
|
102
|
+
"itemContent": ItemContentUnion.from_dict(obj["itemContent"]) if obj.get("itemContent") is not None else None
|
|
105
103
|
})
|
|
106
104
|
return _obj
|
|
107
105
|
|
|
@@ -18,16 +18,14 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
from pydantic import BaseModel, Field, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
-
from pydantic import BaseModel, StrictStr, field_validator
|
|
24
|
-
from pydantic import Field
|
|
25
23
|
from twitter_openapi_python_generated.models.content_entry_type import ContentEntryType
|
|
24
|
+
from twitter_openapi_python_generated.models.display_type import DisplayType
|
|
25
|
+
from twitter_openapi_python_generated.models.feedback_info import FeedbackInfo
|
|
26
26
|
from twitter_openapi_python_generated.models.module_item import ModuleItem
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
except ImportError:
|
|
30
|
-
from typing_extensions import Self
|
|
27
|
+
from typing import Optional, Set
|
|
28
|
+
from typing_extensions import Self
|
|
31
29
|
|
|
32
30
|
class TimelineTimelineModule(BaseModel):
|
|
33
31
|
"""
|
|
@@ -35,19 +33,14 @@ class TimelineTimelineModule(BaseModel):
|
|
|
35
33
|
""" # noqa: E501
|
|
36
34
|
typename: StrictStr = Field(alias="__typename")
|
|
37
35
|
client_event_info: Dict[str, Any] = Field(alias="clientEventInfo")
|
|
38
|
-
display_type:
|
|
36
|
+
display_type: DisplayType = Field(alias="displayType")
|
|
39
37
|
entry_type: ContentEntryType = Field(alias="entryType")
|
|
38
|
+
feedback_info: Optional[FeedbackInfo] = Field(default=None, alias="feedbackInfo")
|
|
40
39
|
footer: Optional[Dict[str, Any]] = None
|
|
41
40
|
header: Optional[Dict[str, Any]] = None
|
|
42
41
|
items: Optional[List[ModuleItem]] = None
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
@field_validator('display_type')
|
|
46
|
-
def display_type_validate_enum(cls, value):
|
|
47
|
-
"""Validates the enum"""
|
|
48
|
-
if value not in ('Vertical', 'VerticalConversation', 'VerticalGrid', 'Carousel'):
|
|
49
|
-
raise ValueError("must be one of enum values ('Vertical', 'VerticalConversation', 'VerticalGrid', 'Carousel')")
|
|
50
|
-
return value
|
|
42
|
+
metadata: Optional[Dict[str, Any]] = None
|
|
43
|
+
__properties: ClassVar[List[str]] = ["__typename", "clientEventInfo", "displayType", "entryType", "feedbackInfo", "footer", "header", "items", "metadata"]
|
|
51
44
|
|
|
52
45
|
model_config = {
|
|
53
46
|
"populate_by_name": True,
|
|
@@ -66,7 +59,7 @@ class TimelineTimelineModule(BaseModel):
|
|
|
66
59
|
return json.dumps(self.to_dict())
|
|
67
60
|
|
|
68
61
|
@classmethod
|
|
69
|
-
def from_json(cls, json_str: str) -> Self:
|
|
62
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
70
63
|
"""Create an instance of TimelineTimelineModule from a JSON string"""
|
|
71
64
|
return cls.from_dict(json.loads(json_str))
|
|
72
65
|
|
|
@@ -80,12 +73,17 @@ class TimelineTimelineModule(BaseModel):
|
|
|
80
73
|
were set at model initialization. Other fields with value `None`
|
|
81
74
|
are ignored.
|
|
82
75
|
"""
|
|
76
|
+
excluded_fields: Set[str] = set([
|
|
77
|
+
])
|
|
78
|
+
|
|
83
79
|
_dict = self.model_dump(
|
|
84
80
|
by_alias=True,
|
|
85
|
-
exclude=
|
|
86
|
-
},
|
|
81
|
+
exclude=excluded_fields,
|
|
87
82
|
exclude_none=True,
|
|
88
83
|
)
|
|
84
|
+
# override the default output from pydantic by calling `to_dict()` of feedback_info
|
|
85
|
+
if self.feedback_info:
|
|
86
|
+
_dict['feedbackInfo'] = self.feedback_info.to_dict()
|
|
89
87
|
# override the default output from pydantic by calling `to_dict()` of each item in items (list)
|
|
90
88
|
_items = []
|
|
91
89
|
if self.items:
|
|
@@ -96,7 +94,7 @@ class TimelineTimelineModule(BaseModel):
|
|
|
96
94
|
return _dict
|
|
97
95
|
|
|
98
96
|
@classmethod
|
|
99
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
97
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
100
98
|
"""Create an instance of TimelineTimelineModule from a dict"""
|
|
101
99
|
if obj is None:
|
|
102
100
|
return None
|
|
@@ -109,9 +107,11 @@ class TimelineTimelineModule(BaseModel):
|
|
|
109
107
|
"clientEventInfo": obj.get("clientEventInfo"),
|
|
110
108
|
"displayType": obj.get("displayType"),
|
|
111
109
|
"entryType": obj.get("entryType"),
|
|
110
|
+
"feedbackInfo": FeedbackInfo.from_dict(obj["feedbackInfo"]) if obj.get("feedbackInfo") is not None else None,
|
|
112
111
|
"footer": obj.get("footer"),
|
|
113
112
|
"header": obj.get("header"),
|
|
114
|
-
"items": [ModuleItem.from_dict(_item) for _item in obj
|
|
113
|
+
"items": [ModuleItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None,
|
|
114
|
+
"metadata": obj.get("metadata")
|
|
115
115
|
})
|
|
116
116
|
return _obj
|
|
117
117
|
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Twitter OpenAPI
|
|
5
|
+
|
|
6
|
+
Twitter OpenAPI(Swagger) specification
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1
|
|
9
|
+
Contact: yuki@yuki0311.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, Field, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from twitter_openapi_python_generated.models.social_context_union_type import SocialContextUnionType
|
|
24
|
+
from twitter_openapi_python_generated.models.topic_context import TopicContext
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class TimelineTopicContext(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
TimelineTopicContext
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
functionality_type: Optional[StrictStr] = Field(default=None, alias="functionalityType")
|
|
33
|
+
topic: Optional[TopicContext] = None
|
|
34
|
+
type: Optional[SocialContextUnionType] = None
|
|
35
|
+
__properties: ClassVar[List[str]] = ["functionalityType", "topic", "type"]
|
|
36
|
+
|
|
37
|
+
@field_validator('functionality_type')
|
|
38
|
+
def functionality_type_validate_enum(cls, value):
|
|
39
|
+
"""Validates the enum"""
|
|
40
|
+
if value is None:
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
if value not in set(['Basic']):
|
|
44
|
+
raise ValueError("must be one of enum values ('Basic')")
|
|
45
|
+
return value
|
|
46
|
+
|
|
47
|
+
model_config = {
|
|
48
|
+
"populate_by_name": True,
|
|
49
|
+
"validate_assignment": True,
|
|
50
|
+
"protected_namespaces": (),
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def to_str(self) -> str:
|
|
55
|
+
"""Returns the string representation of the model using alias"""
|
|
56
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
57
|
+
|
|
58
|
+
def to_json(self) -> str:
|
|
59
|
+
"""Returns the JSON representation of the model using alias"""
|
|
60
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
61
|
+
return json.dumps(self.to_dict())
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
65
|
+
"""Create an instance of TimelineTopicContext from a JSON string"""
|
|
66
|
+
return cls.from_dict(json.loads(json_str))
|
|
67
|
+
|
|
68
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
69
|
+
"""Return the dictionary representation of the model using alias.
|
|
70
|
+
|
|
71
|
+
This has the following differences from calling pydantic's
|
|
72
|
+
`self.model_dump(by_alias=True)`:
|
|
73
|
+
|
|
74
|
+
* `None` is only added to the output dict for nullable fields that
|
|
75
|
+
were set at model initialization. Other fields with value `None`
|
|
76
|
+
are ignored.
|
|
77
|
+
"""
|
|
78
|
+
excluded_fields: Set[str] = set([
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
_dict = self.model_dump(
|
|
82
|
+
by_alias=True,
|
|
83
|
+
exclude=excluded_fields,
|
|
84
|
+
exclude_none=True,
|
|
85
|
+
)
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of topic
|
|
87
|
+
if self.topic:
|
|
88
|
+
_dict['topic'] = self.topic.to_dict()
|
|
89
|
+
return _dict
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
93
|
+
"""Create an instance of TimelineTopicContext from a dict"""
|
|
94
|
+
if obj is None:
|
|
95
|
+
return None
|
|
96
|
+
|
|
97
|
+
if not isinstance(obj, dict):
|
|
98
|
+
return cls.model_validate(obj)
|
|
99
|
+
|
|
100
|
+
_obj = cls.model_validate({
|
|
101
|
+
"functionalityType": obj.get("functionalityType"),
|
|
102
|
+
"topic": TopicContext.from_dict(obj["topic"]) if obj.get("topic") is not None else None,
|
|
103
|
+
"type": obj.get("type")
|
|
104
|
+
})
|
|
105
|
+
return _obj
|
|
106
|
+
|
|
107
|
+
|
|
@@ -18,30 +18,28 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
from pydantic import BaseModel, Field, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
-
from pydantic import BaseModel, StrictStr
|
|
24
|
-
from pydantic import Field
|
|
25
23
|
from twitter_openapi_python_generated.models.content_item_type import ContentItemType
|
|
24
|
+
from twitter_openapi_python_generated.models.highlight import Highlight
|
|
26
25
|
from twitter_openapi_python_generated.models.item_result import ItemResult
|
|
27
|
-
from twitter_openapi_python_generated.models.
|
|
26
|
+
from twitter_openapi_python_generated.models.social_context_union import SocialContextUnion
|
|
28
27
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
except ImportError:
|
|
32
|
-
from typing_extensions import Self
|
|
28
|
+
from typing import Optional, Set
|
|
29
|
+
from typing_extensions import Self
|
|
33
30
|
|
|
34
31
|
class TimelineTweet(BaseModel):
|
|
35
32
|
"""
|
|
36
33
|
TimelineTweet
|
|
37
34
|
""" # noqa: E501
|
|
38
|
-
social_context: Optional[SocialContext] = Field(default=None, alias="SocialContext")
|
|
39
35
|
typename: TypeName = Field(alias="__typename")
|
|
36
|
+
highlights: Optional[Highlight] = None
|
|
40
37
|
item_type: ContentItemType = Field(alias="itemType")
|
|
41
38
|
promoted_metadata: Optional[Dict[str, Any]] = Field(default=None, alias="promotedMetadata")
|
|
39
|
+
social_context: Optional[SocialContextUnion] = Field(default=None, alias="socialContext")
|
|
42
40
|
tweet_display_type: StrictStr = Field(alias="tweetDisplayType")
|
|
43
41
|
tweet_results: ItemResult
|
|
44
|
-
__properties: ClassVar[List[str]] = ["
|
|
42
|
+
__properties: ClassVar[List[str]] = ["__typename", "highlights", "itemType", "promotedMetadata", "socialContext", "tweetDisplayType", "tweet_results"]
|
|
45
43
|
|
|
46
44
|
model_config = {
|
|
47
45
|
"populate_by_name": True,
|
|
@@ -60,7 +58,7 @@ class TimelineTweet(BaseModel):
|
|
|
60
58
|
return json.dumps(self.to_dict())
|
|
61
59
|
|
|
62
60
|
@classmethod
|
|
63
|
-
def from_json(cls, json_str: str) -> Self:
|
|
61
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
64
62
|
"""Create an instance of TimelineTweet from a JSON string"""
|
|
65
63
|
return cls.from_dict(json.loads(json_str))
|
|
66
64
|
|
|
@@ -74,22 +72,27 @@ class TimelineTweet(BaseModel):
|
|
|
74
72
|
were set at model initialization. Other fields with value `None`
|
|
75
73
|
are ignored.
|
|
76
74
|
"""
|
|
75
|
+
excluded_fields: Set[str] = set([
|
|
76
|
+
])
|
|
77
|
+
|
|
77
78
|
_dict = self.model_dump(
|
|
78
79
|
by_alias=True,
|
|
79
|
-
exclude=
|
|
80
|
-
},
|
|
80
|
+
exclude=excluded_fields,
|
|
81
81
|
exclude_none=True,
|
|
82
82
|
)
|
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of highlights
|
|
84
|
+
if self.highlights:
|
|
85
|
+
_dict['highlights'] = self.highlights.to_dict()
|
|
83
86
|
# override the default output from pydantic by calling `to_dict()` of social_context
|
|
84
87
|
if self.social_context:
|
|
85
|
-
_dict['
|
|
88
|
+
_dict['socialContext'] = self.social_context.to_dict()
|
|
86
89
|
# override the default output from pydantic by calling `to_dict()` of tweet_results
|
|
87
90
|
if self.tweet_results:
|
|
88
91
|
_dict['tweet_results'] = self.tweet_results.to_dict()
|
|
89
92
|
return _dict
|
|
90
93
|
|
|
91
94
|
@classmethod
|
|
92
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
95
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
93
96
|
"""Create an instance of TimelineTweet from a dict"""
|
|
94
97
|
if obj is None:
|
|
95
98
|
return None
|
|
@@ -98,12 +101,13 @@ class TimelineTweet(BaseModel):
|
|
|
98
101
|
return cls.model_validate(obj)
|
|
99
102
|
|
|
100
103
|
_obj = cls.model_validate({
|
|
101
|
-
"SocialContext": SocialContext.from_dict(obj.get("SocialContext")) if obj.get("SocialContext") is not None else None,
|
|
102
104
|
"__typename": obj.get("__typename"),
|
|
105
|
+
"highlights": Highlight.from_dict(obj["highlights"]) if obj.get("highlights") is not None else None,
|
|
103
106
|
"itemType": obj.get("itemType"),
|
|
104
107
|
"promotedMetadata": obj.get("promotedMetadata"),
|
|
108
|
+
"socialContext": SocialContextUnion.from_dict(obj["socialContext"]) if obj.get("socialContext") is not None else None,
|
|
105
109
|
"tweetDisplayType": obj.get("tweetDisplayType"),
|
|
106
|
-
"tweet_results": ItemResult.from_dict(obj
|
|
110
|
+
"tweet_results": ItemResult.from_dict(obj["tweet_results"]) if obj.get("tweet_results") is not None else None
|
|
107
111
|
})
|
|
108
112
|
return _obj
|
|
109
113
|
|
|
@@ -18,34 +18,30 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
from pydantic import BaseModel, Field, StrictStr, field_validator
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
-
from pydantic import BaseModel, StrictStr, field_validator
|
|
24
|
-
from pydantic import Field
|
|
25
23
|
from twitter_openapi_python_generated.models.content_item_type import ContentItemType
|
|
26
|
-
from twitter_openapi_python_generated.models.
|
|
24
|
+
from twitter_openapi_python_generated.models.social_context_union import SocialContextUnion
|
|
27
25
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
28
26
|
from twitter_openapi_python_generated.models.user_results import UserResults
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
except ImportError:
|
|
32
|
-
from typing_extensions import Self
|
|
27
|
+
from typing import Optional, Set
|
|
28
|
+
from typing_extensions import Self
|
|
33
29
|
|
|
34
30
|
class TimelineUser(BaseModel):
|
|
35
31
|
"""
|
|
36
32
|
TimelineUser
|
|
37
33
|
""" # noqa: E501
|
|
38
|
-
social_context: Optional[SocialContext] = Field(default=None, alias="SocialContext")
|
|
39
34
|
typename: TypeName = Field(alias="__typename")
|
|
40
35
|
item_type: ContentItemType = Field(alias="itemType")
|
|
36
|
+
social_context: Optional[SocialContextUnion] = Field(default=None, alias="socialContext")
|
|
41
37
|
user_display_type: StrictStr = Field(alias="userDisplayType")
|
|
42
38
|
user_results: UserResults
|
|
43
|
-
__properties: ClassVar[List[str]] = ["
|
|
39
|
+
__properties: ClassVar[List[str]] = ["__typename", "itemType", "socialContext", "userDisplayType", "user_results"]
|
|
44
40
|
|
|
45
41
|
@field_validator('user_display_type')
|
|
46
42
|
def user_display_type_validate_enum(cls, value):
|
|
47
43
|
"""Validates the enum"""
|
|
48
|
-
if value not in ('User', 'UserDetailed', 'SubscribableUser'):
|
|
44
|
+
if value not in set(['User', 'UserDetailed', 'SubscribableUser']):
|
|
49
45
|
raise ValueError("must be one of enum values ('User', 'UserDetailed', 'SubscribableUser')")
|
|
50
46
|
return value
|
|
51
47
|
|
|
@@ -66,7 +62,7 @@ class TimelineUser(BaseModel):
|
|
|
66
62
|
return json.dumps(self.to_dict())
|
|
67
63
|
|
|
68
64
|
@classmethod
|
|
69
|
-
def from_json(cls, json_str: str) -> Self:
|
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
70
66
|
"""Create an instance of TimelineUser from a JSON string"""
|
|
71
67
|
return cls.from_dict(json.loads(json_str))
|
|
72
68
|
|
|
@@ -80,22 +76,24 @@ class TimelineUser(BaseModel):
|
|
|
80
76
|
were set at model initialization. Other fields with value `None`
|
|
81
77
|
are ignored.
|
|
82
78
|
"""
|
|
79
|
+
excluded_fields: Set[str] = set([
|
|
80
|
+
])
|
|
81
|
+
|
|
83
82
|
_dict = self.model_dump(
|
|
84
83
|
by_alias=True,
|
|
85
|
-
exclude=
|
|
86
|
-
},
|
|
84
|
+
exclude=excluded_fields,
|
|
87
85
|
exclude_none=True,
|
|
88
86
|
)
|
|
89
87
|
# override the default output from pydantic by calling `to_dict()` of social_context
|
|
90
88
|
if self.social_context:
|
|
91
|
-
_dict['
|
|
89
|
+
_dict['socialContext'] = self.social_context.to_dict()
|
|
92
90
|
# override the default output from pydantic by calling `to_dict()` of user_results
|
|
93
91
|
if self.user_results:
|
|
94
92
|
_dict['user_results'] = self.user_results.to_dict()
|
|
95
93
|
return _dict
|
|
96
94
|
|
|
97
95
|
@classmethod
|
|
98
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
96
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
99
97
|
"""Create an instance of TimelineUser from a dict"""
|
|
100
98
|
if obj is None:
|
|
101
99
|
return None
|
|
@@ -104,11 +102,11 @@ class TimelineUser(BaseModel):
|
|
|
104
102
|
return cls.model_validate(obj)
|
|
105
103
|
|
|
106
104
|
_obj = cls.model_validate({
|
|
107
|
-
"SocialContext": SocialContext.from_dict(obj.get("SocialContext")) if obj.get("SocialContext") is not None else None,
|
|
108
105
|
"__typename": obj.get("__typename"),
|
|
109
106
|
"itemType": obj.get("itemType"),
|
|
107
|
+
"socialContext": SocialContextUnion.from_dict(obj["socialContext"]) if obj.get("socialContext") is not None else None,
|
|
110
108
|
"userDisplayType": obj.get("userDisplayType"),
|
|
111
|
-
"user_results": UserResults.from_dict(obj
|
|
109
|
+
"user_results": UserResults.from_dict(obj["user_results"]) if obj.get("user_results") is not None else None
|
|
112
110
|
})
|
|
113
111
|
return _obj
|
|
114
112
|
|
|
@@ -18,14 +18,11 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
23
21
|
from pydantic import BaseModel
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
24
23
|
from twitter_openapi_python_generated.models.timeline import Timeline
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
except ImportError:
|
|
28
|
-
from typing_extensions import Self
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
29
26
|
|
|
30
27
|
class TimelineV2(BaseModel):
|
|
31
28
|
"""
|
|
@@ -51,7 +48,7 @@ class TimelineV2(BaseModel):
|
|
|
51
48
|
return json.dumps(self.to_dict())
|
|
52
49
|
|
|
53
50
|
@classmethod
|
|
54
|
-
def from_json(cls, json_str: str) -> Self:
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
52
|
"""Create an instance of TimelineV2 from a JSON string"""
|
|
56
53
|
return cls.from_dict(json.loads(json_str))
|
|
57
54
|
|
|
@@ -65,10 +62,12 @@ class TimelineV2(BaseModel):
|
|
|
65
62
|
were set at model initialization. Other fields with value `None`
|
|
66
63
|
are ignored.
|
|
67
64
|
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
68
|
_dict = self.model_dump(
|
|
69
69
|
by_alias=True,
|
|
70
|
-
exclude=
|
|
71
|
-
},
|
|
70
|
+
exclude=excluded_fields,
|
|
72
71
|
exclude_none=True,
|
|
73
72
|
)
|
|
74
73
|
# override the default output from pydantic by calling `to_dict()` of timeline
|
|
@@ -77,7 +76,7 @@ class TimelineV2(BaseModel):
|
|
|
77
76
|
return _dict
|
|
78
77
|
|
|
79
78
|
@classmethod
|
|
80
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
79
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
80
|
"""Create an instance of TimelineV2 from a dict"""
|
|
82
81
|
if obj is None:
|
|
83
82
|
return None
|
|
@@ -86,7 +85,7 @@ class TimelineV2(BaseModel):
|
|
|
86
85
|
return cls.model_validate(obj)
|
|
87
86
|
|
|
88
87
|
_obj = cls.model_validate({
|
|
89
|
-
"timeline": Timeline.from_dict(obj
|
|
88
|
+
"timeline": Timeline.from_dict(obj["timeline"]) if obj.get("timeline") is not None else None
|
|
90
89
|
})
|
|
91
90
|
return _obj
|
|
92
91
|
|