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
|
@@ -0,0 +1,101 @@
|
|
|
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, Optional
|
|
23
|
+
from twitter_openapi_python_generated.models.content_item_type import ContentItemType
|
|
24
|
+
from twitter_openapi_python_generated.models.twitter_list import TwitterList
|
|
25
|
+
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
26
|
+
from typing import Optional, Set
|
|
27
|
+
from typing_extensions import Self
|
|
28
|
+
from pydantic_core import to_jsonable_python
|
|
29
|
+
|
|
30
|
+
class TimelineTwitterList(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
TimelineTwitterList
|
|
33
|
+
""" # noqa: E501
|
|
34
|
+
typename: TypeName = Field(alias="__typename")
|
|
35
|
+
display_type: Optional[StrictStr] = Field(default=None, alias="displayType")
|
|
36
|
+
item_type: ContentItemType = Field(alias="itemType")
|
|
37
|
+
list: TwitterList
|
|
38
|
+
__properties: ClassVar[List[str]] = ["__typename", "displayType", "itemType", "list"]
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
validate_by_name=True,
|
|
42
|
+
validate_by_alias=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of TimelineTwitterList from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([
|
|
72
|
+
])
|
|
73
|
+
|
|
74
|
+
_dict = self.model_dump(
|
|
75
|
+
by_alias=True,
|
|
76
|
+
exclude=excluded_fields,
|
|
77
|
+
exclude_none=True,
|
|
78
|
+
)
|
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of list
|
|
80
|
+
if self.list:
|
|
81
|
+
_dict['list'] = self.list.to_dict()
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of TimelineTwitterList from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate({
|
|
94
|
+
"__typename": obj.get("__typename"),
|
|
95
|
+
"displayType": obj.get("displayType"),
|
|
96
|
+
"itemType": obj.get("itemType"),
|
|
97
|
+
"list": TwitterList.from_dict(obj["list"]) if obj.get("list") is not None else None
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|
|
@@ -77,8 +77,7 @@ class TombstoneRichText(BaseModel):
|
|
|
77
77
|
_items = []
|
|
78
78
|
if self.entities:
|
|
79
79
|
for _item_entities in self.entities:
|
|
80
|
-
if _item_entities
|
|
81
|
-
_items.append(_item_entities.to_dict())
|
|
80
|
+
_items.append(_item_entities.to_dict() if _item_entities is not None else None)
|
|
82
81
|
_dict['entities'] = _items
|
|
83
82
|
return _dict
|
|
84
83
|
|
|
@@ -32,13 +32,10 @@ class Tracing(BaseModel):
|
|
|
32
32
|
trace_id: Annotated[str, Field(strict=True)]
|
|
33
33
|
__properties: ClassVar[List[str]] = ["trace_id"]
|
|
34
34
|
|
|
35
|
-
@field_validator('trace_id')
|
|
35
|
+
@field_validator('trace_id', mode="before")
|
|
36
36
|
def trace_id_validate_regular_expression(cls, value):
|
|
37
37
|
"""Validates the regular expression"""
|
|
38
|
-
if
|
|
39
|
-
value = str(value)
|
|
40
|
-
|
|
41
|
-
if not re.match(r"^[0-9a-f]{16}$", value):
|
|
38
|
+
if isinstance(value, str) and not re.match(r"^[0-9a-f]{16}$", value):
|
|
42
39
|
raise ValueError(r"must validate the regular expression /^[0-9a-f]{16}$/")
|
|
43
40
|
return value
|
|
44
41
|
|
|
@@ -18,7 +18,7 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
from pydantic import BaseModel, ConfigDict
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from twitter_openapi_python_generated.models.social_context_landing_url import SocialContextLandingUrl
|
|
24
24
|
from typing import Optional, Set
|
|
@@ -29,8 +29,9 @@ class TrendMetadata(BaseModel):
|
|
|
29
29
|
"""
|
|
30
30
|
TrendMetadata
|
|
31
31
|
""" # noqa: E501
|
|
32
|
+
domain_context: Optional[StrictStr] = None
|
|
32
33
|
url: Optional[SocialContextLandingUrl] = None
|
|
33
|
-
__properties: ClassVar[List[str]] = ["url"]
|
|
34
|
+
__properties: ClassVar[List[str]] = ["domain_context", "url"]
|
|
34
35
|
|
|
35
36
|
model_config = ConfigDict(
|
|
36
37
|
validate_by_name=True,
|
|
@@ -86,6 +87,7 @@ class TrendMetadata(BaseModel):
|
|
|
86
87
|
return cls.model_validate(obj)
|
|
87
88
|
|
|
88
89
|
_obj = cls.model_validate({
|
|
90
|
+
"domain_context": obj.get("domain_context"),
|
|
89
91
|
"url": SocialContextLandingUrl.from_dict(obj["url"]) if obj.get("url") is not None else None
|
|
90
92
|
})
|
|
91
93
|
return _obj
|
|
@@ -32,13 +32,10 @@ class TrendResults(BaseModel):
|
|
|
32
32
|
rest_id: Annotated[str, Field(strict=True)]
|
|
33
33
|
__properties: ClassVar[List[str]] = ["rest_id"]
|
|
34
34
|
|
|
35
|
-
@field_validator('rest_id')
|
|
35
|
+
@field_validator('rest_id', mode="before")
|
|
36
36
|
def rest_id_validate_regular_expression(cls, value):
|
|
37
37
|
"""Validates the regular expression"""
|
|
38
|
-
if
|
|
39
|
-
value = str(value)
|
|
40
|
-
|
|
41
|
-
if not re.match(r"^[0-9]+$", value):
|
|
38
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
42
39
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
43
40
|
return value
|
|
44
41
|
|
|
@@ -24,6 +24,7 @@ from typing_extensions import Annotated
|
|
|
24
24
|
from twitter_openapi_python_generated.models.article import Article
|
|
25
25
|
from twitter_openapi_python_generated.models.author_community_relationship import AuthorCommunityRelationship
|
|
26
26
|
from twitter_openapi_python_generated.models.birdwatch_pivot import BirdwatchPivot
|
|
27
|
+
from twitter_openapi_python_generated.models.cashtag_attachment import CashtagAttachment
|
|
27
28
|
from twitter_openapi_python_generated.models.community_relationship import CommunityRelationship
|
|
28
29
|
from twitter_openapi_python_generated.models.community_result import CommunityResult
|
|
29
30
|
from twitter_openapi_python_generated.models.content_disclosure import ContentDisclosure
|
|
@@ -54,6 +55,7 @@ class Tweet(BaseModel):
|
|
|
54
55
|
author_community_relationship: Optional[AuthorCommunityRelationship] = None
|
|
55
56
|
birdwatch_pivot: Optional[BirdwatchPivot] = None
|
|
56
57
|
card: Optional[TweetCard] = None
|
|
58
|
+
cashtag_attachments: Optional[List[CashtagAttachment]] = None
|
|
57
59
|
community_relationship: Optional[CommunityRelationship] = None
|
|
58
60
|
community_results: Optional[CommunityResult] = None
|
|
59
61
|
content_disclosure: Optional[ContentDisclosure] = None
|
|
@@ -68,6 +70,7 @@ class Tweet(BaseModel):
|
|
|
68
70
|
has_birdwatch_notes: Optional[StrictBool] = None
|
|
69
71
|
is_translatable: Optional[StrictBool] = None
|
|
70
72
|
legacy: Optional[TweetLegacy] = None
|
|
73
|
+
nested_quoted_tweet_results: Optional[ItemResult] = None
|
|
71
74
|
note_tweet: Optional[NoteTweet] = None
|
|
72
75
|
post_cta: Optional[TweetPostCta] = Field(default=None, alias="postCta")
|
|
73
76
|
post_image_description: Optional[StrictStr] = None
|
|
@@ -83,15 +86,12 @@ class Tweet(BaseModel):
|
|
|
83
86
|
unified_card: Optional[UnifiedCard] = None
|
|
84
87
|
unmention_data: Optional[Dict[str, Any]] = None
|
|
85
88
|
views: Optional[TweetView] = None
|
|
86
|
-
__properties: ClassVar[List[str]] = ["__typename", "article", "author_community_relationship", "birdwatch_pivot", "card", "community_relationship", "community_results", "content_disclosure", "core", "edit_control", "edit_prespective", "grok_analysis_button", "grok_analysis_followups", "grok_annotations", "grok_share_attachment", "grok_translated_post_with_availability", "has_birdwatch_notes", "is_translatable", "legacy", "note_tweet", "postCta", "post_image_description", "post_video_description", "previous_counts", "quick_promote_eligibility", "quotedRefResult", "quoted_status_result", "rest_id", "source", "superFollowsReplyUserResult", "trend_results", "unified_card", "unmention_data", "views"]
|
|
89
|
+
__properties: ClassVar[List[str]] = ["__typename", "article", "author_community_relationship", "birdwatch_pivot", "card", "cashtag_attachments", "community_relationship", "community_results", "content_disclosure", "core", "edit_control", "edit_prespective", "grok_analysis_button", "grok_analysis_followups", "grok_annotations", "grok_share_attachment", "grok_translated_post_with_availability", "has_birdwatch_notes", "is_translatable", "legacy", "nested_quoted_tweet_results", "note_tweet", "postCta", "post_image_description", "post_video_description", "previous_counts", "quick_promote_eligibility", "quotedRefResult", "quoted_status_result", "rest_id", "source", "superFollowsReplyUserResult", "trend_results", "unified_card", "unmention_data", "views"]
|
|
87
90
|
|
|
88
|
-
@field_validator('rest_id')
|
|
91
|
+
@field_validator('rest_id', mode="before")
|
|
89
92
|
def rest_id_validate_regular_expression(cls, value):
|
|
90
93
|
"""Validates the regular expression"""
|
|
91
|
-
if
|
|
92
|
-
value = str(value)
|
|
93
|
-
|
|
94
|
-
if not re.match(r"^[0-9]+$", value):
|
|
94
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
95
95
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
96
96
|
return value
|
|
97
97
|
|
|
@@ -146,6 +146,12 @@ class Tweet(BaseModel):
|
|
|
146
146
|
# override the default output from pydantic by calling `to_dict()` of card
|
|
147
147
|
if self.card:
|
|
148
148
|
_dict['card'] = self.card.to_dict()
|
|
149
|
+
# override the default output from pydantic by calling `to_dict()` of each item in cashtag_attachments (list)
|
|
150
|
+
_items = []
|
|
151
|
+
if self.cashtag_attachments:
|
|
152
|
+
for _item_cashtag_attachments in self.cashtag_attachments:
|
|
153
|
+
_items.append(_item_cashtag_attachments.to_dict() if _item_cashtag_attachments is not None else None)
|
|
154
|
+
_dict['cashtag_attachments'] = _items
|
|
149
155
|
# override the default output from pydantic by calling `to_dict()` of community_relationship
|
|
150
156
|
if self.community_relationship:
|
|
151
157
|
_dict['community_relationship'] = self.community_relationship.to_dict()
|
|
@@ -176,6 +182,9 @@ class Tweet(BaseModel):
|
|
|
176
182
|
# override the default output from pydantic by calling `to_dict()` of legacy
|
|
177
183
|
if self.legacy:
|
|
178
184
|
_dict['legacy'] = self.legacy.to_dict()
|
|
185
|
+
# override the default output from pydantic by calling `to_dict()` of nested_quoted_tweet_results
|
|
186
|
+
if self.nested_quoted_tweet_results:
|
|
187
|
+
_dict['nested_quoted_tweet_results'] = self.nested_quoted_tweet_results.to_dict()
|
|
179
188
|
# override the default output from pydantic by calling `to_dict()` of note_tweet
|
|
180
189
|
if self.note_tweet:
|
|
181
190
|
_dict['note_tweet'] = self.note_tweet.to_dict()
|
|
@@ -220,6 +229,7 @@ class Tweet(BaseModel):
|
|
|
220
229
|
"author_community_relationship": AuthorCommunityRelationship.from_dict(obj["author_community_relationship"]) if obj.get("author_community_relationship") is not None else None,
|
|
221
230
|
"birdwatch_pivot": BirdwatchPivot.from_dict(obj["birdwatch_pivot"]) if obj.get("birdwatch_pivot") is not None else None,
|
|
222
231
|
"card": TweetCard.from_dict(obj["card"]) if obj.get("card") is not None else None,
|
|
232
|
+
"cashtag_attachments": [CashtagAttachment.from_dict(_item) for _item in obj["cashtag_attachments"]] if obj.get("cashtag_attachments") is not None else None,
|
|
223
233
|
"community_relationship": CommunityRelationship.from_dict(obj["community_relationship"]) if obj.get("community_relationship") is not None else None,
|
|
224
234
|
"community_results": CommunityResult.from_dict(obj["community_results"]) if obj.get("community_results") is not None else None,
|
|
225
235
|
"content_disclosure": ContentDisclosure.from_dict(obj["content_disclosure"]) if obj.get("content_disclosure") is not None else None,
|
|
@@ -234,6 +244,7 @@ class Tweet(BaseModel):
|
|
|
234
244
|
"has_birdwatch_notes": obj.get("has_birdwatch_notes"),
|
|
235
245
|
"is_translatable": obj.get("is_translatable"),
|
|
236
246
|
"legacy": TweetLegacy.from_dict(obj["legacy"]) if obj.get("legacy") is not None else None,
|
|
247
|
+
"nested_quoted_tweet_results": ItemResult.from_dict(obj["nested_quoted_tweet_results"]) if obj.get("nested_quoted_tweet_results") is not None else None,
|
|
237
248
|
"note_tweet": NoteTweet.from_dict(obj["note_tweet"]) if obj.get("note_tweet") is not None else None,
|
|
238
249
|
"postCta": TweetPostCta.from_dict(obj["postCta"]) if obj.get("postCta") is not None else None,
|
|
239
250
|
"post_image_description": obj.get("post_image_description"),
|
|
@@ -81,8 +81,7 @@ class TweetCardLegacy(BaseModel):
|
|
|
81
81
|
_items = []
|
|
82
82
|
if self.binding_values:
|
|
83
83
|
for _item_binding_values in self.binding_values:
|
|
84
|
-
if _item_binding_values
|
|
85
|
-
_items.append(_item_binding_values.to_dict())
|
|
84
|
+
_items.append(_item_binding_values.to_dict() if _item_binding_values is not None else None)
|
|
86
85
|
_dict['binding_values'] = _items
|
|
87
86
|
# override the default output from pydantic by calling `to_dict()` of card_platform
|
|
88
87
|
if self.card_platform:
|
|
@@ -91,8 +90,7 @@ class TweetCardLegacy(BaseModel):
|
|
|
91
90
|
_items = []
|
|
92
91
|
if self.user_refs_results:
|
|
93
92
|
for _item_user_refs_results in self.user_refs_results:
|
|
94
|
-
if _item_user_refs_results
|
|
95
|
-
_items.append(_item_user_refs_results.to_dict())
|
|
93
|
+
_items.append(_item_user_refs_results.to_dict() if _item_user_refs_results is not None else None)
|
|
96
94
|
_dict['user_refs_results'] = _items
|
|
97
95
|
return _dict
|
|
98
96
|
|
|
@@ -33,13 +33,10 @@ class TweetCardPlatformDevice(BaseModel):
|
|
|
33
33
|
version: Annotated[str, Field(strict=True)]
|
|
34
34
|
__properties: ClassVar[List[str]] = ["name", "version"]
|
|
35
35
|
|
|
36
|
-
@field_validator('version')
|
|
36
|
+
@field_validator('version', mode="before")
|
|
37
37
|
def version_validate_regular_expression(cls, value):
|
|
38
38
|
"""Validates the regular expression"""
|
|
39
|
-
if
|
|
40
|
-
value = str(value)
|
|
41
|
-
|
|
42
|
-
if not re.match(r"^[0-9]+$", value):
|
|
39
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
43
40
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
44
41
|
return value
|
|
45
42
|
|
|
@@ -80,8 +80,7 @@ class TweetDetailResponse(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
|
|
|
@@ -38,42 +38,33 @@ class TweetEditControl(BaseModel):
|
|
|
38
38
|
is_edit_eligible: Optional[StrictBool] = None
|
|
39
39
|
__properties: ClassVar[List[str]] = ["edit_control_initial", "edit_tweet_ids", "editable_until_msecs", "edits_remaining", "initial_tweet_id", "is_edit_eligible"]
|
|
40
40
|
|
|
41
|
-
@field_validator('editable_until_msecs')
|
|
41
|
+
@field_validator('editable_until_msecs', mode="before")
|
|
42
42
|
def editable_until_msecs_validate_regular_expression(cls, value):
|
|
43
43
|
"""Validates the regular expression"""
|
|
44
44
|
if value is None:
|
|
45
45
|
return value
|
|
46
46
|
|
|
47
|
-
if
|
|
48
|
-
value = str(value)
|
|
49
|
-
|
|
50
|
-
if not re.match(r"^[0-9]+$", value):
|
|
47
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
51
48
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
52
49
|
return value
|
|
53
50
|
|
|
54
|
-
@field_validator('edits_remaining')
|
|
51
|
+
@field_validator('edits_remaining', mode="before")
|
|
55
52
|
def edits_remaining_validate_regular_expression(cls, value):
|
|
56
53
|
"""Validates the regular expression"""
|
|
57
54
|
if value is None:
|
|
58
55
|
return value
|
|
59
56
|
|
|
60
|
-
if
|
|
61
|
-
value = str(value)
|
|
62
|
-
|
|
63
|
-
if not re.match(r"^[0-9]+$", value):
|
|
57
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
64
58
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
65
59
|
return value
|
|
66
60
|
|
|
67
|
-
@field_validator('initial_tweet_id')
|
|
61
|
+
@field_validator('initial_tweet_id', mode="before")
|
|
68
62
|
def initial_tweet_id_validate_regular_expression(cls, value):
|
|
69
63
|
"""Validates the regular expression"""
|
|
70
64
|
if value is None:
|
|
71
65
|
return value
|
|
72
66
|
|
|
73
|
-
if
|
|
74
|
-
value = str(value)
|
|
75
|
-
|
|
76
|
-
if not re.match(r"^[0-9]+$", value):
|
|
67
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
77
68
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
78
69
|
return value
|
|
79
70
|
|
|
@@ -35,23 +35,17 @@ class TweetEditControlInitial(BaseModel):
|
|
|
35
35
|
is_edit_eligible: StrictBool
|
|
36
36
|
__properties: ClassVar[List[str]] = ["edit_tweet_ids", "editable_until_msecs", "edits_remaining", "is_edit_eligible"]
|
|
37
37
|
|
|
38
|
-
@field_validator('editable_until_msecs')
|
|
38
|
+
@field_validator('editable_until_msecs', mode="before")
|
|
39
39
|
def editable_until_msecs_validate_regular_expression(cls, value):
|
|
40
40
|
"""Validates the regular expression"""
|
|
41
|
-
if
|
|
42
|
-
value = str(value)
|
|
43
|
-
|
|
44
|
-
if not re.match(r"^[0-9]+$", value):
|
|
41
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
45
42
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
46
43
|
return value
|
|
47
44
|
|
|
48
|
-
@field_validator('edits_remaining')
|
|
45
|
+
@field_validator('edits_remaining', mode="before")
|
|
49
46
|
def edits_remaining_validate_regular_expression(cls, value):
|
|
50
47
|
"""Validates the regular expression"""
|
|
51
|
-
if
|
|
52
|
-
value = str(value)
|
|
53
|
-
|
|
54
|
-
if not re.match(r"^[0-9]+$", value):
|
|
48
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
55
49
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
56
50
|
return value
|
|
57
51
|
|
|
@@ -80,8 +80,7 @@ class TweetFavoritersResponse(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
|
|
|
@@ -77,8 +77,7 @@ class TweetInterstitialRevealText(BaseModel):
|
|
|
77
77
|
_items = []
|
|
78
78
|
if self.entities:
|
|
79
79
|
for _item_entities in self.entities:
|
|
80
|
-
if _item_entities
|
|
81
|
-
_items.append(_item_entities.to_dict())
|
|
80
|
+
_items.append(_item_entities.to_dict() if _item_entities is not None else None)
|
|
82
81
|
_dict['entities'] = _items
|
|
83
82
|
return _dict
|
|
84
83
|
|
|
@@ -77,8 +77,7 @@ class TweetInterstitialText(BaseModel):
|
|
|
77
77
|
_items = []
|
|
78
78
|
if self.entities:
|
|
79
79
|
for _item_entities in self.entities:
|
|
80
|
-
if _item_entities
|
|
81
|
-
_items.append(_item_entities.to_dict())
|
|
80
|
+
_items.append(_item_entities.to_dict() if _item_entities is not None else None)
|
|
82
81
|
_dict['entities'] = _items
|
|
83
82
|
return _dict
|
|
84
83
|
|
|
@@ -38,7 +38,7 @@ class TweetLegacy(BaseModel):
|
|
|
38
38
|
bookmarked: StrictBool
|
|
39
39
|
conversation_control: Optional[Dict[str, Any]] = None
|
|
40
40
|
conversation_id_str: Annotated[str, Field(strict=True)]
|
|
41
|
-
created_at: Annotated[str, Field(strict=True)]
|
|
41
|
+
created_at: Annotated[str, Field(strict=True)] = Field(json_schema_extra={"examples": ["Sat Dec 31 23:59:59 +0000 2023"]})
|
|
42
42
|
display_text_range: List[StrictInt]
|
|
43
43
|
entities: Optional[Entities] = None
|
|
44
44
|
extended_entities: Optional[ExtendedEntities] = None
|
|
@@ -67,59 +67,44 @@ class TweetLegacy(BaseModel):
|
|
|
67
67
|
user_id_str: Annotated[str, Field(strict=True)]
|
|
68
68
|
__properties: ClassVar[List[str]] = ["bookmark_count", "bookmarked", "conversation_control", "conversation_id_str", "created_at", "display_text_range", "entities", "extended_entities", "favorite_count", "favorited", "full_text", "id_str", "in_reply_to_screen_name", "in_reply_to_status_id_str", "in_reply_to_user_id_str", "is_quote_status", "lang", "limited_actions", "place", "possibly_sensitive", "possibly_sensitive_editable", "quote_count", "quoted_status_id_str", "quoted_status_permalink", "reply_count", "retweet_count", "retweeted", "retweeted_status_result", "scopes", "self_thread", "user_id_str"]
|
|
69
69
|
|
|
70
|
-
@field_validator('conversation_id_str')
|
|
70
|
+
@field_validator('conversation_id_str', mode="before")
|
|
71
71
|
def conversation_id_str_validate_regular_expression(cls, value):
|
|
72
72
|
"""Validates the regular expression"""
|
|
73
|
-
if
|
|
74
|
-
value = str(value)
|
|
75
|
-
|
|
76
|
-
if not re.match(r"^[0-9]+$", value):
|
|
73
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
77
74
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
78
75
|
return value
|
|
79
76
|
|
|
80
|
-
@field_validator('created_at')
|
|
77
|
+
@field_validator('created_at', mode="before")
|
|
81
78
|
def created_at_validate_regular_expression(cls, value):
|
|
82
79
|
"""Validates the regular expression"""
|
|
83
|
-
if
|
|
84
|
-
value = str(value)
|
|
85
|
-
|
|
86
|
-
if not re.match(r"^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (0[1-9]|[12][0-9]|3[01]) (0[0-9]|1[0-9]|2[0-3])(: ?)([0-5][0-9])(: ?)([0-5][0-9]) ([+-][0-9]{4}) ([0-9]{4})$", value):
|
|
80
|
+
if isinstance(value, str) and not re.match(r"^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (0[1-9]|[12][0-9]|3[01]) (0[0-9]|1[0-9]|2[0-3])(: ?)([0-5][0-9])(: ?)([0-5][0-9]) ([+-][0-9]{4}) ([0-9]{4})$", value):
|
|
87
81
|
raise ValueError(r"must validate the regular expression /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (0[1-9]|[12][0-9]|3[01]) (0[0-9]|1[0-9]|2[0-3])(: ?)([0-5][0-9])(: ?)([0-5][0-9]) ([+-][0-9]{4}) ([0-9]{4})$/")
|
|
88
82
|
return value
|
|
89
83
|
|
|
90
|
-
@field_validator('id_str')
|
|
84
|
+
@field_validator('id_str', mode="before")
|
|
91
85
|
def id_str_validate_regular_expression(cls, value):
|
|
92
86
|
"""Validates the regular expression"""
|
|
93
|
-
if
|
|
94
|
-
value = str(value)
|
|
95
|
-
|
|
96
|
-
if not re.match(r"^[0-9]+$", value):
|
|
87
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
97
88
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
98
89
|
return value
|
|
99
90
|
|
|
100
|
-
@field_validator('in_reply_to_status_id_str')
|
|
91
|
+
@field_validator('in_reply_to_status_id_str', mode="before")
|
|
101
92
|
def in_reply_to_status_id_str_validate_regular_expression(cls, value):
|
|
102
93
|
"""Validates the regular expression"""
|
|
103
94
|
if value is None:
|
|
104
95
|
return value
|
|
105
96
|
|
|
106
|
-
if
|
|
107
|
-
value = str(value)
|
|
108
|
-
|
|
109
|
-
if not re.match(r"^[0-9]+$", value):
|
|
97
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
110
98
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
111
99
|
return value
|
|
112
100
|
|
|
113
|
-
@field_validator('in_reply_to_user_id_str')
|
|
101
|
+
@field_validator('in_reply_to_user_id_str', mode="before")
|
|
114
102
|
def in_reply_to_user_id_str_validate_regular_expression(cls, value):
|
|
115
103
|
"""Validates the regular expression"""
|
|
116
104
|
if value is None:
|
|
117
105
|
return value
|
|
118
106
|
|
|
119
|
-
if
|
|
120
|
-
value = str(value)
|
|
121
|
-
|
|
122
|
-
if not re.match(r"^[0-9]+$", value):
|
|
107
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
123
108
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
124
109
|
return value
|
|
125
110
|
|
|
@@ -133,26 +118,20 @@ class TweetLegacy(BaseModel):
|
|
|
133
118
|
raise ValueError("must be one of enum values ('limited_replies', 'non_compliant', 'dynamic_product_ad', 'stale_tweet', 'community_tweet_non_member_public_community', 'community_tweet_non_member_closed_community', 'blocked_viewer')")
|
|
134
119
|
return value
|
|
135
120
|
|
|
136
|
-
@field_validator('quoted_status_id_str')
|
|
121
|
+
@field_validator('quoted_status_id_str', mode="before")
|
|
137
122
|
def quoted_status_id_str_validate_regular_expression(cls, value):
|
|
138
123
|
"""Validates the regular expression"""
|
|
139
124
|
if value is None:
|
|
140
125
|
return value
|
|
141
126
|
|
|
142
|
-
if
|
|
143
|
-
value = str(value)
|
|
144
|
-
|
|
145
|
-
if not re.match(r"^[0-9]+$", value):
|
|
127
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
146
128
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
147
129
|
return value
|
|
148
130
|
|
|
149
|
-
@field_validator('user_id_str')
|
|
131
|
+
@field_validator('user_id_str', mode="before")
|
|
150
132
|
def user_id_str_validate_regular_expression(cls, value):
|
|
151
133
|
"""Validates the regular expression"""
|
|
152
|
-
if
|
|
153
|
-
value = str(value)
|
|
154
|
-
|
|
155
|
-
if not re.match(r"^[0-9]+$", value):
|
|
134
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
156
135
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
157
136
|
return value
|
|
158
137
|
|
|
@@ -75,8 +75,7 @@ class TweetLimitedActionResults(BaseModel):
|
|
|
75
75
|
_items = []
|
|
76
76
|
if self.limited_actions:
|
|
77
77
|
for _item_limited_actions in self.limited_actions:
|
|
78
|
-
if _item_limited_actions
|
|
79
|
-
_items.append(_item_limited_actions.to_dict())
|
|
78
|
+
_items.append(_item_limited_actions.to_dict() if _item_limited_actions is not None else None)
|
|
80
79
|
_dict['limited_actions'] = _items
|
|
81
80
|
return _dict
|
|
82
81
|
|
|
@@ -35,7 +35,7 @@ class TweetPreviewDisplayTweet(BaseModel):
|
|
|
35
35
|
article_preview: Optional[ArticlePreview] = None
|
|
36
36
|
bookmark_count: StrictInt
|
|
37
37
|
core: UserResultCore
|
|
38
|
-
created_at: Annotated[str, Field(strict=True)]
|
|
38
|
+
created_at: Annotated[str, Field(strict=True)] = Field(json_schema_extra={"examples": ["Sat Dec 31 23:59:59 +0000 2023"]})
|
|
39
39
|
entities: Dict[str, Any]
|
|
40
40
|
favorite_count: StrictInt
|
|
41
41
|
quote_count: StrictInt
|
|
@@ -46,23 +46,17 @@ class TweetPreviewDisplayTweet(BaseModel):
|
|
|
46
46
|
view_count: TweetPreviewDisplayTweetViewCount
|
|
47
47
|
__properties: ClassVar[List[str]] = ["article_preview", "bookmark_count", "core", "created_at", "entities", "favorite_count", "quote_count", "reply_count", "rest_id", "retweet_count", "text", "view_count"]
|
|
48
48
|
|
|
49
|
-
@field_validator('created_at')
|
|
49
|
+
@field_validator('created_at', mode="before")
|
|
50
50
|
def created_at_validate_regular_expression(cls, value):
|
|
51
51
|
"""Validates the regular expression"""
|
|
52
|
-
if
|
|
53
|
-
value = str(value)
|
|
54
|
-
|
|
55
|
-
if not re.match(r"^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (0[1-9]|[12][0-9]|3[01]) (0[0-9]|1[0-9]|2[0-3])(: ?)([0-5][0-9])(: ?)([0-5][0-9]) ([+-][0-9]{4}) ([0-9]{4})$", value):
|
|
52
|
+
if isinstance(value, str) and not re.match(r"^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (0[1-9]|[12][0-9]|3[01]) (0[0-9]|1[0-9]|2[0-3])(: ?)([0-5][0-9])(: ?)([0-5][0-9]) ([+-][0-9]{4}) ([0-9]{4})$", value):
|
|
56
53
|
raise ValueError(r"must validate the regular expression /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (0[1-9]|[12][0-9]|3[01]) (0[0-9]|1[0-9]|2[0-3])(: ?)([0-5][0-9])(: ?)([0-5][0-9]) ([+-][0-9]{4}) ([0-9]{4})$/")
|
|
57
54
|
return value
|
|
58
55
|
|
|
59
|
-
@field_validator('rest_id')
|
|
56
|
+
@field_validator('rest_id', mode="before")
|
|
60
57
|
def rest_id_validate_regular_expression(cls, value):
|
|
61
58
|
"""Validates the regular expression"""
|
|
62
|
-
if
|
|
63
|
-
value = str(value)
|
|
64
|
-
|
|
65
|
-
if not re.match(r"^[0-9]+$", value):
|
|
59
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
66
60
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
67
61
|
return value
|
|
68
62
|
|
|
@@ -32,13 +32,10 @@ class TweetPreviewDisplayTweetViewCount(BaseModel):
|
|
|
32
32
|
count: Annotated[str, Field(strict=True)]
|
|
33
33
|
__properties: ClassVar[List[str]] = ["count"]
|
|
34
34
|
|
|
35
|
-
@field_validator('count')
|
|
35
|
+
@field_validator('count', mode="before")
|
|
36
36
|
def count_validate_regular_expression(cls, value):
|
|
37
37
|
"""Validates the regular expression"""
|
|
38
|
-
if
|
|
39
|
-
value = str(value)
|
|
40
|
-
|
|
41
|
-
if not re.match(r"^[0-9]+$", value):
|
|
38
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
42
39
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
43
40
|
return value
|
|
44
41
|
|
|
@@ -80,8 +80,7 @@ class TweetResultByRestIdResponse(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
|
|
|
@@ -80,8 +80,7 @@ class TweetRetweetersResponse(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
|
|
|
@@ -114,9 +114,10 @@ class TweetUnion(BaseModel):
|
|
|
114
114
|
match = 0
|
|
115
115
|
|
|
116
116
|
# use oneOf discriminator to lookup the data type
|
|
117
|
-
|
|
117
|
+
_discriminator_property = "__typename"
|
|
118
|
+
_data_type = json.loads(json_str).get(_discriminator_property)
|
|
118
119
|
if not _data_type:
|
|
119
|
-
raise ValueError("Failed to lookup data type from the field `
|
|
120
|
+
raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.")
|
|
120
121
|
|
|
121
122
|
# check if data type is `Tweet`
|
|
122
123
|
if _data_type == "Tweet":
|