twitter-openapi-python-generated 0.0.35__py3-none-any.whl → 0.1.1__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 +135 -9
- twitter_openapi_python_generated/api_client.py +1 -1
- twitter_openapi_python_generated/configuration.py +1 -1
- twitter_openapi_python_generated/models/__init__.py +67 -4
- twitter_openapi_python_generated/models/ad_metadata_container.py +104 -0
- twitter_openapi_python_generated/models/affiliates_highlighted_label.py +93 -0
- twitter_openapi_python_generated/models/api_image.py +108 -0
- twitter_openapi_python_generated/models/api_media.py +110 -0
- twitter_openapi_python_generated/models/article_cover_media_info.py +3 -3
- twitter_openapi_python_generated/models/birdwatch_pivot.py +2 -2
- twitter_openapi_python_generated/models/cashtag_info.py +93 -0
- twitter_openapi_python_generated/models/click_tracking_info.py +96 -0
- twitter_openapi_python_generated/models/client_event_info.py +6 -2
- twitter_openapi_python_generated/models/client_event_info_details.py +99 -0
- twitter_openapi_python_generated/models/community.py +20 -7
- twitter_openapi_python_generated/models/community_banner_media.py +95 -0
- twitter_openapi_python_generated/models/community_banner_media_info.py +108 -0
- twitter_openapi_python_generated/models/community_moderation_state.py +90 -0
- twitter_openapi_python_generated/models/community_relationship.py +6 -2
- twitter_openapi_python_generated/models/community_viewer_relationship.py +95 -0
- twitter_openapi_python_generated/models/conversation_control.py +10 -11
- twitter_openapi_python_generated/models/conversation_details.py +96 -0
- twitter_openapi_python_generated/models/conversation_metadata.py +92 -0
- twitter_openapi_python_generated/models/conversation_owner.py +96 -0
- twitter_openapi_python_generated/models/conversation_owner_core.py +89 -0
- twitter_openapi_python_generated/models/conversation_owner_results.py +93 -0
- twitter_openapi_python_generated/models/cta_limited_action_prompt.py +110 -0
- twitter_openapi_python_generated/models/cta_limited_action_prompt_text.py +91 -0
- twitter_openapi_python_generated/models/deepsearch_header.py +96 -0
- twitter_openapi_python_generated/models/deepsearch_step.py +99 -0
- twitter_openapi_python_generated/models/deepsearch_web_result.py +89 -0
- twitter_openapi_python_generated/models/entities.py +27 -6
- 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/feedback_action.py +136 -0
- twitter_openapi_python_generated/models/feedback_action_entry.py +95 -0
- twitter_openapi_python_generated/models/feedback_client_event_info.py +93 -0
- twitter_openapi_python_generated/models/feedback_info.py +8 -6
- twitter_openapi_python_generated/models/grok_share_attachment_item.py +9 -2
- twitter_openapi_python_generated/models/grouped_trend.py +95 -0
- twitter_openapi_python_generated/models/hashtag.py +91 -0
- twitter_openapi_python_generated/models/jetfuel_attachment.py +91 -0
- twitter_openapi_python_generated/models/key_value.py +91 -0
- twitter_openapi_python_generated/models/landing_url.py +98 -0
- twitter_openapi_python_generated/models/limited_action.py +95 -0
- twitter_openapi_python_generated/models/limited_action_results.py +96 -0
- twitter_openapi_python_generated/models/limited_action_results_data.py +1 -8
- twitter_openapi_python_generated/models/list_banner_media_info.py +3 -3
- twitter_openapi_python_generated/models/list_banner_media_results.py +93 -0
- twitter_openapi_python_generated/models/{article_cover_media_color_info.py → media_color_info.py} +7 -7
- twitter_openapi_python_generated/models/{article_cover_media_color_info_palette.py → media_color_info_palette.py} +7 -7
- twitter_openapi_python_generated/models/{article_cover_media_color_info_palette_rgb.py → media_color_info_palette_rgb.py} +4 -4
- twitter_openapi_python_generated/models/{list_banner_media_salient_rect.py → media_salient_rect.py} +4 -4
- twitter_openapi_python_generated/models/module_footer.py +104 -0
- twitter_openapi_python_generated/models/module_header.py +100 -0
- twitter_openapi_python_generated/models/module_metadata.py +93 -0
- twitter_openapi_python_generated/models/promoted_metadata.py +109 -0
- twitter_openapi_python_generated/models/reader_mode_config.py +89 -0
- twitter_openapi_python_generated/models/scribe_config.py +89 -0
- twitter_openapi_python_generated/models/search_timeline.py +2 -2
- twitter_openapi_python_generated/models/smarttag_tag.py +6 -2
- twitter_openapi_python_generated/models/smarttag_tag_info.py +93 -0
- twitter_openapi_python_generated/models/symbol.py +97 -0
- twitter_openapi_python_generated/models/timeline.py +12 -4
- twitter_openapi_python_generated/models/timeline_community.py +13 -17
- 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_metadata.py +99 -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_response_objects.py +96 -0
- twitter_openapi_python_generated/models/timeline_show_alert.py +18 -21
- twitter_openapi_python_generated/models/timeline_show_alert_color_config.py +93 -0
- twitter_openapi_python_generated/models/timeline_show_alert_icon_display_info.py +91 -0
- twitter_openapi_python_generated/models/timeline_show_alert_rich_text.py +3 -3
- twitter_openapi_python_generated/models/timeline_timeline_item.py +6 -2
- twitter_openapi_python_generated/models/timeline_timeline_module.py +18 -6
- twitter_openapi_python_generated/models/timeline_trend.py +10 -1
- twitter_openapi_python_generated/models/timeline_tweet.py +6 -2
- twitter_openapi_python_generated/models/timelines_details.py +93 -0
- twitter_openapi_python_generated/models/tweet.py +7 -1
- twitter_openapi_python_generated/models/tweet_card_legacy_binding_value_data.py +6 -2
- twitter_openapi_python_generated/models/tweet_legacy.py +6 -2
- twitter_openapi_python_generated/models/tweet_with_visibility_results.py +6 -2
- twitter_openapi_python_generated/models/twitter_list.py +17 -3
- twitter_openapi_python_generated/models/type_name.py +3 -0
- twitter_openapi_python_generated/models/user.py +6 -2
- twitter_openapi_python_generated/models/user_label.py +128 -0
- twitter_openapi_python_generated/models/user_label_badge.py +89 -0
- twitter_openapi_python_generated/models/user_label_mention_results.py +93 -0
- twitter_openapi_python_generated/models/user_label_mention_user.py +106 -0
- twitter_openapi_python_generated/models/user_label_mention_user_core.py +89 -0
- twitter_openapi_python_generated/models/user_label_text.py +98 -0
- twitter_openapi_python_generated/models/user_label_text_entity.py +97 -0
- twitter_openapi_python_generated/models/user_label_text_entity_ref.py +104 -0
- twitter_openapi_python_generated/models/user_label_url.py +98 -0
- twitter_openapi_python_generated/models/user_legacy.py +6 -2
- twitter_openapi_python_generated/models/user_mention.py +115 -0
- twitter_openapi_python_generated/models/user_professional.py +7 -2
- {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/METADATA +72 -9
- {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/RECORD +111 -48
- {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/WHEEL +0 -0
- {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/licenses/LICENSE +0 -0
- {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/licenses/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/top_level.txt +0 -0
|
@@ -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, Optional
|
|
23
|
+
from twitter_openapi_python_generated.models.cashtag_info import CashtagInfo
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class SmarttagTagInfo(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
SmarttagTagInfo
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
info: Optional[CashtagInfo] = None
|
|
33
|
+
__properties: ClassVar[List[str]] = ["info"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
validate_by_name=True,
|
|
37
|
+
validate_by_alias=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of SmarttagTagInfo 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 info
|
|
75
|
+
if self.info:
|
|
76
|
+
_dict['info'] = self.info.to_dict()
|
|
77
|
+
return _dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of SmarttagTagInfo 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
|
+
"info": CashtagInfo.from_dict(obj["info"]) if obj.get("info") is not None else None
|
|
90
|
+
})
|
|
91
|
+
return _obj
|
|
92
|
+
|
|
93
|
+
|
|
@@ -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, StrictInt, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from twitter_openapi_python_generated.models.smarttag_tag import SmarttagTag
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class Symbol(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
Symbol
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
indices: List[StrictInt]
|
|
33
|
+
tag: Optional[SmarttagTag] = None
|
|
34
|
+
text: StrictStr
|
|
35
|
+
__properties: ClassVar[List[str]] = ["indices", "tag", "text"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
validate_by_name=True,
|
|
39
|
+
validate_by_alias=True,
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def to_str(self) -> str:
|
|
46
|
+
"""Returns the string representation of the model using alias"""
|
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> str:
|
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
|
51
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
+
"""Create an instance of Symbol from a JSON string"""
|
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
|
57
|
+
|
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
|
60
|
+
|
|
61
|
+
This has the following differences from calling pydantic's
|
|
62
|
+
`self.model_dump(by_alias=True)`:
|
|
63
|
+
|
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
|
65
|
+
were set at model initialization. Other fields with value `None`
|
|
66
|
+
are ignored.
|
|
67
|
+
"""
|
|
68
|
+
excluded_fields: Set[str] = set([
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
_dict = self.model_dump(
|
|
72
|
+
by_alias=True,
|
|
73
|
+
exclude=excluded_fields,
|
|
74
|
+
exclude_none=True,
|
|
75
|
+
)
|
|
76
|
+
# override the default output from pydantic by calling `to_dict()` of tag
|
|
77
|
+
if self.tag:
|
|
78
|
+
_dict['tag'] = self.tag.to_dict()
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of Symbol from a dict"""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(obj, dict):
|
|
88
|
+
return cls.model_validate(obj)
|
|
89
|
+
|
|
90
|
+
_obj = cls.model_validate({
|
|
91
|
+
"indices": obj.get("indices"),
|
|
92
|
+
"tag": SmarttagTag.from_dict(obj["tag"]) if obj.get("tag") is not None else None,
|
|
93
|
+
"text": obj.get("text")
|
|
94
|
+
})
|
|
95
|
+
return _obj
|
|
96
|
+
|
|
97
|
+
|
|
@@ -21,6 +21,8 @@ import json
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from twitter_openapi_python_generated.models.instruction_union import InstructionUnion
|
|
24
|
+
from twitter_openapi_python_generated.models.timeline_metadata import TimelineMetadata
|
|
25
|
+
from twitter_openapi_python_generated.models.timeline_response_objects import TimelineResponseObjects
|
|
24
26
|
from typing import Optional, Set
|
|
25
27
|
from typing_extensions import Self
|
|
26
28
|
from pydantic_core import to_jsonable_python
|
|
@@ -30,8 +32,8 @@ class Timeline(BaseModel):
|
|
|
30
32
|
Timeline
|
|
31
33
|
""" # noqa: E501
|
|
32
34
|
instructions: List[InstructionUnion]
|
|
33
|
-
metadata: Optional[
|
|
34
|
-
response_objects: Optional[
|
|
35
|
+
metadata: Optional[TimelineMetadata] = None
|
|
36
|
+
response_objects: Optional[TimelineResponseObjects] = Field(default=None, alias="responseObjects")
|
|
35
37
|
__properties: ClassVar[List[str]] = ["instructions", "metadata", "responseObjects"]
|
|
36
38
|
|
|
37
39
|
model_config = ConfigDict(
|
|
@@ -79,6 +81,12 @@ class Timeline(BaseModel):
|
|
|
79
81
|
for _item_instructions in self.instructions:
|
|
80
82
|
_items.append(_item_instructions.to_dict() if _item_instructions is not None else None)
|
|
81
83
|
_dict['instructions'] = _items
|
|
84
|
+
# override the default output from pydantic by calling `to_dict()` of metadata
|
|
85
|
+
if self.metadata:
|
|
86
|
+
_dict['metadata'] = self.metadata.to_dict()
|
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of response_objects
|
|
88
|
+
if self.response_objects:
|
|
89
|
+
_dict['responseObjects'] = self.response_objects.to_dict()
|
|
82
90
|
return _dict
|
|
83
91
|
|
|
84
92
|
@classmethod
|
|
@@ -92,8 +100,8 @@ class Timeline(BaseModel):
|
|
|
92
100
|
|
|
93
101
|
_obj = cls.model_validate({
|
|
94
102
|
"instructions": [InstructionUnion.from_dict(_item) for _item in obj["instructions"]] if obj.get("instructions") is not None else None,
|
|
95
|
-
"metadata": obj.get("metadata"),
|
|
96
|
-
"responseObjects": obj.get("responseObjects")
|
|
103
|
+
"metadata": TimelineMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None,
|
|
104
|
+
"responseObjects": TimelineResponseObjects.from_dict(obj["responseObjects"]) if obj.get("responseObjects") is not None else None
|
|
97
105
|
})
|
|
98
106
|
return _obj
|
|
99
107
|
|
|
@@ -19,7 +19,9 @@ import re # noqa: F401
|
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.community_result import CommunityResult
|
|
24
|
+
from twitter_openapi_python_generated.models.content_item_type import ContentItemType
|
|
23
25
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
24
26
|
from typing import Optional, Set
|
|
25
27
|
from typing_extensions import Self
|
|
@@ -29,9 +31,10 @@ class TimelineCommunity(BaseModel):
|
|
|
29
31
|
"""
|
|
30
32
|
TimelineCommunity
|
|
31
33
|
""" # noqa: E501
|
|
32
|
-
typename:
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
typename: TypeName = Field(alias="__typename")
|
|
35
|
+
community_results: CommunityResult
|
|
36
|
+
item_type: ContentItemType = Field(alias="itemType")
|
|
37
|
+
__properties: ClassVar[List[str]] = ["__typename", "community_results", "itemType"]
|
|
35
38
|
|
|
36
39
|
model_config = ConfigDict(
|
|
37
40
|
validate_by_name=True,
|
|
@@ -63,10 +66,8 @@ class TimelineCommunity(BaseModel):
|
|
|
63
66
|
* `None` is only added to the output dict for nullable fields that
|
|
64
67
|
were set at model initialization. Other fields with value `None`
|
|
65
68
|
are ignored.
|
|
66
|
-
* Fields in `self.additional_properties` are added to the output dict.
|
|
67
69
|
"""
|
|
68
70
|
excluded_fields: Set[str] = set([
|
|
69
|
-
"additional_properties",
|
|
70
71
|
])
|
|
71
72
|
|
|
72
73
|
_dict = self.model_dump(
|
|
@@ -74,11 +75,9 @@ class TimelineCommunity(BaseModel):
|
|
|
74
75
|
exclude=excluded_fields,
|
|
75
76
|
exclude_none=True,
|
|
76
77
|
)
|
|
77
|
-
#
|
|
78
|
-
if self.
|
|
79
|
-
|
|
80
|
-
_dict[_key] = _value
|
|
81
|
-
|
|
78
|
+
# override the default output from pydantic by calling `to_dict()` of community_results
|
|
79
|
+
if self.community_results:
|
|
80
|
+
_dict['community_results'] = self.community_results.to_dict()
|
|
82
81
|
return _dict
|
|
83
82
|
|
|
84
83
|
@classmethod
|
|
@@ -91,13 +90,10 @@ class TimelineCommunity(BaseModel):
|
|
|
91
90
|
return cls.model_validate(obj)
|
|
92
91
|
|
|
93
92
|
_obj = cls.model_validate({
|
|
94
|
-
"__typename": obj.get("__typename")
|
|
93
|
+
"__typename": obj.get("__typename"),
|
|
94
|
+
"community_results": CommunityResult.from_dict(obj["community_results"]) if obj.get("community_results") is not None else None,
|
|
95
|
+
"itemType": obj.get("itemType")
|
|
95
96
|
})
|
|
96
|
-
# store additional fields in additional_properties
|
|
97
|
-
for _key in obj.keys():
|
|
98
|
-
if _key not in cls.__properties:
|
|
99
|
-
_obj.additional_properties[_key] = obj.get(_key)
|
|
100
|
-
|
|
101
97
|
return _obj
|
|
102
98
|
|
|
103
99
|
|
|
@@ -19,7 +19,9 @@ import re # noqa: F401
|
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
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.timeline_message_prompt_content import TimelineMessagePromptContent
|
|
23
25
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
24
26
|
from typing import Optional, Set
|
|
25
27
|
from typing_extensions import Self
|
|
@@ -29,9 +31,10 @@ class TimelineMessagePrompt(BaseModel):
|
|
|
29
31
|
"""
|
|
30
32
|
TimelineMessagePrompt
|
|
31
33
|
""" # noqa: E501
|
|
32
|
-
typename:
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
typename: TypeName = Field(alias="__typename")
|
|
35
|
+
content: TimelineMessagePromptContent
|
|
36
|
+
item_type: ContentItemType = Field(alias="itemType")
|
|
37
|
+
__properties: ClassVar[List[str]] = ["__typename", "content", "itemType"]
|
|
35
38
|
|
|
36
39
|
model_config = ConfigDict(
|
|
37
40
|
validate_by_name=True,
|
|
@@ -63,10 +66,8 @@ class TimelineMessagePrompt(BaseModel):
|
|
|
63
66
|
* `None` is only added to the output dict for nullable fields that
|
|
64
67
|
were set at model initialization. Other fields with value `None`
|
|
65
68
|
are ignored.
|
|
66
|
-
* Fields in `self.additional_properties` are added to the output dict.
|
|
67
69
|
"""
|
|
68
70
|
excluded_fields: Set[str] = set([
|
|
69
|
-
"additional_properties",
|
|
70
71
|
])
|
|
71
72
|
|
|
72
73
|
_dict = self.model_dump(
|
|
@@ -74,11 +75,9 @@ class TimelineMessagePrompt(BaseModel):
|
|
|
74
75
|
exclude=excluded_fields,
|
|
75
76
|
exclude_none=True,
|
|
76
77
|
)
|
|
77
|
-
#
|
|
78
|
-
if self.
|
|
79
|
-
|
|
80
|
-
_dict[_key] = _value
|
|
81
|
-
|
|
78
|
+
# override the default output from pydantic by calling `to_dict()` of content
|
|
79
|
+
if self.content:
|
|
80
|
+
_dict['content'] = self.content.to_dict()
|
|
82
81
|
return _dict
|
|
83
82
|
|
|
84
83
|
@classmethod
|
|
@@ -91,13 +90,10 @@ class TimelineMessagePrompt(BaseModel):
|
|
|
91
90
|
return cls.model_validate(obj)
|
|
92
91
|
|
|
93
92
|
_obj = cls.model_validate({
|
|
94
|
-
"__typename": obj.get("__typename")
|
|
93
|
+
"__typename": obj.get("__typename"),
|
|
94
|
+
"content": TimelineMessagePromptContent.from_dict(obj["content"]) if obj.get("content") is not None else None,
|
|
95
|
+
"itemType": obj.get("itemType")
|
|
95
96
|
})
|
|
96
|
-
# store additional fields in additional_properties
|
|
97
|
-
for _key in obj.keys():
|
|
98
|
-
if _key not in cls.__properties:
|
|
99
|
-
_obj.additional_properties[_key] = obj.get(_key)
|
|
100
|
-
|
|
101
97
|
return _obj
|
|
102
98
|
|
|
103
99
|
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Twitter OpenAPI
|
|
5
|
+
|
|
6
|
+
Twitter OpenAPI(Swagger) specification
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1
|
|
9
|
+
Contact: yuki@yuki0311.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_button_action import TimelineMessagePromptButtonAction
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class TimelineMessagePromptButton(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
TimelineMessagePromptButton
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
action: TimelineMessagePromptButtonAction
|
|
33
|
+
text: StrictStr
|
|
34
|
+
__properties: ClassVar[List[str]] = ["action", "text"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
validate_by_name=True,
|
|
38
|
+
validate_by_alias=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def to_str(self) -> str:
|
|
45
|
+
"""Returns the string representation of the model using alias"""
|
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
47
|
+
|
|
48
|
+
def to_json(self) -> str:
|
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
|
50
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of TimelineMessagePromptButton from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of action
|
|
76
|
+
if self.action:
|
|
77
|
+
_dict['action'] = self.action.to_dict()
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of TimelineMessagePromptButton 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
|
+
"action": TimelineMessagePromptButtonAction.from_dict(obj["action"]) if obj.get("action") is not None else None,
|
|
91
|
+
"text": obj.get("text")
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
|
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 TimelineMessagePromptButtonAction(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
TimelineMessagePromptButtonAction
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
dismiss_on_click: StrictBool = Field(alias="dismissOnClick")
|
|
32
|
+
url: StrictStr
|
|
33
|
+
__properties: ClassVar[List[str]] = ["dismissOnClick", "url"]
|
|
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 TimelineMessagePromptButtonAction 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
|
+
return _dict
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
78
|
+
"""Create an instance of TimelineMessagePromptButtonAction from a dict"""
|
|
79
|
+
if obj is None:
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
if not isinstance(obj, dict):
|
|
83
|
+
return cls.model_validate(obj)
|
|
84
|
+
|
|
85
|
+
_obj = cls.model_validate({
|
|
86
|
+
"dismissOnClick": obj.get("dismissOnClick"),
|
|
87
|
+
"url": obj.get("url")
|
|
88
|
+
})
|
|
89
|
+
return _obj
|
|
90
|
+
|
|
91
|
+
|
|
@@ -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, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_button import TimelineMessagePromptButton
|
|
24
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_rich_text import TimelineMessagePromptRichText
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
from pydantic_core import to_jsonable_python
|
|
28
|
+
|
|
29
|
+
class TimelineMessagePromptContent(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
TimelineMessagePromptContent
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
body_rich_text: Optional[TimelineMessagePromptRichText] = Field(default=None, alias="bodyRichText")
|
|
34
|
+
body_text: Optional[StrictStr] = Field(default=None, alias="bodyText")
|
|
35
|
+
content_type: StrictStr = Field(alias="contentType")
|
|
36
|
+
header_text: StrictStr = Field(alias="headerText")
|
|
37
|
+
primary_button_action: Optional[TimelineMessagePromptButton] = Field(default=None, alias="primaryButtonAction")
|
|
38
|
+
__properties: ClassVar[List[str]] = ["bodyRichText", "bodyText", "contentType", "headerText", "primaryButtonAction"]
|
|
39
|
+
|
|
40
|
+
@field_validator('content_type')
|
|
41
|
+
def content_type_validate_enum(cls, value):
|
|
42
|
+
"""Validates the enum"""
|
|
43
|
+
if value not in set(['TimelineInlinePrompt', 'TimelineCompactPrompt']):
|
|
44
|
+
raise ValueError("must be one of enum values ('TimelineInlinePrompt', 'TimelineCompactPrompt')")
|
|
45
|
+
return value
|
|
46
|
+
|
|
47
|
+
model_config = ConfigDict(
|
|
48
|
+
validate_by_name=True,
|
|
49
|
+
validate_by_alias=True,
|
|
50
|
+
validate_assignment=True,
|
|
51
|
+
protected_namespaces=(),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def to_str(self) -> str:
|
|
56
|
+
"""Returns the string representation of the model using alias"""
|
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
58
|
+
|
|
59
|
+
def to_json(self) -> str:
|
|
60
|
+
"""Returns the JSON representation of the model using alias"""
|
|
61
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
65
|
+
"""Create an instance of TimelineMessagePromptContent from a JSON string"""
|
|
66
|
+
return cls.from_dict(json.loads(json_str))
|
|
67
|
+
|
|
68
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
69
|
+
"""Return the dictionary representation of the model using alias.
|
|
70
|
+
|
|
71
|
+
This has the following differences from calling pydantic's
|
|
72
|
+
`self.model_dump(by_alias=True)`:
|
|
73
|
+
|
|
74
|
+
* `None` is only added to the output dict for nullable fields that
|
|
75
|
+
were set at model initialization. Other fields with value `None`
|
|
76
|
+
are ignored.
|
|
77
|
+
"""
|
|
78
|
+
excluded_fields: Set[str] = set([
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
_dict = self.model_dump(
|
|
82
|
+
by_alias=True,
|
|
83
|
+
exclude=excluded_fields,
|
|
84
|
+
exclude_none=True,
|
|
85
|
+
)
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of body_rich_text
|
|
87
|
+
if self.body_rich_text:
|
|
88
|
+
_dict['bodyRichText'] = self.body_rich_text.to_dict()
|
|
89
|
+
# override the default output from pydantic by calling `to_dict()` of primary_button_action
|
|
90
|
+
if self.primary_button_action:
|
|
91
|
+
_dict['primaryButtonAction'] = self.primary_button_action.to_dict()
|
|
92
|
+
return _dict
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
96
|
+
"""Create an instance of TimelineMessagePromptContent from a dict"""
|
|
97
|
+
if obj is None:
|
|
98
|
+
return None
|
|
99
|
+
|
|
100
|
+
if not isinstance(obj, dict):
|
|
101
|
+
return cls.model_validate(obj)
|
|
102
|
+
|
|
103
|
+
_obj = cls.model_validate({
|
|
104
|
+
"bodyRichText": TimelineMessagePromptRichText.from_dict(obj["bodyRichText"]) if obj.get("bodyRichText") is not None else None,
|
|
105
|
+
"bodyText": obj.get("bodyText"),
|
|
106
|
+
"contentType": obj.get("contentType"),
|
|
107
|
+
"headerText": obj.get("headerText"),
|
|
108
|
+
"primaryButtonAction": TimelineMessagePromptButton.from_dict(obj["primaryButtonAction"]) if obj.get("primaryButtonAction") is not None else None
|
|
109
|
+
})
|
|
110
|
+
return _obj
|
|
111
|
+
|
|
112
|
+
|