twitter-openapi-python-generated 0.0.15__py3-none-any.whl → 0.0.16__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 +20 -1
- twitter_openapi_python_generated/api/default_api.py +23 -6
- twitter_openapi_python_generated/api/other_api.py +3 -3
- twitter_openapi_python_generated/api/post_api.py +691 -77
- twitter_openapi_python_generated/api/tweet_api.py +33 -33
- twitter_openapi_python_generated/api/user_api.py +6 -6
- twitter_openapi_python_generated/api/user_list_api.py +15 -15
- twitter_openapi_python_generated/api/users_api.py +3 -3
- 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 +36 -24
- twitter_openapi_python_generated/configuration.py +14 -14
- twitter_openapi_python_generated/models/__init__.py +19 -0
- twitter_openapi_python_generated/models/allow_download_status.py +88 -0
- 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/content_union.py +2 -2
- twitter_openapi_python_generated/models/create_bookmark_response.py +92 -0
- 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/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/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_result.py +88 -0
- twitter_openapi_python_generated/models/media_results.py +92 -0
- 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/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_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_unfavorite_tweet200_response.py +2 -2
- twitter_openapi_python_generated/models/social_context_union.py +2 -2
- twitter_openapi_python_generated/models/tweet_union.py +2 -2
- 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/user.py +13 -1
- 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_tip_jar_settings.py +100 -0
- twitter_openapi_python_generated/models/user_union.py +2 -2
- twitter_openapi_python_generated/rest.py +2 -0
- {twitter_openapi_python_generated-0.0.15.dist-info → twitter_openapi_python_generated-0.0.16.dist-info}/METADATA +1 -1
- {twitter_openapi_python_generated-0.0.15.dist-info → twitter_openapi_python_generated-0.0.16.dist-info}/RECORD +73 -54
- {twitter_openapi_python_generated-0.0.15.dist-info → twitter_openapi_python_generated-0.0.16.dist-info}/LICENSE +0 -0
- {twitter_openapi_python_generated-0.0.15.dist-info → twitter_openapi_python_generated-0.0.16.dist-info}/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.0.15.dist-info → twitter_openapi_python_generated-0.0.16.dist-info}/WHEEL +0 -0
- {twitter_openapi_python_generated-0.0.15.dist-info → twitter_openapi_python_generated-0.0.16.dist-info}/top_level.txt +0 -0
|
@@ -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,
|
|
@@ -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
|
+
|
|
@@ -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_result import MediaResult
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class MediaResults(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
MediaResults
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
result: MediaResult
|
|
32
|
+
__properties: ClassVar[List[str]] = ["result"]
|
|
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 MediaResults 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 result
|
|
74
|
+
if self.result:
|
|
75
|
+
_dict['result'] = self.result.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 MediaResults 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
|
+
"result": MediaResult.from_dict(obj["result"]) if obj.get("result") is not None else None
|
|
89
|
+
})
|
|
90
|
+
return _obj
|
|
91
|
+
|
|
92
|
+
|
|
@@ -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
|
+
|
twitter_openapi_python_generated/models/media_visibility_results_blurred_image_interstitial.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
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, StrictFloat, StrictInt
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Union
|
|
23
|
+
from twitter_openapi_python_generated.models.tweet_interstitial_text import TweetInterstitialText
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class MediaVisibilityResultsBlurredImageInterstitial(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
MediaVisibilityResultsBlurredImageInterstitial
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
opacity: Union[StrictFloat, StrictInt]
|
|
32
|
+
text: TweetInterstitialText
|
|
33
|
+
title: TweetInterstitialText
|
|
34
|
+
__properties: ClassVar[List[str]] = ["opacity", "text", "title"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of MediaVisibilityResultsBlurredImageInterstitial from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of text
|
|
76
|
+
if self.text:
|
|
77
|
+
_dict['text'] = self.text.to_dict()
|
|
78
|
+
# override the default output from pydantic by calling `to_dict()` of title
|
|
79
|
+
if self.title:
|
|
80
|
+
_dict['title'] = self.title.to_dict()
|
|
81
|
+
return _dict
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
85
|
+
"""Create an instance of MediaVisibilityResultsBlurredImageInterstitial from a dict"""
|
|
86
|
+
if obj is None:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
if not isinstance(obj, dict):
|
|
90
|
+
return cls.model_validate(obj)
|
|
91
|
+
|
|
92
|
+
_obj = cls.model_validate({
|
|
93
|
+
"opacity": obj.get("opacity"),
|
|
94
|
+
"text": TweetInterstitialText.from_dict(obj["text"]) if obj.get("text") is not None else None,
|
|
95
|
+
"title": TweetInterstitialText.from_dict(obj["title"]) if obj.get("title") is not None else None
|
|
96
|
+
})
|
|
97
|
+
return _obj
|
|
98
|
+
|
|
99
|
+
|
|
@@ -20,7 +20,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, f
|
|
|
20
20
|
from typing import Any, List, Optional
|
|
21
21
|
from twitter_openapi_python_generated.models.other_response import OtherResponse
|
|
22
22
|
from pydantic import StrictStr, Field
|
|
23
|
-
from typing import Union, List, Optional, Dict
|
|
23
|
+
from typing import Union, List, Set, Optional, Dict
|
|
24
24
|
from typing_extensions import Literal, Self
|
|
25
25
|
|
|
26
26
|
OTHER200RESPONSE_ONE_OF_SCHEMAS = ["OtherResponse"]
|
|
@@ -32,7 +32,7 @@ class Other200Response(BaseModel):
|
|
|
32
32
|
# data type: OtherResponse
|
|
33
33
|
oneof_schema_1_validator: Optional[OtherResponse] = None
|
|
34
34
|
actual_instance: Optional[Union[OtherResponse]] = None
|
|
35
|
-
one_of_schemas:
|
|
35
|
+
one_of_schemas: Set[str] = { "OtherResponse" }
|
|
36
36
|
|
|
37
37
|
model_config = ConfigDict(
|
|
38
38
|
validate_assignment=True,
|