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,89 @@
|
|
|
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 typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
|
|
27
|
+
class ScheduledTweetsViewer(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
ScheduledTweetsViewer
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
scheduled_tweet_list: List[Dict[str, Any]]
|
|
32
|
+
__properties: ClassVar[List[str]] = ["scheduled_tweet_list"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
validate_by_name=True,
|
|
36
|
+
validate_by_alias=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of ScheduledTweetsViewer from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
return _dict
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
77
|
+
"""Create an instance of ScheduledTweetsViewer from a dict"""
|
|
78
|
+
if obj is None:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
if not isinstance(obj, dict):
|
|
82
|
+
return cls.model_validate(obj)
|
|
83
|
+
|
|
84
|
+
_obj = cls.model_validate({
|
|
85
|
+
"scheduled_tweet_list": obj.get("scheduled_tweet_list")
|
|
86
|
+
})
|
|
87
|
+
return _obj
|
|
88
|
+
|
|
89
|
+
|
|
@@ -80,8 +80,7 @@ class SearchTimelineResponse(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
|
|
|
@@ -32,13 +32,10 @@ class SelfThread(BaseModel):
|
|
|
32
32
|
id_str: Annotated[str, Field(strict=True)]
|
|
33
33
|
__properties: ClassVar[List[str]] = ["id_str"]
|
|
34
34
|
|
|
35
|
-
@field_validator('id_str')
|
|
35
|
+
@field_validator('id_str', mode="before")
|
|
36
36
|
def id_str_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
|
|
|
@@ -48,33 +48,24 @@ class Session(BaseModel):
|
|
|
48
48
|
user_id: Annotated[str, Field(strict=True)]
|
|
49
49
|
__properties: ClassVar[List[str]] = ["SsoInitTokens", "communitiesActions", "country", "guestId", "hasCommunityMemberships", "isActiveCreator", "isRestrictedSession", "isSuperFollowSubscriber", "language", "oneFactorLoginEligibility", "superFollowersCount", "superFollowsApplicationStatus", "userFeatures", "user_id"]
|
|
50
50
|
|
|
51
|
-
@field_validator('country')
|
|
51
|
+
@field_validator('country', mode="before")
|
|
52
52
|
def country_validate_regular_expression(cls, value):
|
|
53
53
|
"""Validates the regular expression"""
|
|
54
|
-
if
|
|
55
|
-
value = str(value)
|
|
56
|
-
|
|
57
|
-
if not re.match(r"^[A-Z]{2}$", value):
|
|
54
|
+
if isinstance(value, str) and not re.match(r"^[A-Z]{2}$", value):
|
|
58
55
|
raise ValueError(r"must validate the regular expression /^[A-Z]{2}$/")
|
|
59
56
|
return value
|
|
60
57
|
|
|
61
|
-
@field_validator('guest_id')
|
|
58
|
+
@field_validator('guest_id', mode="before")
|
|
62
59
|
def guest_id_validate_regular_expression(cls, value):
|
|
63
60
|
"""Validates the regular expression"""
|
|
64
|
-
if
|
|
65
|
-
value = str(value)
|
|
66
|
-
|
|
67
|
-
if not re.match(r"^[0-9]+$", value):
|
|
61
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
68
62
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
69
63
|
return value
|
|
70
64
|
|
|
71
|
-
@field_validator('language')
|
|
65
|
+
@field_validator('language', mode="before")
|
|
72
66
|
def language_validate_regular_expression(cls, value):
|
|
73
67
|
"""Validates the regular expression"""
|
|
74
|
-
if
|
|
75
|
-
value = str(value)
|
|
76
|
-
|
|
77
|
-
if not re.match(r"^[a-z]{2}$", value):
|
|
68
|
+
if isinstance(value, str) and not re.match(r"^[a-z]{2}$", value):
|
|
78
69
|
raise ValueError(r"must validate the regular expression /^[a-z]{2}$/")
|
|
79
70
|
return value
|
|
80
71
|
|
|
@@ -85,13 +76,10 @@ class Session(BaseModel):
|
|
|
85
76
|
raise ValueError("must be one of enum values ('NotStarted')")
|
|
86
77
|
return value
|
|
87
78
|
|
|
88
|
-
@field_validator('user_id')
|
|
79
|
+
@field_validator('user_id', mode="before")
|
|
89
80
|
def user_id_validate_regular_expression(cls, value):
|
|
90
81
|
"""Validates the regular expression"""
|
|
91
|
-
if
|
|
92
|
-
value = str(value)
|
|
93
|
-
|
|
94
|
-
if not re.match(r"^[0-9]+$", value):
|
|
82
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
95
83
|
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
96
84
|
return value
|
|
97
85
|
|
|
@@ -92,9 +92,10 @@ class SocialContextUnion(BaseModel):
|
|
|
92
92
|
match = 0
|
|
93
93
|
|
|
94
94
|
# use oneOf discriminator to lookup the data type
|
|
95
|
-
|
|
95
|
+
_discriminator_property = "type"
|
|
96
|
+
_data_type = json.loads(json_str).get(_discriminator_property)
|
|
96
97
|
if not _data_type:
|
|
97
|
-
raise ValueError("Failed to lookup data type from the field `
|
|
98
|
+
raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.")
|
|
98
99
|
|
|
99
100
|
# check if data type is `TimelineGeneralContext`
|
|
100
101
|
if _data_type == "TimelineGeneralContext":
|
|
@@ -76,8 +76,7 @@ class Text(BaseModel):
|
|
|
76
76
|
_items = []
|
|
77
77
|
if self.entities:
|
|
78
78
|
for _item_entities in self.entities:
|
|
79
|
-
if _item_entities
|
|
80
|
-
_items.append(_item_entities.to_dict())
|
|
79
|
+
_items.append(_item_entities.to_dict() if _item_entities is not None else None)
|
|
81
80
|
_dict['entities'] = _items
|
|
82
81
|
return _dict
|
|
83
82
|
|
|
@@ -77,8 +77,7 @@ class Timeline(BaseModel):
|
|
|
77
77
|
_items = []
|
|
78
78
|
if self.instructions:
|
|
79
79
|
for _item_instructions in self.instructions:
|
|
80
|
-
if _item_instructions
|
|
81
|
-
_items.append(_item_instructions.to_dict())
|
|
80
|
+
_items.append(_item_instructions.to_dict() if _item_instructions is not None else None)
|
|
82
81
|
_dict['instructions'] = _items
|
|
83
82
|
return _dict
|
|
84
83
|
|
|
@@ -77,8 +77,7 @@ class TimelineAddEntries(BaseModel):
|
|
|
77
77
|
_items = []
|
|
78
78
|
if self.entries:
|
|
79
79
|
for _item_entries in self.entries:
|
|
80
|
-
if _item_entries
|
|
81
|
-
_items.append(_item_entries.to_dict())
|
|
80
|
+
_items.append(_item_entries.to_dict() if _item_entries is not None else None)
|
|
82
81
|
_dict['entries'] = _items
|
|
83
82
|
return _dict
|
|
84
83
|
|
|
@@ -35,23 +35,17 @@ class TimelineAddEntry(BaseModel):
|
|
|
35
35
|
sort_index: Annotated[str, Field(strict=True)] = Field(alias="sortIndex")
|
|
36
36
|
__properties: ClassVar[List[str]] = ["content", "entryId", "sortIndex"]
|
|
37
37
|
|
|
38
|
-
@field_validator('entry_id')
|
|
38
|
+
@field_validator('entry_id', mode="before")
|
|
39
39
|
def entry_id_validate_regular_expression(cls, value):
|
|
40
40
|
"""Validates the regular expression"""
|
|
41
|
-
if
|
|
42
|
-
value = str(value)
|
|
43
|
-
|
|
44
|
-
if not re.match(r"^(([a-zA-Z]+|[0-9]+|[0-9a-f]+)(-|$))+", value):
|
|
41
|
+
if isinstance(value, str) and not re.match(r"^(([a-zA-Z]+|[0-9]+|[0-9a-f]+)(-|$))+", value):
|
|
45
42
|
raise ValueError(r"must validate the regular expression /^(([a-zA-Z]+|[0-9]+|[0-9a-f]+)(-|$))+/")
|
|
46
43
|
return value
|
|
47
44
|
|
|
48
|
-
@field_validator('sort_index')
|
|
45
|
+
@field_validator('sort_index', mode="before")
|
|
49
46
|
def sort_index_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
|
|
|
@@ -79,8 +79,7 @@ class TimelineAddToModule(BaseModel):
|
|
|
79
79
|
_items = []
|
|
80
80
|
if self.module_items:
|
|
81
81
|
for _item_module_items in self.module_items:
|
|
82
|
-
if _item_module_items
|
|
83
|
-
_items.append(_item_module_items.to_dict())
|
|
82
|
+
_items.append(_item_module_items.to_dict() if _item_module_items is not None else None)
|
|
84
83
|
_dict['moduleItems'] = _items
|
|
85
84
|
return _dict
|
|
86
85
|
|
|
@@ -0,0 +1,97 @@
|
|
|
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, StrictInt, 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.type_name import TypeName
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
from pydantic_core import to_jsonable_python
|
|
28
|
+
|
|
29
|
+
class TimelineFrame(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
TimelineFrame
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
typename: TypeName = Field(alias="__typename")
|
|
34
|
+
height: StrictInt
|
|
35
|
+
item_type: ContentItemType = Field(alias="itemType")
|
|
36
|
+
payload: StrictStr
|
|
37
|
+
__properties: ClassVar[List[str]] = ["__typename", "height", "itemType", "payload"]
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(
|
|
40
|
+
validate_by_name=True,
|
|
41
|
+
validate_by_alias=True,
|
|
42
|
+
validate_assignment=True,
|
|
43
|
+
protected_namespaces=(),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
|
+
"""Create an instance of TimelineFrame from a JSON string"""
|
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
|
59
|
+
|
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
|
62
|
+
|
|
63
|
+
This has the following differences from calling pydantic's
|
|
64
|
+
`self.model_dump(by_alias=True)`:
|
|
65
|
+
|
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
|
67
|
+
were set at model initialization. Other fields with value `None`
|
|
68
|
+
are ignored.
|
|
69
|
+
"""
|
|
70
|
+
excluded_fields: Set[str] = set([
|
|
71
|
+
])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of TimelineFrame from a dict"""
|
|
83
|
+
if obj is None:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
if not isinstance(obj, dict):
|
|
87
|
+
return cls.model_validate(obj)
|
|
88
|
+
|
|
89
|
+
_obj = cls.model_validate({
|
|
90
|
+
"__typename": obj.get("__typename"),
|
|
91
|
+
"height": obj.get("height"),
|
|
92
|
+
"itemType": obj.get("itemType"),
|
|
93
|
+
"payload": obj.get("payload")
|
|
94
|
+
})
|
|
95
|
+
return _obj
|
|
96
|
+
|
|
97
|
+
|
|
@@ -97,8 +97,7 @@ class TimelineHalfCover(BaseModel):
|
|
|
97
97
|
_items = []
|
|
98
98
|
if self.impression_callbacks:
|
|
99
99
|
for _item_impression_callbacks in self.impression_callbacks:
|
|
100
|
-
if _item_impression_callbacks
|
|
101
|
-
_items.append(_item_impression_callbacks.to_dict())
|
|
100
|
+
_items.append(_item_impression_callbacks.to_dict() if _item_impression_callbacks is not None else None)
|
|
102
101
|
_dict['impressionCallbacks'] = _items
|
|
103
102
|
# override the default output from pydantic by calling `to_dict()` of primary_cover_cta
|
|
104
103
|
if self.primary_cover_cta:
|
|
@@ -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
|
|
23
|
+
from twitter_openapi_python_generated.models.content_item_type import ContentItemType
|
|
24
|
+
from twitter_openapi_python_generated.models.social_context_landing_url import SocialContextLandingUrl
|
|
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 TimelineLabel(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
TimelineLabel
|
|
33
|
+
""" # noqa: E501
|
|
34
|
+
typename: TypeName = Field(alias="__typename")
|
|
35
|
+
item_type: ContentItemType = Field(alias="itemType")
|
|
36
|
+
text: StrictStr
|
|
37
|
+
url: SocialContextLandingUrl
|
|
38
|
+
__properties: ClassVar[List[str]] = ["__typename", "itemType", "text", "url"]
|
|
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 TimelineLabel 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 url
|
|
80
|
+
if self.url:
|
|
81
|
+
_dict['url'] = self.url.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 TimelineLabel 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
|
+
"itemType": obj.get("itemType"),
|
|
96
|
+
"text": obj.get("text"),
|
|
97
|
+
"url": SocialContextLandingUrl.from_dict(obj["url"]) if obj.get("url") is not None else None
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|
twitter_openapi_python_generated/models/timeline_mark_entries_unread_greater_than_sort_index.py
CHANGED
|
@@ -34,16 +34,13 @@ class TimelineMarkEntriesUnreadGreaterThanSortIndex(BaseModel):
|
|
|
34
34
|
type: InstructionType
|
|
35
35
|
__properties: ClassVar[List[str]] = ["sort_index", "type"]
|
|
36
36
|
|
|
37
|
-
@field_validator('sort_index')
|
|
37
|
+
@field_validator('sort_index', mode="before")
|
|
38
38
|
def sort_index_validate_regular_expression(cls, value):
|
|
39
39
|
"""Validates the regular expression"""
|
|
40
40
|
if value is None:
|
|
41
41
|
return value
|
|
42
42
|
|
|
43
|
-
if
|
|
44
|
-
value = str(value)
|
|
45
|
-
|
|
46
|
-
if not re.match(r"[0-9]+$", value):
|
|
43
|
+
if isinstance(value, str) and not re.match(r"[0-9]+$", value):
|
|
47
44
|
raise ValueError(r"must validate the regular expression /[0-9]+$/")
|
|
48
45
|
return value
|
|
49
46
|
|
|
@@ -80,8 +80,7 @@ class TimelineResponse(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
|
|
|
@@ -41,7 +41,7 @@ class TimelineShowAlert(BaseModel):
|
|
|
41
41
|
rich_text: TimelineShowAlertRichText = Field(alias="richText")
|
|
42
42
|
trigger_delay_ms: Optional[StrictInt] = Field(default=None, alias="triggerDelayMs")
|
|
43
43
|
type: InstructionType
|
|
44
|
-
users_results: List[UserResults] = Field(alias="usersResults")
|
|
44
|
+
users_results: Optional[List[UserResults]] = Field(alias="usersResults")
|
|
45
45
|
__properties: ClassVar[List[str]] = ["alertType", "clientEventInfo", "colorConfig", "displayDurationMs", "displayLocation", "iconDisplayInfo", "richText", "triggerDelayMs", "type", "usersResults"]
|
|
46
46
|
|
|
47
47
|
@field_validator('alert_type')
|
|
@@ -113,9 +113,13 @@ class TimelineShowAlert(BaseModel):
|
|
|
113
113
|
_items = []
|
|
114
114
|
if self.users_results:
|
|
115
115
|
for _item_users_results in self.users_results:
|
|
116
|
-
if _item_users_results
|
|
117
|
-
_items.append(_item_users_results.to_dict())
|
|
116
|
+
_items.append(_item_users_results.to_dict() if _item_users_results is not None else None)
|
|
118
117
|
_dict['usersResults'] = _items
|
|
118
|
+
# set to None if users_results (nullable) is None
|
|
119
|
+
# and model_fields_set contains the field
|
|
120
|
+
if self.users_results is None and "users_results" in self.model_fields_set:
|
|
121
|
+
_dict['usersResults'] = None
|
|
122
|
+
|
|
119
123
|
return _dict
|
|
120
124
|
|
|
121
125
|
@classmethod
|
|
@@ -93,8 +93,7 @@ class TimelineTimelineModule(BaseModel):
|
|
|
93
93
|
_items = []
|
|
94
94
|
if self.items:
|
|
95
95
|
for _item_items in self.items:
|
|
96
|
-
if _item_items
|
|
97
|
-
_items.append(_item_items.to_dict())
|
|
96
|
+
_items.append(_item_items.to_dict() if _item_items is not None else None)
|
|
98
97
|
_dict['items'] = _items
|
|
99
98
|
return _dict
|
|
100
99
|
|
|
@@ -18,8 +18,9 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from typing_extensions import Annotated
|
|
23
24
|
from twitter_openapi_python_generated.models.content_item_type import ContentItemType
|
|
24
25
|
from twitter_openapi_python_generated.models.social_context_landing_url import SocialContextLandingUrl
|
|
25
26
|
from twitter_openapi_python_generated.models.social_context_union import SocialContextUnion
|
|
@@ -40,11 +41,22 @@ class TimelineTrend(BaseModel):
|
|
|
40
41
|
is_ai_trend: Optional[StrictBool] = None
|
|
41
42
|
item_type: Optional[ContentItemType] = Field(default=None, alias="itemType")
|
|
42
43
|
name: StrictStr
|
|
44
|
+
rank: Optional[Annotated[str, Field(strict=True)]] = None
|
|
43
45
|
social_context: Optional[SocialContextUnion] = None
|
|
44
46
|
thumbnail_image: Optional[ThumbnailImage] = None
|
|
45
47
|
trend_metadata: TrendMetadata
|
|
46
48
|
trend_url: SocialContextLandingUrl
|
|
47
|
-
__properties: ClassVar[List[str]] = ["__typename", "images", "is_ai_trend", "itemType", "name", "social_context", "thumbnail_image", "trend_metadata", "trend_url"]
|
|
49
|
+
__properties: ClassVar[List[str]] = ["__typename", "images", "is_ai_trend", "itemType", "name", "rank", "social_context", "thumbnail_image", "trend_metadata", "trend_url"]
|
|
50
|
+
|
|
51
|
+
@field_validator('rank', mode="before")
|
|
52
|
+
def rank_validate_regular_expression(cls, value):
|
|
53
|
+
"""Validates the regular expression"""
|
|
54
|
+
if value is None:
|
|
55
|
+
return value
|
|
56
|
+
|
|
57
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
58
|
+
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
59
|
+
return value
|
|
48
60
|
|
|
49
61
|
model_config = ConfigDict(
|
|
50
62
|
validate_by_name=True,
|
|
@@ -89,8 +101,7 @@ class TimelineTrend(BaseModel):
|
|
|
89
101
|
_items = []
|
|
90
102
|
if self.images:
|
|
91
103
|
for _item_images in self.images:
|
|
92
|
-
if _item_images
|
|
93
|
-
_items.append(_item_images.to_dict())
|
|
104
|
+
_items.append(_item_images.to_dict() if _item_images is not None else None)
|
|
94
105
|
_dict['images'] = _items
|
|
95
106
|
# override the default output from pydantic by calling `to_dict()` of social_context
|
|
96
107
|
if self.social_context:
|
|
@@ -121,6 +132,7 @@ class TimelineTrend(BaseModel):
|
|
|
121
132
|
"is_ai_trend": obj.get("is_ai_trend"),
|
|
122
133
|
"itemType": obj.get("itemType"),
|
|
123
134
|
"name": obj.get("name"),
|
|
135
|
+
"rank": obj.get("rank"),
|
|
124
136
|
"social_context": SocialContextUnion.from_dict(obj["social_context"]) if obj.get("social_context") is not None else None,
|
|
125
137
|
"thumbnail_image": ThumbnailImage.from_dict(obj["thumbnail_image"]) if obj.get("thumbnail_image") is not None else None,
|
|
126
138
|
"trend_metadata": TrendMetadata.from_dict(obj["trend_metadata"]) if obj.get("trend_metadata") is not None else None,
|