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
|
@@ -0,0 +1,138 @@
|
|
|
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 json
|
|
18
|
+
import pprint
|
|
19
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
20
|
+
from typing import Any, List, Optional
|
|
21
|
+
from twitter_openapi_python_generated.models.create_bookmark_response import CreateBookmarkResponse
|
|
22
|
+
from twitter_openapi_python_generated.models.errors import Errors
|
|
23
|
+
from pydantic import StrictStr, Field
|
|
24
|
+
from typing import Union, List, Set, Optional, Dict
|
|
25
|
+
from typing_extensions import Literal, Self
|
|
26
|
+
|
|
27
|
+
POSTCREATEBOOKMARK200RESPONSE_ONE_OF_SCHEMAS = ["CreateBookmarkResponse", "Errors"]
|
|
28
|
+
|
|
29
|
+
class PostCreateBookmark200Response(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
PostCreateBookmark200Response
|
|
32
|
+
"""
|
|
33
|
+
# data type: CreateBookmarkResponse
|
|
34
|
+
oneof_schema_1_validator: Optional[CreateBookmarkResponse] = None
|
|
35
|
+
# data type: Errors
|
|
36
|
+
oneof_schema_2_validator: Optional[Errors] = None
|
|
37
|
+
actual_instance: Optional[Union[CreateBookmarkResponse, Errors]] = None
|
|
38
|
+
one_of_schemas: Set[str] = { "CreateBookmarkResponse", "Errors" }
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
validate_assignment=True,
|
|
42
|
+
protected_namespaces=(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
47
|
+
if args:
|
|
48
|
+
if len(args) > 1:
|
|
49
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
50
|
+
if kwargs:
|
|
51
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
52
|
+
super().__init__(actual_instance=args[0])
|
|
53
|
+
else:
|
|
54
|
+
super().__init__(**kwargs)
|
|
55
|
+
|
|
56
|
+
@field_validator('actual_instance')
|
|
57
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
58
|
+
instance = PostCreateBookmark200Response.model_construct()
|
|
59
|
+
error_messages = []
|
|
60
|
+
match = 0
|
|
61
|
+
# validate data type: CreateBookmarkResponse
|
|
62
|
+
if not isinstance(v, CreateBookmarkResponse):
|
|
63
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `CreateBookmarkResponse`")
|
|
64
|
+
else:
|
|
65
|
+
match += 1
|
|
66
|
+
# validate data type: Errors
|
|
67
|
+
if not isinstance(v, Errors):
|
|
68
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `Errors`")
|
|
69
|
+
else:
|
|
70
|
+
match += 1
|
|
71
|
+
if match > 1:
|
|
72
|
+
# more than 1 match
|
|
73
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in PostCreateBookmark200Response with oneOf schemas: CreateBookmarkResponse, Errors. Details: " + ", ".join(error_messages))
|
|
74
|
+
elif match == 0:
|
|
75
|
+
# no match
|
|
76
|
+
raise ValueError("No match found when setting `actual_instance` in PostCreateBookmark200Response with oneOf schemas: CreateBookmarkResponse, Errors. Details: " + ", ".join(error_messages))
|
|
77
|
+
else:
|
|
78
|
+
return v
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
82
|
+
return cls.from_json(json.dumps(obj))
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_json(cls, json_str: str) -> Self:
|
|
86
|
+
"""Returns the object represented by the json string"""
|
|
87
|
+
instance = cls.model_construct()
|
|
88
|
+
error_messages = []
|
|
89
|
+
match = 0
|
|
90
|
+
|
|
91
|
+
# deserialize data into CreateBookmarkResponse
|
|
92
|
+
try:
|
|
93
|
+
instance.actual_instance = CreateBookmarkResponse.from_json(json_str)
|
|
94
|
+
match += 1
|
|
95
|
+
except (ValidationError, ValueError) as e:
|
|
96
|
+
error_messages.append(str(e))
|
|
97
|
+
# deserialize data into Errors
|
|
98
|
+
try:
|
|
99
|
+
instance.actual_instance = Errors.from_json(json_str)
|
|
100
|
+
match += 1
|
|
101
|
+
except (ValidationError, ValueError) as e:
|
|
102
|
+
error_messages.append(str(e))
|
|
103
|
+
|
|
104
|
+
if match > 1:
|
|
105
|
+
# more than 1 match
|
|
106
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into PostCreateBookmark200Response with oneOf schemas: CreateBookmarkResponse, Errors. Details: " + ", ".join(error_messages))
|
|
107
|
+
elif match == 0:
|
|
108
|
+
# no match
|
|
109
|
+
raise ValueError("No match found when deserializing the JSON string into PostCreateBookmark200Response with oneOf schemas: CreateBookmarkResponse, Errors. Details: " + ", ".join(error_messages))
|
|
110
|
+
else:
|
|
111
|
+
return instance
|
|
112
|
+
|
|
113
|
+
def to_json(self) -> str:
|
|
114
|
+
"""Returns the JSON representation of the actual instance"""
|
|
115
|
+
if self.actual_instance is None:
|
|
116
|
+
return "null"
|
|
117
|
+
|
|
118
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
119
|
+
return self.actual_instance.to_json()
|
|
120
|
+
else:
|
|
121
|
+
return json.dumps(self.actual_instance)
|
|
122
|
+
|
|
123
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], CreateBookmarkResponse, Errors]]:
|
|
124
|
+
"""Returns the dict representation of the actual instance"""
|
|
125
|
+
if self.actual_instance is None:
|
|
126
|
+
return None
|
|
127
|
+
|
|
128
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
129
|
+
return self.actual_instance.to_dict()
|
|
130
|
+
else:
|
|
131
|
+
# primitive type
|
|
132
|
+
return self.actual_instance
|
|
133
|
+
|
|
134
|
+
def to_str(self) -> str:
|
|
135
|
+
"""Returns the string representation of the actual instance"""
|
|
136
|
+
return pprint.pformat(self.model_dump())
|
|
137
|
+
|
|
138
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Twitter OpenAPI
|
|
5
|
+
|
|
6
|
+
Twitter OpenAPI(Swagger) specification
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1
|
|
9
|
+
Contact: yuki@yuki0311.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.post_create_bookmark_request_variables import PostCreateBookmarkRequestVariables
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class PostCreateBookmarkRequest(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
PostCreateBookmarkRequest
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
query_id: StrictStr = Field(alias="queryId")
|
|
32
|
+
variables: PostCreateBookmarkRequestVariables
|
|
33
|
+
__properties: ClassVar[List[str]] = ["queryId", "variables"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of PostCreateBookmarkRequest from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of variables
|
|
75
|
+
if self.variables:
|
|
76
|
+
_dict['variables'] = self.variables.to_dict()
|
|
77
|
+
return _dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of PostCreateBookmarkRequest from a dict"""
|
|
82
|
+
if obj is None:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
if not isinstance(obj, dict):
|
|
86
|
+
return cls.model_validate(obj)
|
|
87
|
+
|
|
88
|
+
_obj = cls.model_validate({
|
|
89
|
+
"queryId": obj.get("queryId") if obj.get("queryId") is not None else 'aoDbu3RHznuiSkQ9aNM67Q',
|
|
90
|
+
"variables": PostCreateBookmarkRequestVariables.from_dict(obj["variables"]) if obj.get("variables") is not None else None
|
|
91
|
+
})
|
|
92
|
+
return _obj
|
|
93
|
+
|
|
94
|
+
|
|
@@ -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 PostCreateBookmarkRequestVariables(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
PostCreateBookmarkRequestVariables
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
tweet_id: StrictStr
|
|
31
|
+
__properties: ClassVar[List[str]] = ["tweet_id"]
|
|
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 PostCreateBookmarkRequestVariables 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 PostCreateBookmarkRequestVariables 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
|
+
"tweet_id": obj.get("tweet_id") if obj.get("tweet_id") is not None else '1349129669258448897'
|
|
85
|
+
})
|
|
86
|
+
return _obj
|
|
87
|
+
|
|
88
|
+
|
|
@@ -21,7 +21,7 @@ from typing import Any, List, Optional
|
|
|
21
21
|
from twitter_openapi_python_generated.models.create_retweet_response import CreateRetweetResponse
|
|
22
22
|
from twitter_openapi_python_generated.models.errors import Errors
|
|
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
|
POSTCREATERETWEET200RESPONSE_ONE_OF_SCHEMAS = ["CreateRetweetResponse", "Errors"]
|
|
@@ -35,7 +35,7 @@ class PostCreateRetweet200Response(BaseModel):
|
|
|
35
35
|
# data type: Errors
|
|
36
36
|
oneof_schema_2_validator: Optional[Errors] = None
|
|
37
37
|
actual_instance: Optional[Union[CreateRetweetResponse, Errors]] = None
|
|
38
|
-
one_of_schemas:
|
|
38
|
+
one_of_schemas: Set[str] = { "CreateRetweetResponse", "Errors" }
|
|
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.create_tweet_response import CreateTweetResponse
|
|
22
22
|
from twitter_openapi_python_generated.models.errors import Errors
|
|
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
|
POSTCREATETWEET200RESPONSE_ONE_OF_SCHEMAS = ["CreateTweetResponse", "Errors"]
|
|
@@ -35,7 +35,7 @@ class PostCreateTweet200Response(BaseModel):
|
|
|
35
35
|
# data type: Errors
|
|
36
36
|
oneof_schema_2_validator: Optional[Errors] = None
|
|
37
37
|
actual_instance: Optional[Union[CreateTweetResponse, Errors]] = None
|
|
38
|
-
one_of_schemas:
|
|
38
|
+
one_of_schemas: Set[str] = { "CreateTweetResponse", "Errors" }
|
|
39
39
|
|
|
40
40
|
model_config = ConfigDict(
|
|
41
41
|
validate_assignment=True,
|
|
@@ -0,0 +1,138 @@
|
|
|
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 json
|
|
18
|
+
import pprint
|
|
19
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
20
|
+
from typing import Any, List, Optional
|
|
21
|
+
from twitter_openapi_python_generated.models.delete_bookmark_response import DeleteBookmarkResponse
|
|
22
|
+
from twitter_openapi_python_generated.models.errors import Errors
|
|
23
|
+
from pydantic import StrictStr, Field
|
|
24
|
+
from typing import Union, List, Set, Optional, Dict
|
|
25
|
+
from typing_extensions import Literal, Self
|
|
26
|
+
|
|
27
|
+
POSTDELETEBOOKMARK200RESPONSE_ONE_OF_SCHEMAS = ["DeleteBookmarkResponse", "Errors"]
|
|
28
|
+
|
|
29
|
+
class PostDeleteBookmark200Response(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
PostDeleteBookmark200Response
|
|
32
|
+
"""
|
|
33
|
+
# data type: DeleteBookmarkResponse
|
|
34
|
+
oneof_schema_1_validator: Optional[DeleteBookmarkResponse] = None
|
|
35
|
+
# data type: Errors
|
|
36
|
+
oneof_schema_2_validator: Optional[Errors] = None
|
|
37
|
+
actual_instance: Optional[Union[DeleteBookmarkResponse, Errors]] = None
|
|
38
|
+
one_of_schemas: Set[str] = { "DeleteBookmarkResponse", "Errors" }
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
validate_assignment=True,
|
|
42
|
+
protected_namespaces=(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
47
|
+
if args:
|
|
48
|
+
if len(args) > 1:
|
|
49
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
50
|
+
if kwargs:
|
|
51
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
52
|
+
super().__init__(actual_instance=args[0])
|
|
53
|
+
else:
|
|
54
|
+
super().__init__(**kwargs)
|
|
55
|
+
|
|
56
|
+
@field_validator('actual_instance')
|
|
57
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
58
|
+
instance = PostDeleteBookmark200Response.model_construct()
|
|
59
|
+
error_messages = []
|
|
60
|
+
match = 0
|
|
61
|
+
# validate data type: DeleteBookmarkResponse
|
|
62
|
+
if not isinstance(v, DeleteBookmarkResponse):
|
|
63
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `DeleteBookmarkResponse`")
|
|
64
|
+
else:
|
|
65
|
+
match += 1
|
|
66
|
+
# validate data type: Errors
|
|
67
|
+
if not isinstance(v, Errors):
|
|
68
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `Errors`")
|
|
69
|
+
else:
|
|
70
|
+
match += 1
|
|
71
|
+
if match > 1:
|
|
72
|
+
# more than 1 match
|
|
73
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in PostDeleteBookmark200Response with oneOf schemas: DeleteBookmarkResponse, Errors. Details: " + ", ".join(error_messages))
|
|
74
|
+
elif match == 0:
|
|
75
|
+
# no match
|
|
76
|
+
raise ValueError("No match found when setting `actual_instance` in PostDeleteBookmark200Response with oneOf schemas: DeleteBookmarkResponse, Errors. Details: " + ", ".join(error_messages))
|
|
77
|
+
else:
|
|
78
|
+
return v
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
82
|
+
return cls.from_json(json.dumps(obj))
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_json(cls, json_str: str) -> Self:
|
|
86
|
+
"""Returns the object represented by the json string"""
|
|
87
|
+
instance = cls.model_construct()
|
|
88
|
+
error_messages = []
|
|
89
|
+
match = 0
|
|
90
|
+
|
|
91
|
+
# deserialize data into DeleteBookmarkResponse
|
|
92
|
+
try:
|
|
93
|
+
instance.actual_instance = DeleteBookmarkResponse.from_json(json_str)
|
|
94
|
+
match += 1
|
|
95
|
+
except (ValidationError, ValueError) as e:
|
|
96
|
+
error_messages.append(str(e))
|
|
97
|
+
# deserialize data into Errors
|
|
98
|
+
try:
|
|
99
|
+
instance.actual_instance = Errors.from_json(json_str)
|
|
100
|
+
match += 1
|
|
101
|
+
except (ValidationError, ValueError) as e:
|
|
102
|
+
error_messages.append(str(e))
|
|
103
|
+
|
|
104
|
+
if match > 1:
|
|
105
|
+
# more than 1 match
|
|
106
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into PostDeleteBookmark200Response with oneOf schemas: DeleteBookmarkResponse, Errors. Details: " + ", ".join(error_messages))
|
|
107
|
+
elif match == 0:
|
|
108
|
+
# no match
|
|
109
|
+
raise ValueError("No match found when deserializing the JSON string into PostDeleteBookmark200Response with oneOf schemas: DeleteBookmarkResponse, Errors. Details: " + ", ".join(error_messages))
|
|
110
|
+
else:
|
|
111
|
+
return instance
|
|
112
|
+
|
|
113
|
+
def to_json(self) -> str:
|
|
114
|
+
"""Returns the JSON representation of the actual instance"""
|
|
115
|
+
if self.actual_instance is None:
|
|
116
|
+
return "null"
|
|
117
|
+
|
|
118
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
119
|
+
return self.actual_instance.to_json()
|
|
120
|
+
else:
|
|
121
|
+
return json.dumps(self.actual_instance)
|
|
122
|
+
|
|
123
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], DeleteBookmarkResponse, Errors]]:
|
|
124
|
+
"""Returns the dict representation of the actual instance"""
|
|
125
|
+
if self.actual_instance is None:
|
|
126
|
+
return None
|
|
127
|
+
|
|
128
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
129
|
+
return self.actual_instance.to_dict()
|
|
130
|
+
else:
|
|
131
|
+
# primitive type
|
|
132
|
+
return self.actual_instance
|
|
133
|
+
|
|
134
|
+
def to_str(self) -> str:
|
|
135
|
+
"""Returns the string representation of the actual instance"""
|
|
136
|
+
return pprint.pformat(self.model_dump())
|
|
137
|
+
|
|
138
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Twitter OpenAPI
|
|
5
|
+
|
|
6
|
+
Twitter OpenAPI(Swagger) specification
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1
|
|
9
|
+
Contact: yuki@yuki0311.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.post_create_bookmark_request_variables import PostCreateBookmarkRequestVariables
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class PostDeleteBookmarkRequest(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
PostDeleteBookmarkRequest
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
query_id: StrictStr = Field(alias="queryId")
|
|
32
|
+
variables: PostCreateBookmarkRequestVariables
|
|
33
|
+
__properties: ClassVar[List[str]] = ["queryId", "variables"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of PostDeleteBookmarkRequest from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of variables
|
|
75
|
+
if self.variables:
|
|
76
|
+
_dict['variables'] = self.variables.to_dict()
|
|
77
|
+
return _dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of PostDeleteBookmarkRequest from a dict"""
|
|
82
|
+
if obj is None:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
if not isinstance(obj, dict):
|
|
86
|
+
return cls.model_validate(obj)
|
|
87
|
+
|
|
88
|
+
_obj = cls.model_validate({
|
|
89
|
+
"queryId": obj.get("queryId") if obj.get("queryId") is not None else 'Wlmlj2-xzyS1GN3a6cj-mQ',
|
|
90
|
+
"variables": PostCreateBookmarkRequestVariables.from_dict(obj["variables"]) if obj.get("variables") is not None else None
|
|
91
|
+
})
|
|
92
|
+
return _obj
|
|
93
|
+
|
|
94
|
+
|
|
@@ -21,7 +21,7 @@ from typing import Any, List, Optional
|
|
|
21
21
|
from twitter_openapi_python_generated.models.delete_retweet_response import DeleteRetweetResponse
|
|
22
22
|
from twitter_openapi_python_generated.models.errors import Errors
|
|
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
|
POSTDELETERETWEET200RESPONSE_ONE_OF_SCHEMAS = ["DeleteRetweetResponse", "Errors"]
|
|
@@ -35,7 +35,7 @@ class PostDeleteRetweet200Response(BaseModel):
|
|
|
35
35
|
# data type: Errors
|
|
36
36
|
oneof_schema_2_validator: Optional[Errors] = None
|
|
37
37
|
actual_instance: Optional[Union[DeleteRetweetResponse, Errors]] = None
|
|
38
|
-
one_of_schemas:
|
|
38
|
+
one_of_schemas: Set[str] = { "DeleteRetweetResponse", "Errors" }
|
|
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.delete_tweet_response import DeleteTweetResponse
|
|
22
22
|
from twitter_openapi_python_generated.models.errors import Errors
|
|
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
|
POSTDELETETWEET200RESPONSE_ONE_OF_SCHEMAS = ["DeleteTweetResponse", "Errors"]
|
|
@@ -35,7 +35,7 @@ class PostDeleteTweet200Response(BaseModel):
|
|
|
35
35
|
# data type: Errors
|
|
36
36
|
oneof_schema_2_validator: Optional[Errors] = None
|
|
37
37
|
actual_instance: Optional[Union[DeleteTweetResponse, Errors]] = None
|
|
38
|
-
one_of_schemas:
|
|
38
|
+
one_of_schemas: Set[str] = { "DeleteTweetResponse", "Errors" }
|
|
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.favorite_tweet_response_data import FavoriteTweetResponseData
|
|
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
|
POSTFAVORITETWEET200RESPONSE_ONE_OF_SCHEMAS = ["Errors", "FavoriteTweetResponseData"]
|
|
@@ -35,7 +35,7 @@ class PostFavoriteTweet200Response(BaseModel):
|
|
|
35
35
|
# data type: Errors
|
|
36
36
|
oneof_schema_2_validator: Optional[Errors] = None
|
|
37
37
|
actual_instance: Optional[Union[Errors, FavoriteTweetResponseData]] = None
|
|
38
|
-
one_of_schemas:
|
|
38
|
+
one_of_schemas: Set[str] = { "Errors", "FavoriteTweetResponseData" }
|
|
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.unfavorite_tweet_response_data import UnfavoriteTweetResponseData
|
|
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
|
POSTUNFAVORITETWEET200RESPONSE_ONE_OF_SCHEMAS = ["Errors", "UnfavoriteTweetResponseData"]
|
|
@@ -35,7 +35,7 @@ class PostUnfavoriteTweet200Response(BaseModel):
|
|
|
35
35
|
# data type: Errors
|
|
36
36
|
oneof_schema_2_validator: Optional[Errors] = None
|
|
37
37
|
actual_instance: Optional[Union[Errors, UnfavoriteTweetResponseData]] = None
|
|
38
|
-
one_of_schemas:
|
|
38
|
+
one_of_schemas: Set[str] = { "Errors", "UnfavoriteTweetResponseData" }
|
|
39
39
|
|
|
40
40
|
model_config = ConfigDict(
|
|
41
41
|
validate_assignment=True,
|