twitter-openapi-python-generated 0.0.27__py3-none-any.whl → 0.0.29__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 +16 -1
- twitter_openapi_python_generated/api/tweet_api.py +17 -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 +15 -0
- twitter_openapi_python_generated/models/community_data.py +24 -15
- twitter_openapi_python_generated/models/content_item_type.py +1 -0
- twitter_openapi_python_generated/models/feedback_info.py +7 -1
- twitter_openapi_python_generated/models/grok_share_attachment.py +96 -0
- twitter_openapi_python_generated/models/grok_share_attachment_item.py +90 -0
- twitter_openapi_python_generated/models/item_content_union.py +27 -8
- twitter_openapi_python_generated/models/limited_action_results_data.py +95 -0
- twitter_openapi_python_generated/models/timeline_timeline_module.py +6 -2
- twitter_openapi_python_generated/models/timeline_tombstone.py +110 -0
- twitter_openapi_python_generated/models/timeline_tweet.py +4 -2
- twitter_openapi_python_generated/models/tombstone_entity.py +96 -0
- twitter_openapi_python_generated/models/tombstone_info.py +94 -0
- twitter_openapi_python_generated/models/tombstone_ref.py +112 -0
- twitter_openapi_python_generated/models/tombstone_rich_text.py +100 -0
- twitter_openapi_python_generated/models/trend_results.py +96 -0
- twitter_openapi_python_generated/models/tweet.py +17 -1
- twitter_openapi_python_generated/models/tweet_limited_action_results.py +96 -0
- twitter_openapi_python_generated/models/tweet_preview_display.py +107 -0
- twitter_openapi_python_generated/models/tweet_preview_display_cta.py +94 -0
- twitter_openapi_python_generated/models/tweet_preview_display_cta_url.py +97 -0
- twitter_openapi_python_generated/models/tweet_preview_display_tweet.py +131 -0
- twitter_openapi_python_generated/models/tweet_preview_display_tweet_view_count.py +96 -0
- twitter_openapi_python_generated/models/tweet_union.py +27 -8
- twitter_openapi_python_generated/models/type_name.py +2 -0
- twitter_openapi_python_generated/models/user.py +15 -1
- {twitter_openapi_python_generated-0.0.27.dist-info → twitter_openapi_python_generated-0.0.29.dist-info}/METADATA +6 -6
- {twitter_openapi_python_generated-0.0.27.dist-info → twitter_openapi_python_generated-0.0.29.dist-info}/RECORD +36 -21
- {twitter_openapi_python_generated-0.0.27.dist-info → twitter_openapi_python_generated-0.0.29.dist-info}/WHEEL +1 -1
- {twitter_openapi_python_generated-0.0.27.dist-info → twitter_openapi_python_generated-0.0.29.dist-info}/LICENSE +0 -0
- {twitter_openapi_python_generated-0.0.27.dist-info → twitter_openapi_python_generated-0.0.29.dist-info}/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.0.27.dist-info → twitter_openapi_python_generated-0.0.29.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, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing_extensions import Annotated
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class TrendResults(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
TrendResults
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
rest_id: Annotated[str, Field(strict=True)]
|
|
32
|
+
__properties: ClassVar[List[str]] = ["rest_id"]
|
|
33
|
+
|
|
34
|
+
@field_validator('rest_id')
|
|
35
|
+
def rest_id_validate_regular_expression(cls, value):
|
|
36
|
+
"""Validates the regular expression"""
|
|
37
|
+
if not re.match(r"^[0-9]+$", value):
|
|
38
|
+
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=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
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of TrendResults from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of TrendResults 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
|
+
"rest_id": obj.get("rest_id")
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -26,8 +26,10 @@ from twitter_openapi_python_generated.models.author_community_relationship impor
|
|
|
26
26
|
from twitter_openapi_python_generated.models.birdwatch_pivot import BirdwatchPivot
|
|
27
27
|
from twitter_openapi_python_generated.models.community import Community
|
|
28
28
|
from twitter_openapi_python_generated.models.community_relationship import CommunityRelationship
|
|
29
|
+
from twitter_openapi_python_generated.models.grok_share_attachment import GrokShareAttachment
|
|
29
30
|
from twitter_openapi_python_generated.models.note_tweet import NoteTweet
|
|
30
31
|
from twitter_openapi_python_generated.models.super_follows_reply_user_result import SuperFollowsReplyUserResult
|
|
32
|
+
from twitter_openapi_python_generated.models.trend_results import TrendResults
|
|
31
33
|
from twitter_openapi_python_generated.models.tweet_card import TweetCard
|
|
32
34
|
from twitter_openapi_python_generated.models.tweet_edit_control import TweetEditControl
|
|
33
35
|
from twitter_openapi_python_generated.models.tweet_edit_prespective import TweetEditPrespective
|
|
@@ -53,6 +55,9 @@ class Tweet(BaseModel):
|
|
|
53
55
|
core: Optional[UserResultCore] = None
|
|
54
56
|
edit_control: Optional[TweetEditControl] = None
|
|
55
57
|
edit_prespective: Optional[TweetEditPrespective] = None
|
|
58
|
+
grok_analysis_button: Optional[StrictBool] = None
|
|
59
|
+
grok_analysis_followups: Optional[List[StrictStr]] = None
|
|
60
|
+
grok_share_attachment: Optional[GrokShareAttachment] = None
|
|
56
61
|
has_birdwatch_notes: Optional[StrictBool] = None
|
|
57
62
|
is_translatable: Optional[StrictBool] = None
|
|
58
63
|
legacy: Optional[TweetLegacy] = None
|
|
@@ -64,10 +69,11 @@ class Tweet(BaseModel):
|
|
|
64
69
|
rest_id: Annotated[str, Field(strict=True)]
|
|
65
70
|
source: Optional[StrictStr] = None
|
|
66
71
|
super_follows_reply_user_result: Optional[SuperFollowsReplyUserResult] = Field(default=None, alias="superFollowsReplyUserResult")
|
|
72
|
+
trend_results: Optional[TrendResults] = None
|
|
67
73
|
unified_card: Optional[UnifiedCard] = None
|
|
68
74
|
unmention_data: Optional[Dict[str, Any]] = None
|
|
69
75
|
views: Optional[TweetView] = None
|
|
70
|
-
__properties: ClassVar[List[str]] = ["__typename", "article", "author_community_relationship", "birdwatch_pivot", "card", "community_relationship", "community_results", "core", "edit_control", "edit_prespective", "has_birdwatch_notes", "is_translatable", "legacy", "note_tweet", "previous_counts", "quick_promote_eligibility", "quotedRefResult", "quoted_status_result", "rest_id", "source", "superFollowsReplyUserResult", "unified_card", "unmention_data", "views"]
|
|
76
|
+
__properties: ClassVar[List[str]] = ["__typename", "article", "author_community_relationship", "birdwatch_pivot", "card", "community_relationship", "community_results", "core", "edit_control", "edit_prespective", "grok_analysis_button", "grok_analysis_followups", "grok_share_attachment", "has_birdwatch_notes", "is_translatable", "legacy", "note_tweet", "previous_counts", "quick_promote_eligibility", "quotedRefResult", "quoted_status_result", "rest_id", "source", "superFollowsReplyUserResult", "trend_results", "unified_card", "unmention_data", "views"]
|
|
71
77
|
|
|
72
78
|
@field_validator('rest_id')
|
|
73
79
|
def rest_id_validate_regular_expression(cls, value):
|
|
@@ -142,6 +148,9 @@ class Tweet(BaseModel):
|
|
|
142
148
|
# override the default output from pydantic by calling `to_dict()` of edit_prespective
|
|
143
149
|
if self.edit_prespective:
|
|
144
150
|
_dict['edit_prespective'] = self.edit_prespective.to_dict()
|
|
151
|
+
# override the default output from pydantic by calling `to_dict()` of grok_share_attachment
|
|
152
|
+
if self.grok_share_attachment:
|
|
153
|
+
_dict['grok_share_attachment'] = self.grok_share_attachment.to_dict()
|
|
145
154
|
# override the default output from pydantic by calling `to_dict()` of legacy
|
|
146
155
|
if self.legacy:
|
|
147
156
|
_dict['legacy'] = self.legacy.to_dict()
|
|
@@ -160,6 +169,9 @@ class Tweet(BaseModel):
|
|
|
160
169
|
# override the default output from pydantic by calling `to_dict()` of super_follows_reply_user_result
|
|
161
170
|
if self.super_follows_reply_user_result:
|
|
162
171
|
_dict['superFollowsReplyUserResult'] = self.super_follows_reply_user_result.to_dict()
|
|
172
|
+
# override the default output from pydantic by calling `to_dict()` of trend_results
|
|
173
|
+
if self.trend_results:
|
|
174
|
+
_dict['trend_results'] = self.trend_results.to_dict()
|
|
163
175
|
# override the default output from pydantic by calling `to_dict()` of unified_card
|
|
164
176
|
if self.unified_card:
|
|
165
177
|
_dict['unified_card'] = self.unified_card.to_dict()
|
|
@@ -188,6 +200,9 @@ class Tweet(BaseModel):
|
|
|
188
200
|
"core": UserResultCore.from_dict(obj["core"]) if obj.get("core") is not None else None,
|
|
189
201
|
"edit_control": TweetEditControl.from_dict(obj["edit_control"]) if obj.get("edit_control") is not None else None,
|
|
190
202
|
"edit_prespective": TweetEditPrespective.from_dict(obj["edit_prespective"]) if obj.get("edit_prespective") is not None else None,
|
|
203
|
+
"grok_analysis_button": obj.get("grok_analysis_button"),
|
|
204
|
+
"grok_analysis_followups": obj.get("grok_analysis_followups"),
|
|
205
|
+
"grok_share_attachment": GrokShareAttachment.from_dict(obj["grok_share_attachment"]) if obj.get("grok_share_attachment") is not None else None,
|
|
191
206
|
"has_birdwatch_notes": obj.get("has_birdwatch_notes"),
|
|
192
207
|
"is_translatable": obj.get("is_translatable"),
|
|
193
208
|
"legacy": TweetLegacy.from_dict(obj["legacy"]) if obj.get("legacy") is not None else None,
|
|
@@ -199,6 +214,7 @@ class Tweet(BaseModel):
|
|
|
199
214
|
"rest_id": obj.get("rest_id"),
|
|
200
215
|
"source": obj.get("source"),
|
|
201
216
|
"superFollowsReplyUserResult": SuperFollowsReplyUserResult.from_dict(obj["superFollowsReplyUserResult"]) if obj.get("superFollowsReplyUserResult") is not None else None,
|
|
217
|
+
"trend_results": TrendResults.from_dict(obj["trend_results"]) if obj.get("trend_results") is not None else None,
|
|
202
218
|
"unified_card": UnifiedCard.from_dict(obj["unified_card"]) if obj.get("unified_card") is not None else None,
|
|
203
219
|
"unmention_data": obj.get("unmention_data"),
|
|
204
220
|
"views": TweetView.from_dict(obj["views"]) if obj.get("views") is not None else None
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Twitter OpenAPI
|
|
5
|
+
|
|
6
|
+
Twitter OpenAPI(Swagger) specification
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1
|
|
9
|
+
Contact: yuki@yuki0311.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.limited_action_results_data import LimitedActionResultsData
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class TweetLimitedActionResults(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
TweetLimitedActionResults
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
limited_actions: List[LimitedActionResultsData]
|
|
32
|
+
__properties: ClassVar[List[str]] = ["limited_actions"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of TweetLimitedActionResults 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
|
+
# override the default output from pydantic by calling `to_dict()` of each item in limited_actions (list)
|
|
74
|
+
_items = []
|
|
75
|
+
if self.limited_actions:
|
|
76
|
+
for _item_limited_actions in self.limited_actions:
|
|
77
|
+
if _item_limited_actions:
|
|
78
|
+
_items.append(_item_limited_actions.to_dict())
|
|
79
|
+
_dict['limited_actions'] = _items
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of TweetLimitedActionResults 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
|
+
"limited_actions": [LimitedActionResultsData.from_dict(_item) for _item in obj["limited_actions"]] if obj.get("limited_actions") is not None else None
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -0,0 +1,107 @@
|
|
|
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.tweet_limited_action_results import TweetLimitedActionResults
|
|
24
|
+
from twitter_openapi_python_generated.models.tweet_preview_display_cta import TweetPreviewDisplayCta
|
|
25
|
+
from twitter_openapi_python_generated.models.tweet_preview_display_tweet import TweetPreviewDisplayTweet
|
|
26
|
+
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
27
|
+
from typing import Optional, Set
|
|
28
|
+
from typing_extensions import Self
|
|
29
|
+
|
|
30
|
+
class TweetPreviewDisplay(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
TweetPreviewDisplay
|
|
33
|
+
""" # noqa: E501
|
|
34
|
+
typename: TypeName = Field(alias="__typename")
|
|
35
|
+
cta: TweetPreviewDisplayCta
|
|
36
|
+
limited_action_results: TweetLimitedActionResults
|
|
37
|
+
tweet: TweetPreviewDisplayTweet
|
|
38
|
+
__properties: ClassVar[List[str]] = ["__typename", "cta", "limited_action_results", "tweet"]
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
populate_by_name=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
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
54
|
+
return json.dumps(self.to_dict())
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of TweetPreviewDisplay 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 cta
|
|
80
|
+
if self.cta:
|
|
81
|
+
_dict['cta'] = self.cta.to_dict()
|
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of limited_action_results
|
|
83
|
+
if self.limited_action_results:
|
|
84
|
+
_dict['limited_action_results'] = self.limited_action_results.to_dict()
|
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of tweet
|
|
86
|
+
if self.tweet:
|
|
87
|
+
_dict['tweet'] = self.tweet.to_dict()
|
|
88
|
+
return _dict
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
92
|
+
"""Create an instance of TweetPreviewDisplay from a dict"""
|
|
93
|
+
if obj is None:
|
|
94
|
+
return None
|
|
95
|
+
|
|
96
|
+
if not isinstance(obj, dict):
|
|
97
|
+
return cls.model_validate(obj)
|
|
98
|
+
|
|
99
|
+
_obj = cls.model_validate({
|
|
100
|
+
"__typename": obj.get("__typename"),
|
|
101
|
+
"cta": TweetPreviewDisplayCta.from_dict(obj["cta"]) if obj.get("cta") is not None else None,
|
|
102
|
+
"limited_action_results": TweetLimitedActionResults.from_dict(obj["limited_action_results"]) if obj.get("limited_action_results") is not None else None,
|
|
103
|
+
"tweet": TweetPreviewDisplayTweet.from_dict(obj["tweet"]) if obj.get("tweet") is not None else None
|
|
104
|
+
})
|
|
105
|
+
return _obj
|
|
106
|
+
|
|
107
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
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.tweet_preview_display_cta_url import TweetPreviewDisplayCtaUrl
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class TweetPreviewDisplayCta(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
TweetPreviewDisplayCta
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
title: StrictStr
|
|
32
|
+
url: TweetPreviewDisplayCtaUrl
|
|
33
|
+
__properties: ClassVar[List[str]] = ["title", "url"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=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
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of TweetPreviewDisplayCta 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 url
|
|
75
|
+
if self.url:
|
|
76
|
+
_dict['url'] = self.url.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 TweetPreviewDisplayCta 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
|
+
"title": obj.get("title"),
|
|
90
|
+
"url": TweetPreviewDisplayCtaUrl.from_dict(obj["url"]) if obj.get("url") is not None else None
|
|
91
|
+
})
|
|
92
|
+
return _obj
|
|
93
|
+
|
|
94
|
+
|
|
@@ -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, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class TweetPreviewDisplayCtaUrl(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
TweetPreviewDisplayCtaUrl
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
url: StrictStr
|
|
31
|
+
url_type: StrictStr = Field(alias="urlType")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["url", "urlType"]
|
|
33
|
+
|
|
34
|
+
@field_validator('url_type')
|
|
35
|
+
def url_type_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in set(['DeepLink', 'UrtEndpoint', 'ExternalUrl']):
|
|
38
|
+
raise ValueError("must be one of enum values ('DeepLink', 'UrtEndpoint', 'ExternalUrl')")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=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
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of TweetPreviewDisplayCtaUrl from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of TweetPreviewDisplayCtaUrl 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
|
+
"url": obj.get("url"),
|
|
93
|
+
"urlType": obj.get("urlType")
|
|
94
|
+
})
|
|
95
|
+
return _obj
|
|
96
|
+
|
|
97
|
+
|