twitter-openapi-python-generated 0.0.31__py3-none-any.whl → 0.0.33__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_tweet_request.py +1 -1
- twitter_openapi_python_generated/models/post_create_tweet_request_features.py +19 -5
- 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.33.dist-info}/METADATA +12 -2
- {twitter_openapi_python_generated-0.0.31.dist-info → twitter_openapi_python_generated-0.0.33.dist-info}/RECORD +64 -40
- {twitter_openapi_python_generated-0.0.31.dist-info → twitter_openapi_python_generated-0.0.33.dist-info}/WHEEL +1 -1
- {twitter_openapi_python_generated-0.0.31.dist-info → twitter_openapi_python_generated-0.0.33.dist-info/licenses}/LICENSE +0 -0
- {twitter_openapi_python_generated-0.0.31.dist-info → twitter_openapi_python_generated-0.0.33.dist-info/licenses}/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.0.31.dist-info → twitter_openapi_python_generated-0.0.33.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
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 RichMessage(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
RichMessage
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
rtl: Optional[StrictBool] = None
|
|
31
|
+
text: Optional[StrictStr] = None
|
|
32
|
+
__properties: ClassVar[List[str]] = ["rtl", "text"]
|
|
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 RichMessage 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
|
+
return _dict
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
77
|
+
"""Create an instance of RichMessage from a dict"""
|
|
78
|
+
if obj is None:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
if not isinstance(obj, dict):
|
|
82
|
+
return cls.model_validate(obj)
|
|
83
|
+
|
|
84
|
+
_obj = cls.model_validate({
|
|
85
|
+
"rtl": obj.get("rtl"),
|
|
86
|
+
"text": obj.get("text")
|
|
87
|
+
})
|
|
88
|
+
return _obj
|
|
89
|
+
|
|
90
|
+
|
|
@@ -19,7 +19,7 @@ import re # noqa: F401
|
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
23
|
from twitter_openapi_python_generated.models.search_by_raw_query import SearchByRawQuery
|
|
24
24
|
from typing import Optional, Set
|
|
25
25
|
from typing_extensions import Self
|
|
@@ -28,7 +28,7 @@ class SearchTimelineData(BaseModel):
|
|
|
28
28
|
"""
|
|
29
29
|
SearchTimelineData
|
|
30
30
|
""" # noqa: E501
|
|
31
|
-
search_by_raw_query:
|
|
31
|
+
search_by_raw_query: SearchByRawQuery
|
|
32
32
|
__properties: ClassVar[List[str]] = ["search_by_raw_query"]
|
|
33
33
|
|
|
34
34
|
model_config = ConfigDict(
|
|
@@ -37,8 +37,8 @@ class TimelineAddEntry(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
|
@field_validator('sort_index')
|
|
@@ -0,0 +1,89 @@
|
|
|
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.instruction_type import InstructionType
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class TimelineClearEntriesUnreadState(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
TimelineClearEntriesUnreadState
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
type: InstructionType
|
|
32
|
+
__properties: ClassVar[List[str]] = ["type"]
|
|
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 TimelineClearEntriesUnreadState 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
|
+
return _dict
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
77
|
+
"""Create an instance of TimelineClearEntriesUnreadState from a dict"""
|
|
78
|
+
if obj is None:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
if not isinstance(obj, dict):
|
|
82
|
+
return cls.model_validate(obj)
|
|
83
|
+
|
|
84
|
+
_obj = cls.model_validate({
|
|
85
|
+
"type": obj.get("type")
|
|
86
|
+
})
|
|
87
|
+
return _obj
|
|
88
|
+
|
|
89
|
+
|
|
@@ -29,11 +29,12 @@ class TimelineGeneralContext(BaseModel):
|
|
|
29
29
|
"""
|
|
30
30
|
TimelineGeneralContext
|
|
31
31
|
""" # noqa: E501
|
|
32
|
+
context_image_urls: Optional[List[StrictStr]] = Field(default=None, alias="contextImageUrls")
|
|
32
33
|
context_type: Optional[StrictStr] = Field(default=None, alias="contextType")
|
|
33
34
|
landing_url: Optional[SocialContextLandingUrl] = Field(default=None, alias="landingUrl")
|
|
34
35
|
text: Optional[StrictStr] = None
|
|
35
36
|
type: Optional[SocialContextUnionType] = None
|
|
36
|
-
__properties: ClassVar[List[str]] = ["contextType", "landingUrl", "text", "type"]
|
|
37
|
+
__properties: ClassVar[List[str]] = ["contextImageUrls", "contextType", "landingUrl", "text", "type"]
|
|
37
38
|
|
|
38
39
|
@field_validator('context_type')
|
|
39
40
|
def context_type_validate_enum(cls, value):
|
|
@@ -41,8 +42,8 @@ class TimelineGeneralContext(BaseModel):
|
|
|
41
42
|
if value is None:
|
|
42
43
|
return value
|
|
43
44
|
|
|
44
|
-
if value not in set(['Follow', 'Pin', 'Like', 'Location', 'Sparkle', 'Conversation', 'List', 'Community']):
|
|
45
|
-
raise ValueError("must be one of enum values ('Follow', 'Pin', 'Like', 'Location', 'Sparkle', 'Conversation', 'List', 'Community')")
|
|
45
|
+
if value not in set(['Follow', 'Pin', 'Like', 'Location', 'Sparkle', 'Conversation', 'List', 'Community', 'Facepile']):
|
|
46
|
+
raise ValueError("must be one of enum values ('Follow', 'Pin', 'Like', 'Location', 'Sparkle', 'Conversation', 'List', 'Community', 'Facepile')")
|
|
46
47
|
return value
|
|
47
48
|
|
|
48
49
|
model_config = ConfigDict(
|
|
@@ -99,6 +100,7 @@ class TimelineGeneralContext(BaseModel):
|
|
|
99
100
|
return cls.model_validate(obj)
|
|
100
101
|
|
|
101
102
|
_obj = cls.model_validate({
|
|
103
|
+
"contextImageUrls": obj.get("contextImageUrls"),
|
|
102
104
|
"contextType": obj.get("contextType"),
|
|
103
105
|
"landingUrl": SocialContextLandingUrl.from_dict(obj["landingUrl"]) if obj.get("landingUrl") is not None else None,
|
|
104
106
|
"text": obj.get("text"),
|
twitter_openapi_python_generated/models/timeline_mark_entries_unread_greater_than_sort_index.py
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
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, Optional
|
|
23
|
+
from typing_extensions import Annotated
|
|
24
|
+
from twitter_openapi_python_generated.models.instruction_type import InstructionType
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class TimelineMarkEntriesUnreadGreaterThanSortIndex(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
TimelineMarkEntriesUnreadGreaterThanSortIndex
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
sort_index: Optional[Annotated[str, Field(strict=True)]] = None
|
|
33
|
+
type: InstructionType
|
|
34
|
+
__properties: ClassVar[List[str]] = ["sort_index", "type"]
|
|
35
|
+
|
|
36
|
+
@field_validator('sort_index')
|
|
37
|
+
def sort_index_validate_regular_expression(cls, value):
|
|
38
|
+
"""Validates the regular expression"""
|
|
39
|
+
if value is None:
|
|
40
|
+
return value
|
|
41
|
+
|
|
42
|
+
if not re.match(r"[0-9]+$", value):
|
|
43
|
+
raise ValueError(r"must validate the regular expression /[0-9]+$/")
|
|
44
|
+
return value
|
|
45
|
+
|
|
46
|
+
model_config = ConfigDict(
|
|
47
|
+
populate_by_name=True,
|
|
48
|
+
validate_assignment=True,
|
|
49
|
+
protected_namespaces=(),
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def to_str(self) -> str:
|
|
54
|
+
"""Returns the string representation of the model using alias"""
|
|
55
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
56
|
+
|
|
57
|
+
def to_json(self) -> str:
|
|
58
|
+
"""Returns the JSON representation of the model using alias"""
|
|
59
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
60
|
+
return json.dumps(self.to_dict())
|
|
61
|
+
|
|
62
|
+
@classmethod
|
|
63
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
64
|
+
"""Create an instance of TimelineMarkEntriesUnreadGreaterThanSortIndex from a JSON string"""
|
|
65
|
+
return cls.from_dict(json.loads(json_str))
|
|
66
|
+
|
|
67
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
68
|
+
"""Return the dictionary representation of the model using alias.
|
|
69
|
+
|
|
70
|
+
This has the following differences from calling pydantic's
|
|
71
|
+
`self.model_dump(by_alias=True)`:
|
|
72
|
+
|
|
73
|
+
* `None` is only added to the output dict for nullable fields that
|
|
74
|
+
were set at model initialization. Other fields with value `None`
|
|
75
|
+
are ignored.
|
|
76
|
+
"""
|
|
77
|
+
excluded_fields: Set[str] = set([
|
|
78
|
+
])
|
|
79
|
+
|
|
80
|
+
_dict = self.model_dump(
|
|
81
|
+
by_alias=True,
|
|
82
|
+
exclude=excluded_fields,
|
|
83
|
+
exclude_none=True,
|
|
84
|
+
)
|
|
85
|
+
return _dict
|
|
86
|
+
|
|
87
|
+
@classmethod
|
|
88
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
89
|
+
"""Create an instance of TimelineMarkEntriesUnreadGreaterThanSortIndex from a dict"""
|
|
90
|
+
if obj is None:
|
|
91
|
+
return None
|
|
92
|
+
|
|
93
|
+
if not isinstance(obj, dict):
|
|
94
|
+
return cls.model_validate(obj)
|
|
95
|
+
|
|
96
|
+
_obj = cls.model_validate({
|
|
97
|
+
"sort_index": obj.get("sort_index"),
|
|
98
|
+
"type": obj.get("type")
|
|
99
|
+
})
|
|
100
|
+
return _obj
|
|
101
|
+
|
|
102
|
+
|
|
@@ -0,0 +1,116 @@
|
|
|
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.content_item_type import ContentItemType
|
|
24
|
+
from twitter_openapi_python_generated.models.notification_template import NotificationTemplate
|
|
25
|
+
from twitter_openapi_python_generated.models.rich_message import RichMessage
|
|
26
|
+
from twitter_openapi_python_generated.models.social_context_landing_url import SocialContextLandingUrl
|
|
27
|
+
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
28
|
+
from typing import Optional, Set
|
|
29
|
+
from typing_extensions import Self
|
|
30
|
+
|
|
31
|
+
class TimelineNotification(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
TimelineNotification
|
|
34
|
+
""" # noqa: E501
|
|
35
|
+
typename: TypeName = Field(alias="__typename")
|
|
36
|
+
id: StrictStr
|
|
37
|
+
item_type: ContentItemType = Field(alias="itemType")
|
|
38
|
+
notification_icon: StrictStr
|
|
39
|
+
notification_url: SocialContextLandingUrl
|
|
40
|
+
rich_message: RichMessage
|
|
41
|
+
template: NotificationTemplate
|
|
42
|
+
timestamp_ms: StrictStr
|
|
43
|
+
__properties: ClassVar[List[str]] = ["__typename", "id", "itemType", "notification_icon", "notification_url", "rich_message", "template", "timestamp_ms"]
|
|
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 TimelineNotification 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_url
|
|
85
|
+
if self.notification_url:
|
|
86
|
+
_dict['notification_url'] = self.notification_url.to_dict()
|
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of rich_message
|
|
88
|
+
if self.rich_message:
|
|
89
|
+
_dict['rich_message'] = self.rich_message.to_dict()
|
|
90
|
+
# override the default output from pydantic by calling `to_dict()` of template
|
|
91
|
+
if self.template:
|
|
92
|
+
_dict['template'] = self.template.to_dict()
|
|
93
|
+
return _dict
|
|
94
|
+
|
|
95
|
+
@classmethod
|
|
96
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
97
|
+
"""Create an instance of TimelineNotification from a dict"""
|
|
98
|
+
if obj is None:
|
|
99
|
+
return None
|
|
100
|
+
|
|
101
|
+
if not isinstance(obj, dict):
|
|
102
|
+
return cls.model_validate(obj)
|
|
103
|
+
|
|
104
|
+
_obj = cls.model_validate({
|
|
105
|
+
"__typename": obj.get("__typename"),
|
|
106
|
+
"id": obj.get("id"),
|
|
107
|
+
"itemType": obj.get("itemType"),
|
|
108
|
+
"notification_icon": obj.get("notification_icon"),
|
|
109
|
+
"notification_url": SocialContextLandingUrl.from_dict(obj["notification_url"]) if obj.get("notification_url") is not None else None,
|
|
110
|
+
"rich_message": RichMessage.from_dict(obj["rich_message"]) if obj.get("rich_message") is not None else None,
|
|
111
|
+
"template": NotificationTemplate.from_dict(obj["template"]) if obj.get("template") is not None else None,
|
|
112
|
+
"timestamp_ms": obj.get("timestamp_ms")
|
|
113
|
+
})
|
|
114
|
+
return _obj
|
|
115
|
+
|
|
116
|
+
|
|
@@ -18,18 +18,19 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
from pydantic import BaseModel, ConfigDict
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from twitter_openapi_python_generated.models.timeline import Timeline
|
|
24
24
|
from typing import Optional, Set
|
|
25
25
|
from typing_extensions import Self
|
|
26
26
|
|
|
27
|
-
class
|
|
27
|
+
class TimelineResult(BaseModel):
|
|
28
28
|
"""
|
|
29
|
-
|
|
29
|
+
TimelineResult
|
|
30
30
|
""" # noqa: E501
|
|
31
|
+
id: Optional[StrictStr] = None
|
|
31
32
|
timeline: Optional[Timeline] = None
|
|
32
|
-
__properties: ClassVar[List[str]] = ["timeline"]
|
|
33
|
+
__properties: ClassVar[List[str]] = ["id", "timeline"]
|
|
33
34
|
|
|
34
35
|
model_config = ConfigDict(
|
|
35
36
|
populate_by_name=True,
|
|
@@ -49,7 +50,7 @@ class ListTweetsTimeline(BaseModel):
|
|
|
49
50
|
|
|
50
51
|
@classmethod
|
|
51
52
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
-
"""Create an instance of
|
|
53
|
+
"""Create an instance of TimelineResult from a JSON string"""
|
|
53
54
|
return cls.from_dict(json.loads(json_str))
|
|
54
55
|
|
|
55
56
|
def to_dict(self) -> Dict[str, Any]:
|
|
@@ -77,7 +78,7 @@ class ListTweetsTimeline(BaseModel):
|
|
|
77
78
|
|
|
78
79
|
@classmethod
|
|
79
80
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
-
"""Create an instance of
|
|
81
|
+
"""Create an instance of TimelineResult from a dict"""
|
|
81
82
|
if obj is None:
|
|
82
83
|
return None
|
|
83
84
|
|
|
@@ -85,6 +86,7 @@ class ListTweetsTimeline(BaseModel):
|
|
|
85
86
|
return cls.model_validate(obj)
|
|
86
87
|
|
|
87
88
|
_obj = cls.model_validate({
|
|
89
|
+
"id": obj.get("id"),
|
|
88
90
|
"timeline": Timeline.from_dict(obj["timeline"]) if obj.get("timeline") is not None else None
|
|
89
91
|
})
|
|
90
92
|
return _obj
|
|
@@ -33,7 +33,7 @@ class TimelineTimelineModule(BaseModel):
|
|
|
33
33
|
TimelineTimelineModule
|
|
34
34
|
""" # noqa: E501
|
|
35
35
|
typename: StrictStr = Field(alias="__typename")
|
|
36
|
-
client_event_info: ClientEventInfo = Field(alias="clientEventInfo")
|
|
36
|
+
client_event_info: Optional[ClientEventInfo] = Field(default=None, alias="clientEventInfo")
|
|
37
37
|
display_type: DisplayType = Field(alias="displayType")
|
|
38
38
|
entry_type: ContentEntryType = Field(alias="entryType")
|
|
39
39
|
feedback_info: Optional[FeedbackInfo] = Field(default=None, alias="feedbackInfo")
|
|
@@ -35,12 +35,12 @@ class TimelineTrend(BaseModel):
|
|
|
35
35
|
TimelineTrend
|
|
36
36
|
""" # noqa: E501
|
|
37
37
|
typename: TypeName = Field(alias="__typename")
|
|
38
|
-
images: List[TrendImage]
|
|
38
|
+
images: Optional[List[TrendImage]] = None
|
|
39
39
|
is_ai_trend: Optional[StrictBool] = None
|
|
40
|
-
item_type: ContentItemType = Field(alias="itemType")
|
|
40
|
+
item_type: Optional[ContentItemType] = Field(default=None, alias="itemType")
|
|
41
41
|
name: StrictStr
|
|
42
42
|
social_context: Optional[SocialContextUnion] = None
|
|
43
|
-
thumbnail_image: ThumbnailImage
|
|
43
|
+
thumbnail_image: Optional[ThumbnailImage] = None
|
|
44
44
|
trend_metadata: TrendMetadata
|
|
45
45
|
trend_url: SocialContextLandingUrl
|
|
46
46
|
__properties: ClassVar[List[str]] = ["__typename", "images", "is_ai_trend", "itemType", "name", "social_context", "thumbnail_image", "trend_metadata", "trend_url"]
|
|
@@ -41,8 +41,8 @@ class TimelineUser(BaseModel):
|
|
|
41
41
|
@field_validator('user_display_type')
|
|
42
42
|
def user_display_type_validate_enum(cls, value):
|
|
43
43
|
"""Validates the enum"""
|
|
44
|
-
if value not in set(['User', 'UserDetailed', 'SubscribableUser']):
|
|
45
|
-
raise ValueError("must be one of enum values ('User', 'UserDetailed', 'SubscribableUser')")
|
|
44
|
+
if value not in set(['User', 'UserDetailed', 'SubscribableUser', 'UserConcise']):
|
|
45
|
+
raise ValueError("must be one of enum values ('User', 'UserDetailed', 'SubscribableUser', 'UserConcise')")
|
|
46
46
|
return value
|
|
47
47
|
|
|
48
48
|
model_config = ConfigDict(
|
|
@@ -26,7 +26,6 @@ from twitter_openapi_python_generated.models.author_community_relationship impor
|
|
|
26
26
|
from twitter_openapi_python_generated.models.birdwatch_pivot import BirdwatchPivot
|
|
27
27
|
from twitter_openapi_python_generated.models.community import Community
|
|
28
28
|
from twitter_openapi_python_generated.models.community_relationship import CommunityRelationship
|
|
29
|
-
from twitter_openapi_python_generated.models.grok_share_attachment import GrokShareAttachment
|
|
30
29
|
from twitter_openapi_python_generated.models.note_tweet import NoteTweet
|
|
31
30
|
from twitter_openapi_python_generated.models.super_follows_reply_user_result import SuperFollowsReplyUserResult
|
|
32
31
|
from twitter_openapi_python_generated.models.trend_results import TrendResults
|
|
@@ -221,6 +220,7 @@ class Tweet(BaseModel):
|
|
|
221
220
|
})
|
|
222
221
|
return _obj
|
|
223
222
|
|
|
223
|
+
from twitter_openapi_python_generated.models.grok_share_attachment import GrokShareAttachment
|
|
224
224
|
from twitter_openapi_python_generated.models.item_result import ItemResult
|
|
225
225
|
from twitter_openapi_python_generated.models.quoted_ref_result import QuotedRefResult
|
|
226
226
|
from twitter_openapi_python_generated.models.tweet_legacy import TweetLegacy
|
|
@@ -20,7 +20,7 @@ import json
|
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
-
from twitter_openapi_python_generated.models.
|
|
23
|
+
from twitter_openapi_python_generated.models.timeline_result import TimelineResult
|
|
24
24
|
from typing import Optional, Set
|
|
25
25
|
from typing_extensions import Self
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ class TweetFavoritersResponseData(BaseModel):
|
|
|
28
28
|
"""
|
|
29
29
|
TweetFavoritersResponseData
|
|
30
30
|
""" # noqa: E501
|
|
31
|
-
favoriters_timeline: Optional[
|
|
31
|
+
favoriters_timeline: Optional[TimelineResult] = None
|
|
32
32
|
__properties: ClassVar[List[str]] = ["favoriters_timeline"]
|
|
33
33
|
|
|
34
34
|
model_config = ConfigDict(
|
|
@@ -85,7 +85,7 @@ class TweetFavoritersResponseData(BaseModel):
|
|
|
85
85
|
return cls.model_validate(obj)
|
|
86
86
|
|
|
87
87
|
_obj = cls.model_validate({
|
|
88
|
-
"favoriters_timeline":
|
|
88
|
+
"favoriters_timeline": TimelineResult.from_dict(obj["favoriters_timeline"]) if obj.get("favoriters_timeline") is not None else None
|
|
89
89
|
})
|
|
90
90
|
return _obj
|
|
91
91
|
|
|
@@ -20,7 +20,7 @@ import json
|
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
-
from twitter_openapi_python_generated.models.
|
|
23
|
+
from twitter_openapi_python_generated.models.timeline_result import TimelineResult
|
|
24
24
|
from typing import Optional, Set
|
|
25
25
|
from typing_extensions import Self
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ class TweetRetweetersResponseData(BaseModel):
|
|
|
28
28
|
"""
|
|
29
29
|
TweetRetweetersResponseData
|
|
30
30
|
""" # noqa: E501
|
|
31
|
-
retweeters_timeline: Optional[
|
|
31
|
+
retweeters_timeline: Optional[TimelineResult] = None
|
|
32
32
|
__properties: ClassVar[List[str]] = ["retweeters_timeline"]
|
|
33
33
|
|
|
34
34
|
model_config = ConfigDict(
|
|
@@ -85,7 +85,7 @@ class TweetRetweetersResponseData(BaseModel):
|
|
|
85
85
|
return cls.model_validate(obj)
|
|
86
86
|
|
|
87
87
|
_obj = cls.model_validate({
|
|
88
|
-
"retweeters_timeline":
|
|
88
|
+
"retweeters_timeline": TimelineResult.from_dict(obj["retweeters_timeline"]) if obj.get("retweeters_timeline") is not None else None
|
|
89
89
|
})
|
|
90
90
|
return _obj
|
|
91
91
|
|
|
@@ -40,6 +40,8 @@ class TypeName(str, Enum):
|
|
|
40
40
|
TIMELINECOMMUNITY = 'TimelineCommunity'
|
|
41
41
|
TIMELINETOMBSTONE = 'TimelineTombstone'
|
|
42
42
|
TIMELINETREND = 'TimelineTrend'
|
|
43
|
+
TIMELINENOTIFICATION = 'TimelineNotification'
|
|
44
|
+
TIMELINENOTIFICATIONAGGREGATEUSERACTIONS = 'TimelineNotificationAggregateUserActions'
|
|
43
45
|
TWEETUNAVAILABLE = 'TweetUnavailable'
|
|
44
46
|
TWEETPREVIEWDISPLAY = 'TweetPreviewDisplay'
|
|
45
47
|
TWEET = 'Tweet'
|
|
@@ -75,8 +75,8 @@ class User(BaseModel):
|
|
|
75
75
|
if value is None:
|
|
76
76
|
return value
|
|
77
77
|
|
|
78
|
-
if value not in set(['None', 'Parody']):
|
|
79
|
-
raise ValueError("must be one of enum values ('None', 'Parody')")
|
|
78
|
+
if value not in set(['None', 'Parody', 'Commentary']):
|
|
79
|
+
raise ValueError("must be one of enum values ('None', 'Parody', 'Commentary')")
|
|
80
80
|
return value
|
|
81
81
|
|
|
82
82
|
@field_validator('profile_image_shape')
|