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,14 +18,10 @@ 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
|
|
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 TextEntityRef(BaseModel):
|
|
31
27
|
"""
|
|
@@ -39,14 +35,14 @@ class TextEntityRef(BaseModel):
|
|
|
39
35
|
@field_validator('type')
|
|
40
36
|
def type_validate_enum(cls, value):
|
|
41
37
|
"""Validates the enum"""
|
|
42
|
-
if value not in ('TimelineUrl'):
|
|
38
|
+
if value not in set(['TimelineUrl']):
|
|
43
39
|
raise ValueError("must be one of enum values ('TimelineUrl')")
|
|
44
40
|
return value
|
|
45
41
|
|
|
46
42
|
@field_validator('url_type')
|
|
47
43
|
def url_type_validate_enum(cls, value):
|
|
48
44
|
"""Validates the enum"""
|
|
49
|
-
if value not in ('ExternalUrl'):
|
|
45
|
+
if value not in set(['ExternalUrl']):
|
|
50
46
|
raise ValueError("must be one of enum values ('ExternalUrl')")
|
|
51
47
|
return value
|
|
52
48
|
|
|
@@ -67,7 +63,7 @@ class TextEntityRef(BaseModel):
|
|
|
67
63
|
return json.dumps(self.to_dict())
|
|
68
64
|
|
|
69
65
|
@classmethod
|
|
70
|
-
def from_json(cls, json_str: str) -> Self:
|
|
66
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
71
67
|
"""Create an instance of TextEntityRef from a JSON string"""
|
|
72
68
|
return cls.from_dict(json.loads(json_str))
|
|
73
69
|
|
|
@@ -81,16 +77,18 @@ class TextEntityRef(BaseModel):
|
|
|
81
77
|
were set at model initialization. Other fields with value `None`
|
|
82
78
|
are ignored.
|
|
83
79
|
"""
|
|
80
|
+
excluded_fields: Set[str] = set([
|
|
81
|
+
])
|
|
82
|
+
|
|
84
83
|
_dict = self.model_dump(
|
|
85
84
|
by_alias=True,
|
|
86
|
-
exclude=
|
|
87
|
-
},
|
|
85
|
+
exclude=excluded_fields,
|
|
88
86
|
exclude_none=True,
|
|
89
87
|
)
|
|
90
88
|
return _dict
|
|
91
89
|
|
|
92
90
|
@classmethod
|
|
93
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
91
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
94
92
|
"""Create an instance of TextEntityRef from a dict"""
|
|
95
93
|
if obj is None:
|
|
96
94
|
return None
|
|
@@ -0,0 +1,90 @@
|
|
|
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, StrictInt
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class TextHighlight(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
TextHighlight
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
end_index: StrictInt = Field(alias="endIndex")
|
|
31
|
+
start_index: StrictInt = Field(alias="startIndex")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["endIndex", "startIndex"]
|
|
33
|
+
|
|
34
|
+
model_config = {
|
|
35
|
+
"populate_by_name": True,
|
|
36
|
+
"validate_assignment": True,
|
|
37
|
+
"protected_namespaces": (),
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of TextHighlight from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
return _dict
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
77
|
+
"""Create an instance of TextHighlight from a dict"""
|
|
78
|
+
if obj is None:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
if not isinstance(obj, dict):
|
|
82
|
+
return cls.model_validate(obj)
|
|
83
|
+
|
|
84
|
+
_obj = cls.model_validate({
|
|
85
|
+
"endIndex": obj.get("endIndex"),
|
|
86
|
+
"startIndex": obj.get("startIndex")
|
|
87
|
+
})
|
|
88
|
+
return _obj
|
|
89
|
+
|
|
90
|
+
|
|
@@ -18,15 +18,11 @@ 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.instruction_union import InstructionUnion
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
except ImportError:
|
|
29
|
-
from typing_extensions import Self
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
30
26
|
|
|
31
27
|
class Timeline(BaseModel):
|
|
32
28
|
"""
|
|
@@ -54,7 +50,7 @@ class Timeline(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 Timeline from a JSON string"""
|
|
59
55
|
return cls.from_dict(json.loads(json_str))
|
|
60
56
|
|
|
@@ -68,10 +64,12 @@ class Timeline(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 each item in instructions (list)
|
|
@@ -84,7 +82,7 @@ class Timeline(BaseModel):
|
|
|
84
82
|
return _dict
|
|
85
83
|
|
|
86
84
|
@classmethod
|
|
87
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
88
86
|
"""Create an instance of Timeline from a dict"""
|
|
89
87
|
if obj is None:
|
|
90
88
|
return None
|
|
@@ -93,7 +91,7 @@ class Timeline(BaseModel):
|
|
|
93
91
|
return cls.model_validate(obj)
|
|
94
92
|
|
|
95
93
|
_obj = cls.model_validate({
|
|
96
|
-
"instructions": [InstructionUnion.from_dict(_item) for _item in obj
|
|
94
|
+
"instructions": [InstructionUnion.from_dict(_item) for _item in obj["instructions"]] if obj.get("instructions") is not None else None,
|
|
97
95
|
"metadata": obj.get("metadata"),
|
|
98
96
|
"responseObjects": obj.get("responseObjects")
|
|
99
97
|
})
|
|
@@ -18,15 +18,12 @@ 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.instruction_type import InstructionType
|
|
25
24
|
from twitter_openapi_python_generated.models.timeline_add_entry import TimelineAddEntry
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
except ImportError:
|
|
29
|
-
from typing_extensions import Self
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
30
27
|
|
|
31
28
|
class TimelineAddEntries(BaseModel):
|
|
32
29
|
"""
|
|
@@ -53,7 +50,7 @@ class TimelineAddEntries(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 TimelineAddEntries from a JSON string"""
|
|
58
55
|
return cls.from_dict(json.loads(json_str))
|
|
59
56
|
|
|
@@ -67,10 +64,12 @@ class TimelineAddEntries(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 entries (list)
|
|
@@ -83,7 +82,7 @@ class TimelineAddEntries(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 TimelineAddEntries from a dict"""
|
|
88
87
|
if obj is None:
|
|
89
88
|
return None
|
|
@@ -92,7 +91,7 @@ class TimelineAddEntries(BaseModel):
|
|
|
92
91
|
return cls.model_validate(obj)
|
|
93
92
|
|
|
94
93
|
_obj = cls.model_validate({
|
|
95
|
-
"entries": [TimelineAddEntry.from_dict(_item) for _item in obj
|
|
94
|
+
"entries": [TimelineAddEntry.from_dict(_item) for _item in obj["entries"]] if obj.get("entries") is not None else None,
|
|
96
95
|
"type": obj.get("type")
|
|
97
96
|
})
|
|
98
97
|
return _obj
|
|
@@ -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.content_union import ContentUnion
|
|
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 TimelineAddEntry(BaseModel):
|
|
33
29
|
"""
|
|
@@ -69,7 +65,7 @@ class TimelineAddEntry(BaseModel):
|
|
|
69
65
|
return json.dumps(self.to_dict())
|
|
70
66
|
|
|
71
67
|
@classmethod
|
|
72
|
-
def from_json(cls, json_str: str) -> Self:
|
|
68
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
73
69
|
"""Create an instance of TimelineAddEntry from a JSON string"""
|
|
74
70
|
return cls.from_dict(json.loads(json_str))
|
|
75
71
|
|
|
@@ -83,10 +79,12 @@ class TimelineAddEntry(BaseModel):
|
|
|
83
79
|
were set at model initialization. Other fields with value `None`
|
|
84
80
|
are ignored.
|
|
85
81
|
"""
|
|
82
|
+
excluded_fields: Set[str] = set([
|
|
83
|
+
])
|
|
84
|
+
|
|
86
85
|
_dict = self.model_dump(
|
|
87
86
|
by_alias=True,
|
|
88
|
-
exclude=
|
|
89
|
-
},
|
|
87
|
+
exclude=excluded_fields,
|
|
90
88
|
exclude_none=True,
|
|
91
89
|
)
|
|
92
90
|
# override the default output from pydantic by calling `to_dict()` of content
|
|
@@ -95,7 +93,7 @@ class TimelineAddEntry(BaseModel):
|
|
|
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 TimelineAddEntry from a dict"""
|
|
100
98
|
if obj is None:
|
|
101
99
|
return None
|
|
@@ -104,7 +102,7 @@ class TimelineAddEntry(BaseModel):
|
|
|
104
102
|
return cls.model_validate(obj)
|
|
105
103
|
|
|
106
104
|
_obj = cls.model_validate({
|
|
107
|
-
"content": ContentUnion.from_dict(obj
|
|
105
|
+
"content": ContentUnion.from_dict(obj["content"]) if obj.get("content") is not None else None,
|
|
108
106
|
"entryId": obj.get("entryId"),
|
|
109
107
|
"sortIndex": obj.get("sortIndex")
|
|
110
108
|
})
|
|
@@ -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, StrictBool, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
-
from pydantic import BaseModel, StrictBool, StrictStr
|
|
24
|
-
from pydantic import Field
|
|
25
23
|
from twitter_openapi_python_generated.models.instruction_type import InstructionType
|
|
26
24
|
from twitter_openapi_python_generated.models.module_item import ModuleItem
|
|
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 TimelineAddToModule(BaseModel):
|
|
33
29
|
"""
|
|
@@ -56,7 +52,7 @@ class TimelineAddToModule(BaseModel):
|
|
|
56
52
|
return json.dumps(self.to_dict())
|
|
57
53
|
|
|
58
54
|
@classmethod
|
|
59
|
-
def from_json(cls, json_str: str) -> Self:
|
|
55
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
60
56
|
"""Create an instance of TimelineAddToModule from a JSON string"""
|
|
61
57
|
return cls.from_dict(json.loads(json_str))
|
|
62
58
|
|
|
@@ -70,10 +66,12 @@ class TimelineAddToModule(BaseModel):
|
|
|
70
66
|
were set at model initialization. Other fields with value `None`
|
|
71
67
|
are ignored.
|
|
72
68
|
"""
|
|
69
|
+
excluded_fields: Set[str] = set([
|
|
70
|
+
])
|
|
71
|
+
|
|
73
72
|
_dict = self.model_dump(
|
|
74
73
|
by_alias=True,
|
|
75
|
-
exclude=
|
|
76
|
-
},
|
|
74
|
+
exclude=excluded_fields,
|
|
77
75
|
exclude_none=True,
|
|
78
76
|
)
|
|
79
77
|
# override the default output from pydantic by calling `to_dict()` of each item in module_items (list)
|
|
@@ -86,7 +84,7 @@ class TimelineAddToModule(BaseModel):
|
|
|
86
84
|
return _dict
|
|
87
85
|
|
|
88
86
|
@classmethod
|
|
89
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
87
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
90
88
|
"""Create an instance of TimelineAddToModule from a dict"""
|
|
91
89
|
if obj is None:
|
|
92
90
|
return None
|
|
@@ -96,7 +94,7 @@ class TimelineAddToModule(BaseModel):
|
|
|
96
94
|
|
|
97
95
|
_obj = cls.model_validate({
|
|
98
96
|
"moduleEntryId": obj.get("moduleEntryId"),
|
|
99
|
-
"moduleItems": [ModuleItem.from_dict(_item) for _item in obj
|
|
97
|
+
"moduleItems": [ModuleItem.from_dict(_item) for _item in obj["moduleItems"]] if obj.get("moduleItems") is not None else None,
|
|
100
98
|
"prepend": obj.get("prepend"),
|
|
101
99
|
"type": obj.get("type")
|
|
102
100
|
})
|
|
@@ -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.instruction_type import InstructionType
|
|
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 TimelineClearCache(BaseModel):
|
|
31
28
|
"""
|
|
@@ -51,7 +48,7 @@ class TimelineClearCache(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 TimelineClearCache from a JSON string"""
|
|
56
53
|
return cls.from_dict(json.loads(json_str))
|
|
57
54
|
|
|
@@ -65,16 +62,18 @@ class TimelineClearCache(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
|
return _dict
|
|
75
74
|
|
|
76
75
|
@classmethod
|
|
77
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
78
77
|
"""Create an instance of TimelineClearCache from a dict"""
|
|
79
78
|
if obj is None:
|
|
80
79
|
return None
|
|
@@ -18,15 +18,11 @@ 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.type_name import TypeName
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
except ImportError:
|
|
29
|
-
from typing_extensions import Self
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
30
26
|
|
|
31
27
|
class TimelineCommunity(BaseModel):
|
|
32
28
|
"""
|
|
@@ -53,7 +49,7 @@ class TimelineCommunity(BaseModel):
|
|
|
53
49
|
return json.dumps(self.to_dict())
|
|
54
50
|
|
|
55
51
|
@classmethod
|
|
56
|
-
def from_json(cls, json_str: str) -> Self:
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
53
|
"""Create an instance of TimelineCommunity from a JSON string"""
|
|
58
54
|
return cls.from_dict(json.loads(json_str))
|
|
59
55
|
|
|
@@ -68,11 +64,13 @@ class TimelineCommunity(BaseModel):
|
|
|
68
64
|
are ignored.
|
|
69
65
|
* Fields in `self.additional_properties` are added to the output dict.
|
|
70
66
|
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
"additional_properties",
|
|
69
|
+
])
|
|
70
|
+
|
|
71
71
|
_dict = self.model_dump(
|
|
72
72
|
by_alias=True,
|
|
73
|
-
exclude=
|
|
74
|
-
"additional_properties",
|
|
75
|
-
},
|
|
73
|
+
exclude=excluded_fields,
|
|
76
74
|
exclude_none=True,
|
|
77
75
|
)
|
|
78
76
|
# puts key-value pairs in additional_properties in the top level
|
|
@@ -83,7 +81,7 @@ class TimelineCommunity(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 TimelineCommunity from a dict"""
|
|
88
86
|
if obj is None:
|
|
89
87
|
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, 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 TimelineCoverBehavior(BaseModel):
|
|
30
27
|
"""
|
|
@@ -36,7 +33,7 @@ class TimelineCoverBehavior(BaseModel):
|
|
|
36
33
|
@field_validator('type')
|
|
37
34
|
def type_validate_enum(cls, value):
|
|
38
35
|
"""Validates the enum"""
|
|
39
|
-
if value not in ('TimelineCoverBehaviorDismiss'):
|
|
36
|
+
if value not in set(['TimelineCoverBehaviorDismiss']):
|
|
40
37
|
raise ValueError("must be one of enum values ('TimelineCoverBehaviorDismiss')")
|
|
41
38
|
return value
|
|
42
39
|
|
|
@@ -57,7 +54,7 @@ class TimelineCoverBehavior(BaseModel):
|
|
|
57
54
|
return json.dumps(self.to_dict())
|
|
58
55
|
|
|
59
56
|
@classmethod
|
|
60
|
-
def from_json(cls, json_str: str) -> Self:
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
61
58
|
"""Create an instance of TimelineCoverBehavior from a JSON string"""
|
|
62
59
|
return cls.from_dict(json.loads(json_str))
|
|
63
60
|
|
|
@@ -71,16 +68,18 @@ class TimelineCoverBehavior(BaseModel):
|
|
|
71
68
|
were set at model initialization. Other fields with value `None`
|
|
72
69
|
are ignored.
|
|
73
70
|
"""
|
|
71
|
+
excluded_fields: Set[str] = set([
|
|
72
|
+
])
|
|
73
|
+
|
|
74
74
|
_dict = self.model_dump(
|
|
75
75
|
by_alias=True,
|
|
76
|
-
exclude=
|
|
77
|
-
},
|
|
76
|
+
exclude=excluded_fields,
|
|
78
77
|
exclude_none=True,
|
|
79
78
|
)
|
|
80
79
|
return _dict
|
|
81
80
|
|
|
82
81
|
@classmethod
|
|
83
|
-
def from_dict(cls, obj: Dict) -> Self:
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
83
|
"""Create an instance of TimelineCoverBehavior from a dict"""
|
|
85
84
|
if obj is None:
|
|
86
85
|
return None
|
|
@@ -0,0 +1,109 @@
|
|
|
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_landing_url import SocialContextLandingUrl
|
|
24
|
+
from twitter_openapi_python_generated.models.social_context_union_type import SocialContextUnionType
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class TimelineGeneralContext(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
TimelineGeneralContext
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
context_type: Optional[StrictStr] = Field(default=None, alias="contextType")
|
|
33
|
+
landing_url: Optional[SocialContextLandingUrl] = Field(default=None, alias="landingUrl")
|
|
34
|
+
text: Optional[StrictStr] = None
|
|
35
|
+
type: Optional[SocialContextUnionType] = None
|
|
36
|
+
__properties: ClassVar[List[str]] = ["contextType", "landingUrl", "text", "type"]
|
|
37
|
+
|
|
38
|
+
@field_validator('context_type')
|
|
39
|
+
def context_type_validate_enum(cls, value):
|
|
40
|
+
"""Validates the enum"""
|
|
41
|
+
if value is None:
|
|
42
|
+
return value
|
|
43
|
+
|
|
44
|
+
if value not in set(['Follow', 'Pin', 'Like', 'Location', 'Sparkle']):
|
|
45
|
+
raise ValueError("must be one of enum values ('Follow', 'Pin', 'Like', 'Location', 'Sparkle')")
|
|
46
|
+
return value
|
|
47
|
+
|
|
48
|
+
model_config = {
|
|
49
|
+
"populate_by_name": True,
|
|
50
|
+
"validate_assignment": True,
|
|
51
|
+
"protected_namespaces": (),
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def to_str(self) -> str:
|
|
56
|
+
"""Returns the string representation of the model using alias"""
|
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
58
|
+
|
|
59
|
+
def to_json(self) -> str:
|
|
60
|
+
"""Returns the JSON representation of the model using alias"""
|
|
61
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
62
|
+
return json.dumps(self.to_dict())
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
66
|
+
"""Create an instance of TimelineGeneralContext from a JSON string"""
|
|
67
|
+
return cls.from_dict(json.loads(json_str))
|
|
68
|
+
|
|
69
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
70
|
+
"""Return the dictionary representation of the model using alias.
|
|
71
|
+
|
|
72
|
+
This has the following differences from calling pydantic's
|
|
73
|
+
`self.model_dump(by_alias=True)`:
|
|
74
|
+
|
|
75
|
+
* `None` is only added to the output dict for nullable fields that
|
|
76
|
+
were set at model initialization. Other fields with value `None`
|
|
77
|
+
are ignored.
|
|
78
|
+
"""
|
|
79
|
+
excluded_fields: Set[str] = set([
|
|
80
|
+
])
|
|
81
|
+
|
|
82
|
+
_dict = self.model_dump(
|
|
83
|
+
by_alias=True,
|
|
84
|
+
exclude=excluded_fields,
|
|
85
|
+
exclude_none=True,
|
|
86
|
+
)
|
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of landing_url
|
|
88
|
+
if self.landing_url:
|
|
89
|
+
_dict['landingUrl'] = self.landing_url.to_dict()
|
|
90
|
+
return _dict
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
94
|
+
"""Create an instance of TimelineGeneralContext from a dict"""
|
|
95
|
+
if obj is None:
|
|
96
|
+
return None
|
|
97
|
+
|
|
98
|
+
if not isinstance(obj, dict):
|
|
99
|
+
return cls.model_validate(obj)
|
|
100
|
+
|
|
101
|
+
_obj = cls.model_validate({
|
|
102
|
+
"contextType": obj.get("contextType"),
|
|
103
|
+
"landingUrl": SocialContextLandingUrl.from_dict(obj["landingUrl"]) if obj.get("landingUrl") is not None else None,
|
|
104
|
+
"text": obj.get("text"),
|
|
105
|
+
"type": obj.get("type")
|
|
106
|
+
})
|
|
107
|
+
return _obj
|
|
108
|
+
|
|
109
|
+
|