twitter-openapi-python-generated 0.0.31__py3-none-any.whl → 0.0.32__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 +28 -4
- twitter_openapi_python_generated/api/tweet_api.py +1356 -84
- twitter_openapi_python_generated/api_client.py +1 -1
- twitter_openapi_python_generated/configuration.py +1 -1
- twitter_openapi_python_generated/models/__init__.py +27 -3
- twitter_openapi_python_generated/models/about_community_result.py +95 -0
- twitter_openapi_python_generated/models/{timeline_v2.py → about_community_results.py} +12 -12
- twitter_openapi_python_generated/models/about_community_tweet_data.py +92 -0
- twitter_openapi_python_generated/models/analysis_results.py +94 -0
- twitter_openapi_python_generated/models/birdwatch_pivot.py +3 -1
- twitter_openapi_python_generated/models/community_about_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/community_media_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/community_tweets_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/content_item_type.py +2 -0
- twitter_openapi_python_generated/models/grok_image_annotation.py +90 -0
- twitter_openapi_python_generated/models/grok_share_attachment.py +3 -1
- twitter_openapi_python_generated/models/grok_share_attachment_item.py +10 -2
- twitter_openapi_python_generated/models/home_timeline_response_data.py +2 -2
- twitter_openapi_python_generated/models/instruction_type.py +2 -0
- twitter_openapi_python_generated/models/instruction_union.py +46 -8
- twitter_openapi_python_generated/models/item_content_union.py +27 -8
- twitter_openapi_python_generated/models/list_tweets_timeline_data.py +2 -2
- twitter_openapi_python_generated/models/list_tweets_timeline_list.py +3 -3
- twitter_openapi_python_generated/models/media_community_result.py +95 -0
- twitter_openapi_python_generated/models/media_community_results.py +92 -0
- twitter_openapi_python_generated/models/media_community_tweet_data.py +92 -0
- twitter_openapi_python_generated/models/media_result.py +8 -2
- twitter_openapi_python_generated/models/module_item.py +2 -2
- twitter_openapi_python_generated/models/notification_template.py +93 -0
- twitter_openapi_python_generated/models/notifications_result.py +105 -0
- twitter_openapi_python_generated/models/notifications_timeline_data.py +92 -0
- twitter_openapi_python_generated/models/notifications_timeline_response.py +102 -0
- twitter_openapi_python_generated/models/notifications_user_results.py +92 -0
- twitter_openapi_python_generated/models/notifications_viewer_v2.py +92 -0
- twitter_openapi_python_generated/models/post_create_bookmark_request.py +5 -1
- twitter_openapi_python_generated/models/post_create_retweet_request.py +5 -1
- twitter_openapi_python_generated/models/post_create_tweet_request.py +6 -2
- twitter_openapi_python_generated/models/post_create_tweet_request_features.py +19 -5
- twitter_openapi_python_generated/models/post_delete_bookmark_request.py +5 -1
- twitter_openapi_python_generated/models/post_delete_retweet_request.py +5 -1
- twitter_openapi_python_generated/models/post_delete_tweet_request.py +5 -1
- twitter_openapi_python_generated/models/post_favorite_tweet_request.py +5 -1
- twitter_openapi_python_generated/models/post_unfavorite_tweet_request.py +5 -1
- twitter_openapi_python_generated/models/ranked_community_result.py +95 -0
- twitter_openapi_python_generated/models/ranked_community_results.py +92 -0
- twitter_openapi_python_generated/models/ranked_community_tweet_data.py +92 -0
- twitter_openapi_python_generated/models/rich_message.py +90 -0
- twitter_openapi_python_generated/models/search_timeline_data.py +2 -2
- twitter_openapi_python_generated/models/timeline_add_entry.py +2 -2
- twitter_openapi_python_generated/models/timeline_clear_entries_unread_state.py +89 -0
- twitter_openapi_python_generated/models/timeline_general_context.py +5 -3
- twitter_openapi_python_generated/models/timeline_mark_entries_unread_greater_than_sort_index.py +102 -0
- twitter_openapi_python_generated/models/timeline_notification.py +116 -0
- twitter_openapi_python_generated/models/{list_tweets_timeline.py → timeline_result.py} +8 -6
- twitter_openapi_python_generated/models/timeline_timeline_module.py +1 -1
- twitter_openapi_python_generated/models/timeline_trend.py +3 -3
- twitter_openapi_python_generated/models/timeline_user.py +2 -2
- twitter_openapi_python_generated/models/tweet.py +1 -1
- twitter_openapi_python_generated/models/tweet_favoriters_response_data.py +3 -3
- twitter_openapi_python_generated/models/tweet_retweeters_response_data.py +3 -3
- twitter_openapi_python_generated/models/type_name.py +2 -0
- twitter_openapi_python_generated/models/user.py +2 -2
- twitter_openapi_python_generated/models/user_tweets_result_v1.py +95 -0
- twitter_openapi_python_generated/models/{user_tweets_result.py → user_tweets_result_v2.py} +7 -7
- twitter_openapi_python_generated/models/user_tweets_user.py +3 -3
- {twitter_openapi_python_generated-0.0.31.dist-info → twitter_openapi_python_generated-0.0.32.dist-info}/METADATA +12 -2
- {twitter_openapi_python_generated-0.0.31.dist-info → twitter_openapi_python_generated-0.0.32.dist-info}/RECORD +71 -47
- {twitter_openapi_python_generated-0.0.31.dist-info → twitter_openapi_python_generated-0.0.32.dist-info}/WHEEL +1 -1
- {twitter_openapi_python_generated-0.0.31.dist-info → twitter_openapi_python_generated-0.0.32.dist-info/licenses}/LICENSE +0 -0
- {twitter_openapi_python_generated-0.0.31.dist-info → twitter_openapi_python_generated-0.0.32.dist-info/licenses}/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.0.31.dist-info → twitter_openapi_python_generated-0.0.32.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
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
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.timeline_result import TimelineResult
|
|
24
|
+
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class MediaCommunityResult(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
MediaCommunityResult
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
typename: TypeName = Field(alias="__typename")
|
|
33
|
+
community_media_timeline: TimelineResult
|
|
34
|
+
__properties: ClassVar[List[str]] = ["__typename", "community_media_timeline"]
|
|
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 MediaCommunityResult 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 community_media_timeline
|
|
76
|
+
if self.community_media_timeline:
|
|
77
|
+
_dict['community_media_timeline'] = self.community_media_timeline.to_dict()
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of MediaCommunityResult 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
|
+
"__typename": obj.get("__typename"),
|
|
91
|
+
"community_media_timeline": TimelineResult.from_dict(obj["community_media_timeline"]) if obj.get("community_media_timeline") is not None else None
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -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_community_result import MediaCommunityResult
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class MediaCommunityResults(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
MediaCommunityResults
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
result: MediaCommunityResult
|
|
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 MediaCommunityResults 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 MediaCommunityResults 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": MediaCommunityResult.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, Field
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.media_community_results import MediaCommunityResults
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class MediaCommunityTweetData(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
MediaCommunityTweetData
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
community_results: MediaCommunityResults = Field(alias="communityResults")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["communityResults"]
|
|
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 MediaCommunityTweetData 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 community_results
|
|
74
|
+
if self.community_results:
|
|
75
|
+
_dict['communityResults'] = self.community_results.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 MediaCommunityTweetData 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
|
+
"communityResults": MediaCommunityResults.from_dict(obj["communityResults"]) if obj.get("communityResults") is not None else None
|
|
89
|
+
})
|
|
90
|
+
return _obj
|
|
91
|
+
|
|
92
|
+
|
|
@@ -19,7 +19,8 @@ import re # noqa: F401
|
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, StrictStr
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from twitter_openapi_python_generated.models.grok_image_annotation import GrokImageAnnotation
|
|
23
24
|
from typing import Optional, Set
|
|
24
25
|
from typing_extensions import Self
|
|
25
26
|
|
|
@@ -27,8 +28,9 @@ class MediaResult(BaseModel):
|
|
|
27
28
|
"""
|
|
28
29
|
MediaResult
|
|
29
30
|
""" # noqa: E501
|
|
31
|
+
grok_image_annotation: Optional[GrokImageAnnotation] = None
|
|
30
32
|
media_key: StrictStr
|
|
31
|
-
__properties: ClassVar[List[str]] = ["media_key"]
|
|
33
|
+
__properties: ClassVar[List[str]] = ["grok_image_annotation", "media_key"]
|
|
32
34
|
|
|
33
35
|
model_config = ConfigDict(
|
|
34
36
|
populate_by_name=True,
|
|
@@ -69,6 +71,9 @@ class MediaResult(BaseModel):
|
|
|
69
71
|
exclude=excluded_fields,
|
|
70
72
|
exclude_none=True,
|
|
71
73
|
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of grok_image_annotation
|
|
75
|
+
if self.grok_image_annotation:
|
|
76
|
+
_dict['grok_image_annotation'] = self.grok_image_annotation.to_dict()
|
|
72
77
|
return _dict
|
|
73
78
|
|
|
74
79
|
@classmethod
|
|
@@ -81,6 +86,7 @@ class MediaResult(BaseModel):
|
|
|
81
86
|
return cls.model_validate(obj)
|
|
82
87
|
|
|
83
88
|
_obj = cls.model_validate({
|
|
89
|
+
"grok_image_annotation": GrokImageAnnotation.from_dict(obj["grok_image_annotation"]) if obj.get("grok_image_annotation") is not None else None,
|
|
84
90
|
"media_key": obj.get("media_key")
|
|
85
91
|
})
|
|
86
92
|
return _obj
|
|
@@ -37,8 +37,8 @@ class ModuleItem(BaseModel):
|
|
|
37
37
|
@field_validator('entry_id')
|
|
38
38
|
def entry_id_validate_regular_expression(cls, value):
|
|
39
39
|
"""Validates the regular expression"""
|
|
40
|
-
if not re.match(r"^(([a-
|
|
41
|
-
raise ValueError(r"must validate the regular expression /^(([a-
|
|
40
|
+
if not re.match(r"^(([a-zA-Z]+|[0-9]+|[0-9a-f]+)(-|$))+", value):
|
|
41
|
+
raise ValueError(r"must validate the regular expression /^(([a-zA-Z]+|[0-9]+|[0-9a-f]+)(-|$))+/")
|
|
42
42
|
return value
|
|
43
43
|
|
|
44
44
|
model_config = ConfigDict(
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class NotificationTemplate(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
NotificationTemplate
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
typename: Optional[TypeName] = Field(default=None, alias="__typename")
|
|
32
|
+
from_users: Optional[List[Dict[str, Any]]] = None
|
|
33
|
+
target_objects: Optional[List[Dict[str, Any]]] = None
|
|
34
|
+
__properties: ClassVar[List[str]] = ["__typename", "from_users", "target_objects"]
|
|
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 NotificationTemplate 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
|
+
return _dict
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
79
|
+
"""Create an instance of NotificationTemplate from a dict"""
|
|
80
|
+
if obj is None:
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
if not isinstance(obj, dict):
|
|
84
|
+
return cls.model_validate(obj)
|
|
85
|
+
|
|
86
|
+
_obj = cls.model_validate({
|
|
87
|
+
"__typename": obj.get("__typename"),
|
|
88
|
+
"from_users": obj.get("from_users"),
|
|
89
|
+
"target_objects": obj.get("target_objects")
|
|
90
|
+
})
|
|
91
|
+
return _obj
|
|
92
|
+
|
|
93
|
+
|
|
@@ -0,0 +1,105 @@
|
|
|
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, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing_extensions import Annotated
|
|
24
|
+
from twitter_openapi_python_generated.models.timeline_result import TimelineResult
|
|
25
|
+
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
26
|
+
from typing import Optional, Set
|
|
27
|
+
from typing_extensions import Self
|
|
28
|
+
|
|
29
|
+
class NotificationsResult(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
NotificationsResult
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
typename: TypeName = Field(alias="__typename")
|
|
34
|
+
notification_timeline: TimelineResult
|
|
35
|
+
rest_id: Annotated[str, Field(strict=True)]
|
|
36
|
+
__properties: ClassVar[List[str]] = ["__typename", "notification_timeline", "rest_id"]
|
|
37
|
+
|
|
38
|
+
@field_validator('rest_id')
|
|
39
|
+
def rest_id_validate_regular_expression(cls, value):
|
|
40
|
+
"""Validates the regular expression"""
|
|
41
|
+
if not re.match(r"^[0-9]+$", value):
|
|
42
|
+
raise ValueError(r"must validate the regular expression /^[0-9]+$/")
|
|
43
|
+
return value
|
|
44
|
+
|
|
45
|
+
model_config = ConfigDict(
|
|
46
|
+
populate_by_name=True,
|
|
47
|
+
validate_assignment=True,
|
|
48
|
+
protected_namespaces=(),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def to_str(self) -> str:
|
|
53
|
+
"""Returns the string representation of the model using alias"""
|
|
54
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
55
|
+
|
|
56
|
+
def to_json(self) -> str:
|
|
57
|
+
"""Returns the JSON representation of the model using alias"""
|
|
58
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
59
|
+
return json.dumps(self.to_dict())
|
|
60
|
+
|
|
61
|
+
@classmethod
|
|
62
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
63
|
+
"""Create an instance of NotificationsResult from a JSON string"""
|
|
64
|
+
return cls.from_dict(json.loads(json_str))
|
|
65
|
+
|
|
66
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
67
|
+
"""Return the dictionary representation of the model using alias.
|
|
68
|
+
|
|
69
|
+
This has the following differences from calling pydantic's
|
|
70
|
+
`self.model_dump(by_alias=True)`:
|
|
71
|
+
|
|
72
|
+
* `None` is only added to the output dict for nullable fields that
|
|
73
|
+
were set at model initialization. Other fields with value `None`
|
|
74
|
+
are ignored.
|
|
75
|
+
"""
|
|
76
|
+
excluded_fields: Set[str] = set([
|
|
77
|
+
])
|
|
78
|
+
|
|
79
|
+
_dict = self.model_dump(
|
|
80
|
+
by_alias=True,
|
|
81
|
+
exclude=excluded_fields,
|
|
82
|
+
exclude_none=True,
|
|
83
|
+
)
|
|
84
|
+
# override the default output from pydantic by calling `to_dict()` of notification_timeline
|
|
85
|
+
if self.notification_timeline:
|
|
86
|
+
_dict['notification_timeline'] = self.notification_timeline.to_dict()
|
|
87
|
+
return _dict
|
|
88
|
+
|
|
89
|
+
@classmethod
|
|
90
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
91
|
+
"""Create an instance of NotificationsResult from a dict"""
|
|
92
|
+
if obj is None:
|
|
93
|
+
return None
|
|
94
|
+
|
|
95
|
+
if not isinstance(obj, dict):
|
|
96
|
+
return cls.model_validate(obj)
|
|
97
|
+
|
|
98
|
+
_obj = cls.model_validate({
|
|
99
|
+
"__typename": obj.get("__typename"),
|
|
100
|
+
"notification_timeline": TimelineResult.from_dict(obj["notification_timeline"]) if obj.get("notification_timeline") is not None else None,
|
|
101
|
+
"rest_id": obj.get("rest_id")
|
|
102
|
+
})
|
|
103
|
+
return _obj
|
|
104
|
+
|
|
105
|
+
|
|
@@ -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.notifications_viewer_v2 import NotificationsViewerV2
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class NotificationsTimelineData(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
NotificationsTimelineData
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
viewer_v2: NotificationsViewerV2
|
|
32
|
+
__properties: ClassVar[List[str]] = ["viewer_v2"]
|
|
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 NotificationsTimelineData 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 viewer_v2
|
|
74
|
+
if self.viewer_v2:
|
|
75
|
+
_dict['viewer_v2'] = self.viewer_v2.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 NotificationsTimelineData 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
|
+
"viewer_v2": NotificationsViewerV2.from_dict(obj["viewer_v2"]) if obj.get("viewer_v2") is not None else None
|
|
89
|
+
})
|
|
90
|
+
return _obj
|
|
91
|
+
|
|
92
|
+
|