twitter-openapi-python-generated 0.0.16__py3-none-any.whl → 0.0.18__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 +3 -3
- twitter_openapi_python_generated/api/default_api.py +12 -10
- twitter_openapi_python_generated/api/other_api.py +6 -5
- twitter_openapi_python_generated/api/post_api.py +48 -40
- twitter_openapi_python_generated/api/tweet_api.py +66 -55
- twitter_openapi_python_generated/api/user_api.py +12 -10
- twitter_openapi_python_generated/api/user_list_api.py +30 -25
- twitter_openapi_python_generated/api/users_api.py +6 -5
- twitter_openapi_python_generated/api_client.py +28 -10
- twitter_openapi_python_generated/configuration.py +22 -4
- twitter_openapi_python_generated/models/__init__.py +2 -2
- twitter_openapi_python_generated/models/allow_download_status.py +2 -2
- twitter_openapi_python_generated/models/article_cover_media_color_info.py +3 -3
- twitter_openapi_python_generated/models/birdwatch_pivot_footer.py +3 -3
- twitter_openapi_python_generated/models/birdwatch_pivot_subtitle.py +3 -3
- twitter_openapi_python_generated/models/community_data.py +6 -6
- twitter_openapi_python_generated/models/cover_cta.py +3 -3
- twitter_openapi_python_generated/models/delete_retweet.py +3 -3
- twitter_openapi_python_generated/models/entities.py +9 -9
- twitter_openapi_python_generated/models/error.py +5 -5
- twitter_openapi_python_generated/models/error_extensions.py +2 -2
- twitter_openapi_python_generated/models/errors.py +3 -3
- twitter_openapi_python_generated/models/extended_entities.py +3 -3
- twitter_openapi_python_generated/models/highlight.py +3 -3
- twitter_openapi_python_generated/models/media_original_info.py +3 -3
- twitter_openapi_python_generated/models/media_video_info.py +3 -3
- twitter_openapi_python_generated/models/note_tweet_result_media.py +3 -3
- twitter_openapi_python_generated/models/note_tweet_result_rich_text.py +3 -3
- twitter_openapi_python_generated/models/post_create_tweet_request.py +1 -1
- twitter_openapi_python_generated/models/post_create_tweet_request_features.py +9 -5
- twitter_openapi_python_generated/models/post_create_tweet_request_variables.py +3 -1
- twitter_openapi_python_generated/models/post_create_tweet_request_variables_media.py +3 -3
- twitter_openapi_python_generated/models/post_favorite_tweet_request.py +3 -3
- twitter_openapi_python_generated/models/sensitive_media_warning.py +3 -3
- twitter_openapi_python_generated/models/text.py +3 -3
- twitter_openapi_python_generated/models/timeline.py +3 -3
- twitter_openapi_python_generated/models/timeline_add_entries.py +3 -3
- twitter_openapi_python_generated/models/timeline_add_to_module.py +3 -3
- twitter_openapi_python_generated/models/timeline_cover_behavior.py +11 -5
- twitter_openapi_python_generated/models/{extensions.py → timeline_cover_behavior_url.py} +17 -20
- twitter_openapi_python_generated/models/timeline_half_cover.py +3 -3
- twitter_openapi_python_generated/models/timeline_show_alert.py +3 -3
- twitter_openapi_python_generated/models/timeline_timeline_cursor.py +2 -2
- twitter_openapi_python_generated/models/timeline_timeline_module.py +3 -3
- twitter_openapi_python_generated/models/timeline_v2.py +2 -2
- twitter_openapi_python_generated/models/tweet.py +9 -3
- twitter_openapi_python_generated/models/tweet_card_legacy.py +6 -6
- twitter_openapi_python_generated/models/tweet_interstitial_reveal_text.py +3 -3
- twitter_openapi_python_generated/models/tweet_interstitial_text.py +3 -3
- twitter_openapi_python_generated/models/tweet_legacy.py +4 -4
- twitter_openapi_python_generated/models/{error_response.py → tweet_unavailable.py} +12 -13
- twitter_openapi_python_generated/models/tweet_union.py +27 -8
- twitter_openapi_python_generated/models/urt_endpoint_options.py +3 -3
- twitter_openapi_python_generated/models/user.py +14 -10
- twitter_openapi_python_generated/models/user_legacy.py +34 -34
- twitter_openapi_python_generated/models/user_professional.py +3 -3
- twitter_openapi_python_generated/models/user_tip_jar_settings.py +3 -1
- twitter_openapi_python_generated/models/user_verification_info.py +1 -1
- twitter_openapi_python_generated/models/user_verification_info_reason_description.py +3 -3
- twitter_openapi_python_generated/models/users_response_data.py +3 -3
- {twitter_openapi_python_generated-0.0.16.dist-info → twitter_openapi_python_generated-0.0.18.dist-info}/METADATA +5 -5
- {twitter_openapi_python_generated-0.0.16.dist-info → twitter_openapi_python_generated-0.0.18.dist-info}/RECORD +66 -66
- {twitter_openapi_python_generated-0.0.16.dist-info → twitter_openapi_python_generated-0.0.18.dist-info}/WHEEL +1 -1
- {twitter_openapi_python_generated-0.0.16.dist-info → twitter_openapi_python_generated-0.0.18.dist-info}/LICENSE +0 -0
- {twitter_openapi_python_generated-0.0.16.dist-info → twitter_openapi_python_generated-0.0.18.dist-info}/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.0.16.dist-info → twitter_openapi_python_generated-0.0.18.dist-info}/top_level.txt +0 -0
|
@@ -20,7 +20,7 @@ import json
|
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List
|
|
23
|
-
from twitter_openapi_python_generated.models.
|
|
23
|
+
from twitter_openapi_python_generated.models.post_create_bookmark_request_variables import PostCreateBookmarkRequestVariables
|
|
24
24
|
from typing import Optional, Set
|
|
25
25
|
from typing_extensions import Self
|
|
26
26
|
|
|
@@ -29,7 +29,7 @@ class PostFavoriteTweetRequest(BaseModel):
|
|
|
29
29
|
PostFavoriteTweetRequest
|
|
30
30
|
""" # noqa: E501
|
|
31
31
|
query_id: StrictStr = Field(alias="queryId")
|
|
32
|
-
variables:
|
|
32
|
+
variables: PostCreateBookmarkRequestVariables
|
|
33
33
|
__properties: ClassVar[List[str]] = ["queryId", "variables"]
|
|
34
34
|
|
|
35
35
|
model_config = ConfigDict(
|
|
@@ -87,7 +87,7 @@ class PostFavoriteTweetRequest(BaseModel):
|
|
|
87
87
|
|
|
88
88
|
_obj = cls.model_validate({
|
|
89
89
|
"queryId": obj.get("queryId") if obj.get("queryId") is not None else 'lI07N6Otwv1PhnEgXILM7A',
|
|
90
|
-
"variables":
|
|
90
|
+
"variables": PostCreateBookmarkRequestVariables.from_dict(obj["variables"]) if obj.get("variables") is not None else None
|
|
91
91
|
})
|
|
92
92
|
return _obj
|
|
93
93
|
|
|
@@ -83,9 +83,9 @@ class SensitiveMediaWarning(BaseModel):
|
|
|
83
83
|
return cls.model_validate(obj)
|
|
84
84
|
|
|
85
85
|
_obj = cls.model_validate({
|
|
86
|
-
"adult_content": obj.get("adult_content")
|
|
87
|
-
"graphic_violence": obj.get("graphic_violence")
|
|
88
|
-
"other": obj.get("other")
|
|
86
|
+
"adult_content": obj.get("adult_content"),
|
|
87
|
+
"graphic_violence": obj.get("graphic_violence"),
|
|
88
|
+
"other": obj.get("other")
|
|
89
89
|
})
|
|
90
90
|
return _obj
|
|
91
91
|
|
|
@@ -74,9 +74,9 @@ class Text(BaseModel):
|
|
|
74
74
|
# override the default output from pydantic by calling `to_dict()` of each item in entities (list)
|
|
75
75
|
_items = []
|
|
76
76
|
if self.entities:
|
|
77
|
-
for
|
|
78
|
-
if
|
|
79
|
-
_items.append(
|
|
77
|
+
for _item_entities in self.entities:
|
|
78
|
+
if _item_entities:
|
|
79
|
+
_items.append(_item_entities.to_dict())
|
|
80
80
|
_dict['entities'] = _items
|
|
81
81
|
return _dict
|
|
82
82
|
|
|
@@ -75,9 +75,9 @@ class Timeline(BaseModel):
|
|
|
75
75
|
# override the default output from pydantic by calling `to_dict()` of each item in instructions (list)
|
|
76
76
|
_items = []
|
|
77
77
|
if self.instructions:
|
|
78
|
-
for
|
|
79
|
-
if
|
|
80
|
-
_items.append(
|
|
78
|
+
for _item_instructions in self.instructions:
|
|
79
|
+
if _item_instructions:
|
|
80
|
+
_items.append(_item_instructions.to_dict())
|
|
81
81
|
_dict['instructions'] = _items
|
|
82
82
|
return _dict
|
|
83
83
|
|
|
@@ -75,9 +75,9 @@ class TimelineAddEntries(BaseModel):
|
|
|
75
75
|
# override the default output from pydantic by calling `to_dict()` of each item in entries (list)
|
|
76
76
|
_items = []
|
|
77
77
|
if self.entries:
|
|
78
|
-
for
|
|
79
|
-
if
|
|
80
|
-
_items.append(
|
|
78
|
+
for _item_entries in self.entries:
|
|
79
|
+
if _item_entries:
|
|
80
|
+
_items.append(_item_entries.to_dict())
|
|
81
81
|
_dict['entries'] = _items
|
|
82
82
|
return _dict
|
|
83
83
|
|
|
@@ -77,9 +77,9 @@ class TimelineAddToModule(BaseModel):
|
|
|
77
77
|
# override the default output from pydantic by calling `to_dict()` of each item in module_items (list)
|
|
78
78
|
_items = []
|
|
79
79
|
if self.module_items:
|
|
80
|
-
for
|
|
81
|
-
if
|
|
82
|
-
_items.append(
|
|
80
|
+
for _item_module_items in self.module_items:
|
|
81
|
+
if _item_module_items:
|
|
82
|
+
_items.append(_item_module_items.to_dict())
|
|
83
83
|
_dict['moduleItems'] = _items
|
|
84
84
|
return _dict
|
|
85
85
|
|
|
@@ -19,7 +19,8 @@ import re # noqa: F401
|
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from twitter_openapi_python_generated.models.timeline_cover_behavior_url import TimelineCoverBehaviorUrl
|
|
23
24
|
from typing import Optional, Set
|
|
24
25
|
from typing_extensions import Self
|
|
25
26
|
|
|
@@ -28,13 +29,14 @@ class TimelineCoverBehavior(BaseModel):
|
|
|
28
29
|
TimelineCoverBehavior
|
|
29
30
|
""" # noqa: E501
|
|
30
31
|
type: StrictStr
|
|
31
|
-
|
|
32
|
+
url: Optional[TimelineCoverBehaviorUrl] = None
|
|
33
|
+
__properties: ClassVar[List[str]] = ["type", "url"]
|
|
32
34
|
|
|
33
35
|
@field_validator('type')
|
|
34
36
|
def type_validate_enum(cls, value):
|
|
35
37
|
"""Validates the enum"""
|
|
36
|
-
if value not in set(['TimelineCoverBehaviorDismiss']):
|
|
37
|
-
raise ValueError("must be one of enum values ('TimelineCoverBehaviorDismiss')")
|
|
38
|
+
if value not in set(['TimelineCoverBehaviorDismiss', 'TimelineCoverBehaviorNavigate']):
|
|
39
|
+
raise ValueError("must be one of enum values ('TimelineCoverBehaviorDismiss', 'TimelineCoverBehaviorNavigate')")
|
|
38
40
|
return value
|
|
39
41
|
|
|
40
42
|
model_config = ConfigDict(
|
|
@@ -76,6 +78,9 @@ class TimelineCoverBehavior(BaseModel):
|
|
|
76
78
|
exclude=excluded_fields,
|
|
77
79
|
exclude_none=True,
|
|
78
80
|
)
|
|
81
|
+
# override the default output from pydantic by calling `to_dict()` of url
|
|
82
|
+
if self.url:
|
|
83
|
+
_dict['url'] = self.url.to_dict()
|
|
79
84
|
return _dict
|
|
80
85
|
|
|
81
86
|
@classmethod
|
|
@@ -88,7 +93,8 @@ class TimelineCoverBehavior(BaseModel):
|
|
|
88
93
|
return cls.model_validate(obj)
|
|
89
94
|
|
|
90
95
|
_obj = cls.model_validate({
|
|
91
|
-
"type": obj.get("type")
|
|
96
|
+
"type": obj.get("type"),
|
|
97
|
+
"url": TimelineCoverBehaviorUrl.from_dict(obj["url"]) if obj.get("url") is not None else None
|
|
92
98
|
})
|
|
93
99
|
return _obj
|
|
94
100
|
|
|
@@ -18,22 +18,25 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
from pydantic import BaseModel, ConfigDict,
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
|
|
22
22
|
from typing import Any, ClassVar, Dict, List
|
|
23
|
-
from twitter_openapi_python_generated.models.tracing import Tracing
|
|
24
23
|
from typing import Optional, Set
|
|
25
24
|
from typing_extensions import Self
|
|
26
25
|
|
|
27
|
-
class
|
|
26
|
+
class TimelineCoverBehaviorUrl(BaseModel):
|
|
28
27
|
"""
|
|
29
|
-
|
|
28
|
+
TimelineCoverBehaviorUrl
|
|
30
29
|
""" # noqa: E501
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
url: StrictStr
|
|
31
|
+
url_type: StrictStr
|
|
32
|
+
__properties: ClassVar[List[str]] = ["url", "url_type"]
|
|
33
|
+
|
|
34
|
+
@field_validator('url_type')
|
|
35
|
+
def url_type_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in set(['ExternalUrl']):
|
|
38
|
+
raise ValueError("must be one of enum values ('ExternalUrl')")
|
|
39
|
+
return value
|
|
37
40
|
|
|
38
41
|
model_config = ConfigDict(
|
|
39
42
|
populate_by_name=True,
|
|
@@ -53,7 +56,7 @@ class Extensions(BaseModel):
|
|
|
53
56
|
|
|
54
57
|
@classmethod
|
|
55
58
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
56
|
-
"""Create an instance of
|
|
59
|
+
"""Create an instance of TimelineCoverBehaviorUrl from a JSON string"""
|
|
57
60
|
return cls.from_dict(json.loads(json_str))
|
|
58
61
|
|
|
59
62
|
def to_dict(self) -> Dict[str, Any]:
|
|
@@ -74,14 +77,11 @@ class Extensions(BaseModel):
|
|
|
74
77
|
exclude=excluded_fields,
|
|
75
78
|
exclude_none=True,
|
|
76
79
|
)
|
|
77
|
-
# override the default output from pydantic by calling `to_dict()` of tracing
|
|
78
|
-
if self.tracing:
|
|
79
|
-
_dict['tracing'] = self.tracing.to_dict()
|
|
80
80
|
return _dict
|
|
81
81
|
|
|
82
82
|
@classmethod
|
|
83
83
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
-
"""Create an instance of
|
|
84
|
+
"""Create an instance of TimelineCoverBehaviorUrl from a dict"""
|
|
85
85
|
if obj is None:
|
|
86
86
|
return None
|
|
87
87
|
|
|
@@ -89,11 +89,8 @@ class Extensions(BaseModel):
|
|
|
89
89
|
return cls.model_validate(obj)
|
|
90
90
|
|
|
91
91
|
_obj = cls.model_validate({
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"name": obj.get("name"),
|
|
95
|
-
"source": obj.get("source"),
|
|
96
|
-
"tracing": Tracing.from_dict(obj["tracing"]) if obj.get("tracing") is not None else None
|
|
92
|
+
"url": obj.get("url"),
|
|
93
|
+
"url_type": obj.get("url_type")
|
|
97
94
|
})
|
|
98
95
|
return _obj
|
|
99
96
|
|
|
@@ -95,9 +95,9 @@ class TimelineHalfCover(BaseModel):
|
|
|
95
95
|
# override the default output from pydantic by calling `to_dict()` of each item in impression_callbacks (list)
|
|
96
96
|
_items = []
|
|
97
97
|
if self.impression_callbacks:
|
|
98
|
-
for
|
|
99
|
-
if
|
|
100
|
-
_items.append(
|
|
98
|
+
for _item_impression_callbacks in self.impression_callbacks:
|
|
99
|
+
if _item_impression_callbacks:
|
|
100
|
+
_items.append(_item_impression_callbacks.to_dict())
|
|
101
101
|
_dict['impressionCallbacks'] = _items
|
|
102
102
|
# override the default output from pydantic by calling `to_dict()` of primary_cover_cta
|
|
103
103
|
if self.primary_cover_cta:
|
|
@@ -106,9 +106,9 @@ class TimelineShowAlert(BaseModel):
|
|
|
106
106
|
# override the default output from pydantic by calling `to_dict()` of each item in users_results (list)
|
|
107
107
|
_items = []
|
|
108
108
|
if self.users_results:
|
|
109
|
-
for
|
|
110
|
-
if
|
|
111
|
-
_items.append(
|
|
109
|
+
for _item_users_results in self.users_results:
|
|
110
|
+
if _item_users_results:
|
|
111
|
+
_items.append(_item_users_results.to_dict())
|
|
112
112
|
_dict['usersResults'] = _items
|
|
113
113
|
return _dict
|
|
114
114
|
|
|
@@ -36,7 +36,7 @@ class TimelineTimelineCursor(BaseModel):
|
|
|
36
36
|
display_treatment: Optional[DisplayTreatment] = Field(default=None, alias="displayTreatment")
|
|
37
37
|
entry_type: Optional[ContentEntryType] = Field(default=None, alias="entryType")
|
|
38
38
|
item_type: Optional[ContentEntryType] = Field(default=None, alias="itemType")
|
|
39
|
-
stop_on_empty_response: StrictBool = Field(alias="stopOnEmptyResponse")
|
|
39
|
+
stop_on_empty_response: Optional[StrictBool] = Field(default=None, alias="stopOnEmptyResponse")
|
|
40
40
|
value: StrictStr
|
|
41
41
|
__properties: ClassVar[List[str]] = ["__typename", "cursorType", "displayTreatment", "entryType", "itemType", "stopOnEmptyResponse", "value"]
|
|
42
42
|
|
|
@@ -99,7 +99,7 @@ class TimelineTimelineCursor(BaseModel):
|
|
|
99
99
|
"displayTreatment": DisplayTreatment.from_dict(obj["displayTreatment"]) if obj.get("displayTreatment") is not None else None,
|
|
100
100
|
"entryType": obj.get("entryType"),
|
|
101
101
|
"itemType": obj.get("itemType"),
|
|
102
|
-
"stopOnEmptyResponse": obj.get("stopOnEmptyResponse")
|
|
102
|
+
"stopOnEmptyResponse": obj.get("stopOnEmptyResponse"),
|
|
103
103
|
"value": obj.get("value")
|
|
104
104
|
})
|
|
105
105
|
return _obj
|
|
@@ -87,9 +87,9 @@ class TimelineTimelineModule(BaseModel):
|
|
|
87
87
|
# override the default output from pydantic by calling `to_dict()` of each item in items (list)
|
|
88
88
|
_items = []
|
|
89
89
|
if self.items:
|
|
90
|
-
for
|
|
91
|
-
if
|
|
92
|
-
_items.append(
|
|
90
|
+
for _item_items in self.items:
|
|
91
|
+
if _item_items:
|
|
92
|
+
_items.append(_item_items.to_dict())
|
|
93
93
|
_dict['items'] = _items
|
|
94
94
|
return _dict
|
|
95
95
|
|
|
@@ -19,7 +19,7 @@ import re # noqa: F401
|
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from twitter_openapi_python_generated.models.timeline import Timeline
|
|
24
24
|
from typing import Optional, Set
|
|
25
25
|
from typing_extensions import Self
|
|
@@ -28,7 +28,7 @@ class TimelineV2(BaseModel):
|
|
|
28
28
|
"""
|
|
29
29
|
TimelineV2
|
|
30
30
|
""" # noqa: E501
|
|
31
|
-
timeline: Timeline
|
|
31
|
+
timeline: Optional[Timeline] = None
|
|
32
32
|
__properties: ClassVar[List[str]] = ["timeline"]
|
|
33
33
|
|
|
34
34
|
model_config = ConfigDict(
|
|
@@ -24,6 +24,7 @@ from typing_extensions import Annotated
|
|
|
24
24
|
from twitter_openapi_python_generated.models.article import Article
|
|
25
25
|
from twitter_openapi_python_generated.models.author_community_relationship import AuthorCommunityRelationship
|
|
26
26
|
from twitter_openapi_python_generated.models.birdwatch_pivot import BirdwatchPivot
|
|
27
|
+
from twitter_openapi_python_generated.models.community import Community
|
|
27
28
|
from twitter_openapi_python_generated.models.note_tweet import NoteTweet
|
|
28
29
|
from twitter_openapi_python_generated.models.super_follows_reply_user_result import SuperFollowsReplyUserResult
|
|
29
30
|
from twitter_openapi_python_generated.models.tweet_card import TweetCard
|
|
@@ -46,11 +47,12 @@ class Tweet(BaseModel):
|
|
|
46
47
|
author_community_relationship: Optional[AuthorCommunityRelationship] = None
|
|
47
48
|
birdwatch_pivot: Optional[BirdwatchPivot] = None
|
|
48
49
|
card: Optional[TweetCard] = None
|
|
50
|
+
community_results: Optional[Community] = None
|
|
49
51
|
core: Optional[UserResultCore] = None
|
|
50
52
|
edit_control: Optional[TweetEditControl] = None
|
|
51
53
|
edit_prespective: Optional[TweetEditPrespective] = None
|
|
52
54
|
has_birdwatch_notes: Optional[StrictBool] = None
|
|
53
|
-
is_translatable: Optional[StrictBool] =
|
|
55
|
+
is_translatable: Optional[StrictBool] = None
|
|
54
56
|
legacy: Optional[TweetLegacy] = None
|
|
55
57
|
note_tweet: Optional[NoteTweet] = None
|
|
56
58
|
previous_counts: Optional[TweetPreviousCounts] = None
|
|
@@ -63,7 +65,7 @@ class Tweet(BaseModel):
|
|
|
63
65
|
unified_card: Optional[UnifiedCard] = None
|
|
64
66
|
unmention_data: Optional[Dict[str, Any]] = None
|
|
65
67
|
views: Optional[TweetView] = None
|
|
66
|
-
__properties: ClassVar[List[str]] = ["__typename", "article", "author_community_relationship", "birdwatch_pivot", "card", "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"]
|
|
68
|
+
__properties: ClassVar[List[str]] = ["__typename", "article", "author_community_relationship", "birdwatch_pivot", "card", "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"]
|
|
67
69
|
|
|
68
70
|
@field_validator('rest_id')
|
|
69
71
|
def rest_id_validate_regular_expression(cls, value):
|
|
@@ -123,6 +125,9 @@ class Tweet(BaseModel):
|
|
|
123
125
|
# override the default output from pydantic by calling `to_dict()` of card
|
|
124
126
|
if self.card:
|
|
125
127
|
_dict['card'] = self.card.to_dict()
|
|
128
|
+
# override the default output from pydantic by calling `to_dict()` of community_results
|
|
129
|
+
if self.community_results:
|
|
130
|
+
_dict['community_results'] = self.community_results.to_dict()
|
|
126
131
|
# override the default output from pydantic by calling `to_dict()` of core
|
|
127
132
|
if self.core:
|
|
128
133
|
_dict['core'] = self.core.to_dict()
|
|
@@ -173,11 +178,12 @@ class Tweet(BaseModel):
|
|
|
173
178
|
"author_community_relationship": AuthorCommunityRelationship.from_dict(obj["author_community_relationship"]) if obj.get("author_community_relationship") is not None else None,
|
|
174
179
|
"birdwatch_pivot": BirdwatchPivot.from_dict(obj["birdwatch_pivot"]) if obj.get("birdwatch_pivot") is not None else None,
|
|
175
180
|
"card": TweetCard.from_dict(obj["card"]) if obj.get("card") is not None else None,
|
|
181
|
+
"community_results": Community.from_dict(obj["community_results"]) if obj.get("community_results") is not None else None,
|
|
176
182
|
"core": UserResultCore.from_dict(obj["core"]) if obj.get("core") is not None else None,
|
|
177
183
|
"edit_control": TweetEditControl.from_dict(obj["edit_control"]) if obj.get("edit_control") is not None else None,
|
|
178
184
|
"edit_prespective": TweetEditPrespective.from_dict(obj["edit_prespective"]) if obj.get("edit_prespective") is not None else None,
|
|
179
185
|
"has_birdwatch_notes": obj.get("has_birdwatch_notes"),
|
|
180
|
-
"is_translatable": obj.get("is_translatable")
|
|
186
|
+
"is_translatable": obj.get("is_translatable"),
|
|
181
187
|
"legacy": TweetLegacy.from_dict(obj["legacy"]) if obj.get("legacy") is not None else None,
|
|
182
188
|
"note_tweet": NoteTweet.from_dict(obj["note_tweet"]) if obj.get("note_tweet") is not None else None,
|
|
183
189
|
"previous_counts": TweetPreviousCounts.from_dict(obj["previous_counts"]) if obj.get("previous_counts") is not None else None,
|
|
@@ -79,9 +79,9 @@ class TweetCardLegacy(BaseModel):
|
|
|
79
79
|
# override the default output from pydantic by calling `to_dict()` of each item in binding_values (list)
|
|
80
80
|
_items = []
|
|
81
81
|
if self.binding_values:
|
|
82
|
-
for
|
|
83
|
-
if
|
|
84
|
-
_items.append(
|
|
82
|
+
for _item_binding_values in self.binding_values:
|
|
83
|
+
if _item_binding_values:
|
|
84
|
+
_items.append(_item_binding_values.to_dict())
|
|
85
85
|
_dict['binding_values'] = _items
|
|
86
86
|
# override the default output from pydantic by calling `to_dict()` of card_platform
|
|
87
87
|
if self.card_platform:
|
|
@@ -89,9 +89,9 @@ class TweetCardLegacy(BaseModel):
|
|
|
89
89
|
# override the default output from pydantic by calling `to_dict()` of each item in user_refs_results (list)
|
|
90
90
|
_items = []
|
|
91
91
|
if self.user_refs_results:
|
|
92
|
-
for
|
|
93
|
-
if
|
|
94
|
-
_items.append(
|
|
92
|
+
for _item_user_refs_results in self.user_refs_results:
|
|
93
|
+
if _item_user_refs_results:
|
|
94
|
+
_items.append(_item_user_refs_results.to_dict())
|
|
95
95
|
_dict['user_refs_results'] = _items
|
|
96
96
|
return _dict
|
|
97
97
|
|
|
@@ -75,9 +75,9 @@ class TweetInterstitialRevealText(BaseModel):
|
|
|
75
75
|
# override the default output from pydantic by calling `to_dict()` of each item in entities (list)
|
|
76
76
|
_items = []
|
|
77
77
|
if self.entities:
|
|
78
|
-
for
|
|
79
|
-
if
|
|
80
|
-
_items.append(
|
|
78
|
+
for _item_entities in self.entities:
|
|
79
|
+
if _item_entities:
|
|
80
|
+
_items.append(_item_entities.to_dict())
|
|
81
81
|
_dict['entities'] = _items
|
|
82
82
|
return _dict
|
|
83
83
|
|
|
@@ -75,9 +75,9 @@ class TweetInterstitialText(BaseModel):
|
|
|
75
75
|
# override the default output from pydantic by calling `to_dict()` of each item in entities (list)
|
|
76
76
|
_items = []
|
|
77
77
|
if self.entities:
|
|
78
|
-
for
|
|
79
|
-
if
|
|
80
|
-
_items.append(
|
|
78
|
+
for _item_entities in self.entities:
|
|
79
|
+
if _item_entities:
|
|
80
|
+
_items.append(_item_entities.to_dict())
|
|
81
81
|
_dict['entities'] = _items
|
|
82
82
|
return _dict
|
|
83
83
|
|
|
@@ -52,8 +52,8 @@ class TweetLegacy(BaseModel):
|
|
|
52
52
|
lang: StrictStr
|
|
53
53
|
limited_actions: Optional[StrictStr] = None
|
|
54
54
|
place: Optional[Dict[str, Any]] = None
|
|
55
|
-
possibly_sensitive: Optional[StrictBool] =
|
|
56
|
-
possibly_sensitive_editable: Optional[StrictBool] =
|
|
55
|
+
possibly_sensitive: Optional[StrictBool] = None
|
|
56
|
+
possibly_sensitive_editable: Optional[StrictBool] = None
|
|
57
57
|
quote_count: StrictInt
|
|
58
58
|
quoted_status_id_str: Optional[Annotated[str, Field(strict=True)]] = None
|
|
59
59
|
quoted_status_permalink: Optional[QuotedStatusPermalink] = None
|
|
@@ -222,8 +222,8 @@ class TweetLegacy(BaseModel):
|
|
|
222
222
|
"lang": obj.get("lang"),
|
|
223
223
|
"limited_actions": obj.get("limited_actions"),
|
|
224
224
|
"place": obj.get("place"),
|
|
225
|
-
"possibly_sensitive": obj.get("possibly_sensitive")
|
|
226
|
-
"possibly_sensitive_editable": obj.get("possibly_sensitive_editable")
|
|
225
|
+
"possibly_sensitive": obj.get("possibly_sensitive"),
|
|
226
|
+
"possibly_sensitive_editable": obj.get("possibly_sensitive_editable"),
|
|
227
227
|
"quote_count": obj.get("quote_count"),
|
|
228
228
|
"quoted_status_id_str": obj.get("quoted_status_id_str"),
|
|
229
229
|
"quoted_status_permalink": QuotedStatusPermalink.from_dict(obj["quoted_status_permalink"]) if obj.get("quoted_status_permalink") is not None else None,
|
|
@@ -18,18 +18,19 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
from pydantic import BaseModel, ConfigDict
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
23
|
-
from twitter_openapi_python_generated.models.
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
24
24
|
from typing import Optional, Set
|
|
25
25
|
from typing_extensions import Self
|
|
26
26
|
|
|
27
|
-
class
|
|
27
|
+
class TweetUnavailable(BaseModel):
|
|
28
28
|
"""
|
|
29
|
-
|
|
29
|
+
TweetUnavailable
|
|
30
30
|
""" # noqa: E501
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
typename: Optional[TypeName] = Field(default=None, alias="__typename")
|
|
32
|
+
reason: Optional[StrictStr] = None
|
|
33
|
+
__properties: ClassVar[List[str]] = ["__typename", "reason"]
|
|
33
34
|
|
|
34
35
|
model_config = ConfigDict(
|
|
35
36
|
populate_by_name=True,
|
|
@@ -49,7 +50,7 @@ class ErrorResponse(BaseModel):
|
|
|
49
50
|
|
|
50
51
|
@classmethod
|
|
51
52
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
-
"""Create an instance of
|
|
53
|
+
"""Create an instance of TweetUnavailable from a JSON string"""
|
|
53
54
|
return cls.from_dict(json.loads(json_str))
|
|
54
55
|
|
|
55
56
|
def to_dict(self) -> Dict[str, Any]:
|
|
@@ -70,14 +71,11 @@ class ErrorResponse(BaseModel):
|
|
|
70
71
|
exclude=excluded_fields,
|
|
71
72
|
exclude_none=True,
|
|
72
73
|
)
|
|
73
|
-
# override the default output from pydantic by calling `to_dict()` of errors
|
|
74
|
-
if self.errors:
|
|
75
|
-
_dict['errors'] = self.errors.to_dict()
|
|
76
74
|
return _dict
|
|
77
75
|
|
|
78
76
|
@classmethod
|
|
79
77
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
-
"""Create an instance of
|
|
78
|
+
"""Create an instance of TweetUnavailable from a dict"""
|
|
81
79
|
if obj is None:
|
|
82
80
|
return None
|
|
83
81
|
|
|
@@ -85,7 +83,8 @@ class ErrorResponse(BaseModel):
|
|
|
85
83
|
return cls.model_validate(obj)
|
|
86
84
|
|
|
87
85
|
_obj = cls.model_validate({
|
|
88
|
-
"
|
|
86
|
+
"__typename": obj.get("__typename"),
|
|
87
|
+
"reason": obj.get("reason")
|
|
89
88
|
})
|
|
90
89
|
return _obj
|
|
91
90
|
|
|
@@ -19,11 +19,12 @@ import pprint
|
|
|
19
19
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
20
20
|
from typing import Any, List, Optional
|
|
21
21
|
from twitter_openapi_python_generated.models.tweet_tombstone import TweetTombstone
|
|
22
|
+
from twitter_openapi_python_generated.models.tweet_unavailable import TweetUnavailable
|
|
22
23
|
from pydantic import StrictStr, Field
|
|
23
24
|
from typing import Union, List, Set, Optional, Dict
|
|
24
25
|
from typing_extensions import Literal, Self
|
|
25
26
|
|
|
26
|
-
TWEETUNION_ONE_OF_SCHEMAS = ["Tweet", "TweetTombstone", "TweetWithVisibilityResults"]
|
|
27
|
+
TWEETUNION_ONE_OF_SCHEMAS = ["Tweet", "TweetTombstone", "TweetUnavailable", "TweetWithVisibilityResults"]
|
|
27
28
|
|
|
28
29
|
class TweetUnion(BaseModel):
|
|
29
30
|
"""
|
|
@@ -35,8 +36,10 @@ class TweetUnion(BaseModel):
|
|
|
35
36
|
oneof_schema_2_validator: Optional[TweetWithVisibilityResults] = None
|
|
36
37
|
# data type: TweetTombstone
|
|
37
38
|
oneof_schema_3_validator: Optional[TweetTombstone] = None
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
# data type: TweetUnavailable
|
|
40
|
+
oneof_schema_4_validator: Optional[TweetUnavailable] = None
|
|
41
|
+
actual_instance: Optional[Union[Tweet, TweetTombstone, TweetUnavailable, TweetWithVisibilityResults]] = None
|
|
42
|
+
one_of_schemas: Set[str] = { "Tweet", "TweetTombstone", "TweetUnavailable", "TweetWithVisibilityResults" }
|
|
40
43
|
|
|
41
44
|
model_config = ConfigDict(
|
|
42
45
|
validate_assignment=True,
|
|
@@ -77,12 +80,17 @@ class TweetUnion(BaseModel):
|
|
|
77
80
|
error_messages.append(f"Error! Input type `{type(v)}` is not `TweetTombstone`")
|
|
78
81
|
else:
|
|
79
82
|
match += 1
|
|
83
|
+
# validate data type: TweetUnavailable
|
|
84
|
+
if not isinstance(v, TweetUnavailable):
|
|
85
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TweetUnavailable`")
|
|
86
|
+
else:
|
|
87
|
+
match += 1
|
|
80
88
|
if match > 1:
|
|
81
89
|
# more than 1 match
|
|
82
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in TweetUnion with oneOf schemas: Tweet, TweetTombstone, TweetWithVisibilityResults. Details: " + ", ".join(error_messages))
|
|
90
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in TweetUnion with oneOf schemas: Tweet, TweetTombstone, TweetUnavailable, TweetWithVisibilityResults. Details: " + ", ".join(error_messages))
|
|
83
91
|
elif match == 0:
|
|
84
92
|
# no match
|
|
85
|
-
raise ValueError("No match found when setting `actual_instance` in TweetUnion with oneOf schemas: Tweet, TweetTombstone, TweetWithVisibilityResults. Details: " + ", ".join(error_messages))
|
|
93
|
+
raise ValueError("No match found when setting `actual_instance` in TweetUnion with oneOf schemas: Tweet, TweetTombstone, TweetUnavailable, TweetWithVisibilityResults. Details: " + ", ".join(error_messages))
|
|
86
94
|
else:
|
|
87
95
|
return v
|
|
88
96
|
|
|
@@ -112,6 +120,11 @@ class TweetUnion(BaseModel):
|
|
|
112
120
|
instance.actual_instance = TweetTombstone.from_json(json_str)
|
|
113
121
|
return instance
|
|
114
122
|
|
|
123
|
+
# check if data type is `TweetUnavailable`
|
|
124
|
+
if _data_type == "TweetUnavailable":
|
|
125
|
+
instance.actual_instance = TweetUnavailable.from_json(json_str)
|
|
126
|
+
return instance
|
|
127
|
+
|
|
115
128
|
# check if data type is `TweetWithVisibilityResults`
|
|
116
129
|
if _data_type == "TweetWithVisibilityResults":
|
|
117
130
|
instance.actual_instance = TweetWithVisibilityResults.from_json(json_str)
|
|
@@ -135,13 +148,19 @@ class TweetUnion(BaseModel):
|
|
|
135
148
|
match += 1
|
|
136
149
|
except (ValidationError, ValueError) as e:
|
|
137
150
|
error_messages.append(str(e))
|
|
151
|
+
# deserialize data into TweetUnavailable
|
|
152
|
+
try:
|
|
153
|
+
instance.actual_instance = TweetUnavailable.from_json(json_str)
|
|
154
|
+
match += 1
|
|
155
|
+
except (ValidationError, ValueError) as e:
|
|
156
|
+
error_messages.append(str(e))
|
|
138
157
|
|
|
139
158
|
if match > 1:
|
|
140
159
|
# more than 1 match
|
|
141
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into TweetUnion with oneOf schemas: Tweet, TweetTombstone, TweetWithVisibilityResults. Details: " + ", ".join(error_messages))
|
|
160
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into TweetUnion with oneOf schemas: Tweet, TweetTombstone, TweetUnavailable, TweetWithVisibilityResults. Details: " + ", ".join(error_messages))
|
|
142
161
|
elif match == 0:
|
|
143
162
|
# no match
|
|
144
|
-
raise ValueError("No match found when deserializing the JSON string into TweetUnion with oneOf schemas: Tweet, TweetTombstone, TweetWithVisibilityResults. Details: " + ", ".join(error_messages))
|
|
163
|
+
raise ValueError("No match found when deserializing the JSON string into TweetUnion with oneOf schemas: Tweet, TweetTombstone, TweetUnavailable, TweetWithVisibilityResults. Details: " + ", ".join(error_messages))
|
|
145
164
|
else:
|
|
146
165
|
return instance
|
|
147
166
|
|
|
@@ -155,7 +174,7 @@ class TweetUnion(BaseModel):
|
|
|
155
174
|
else:
|
|
156
175
|
return json.dumps(self.actual_instance)
|
|
157
176
|
|
|
158
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], Tweet, TweetTombstone, TweetWithVisibilityResults]]:
|
|
177
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], Tweet, TweetTombstone, TweetUnavailable, TweetWithVisibilityResults]]:
|
|
159
178
|
"""Returns the dict representation of the actual instance"""
|
|
160
179
|
if self.actual_instance is None:
|
|
161
180
|
return None
|
|
@@ -74,9 +74,9 @@ class UrtEndpointOptions(BaseModel):
|
|
|
74
74
|
# override the default output from pydantic by calling `to_dict()` of each item in request_params (list)
|
|
75
75
|
_items = []
|
|
76
76
|
if self.request_params:
|
|
77
|
-
for
|
|
78
|
-
if
|
|
79
|
-
_items.append(
|
|
77
|
+
for _item_request_params in self.request_params:
|
|
78
|
+
if _item_request_params:
|
|
79
|
+
_items.append(_item_request_params.to_dict())
|
|
80
80
|
_dict['requestParams'] = _items
|
|
81
81
|
return _dict
|
|
82
82
|
|