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,7 +21,7 @@ from typing import Any, List, Optional
|
|
|
21
21
|
from twitter_openapi_python_generated.models.timeline_general_context import TimelineGeneralContext
|
|
22
22
|
from twitter_openapi_python_generated.models.timeline_topic_context import TimelineTopicContext
|
|
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
|
SOCIALCONTEXTUNION_ONE_OF_SCHEMAS = ["TimelineGeneralContext", "TimelineTopicContext"]
|
|
@@ -35,7 +35,7 @@ class SocialContextUnion(BaseModel):
|
|
|
35
35
|
# data type: TimelineTopicContext
|
|
36
36
|
oneof_schema_2_validator: Optional[TimelineTopicContext] = None
|
|
37
37
|
actual_instance: Optional[Union[TimelineGeneralContext, TimelineTopicContext]] = None
|
|
38
|
-
one_of_schemas:
|
|
38
|
+
one_of_schemas: Set[str] = { "TimelineGeneralContext", "TimelineTopicContext" }
|
|
39
39
|
|
|
40
40
|
model_config = ConfigDict(
|
|
41
41
|
validate_assignment=True,
|
|
@@ -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.tweet_tombstone import TweetTombstone
|
|
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
|
TWEETUNION_ONE_OF_SCHEMAS = ["Tweet", "TweetTombstone", "TweetWithVisibilityResults"]
|
|
@@ -36,7 +36,7 @@ class TweetUnion(BaseModel):
|
|
|
36
36
|
# data type: TweetTombstone
|
|
37
37
|
oneof_schema_3_validator: Optional[TweetTombstone] = None
|
|
38
38
|
actual_instance: Optional[Union[Tweet, TweetTombstone, TweetWithVisibilityResults]] = None
|
|
39
|
-
one_of_schemas:
|
|
39
|
+
one_of_schemas: Set[str] = { "Tweet", "TweetTombstone", "TweetWithVisibilityResults" }
|
|
40
40
|
|
|
41
41
|
model_config = ConfigDict(
|
|
42
42
|
validate_assignment=True,
|
|
@@ -20,6 +20,7 @@ import json
|
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from twitter_openapi_python_generated.models.media_visibility_results import MediaVisibilityResults
|
|
23
24
|
from twitter_openapi_python_generated.models.tweet_interstitial import TweetInterstitial
|
|
24
25
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
25
26
|
from typing import Optional, Set
|
|
@@ -31,9 +32,10 @@ class TweetWithVisibilityResults(BaseModel):
|
|
|
31
32
|
""" # noqa: E501
|
|
32
33
|
typename: TypeName = Field(alias="__typename")
|
|
33
34
|
limited_action_results: Optional[Dict[str, Any]] = Field(default=None, alias="limitedActionResults")
|
|
35
|
+
media_visibility_results: Optional[MediaVisibilityResults] = Field(default=None, alias="mediaVisibilityResults")
|
|
34
36
|
tweet: Tweet
|
|
35
37
|
tweet_interstitial: Optional[TweetInterstitial] = Field(default=None, alias="tweetInterstitial")
|
|
36
|
-
__properties: ClassVar[List[str]] = ["__typename", "limitedActionResults", "tweet", "tweetInterstitial"]
|
|
38
|
+
__properties: ClassVar[List[str]] = ["__typename", "limitedActionResults", "mediaVisibilityResults", "tweet", "tweetInterstitial"]
|
|
37
39
|
|
|
38
40
|
model_config = ConfigDict(
|
|
39
41
|
populate_by_name=True,
|
|
@@ -74,6 +76,9 @@ class TweetWithVisibilityResults(BaseModel):
|
|
|
74
76
|
exclude=excluded_fields,
|
|
75
77
|
exclude_none=True,
|
|
76
78
|
)
|
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of media_visibility_results
|
|
80
|
+
if self.media_visibility_results:
|
|
81
|
+
_dict['mediaVisibilityResults'] = self.media_visibility_results.to_dict()
|
|
77
82
|
# override the default output from pydantic by calling `to_dict()` of tweet
|
|
78
83
|
if self.tweet:
|
|
79
84
|
_dict['tweet'] = self.tweet.to_dict()
|
|
@@ -94,6 +99,7 @@ class TweetWithVisibilityResults(BaseModel):
|
|
|
94
99
|
_obj = cls.model_validate({
|
|
95
100
|
"__typename": obj.get("__typename"),
|
|
96
101
|
"limitedActionResults": obj.get("limitedActionResults"),
|
|
102
|
+
"mediaVisibilityResults": MediaVisibilityResults.from_dict(obj["mediaVisibilityResults"]) if obj.get("mediaVisibilityResults") is not None else None,
|
|
97
103
|
"tweet": Tweet.from_dict(obj["tweet"]) if obj.get("tweet") is not None else None,
|
|
98
104
|
"tweetInterstitial": TweetInterstitial.from_dict(obj["tweetInterstitial"]) if obj.get("tweetInterstitial") is not None else None
|
|
99
105
|
})
|
|
@@ -19,7 +19,7 @@ import re # noqa: F401
|
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from typing import Optional, Set
|
|
24
24
|
from typing_extensions import Self
|
|
25
25
|
|
|
@@ -28,7 +28,7 @@ class Url(BaseModel):
|
|
|
28
28
|
Url
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
display_url: StrictStr
|
|
31
|
-
expanded_url: StrictStr
|
|
31
|
+
expanded_url: Optional[StrictStr] = None
|
|
32
32
|
indices: List[StrictInt]
|
|
33
33
|
url: StrictStr
|
|
34
34
|
__properties: ClassVar[List[str]] = ["display_url", "expanded_url", "indices", "url"]
|
|
@@ -24,7 +24,9 @@ from typing_extensions import Annotated
|
|
|
24
24
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
25
25
|
from twitter_openapi_python_generated.models.user_highlights_info import UserHighlightsInfo
|
|
26
26
|
from twitter_openapi_python_generated.models.user_legacy import UserLegacy
|
|
27
|
+
from twitter_openapi_python_generated.models.user_legacy_extended_profile import UserLegacyExtendedProfile
|
|
27
28
|
from twitter_openapi_python_generated.models.user_professional import UserProfessional
|
|
29
|
+
from twitter_openapi_python_generated.models.user_tip_jar_settings import UserTipJarSettings
|
|
28
30
|
from twitter_openapi_python_generated.models.user_verification_info import UserVerificationInfo
|
|
29
31
|
from typing import Optional, Set
|
|
30
32
|
from typing_extensions import Self
|
|
@@ -44,15 +46,17 @@ class User(BaseModel):
|
|
|
44
46
|
is_blue_verified: StrictBool
|
|
45
47
|
is_profile_translatable: Optional[StrictBool] = None
|
|
46
48
|
legacy: UserLegacy
|
|
49
|
+
legacy_extended_profile: Optional[UserLegacyExtendedProfile] = None
|
|
47
50
|
professional: Optional[UserProfessional] = None
|
|
48
51
|
profile_image_shape: StrictStr
|
|
49
52
|
rest_id: Annotated[str, Field(strict=True)]
|
|
50
53
|
super_follow_eligible: StrictBool
|
|
51
54
|
super_followed_by: StrictBool
|
|
52
55
|
super_following: StrictBool
|
|
56
|
+
tipjar_settings: Optional[UserTipJarSettings] = None
|
|
53
57
|
user_seed_tweet_count: Optional[StrictInt] = None
|
|
54
58
|
verification_info: Optional[UserVerificationInfo] = None
|
|
55
|
-
__properties: ClassVar[List[str]] = ["__typename", "affiliates_highlighted_label", "business_account", "creator_subscriptions_count", "has_graduated_access", "has_nft_avatar", "highlights_info", "id", "is_blue_verified", "is_profile_translatable", "legacy", "professional", "profile_image_shape", "rest_id", "super_follow_eligible", "super_followed_by", "super_following", "user_seed_tweet_count", "verification_info"]
|
|
59
|
+
__properties: ClassVar[List[str]] = ["__typename", "affiliates_highlighted_label", "business_account", "creator_subscriptions_count", "has_graduated_access", "has_nft_avatar", "highlights_info", "id", "is_blue_verified", "is_profile_translatable", "legacy", "legacy_extended_profile", "professional", "profile_image_shape", "rest_id", "super_follow_eligible", "super_followed_by", "super_following", "tipjar_settings", "user_seed_tweet_count", "verification_info"]
|
|
56
60
|
|
|
57
61
|
@field_validator('id')
|
|
58
62
|
def id_validate_regular_expression(cls, value):
|
|
@@ -120,9 +124,15 @@ class User(BaseModel):
|
|
|
120
124
|
# override the default output from pydantic by calling `to_dict()` of legacy
|
|
121
125
|
if self.legacy:
|
|
122
126
|
_dict['legacy'] = self.legacy.to_dict()
|
|
127
|
+
# override the default output from pydantic by calling `to_dict()` of legacy_extended_profile
|
|
128
|
+
if self.legacy_extended_profile:
|
|
129
|
+
_dict['legacy_extended_profile'] = self.legacy_extended_profile.to_dict()
|
|
123
130
|
# override the default output from pydantic by calling `to_dict()` of professional
|
|
124
131
|
if self.professional:
|
|
125
132
|
_dict['professional'] = self.professional.to_dict()
|
|
133
|
+
# override the default output from pydantic by calling `to_dict()` of tipjar_settings
|
|
134
|
+
if self.tipjar_settings:
|
|
135
|
+
_dict['tipjar_settings'] = self.tipjar_settings.to_dict()
|
|
126
136
|
# override the default output from pydantic by calling `to_dict()` of verification_info
|
|
127
137
|
if self.verification_info:
|
|
128
138
|
_dict['verification_info'] = self.verification_info.to_dict()
|
|
@@ -149,12 +159,14 @@ class User(BaseModel):
|
|
|
149
159
|
"is_blue_verified": obj.get("is_blue_verified") if obj.get("is_blue_verified") is not None else False,
|
|
150
160
|
"is_profile_translatable": obj.get("is_profile_translatable"),
|
|
151
161
|
"legacy": UserLegacy.from_dict(obj["legacy"]) if obj.get("legacy") is not None else None,
|
|
162
|
+
"legacy_extended_profile": UserLegacyExtendedProfile.from_dict(obj["legacy_extended_profile"]) if obj.get("legacy_extended_profile") is not None else None,
|
|
152
163
|
"professional": UserProfessional.from_dict(obj["professional"]) if obj.get("professional") is not None else None,
|
|
153
164
|
"profile_image_shape": obj.get("profile_image_shape"),
|
|
154
165
|
"rest_id": obj.get("rest_id"),
|
|
155
166
|
"super_follow_eligible": obj.get("super_follow_eligible") if obj.get("super_follow_eligible") is not None else False,
|
|
156
167
|
"super_followed_by": obj.get("super_followed_by") if obj.get("super_followed_by") is not None else False,
|
|
157
168
|
"super_following": obj.get("super_following") if obj.get("super_following") is not None else False,
|
|
169
|
+
"tipjar_settings": UserTipJarSettings.from_dict(obj["tipjar_settings"]) if obj.get("tipjar_settings") is not None else None,
|
|
158
170
|
"user_seed_tweet_count": obj.get("user_seed_tweet_count"),
|
|
159
171
|
"verification_info": UserVerificationInfo.from_dict(obj["verification_info"]) if obj.get("verification_info") is not None else None
|
|
160
172
|
})
|
|
@@ -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, Optional
|
|
23
|
+
from twitter_openapi_python_generated.models.user_legacy_extended_profile_birthdate import UserLegacyExtendedProfileBirthdate
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class UserLegacyExtendedProfile(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
UserLegacyExtendedProfile
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
birthdate: Optional[UserLegacyExtendedProfileBirthdate] = None
|
|
32
|
+
__properties: ClassVar[List[str]] = ["birthdate"]
|
|
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 UserLegacyExtendedProfile 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 birthdate
|
|
74
|
+
if self.birthdate:
|
|
75
|
+
_dict['birthdate'] = self.birthdate.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 UserLegacyExtendedProfile 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
|
+
"birthdate": UserLegacyExtendedProfileBirthdate.from_dict(obj["birthdate"]) if obj.get("birthdate") is not None else None
|
|
89
|
+
})
|
|
90
|
+
return _obj
|
|
91
|
+
|
|
92
|
+
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Twitter OpenAPI
|
|
5
|
+
|
|
6
|
+
Twitter OpenAPI(Swagger) specification
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1
|
|
9
|
+
Contact: yuki@yuki0311.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class UserLegacyExtendedProfileBirthdate(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
UserLegacyExtendedProfileBirthdate
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
day: StrictInt
|
|
31
|
+
month: StrictInt
|
|
32
|
+
visibility: StrictStr
|
|
33
|
+
year: StrictInt
|
|
34
|
+
year_visibility: StrictStr
|
|
35
|
+
__properties: ClassVar[List[str]] = ["day", "month", "visibility", "year", "year_visibility"]
|
|
36
|
+
|
|
37
|
+
@field_validator('visibility')
|
|
38
|
+
def visibility_validate_enum(cls, value):
|
|
39
|
+
"""Validates the enum"""
|
|
40
|
+
if value not in set(['Self', 'Public', 'MutualFollow', 'Followers', 'Following']):
|
|
41
|
+
raise ValueError("must be one of enum values ('Self', 'Public', 'MutualFollow', 'Followers', 'Following')")
|
|
42
|
+
return value
|
|
43
|
+
|
|
44
|
+
@field_validator('year_visibility')
|
|
45
|
+
def year_visibility_validate_enum(cls, value):
|
|
46
|
+
"""Validates the enum"""
|
|
47
|
+
if value not in set(['Self', 'Public', 'MutualFollow', 'Followers', 'Following']):
|
|
48
|
+
raise ValueError("must be one of enum values ('Self', 'Public', 'MutualFollow', 'Followers', 'Following')")
|
|
49
|
+
return value
|
|
50
|
+
|
|
51
|
+
model_config = ConfigDict(
|
|
52
|
+
populate_by_name=True,
|
|
53
|
+
validate_assignment=True,
|
|
54
|
+
protected_namespaces=(),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def to_str(self) -> str:
|
|
59
|
+
"""Returns the string representation of the model using alias"""
|
|
60
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
61
|
+
|
|
62
|
+
def to_json(self) -> str:
|
|
63
|
+
"""Returns the JSON representation of the model using alias"""
|
|
64
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
65
|
+
return json.dumps(self.to_dict())
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
69
|
+
"""Create an instance of UserLegacyExtendedProfileBirthdate from a JSON string"""
|
|
70
|
+
return cls.from_dict(json.loads(json_str))
|
|
71
|
+
|
|
72
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
73
|
+
"""Return the dictionary representation of the model using alias.
|
|
74
|
+
|
|
75
|
+
This has the following differences from calling pydantic's
|
|
76
|
+
`self.model_dump(by_alias=True)`:
|
|
77
|
+
|
|
78
|
+
* `None` is only added to the output dict for nullable fields that
|
|
79
|
+
were set at model initialization. Other fields with value `None`
|
|
80
|
+
are ignored.
|
|
81
|
+
"""
|
|
82
|
+
excluded_fields: Set[str] = set([
|
|
83
|
+
])
|
|
84
|
+
|
|
85
|
+
_dict = self.model_dump(
|
|
86
|
+
by_alias=True,
|
|
87
|
+
exclude=excluded_fields,
|
|
88
|
+
exclude_none=True,
|
|
89
|
+
)
|
|
90
|
+
return _dict
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
94
|
+
"""Create an instance of UserLegacyExtendedProfileBirthdate from a dict"""
|
|
95
|
+
if obj is None:
|
|
96
|
+
return None
|
|
97
|
+
|
|
98
|
+
if not isinstance(obj, dict):
|
|
99
|
+
return cls.model_validate(obj)
|
|
100
|
+
|
|
101
|
+
_obj = cls.model_validate({
|
|
102
|
+
"day": obj.get("day"),
|
|
103
|
+
"month": obj.get("month"),
|
|
104
|
+
"visibility": obj.get("visibility"),
|
|
105
|
+
"year": obj.get("year"),
|
|
106
|
+
"year_visibility": obj.get("year_visibility")
|
|
107
|
+
})
|
|
108
|
+
return _obj
|
|
109
|
+
|
|
110
|
+
|
|
@@ -0,0 +1,100 @@
|
|
|
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, StrictBool, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class UserTipJarSettings(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
UserTipJarSettings
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
bitcoin_handle: Optional[StrictStr] = None
|
|
31
|
+
cash_app_handle: Optional[StrictStr] = None
|
|
32
|
+
ethereum_handle: Optional[StrictStr] = None
|
|
33
|
+
gofundme_handle: Optional[StrictStr] = None
|
|
34
|
+
is_enabled: Optional[StrictBool] = None
|
|
35
|
+
patreon_handle: Optional[StrictStr] = None
|
|
36
|
+
venmo_handle: Optional[StrictStr] = None
|
|
37
|
+
__properties: ClassVar[List[str]] = ["bitcoin_handle", "cash_app_handle", "ethereum_handle", "gofundme_handle", "is_enabled", "patreon_handle", "venmo_handle"]
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(
|
|
40
|
+
populate_by_name=True,
|
|
41
|
+
validate_assignment=True,
|
|
42
|
+
protected_namespaces=(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def to_str(self) -> str:
|
|
47
|
+
"""Returns the string representation of the model using alias"""
|
|
48
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
49
|
+
|
|
50
|
+
def to_json(self) -> str:
|
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
|
52
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
53
|
+
return json.dumps(self.to_dict())
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
|
+
"""Create an instance of UserTipJarSettings from a JSON string"""
|
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
|
59
|
+
|
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
|
62
|
+
|
|
63
|
+
This has the following differences from calling pydantic's
|
|
64
|
+
`self.model_dump(by_alias=True)`:
|
|
65
|
+
|
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
|
67
|
+
were set at model initialization. Other fields with value `None`
|
|
68
|
+
are ignored.
|
|
69
|
+
"""
|
|
70
|
+
excluded_fields: Set[str] = set([
|
|
71
|
+
])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of UserTipJarSettings from a dict"""
|
|
83
|
+
if obj is None:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
if not isinstance(obj, dict):
|
|
87
|
+
return cls.model_validate(obj)
|
|
88
|
+
|
|
89
|
+
_obj = cls.model_validate({
|
|
90
|
+
"bitcoin_handle": obj.get("bitcoin_handle"),
|
|
91
|
+
"cash_app_handle": obj.get("cash_app_handle"),
|
|
92
|
+
"ethereum_handle": obj.get("ethereum_handle"),
|
|
93
|
+
"gofundme_handle": obj.get("gofundme_handle"),
|
|
94
|
+
"is_enabled": obj.get("is_enabled"),
|
|
95
|
+
"patreon_handle": obj.get("patreon_handle"),
|
|
96
|
+
"venmo_handle": obj.get("venmo_handle")
|
|
97
|
+
})
|
|
98
|
+
return _obj
|
|
99
|
+
|
|
100
|
+
|
|
@@ -21,7 +21,7 @@ from typing import Any, List, Optional
|
|
|
21
21
|
from twitter_openapi_python_generated.models.user import User
|
|
22
22
|
from twitter_openapi_python_generated.models.user_unavailable import UserUnavailable
|
|
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
|
USERUNION_ONE_OF_SCHEMAS = ["User", "UserUnavailable"]
|
|
@@ -35,7 +35,7 @@ class UserUnion(BaseModel):
|
|
|
35
35
|
# data type: UserUnavailable
|
|
36
36
|
oneof_schema_2_validator: Optional[UserUnavailable] = None
|
|
37
37
|
actual_instance: Optional[Union[User, UserUnavailable]] = None
|
|
38
|
-
one_of_schemas:
|
|
38
|
+
one_of_schemas: Set[str] = { "User", "UserUnavailable" }
|
|
39
39
|
|
|
40
40
|
model_config = ConfigDict(
|
|
41
41
|
validate_assignment=True,
|
|
@@ -203,6 +203,8 @@ class RESTClientObject:
|
|
|
203
203
|
# Content-Type which generated by urllib3 will be
|
|
204
204
|
# overwritten.
|
|
205
205
|
del headers['Content-Type']
|
|
206
|
+
# Ensures that dict objects are serialized
|
|
207
|
+
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params]
|
|
206
208
|
r = self.pool_manager.request(
|
|
207
209
|
method,
|
|
208
210
|
url,
|