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,13 +18,10 @@ 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, StrictInt
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
from typing_extensions import Self
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
28
25
|
|
|
29
26
|
class MediaOriginalInfoFocusRect(BaseModel):
|
|
30
27
|
"""
|
|
@@ -53,7 +50,7 @@ class MediaOriginalInfoFocusRect(BaseModel):
|
|
|
53
50
|
return json.dumps(self.to_dict())
|
|
54
51
|
|
|
55
52
|
@classmethod
|
|
56
|
-
def from_json(cls, json_str: str) -> Self:
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
54
|
"""Create an instance of MediaOriginalInfoFocusRect from a JSON string"""
|
|
58
55
|
return cls.from_dict(json.loads(json_str))
|
|
59
56
|
|
|
@@ -67,16 +64,18 @@ class MediaOriginalInfoFocusRect(BaseModel):
|
|
|
67
64
|
were set at model initialization. Other fields with value `None`
|
|
68
65
|
are ignored.
|
|
69
66
|
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
70
|
_dict = self.model_dump(
|
|
71
71
|
by_alias=True,
|
|
72
|
-
exclude=
|
|
73
|
-
},
|
|
72
|
+
exclude=excluded_fields,
|
|
74
73
|
exclude_none=True,
|
|
75
74
|
)
|
|
76
75
|
return _dict
|
|
77
76
|
|
|
78
77
|
@classmethod
|
|
79
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
78
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
79
|
"""Create an instance of MediaOriginalInfoFocusRect from a dict"""
|
|
81
80
|
if obj is None:
|
|
82
81
|
return None
|
|
@@ -18,13 +18,10 @@ 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, StrictInt, StrictStr, field_validator
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
from typing_extensions import Self
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
28
25
|
|
|
29
26
|
class MediaSize(BaseModel):
|
|
30
27
|
"""
|
|
@@ -38,7 +35,7 @@ class MediaSize(BaseModel):
|
|
|
38
35
|
@field_validator('resize')
|
|
39
36
|
def resize_validate_enum(cls, value):
|
|
40
37
|
"""Validates the enum"""
|
|
41
|
-
if value not in ('crop', 'fit'):
|
|
38
|
+
if value not in set(['crop', 'fit']):
|
|
42
39
|
raise ValueError("must be one of enum values ('crop', 'fit')")
|
|
43
40
|
return value
|
|
44
41
|
|
|
@@ -59,7 +56,7 @@ class MediaSize(BaseModel):
|
|
|
59
56
|
return json.dumps(self.to_dict())
|
|
60
57
|
|
|
61
58
|
@classmethod
|
|
62
|
-
def from_json(cls, json_str: str) -> Self:
|
|
59
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
63
60
|
"""Create an instance of MediaSize from a JSON string"""
|
|
64
61
|
return cls.from_dict(json.loads(json_str))
|
|
65
62
|
|
|
@@ -73,16 +70,18 @@ class MediaSize(BaseModel):
|
|
|
73
70
|
were set at model initialization. Other fields with value `None`
|
|
74
71
|
are ignored.
|
|
75
72
|
"""
|
|
73
|
+
excluded_fields: Set[str] = set([
|
|
74
|
+
])
|
|
75
|
+
|
|
76
76
|
_dict = self.model_dump(
|
|
77
77
|
by_alias=True,
|
|
78
|
-
exclude=
|
|
79
|
-
},
|
|
78
|
+
exclude=excluded_fields,
|
|
80
79
|
exclude_none=True,
|
|
81
80
|
)
|
|
82
81
|
return _dict
|
|
83
82
|
|
|
84
83
|
@classmethod
|
|
85
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
84
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
85
|
"""Create an instance of MediaSize from a dict"""
|
|
87
86
|
if obj is None:
|
|
88
87
|
return None
|
|
@@ -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.media_size import MediaSize
|
|
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 MediaSizes(BaseModel):
|
|
31
28
|
"""
|
|
@@ -54,7 +51,7 @@ class MediaSizes(BaseModel):
|
|
|
54
51
|
return json.dumps(self.to_dict())
|
|
55
52
|
|
|
56
53
|
@classmethod
|
|
57
|
-
def from_json(cls, json_str: str) -> Self:
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
55
|
"""Create an instance of MediaSizes from a JSON string"""
|
|
59
56
|
return cls.from_dict(json.loads(json_str))
|
|
60
57
|
|
|
@@ -68,10 +65,12 @@ class MediaSizes(BaseModel):
|
|
|
68
65
|
were set at model initialization. Other fields with value `None`
|
|
69
66
|
are ignored.
|
|
70
67
|
"""
|
|
68
|
+
excluded_fields: Set[str] = set([
|
|
69
|
+
])
|
|
70
|
+
|
|
71
71
|
_dict = self.model_dump(
|
|
72
72
|
by_alias=True,
|
|
73
|
-
exclude=
|
|
74
|
-
},
|
|
73
|
+
exclude=excluded_fields,
|
|
75
74
|
exclude_none=True,
|
|
76
75
|
)
|
|
77
76
|
# override the default output from pydantic by calling `to_dict()` of large
|
|
@@ -89,7 +88,7 @@ class MediaSizes(BaseModel):
|
|
|
89
88
|
return _dict
|
|
90
89
|
|
|
91
90
|
@classmethod
|
|
92
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
91
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
93
92
|
"""Create an instance of MediaSizes from a dict"""
|
|
94
93
|
if obj is None:
|
|
95
94
|
return None
|
|
@@ -98,10 +97,10 @@ class MediaSizes(BaseModel):
|
|
|
98
97
|
return cls.model_validate(obj)
|
|
99
98
|
|
|
100
99
|
_obj = cls.model_validate({
|
|
101
|
-
"large": MediaSize.from_dict(obj
|
|
102
|
-
"medium": MediaSize.from_dict(obj
|
|
103
|
-
"small": MediaSize.from_dict(obj
|
|
104
|
-
"thumb": MediaSize.from_dict(obj
|
|
100
|
+
"large": MediaSize.from_dict(obj["large"]) if obj.get("large") is not None else None,
|
|
101
|
+
"medium": MediaSize.from_dict(obj["medium"]) if obj.get("medium") is not None else None,
|
|
102
|
+
"small": MediaSize.from_dict(obj["small"]) if obj.get("small") is not None else None,
|
|
103
|
+
"thumb": MediaSize.from_dict(obj["thumb"]) if obj.get("thumb") is not None else None
|
|
105
104
|
})
|
|
106
105
|
return _obj
|
|
107
106
|
|
|
@@ -18,14 +18,10 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
from pydantic import BaseModel, Field, StrictInt
|
|
22
22
|
from typing import Any, ClassVar, Dict, List
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
try:
|
|
26
|
-
from typing import Self
|
|
27
|
-
except ImportError:
|
|
28
|
-
from typing_extensions import Self
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
29
25
|
|
|
30
26
|
class MediaStats(BaseModel):
|
|
31
27
|
"""
|
|
@@ -51,7 +47,7 @@ class MediaStats(BaseModel):
|
|
|
51
47
|
return json.dumps(self.to_dict())
|
|
52
48
|
|
|
53
49
|
@classmethod
|
|
54
|
-
def from_json(cls, json_str: str) -> Self:
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
51
|
"""Create an instance of MediaStats from a JSON string"""
|
|
56
52
|
return cls.from_dict(json.loads(json_str))
|
|
57
53
|
|
|
@@ -65,16 +61,18 @@ class MediaStats(BaseModel):
|
|
|
65
61
|
were set at model initialization. Other fields with value `None`
|
|
66
62
|
are ignored.
|
|
67
63
|
"""
|
|
64
|
+
excluded_fields: Set[str] = set([
|
|
65
|
+
])
|
|
66
|
+
|
|
68
67
|
_dict = self.model_dump(
|
|
69
68
|
by_alias=True,
|
|
70
|
-
exclude=
|
|
71
|
-
},
|
|
69
|
+
exclude=excluded_fields,
|
|
72
70
|
exclude_none=True,
|
|
73
71
|
)
|
|
74
72
|
return _dict
|
|
75
73
|
|
|
76
74
|
@classmethod
|
|
77
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
75
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
78
76
|
"""Create an instance of MediaStats from a dict"""
|
|
79
77
|
if obj is None:
|
|
80
78
|
return None
|
|
@@ -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, Optional
|
|
23
21
|
from pydantic import BaseModel, StrictInt
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
24
23
|
from twitter_openapi_python_generated.models.media_video_info_variant import MediaVideoInfoVariant
|
|
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 MediaVideoInfo(BaseModel):
|
|
31
28
|
"""
|
|
@@ -53,7 +50,7 @@ class MediaVideoInfo(BaseModel):
|
|
|
53
50
|
return json.dumps(self.to_dict())
|
|
54
51
|
|
|
55
52
|
@classmethod
|
|
56
|
-
def from_json(cls, json_str: str) -> Self:
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
54
|
"""Create an instance of MediaVideoInfo from a JSON string"""
|
|
58
55
|
return cls.from_dict(json.loads(json_str))
|
|
59
56
|
|
|
@@ -67,10 +64,12 @@ class MediaVideoInfo(BaseModel):
|
|
|
67
64
|
were set at model initialization. Other fields with value `None`
|
|
68
65
|
are ignored.
|
|
69
66
|
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
70
|
_dict = self.model_dump(
|
|
71
71
|
by_alias=True,
|
|
72
|
-
exclude=
|
|
73
|
-
},
|
|
72
|
+
exclude=excluded_fields,
|
|
74
73
|
exclude_none=True,
|
|
75
74
|
)
|
|
76
75
|
# override the default output from pydantic by calling `to_dict()` of each item in variants (list)
|
|
@@ -83,7 +82,7 @@ class MediaVideoInfo(BaseModel):
|
|
|
83
82
|
return _dict
|
|
84
83
|
|
|
85
84
|
@classmethod
|
|
86
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
87
86
|
"""Create an instance of MediaVideoInfo from a dict"""
|
|
88
87
|
if obj is None:
|
|
89
88
|
return None
|
|
@@ -94,7 +93,7 @@ class MediaVideoInfo(BaseModel):
|
|
|
94
93
|
_obj = cls.model_validate({
|
|
95
94
|
"aspect_ratio": obj.get("aspect_ratio"),
|
|
96
95
|
"duration_millis": obj.get("duration_millis"),
|
|
97
|
-
"variants": [MediaVideoInfoVariant.from_dict(_item) for _item in obj
|
|
96
|
+
"variants": [MediaVideoInfoVariant.from_dict(_item) for _item in obj["variants"]] if obj.get("variants") is not None else None
|
|
98
97
|
})
|
|
99
98
|
return _obj
|
|
100
99
|
|
|
@@ -18,13 +18,10 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
21
|
from pydantic import BaseModel, StrictInt, StrictStr
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
from typing_extensions import Self
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
28
25
|
|
|
29
26
|
class MediaVideoInfoVariant(BaseModel):
|
|
30
27
|
"""
|
|
@@ -52,7 +49,7 @@ class MediaVideoInfoVariant(BaseModel):
|
|
|
52
49
|
return json.dumps(self.to_dict())
|
|
53
50
|
|
|
54
51
|
@classmethod
|
|
55
|
-
def from_json(cls, json_str: str) -> Self:
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
56
53
|
"""Create an instance of MediaVideoInfoVariant from a JSON string"""
|
|
57
54
|
return cls.from_dict(json.loads(json_str))
|
|
58
55
|
|
|
@@ -66,16 +63,18 @@ class MediaVideoInfoVariant(BaseModel):
|
|
|
66
63
|
were set at model initialization. Other fields with value `None`
|
|
67
64
|
are ignored.
|
|
68
65
|
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
69
|
_dict = self.model_dump(
|
|
70
70
|
by_alias=True,
|
|
71
|
-
exclude=
|
|
72
|
-
},
|
|
71
|
+
exclude=excluded_fields,
|
|
73
72
|
exclude_none=True,
|
|
74
73
|
)
|
|
75
74
|
return _dict
|
|
76
75
|
|
|
77
76
|
@classmethod
|
|
78
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
77
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
79
78
|
"""Create an instance of MediaVideoInfoVariant from a dict"""
|
|
80
79
|
if obj is None:
|
|
81
80
|
return None
|
|
@@ -18,16 +18,12 @@ 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.item_content_union import ItemContentUnion
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
except ImportError:
|
|
30
|
-
from typing_extensions import Self
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
31
27
|
|
|
32
28
|
class ModuleEntry(BaseModel):
|
|
33
29
|
"""
|
|
@@ -54,7 +50,7 @@ class ModuleEntry(BaseModel):
|
|
|
54
50
|
return json.dumps(self.to_dict())
|
|
55
51
|
|
|
56
52
|
@classmethod
|
|
57
|
-
def from_json(cls, json_str: str) -> Self:
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
54
|
"""Create an instance of ModuleEntry from a JSON string"""
|
|
59
55
|
return cls.from_dict(json.loads(json_str))
|
|
60
56
|
|
|
@@ -68,10 +64,12 @@ class ModuleEntry(BaseModel):
|
|
|
68
64
|
were set at model initialization. Other fields with value `None`
|
|
69
65
|
are ignored.
|
|
70
66
|
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
71
70
|
_dict = self.model_dump(
|
|
72
71
|
by_alias=True,
|
|
73
|
-
exclude=
|
|
74
|
-
},
|
|
72
|
+
exclude=excluded_fields,
|
|
75
73
|
exclude_none=True,
|
|
76
74
|
)
|
|
77
75
|
# override the default output from pydantic by calling `to_dict()` of client_event_info
|
|
@@ -83,7 +81,7 @@ class ModuleEntry(BaseModel):
|
|
|
83
81
|
return _dict
|
|
84
82
|
|
|
85
83
|
@classmethod
|
|
86
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
84
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
87
85
|
"""Create an instance of ModuleEntry from a dict"""
|
|
88
86
|
if obj is None:
|
|
89
87
|
return None
|
|
@@ -92,8 +90,8 @@ class ModuleEntry(BaseModel):
|
|
|
92
90
|
return cls.model_validate(obj)
|
|
93
91
|
|
|
94
92
|
_obj = cls.model_validate({
|
|
95
|
-
"clientEventInfo": ClientEventInfo.from_dict(obj
|
|
96
|
-
"itemContent": ItemContentUnion.from_dict(obj
|
|
93
|
+
"clientEventInfo": ClientEventInfo.from_dict(obj["clientEventInfo"]) if obj.get("clientEventInfo") is not None else None,
|
|
94
|
+
"itemContent": ItemContentUnion.from_dict(obj["itemContent"]) if obj.get("itemContent") is not None else None
|
|
97
95
|
})
|
|
98
96
|
return _obj
|
|
99
97
|
|
|
@@ -18,16 +18,12 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
from pydantic import BaseModel, Field, field_validator
|
|
22
22
|
from typing import Any, ClassVar, Dict, List
|
|
23
|
-
from pydantic import BaseModel, field_validator
|
|
24
|
-
from pydantic import Field
|
|
25
23
|
from typing_extensions import Annotated
|
|
26
24
|
from twitter_openapi_python_generated.models.module_entry import ModuleEntry
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
except ImportError:
|
|
30
|
-
from typing_extensions import Self
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
31
27
|
|
|
32
28
|
class ModuleItem(BaseModel):
|
|
33
29
|
"""
|
|
@@ -61,7 +57,7 @@ class ModuleItem(BaseModel):
|
|
|
61
57
|
return json.dumps(self.to_dict())
|
|
62
58
|
|
|
63
59
|
@classmethod
|
|
64
|
-
def from_json(cls, json_str: str) -> Self:
|
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
65
61
|
"""Create an instance of ModuleItem from a JSON string"""
|
|
66
62
|
return cls.from_dict(json.loads(json_str))
|
|
67
63
|
|
|
@@ -75,10 +71,12 @@ class ModuleItem(BaseModel):
|
|
|
75
71
|
were set at model initialization. Other fields with value `None`
|
|
76
72
|
are ignored.
|
|
77
73
|
"""
|
|
74
|
+
excluded_fields: Set[str] = set([
|
|
75
|
+
])
|
|
76
|
+
|
|
78
77
|
_dict = self.model_dump(
|
|
79
78
|
by_alias=True,
|
|
80
|
-
exclude=
|
|
81
|
-
},
|
|
79
|
+
exclude=excluded_fields,
|
|
82
80
|
exclude_none=True,
|
|
83
81
|
)
|
|
84
82
|
# override the default output from pydantic by calling `to_dict()` of item
|
|
@@ -87,7 +85,7 @@ class ModuleItem(BaseModel):
|
|
|
87
85
|
return _dict
|
|
88
86
|
|
|
89
87
|
@classmethod
|
|
90
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
88
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
91
89
|
"""Create an instance of ModuleItem from a dict"""
|
|
92
90
|
if obj is None:
|
|
93
91
|
return None
|
|
@@ -97,7 +95,7 @@ class ModuleItem(BaseModel):
|
|
|
97
95
|
|
|
98
96
|
_obj = cls.model_validate({
|
|
99
97
|
"entryId": obj.get("entryId"),
|
|
100
|
-
"item": ModuleEntry.from_dict(obj
|
|
98
|
+
"item": ModuleEntry.from_dict(obj["item"]) if obj.get("item") is not None else None
|
|
101
99
|
})
|
|
102
100
|
return _obj
|
|
103
101
|
|
|
@@ -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, StrictBool
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
24
23
|
from twitter_openapi_python_generated.models.note_tweet_result import NoteTweetResult
|
|
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 NoteTweet(BaseModel):
|
|
31
28
|
"""
|
|
@@ -52,7 +49,7 @@ class NoteTweet(BaseModel):
|
|
|
52
49
|
return json.dumps(self.to_dict())
|
|
53
50
|
|
|
54
51
|
@classmethod
|
|
55
|
-
def from_json(cls, json_str: str) -> Self:
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
56
53
|
"""Create an instance of NoteTweet from a JSON string"""
|
|
57
54
|
return cls.from_dict(json.loads(json_str))
|
|
58
55
|
|
|
@@ -66,10 +63,12 @@ class NoteTweet(BaseModel):
|
|
|
66
63
|
were set at model initialization. Other fields with value `None`
|
|
67
64
|
are ignored.
|
|
68
65
|
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
69
|
_dict = self.model_dump(
|
|
70
70
|
by_alias=True,
|
|
71
|
-
exclude=
|
|
72
|
-
},
|
|
71
|
+
exclude=excluded_fields,
|
|
73
72
|
exclude_none=True,
|
|
74
73
|
)
|
|
75
74
|
# override the default output from pydantic by calling `to_dict()` of note_tweet_results
|
|
@@ -78,7 +77,7 @@ class NoteTweet(BaseModel):
|
|
|
78
77
|
return _dict
|
|
79
78
|
|
|
80
79
|
@classmethod
|
|
81
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
81
|
"""Create an instance of NoteTweet from a dict"""
|
|
83
82
|
if obj is None:
|
|
84
83
|
return None
|
|
@@ -88,7 +87,7 @@ class NoteTweet(BaseModel):
|
|
|
88
87
|
|
|
89
88
|
_obj = cls.model_validate({
|
|
90
89
|
"is_expandable": obj.get("is_expandable"),
|
|
91
|
-
"note_tweet_results": NoteTweetResult.from_dict(obj
|
|
90
|
+
"note_tweet_results": NoteTweetResult.from_dict(obj["note_tweet_results"]) if obj.get("note_tweet_results") is not None else None
|
|
92
91
|
})
|
|
93
92
|
return _obj
|
|
94
93
|
|
|
@@ -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.note_tweet_result_data import NoteTweetResultData
|
|
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 NoteTweetResult(BaseModel):
|
|
31
28
|
"""
|
|
@@ -51,7 +48,7 @@ class NoteTweetResult(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 NoteTweetResult from a JSON string"""
|
|
56
53
|
return cls.from_dict(json.loads(json_str))
|
|
57
54
|
|
|
@@ -65,10 +62,12 @@ class NoteTweetResult(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 result
|
|
@@ -77,7 +76,7 @@ class NoteTweetResult(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 NoteTweetResult from a dict"""
|
|
82
81
|
if obj is None:
|
|
83
82
|
return None
|
|
@@ -86,7 +85,7 @@ class NoteTweetResult(BaseModel):
|
|
|
86
85
|
return cls.model_validate(obj)
|
|
87
86
|
|
|
88
87
|
_obj = cls.model_validate({
|
|
89
|
-
"result": NoteTweetResultData.from_dict(obj
|
|
88
|
+
"result": NoteTweetResultData.from_dict(obj["result"]) if obj.get("result") is not None else None
|
|
90
89
|
})
|
|
91
90
|
return _obj
|
|
92
91
|
|
|
@@ -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, 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 typing_extensions import Annotated
|
|
26
24
|
from twitter_openapi_python_generated.models.entities import Entities
|
|
27
25
|
from twitter_openapi_python_generated.models.note_tweet_result_media import NoteTweetResultMedia
|
|
28
26
|
from twitter_openapi_python_generated.models.note_tweet_result_rich_text import NoteTweetResultRichText
|
|
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 NoteTweetResultData(BaseModel):
|
|
35
31
|
"""
|
|
@@ -66,7 +62,7 @@ class NoteTweetResultData(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 NoteTweetResultData from a JSON string"""
|
|
71
67
|
return cls.from_dict(json.loads(json_str))
|
|
72
68
|
|
|
@@ -80,10 +76,12 @@ class NoteTweetResultData(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 entity_set
|
|
@@ -98,7 +96,7 @@ class NoteTweetResultData(BaseModel):
|
|
|
98
96
|
return _dict
|
|
99
97
|
|
|
100
98
|
@classmethod
|
|
101
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
99
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
102
100
|
"""Create an instance of NoteTweetResultData from a dict"""
|
|
103
101
|
if obj is None:
|
|
104
102
|
return None
|
|
@@ -107,10 +105,10 @@ class NoteTweetResultData(BaseModel):
|
|
|
107
105
|
return cls.model_validate(obj)
|
|
108
106
|
|
|
109
107
|
_obj = cls.model_validate({
|
|
110
|
-
"entity_set": Entities.from_dict(obj
|
|
108
|
+
"entity_set": Entities.from_dict(obj["entity_set"]) if obj.get("entity_set") is not None else None,
|
|
111
109
|
"id": obj.get("id"),
|
|
112
|
-
"media": NoteTweetResultMedia.from_dict(obj
|
|
113
|
-
"richtext": NoteTweetResultRichText.from_dict(obj
|
|
110
|
+
"media": NoteTweetResultMedia.from_dict(obj["media"]) if obj.get("media") is not None else None,
|
|
111
|
+
"richtext": NoteTweetResultRichText.from_dict(obj["richtext"]) if obj.get("richtext") is not None else None,
|
|
114
112
|
"text": obj.get("text")
|
|
115
113
|
})
|
|
116
114
|
return _obj
|