twitter-openapi-python-generated 0.0.34__py3-none-any.whl → 0.0.35__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 +165 -1
- twitter_openapi_python_generated/api/post_api.py +2079 -203
- twitter_openapi_python_generated/api/tweet_api.py +3207 -231
- twitter_openapi_python_generated/api/user_api.py +969 -66
- twitter_openapi_python_generated/api/user_list_api.py +1907 -0
- twitter_openapi_python_generated/api_client.py +47 -9
- twitter_openapi_python_generated/configuration.py +55 -6
- twitter_openapi_python_generated/models/__init__.py +82 -0
- twitter_openapi_python_generated/models/additional_media_info.py +3 -1
- twitter_openapi_python_generated/models/article_cover_media.py +2 -5
- twitter_openapi_python_generated/models/article_cover_media_color_info.py +1 -2
- twitter_openapi_python_generated/models/article_result.py +3 -7
- twitter_openapi_python_generated/models/badge_counts.py +97 -0
- twitter_openapi_python_generated/models/birdwatch_entity_ref.py +3 -1
- twitter_openapi_python_generated/models/birdwatch_pivot_footer.py +1 -2
- twitter_openapi_python_generated/models/birdwatch_pivot_note.py +2 -5
- twitter_openapi_python_generated/models/birdwatch_pivot_subtitle.py +1 -2
- twitter_openapi_python_generated/models/bookmarks_response.py +1 -2
- twitter_openapi_python_generated/models/cashtag_attachment.py +89 -0
- twitter_openapi_python_generated/models/community.py +4 -9
- twitter_openapi_python_generated/models/community_about_timeline_response.py +1 -2
- twitter_openapi_python_generated/models/community_discovery_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/community_discovery_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/community_discovery_timeline_viewer.py +93 -0
- twitter_openapi_python_generated/models/community_join_action_result_union.py +3 -2
- twitter_openapi_python_generated/models/community_media_timeline_response.py +1 -2
- twitter_openapi_python_generated/models/community_relationship.py +2 -5
- twitter_openapi_python_generated/models/community_rule.py +2 -5
- twitter_openapi_python_generated/models/community_tweets_timeline_response.py +1 -2
- twitter_openapi_python_generated/models/community_union.py +3 -2
- twitter_openapi_python_generated/models/connect_tab_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/connect_tab_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/content_disclosure_ai_generated_disclosure.py +2 -2
- twitter_openapi_python_generated/models/content_item_type.py +3 -0
- twitter_openapi_python_generated/models/content_union.py +3 -2
- twitter_openapi_python_generated/models/cover_cta.py +1 -2
- twitter_openapi_python_generated/models/create_bookmark_response.py +1 -2
- twitter_openapi_python_generated/models/create_draft_tweet_response.py +102 -0
- twitter_openapi_python_generated/models/create_draft_tweet_response_data.py +93 -0
- twitter_openapi_python_generated/models/create_draft_tweet_response_tweet.py +97 -0
- twitter_openapi_python_generated/models/create_retweet_response.py +1 -2
- twitter_openapi_python_generated/models/create_tweet_response.py +1 -2
- twitter_openapi_python_generated/models/delete_bookmark_response.py +1 -2
- twitter_openapi_python_generated/models/delete_draft_tweets_response.py +102 -0
- twitter_openapi_python_generated/models/delete_draft_tweets_response_data.py +89 -0
- twitter_openapi_python_generated/models/delete_list_response.py +102 -0
- twitter_openapi_python_generated/models/delete_list_response_data.py +89 -0
- twitter_openapi_python_generated/models/delete_retweet.py +1 -2
- twitter_openapi_python_generated/models/delete_retweet_response.py +1 -2
- twitter_openapi_python_generated/models/delete_tweet_response.py +1 -2
- twitter_openapi_python_generated/models/draft_list.py +96 -0
- twitter_openapi_python_generated/models/draft_tweet.py +109 -0
- twitter_openapi_python_generated/models/draft_tweet_create_request.py +99 -0
- twitter_openapi_python_generated/models/draft_tweet_user.py +100 -0
- twitter_openapi_python_generated/models/draft_tweet_user_results.py +93 -0
- twitter_openapi_python_generated/models/draft_tweets_viewer.py +93 -0
- twitter_openapi_python_generated/models/entities.py +7 -9
- twitter_openapi_python_generated/models/error_extensions.py +1 -1
- twitter_openapi_python_generated/models/error_response.py +3 -5
- twitter_openapi_python_generated/models/explore_page.py +95 -0
- twitter_openapi_python_generated/models/explore_page_body.py +104 -0
- twitter_openapi_python_generated/models/explore_page_response.py +102 -0
- twitter_openapi_python_generated/models/explore_page_response_data.py +93 -0
- twitter_openapi_python_generated/models/explore_timeline.py +105 -0
- twitter_openapi_python_generated/models/explore_timeline_scribe_config.py +91 -0
- twitter_openapi_python_generated/models/extended_entities.py +1 -2
- twitter_openapi_python_generated/models/favorite_tweet_response.py +1 -2
- twitter_openapi_python_generated/models/fetch_draft_tweets_response.py +102 -0
- twitter_openapi_python_generated/models/fetch_draft_tweets_response_data.py +93 -0
- twitter_openapi_python_generated/models/fetch_scheduled_tweets_response.py +102 -0
- twitter_openapi_python_generated/models/fetch_scheduled_tweets_response_data.py +93 -0
- twitter_openapi_python_generated/models/follow_response.py +1 -2
- twitter_openapi_python_generated/models/generic_timeline_by_id_response.py +102 -0
- twitter_openapi_python_generated/models/generic_timeline_by_id_response_data.py +93 -0
- twitter_openapi_python_generated/models/grok_share_attachment.py +1 -2
- twitter_openapi_python_generated/models/grok_translated_bio.py +101 -0
- twitter_openapi_python_generated/models/grok_translated_bio_with_availability.py +97 -0
- twitter_openapi_python_generated/models/grok_translated_community_note.py +1 -2
- twitter_openapi_python_generated/models/highlight.py +1 -2
- twitter_openapi_python_generated/models/instruction_union.py +3 -2
- twitter_openapi_python_generated/models/item_content_union.py +68 -10
- twitter_openapi_python_generated/models/list_banner_media.py +93 -0
- twitter_openapi_python_generated/models/list_banner_media_info.py +99 -0
- twitter_openapi_python_generated/models/list_banner_media_salient_rect.py +95 -0
- twitter_openapi_python_generated/models/list_latest_tweets_timeline_response.py +1 -2
- twitter_openapi_python_generated/models/list_members_list.py +93 -0
- twitter_openapi_python_generated/models/list_members_response.py +102 -0
- twitter_openapi_python_generated/models/list_members_response_data.py +93 -0
- twitter_openapi_python_generated/models/list_recommended_users_list.py +93 -0
- twitter_openapi_python_generated/models/list_recommended_users_response.py +102 -0
- twitter_openapi_python_generated/models/list_recommended_users_response_data.py +93 -0
- twitter_openapi_python_generated/models/list_response.py +102 -0
- twitter_openapi_python_generated/models/list_response_data.py +93 -0
- twitter_openapi_python_generated/models/list_subscribers_list.py +93 -0
- twitter_openapi_python_generated/models/list_subscribers_response.py +102 -0
- twitter_openapi_python_generated/models/list_subscribers_response_data.py +93 -0
- twitter_openapi_python_generated/models/media.py +16 -17
- twitter_openapi_python_generated/models/media_extended.py +13 -16
- twitter_openapi_python_generated/models/media_original_info.py +1 -2
- twitter_openapi_python_generated/models/media_video_info.py +1 -2
- twitter_openapi_python_generated/models/module_item.py +2 -5
- twitter_openapi_python_generated/models/note_tweet_result_data.py +2 -5
- twitter_openapi_python_generated/models/note_tweet_result_media.py +1 -2
- twitter_openapi_python_generated/models/note_tweet_result_media_inline_media.py +2 -5
- twitter_openapi_python_generated/models/note_tweet_result_rich_text.py +1 -2
- twitter_openapi_python_generated/models/notifications_result.py +2 -5
- twitter_openapi_python_generated/models/notifications_timeline_response.py +1 -2
- twitter_openapi_python_generated/models/post_create_bookmark_request.py +1 -1
- twitter_openapi_python_generated/models/post_create_bookmark_request_variables.py +2 -2
- twitter_openapi_python_generated/models/post_create_draft_tweet_request.py +95 -0
- twitter_openapi_python_generated/models/post_create_draft_tweet_request_variables.py +93 -0
- twitter_openapi_python_generated/models/post_create_draft_tweet_request_variables_post_tweet_request.py +97 -0
- twitter_openapi_python_generated/models/post_create_list_request.py +101 -0
- twitter_openapi_python_generated/models/post_create_list_request_features.py +97 -0
- twitter_openapi_python_generated/models/post_create_list_request_variables.py +93 -0
- twitter_openapi_python_generated/models/post_create_retweet_request.py +1 -1
- twitter_openapi_python_generated/models/post_create_retweet_request_variables.py +3 -3
- twitter_openapi_python_generated/models/post_create_tweet_request.py +2 -2
- twitter_openapi_python_generated/models/post_create_tweet_request_features.py +43 -41
- twitter_openapi_python_generated/models/post_create_tweet_request_variables.py +4 -4
- twitter_openapi_python_generated/models/post_create_tweet_request_variables_conversation_control.py +2 -2
- twitter_openapi_python_generated/models/post_create_tweet_request_variables_media.py +3 -4
- twitter_openapi_python_generated/models/post_create_tweet_request_variables_media_media_entities_inner.py +2 -2
- twitter_openapi_python_generated/models/post_create_tweet_request_variables_reply.py +2 -2
- twitter_openapi_python_generated/models/post_cta_title_text.py +1 -2
- twitter_openapi_python_generated/models/post_delete_bookmark_request.py +1 -1
- twitter_openapi_python_generated/models/post_delete_draft_tweets_request.py +95 -0
- twitter_openapi_python_generated/models/post_delete_draft_tweets_request_variables.py +89 -0
- twitter_openapi_python_generated/models/post_delete_list_request.py +95 -0
- twitter_openapi_python_generated/models/post_delete_list_request_variables.py +89 -0
- twitter_openapi_python_generated/models/post_delete_retweet_request.py +1 -1
- twitter_openapi_python_generated/models/post_delete_retweet_request_variables.py +3 -3
- twitter_openapi_python_generated/models/post_delete_tweet_request.py +2 -2
- twitter_openapi_python_generated/models/post_favorite_tweet_request.py +1 -1
- twitter_openapi_python_generated/models/post_list_add_member_request.py +101 -0
- twitter_openapi_python_generated/models/post_list_add_member_request_variables.py +91 -0
- twitter_openapi_python_generated/models/post_list_remove_member_request.py +101 -0
- twitter_openapi_python_generated/models/post_unfavorite_tweet_request.py +1 -1
- twitter_openapi_python_generated/models/primary_community_topic.py +2 -5
- twitter_openapi_python_generated/models/profile_bio.py +11 -3
- twitter_openapi_python_generated/models/profile_bio_entities.py +98 -0
- twitter_openapi_python_generated/models/profile_bio_entities_urls.py +96 -0
- twitter_openapi_python_generated/models/profile_response.py +1 -2
- twitter_openapi_python_generated/models/retweet.py +4 -7
- twitter_openapi_python_generated/models/scheduled_tweets_viewer.py +89 -0
- twitter_openapi_python_generated/models/search_timeline_response.py +1 -2
- twitter_openapi_python_generated/models/self_thread.py +2 -5
- twitter_openapi_python_generated/models/session.py +8 -20
- twitter_openapi_python_generated/models/social_context_union.py +3 -2
- twitter_openapi_python_generated/models/text.py +1 -2
- twitter_openapi_python_generated/models/timeline.py +1 -2
- twitter_openapi_python_generated/models/timeline_add_entries.py +1 -2
- twitter_openapi_python_generated/models/timeline_add_entry.py +4 -10
- twitter_openapi_python_generated/models/timeline_add_to_module.py +1 -2
- twitter_openapi_python_generated/models/timeline_frame.py +97 -0
- twitter_openapi_python_generated/models/timeline_half_cover.py +1 -2
- twitter_openapi_python_generated/models/timeline_label.py +101 -0
- twitter_openapi_python_generated/models/timeline_mark_entries_unread_greater_than_sort_index.py +2 -5
- twitter_openapi_python_generated/models/timeline_response.py +1 -2
- twitter_openapi_python_generated/models/timeline_show_alert.py +7 -3
- twitter_openapi_python_generated/models/timeline_timeline_module.py +1 -2
- twitter_openapi_python_generated/models/timeline_trend.py +16 -4
- twitter_openapi_python_generated/models/timeline_twitter_list.py +101 -0
- twitter_openapi_python_generated/models/tombstone_rich_text.py +1 -2
- twitter_openapi_python_generated/models/tracing.py +2 -5
- twitter_openapi_python_generated/models/trend_metadata.py +4 -2
- twitter_openapi_python_generated/models/trend_results.py +2 -5
- twitter_openapi_python_generated/models/tweet.py +17 -6
- twitter_openapi_python_generated/models/tweet_card_legacy.py +2 -4
- twitter_openapi_python_generated/models/tweet_card_platform_device.py +2 -5
- twitter_openapi_python_generated/models/tweet_detail_response.py +1 -2
- twitter_openapi_python_generated/models/tweet_edit_control.py +6 -15
- twitter_openapi_python_generated/models/tweet_edit_control_initial.py +4 -10
- twitter_openapi_python_generated/models/tweet_favoriters_response.py +1 -2
- twitter_openapi_python_generated/models/tweet_interstitial_reveal_text.py +1 -2
- twitter_openapi_python_generated/models/tweet_interstitial_text.py +1 -2
- twitter_openapi_python_generated/models/tweet_legacy.py +15 -36
- twitter_openapi_python_generated/models/tweet_limited_action_results.py +1 -2
- twitter_openapi_python_generated/models/tweet_preview_display_tweet.py +5 -11
- twitter_openapi_python_generated/models/tweet_preview_display_tweet_view_count.py +2 -5
- twitter_openapi_python_generated/models/tweet_result_by_rest_id_response.py +1 -2
- twitter_openapi_python_generated/models/tweet_retweeters_response.py +1 -2
- twitter_openapi_python_generated/models/tweet_union.py +3 -2
- twitter_openapi_python_generated/models/tweet_view.py +2 -5
- twitter_openapi_python_generated/models/twitter_list.py +146 -0
- twitter_openapi_python_generated/models/type_name.py +4 -0
- twitter_openapi_python_generated/models/unfavorite_tweet_response.py +1 -2
- twitter_openapi_python_generated/models/urt_endpoint_options.py +3 -4
- twitter_openapi_python_generated/models/user.py +75 -13
- twitter_openapi_python_generated/models/user_action_counts.py +89 -0
- twitter_openapi_python_generated/models/user_banner.py +89 -0
- twitter_openapi_python_generated/models/user_core.py +3 -6
- twitter_openapi_python_generated/models/user_highlights_tweets_response.py +1 -2
- twitter_openapi_python_generated/models/user_legacy.py +3 -6
- twitter_openapi_python_generated/models/user_notifications_settings.py +89 -0
- twitter_openapi_python_generated/models/user_pinned_items.py +90 -0
- twitter_openapi_python_generated/models/user_professional.py +3 -7
- twitter_openapi_python_generated/models/user_profile_metadata.py +89 -0
- twitter_openapi_python_generated/models/user_profile_translation.py +89 -0
- twitter_openapi_python_generated/models/user_relationship_counts.py +91 -0
- twitter_openapi_python_generated/models/user_relationship_perspectives.py +6 -2
- twitter_openapi_python_generated/models/user_response.py +1 -2
- twitter_openapi_python_generated/models/user_result_by_screen_name.py +2 -5
- twitter_openapi_python_generated/models/user_result_by_screen_name_result.py +8 -12
- twitter_openapi_python_generated/models/user_result_core.py +3 -1
- twitter_openapi_python_generated/models/user_results.py +3 -1
- twitter_openapi_python_generated/models/user_tweet_counts.py +91 -0
- twitter_openapi_python_generated/models/user_tweets_response.py +1 -2
- twitter_openapi_python_generated/models/user_union.py +6 -3
- twitter_openapi_python_generated/models/user_value.py +8 -9
- twitter_openapi_python_generated/models/user_verification_info_reason.py +2 -5
- twitter_openapi_python_generated/models/user_verification_info_reason_description.py +1 -2
- twitter_openapi_python_generated/models/user_website.py +89 -0
- twitter_openapi_python_generated/models/users_response.py +1 -2
- twitter_openapi_python_generated/models/users_response_data.py +1 -2
- twitter_openapi_python_generated/models/viewer_badge_counts_response.py +102 -0
- twitter_openapi_python_generated/models/viewer_badge_counts_response_data.py +93 -0
- twitter_openapi_python_generated/models/viewer_badge_counts_result.py +96 -0
- twitter_openapi_python_generated/models/viewer_badge_counts_user_results.py +93 -0
- twitter_openapi_python_generated/models/viewer_badge_counts_viewer.py +93 -0
- twitter_openapi_python_generated/rest.py +79 -8
- {twitter_openapi_python_generated-0.0.34.dist-info → twitter_openapi_python_generated-0.0.35.dist-info}/METADATA +926 -816
- {twitter_openapi_python_generated-0.0.34.dist-info → twitter_openapi_python_generated-0.0.35.dist-info}/RECORD +227 -145
- {twitter_openapi_python_generated-0.0.34.dist-info → twitter_openapi_python_generated-0.0.35.dist-info}/WHEEL +1 -1
- {twitter_openapi_python_generated-0.0.34.dist-info → twitter_openapi_python_generated-0.0.35.dist-info}/licenses/LICENSE +31 -31
- {twitter_openapi_python_generated-0.0.34.dist-info → twitter_openapi_python_generated-0.0.35.dist-info}/licenses/LICENSE.AGPL +660 -660
- {twitter_openapi_python_generated-0.0.34.dist-info → twitter_openapi_python_generated-0.0.35.dist-info}/top_level.txt +0 -0
|
@@ -19,6 +19,8 @@ import pprint
|
|
|
19
19
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
20
20
|
from typing import Any, List, Optional
|
|
21
21
|
from twitter_openapi_python_generated.models.timeline_community import TimelineCommunity
|
|
22
|
+
from twitter_openapi_python_generated.models.timeline_frame import TimelineFrame
|
|
23
|
+
from twitter_openapi_python_generated.models.timeline_label import TimelineLabel
|
|
22
24
|
from twitter_openapi_python_generated.models.timeline_message_prompt import TimelineMessagePrompt
|
|
23
25
|
from twitter_openapi_python_generated.models.timeline_notification import TimelineNotification
|
|
24
26
|
from twitter_openapi_python_generated.models.timeline_prompt import TimelinePrompt
|
|
@@ -26,12 +28,13 @@ from twitter_openapi_python_generated.models.timeline_timeline_cursor import Tim
|
|
|
26
28
|
from twitter_openapi_python_generated.models.timeline_tombstone import TimelineTombstone
|
|
27
29
|
from twitter_openapi_python_generated.models.timeline_trend import TimelineTrend
|
|
28
30
|
from twitter_openapi_python_generated.models.timeline_tweet import TimelineTweet
|
|
31
|
+
from twitter_openapi_python_generated.models.timeline_twitter_list import TimelineTwitterList
|
|
29
32
|
from twitter_openapi_python_generated.models.timeline_user import TimelineUser
|
|
30
33
|
from pydantic import StrictStr, Field
|
|
31
34
|
from typing import Union, List, Set, Optional, Dict
|
|
32
35
|
from typing_extensions import Literal, Self
|
|
33
36
|
|
|
34
|
-
ITEMCONTENTUNION_ONE_OF_SCHEMAS = ["TimelineCommunity", "TimelineMessagePrompt", "TimelineNotification", "TimelinePrompt", "TimelineTimelineCursor", "TimelineTombstone", "TimelineTrend", "TimelineTweet", "TimelineUser"]
|
|
37
|
+
ITEMCONTENTUNION_ONE_OF_SCHEMAS = ["TimelineCommunity", "TimelineFrame", "TimelineLabel", "TimelineMessagePrompt", "TimelineNotification", "TimelinePrompt", "TimelineTimelineCursor", "TimelineTombstone", "TimelineTrend", "TimelineTweet", "TimelineTwitterList", "TimelineUser"]
|
|
35
38
|
|
|
36
39
|
class ItemContentUnion(BaseModel):
|
|
37
40
|
"""
|
|
@@ -55,8 +58,14 @@ class ItemContentUnion(BaseModel):
|
|
|
55
58
|
oneof_schema_8_validator: Optional[TimelineTrend] = None
|
|
56
59
|
# data type: TimelineNotification
|
|
57
60
|
oneof_schema_9_validator: Optional[TimelineNotification] = None
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
# data type: TimelineFrame
|
|
62
|
+
oneof_schema_10_validator: Optional[TimelineFrame] = None
|
|
63
|
+
# data type: TimelineTwitterList
|
|
64
|
+
oneof_schema_11_validator: Optional[TimelineTwitterList] = None
|
|
65
|
+
# data type: TimelineLabel
|
|
66
|
+
oneof_schema_12_validator: Optional[TimelineLabel] = None
|
|
67
|
+
actual_instance: Optional[Union[TimelineCommunity, TimelineFrame, TimelineLabel, TimelineMessagePrompt, TimelineNotification, TimelinePrompt, TimelineTimelineCursor, TimelineTombstone, TimelineTrend, TimelineTweet, TimelineTwitterList, TimelineUser]] = None
|
|
68
|
+
one_of_schemas: Set[str] = { "TimelineCommunity", "TimelineFrame", "TimelineLabel", "TimelineMessagePrompt", "TimelineNotification", "TimelinePrompt", "TimelineTimelineCursor", "TimelineTombstone", "TimelineTrend", "TimelineTweet", "TimelineTwitterList", "TimelineUser" }
|
|
60
69
|
|
|
61
70
|
model_config = ConfigDict(
|
|
62
71
|
validate_assignment=True,
|
|
@@ -127,12 +136,27 @@ class ItemContentUnion(BaseModel):
|
|
|
127
136
|
error_messages.append(f"Error! Input type `{type(v)}` is not `TimelineNotification`")
|
|
128
137
|
else:
|
|
129
138
|
match += 1
|
|
139
|
+
# validate data type: TimelineFrame
|
|
140
|
+
if not isinstance(v, TimelineFrame):
|
|
141
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TimelineFrame`")
|
|
142
|
+
else:
|
|
143
|
+
match += 1
|
|
144
|
+
# validate data type: TimelineTwitterList
|
|
145
|
+
if not isinstance(v, TimelineTwitterList):
|
|
146
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TimelineTwitterList`")
|
|
147
|
+
else:
|
|
148
|
+
match += 1
|
|
149
|
+
# validate data type: TimelineLabel
|
|
150
|
+
if not isinstance(v, TimelineLabel):
|
|
151
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TimelineLabel`")
|
|
152
|
+
else:
|
|
153
|
+
match += 1
|
|
130
154
|
if match > 1:
|
|
131
155
|
# more than 1 match
|
|
132
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in ItemContentUnion with oneOf schemas: TimelineCommunity, TimelineMessagePrompt, TimelineNotification, TimelinePrompt, TimelineTimelineCursor, TimelineTombstone, TimelineTrend, TimelineTweet, TimelineUser. Details: " + ", ".join(error_messages))
|
|
156
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in ItemContentUnion with oneOf schemas: TimelineCommunity, TimelineFrame, TimelineLabel, TimelineMessagePrompt, TimelineNotification, TimelinePrompt, TimelineTimelineCursor, TimelineTombstone, TimelineTrend, TimelineTweet, TimelineTwitterList, TimelineUser. Details: " + ", ".join(error_messages))
|
|
133
157
|
elif match == 0:
|
|
134
158
|
# no match
|
|
135
|
-
raise ValueError("No match found when setting `actual_instance` in ItemContentUnion with oneOf schemas: TimelineCommunity, TimelineMessagePrompt, TimelineNotification, TimelinePrompt, TimelineTimelineCursor, TimelineTombstone, TimelineTrend, TimelineTweet, TimelineUser. Details: " + ", ".join(error_messages))
|
|
159
|
+
raise ValueError("No match found when setting `actual_instance` in ItemContentUnion with oneOf schemas: TimelineCommunity, TimelineFrame, TimelineLabel, TimelineMessagePrompt, TimelineNotification, TimelinePrompt, TimelineTimelineCursor, TimelineTombstone, TimelineTrend, TimelineTweet, TimelineTwitterList, TimelineUser. Details: " + ", ".join(error_messages))
|
|
136
160
|
else:
|
|
137
161
|
return v
|
|
138
162
|
|
|
@@ -148,15 +172,26 @@ class ItemContentUnion(BaseModel):
|
|
|
148
172
|
match = 0
|
|
149
173
|
|
|
150
174
|
# use oneOf discriminator to lookup the data type
|
|
151
|
-
|
|
175
|
+
_discriminator_property = "__typename"
|
|
176
|
+
_data_type = json.loads(json_str).get(_discriminator_property)
|
|
152
177
|
if not _data_type:
|
|
153
|
-
raise ValueError("Failed to lookup data type from the field `
|
|
178
|
+
raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.")
|
|
154
179
|
|
|
155
180
|
# check if data type is `TimelineCommunity`
|
|
156
181
|
if _data_type == "TimelineCommunity":
|
|
157
182
|
instance.actual_instance = TimelineCommunity.from_json(json_str)
|
|
158
183
|
return instance
|
|
159
184
|
|
|
185
|
+
# check if data type is `TimelineFrame`
|
|
186
|
+
if _data_type == "TimelineFrame":
|
|
187
|
+
instance.actual_instance = TimelineFrame.from_json(json_str)
|
|
188
|
+
return instance
|
|
189
|
+
|
|
190
|
+
# check if data type is `TimelineLabel`
|
|
191
|
+
if _data_type == "TimelineLabel":
|
|
192
|
+
instance.actual_instance = TimelineLabel.from_json(json_str)
|
|
193
|
+
return instance
|
|
194
|
+
|
|
160
195
|
# check if data type is `TimelineMessagePrompt`
|
|
161
196
|
if _data_type == "TimelineMessagePrompt":
|
|
162
197
|
instance.actual_instance = TimelineMessagePrompt.from_json(json_str)
|
|
@@ -192,6 +227,11 @@ class ItemContentUnion(BaseModel):
|
|
|
192
227
|
instance.actual_instance = TimelineTweet.from_json(json_str)
|
|
193
228
|
return instance
|
|
194
229
|
|
|
230
|
+
# check if data type is `TimelineTwitterList`
|
|
231
|
+
if _data_type == "TimelineTwitterList":
|
|
232
|
+
instance.actual_instance = TimelineTwitterList.from_json(json_str)
|
|
233
|
+
return instance
|
|
234
|
+
|
|
195
235
|
# check if data type is `TimelineUser`
|
|
196
236
|
if _data_type == "TimelineUser":
|
|
197
237
|
instance.actual_instance = TimelineUser.from_json(json_str)
|
|
@@ -251,13 +291,31 @@ class ItemContentUnion(BaseModel):
|
|
|
251
291
|
match += 1
|
|
252
292
|
except (ValidationError, ValueError) as e:
|
|
253
293
|
error_messages.append(str(e))
|
|
294
|
+
# deserialize data into TimelineFrame
|
|
295
|
+
try:
|
|
296
|
+
instance.actual_instance = TimelineFrame.from_json(json_str)
|
|
297
|
+
match += 1
|
|
298
|
+
except (ValidationError, ValueError) as e:
|
|
299
|
+
error_messages.append(str(e))
|
|
300
|
+
# deserialize data into TimelineTwitterList
|
|
301
|
+
try:
|
|
302
|
+
instance.actual_instance = TimelineTwitterList.from_json(json_str)
|
|
303
|
+
match += 1
|
|
304
|
+
except (ValidationError, ValueError) as e:
|
|
305
|
+
error_messages.append(str(e))
|
|
306
|
+
# deserialize data into TimelineLabel
|
|
307
|
+
try:
|
|
308
|
+
instance.actual_instance = TimelineLabel.from_json(json_str)
|
|
309
|
+
match += 1
|
|
310
|
+
except (ValidationError, ValueError) as e:
|
|
311
|
+
error_messages.append(str(e))
|
|
254
312
|
|
|
255
313
|
if match > 1:
|
|
256
314
|
# more than 1 match
|
|
257
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into ItemContentUnion with oneOf schemas: TimelineCommunity, TimelineMessagePrompt, TimelineNotification, TimelinePrompt, TimelineTimelineCursor, TimelineTombstone, TimelineTrend, TimelineTweet, TimelineUser. Details: " + ", ".join(error_messages))
|
|
315
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into ItemContentUnion with oneOf schemas: TimelineCommunity, TimelineFrame, TimelineLabel, TimelineMessagePrompt, TimelineNotification, TimelinePrompt, TimelineTimelineCursor, TimelineTombstone, TimelineTrend, TimelineTweet, TimelineTwitterList, TimelineUser. Details: " + ", ".join(error_messages))
|
|
258
316
|
elif match == 0:
|
|
259
317
|
# no match
|
|
260
|
-
raise ValueError("No match found when deserializing the JSON string into ItemContentUnion with oneOf schemas: TimelineCommunity, TimelineMessagePrompt, TimelineNotification, TimelinePrompt, TimelineTimelineCursor, TimelineTombstone, TimelineTrend, TimelineTweet, TimelineUser. Details: " + ", ".join(error_messages))
|
|
318
|
+
raise ValueError("No match found when deserializing the JSON string into ItemContentUnion with oneOf schemas: TimelineCommunity, TimelineFrame, TimelineLabel, TimelineMessagePrompt, TimelineNotification, TimelinePrompt, TimelineTimelineCursor, TimelineTombstone, TimelineTrend, TimelineTweet, TimelineTwitterList, TimelineUser. Details: " + ", ".join(error_messages))
|
|
261
319
|
else:
|
|
262
320
|
return instance
|
|
263
321
|
|
|
@@ -271,7 +329,7 @@ class ItemContentUnion(BaseModel):
|
|
|
271
329
|
else:
|
|
272
330
|
return json.dumps(self.actual_instance)
|
|
273
331
|
|
|
274
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], TimelineCommunity, TimelineMessagePrompt, TimelineNotification, TimelinePrompt, TimelineTimelineCursor, TimelineTombstone, TimelineTrend, TimelineTweet, TimelineUser]]:
|
|
332
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], TimelineCommunity, TimelineFrame, TimelineLabel, TimelineMessagePrompt, TimelineNotification, TimelinePrompt, TimelineTimelineCursor, TimelineTombstone, TimelineTrend, TimelineTweet, TimelineTwitterList, TimelineUser]]:
|
|
275
333
|
"""Returns the dict representation of the actual instance"""
|
|
276
334
|
if self.actual_instance is None:
|
|
277
335
|
return None
|
|
@@ -0,0 +1,93 @@
|
|
|
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, ConfigDict
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.list_banner_media_info import ListBannerMediaInfo
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class ListBannerMedia(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
ListBannerMedia
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
media_info: ListBannerMediaInfo
|
|
33
|
+
__properties: ClassVar[List[str]] = ["media_info"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
validate_by_name=True,
|
|
37
|
+
validate_by_alias=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of ListBannerMedia from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of media_info
|
|
75
|
+
if self.media_info:
|
|
76
|
+
_dict['media_info'] = self.media_info.to_dict()
|
|
77
|
+
return _dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of ListBannerMedia from a dict"""
|
|
82
|
+
if obj is None:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
if not isinstance(obj, dict):
|
|
86
|
+
return cls.model_validate(obj)
|
|
87
|
+
|
|
88
|
+
_obj = cls.model_validate({
|
|
89
|
+
"media_info": ListBannerMediaInfo.from_dict(obj["media_info"]) if obj.get("media_info") is not None else None
|
|
90
|
+
})
|
|
91
|
+
return _obj
|
|
92
|
+
|
|
93
|
+
|
|
@@ -0,0 +1,99 @@
|
|
|
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, ConfigDict, StrictInt, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.list_banner_media_salient_rect import ListBannerMediaSalientRect
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class ListBannerMediaInfo(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
ListBannerMediaInfo
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
original_img_height: StrictInt
|
|
33
|
+
original_img_url: StrictStr
|
|
34
|
+
original_img_width: StrictInt
|
|
35
|
+
salient_rect: ListBannerMediaSalientRect
|
|
36
|
+
__properties: ClassVar[List[str]] = ["original_img_height", "original_img_url", "original_img_width", "salient_rect"]
|
|
37
|
+
|
|
38
|
+
model_config = ConfigDict(
|
|
39
|
+
validate_by_name=True,
|
|
40
|
+
validate_by_alias=True,
|
|
41
|
+
validate_assignment=True,
|
|
42
|
+
protected_namespaces=(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def to_str(self) -> str:
|
|
47
|
+
"""Returns the string representation of the model using alias"""
|
|
48
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
49
|
+
|
|
50
|
+
def to_json(self) -> str:
|
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
|
52
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
56
|
+
"""Create an instance of ListBannerMediaInfo from a JSON string"""
|
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
|
58
|
+
|
|
59
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
60
|
+
"""Return the dictionary representation of the model using alias.
|
|
61
|
+
|
|
62
|
+
This has the following differences from calling pydantic's
|
|
63
|
+
`self.model_dump(by_alias=True)`:
|
|
64
|
+
|
|
65
|
+
* `None` is only added to the output dict for nullable fields that
|
|
66
|
+
were set at model initialization. Other fields with value `None`
|
|
67
|
+
are ignored.
|
|
68
|
+
"""
|
|
69
|
+
excluded_fields: Set[str] = set([
|
|
70
|
+
])
|
|
71
|
+
|
|
72
|
+
_dict = self.model_dump(
|
|
73
|
+
by_alias=True,
|
|
74
|
+
exclude=excluded_fields,
|
|
75
|
+
exclude_none=True,
|
|
76
|
+
)
|
|
77
|
+
# override the default output from pydantic by calling `to_dict()` of salient_rect
|
|
78
|
+
if self.salient_rect:
|
|
79
|
+
_dict['salient_rect'] = self.salient_rect.to_dict()
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of ListBannerMediaInfo from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate({
|
|
92
|
+
"original_img_height": obj.get("original_img_height"),
|
|
93
|
+
"original_img_url": obj.get("original_img_url"),
|
|
94
|
+
"original_img_width": obj.get("original_img_width"),
|
|
95
|
+
"salient_rect": ListBannerMediaSalientRect.from_dict(obj["salient_rect"]) if obj.get("salient_rect") is not None else None
|
|
96
|
+
})
|
|
97
|
+
return _obj
|
|
98
|
+
|
|
99
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
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, ConfigDict, StrictInt
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
|
|
27
|
+
class ListBannerMediaSalientRect(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
ListBannerMediaSalientRect
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
height: StrictInt
|
|
32
|
+
left: StrictInt
|
|
33
|
+
top: StrictInt
|
|
34
|
+
width: StrictInt
|
|
35
|
+
__properties: ClassVar[List[str]] = ["height", "left", "top", "width"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
validate_by_name=True,
|
|
39
|
+
validate_by_alias=True,
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def to_str(self) -> str:
|
|
46
|
+
"""Returns the string representation of the model using alias"""
|
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> str:
|
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
|
51
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
+
"""Create an instance of ListBannerMediaSalientRect from a JSON string"""
|
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
|
57
|
+
|
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
|
60
|
+
|
|
61
|
+
This has the following differences from calling pydantic's
|
|
62
|
+
`self.model_dump(by_alias=True)`:
|
|
63
|
+
|
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
|
65
|
+
were set at model initialization. Other fields with value `None`
|
|
66
|
+
are ignored.
|
|
67
|
+
"""
|
|
68
|
+
excluded_fields: Set[str] = set([
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
_dict = self.model_dump(
|
|
72
|
+
by_alias=True,
|
|
73
|
+
exclude=excluded_fields,
|
|
74
|
+
exclude_none=True,
|
|
75
|
+
)
|
|
76
|
+
return _dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
+
"""Create an instance of ListBannerMediaSalientRect from a dict"""
|
|
81
|
+
if obj is None:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
if not isinstance(obj, dict):
|
|
85
|
+
return cls.model_validate(obj)
|
|
86
|
+
|
|
87
|
+
_obj = cls.model_validate({
|
|
88
|
+
"height": obj.get("height"),
|
|
89
|
+
"left": obj.get("left"),
|
|
90
|
+
"top": obj.get("top"),
|
|
91
|
+
"width": obj.get("width")
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -80,8 +80,7 @@ class ListLatestTweetsTimelineResponse(BaseModel):
|
|
|
80
80
|
_items = []
|
|
81
81
|
if self.errors:
|
|
82
82
|
for _item_errors in self.errors:
|
|
83
|
-
if _item_errors
|
|
84
|
-
_items.append(_item_errors.to_dict())
|
|
83
|
+
_items.append(_item_errors.to_dict() if _item_errors is not None else None)
|
|
85
84
|
_dict['errors'] = _items
|
|
86
85
|
return _dict
|
|
87
86
|
|
|
@@ -0,0 +1,93 @@
|
|
|
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, ConfigDict
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.timeline_result import TimelineResult
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class ListMembersList(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
ListMembersList
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
members_timeline: TimelineResult
|
|
33
|
+
__properties: ClassVar[List[str]] = ["members_timeline"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
validate_by_name=True,
|
|
37
|
+
validate_by_alias=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of ListMembersList from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of members_timeline
|
|
75
|
+
if self.members_timeline:
|
|
76
|
+
_dict['members_timeline'] = self.members_timeline.to_dict()
|
|
77
|
+
return _dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of ListMembersList from a dict"""
|
|
82
|
+
if obj is None:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
if not isinstance(obj, dict):
|
|
86
|
+
return cls.model_validate(obj)
|
|
87
|
+
|
|
88
|
+
_obj = cls.model_validate({
|
|
89
|
+
"members_timeline": TimelineResult.from_dict(obj["members_timeline"]) if obj.get("members_timeline") is not None else None
|
|
90
|
+
})
|
|
91
|
+
return _obj
|
|
92
|
+
|
|
93
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
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, ConfigDict
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from twitter_openapi_python_generated.models.error_response import ErrorResponse
|
|
24
|
+
from twitter_openapi_python_generated.models.list_members_response_data import ListMembersResponseData
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
from pydantic_core import to_jsonable_python
|
|
28
|
+
|
|
29
|
+
class ListMembersResponse(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
ListMembersResponse
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
data: ListMembersResponseData
|
|
34
|
+
errors: Optional[List[ErrorResponse]] = None
|
|
35
|
+
__properties: ClassVar[List[str]] = ["data", "errors"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
validate_by_name=True,
|
|
39
|
+
validate_by_alias=True,
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def to_str(self) -> str:
|
|
46
|
+
"""Returns the string representation of the model using alias"""
|
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> str:
|
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
|
51
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
+
"""Create an instance of ListMembersResponse from a JSON string"""
|
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
|
57
|
+
|
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
|
60
|
+
|
|
61
|
+
This has the following differences from calling pydantic's
|
|
62
|
+
`self.model_dump(by_alias=True)`:
|
|
63
|
+
|
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
|
65
|
+
were set at model initialization. Other fields with value `None`
|
|
66
|
+
are ignored.
|
|
67
|
+
"""
|
|
68
|
+
excluded_fields: Set[str] = set([
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
_dict = self.model_dump(
|
|
72
|
+
by_alias=True,
|
|
73
|
+
exclude=excluded_fields,
|
|
74
|
+
exclude_none=True,
|
|
75
|
+
)
|
|
76
|
+
# override the default output from pydantic by calling `to_dict()` of data
|
|
77
|
+
if self.data:
|
|
78
|
+
_dict['data'] = self.data.to_dict()
|
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of each item in errors (list)
|
|
80
|
+
_items = []
|
|
81
|
+
if self.errors:
|
|
82
|
+
for _item_errors in self.errors:
|
|
83
|
+
_items.append(_item_errors.to_dict() if _item_errors is not None else None)
|
|
84
|
+
_dict['errors'] = _items
|
|
85
|
+
return _dict
|
|
86
|
+
|
|
87
|
+
@classmethod
|
|
88
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
89
|
+
"""Create an instance of ListMembersResponse from a dict"""
|
|
90
|
+
if obj is None:
|
|
91
|
+
return None
|
|
92
|
+
|
|
93
|
+
if not isinstance(obj, dict):
|
|
94
|
+
return cls.model_validate(obj)
|
|
95
|
+
|
|
96
|
+
_obj = cls.model_validate({
|
|
97
|
+
"data": ListMembersResponseData.from_dict(obj["data"]) if obj.get("data") is not None else None,
|
|
98
|
+
"errors": [ErrorResponse.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None
|
|
99
|
+
})
|
|
100
|
+
return _obj
|
|
101
|
+
|
|
102
|
+
|