twitter-openapi-python-generated 0.0.15__py3-none-any.whl → 0.0.17__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 +22 -3
- twitter_openapi_python_generated/api/default_api.py +35 -16
- twitter_openapi_python_generated/api/other_api.py +9 -8
- twitter_openapi_python_generated/api/post_api.py +737 -115
- twitter_openapi_python_generated/api/tweet_api.py +99 -88
- twitter_openapi_python_generated/api/user_api.py +18 -16
- twitter_openapi_python_generated/api/user_list_api.py +45 -40
- twitter_openapi_python_generated/api/users_api.py +9 -8
- twitter_openapi_python_generated/api/v11_get_api.py +6 -6
- twitter_openapi_python_generated/api/v11_post_api.py +6 -6
- twitter_openapi_python_generated/api/v20_get_api.py +3 -3
- twitter_openapi_python_generated/api_client.py +59 -29
- twitter_openapi_python_generated/configuration.py +35 -17
- twitter_openapi_python_generated/models/__init__.py +21 -2
- twitter_openapi_python_generated/models/allow_download_status.py +88 -0
- twitter_openapi_python_generated/models/article_cover_media_color_info.py +3 -3
- twitter_openapi_python_generated/models/article_lifecycle_state.py +88 -0
- twitter_openapi_python_generated/models/article_metadata.py +88 -0
- twitter_openapi_python_generated/models/article_result.py +14 -2
- 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/content_union.py +2 -2
- twitter_openapi_python_generated/models/cover_cta.py +3 -3
- twitter_openapi_python_generated/models/{extensions.py → create_bookmark_response.py} +12 -20
- twitter_openapi_python_generated/models/create_bookmark_response_data.py +88 -0
- twitter_openapi_python_generated/models/delete_bookmark_response.py +92 -0
- twitter_openapi_python_generated/models/delete_bookmark_response_data.py +88 -0
- 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/get_bookmarks200_response.py +2 -2
- twitter_openapi_python_generated/models/get_favoriters200_response.py +2 -2
- twitter_openapi_python_generated/models/get_followers200_response.py +2 -2
- twitter_openapi_python_generated/models/get_home_latest_timeline200_response.py +2 -2
- twitter_openapi_python_generated/models/get_likes200_response.py +2 -2
- twitter_openapi_python_generated/models/get_list_latest_tweets_timeline200_response.py +2 -2
- twitter_openapi_python_generated/models/get_profile_spotlights_query200_response.py +2 -2
- twitter_openapi_python_generated/models/get_retweeters200_response.py +2 -2
- twitter_openapi_python_generated/models/get_search_timeline200_response.py +2 -2
- twitter_openapi_python_generated/models/get_tweet_detail200_response.py +2 -2
- twitter_openapi_python_generated/models/get_tweet_result_by_rest_id200_response.py +2 -2
- twitter_openapi_python_generated/models/get_user_by_rest_id200_response.py +2 -2
- twitter_openapi_python_generated/models/get_user_highlights_tweets200_response.py +2 -2
- twitter_openapi_python_generated/models/get_users_by_rest_ids200_response.py +2 -2
- twitter_openapi_python_generated/models/highlight.py +3 -3
- twitter_openapi_python_generated/models/instruction_union.py +2 -2
- twitter_openapi_python_generated/models/item_content_union.py +2 -2
- twitter_openapi_python_generated/models/media.py +25 -5
- twitter_openapi_python_generated/models/media_extended.py +13 -1
- twitter_openapi_python_generated/models/media_original_info.py +3 -3
- twitter_openapi_python_generated/models/media_result.py +88 -0
- twitter_openapi_python_generated/models/{error_response.py → media_results.py} +11 -11
- twitter_openapi_python_generated/models/media_video_info.py +3 -3
- twitter_openapi_python_generated/models/media_visibility_results.py +92 -0
- twitter_openapi_python_generated/models/media_visibility_results_blurred_image_interstitial.py +99 -0
- 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/other200_response.py +2 -2
- twitter_openapi_python_generated/models/post_create_bookmark200_response.py +138 -0
- twitter_openapi_python_generated/models/post_create_bookmark_request.py +94 -0
- twitter_openapi_python_generated/models/post_create_bookmark_request_variables.py +88 -0
- twitter_openapi_python_generated/models/post_create_retweet200_response.py +2 -2
- twitter_openapi_python_generated/models/post_create_tweet200_response.py +2 -2
- 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_delete_bookmark200_response.py +138 -0
- twitter_openapi_python_generated/models/post_delete_bookmark_request.py +94 -0
- twitter_openapi_python_generated/models/post_delete_retweet200_response.py +2 -2
- twitter_openapi_python_generated/models/post_delete_tweet200_response.py +2 -2
- twitter_openapi_python_generated/models/post_favorite_tweet200_response.py +2 -2
- twitter_openapi_python_generated/models/post_favorite_tweet_request.py +3 -3
- twitter_openapi_python_generated/models/post_unfavorite_tweet200_response.py +2 -2
- twitter_openapi_python_generated/models/sensitive_media_warning.py +3 -3
- twitter_openapi_python_generated/models/social_context_union.py +2 -2
- 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/timeline_cover_behavior_url.py +97 -0
- 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/tweet_unavailable.py +91 -0
- twitter_openapi_python_generated/models/tweet_union.py +28 -9
- twitter_openapi_python_generated/models/tweet_with_visibility_results.py +7 -1
- twitter_openapi_python_generated/models/url.py +2 -2
- twitter_openapi_python_generated/models/urt_endpoint_options.py +3 -3
- twitter_openapi_python_generated/models/user.py +26 -10
- twitter_openapi_python_generated/models/user_legacy.py +31 -31
- twitter_openapi_python_generated/models/user_legacy_extended_profile.py +92 -0
- twitter_openapi_python_generated/models/user_legacy_extended_profile_birthdate.py +110 -0
- twitter_openapi_python_generated/models/user_professional.py +3 -3
- twitter_openapi_python_generated/models/user_tip_jar_settings.py +102 -0
- twitter_openapi_python_generated/models/user_union.py +2 -2
- 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/rest.py +2 -0
- {twitter_openapi_python_generated-0.0.15.dist-info → twitter_openapi_python_generated-0.0.17.dist-info}/METADATA +5 -5
- {twitter_openapi_python_generated-0.0.15.dist-info → twitter_openapi_python_generated-0.0.17.dist-info}/RECORD +118 -99
- {twitter_openapi_python_generated-0.0.15.dist-info → twitter_openapi_python_generated-0.0.17.dist-info}/WHEEL +1 -1
- {twitter_openapi_python_generated-0.0.15.dist-info → twitter_openapi_python_generated-0.0.17.dist-info}/LICENSE +0 -0
- {twitter_openapi_python_generated-0.0.15.dist-info → twitter_openapi_python_generated-0.0.17.dist-info}/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.0.15.dist-info → twitter_openapi_python_generated-0.0.17.dist-info}/top_level.txt +0 -0
|
@@ -21,7 +21,7 @@ from typing import Any, List, Optional
|
|
|
21
21
|
from twitter_openapi_python_generated.models.errors import Errors
|
|
22
22
|
from twitter_openapi_python_generated.models.tweet_result_by_rest_id_response import TweetResultByRestIdResponse
|
|
23
23
|
from pydantic import StrictStr, Field
|
|
24
|
-
from typing import Union, List, Optional, Dict
|
|
24
|
+
from typing import Union, List, Set, Optional, Dict
|
|
25
25
|
from typing_extensions import Literal, Self
|
|
26
26
|
|
|
27
27
|
GETTWEETRESULTBYRESTID200RESPONSE_ONE_OF_SCHEMAS = ["Errors", "TweetResultByRestIdResponse"]
|
|
@@ -35,7 +35,7 @@ class GetTweetResultByRestId200Response(BaseModel):
|
|
|
35
35
|
# data type: Errors
|
|
36
36
|
oneof_schema_2_validator: Optional[Errors] = None
|
|
37
37
|
actual_instance: Optional[Union[Errors, TweetResultByRestIdResponse]] = None
|
|
38
|
-
one_of_schemas:
|
|
38
|
+
one_of_schemas: Set[str] = { "Errors", "TweetResultByRestIdResponse" }
|
|
39
39
|
|
|
40
40
|
model_config = ConfigDict(
|
|
41
41
|
validate_assignment=True,
|
|
@@ -21,7 +21,7 @@ from typing import Any, List, Optional
|
|
|
21
21
|
from twitter_openapi_python_generated.models.errors import Errors
|
|
22
22
|
from twitter_openapi_python_generated.models.user_response import UserResponse
|
|
23
23
|
from pydantic import StrictStr, Field
|
|
24
|
-
from typing import Union, List, Optional, Dict
|
|
24
|
+
from typing import Union, List, Set, Optional, Dict
|
|
25
25
|
from typing_extensions import Literal, Self
|
|
26
26
|
|
|
27
27
|
GETUSERBYRESTID200RESPONSE_ONE_OF_SCHEMAS = ["Errors", "UserResponse"]
|
|
@@ -35,7 +35,7 @@ class GetUserByRestId200Response(BaseModel):
|
|
|
35
35
|
# data type: Errors
|
|
36
36
|
oneof_schema_2_validator: Optional[Errors] = None
|
|
37
37
|
actual_instance: Optional[Union[Errors, UserResponse]] = None
|
|
38
|
-
one_of_schemas:
|
|
38
|
+
one_of_schemas: Set[str] = { "Errors", "UserResponse" }
|
|
39
39
|
|
|
40
40
|
model_config = ConfigDict(
|
|
41
41
|
validate_assignment=True,
|
|
@@ -21,7 +21,7 @@ from typing import Any, List, Optional
|
|
|
21
21
|
from twitter_openapi_python_generated.models.errors import Errors
|
|
22
22
|
from twitter_openapi_python_generated.models.user_highlights_tweets_response import UserHighlightsTweetsResponse
|
|
23
23
|
from pydantic import StrictStr, Field
|
|
24
|
-
from typing import Union, List, Optional, Dict
|
|
24
|
+
from typing import Union, List, Set, Optional, Dict
|
|
25
25
|
from typing_extensions import Literal, Self
|
|
26
26
|
|
|
27
27
|
GETUSERHIGHLIGHTSTWEETS200RESPONSE_ONE_OF_SCHEMAS = ["Errors", "UserHighlightsTweetsResponse"]
|
|
@@ -35,7 +35,7 @@ class GetUserHighlightsTweets200Response(BaseModel):
|
|
|
35
35
|
# data type: Errors
|
|
36
36
|
oneof_schema_2_validator: Optional[Errors] = None
|
|
37
37
|
actual_instance: Optional[Union[Errors, UserHighlightsTweetsResponse]] = None
|
|
38
|
-
one_of_schemas:
|
|
38
|
+
one_of_schemas: Set[str] = { "Errors", "UserHighlightsTweetsResponse" }
|
|
39
39
|
|
|
40
40
|
model_config = ConfigDict(
|
|
41
41
|
validate_assignment=True,
|
|
@@ -21,7 +21,7 @@ from typing import Any, List, Optional
|
|
|
21
21
|
from twitter_openapi_python_generated.models.errors import Errors
|
|
22
22
|
from twitter_openapi_python_generated.models.users_response import UsersResponse
|
|
23
23
|
from pydantic import StrictStr, Field
|
|
24
|
-
from typing import Union, List, Optional, Dict
|
|
24
|
+
from typing import Union, List, Set, Optional, Dict
|
|
25
25
|
from typing_extensions import Literal, Self
|
|
26
26
|
|
|
27
27
|
GETUSERSBYRESTIDS200RESPONSE_ONE_OF_SCHEMAS = ["Errors", "UsersResponse"]
|
|
@@ -35,7 +35,7 @@ class GetUsersByRestIds200Response(BaseModel):
|
|
|
35
35
|
# data type: Errors
|
|
36
36
|
oneof_schema_2_validator: Optional[Errors] = None
|
|
37
37
|
actual_instance: Optional[Union[Errors, UsersResponse]] = None
|
|
38
|
-
one_of_schemas:
|
|
38
|
+
one_of_schemas: Set[str] = { "Errors", "UsersResponse" }
|
|
39
39
|
|
|
40
40
|
model_config = ConfigDict(
|
|
41
41
|
validate_assignment=True,
|
|
@@ -73,9 +73,9 @@ class Highlight(BaseModel):
|
|
|
73
73
|
# override the default output from pydantic by calling `to_dict()` of each item in text_highlights (list)
|
|
74
74
|
_items = []
|
|
75
75
|
if self.text_highlights:
|
|
76
|
-
for
|
|
77
|
-
if
|
|
78
|
-
_items.append(
|
|
76
|
+
for _item_text_highlights in self.text_highlights:
|
|
77
|
+
if _item_text_highlights:
|
|
78
|
+
_items.append(_item_text_highlights.to_dict())
|
|
79
79
|
_dict['textHighlights'] = _items
|
|
80
80
|
return _dict
|
|
81
81
|
|
|
@@ -27,7 +27,7 @@ from twitter_openapi_python_generated.models.timeline_show_alert import Timeline
|
|
|
27
27
|
from twitter_openapi_python_generated.models.timeline_show_cover import TimelineShowCover
|
|
28
28
|
from twitter_openapi_python_generated.models.timeline_terminate_timeline import TimelineTerminateTimeline
|
|
29
29
|
from pydantic import StrictStr, Field
|
|
30
|
-
from typing import Union, List, Optional, Dict
|
|
30
|
+
from typing import Union, List, Set, Optional, Dict
|
|
31
31
|
from typing_extensions import Literal, Self
|
|
32
32
|
|
|
33
33
|
INSTRUCTIONUNION_ONE_OF_SCHEMAS = ["TimelineAddEntries", "TimelineAddToModule", "TimelineClearCache", "TimelinePinEntry", "TimelineReplaceEntry", "TimelineShowAlert", "TimelineShowCover", "TimelineTerminateTimeline"]
|
|
@@ -53,7 +53,7 @@ class InstructionUnion(BaseModel):
|
|
|
53
53
|
# data type: TimelineShowCover
|
|
54
54
|
oneof_schema_8_validator: Optional[TimelineShowCover] = None
|
|
55
55
|
actual_instance: Optional[Union[TimelineAddEntries, TimelineAddToModule, TimelineClearCache, TimelinePinEntry, TimelineReplaceEntry, TimelineShowAlert, TimelineShowCover, TimelineTerminateTimeline]] = None
|
|
56
|
-
one_of_schemas:
|
|
56
|
+
one_of_schemas: Set[str] = { "TimelineAddEntries", "TimelineAddToModule", "TimelineClearCache", "TimelinePinEntry", "TimelineReplaceEntry", "TimelineShowAlert", "TimelineShowCover", "TimelineTerminateTimeline" }
|
|
57
57
|
|
|
58
58
|
model_config = ConfigDict(
|
|
59
59
|
validate_assignment=True,
|
|
@@ -25,7 +25,7 @@ from twitter_openapi_python_generated.models.timeline_timeline_cursor import Tim
|
|
|
25
25
|
from twitter_openapi_python_generated.models.timeline_tweet import TimelineTweet
|
|
26
26
|
from twitter_openapi_python_generated.models.timeline_user import TimelineUser
|
|
27
27
|
from pydantic import StrictStr, Field
|
|
28
|
-
from typing import Union, List, Optional, Dict
|
|
28
|
+
from typing import Union, List, Set, Optional, Dict
|
|
29
29
|
from typing_extensions import Literal, Self
|
|
30
30
|
|
|
31
31
|
ITEMCONTENTUNION_ONE_OF_SCHEMAS = ["TimelineCommunity", "TimelineMessagePrompt", "TimelinePrompt", "TimelineTimelineCursor", "TimelineTweet", "TimelineUser"]
|
|
@@ -47,7 +47,7 @@ class ItemContentUnion(BaseModel):
|
|
|
47
47
|
# data type: TimelineCommunity
|
|
48
48
|
oneof_schema_6_validator: Optional[TimelineCommunity] = None
|
|
49
49
|
actual_instance: Optional[Union[TimelineCommunity, TimelineMessagePrompt, TimelinePrompt, TimelineTimelineCursor, TimelineTweet, TimelineUser]] = None
|
|
50
|
-
one_of_schemas:
|
|
50
|
+
one_of_schemas: Set[str] = { "TimelineCommunity", "TimelineMessagePrompt", "TimelinePrompt", "TimelineTimelineCursor", "TimelineTweet", "TimelineUser" }
|
|
51
51
|
|
|
52
52
|
model_config = ConfigDict(
|
|
53
53
|
validate_assignment=True,
|
|
@@ -21,9 +21,13 @@ import json
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from typing_extensions import Annotated
|
|
24
|
+
from twitter_openapi_python_generated.models.additional_media_info import AdditionalMediaInfo
|
|
25
|
+
from twitter_openapi_python_generated.models.allow_download_status import AllowDownloadStatus
|
|
24
26
|
from twitter_openapi_python_generated.models.ext_media_availability import ExtMediaAvailability
|
|
25
27
|
from twitter_openapi_python_generated.models.media_original_info import MediaOriginalInfo
|
|
28
|
+
from twitter_openapi_python_generated.models.media_results import MediaResults
|
|
26
29
|
from twitter_openapi_python_generated.models.media_sizes import MediaSizes
|
|
30
|
+
from twitter_openapi_python_generated.models.media_video_info import MediaVideoInfo
|
|
27
31
|
from twitter_openapi_python_generated.models.sensitive_media_warning import SensitiveMediaWarning
|
|
28
32
|
from typing import Optional, Set
|
|
29
33
|
from typing_extensions import Self
|
|
@@ -32,7 +36,8 @@ class Media(BaseModel):
|
|
|
32
36
|
"""
|
|
33
37
|
Media
|
|
34
38
|
""" # noqa: E501
|
|
35
|
-
additional_media_info: Optional[
|
|
39
|
+
additional_media_info: Optional[AdditionalMediaInfo] = None
|
|
40
|
+
allow_download_status: Optional[AllowDownloadStatus] = None
|
|
36
41
|
display_url: StrictStr
|
|
37
42
|
expanded_url: StrictStr
|
|
38
43
|
ext_alt_text: Optional[StrictStr] = None
|
|
@@ -41,6 +46,7 @@ class Media(BaseModel):
|
|
|
41
46
|
id_str: Annotated[str, Field(strict=True)]
|
|
42
47
|
indices: List[StrictInt]
|
|
43
48
|
media_key: StrictStr
|
|
49
|
+
media_results: Optional[MediaResults] = None
|
|
44
50
|
media_url_https: StrictStr
|
|
45
51
|
original_info: MediaOriginalInfo
|
|
46
52
|
sensitive_media_warning: Optional[SensitiveMediaWarning] = None
|
|
@@ -49,8 +55,8 @@ class Media(BaseModel):
|
|
|
49
55
|
source_user_id_str: Optional[Annotated[str, Field(strict=True)]] = None
|
|
50
56
|
type: StrictStr
|
|
51
57
|
url: StrictStr
|
|
52
|
-
video_info: Optional[
|
|
53
|
-
__properties: ClassVar[List[str]] = ["additional_media_info", "display_url", "expanded_url", "ext_alt_text", "ext_media_availability", "features", "id_str", "indices", "media_key", "media_url_https", "original_info", "sensitive_media_warning", "sizes", "source_status_id_str", "source_user_id_str", "type", "url", "video_info"]
|
|
58
|
+
video_info: Optional[MediaVideoInfo] = None
|
|
59
|
+
__properties: ClassVar[List[str]] = ["additional_media_info", "allow_download_status", "display_url", "expanded_url", "ext_alt_text", "ext_media_availability", "features", "id_str", "indices", "media_key", "media_results", "media_url_https", "original_info", "sensitive_media_warning", "sizes", "source_status_id_str", "source_user_id_str", "type", "url", "video_info"]
|
|
54
60
|
|
|
55
61
|
@field_validator('id_str')
|
|
56
62
|
def id_str_validate_regular_expression(cls, value):
|
|
@@ -125,9 +131,18 @@ class Media(BaseModel):
|
|
|
125
131
|
exclude=excluded_fields,
|
|
126
132
|
exclude_none=True,
|
|
127
133
|
)
|
|
134
|
+
# override the default output from pydantic by calling `to_dict()` of additional_media_info
|
|
135
|
+
if self.additional_media_info:
|
|
136
|
+
_dict['additional_media_info'] = self.additional_media_info.to_dict()
|
|
137
|
+
# override the default output from pydantic by calling `to_dict()` of allow_download_status
|
|
138
|
+
if self.allow_download_status:
|
|
139
|
+
_dict['allow_download_status'] = self.allow_download_status.to_dict()
|
|
128
140
|
# override the default output from pydantic by calling `to_dict()` of ext_media_availability
|
|
129
141
|
if self.ext_media_availability:
|
|
130
142
|
_dict['ext_media_availability'] = self.ext_media_availability.to_dict()
|
|
143
|
+
# override the default output from pydantic by calling `to_dict()` of media_results
|
|
144
|
+
if self.media_results:
|
|
145
|
+
_dict['media_results'] = self.media_results.to_dict()
|
|
131
146
|
# override the default output from pydantic by calling `to_dict()` of original_info
|
|
132
147
|
if self.original_info:
|
|
133
148
|
_dict['original_info'] = self.original_info.to_dict()
|
|
@@ -137,6 +152,9 @@ class Media(BaseModel):
|
|
|
137
152
|
# override the default output from pydantic by calling `to_dict()` of sizes
|
|
138
153
|
if self.sizes:
|
|
139
154
|
_dict['sizes'] = self.sizes.to_dict()
|
|
155
|
+
# override the default output from pydantic by calling `to_dict()` of video_info
|
|
156
|
+
if self.video_info:
|
|
157
|
+
_dict['video_info'] = self.video_info.to_dict()
|
|
140
158
|
return _dict
|
|
141
159
|
|
|
142
160
|
@classmethod
|
|
@@ -149,7 +167,8 @@ class Media(BaseModel):
|
|
|
149
167
|
return cls.model_validate(obj)
|
|
150
168
|
|
|
151
169
|
_obj = cls.model_validate({
|
|
152
|
-
"additional_media_info": obj.get("additional_media_info"),
|
|
170
|
+
"additional_media_info": AdditionalMediaInfo.from_dict(obj["additional_media_info"]) if obj.get("additional_media_info") is not None else None,
|
|
171
|
+
"allow_download_status": AllowDownloadStatus.from_dict(obj["allow_download_status"]) if obj.get("allow_download_status") is not None else None,
|
|
153
172
|
"display_url": obj.get("display_url"),
|
|
154
173
|
"expanded_url": obj.get("expanded_url"),
|
|
155
174
|
"ext_alt_text": obj.get("ext_alt_text"),
|
|
@@ -158,6 +177,7 @@ class Media(BaseModel):
|
|
|
158
177
|
"id_str": obj.get("id_str"),
|
|
159
178
|
"indices": obj.get("indices"),
|
|
160
179
|
"media_key": obj.get("media_key"),
|
|
180
|
+
"media_results": MediaResults.from_dict(obj["media_results"]) if obj.get("media_results") is not None else None,
|
|
161
181
|
"media_url_https": obj.get("media_url_https"),
|
|
162
182
|
"original_info": MediaOriginalInfo.from_dict(obj["original_info"]) if obj.get("original_info") is not None else None,
|
|
163
183
|
"sensitive_media_warning": SensitiveMediaWarning.from_dict(obj["sensitive_media_warning"]) if obj.get("sensitive_media_warning") is not None else None,
|
|
@@ -166,7 +186,7 @@ class Media(BaseModel):
|
|
|
166
186
|
"source_user_id_str": obj.get("source_user_id_str"),
|
|
167
187
|
"type": obj.get("type"),
|
|
168
188
|
"url": obj.get("url"),
|
|
169
|
-
"video_info": obj.get("video_info")
|
|
189
|
+
"video_info": MediaVideoInfo.from_dict(obj["video_info"]) if obj.get("video_info") is not None else None
|
|
170
190
|
})
|
|
171
191
|
return _obj
|
|
172
192
|
|
|
@@ -22,8 +22,10 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_v
|
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from typing_extensions import Annotated
|
|
24
24
|
from twitter_openapi_python_generated.models.additional_media_info import AdditionalMediaInfo
|
|
25
|
+
from twitter_openapi_python_generated.models.allow_download_status import AllowDownloadStatus
|
|
25
26
|
from twitter_openapi_python_generated.models.ext_media_availability import ExtMediaAvailability
|
|
26
27
|
from twitter_openapi_python_generated.models.media_original_info import MediaOriginalInfo
|
|
28
|
+
from twitter_openapi_python_generated.models.media_results import MediaResults
|
|
27
29
|
from twitter_openapi_python_generated.models.media_sizes import MediaSizes
|
|
28
30
|
from twitter_openapi_python_generated.models.media_stats import MediaStats
|
|
29
31
|
from twitter_openapi_python_generated.models.media_video_info import MediaVideoInfo
|
|
@@ -36,6 +38,7 @@ class MediaExtended(BaseModel):
|
|
|
36
38
|
MediaExtended
|
|
37
39
|
""" # noqa: E501
|
|
38
40
|
additional_media_info: Optional[AdditionalMediaInfo] = None
|
|
41
|
+
allow_download_status: Optional[AllowDownloadStatus] = None
|
|
39
42
|
display_url: StrictStr
|
|
40
43
|
expanded_url: StrictStr
|
|
41
44
|
ext_alt_text: Optional[StrictStr] = None
|
|
@@ -45,6 +48,7 @@ class MediaExtended(BaseModel):
|
|
|
45
48
|
indices: List[StrictInt]
|
|
46
49
|
media_stats: Optional[MediaStats] = Field(default=None, alias="mediaStats")
|
|
47
50
|
media_key: StrictStr
|
|
51
|
+
media_results: Optional[MediaResults] = None
|
|
48
52
|
media_url_https: StrictStr
|
|
49
53
|
original_info: MediaOriginalInfo
|
|
50
54
|
sensitive_media_warning: Optional[SensitiveMediaWarning] = None
|
|
@@ -54,7 +58,7 @@ class MediaExtended(BaseModel):
|
|
|
54
58
|
type: StrictStr
|
|
55
59
|
url: StrictStr
|
|
56
60
|
video_info: Optional[MediaVideoInfo] = None
|
|
57
|
-
__properties: ClassVar[List[str]] = ["additional_media_info", "display_url", "expanded_url", "ext_alt_text", "ext_media_availability", "features", "id_str", "indices", "mediaStats", "media_key", "media_url_https", "original_info", "sensitive_media_warning", "sizes", "source_status_id_str", "source_user_id_str", "type", "url", "video_info"]
|
|
61
|
+
__properties: ClassVar[List[str]] = ["additional_media_info", "allow_download_status", "display_url", "expanded_url", "ext_alt_text", "ext_media_availability", "features", "id_str", "indices", "mediaStats", "media_key", "media_results", "media_url_https", "original_info", "sensitive_media_warning", "sizes", "source_status_id_str", "source_user_id_str", "type", "url", "video_info"]
|
|
58
62
|
|
|
59
63
|
@field_validator('id_str')
|
|
60
64
|
def id_str_validate_regular_expression(cls, value):
|
|
@@ -132,12 +136,18 @@ class MediaExtended(BaseModel):
|
|
|
132
136
|
# override the default output from pydantic by calling `to_dict()` of additional_media_info
|
|
133
137
|
if self.additional_media_info:
|
|
134
138
|
_dict['additional_media_info'] = self.additional_media_info.to_dict()
|
|
139
|
+
# override the default output from pydantic by calling `to_dict()` of allow_download_status
|
|
140
|
+
if self.allow_download_status:
|
|
141
|
+
_dict['allow_download_status'] = self.allow_download_status.to_dict()
|
|
135
142
|
# override the default output from pydantic by calling `to_dict()` of ext_media_availability
|
|
136
143
|
if self.ext_media_availability:
|
|
137
144
|
_dict['ext_media_availability'] = self.ext_media_availability.to_dict()
|
|
138
145
|
# override the default output from pydantic by calling `to_dict()` of media_stats
|
|
139
146
|
if self.media_stats:
|
|
140
147
|
_dict['mediaStats'] = self.media_stats.to_dict()
|
|
148
|
+
# override the default output from pydantic by calling `to_dict()` of media_results
|
|
149
|
+
if self.media_results:
|
|
150
|
+
_dict['media_results'] = self.media_results.to_dict()
|
|
141
151
|
# override the default output from pydantic by calling `to_dict()` of original_info
|
|
142
152
|
if self.original_info:
|
|
143
153
|
_dict['original_info'] = self.original_info.to_dict()
|
|
@@ -163,6 +173,7 @@ class MediaExtended(BaseModel):
|
|
|
163
173
|
|
|
164
174
|
_obj = cls.model_validate({
|
|
165
175
|
"additional_media_info": AdditionalMediaInfo.from_dict(obj["additional_media_info"]) if obj.get("additional_media_info") is not None else None,
|
|
176
|
+
"allow_download_status": AllowDownloadStatus.from_dict(obj["allow_download_status"]) if obj.get("allow_download_status") is not None else None,
|
|
166
177
|
"display_url": obj.get("display_url"),
|
|
167
178
|
"expanded_url": obj.get("expanded_url"),
|
|
168
179
|
"ext_alt_text": obj.get("ext_alt_text"),
|
|
@@ -172,6 +183,7 @@ class MediaExtended(BaseModel):
|
|
|
172
183
|
"indices": obj.get("indices"),
|
|
173
184
|
"mediaStats": MediaStats.from_dict(obj["mediaStats"]) if obj.get("mediaStats") is not None else None,
|
|
174
185
|
"media_key": obj.get("media_key"),
|
|
186
|
+
"media_results": MediaResults.from_dict(obj["media_results"]) if obj.get("media_results") is not None else None,
|
|
175
187
|
"media_url_https": obj.get("media_url_https"),
|
|
176
188
|
"original_info": MediaOriginalInfo.from_dict(obj["original_info"]) if obj.get("original_info") is not None else None,
|
|
177
189
|
"sensitive_media_warning": SensitiveMediaWarning.from_dict(obj["sensitive_media_warning"]) if obj.get("sensitive_media_warning") is not None else None,
|
|
@@ -75,9 +75,9 @@ class MediaOriginalInfo(BaseModel):
|
|
|
75
75
|
# override the default output from pydantic by calling `to_dict()` of each item in focus_rects (list)
|
|
76
76
|
_items = []
|
|
77
77
|
if self.focus_rects:
|
|
78
|
-
for
|
|
79
|
-
if
|
|
80
|
-
_items.append(
|
|
78
|
+
for _item_focus_rects in self.focus_rects:
|
|
79
|
+
if _item_focus_rects:
|
|
80
|
+
_items.append(_item_focus_rects.to_dict())
|
|
81
81
|
_dict['focus_rects'] = _items
|
|
82
82
|
return _dict
|
|
83
83
|
|
|
@@ -0,0 +1,88 @@
|
|
|
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 typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class MediaResult(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
MediaResult
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
media_key: StrictStr
|
|
31
|
+
__properties: ClassVar[List[str]] = ["media_key"]
|
|
32
|
+
|
|
33
|
+
model_config = ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of MediaResult from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([
|
|
65
|
+
])
|
|
66
|
+
|
|
67
|
+
_dict = self.model_dump(
|
|
68
|
+
by_alias=True,
|
|
69
|
+
exclude=excluded_fields,
|
|
70
|
+
exclude_none=True,
|
|
71
|
+
)
|
|
72
|
+
return _dict
|
|
73
|
+
|
|
74
|
+
@classmethod
|
|
75
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
76
|
+
"""Create an instance of MediaResult from a dict"""
|
|
77
|
+
if obj is None:
|
|
78
|
+
return None
|
|
79
|
+
|
|
80
|
+
if not isinstance(obj, dict):
|
|
81
|
+
return cls.model_validate(obj)
|
|
82
|
+
|
|
83
|
+
_obj = cls.model_validate({
|
|
84
|
+
"media_key": obj.get("media_key")
|
|
85
|
+
})
|
|
86
|
+
return _obj
|
|
87
|
+
|
|
88
|
+
|
|
@@ -20,16 +20,16 @@ import json
|
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict
|
|
22
22
|
from typing import Any, ClassVar, Dict, List
|
|
23
|
-
from twitter_openapi_python_generated.models.
|
|
23
|
+
from twitter_openapi_python_generated.models.media_result import MediaResult
|
|
24
24
|
from typing import Optional, Set
|
|
25
25
|
from typing_extensions import Self
|
|
26
26
|
|
|
27
|
-
class
|
|
27
|
+
class MediaResults(BaseModel):
|
|
28
28
|
"""
|
|
29
|
-
|
|
29
|
+
MediaResults
|
|
30
30
|
""" # noqa: E501
|
|
31
|
-
|
|
32
|
-
__properties: ClassVar[List[str]] = ["
|
|
31
|
+
result: MediaResult
|
|
32
|
+
__properties: ClassVar[List[str]] = ["result"]
|
|
33
33
|
|
|
34
34
|
model_config = ConfigDict(
|
|
35
35
|
populate_by_name=True,
|
|
@@ -49,7 +49,7 @@ class ErrorResponse(BaseModel):
|
|
|
49
49
|
|
|
50
50
|
@classmethod
|
|
51
51
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
-
"""Create an instance of
|
|
52
|
+
"""Create an instance of MediaResults from a JSON string"""
|
|
53
53
|
return cls.from_dict(json.loads(json_str))
|
|
54
54
|
|
|
55
55
|
def to_dict(self) -> Dict[str, Any]:
|
|
@@ -70,14 +70,14 @@ class ErrorResponse(BaseModel):
|
|
|
70
70
|
exclude=excluded_fields,
|
|
71
71
|
exclude_none=True,
|
|
72
72
|
)
|
|
73
|
-
# override the default output from pydantic by calling `to_dict()` of
|
|
74
|
-
if self.
|
|
75
|
-
_dict['
|
|
73
|
+
# override the default output from pydantic by calling `to_dict()` of result
|
|
74
|
+
if self.result:
|
|
75
|
+
_dict['result'] = self.result.to_dict()
|
|
76
76
|
return _dict
|
|
77
77
|
|
|
78
78
|
@classmethod
|
|
79
79
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
-
"""Create an instance of
|
|
80
|
+
"""Create an instance of MediaResults from a dict"""
|
|
81
81
|
if obj is None:
|
|
82
82
|
return None
|
|
83
83
|
|
|
@@ -85,7 +85,7 @@ class ErrorResponse(BaseModel):
|
|
|
85
85
|
return cls.model_validate(obj)
|
|
86
86
|
|
|
87
87
|
_obj = cls.model_validate({
|
|
88
|
-
"
|
|
88
|
+
"result": MediaResult.from_dict(obj["result"]) if obj.get("result") is not None else None
|
|
89
89
|
})
|
|
90
90
|
return _obj
|
|
91
91
|
|
|
@@ -75,9 +75,9 @@ class MediaVideoInfo(BaseModel):
|
|
|
75
75
|
# override the default output from pydantic by calling `to_dict()` of each item in variants (list)
|
|
76
76
|
_items = []
|
|
77
77
|
if self.variants:
|
|
78
|
-
for
|
|
79
|
-
if
|
|
80
|
-
_items.append(
|
|
78
|
+
for _item_variants in self.variants:
|
|
79
|
+
if _item_variants:
|
|
80
|
+
_items.append(_item_variants.to_dict())
|
|
81
81
|
_dict['variants'] = _items
|
|
82
82
|
return _dict
|
|
83
83
|
|
|
@@ -0,0 +1,92 @@
|
|
|
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.media_visibility_results_blurred_image_interstitial import MediaVisibilityResultsBlurredImageInterstitial
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class MediaVisibilityResults(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
MediaVisibilityResults
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
blurred_image_interstitial: MediaVisibilityResultsBlurredImageInterstitial
|
|
32
|
+
__properties: ClassVar[List[str]] = ["blurred_image_interstitial"]
|
|
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 MediaVisibilityResults 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 blurred_image_interstitial
|
|
74
|
+
if self.blurred_image_interstitial:
|
|
75
|
+
_dict['blurred_image_interstitial'] = self.blurred_image_interstitial.to_dict()
|
|
76
|
+
return _dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
+
"""Create an instance of MediaVisibilityResults from a dict"""
|
|
81
|
+
if obj is None:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
if not isinstance(obj, dict):
|
|
85
|
+
return cls.model_validate(obj)
|
|
86
|
+
|
|
87
|
+
_obj = cls.model_validate({
|
|
88
|
+
"blurred_image_interstitial": MediaVisibilityResultsBlurredImageInterstitial.from_dict(obj["blurred_image_interstitial"]) if obj.get("blurred_image_interstitial") is not None else None
|
|
89
|
+
})
|
|
90
|
+
return _obj
|
|
91
|
+
|
|
92
|
+
|