twitter-openapi-python-generated 0.1.0__py3-none-any.whl → 0.1.2__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 +235 -1
- twitter_openapi_python_generated/api/__init__.py +2 -0
- twitter_openapi_python_generated/api/birdwatch_api.py +1609 -0
- twitter_openapi_python_generated/api/community_api.py +1910 -0
- twitter_openapi_python_generated/api/default_api.py +1522 -0
- twitter_openapi_python_generated/api/tweet_api.py +778 -142
- twitter_openapi_python_generated/api/user_list_api.py +1145 -192
- twitter_openapi_python_generated/api/users_api.py +318 -0
- twitter_openapi_python_generated/api_client.py +1 -1
- twitter_openapi_python_generated/configuration.py +1 -1
- twitter_openapi_python_generated/models/__init__.py +115 -0
- twitter_openapi_python_generated/models/ad_metadata_container.py +5 -3
- twitter_openapi_python_generated/models/authenticate_periscope_response.py +102 -0
- twitter_openapi_python_generated/models/authenticate_periscope_response_data.py +89 -0
- twitter_openapi_python_generated/models/birdwatch_alias_self_select_status.py +91 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_alias_self_select_status_response.py +102 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_alias_self_select_status_response_data.py +93 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_authenticated_user_profile_response.py +102 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_authenticated_user_profile_response_data.py +93 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_birdwatch_profile_response.py +102 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_birdwatch_profile_response_data.py +93 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_global_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_global_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_public_data_response.py +102 -0
- twitter_openapi_python_generated/models/birdwatch_fetch_public_data_response_data.py +93 -0
- twitter_openapi_python_generated/models/birdwatch_home_page.py +101 -0
- twitter_openapi_python_generated/models/birdwatch_home_page_body.py +104 -0
- twitter_openapi_python_generated/models/birdwatch_home_timeline.py +97 -0
- twitter_openapi_python_generated/models/birdwatch_profile.py +89 -0
- twitter_openapi_python_generated/models/birdwatch_public_data_file.py +91 -0
- twitter_openapi_python_generated/models/birdwatch_public_data_file_bundle.py +113 -0
- twitter_openapi_python_generated/models/birdwatch_viewer.py +93 -0
- twitter_openapi_python_generated/models/bookmark_search.py +93 -0
- twitter_openapi_python_generated/models/bookmark_search_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/bookmark_search_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/client_event_info_details.py +8 -2
- twitter_openapi_python_generated/models/communities_fetch_one_query_response.py +102 -0
- twitter_openapi_python_generated/models/communities_fetch_one_query_response_data.py +93 -0
- twitter_openapi_python_generated/models/communities_search_query_response.py +102 -0
- twitter_openapi_python_generated/models/communities_search_query_response_data.py +93 -0
- twitter_openapi_python_generated/models/communities_search_slice.py +102 -0
- twitter_openapi_python_generated/models/community.py +3 -1
- twitter_openapi_python_generated/models/community_facepile_user.py +98 -0
- twitter_openapi_python_generated/models/community_facepile_user_results.py +95 -0
- twitter_openapi_python_generated/models/community_hashtag.py +91 -0
- twitter_openapi_python_generated/models/community_hashtag_slice.py +99 -0
- twitter_openapi_python_generated/models/community_id_user_results.py +95 -0
- twitter_openapi_python_generated/models/community_list_members_action_result.py +90 -0
- twitter_openapi_python_generated/models/community_page_actions.py +113 -0
- twitter_openapi_python_generated/models/community_page_community.py +187 -0
- twitter_openapi_python_generated/models/community_page_delete_action_result.py +94 -0
- twitter_openapi_python_generated/models/community_page_invites_result.py +96 -0
- twitter_openapi_python_generated/models/community_page_join_action_result.py +92 -0
- twitter_openapi_python_generated/models/community_page_leave_action_result.py +96 -0
- twitter_openapi_python_generated/models/community_page_pin_action_result.py +92 -0
- twitter_openapi_python_generated/models/community_page_results.py +95 -0
- twitter_openapi_python_generated/models/community_primary_topic_name.py +89 -0
- twitter_openapi_python_generated/models/community_query_response.py +102 -0
- twitter_openapi_python_generated/models/community_query_response_data.py +93 -0
- twitter_openapi_python_generated/models/community_relay_rule.py +103 -0
- twitter_openapi_python_generated/models/community_search_community.py +134 -0
- twitter_openapi_python_generated/models/community_search_results.py +95 -0
- twitter_openapi_python_generated/models/community_settings_actions.py +101 -0
- twitter_openapi_python_generated/models/community_settings_community.py +183 -0
- twitter_openapi_python_generated/models/community_settings_creator.py +106 -0
- twitter_openapi_python_generated/models/community_settings_creator_core.py +89 -0
- twitter_openapi_python_generated/models/community_settings_creator_results.py +95 -0
- twitter_openapi_python_generated/models/community_settings_creator_verification.py +89 -0
- twitter_openapi_python_generated/models/community_settings_invites_result.py +90 -0
- twitter_openapi_python_generated/models/community_settings_results.py +95 -0
- twitter_openapi_python_generated/models/community_subtopic.py +99 -0
- twitter_openapi_python_generated/models/community_topic.py +108 -0
- twitter_openapi_python_generated/models/community_topic_results.py +96 -0
- twitter_openapi_python_generated/models/content_item_type.py +1 -0
- twitter_openapi_python_generated/models/creator_studio_tab_bar_item_query_response.py +102 -0
- twitter_openapi_python_generated/models/creator_studio_tab_bar_item_query_response_data.py +89 -0
- twitter_openapi_python_generated/models/data_saver_mode_response.py +102 -0
- twitter_openapi_python_generated/models/data_saver_mode_response_data.py +89 -0
- twitter_openapi_python_generated/models/error_extensions.py +1 -1
- twitter_openapi_python_generated/models/error_response.py +1 -1
- twitter_openapi_python_generated/models/event_summary_ad_metadata_container.py +91 -0
- twitter_openapi_python_generated/models/event_summary_event.py +97 -0
- twitter_openapi_python_generated/models/event_summary_media.py +99 -0
- twitter_openapi_python_generated/models/event_summary_media_entity.py +95 -0
- twitter_openapi_python_generated/models/event_summary_media_key.py +91 -0
- twitter_openapi_python_generated/models/event_summary_promoted_metadata.py +117 -0
- twitter_openapi_python_generated/models/explore_sidebar_response.py +102 -0
- twitter_openapi_python_generated/models/explore_sidebar_response_data.py +93 -0
- twitter_openapi_python_generated/models/feedback_action.py +0 -7
- twitter_openapi_python_generated/models/global_communities_latest_post_search.py +93 -0
- twitter_openapi_python_generated/models/global_communities_latest_post_search_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/global_communities_latest_post_search_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/global_communities_post_search.py +93 -0
- twitter_openapi_python_generated/models/global_communities_post_search_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/global_communities_post_search_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/grok_home.py +114 -0
- twitter_openapi_python_generated/models/grok_home_layout.py +98 -0
- twitter_openapi_python_generated/models/grok_home_layout_section.py +98 -0
- twitter_openapi_python_generated/models/grok_home_prompt.py +99 -0
- twitter_openapi_python_generated/models/grok_home_response.py +102 -0
- twitter_openapi_python_generated/models/grok_home_response_data.py +93 -0
- twitter_openapi_python_generated/models/grok_model_option.py +103 -0
- twitter_openapi_python_generated/models/grouped_trend.py +95 -0
- twitter_openapi_python_generated/models/item_content_union.py +27 -8
- twitter_openapi_python_generated/models/list_search.py +93 -0
- twitter_openapi_python_generated/models/list_search_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/list_search_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/lists_management_page_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/lists_management_page_timeline_response_data.py +93 -0
- twitter_openapi_python_generated/models/lists_management_viewer.py +93 -0
- twitter_openapi_python_generated/models/module_footer.py +1 -8
- twitter_openapi_python_generated/models/notification_details.py +91 -0
- twitter_openapi_python_generated/models/pinned_timelines.py +89 -0
- twitter_openapi_python_generated/models/pinned_timelines_response.py +102 -0
- twitter_openapi_python_generated/models/pinned_timelines_response_data.py +93 -0
- twitter_openapi_python_generated/models/promoted_trend.py +97 -0
- twitter_openapi_python_generated/models/rich_message.py +10 -1
- twitter_openapi_python_generated/models/rich_message_entity.py +97 -0
- twitter_openapi_python_generated/models/rich_message_entity_ref.py +117 -0
- twitter_openapi_python_generated/models/search_timeline.py +2 -2
- twitter_openapi_python_generated/models/slice_info.py +89 -0
- twitter_openapi_python_generated/models/timeline_community.py +13 -17
- twitter_openapi_python_generated/models/timeline_event_summary.py +121 -0
- twitter_openapi_python_generated/models/timeline_message_prompt.py +13 -17
- twitter_openapi_python_generated/models/timeline_message_prompt_button.py +95 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_button_action.py +91 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_content.py +112 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_rich_text.py +98 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_rich_text_entity.py +97 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_rich_text_entity_ref.py +107 -0
- twitter_openapi_python_generated/models/timeline_prompt.py +19 -17
- twitter_openapi_python_generated/models/timeline_prompt_callback.py +89 -0
- twitter_openapi_python_generated/models/timeline_prompt_content.py +124 -0
- twitter_openapi_python_generated/models/timeline_trend.py +18 -1
- twitter_openapi_python_generated/models/topic_carousel_query_response.py +102 -0
- twitter_openapi_python_generated/models/topic_carousel_query_response_data.py +93 -0
- twitter_openapi_python_generated/models/trend_metadata.py +3 -1
- twitter_openapi_python_generated/models/trend_promoted_metadata.py +111 -0
- twitter_openapi_python_generated/models/type_name.py +3 -0
- twitter_openapi_python_generated/models/users_verified_avatars_response.py +102 -0
- twitter_openapi_python_generated/models/users_verified_avatars_response_data.py +96 -0
- twitter_openapi_python_generated/models/verified_avatar_user.py +112 -0
- twitter_openapi_python_generated/models/verified_avatar_user_results.py +93 -0
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.2.dist-info}/METADATA +145 -9
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.2.dist-info}/RECORD +149 -32
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.2.dist-info}/WHEEL +0 -0
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.2.dist-info}/licenses/LICENSE +0 -0
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.2.dist-info}/licenses/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Twitter OpenAPI
|
|
5
|
+
|
|
6
|
+
Twitter OpenAPI(Swagger) specification
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1
|
|
9
|
+
Contact: yuki@yuki0311.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.verified_avatar_user_results import VerifiedAvatarUserResults
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class UsersVerifiedAvatarsResponseData(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
UsersVerifiedAvatarsResponseData
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
users_results: List[VerifiedAvatarUserResults] = Field(alias="usersResults")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["usersResults"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
validate_by_name=True,
|
|
37
|
+
validate_by_alias=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of UsersVerifiedAvatarsResponseData from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of each item in users_results (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.users_results:
|
|
77
|
+
for _item_users_results in self.users_results:
|
|
78
|
+
_items.append(_item_users_results.to_dict() if _item_users_results is not None else None)
|
|
79
|
+
_dict['usersResults'] = _items
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of UsersVerifiedAvatarsResponseData from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate({
|
|
92
|
+
"usersResults": [VerifiedAvatarUserResults.from_dict(_item) for _item in obj["usersResults"]] if obj.get("usersResults") is not None else None
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -0,0 +1,112 @@
|
|
|
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, StrictBool, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing_extensions import Annotated
|
|
24
|
+
from twitter_openapi_python_generated.models.affiliates_highlighted_label import AffiliatesHighlightedLabel
|
|
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 VerifiedAvatarUser(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
VerifiedAvatarUser
|
|
33
|
+
""" # noqa: E501
|
|
34
|
+
typename: TypeName = Field(alias="__typename")
|
|
35
|
+
affiliates_highlighted_label: AffiliatesHighlightedLabel
|
|
36
|
+
is_blue_verified: StrictBool
|
|
37
|
+
profile_image_shape: StrictStr
|
|
38
|
+
rest_id: Annotated[str, Field(strict=True)]
|
|
39
|
+
verification: Dict[str, Any]
|
|
40
|
+
__properties: ClassVar[List[str]] = ["__typename", "affiliates_highlighted_label", "is_blue_verified", "profile_image_shape", "rest_id", "verification"]
|
|
41
|
+
|
|
42
|
+
@field_validator('rest_id', mode="before")
|
|
43
|
+
def rest_id_validate_regular_expression(cls, value):
|
|
44
|
+
"""Validates the regular expression"""
|
|
45
|
+
if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
|
|
46
|
+
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
47
|
+
return value
|
|
48
|
+
|
|
49
|
+
model_config = ConfigDict(
|
|
50
|
+
validate_by_name=True,
|
|
51
|
+
validate_by_alias=True,
|
|
52
|
+
validate_assignment=True,
|
|
53
|
+
protected_namespaces=(),
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def to_str(self) -> str:
|
|
58
|
+
"""Returns the string representation of the model using alias"""
|
|
59
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
60
|
+
|
|
61
|
+
def to_json(self) -> str:
|
|
62
|
+
"""Returns the JSON representation of the model using alias"""
|
|
63
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
67
|
+
"""Create an instance of VerifiedAvatarUser from a JSON string"""
|
|
68
|
+
return cls.from_dict(json.loads(json_str))
|
|
69
|
+
|
|
70
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
71
|
+
"""Return the dictionary representation of the model using alias.
|
|
72
|
+
|
|
73
|
+
This has the following differences from calling pydantic's
|
|
74
|
+
`self.model_dump(by_alias=True)`:
|
|
75
|
+
|
|
76
|
+
* `None` is only added to the output dict for nullable fields that
|
|
77
|
+
were set at model initialization. Other fields with value `None`
|
|
78
|
+
are ignored.
|
|
79
|
+
"""
|
|
80
|
+
excluded_fields: Set[str] = set([
|
|
81
|
+
])
|
|
82
|
+
|
|
83
|
+
_dict = self.model_dump(
|
|
84
|
+
by_alias=True,
|
|
85
|
+
exclude=excluded_fields,
|
|
86
|
+
exclude_none=True,
|
|
87
|
+
)
|
|
88
|
+
# override the default output from pydantic by calling `to_dict()` of affiliates_highlighted_label
|
|
89
|
+
if self.affiliates_highlighted_label:
|
|
90
|
+
_dict['affiliates_highlighted_label'] = self.affiliates_highlighted_label.to_dict()
|
|
91
|
+
return _dict
|
|
92
|
+
|
|
93
|
+
@classmethod
|
|
94
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
95
|
+
"""Create an instance of VerifiedAvatarUser from a dict"""
|
|
96
|
+
if obj is None:
|
|
97
|
+
return None
|
|
98
|
+
|
|
99
|
+
if not isinstance(obj, dict):
|
|
100
|
+
return cls.model_validate(obj)
|
|
101
|
+
|
|
102
|
+
_obj = cls.model_validate({
|
|
103
|
+
"__typename": obj.get("__typename"),
|
|
104
|
+
"affiliates_highlighted_label": AffiliatesHighlightedLabel.from_dict(obj["affiliates_highlighted_label"]) if obj.get("affiliates_highlighted_label") is not None else None,
|
|
105
|
+
"is_blue_verified": obj.get("is_blue_verified"),
|
|
106
|
+
"profile_image_shape": obj.get("profile_image_shape"),
|
|
107
|
+
"rest_id": obj.get("rest_id"),
|
|
108
|
+
"verification": obj.get("verification")
|
|
109
|
+
})
|
|
110
|
+
return _obj
|
|
111
|
+
|
|
112
|
+
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Twitter OpenAPI
|
|
5
|
+
|
|
6
|
+
Twitter OpenAPI(Swagger) specification
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1
|
|
9
|
+
Contact: yuki@yuki0311.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.verified_avatar_user import VerifiedAvatarUser
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class VerifiedAvatarUserResults(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
VerifiedAvatarUserResults
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
result: VerifiedAvatarUser
|
|
33
|
+
__properties: ClassVar[List[str]] = ["result"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
validate_by_name=True,
|
|
37
|
+
validate_by_alias=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of VerifiedAvatarUserResults from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of result
|
|
75
|
+
if self.result:
|
|
76
|
+
_dict['result'] = self.result.to_dict()
|
|
77
|
+
return _dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of VerifiedAvatarUserResults from a dict"""
|
|
82
|
+
if obj is None:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
if not isinstance(obj, dict):
|
|
86
|
+
return cls.model_validate(obj)
|
|
87
|
+
|
|
88
|
+
_obj = cls.model_validate({
|
|
89
|
+
"result": VerifiedAvatarUser.from_dict(obj["result"]) if obj.get("result") is not None else None
|
|
90
|
+
})
|
|
91
|
+
return _obj
|
|
92
|
+
|
|
93
|
+
|