twitter-openapi-python-generated 0.1.1__py3-none-any.whl → 0.1.3__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 +323 -1
- twitter_openapi_python_generated/api/__init__.py +2 -0
- twitter_openapi_python_generated/api/birdwatch_api.py +1609 -0
- twitter_openapi_python_generated/api/community_api.py +1910 -0
- twitter_openapi_python_generated/api/default_api.py +2831 -71
- twitter_openapi_python_generated/api/tweet_api.py +778 -142
- twitter_openapi_python_generated/api/user_api.py +301 -0
- twitter_openapi_python_generated/api/user_list_api.py +1145 -192
- twitter_openapi_python_generated/api/users_api.py +655 -19
- twitter_openapi_python_generated/api_client.py +1 -1
- twitter_openapi_python_generated/configuration.py +1 -1
- twitter_openapi_python_generated/models/__init__.py +159 -0
- twitter_openapi_python_generated/models/about_account_data.py +93 -0
- twitter_openapi_python_generated/models/about_account_response.py +102 -0
- twitter_openapi_python_generated/models/about_account_user.py +161 -0
- twitter_openapi_python_generated/models/about_account_user_result.py +95 -0
- twitter_openapi_python_generated/models/about_account_verification_info.py +95 -0
- twitter_openapi_python_generated/models/about_account_verification_info_reason.py +99 -0
- twitter_openapi_python_generated/models/about_profile.py +103 -0
- twitter_openapi_python_generated/models/about_profile_username_changes.py +109 -0
- twitter_openapi_python_generated/models/ad_metadata_container.py +5 -3
- twitter_openapi_python_generated/models/ai_trend.py +126 -0
- twitter_openapi_python_generated/models/ai_trend_core.py +95 -0
- twitter_openapi_python_generated/models/ai_trend_results.py +95 -0
- twitter_openapi_python_generated/models/ai_trend_social_proof.py +89 -0
- twitter_openapi_python_generated/models/article_content_block.py +117 -0
- twitter_openapi_python_generated/models/article_content_block_data.py +104 -0
- twitter_openapi_python_generated/models/article_content_entity.py +95 -0
- twitter_openapi_python_generated/models/article_content_entity_data.py +115 -0
- twitter_openapi_python_generated/models/article_content_entity_range.py +93 -0
- twitter_openapi_python_generated/models/article_content_entity_value.py +104 -0
- twitter_openapi_python_generated/models/article_content_inline_style_range.py +100 -0
- twitter_openapi_python_generated/models/article_content_media_item.py +101 -0
- twitter_openapi_python_generated/models/article_content_state.py +105 -0
- twitter_openapi_python_generated/models/article_content_text_range.py +93 -0
- twitter_openapi_python_generated/models/article_result.py +9 -3
- twitter_openapi_python_generated/models/audio_space.py +107 -0
- twitter_openapi_python_generated/models/audio_space_data.py +93 -0
- twitter_openapi_python_generated/models/audio_space_mentioned_user.py +97 -0
- twitter_openapi_python_generated/models/audio_space_metadata.py +165 -0
- twitter_openapi_python_generated/models/audio_space_participant.py +109 -0
- twitter_openapi_python_generated/models/audio_space_participant_user.py +104 -0
- twitter_openapi_python_generated/models/audio_space_participant_user_results.py +103 -0
- twitter_openapi_python_generated/models/audio_space_participant_verification.py +99 -0
- twitter_openapi_python_generated/models/audio_space_participants.py +114 -0
- twitter_openapi_python_generated/models/audio_space_response.py +102 -0
- twitter_openapi_python_generated/models/audio_space_sharings.py +91 -0
- twitter_openapi_python_generated/models/authenticate_periscope_response.py +102 -0
- twitter_openapi_python_generated/models/authenticate_periscope_response_data.py +89 -0
- twitter_openapi_python_generated/models/birdwatch_alias_self_select_status.py +91 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_alias_self_select_status_response.py +102 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_alias_self_select_status_response_data.py +93 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_authenticated_user_profile_response.py +102 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_authenticated_user_profile_response_data.py +93 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_birdwatch_profile_response.py +102 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_birdwatch_profile_response_data.py +93 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_global_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_global_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_public_data_response.py +102 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_public_data_response_data.py +93 -0
- twitter_openapi_python_generated/models/birdwatch_home_page.py +101 -0
- twitter_openapi_python_generated/models/birdwatch_home_page_body.py +104 -0
- twitter_openapi_python_generated/models/birdwatch_home_timeline.py +97 -0
- twitter_openapi_python_generated/models/birdwatch_pivot.py +0 -17
- twitter_openapi_python_generated/models/birdwatch_profile.py +89 -0
- twitter_openapi_python_generated/models/birdwatch_public_data_file.py +91 -0
- twitter_openapi_python_generated/models/birdwatch_public_data_file_bundle.py +113 -0
- twitter_openapi_python_generated/models/birdwatch_viewer.py +93 -0
- twitter_openapi_python_generated/models/bookmark_search.py +93 -0
- twitter_openapi_python_generated/models/bookmark_search_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/bookmark_search_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/broadcast.py +159 -0
- twitter_openapi_python_generated/models/broadcast_data.py +93 -0
- twitter_openapi_python_generated/models/broadcast_edited_replay.py +89 -0
- twitter_openapi_python_generated/models/broadcast_periscope_user.py +95 -0
- twitter_openapi_python_generated/models/broadcast_response.py +102 -0
- twitter_openapi_python_generated/models/cashtag_attachment.py +6 -4
- twitter_openapi_python_generated/models/client_event_info_details.py +8 -2
- twitter_openapi_python_generated/models/communities_fetch_one_query_response.py +102 -0
- twitter_openapi_python_generated/models/communities_fetch_one_query_response_data.py +93 -0
- twitter_openapi_python_generated/models/communities_search_query_response.py +102 -0
- twitter_openapi_python_generated/models/communities_search_query_response_data.py +93 -0
- twitter_openapi_python_generated/models/communities_search_slice.py +102 -0
- twitter_openapi_python_generated/models/community.py +2 -2
- twitter_openapi_python_generated/models/community_delete_action_result.py +1 -8
- twitter_openapi_python_generated/models/community_facepile_user.py +98 -0
- twitter_openapi_python_generated/models/community_facepile_user_results.py +95 -0
- twitter_openapi_python_generated/models/community_hashtag.py +91 -0
- twitter_openapi_python_generated/models/community_hashtag_slice.py +99 -0
- twitter_openapi_python_generated/models/community_id_user_results.py +95 -0
- twitter_openapi_python_generated/models/community_invites_result.py +1 -8
- twitter_openapi_python_generated/models/community_join_action_unavailable.py +1 -8
- twitter_openapi_python_generated/models/community_leave_action_result.py +1 -8
- twitter_openapi_python_generated/models/community_list_members_action_result.py +90 -0
- twitter_openapi_python_generated/models/community_page_actions.py +113 -0
- twitter_openapi_python_generated/models/community_page_community.py +187 -0
- twitter_openapi_python_generated/models/community_page_delete_action_result.py +94 -0
- twitter_openapi_python_generated/models/community_page_invites_result.py +96 -0
- twitter_openapi_python_generated/models/community_page_join_action_result.py +92 -0
- twitter_openapi_python_generated/models/community_page_leave_action_result.py +96 -0
- twitter_openapi_python_generated/models/community_page_pin_action_result.py +92 -0
- twitter_openapi_python_generated/models/community_page_results.py +95 -0
- twitter_openapi_python_generated/models/community_primary_topic_name.py +89 -0
- twitter_openapi_python_generated/models/community_query_response.py +102 -0
- twitter_openapi_python_generated/models/community_query_response_data.py +93 -0
- twitter_openapi_python_generated/models/community_relay_rule.py +103 -0
- twitter_openapi_python_generated/models/community_search_community.py +134 -0
- twitter_openapi_python_generated/models/community_search_results.py +95 -0
- twitter_openapi_python_generated/models/community_settings_actions.py +101 -0
- twitter_openapi_python_generated/models/community_settings_community.py +183 -0
- twitter_openapi_python_generated/models/community_settings_creator.py +106 -0
- twitter_openapi_python_generated/models/community_settings_creator_core.py +89 -0
- twitter_openapi_python_generated/models/community_settings_creator_results.py +95 -0
- twitter_openapi_python_generated/models/community_settings_creator_verification.py +89 -0
- twitter_openapi_python_generated/models/community_settings_invites_result.py +90 -0
- twitter_openapi_python_generated/models/community_settings_results.py +95 -0
- twitter_openapi_python_generated/models/community_subtopic.py +99 -0
- twitter_openapi_python_generated/models/community_topic.py +108 -0
- twitter_openapi_python_generated/models/community_topic_results.py +96 -0
- twitter_openapi_python_generated/models/content_item_type.py +1 -0
- twitter_openapi_python_generated/models/conversation_control.py +8 -1
- twitter_openapi_python_generated/models/conversation_details.py +1 -8
- twitter_openapi_python_generated/models/cover_cta.py +5 -15
- twitter_openapi_python_generated/models/creator_studio_tab_bar_item_query_response.py +102 -0
- twitter_openapi_python_generated/models/creator_studio_tab_bar_item_query_response_data.py +89 -0
- twitter_openapi_python_generated/models/cta_client_event_info.py +1 -8
- twitter_openapi_python_generated/models/cta_limited_action_prompt.py +1 -8
- twitter_openapi_python_generated/models/data_saver_mode_response.py +102 -0
- twitter_openapi_python_generated/models/data_saver_mode_response_data.py +89 -0
- twitter_openapi_python_generated/models/event_summary_ad_metadata_container.py +91 -0
- twitter_openapi_python_generated/models/event_summary_event.py +97 -0
- twitter_openapi_python_generated/models/event_summary_media.py +99 -0
- twitter_openapi_python_generated/models/event_summary_media_entity.py +95 -0
- twitter_openapi_python_generated/models/event_summary_media_key.py +91 -0
- twitter_openapi_python_generated/models/event_summary_promoted_metadata.py +117 -0
- twitter_openapi_python_generated/models/explore_sidebar_response.py +102 -0
- twitter_openapi_python_generated/models/explore_sidebar_response_data.py +93 -0
- twitter_openapi_python_generated/models/feedback_action.py +1 -28
- twitter_openapi_python_generated/models/global_communities_latest_post_search.py +93 -0
- twitter_openapi_python_generated/models/global_communities_latest_post_search_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/global_communities_latest_post_search_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/global_communities_post_search.py +93 -0
- twitter_openapi_python_generated/models/global_communities_post_search_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/global_communities_post_search_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/grok_account_jwt.py +89 -0
- twitter_openapi_python_generated/models/grok_account_jwt_data.py +93 -0
- twitter_openapi_python_generated/models/grok_account_jwt_response.py +102 -0
- twitter_openapi_python_generated/models/grok_entity_ref.py +19 -4
- twitter_openapi_python_generated/models/grok_home.py +114 -0
- twitter_openapi_python_generated/models/grok_home_layout.py +98 -0
- twitter_openapi_python_generated/models/grok_home_layout_section.py +98 -0
- twitter_openapi_python_generated/models/grok_home_prompt.py +99 -0
- twitter_openapi_python_generated/models/grok_home_response.py +102 -0
- twitter_openapi_python_generated/models/grok_home_response_data.py +93 -0
- twitter_openapi_python_generated/models/grok_image_annotation.py +2 -2
- twitter_openapi_python_generated/models/grok_model_option.py +103 -0
- twitter_openapi_python_generated/models/identity_profile_labels_highlighted_label.py +93 -0
- twitter_openapi_python_generated/models/item_content_union.py +27 -8
- twitter_openapi_python_generated/models/limited_action.py +8 -1
- twitter_openapi_python_generated/models/limited_action_results_data.py +8 -1
- twitter_openapi_python_generated/models/list_search.py +93 -0
- twitter_openapi_python_generated/models/list_search_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/list_search_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/lists_management_page_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/lists_management_page_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/lists_management_viewer.py +93 -0
- twitter_openapi_python_generated/models/media_result.py +1 -1
- twitter_openapi_python_generated/models/module_footer.py +1 -8
- twitter_openapi_python_generated/models/module_header.py +8 -9
- twitter_openapi_python_generated/models/note_tweet_result_data.py +2 -2
- twitter_openapi_python_generated/models/notification_details.py +91 -0
- twitter_openapi_python_generated/models/pinned_timelines.py +89 -0
- twitter_openapi_python_generated/models/pinned_timelines_response.py +102 -0
- twitter_openapi_python_generated/models/pinned_timelines_response_data.py +93 -0
- twitter_openapi_python_generated/models/promoted_trend.py +97 -0
- twitter_openapi_python_generated/models/rich_message.py +10 -1
- twitter_openapi_python_generated/models/rich_message_entity.py +97 -0
- twitter_openapi_python_generated/models/rich_message_entity_ref.py +117 -0
- twitter_openapi_python_generated/models/session.py +0 -7
- twitter_openapi_python_generated/models/sidebar_user_recommendation.py +95 -0
- twitter_openapi_python_generated/models/sidebar_user_recommendations_data.py +96 -0
- twitter_openapi_python_generated/models/sidebar_user_recommendations_response.py +102 -0
- twitter_openapi_python_generated/models/slice_info.py +89 -0
- twitter_openapi_python_generated/models/story_topic.py +95 -0
- twitter_openapi_python_generated/models/story_topic_data.py +93 -0
- twitter_openapi_python_generated/models/story_topic_item.py +93 -0
- twitter_openapi_python_generated/models/story_topic_response.py +102 -0
- twitter_openapi_python_generated/models/story_topic_stories.py +96 -0
- twitter_openapi_python_generated/models/timeline_event_summary.py +121 -0
- twitter_openapi_python_generated/models/timeline_general_context.py +2 -2
- twitter_openapi_python_generated/models/timeline_half_cover.py +0 -7
- twitter_openapi_python_generated/models/timeline_message_prompt_content.py +1 -8
- twitter_openapi_python_generated/models/timeline_prompt_content.py +1 -15
- twitter_openapi_python_generated/models/timeline_show_alert.py +1 -15
- twitter_openapi_python_generated/models/timeline_tombstone.py +1 -11
- twitter_openapi_python_generated/models/timeline_topic_context.py +1 -11
- twitter_openapi_python_generated/models/timeline_trend.py +9 -1
- twitter_openapi_python_generated/models/topic_carousel_query_response.py +102 -0
- twitter_openapi_python_generated/models/topic_carousel_query_response_data.py +93 -0
- twitter_openapi_python_generated/models/trend_metadata.py +3 -1
- twitter_openapi_python_generated/models/trend_promoted_metadata.py +111 -0
- twitter_openapi_python_generated/models/tweet.py +4 -2
- twitter_openapi_python_generated/models/tweet_card_legacy_binding_value_data.py +8 -1
- twitter_openapi_python_generated/models/tweet_card_platform_audience.py +1 -8
- twitter_openapi_python_generated/models/tweet_legacy.py +18 -3
- twitter_openapi_python_generated/models/tweet_legacy_place.py +107 -0
- twitter_openapi_python_generated/models/tweet_legacy_place_bounding_box.py +98 -0
- twitter_openapi_python_generated/models/tweet_legacy_point.py +98 -0
- twitter_openapi_python_generated/models/tweet_post_cta.py +1 -9
- twitter_openapi_python_generated/models/type_name.py +4 -0
- twitter_openapi_python_generated/models/unified_card.py +1 -8
- twitter_openapi_python_generated/models/user_highlights_tweets_result.py +2 -2
- twitter_openapi_python_generated/models/user_tweets_result_v1.py +2 -2
- twitter_openapi_python_generated/models/users_verified_avatars_response.py +102 -0
- twitter_openapi_python_generated/models/users_verified_avatars_response_data.py +96 -0
- twitter_openapi_python_generated/models/verified_avatar_user.py +112 -0
- twitter_openapi_python_generated/models/verified_avatar_user_results.py +93 -0
- {twitter_openapi_python_generated-0.1.1.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/METADATA +195 -9
- {twitter_openapi_python_generated-0.1.1.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/RECORD +223 -62
- {twitter_openapi_python_generated-0.1.1.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/WHEEL +0 -0
- {twitter_openapi_python_generated-0.1.1.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {twitter_openapi_python_generated-0.1.1.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/licenses/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.1.1.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/top_level.txt +0 -0
|
@@ -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.story_topic_data import StoryTopicData
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
from pydantic_core import to_jsonable_python
|
|
28
|
+
|
|
29
|
+
class StoryTopicResponse(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
StoryTopicResponse
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
data: StoryTopicData
|
|
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 StoryTopicResponse 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 StoryTopicResponse 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": StoryTopicData.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
|
+
|
|
@@ -0,0 +1,96 @@
|
|
|
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.story_topic_item import StoryTopicItem
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class StoryTopicStories(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
StoryTopicStories
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
items: List[StoryTopicItem]
|
|
33
|
+
__properties: ClassVar[List[str]] = ["items"]
|
|
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 StoryTopicStories 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 each item in items (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.items:
|
|
77
|
+
for _item_items in self.items:
|
|
78
|
+
_items.append(_item_items.to_dict() if _item_items is not None else None)
|
|
79
|
+
_dict['items'] = _items
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of StoryTopicStories 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
|
+
"items": [StoryTopicItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -0,0 +1,121 @@
|
|
|
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, Field, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.content_item_type import ContentItemType
|
|
24
|
+
from twitter_openapi_python_generated.models.event_summary_event import EventSummaryEvent
|
|
25
|
+
from twitter_openapi_python_generated.models.event_summary_media import EventSummaryMedia
|
|
26
|
+
from twitter_openapi_python_generated.models.event_summary_promoted_metadata import EventSummaryPromotedMetadata
|
|
27
|
+
from twitter_openapi_python_generated.models.social_context_landing_url import SocialContextLandingUrl
|
|
28
|
+
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
29
|
+
from typing import Optional, Set
|
|
30
|
+
from typing_extensions import Self
|
|
31
|
+
from pydantic_core import to_jsonable_python
|
|
32
|
+
|
|
33
|
+
class TimelineEventSummary(BaseModel):
|
|
34
|
+
"""
|
|
35
|
+
TimelineEventSummary
|
|
36
|
+
""" # noqa: E501
|
|
37
|
+
typename: TypeName = Field(alias="__typename")
|
|
38
|
+
event: EventSummaryEvent
|
|
39
|
+
event_summary_display_type: StrictStr = Field(alias="eventSummaryDisplayType")
|
|
40
|
+
event_summary_url: SocialContextLandingUrl = Field(alias="eventSummaryUrl")
|
|
41
|
+
item_type: ContentItemType = Field(alias="itemType")
|
|
42
|
+
media: EventSummaryMedia
|
|
43
|
+
promoted_metadata: EventSummaryPromotedMetadata = Field(alias="promotedMetadata")
|
|
44
|
+
title: StrictStr
|
|
45
|
+
__properties: ClassVar[List[str]] = ["__typename", "event", "eventSummaryDisplayType", "eventSummaryUrl", "itemType", "media", "promotedMetadata", "title"]
|
|
46
|
+
|
|
47
|
+
model_config = ConfigDict(
|
|
48
|
+
validate_by_name=True,
|
|
49
|
+
validate_by_alias=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
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
65
|
+
"""Create an instance of TimelineEventSummary from a JSON string"""
|
|
66
|
+
return cls.from_dict(json.loads(json_str))
|
|
67
|
+
|
|
68
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
69
|
+
"""Return the dictionary representation of the model using alias.
|
|
70
|
+
|
|
71
|
+
This has the following differences from calling pydantic's
|
|
72
|
+
`self.model_dump(by_alias=True)`:
|
|
73
|
+
|
|
74
|
+
* `None` is only added to the output dict for nullable fields that
|
|
75
|
+
were set at model initialization. Other fields with value `None`
|
|
76
|
+
are ignored.
|
|
77
|
+
"""
|
|
78
|
+
excluded_fields: Set[str] = set([
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
_dict = self.model_dump(
|
|
82
|
+
by_alias=True,
|
|
83
|
+
exclude=excluded_fields,
|
|
84
|
+
exclude_none=True,
|
|
85
|
+
)
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of event
|
|
87
|
+
if self.event:
|
|
88
|
+
_dict['event'] = self.event.to_dict()
|
|
89
|
+
# override the default output from pydantic by calling `to_dict()` of event_summary_url
|
|
90
|
+
if self.event_summary_url:
|
|
91
|
+
_dict['eventSummaryUrl'] = self.event_summary_url.to_dict()
|
|
92
|
+
# override the default output from pydantic by calling `to_dict()` of media
|
|
93
|
+
if self.media:
|
|
94
|
+
_dict['media'] = self.media.to_dict()
|
|
95
|
+
# override the default output from pydantic by calling `to_dict()` of promoted_metadata
|
|
96
|
+
if self.promoted_metadata:
|
|
97
|
+
_dict['promotedMetadata'] = self.promoted_metadata.to_dict()
|
|
98
|
+
return _dict
|
|
99
|
+
|
|
100
|
+
@classmethod
|
|
101
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
102
|
+
"""Create an instance of TimelineEventSummary from a dict"""
|
|
103
|
+
if obj is None:
|
|
104
|
+
return None
|
|
105
|
+
|
|
106
|
+
if not isinstance(obj, dict):
|
|
107
|
+
return cls.model_validate(obj)
|
|
108
|
+
|
|
109
|
+
_obj = cls.model_validate({
|
|
110
|
+
"__typename": obj.get("__typename"),
|
|
111
|
+
"event": EventSummaryEvent.from_dict(obj["event"]) if obj.get("event") is not None else None,
|
|
112
|
+
"eventSummaryDisplayType": obj.get("eventSummaryDisplayType"),
|
|
113
|
+
"eventSummaryUrl": SocialContextLandingUrl.from_dict(obj["eventSummaryUrl"]) if obj.get("eventSummaryUrl") is not None else None,
|
|
114
|
+
"itemType": obj.get("itemType"),
|
|
115
|
+
"media": EventSummaryMedia.from_dict(obj["media"]) if obj.get("media") is not None else None,
|
|
116
|
+
"promotedMetadata": EventSummaryPromotedMetadata.from_dict(obj["promotedMetadata"]) if obj.get("promotedMetadata") is not None else None,
|
|
117
|
+
"title": obj.get("title")
|
|
118
|
+
})
|
|
119
|
+
return _obj
|
|
120
|
+
|
|
121
|
+
|
|
@@ -43,8 +43,8 @@ class TimelineGeneralContext(BaseModel):
|
|
|
43
43
|
if value is None:
|
|
44
44
|
return value
|
|
45
45
|
|
|
46
|
-
if value not in set(['Follow', 'Pin', 'Like', 'Location', 'Sparkle', 'Conversation', 'List', 'Community', 'Facepile']):
|
|
47
|
-
raise ValueError("must be one of enum values ('Follow', 'Pin', 'Like', 'Location', 'Sparkle', 'Conversation', 'List', 'Community', 'Facepile')")
|
|
46
|
+
if value not in set(['Follow', 'Pin', 'Like', 'Location', 'Sparkle', 'Conversation', 'List', 'TextOnly', 'Community', 'Facepile']):
|
|
47
|
+
raise ValueError("must be one of enum values ('Follow', 'Pin', 'Like', 'Location', 'Sparkle', 'Conversation', 'List', 'TextOnly', 'Community', 'Facepile')")
|
|
48
48
|
return value
|
|
49
49
|
|
|
50
50
|
model_config = ConfigDict(
|
|
@@ -40,13 +40,6 @@ class TimelineHalfCover(BaseModel):
|
|
|
40
40
|
type: StrictStr
|
|
41
41
|
__properties: ClassVar[List[str]] = ["dismissible", "halfCoverDisplayType", "impressionCallbacks", "primaryCoverCta", "primaryText", "secondaryText", "type"]
|
|
42
42
|
|
|
43
|
-
@field_validator('half_cover_display_type')
|
|
44
|
-
def half_cover_display_type_validate_enum(cls, value):
|
|
45
|
-
"""Validates the enum"""
|
|
46
|
-
if value not in set(['Cover']):
|
|
47
|
-
raise ValueError("must be one of enum values ('Cover')")
|
|
48
|
-
return value
|
|
49
|
-
|
|
50
43
|
@field_validator('type')
|
|
51
44
|
def type_validate_enum(cls, value):
|
|
52
45
|
"""Validates the enum"""
|
|
@@ -18,7 +18,7 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from twitter_openapi_python_generated.models.timeline_message_prompt_button import TimelineMessagePromptButton
|
|
24
24
|
from twitter_openapi_python_generated.models.timeline_message_prompt_rich_text import TimelineMessagePromptRichText
|
|
@@ -37,13 +37,6 @@ class TimelineMessagePromptContent(BaseModel):
|
|
|
37
37
|
primary_button_action: Optional[TimelineMessagePromptButton] = Field(default=None, alias="primaryButtonAction")
|
|
38
38
|
__properties: ClassVar[List[str]] = ["bodyRichText", "bodyText", "contentType", "headerText", "primaryButtonAction"]
|
|
39
39
|
|
|
40
|
-
@field_validator('content_type')
|
|
41
|
-
def content_type_validate_enum(cls, value):
|
|
42
|
-
"""Validates the enum"""
|
|
43
|
-
if value not in set(['TimelineInlinePrompt', 'TimelineCompactPrompt']):
|
|
44
|
-
raise ValueError("must be one of enum values ('TimelineInlinePrompt', 'TimelineCompactPrompt')")
|
|
45
|
-
return value
|
|
46
|
-
|
|
47
40
|
model_config = ConfigDict(
|
|
48
41
|
validate_by_name=True,
|
|
49
42
|
validate_by_alias=True,
|
|
@@ -18,7 +18,7 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List
|
|
23
23
|
from twitter_openapi_python_generated.models.timeline_prompt_callback import TimelinePromptCallback
|
|
24
24
|
from typing import Optional, Set
|
|
@@ -39,20 +39,6 @@ class TimelinePromptContent(BaseModel):
|
|
|
39
39
|
title: StrictStr
|
|
40
40
|
__properties: ClassVar[List[str]] = ["confirmation", "contentType", "displayType", "isRelevantCallback", "isRelevantText", "notRelevantCallback", "notRelevantText", "title"]
|
|
41
41
|
|
|
42
|
-
@field_validator('content_type')
|
|
43
|
-
def content_type_validate_enum(cls, value):
|
|
44
|
-
"""Validates the enum"""
|
|
45
|
-
if value not in set(['TimelineRelevancePrompt']):
|
|
46
|
-
raise ValueError("must be one of enum values ('TimelineRelevancePrompt')")
|
|
47
|
-
return value
|
|
48
|
-
|
|
49
|
-
@field_validator('display_type')
|
|
50
|
-
def display_type_validate_enum(cls, value):
|
|
51
|
-
"""Validates the enum"""
|
|
52
|
-
if value not in set(['Compact']):
|
|
53
|
-
raise ValueError("must be one of enum values ('Compact')")
|
|
54
|
-
return value
|
|
55
|
-
|
|
56
42
|
model_config = ConfigDict(
|
|
57
43
|
validate_by_name=True,
|
|
58
44
|
validate_by_alias=True,
|
|
@@ -18,7 +18,7 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from twitter_openapi_python_generated.models.client_event_info import ClientEventInfo
|
|
24
24
|
from twitter_openapi_python_generated.models.instruction_type import InstructionType
|
|
@@ -46,20 +46,6 @@ class TimelineShowAlert(BaseModel):
|
|
|
46
46
|
users_results: Optional[List[UserResults]] = Field(default=None, alias="usersResults")
|
|
47
47
|
__properties: ClassVar[List[str]] = ["alertType", "clientEventInfo", "colorConfig", "displayDurationMs", "displayLocation", "iconDisplayInfo", "richText", "triggerDelayMs", "type", "usersResults"]
|
|
48
48
|
|
|
49
|
-
@field_validator('alert_type')
|
|
50
|
-
def alert_type_validate_enum(cls, value):
|
|
51
|
-
"""Validates the enum"""
|
|
52
|
-
if value not in set(['NewTweets']):
|
|
53
|
-
raise ValueError("must be one of enum values ('NewTweets')")
|
|
54
|
-
return value
|
|
55
|
-
|
|
56
|
-
@field_validator('display_location')
|
|
57
|
-
def display_location_validate_enum(cls, value):
|
|
58
|
-
"""Validates the enum"""
|
|
59
|
-
if value not in set(['Top']):
|
|
60
|
-
raise ValueError("must be one of enum values ('Top')")
|
|
61
|
-
return value
|
|
62
|
-
|
|
63
49
|
model_config = ConfigDict(
|
|
64
50
|
validate_by_name=True,
|
|
65
51
|
validate_by_alias=True,
|
|
@@ -18,7 +18,7 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from twitter_openapi_python_generated.models.content_item_type import ContentItemType
|
|
24
24
|
from twitter_openapi_python_generated.models.tombstone_info import TombstoneInfo
|
|
@@ -37,16 +37,6 @@ class TimelineTombstone(BaseModel):
|
|
|
37
37
|
tombstone_info: Optional[TombstoneInfo] = Field(default=None, alias="tombstoneInfo")
|
|
38
38
|
__properties: ClassVar[List[str]] = ["__typename", "itemType", "tombstoneDisplayType", "tombstoneInfo"]
|
|
39
39
|
|
|
40
|
-
@field_validator('tombstone_display_type')
|
|
41
|
-
def tombstone_display_type_validate_enum(cls, value):
|
|
42
|
-
"""Validates the enum"""
|
|
43
|
-
if value is None:
|
|
44
|
-
return value
|
|
45
|
-
|
|
46
|
-
if value not in set(['Inline']):
|
|
47
|
-
raise ValueError("must be one of enum values ('Inline')")
|
|
48
|
-
return value
|
|
49
|
-
|
|
50
40
|
model_config = ConfigDict(
|
|
51
41
|
validate_by_name=True,
|
|
52
42
|
validate_by_alias=True,
|
|
@@ -18,7 +18,7 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from twitter_openapi_python_generated.models.social_context_union_type import SocialContextUnionType
|
|
24
24
|
from twitter_openapi_python_generated.models.topic_context import TopicContext
|
|
@@ -35,16 +35,6 @@ class TimelineTopicContext(BaseModel):
|
|
|
35
35
|
type: Optional[SocialContextUnionType] = None
|
|
36
36
|
__properties: ClassVar[List[str]] = ["functionalityType", "topic", "type"]
|
|
37
37
|
|
|
38
|
-
@field_validator('functionality_type')
|
|
39
|
-
def functionality_type_validate_enum(cls, value):
|
|
40
|
-
"""Validates the enum"""
|
|
41
|
-
if value is None:
|
|
42
|
-
return value
|
|
43
|
-
|
|
44
|
-
if value not in set(['Basic']):
|
|
45
|
-
raise ValueError("must be one of enum values ('Basic')")
|
|
46
|
-
return value
|
|
47
|
-
|
|
48
38
|
model_config = ConfigDict(
|
|
49
39
|
validate_by_name=True,
|
|
50
40
|
validate_by_alias=True,
|
|
@@ -28,6 +28,7 @@ from twitter_openapi_python_generated.models.social_context_union import SocialC
|
|
|
28
28
|
from twitter_openapi_python_generated.models.thumbnail_image import ThumbnailImage
|
|
29
29
|
from twitter_openapi_python_generated.models.trend_image import TrendImage
|
|
30
30
|
from twitter_openapi_python_generated.models.trend_metadata import TrendMetadata
|
|
31
|
+
from twitter_openapi_python_generated.models.trend_promoted_metadata import TrendPromotedMetadata
|
|
31
32
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
32
33
|
from typing import Optional, Set
|
|
33
34
|
from typing_extensions import Self
|
|
@@ -38,17 +39,19 @@ class TimelineTrend(BaseModel):
|
|
|
38
39
|
TimelineTrend
|
|
39
40
|
""" # noqa: E501
|
|
40
41
|
typename: TypeName = Field(alias="__typename")
|
|
42
|
+
description: Optional[StrictStr] = None
|
|
41
43
|
grouped_trends: Optional[List[GroupedTrend]] = None
|
|
42
44
|
images: Optional[List[TrendImage]] = None
|
|
43
45
|
is_ai_trend: Optional[StrictBool] = None
|
|
44
46
|
item_type: Optional[ContentItemType] = Field(default=None, alias="itemType")
|
|
45
47
|
name: StrictStr
|
|
48
|
+
promoted_metadata: Optional[TrendPromotedMetadata] = None
|
|
46
49
|
rank: Optional[Annotated[str, Field(strict=True)]] = None
|
|
47
50
|
social_context: Optional[SocialContextUnion] = None
|
|
48
51
|
thumbnail_image: Optional[ThumbnailImage] = None
|
|
49
52
|
trend_metadata: TrendMetadata
|
|
50
53
|
trend_url: SocialContextLandingUrl
|
|
51
|
-
__properties: ClassVar[List[str]] = ["__typename", "grouped_trends", "images", "is_ai_trend", "itemType", "name", "rank", "social_context", "thumbnail_image", "trend_metadata", "trend_url"]
|
|
54
|
+
__properties: ClassVar[List[str]] = ["__typename", "description", "grouped_trends", "images", "is_ai_trend", "itemType", "name", "promoted_metadata", "rank", "social_context", "thumbnail_image", "trend_metadata", "trend_url"]
|
|
52
55
|
|
|
53
56
|
@field_validator('rank', mode="before")
|
|
54
57
|
def rank_validate_regular_expression(cls, value):
|
|
@@ -111,6 +114,9 @@ class TimelineTrend(BaseModel):
|
|
|
111
114
|
for _item_images in self.images:
|
|
112
115
|
_items.append(_item_images.to_dict() if _item_images is not None else None)
|
|
113
116
|
_dict['images'] = _items
|
|
117
|
+
# override the default output from pydantic by calling `to_dict()` of promoted_metadata
|
|
118
|
+
if self.promoted_metadata:
|
|
119
|
+
_dict['promoted_metadata'] = self.promoted_metadata.to_dict()
|
|
114
120
|
# override the default output from pydantic by calling `to_dict()` of social_context
|
|
115
121
|
if self.social_context:
|
|
116
122
|
_dict['social_context'] = self.social_context.to_dict()
|
|
@@ -136,11 +142,13 @@ class TimelineTrend(BaseModel):
|
|
|
136
142
|
|
|
137
143
|
_obj = cls.model_validate({
|
|
138
144
|
"__typename": obj.get("__typename"),
|
|
145
|
+
"description": obj.get("description"),
|
|
139
146
|
"grouped_trends": [GroupedTrend.from_dict(_item) for _item in obj["grouped_trends"]] if obj.get("grouped_trends") is not None else None,
|
|
140
147
|
"images": [TrendImage.from_dict(_item) for _item in obj["images"]] if obj.get("images") is not None else None,
|
|
141
148
|
"is_ai_trend": obj.get("is_ai_trend"),
|
|
142
149
|
"itemType": obj.get("itemType"),
|
|
143
150
|
"name": obj.get("name"),
|
|
151
|
+
"promoted_metadata": TrendPromotedMetadata.from_dict(obj["promoted_metadata"]) if obj.get("promoted_metadata") is not None else None,
|
|
144
152
|
"rank": obj.get("rank"),
|
|
145
153
|
"social_context": SocialContextUnion.from_dict(obj["social_context"]) if obj.get("social_context") is not None else None,
|
|
146
154
|
"thumbnail_image": ThumbnailImage.from_dict(obj["thumbnail_image"]) if obj.get("thumbnail_image") is not None else None,
|
|
@@ -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.topic_carousel_query_response_data import TopicCarouselQueryResponseData
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
from pydantic_core import to_jsonable_python
|
|
28
|
+
|
|
29
|
+
class TopicCarouselQueryResponse(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
TopicCarouselQueryResponse
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
data: TopicCarouselQueryResponseData
|
|
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 TopicCarouselQueryResponse 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 TopicCarouselQueryResponse 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": TopicCarouselQueryResponseData.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
|
+
|