twitter-openapi-python-generated 0.1.0__py3-none-any.whl → 0.1.1__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 +19 -1
- twitter_openapi_python_generated/api_client.py +1 -1
- twitter_openapi_python_generated/configuration.py +1 -1
- twitter_openapi_python_generated/models/__init__.py +9 -0
- twitter_openapi_python_generated/models/community.py +3 -1
- twitter_openapi_python_generated/models/error_extensions.py +1 -1
- twitter_openapi_python_generated/models/error_response.py +1 -1
- twitter_openapi_python_generated/models/grouped_trend.py +95 -0
- twitter_openapi_python_generated/models/search_timeline.py +2 -2
- twitter_openapi_python_generated/models/timeline_community.py +13 -17
- twitter_openapi_python_generated/models/timeline_message_prompt.py +13 -17
- twitter_openapi_python_generated/models/timeline_message_prompt_button.py +95 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_button_action.py +91 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_content.py +112 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_rich_text.py +98 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_rich_text_entity.py +97 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_rich_text_entity_ref.py +107 -0
- twitter_openapi_python_generated/models/timeline_prompt.py +19 -17
- twitter_openapi_python_generated/models/timeline_prompt_callback.py +89 -0
- twitter_openapi_python_generated/models/timeline_prompt_content.py +124 -0
- twitter_openapi_python_generated/models/timeline_trend.py +10 -1
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/METADATA +11 -2
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/RECORD +27 -18
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/WHEEL +0 -0
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/licenses/LICENSE +0 -0
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/licenses/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/top_level.txt +0 -0
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
""" # noqa: E501
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
__version__ = "0.1.
|
|
18
|
+
__version__ = "0.1.1"
|
|
19
19
|
|
|
20
20
|
# Define package exports
|
|
21
21
|
__all__ = [
|
|
@@ -202,6 +202,7 @@ __all__ = [
|
|
|
202
202
|
"GrokTranslatedCommunityNoteWithAvailability",
|
|
203
203
|
"GrokTranslatedPost",
|
|
204
204
|
"GrokTranslatedPostWithAvailability",
|
|
205
|
+
"GroupedTrend",
|
|
205
206
|
"Hashtag",
|
|
206
207
|
"Highlight",
|
|
207
208
|
"HomeTimelineHome",
|
|
@@ -368,10 +369,18 @@ __all__ = [
|
|
|
368
369
|
"TimelineLabel",
|
|
369
370
|
"TimelineMarkEntriesUnreadGreaterThanSortIndex",
|
|
370
371
|
"TimelineMessagePrompt",
|
|
372
|
+
"TimelineMessagePromptButton",
|
|
373
|
+
"TimelineMessagePromptButtonAction",
|
|
374
|
+
"TimelineMessagePromptContent",
|
|
375
|
+
"TimelineMessagePromptRichText",
|
|
376
|
+
"TimelineMessagePromptRichTextEntity",
|
|
377
|
+
"TimelineMessagePromptRichTextEntityRef",
|
|
371
378
|
"TimelineMetadata",
|
|
372
379
|
"TimelineNotification",
|
|
373
380
|
"TimelinePinEntry",
|
|
374
381
|
"TimelinePrompt",
|
|
382
|
+
"TimelinePromptCallback",
|
|
383
|
+
"TimelinePromptContent",
|
|
375
384
|
"TimelineReplaceEntry",
|
|
376
385
|
"TimelineResponse",
|
|
377
386
|
"TimelineResponseObjects",
|
|
@@ -713,6 +722,7 @@ from twitter_openapi_python_generated.models.grok_translated_community_note impo
|
|
|
713
722
|
from twitter_openapi_python_generated.models.grok_translated_community_note_with_availability import GrokTranslatedCommunityNoteWithAvailability as GrokTranslatedCommunityNoteWithAvailability
|
|
714
723
|
from twitter_openapi_python_generated.models.grok_translated_post import GrokTranslatedPost as GrokTranslatedPost
|
|
715
724
|
from twitter_openapi_python_generated.models.grok_translated_post_with_availability import GrokTranslatedPostWithAvailability as GrokTranslatedPostWithAvailability
|
|
725
|
+
from twitter_openapi_python_generated.models.grouped_trend import GroupedTrend as GroupedTrend
|
|
716
726
|
from twitter_openapi_python_generated.models.hashtag import Hashtag as Hashtag
|
|
717
727
|
from twitter_openapi_python_generated.models.highlight import Highlight as Highlight
|
|
718
728
|
from twitter_openapi_python_generated.models.home_timeline_home import HomeTimelineHome as HomeTimelineHome
|
|
@@ -879,10 +889,18 @@ from twitter_openapi_python_generated.models.timeline_half_cover import Timeline
|
|
|
879
889
|
from twitter_openapi_python_generated.models.timeline_label import TimelineLabel as TimelineLabel
|
|
880
890
|
from twitter_openapi_python_generated.models.timeline_mark_entries_unread_greater_than_sort_index import TimelineMarkEntriesUnreadGreaterThanSortIndex as TimelineMarkEntriesUnreadGreaterThanSortIndex
|
|
881
891
|
from twitter_openapi_python_generated.models.timeline_message_prompt import TimelineMessagePrompt as TimelineMessagePrompt
|
|
892
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_button import TimelineMessagePromptButton as TimelineMessagePromptButton
|
|
893
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_button_action import TimelineMessagePromptButtonAction as TimelineMessagePromptButtonAction
|
|
894
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_content import TimelineMessagePromptContent as TimelineMessagePromptContent
|
|
895
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_rich_text import TimelineMessagePromptRichText as TimelineMessagePromptRichText
|
|
896
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_rich_text_entity import TimelineMessagePromptRichTextEntity as TimelineMessagePromptRichTextEntity
|
|
897
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_rich_text_entity_ref import TimelineMessagePromptRichTextEntityRef as TimelineMessagePromptRichTextEntityRef
|
|
882
898
|
from twitter_openapi_python_generated.models.timeline_metadata import TimelineMetadata as TimelineMetadata
|
|
883
899
|
from twitter_openapi_python_generated.models.timeline_notification import TimelineNotification as TimelineNotification
|
|
884
900
|
from twitter_openapi_python_generated.models.timeline_pin_entry import TimelinePinEntry as TimelinePinEntry
|
|
885
901
|
from twitter_openapi_python_generated.models.timeline_prompt import TimelinePrompt as TimelinePrompt
|
|
902
|
+
from twitter_openapi_python_generated.models.timeline_prompt_callback import TimelinePromptCallback as TimelinePromptCallback
|
|
903
|
+
from twitter_openapi_python_generated.models.timeline_prompt_content import TimelinePromptContent as TimelinePromptContent
|
|
886
904
|
from twitter_openapi_python_generated.models.timeline_replace_entry import TimelineReplaceEntry as TimelineReplaceEntry
|
|
887
905
|
from twitter_openapi_python_generated.models.timeline_response import TimelineResponse as TimelineResponse
|
|
888
906
|
from twitter_openapi_python_generated.models.timeline_response_objects import TimelineResponseObjects as TimelineResponseObjects
|
|
@@ -92,7 +92,7 @@ class ApiClient:
|
|
|
92
92
|
self.default_headers[header_name] = header_value
|
|
93
93
|
self.cookie = cookie
|
|
94
94
|
# Set default User-Agent.
|
|
95
|
-
self.user_agent = 'OpenAPI-Generator/0.1.
|
|
95
|
+
self.user_agent = 'OpenAPI-Generator/0.1.1/python'
|
|
96
96
|
self.client_side_validation = configuration.client_side_validation
|
|
97
97
|
|
|
98
98
|
def __enter__(self):
|
|
@@ -802,7 +802,7 @@ conf = twitter_openapi_python_generated.Configuration(
|
|
|
802
802
|
"OS: {env}\n"\
|
|
803
803
|
"Python Version: {pyversion}\n"\
|
|
804
804
|
"Version of the API: 0.0.1\n"\
|
|
805
|
-
"SDK Package Version: 0.1.
|
|
805
|
+
"SDK Package Version: 0.1.1".\
|
|
806
806
|
format(env=sys.platform, pyversion=sys.version)
|
|
807
807
|
|
|
808
808
|
def get_host_settings(self) -> List[HostSetting]:
|
|
@@ -178,6 +178,7 @@ from twitter_openapi_python_generated.models.grok_translated_community_note impo
|
|
|
178
178
|
from twitter_openapi_python_generated.models.grok_translated_community_note_with_availability import GrokTranslatedCommunityNoteWithAvailability
|
|
179
179
|
from twitter_openapi_python_generated.models.grok_translated_post import GrokTranslatedPost
|
|
180
180
|
from twitter_openapi_python_generated.models.grok_translated_post_with_availability import GrokTranslatedPostWithAvailability
|
|
181
|
+
from twitter_openapi_python_generated.models.grouped_trend import GroupedTrend
|
|
181
182
|
from twitter_openapi_python_generated.models.hashtag import Hashtag
|
|
182
183
|
from twitter_openapi_python_generated.models.highlight import Highlight
|
|
183
184
|
from twitter_openapi_python_generated.models.home_timeline_home import HomeTimelineHome
|
|
@@ -344,10 +345,18 @@ from twitter_openapi_python_generated.models.timeline_half_cover import Timeline
|
|
|
344
345
|
from twitter_openapi_python_generated.models.timeline_label import TimelineLabel
|
|
345
346
|
from twitter_openapi_python_generated.models.timeline_mark_entries_unread_greater_than_sort_index import TimelineMarkEntriesUnreadGreaterThanSortIndex
|
|
346
347
|
from twitter_openapi_python_generated.models.timeline_message_prompt import TimelineMessagePrompt
|
|
348
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_button import TimelineMessagePromptButton
|
|
349
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_button_action import TimelineMessagePromptButtonAction
|
|
350
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_content import TimelineMessagePromptContent
|
|
351
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_rich_text import TimelineMessagePromptRichText
|
|
352
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_rich_text_entity import TimelineMessagePromptRichTextEntity
|
|
353
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_rich_text_entity_ref import TimelineMessagePromptRichTextEntityRef
|
|
347
354
|
from twitter_openapi_python_generated.models.timeline_metadata import TimelineMetadata
|
|
348
355
|
from twitter_openapi_python_generated.models.timeline_notification import TimelineNotification
|
|
349
356
|
from twitter_openapi_python_generated.models.timeline_pin_entry import TimelinePinEntry
|
|
350
357
|
from twitter_openapi_python_generated.models.timeline_prompt import TimelinePrompt
|
|
358
|
+
from twitter_openapi_python_generated.models.timeline_prompt_callback import TimelinePromptCallback
|
|
359
|
+
from twitter_openapi_python_generated.models.timeline_prompt_content import TimelinePromptContent
|
|
351
360
|
from twitter_openapi_python_generated.models.timeline_replace_entry import TimelineReplaceEntry
|
|
352
361
|
from twitter_openapi_python_generated.models.timeline_response import TimelineResponse
|
|
353
362
|
from twitter_openapi_python_generated.models.timeline_response_objects import TimelineResponseObjects
|
|
@@ -50,6 +50,7 @@ class Community(BaseModel):
|
|
|
50
50
|
id_str: Optional[Annotated[str, Field(strict=True)]] = None
|
|
51
51
|
invites_policy: Optional[StrictStr] = None
|
|
52
52
|
invites_result: Optional[CommunityInvitesResult] = None
|
|
53
|
+
is_nsfw: Optional[StrictBool] = None
|
|
53
54
|
is_pinned: Optional[StrictBool] = None
|
|
54
55
|
join_policy: Optional[StrictStr] = None
|
|
55
56
|
join_requests_result: Optional[CommunityJoinRequestsResult] = None
|
|
@@ -65,7 +66,7 @@ class Community(BaseModel):
|
|
|
65
66
|
show_only_users_to_display: Optional[List[StrictStr]] = None
|
|
66
67
|
urls: Optional[CommunityUrls] = None
|
|
67
68
|
viewer_relationship: Optional[CommunityViewerRelationship] = None
|
|
68
|
-
__properties: ClassVar[List[str]] = ["__typename", "actions", "admin_results", "created_at", "creator_results", "custom_banner_media", "default_banner_media", "description", "id_str", "invites_policy", "invites_result", "is_pinned", "join_policy", "join_requests_result", "member_count", "members_facepile_results", "moderator_count", "name", "primary_community_topic", "question", "role", "rules", "search_tags", "show_only_users_to_display", "urls", "viewer_relationship"]
|
|
69
|
+
__properties: ClassVar[List[str]] = ["__typename", "actions", "admin_results", "created_at", "creator_results", "custom_banner_media", "default_banner_media", "description", "id_str", "invites_policy", "invites_result", "is_nsfw", "is_pinned", "join_policy", "join_requests_result", "member_count", "members_facepile_results", "moderator_count", "name", "primary_community_topic", "question", "role", "rules", "search_tags", "show_only_users_to_display", "urls", "viewer_relationship"]
|
|
69
70
|
|
|
70
71
|
@field_validator('id_str', mode="before")
|
|
71
72
|
def id_str_validate_regular_expression(cls, value):
|
|
@@ -211,6 +212,7 @@ class Community(BaseModel):
|
|
|
211
212
|
"id_str": obj.get("id_str"),
|
|
212
213
|
"invites_policy": obj.get("invites_policy"),
|
|
213
214
|
"invites_result": CommunityInvitesResult.from_dict(obj["invites_result"]) if obj.get("invites_result") is not None else None,
|
|
215
|
+
"is_nsfw": obj.get("is_nsfw"),
|
|
214
216
|
"is_pinned": obj.get("is_pinned"),
|
|
215
217
|
"join_policy": obj.get("join_policy"),
|
|
216
218
|
"join_requests_result": CommunityJoinRequestsResult.from_dict(obj["join_requests_result"]) if obj.get("join_requests_result") is not None else None,
|
|
@@ -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, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.social_context_landing_url import SocialContextLandingUrl
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class GroupedTrend(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
GroupedTrend
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
name: StrictStr
|
|
33
|
+
url: SocialContextLandingUrl
|
|
34
|
+
__properties: ClassVar[List[str]] = ["name", "url"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
validate_by_name=True,
|
|
38
|
+
validate_by_alias=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def to_str(self) -> str:
|
|
45
|
+
"""Returns the string representation of the model using alias"""
|
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
47
|
+
|
|
48
|
+
def to_json(self) -> str:
|
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
|
50
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of GroupedTrend 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 url
|
|
76
|
+
if self.url:
|
|
77
|
+
_dict['url'] = self.url.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 GroupedTrend 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
|
+
"name": obj.get("name"),
|
|
91
|
+
"url": SocialContextLandingUrl.from_dict(obj["url"]) if obj.get("url") is not None else None
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -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, 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
|
|
@@ -29,7 +29,7 @@ class SearchTimeline(BaseModel):
|
|
|
29
29
|
"""
|
|
30
30
|
SearchTimeline
|
|
31
31
|
""" # noqa: E501
|
|
32
|
-
timeline: Timeline
|
|
32
|
+
timeline: Optional[Timeline] = None
|
|
33
33
|
__properties: ClassVar[List[str]] = ["timeline"]
|
|
34
34
|
|
|
35
35
|
model_config = ConfigDict(
|
|
@@ -19,7 +19,9 @@ import re # noqa: F401
|
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.community_result import CommunityResult
|
|
24
|
+
from twitter_openapi_python_generated.models.content_item_type import ContentItemType
|
|
23
25
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
24
26
|
from typing import Optional, Set
|
|
25
27
|
from typing_extensions import Self
|
|
@@ -29,9 +31,10 @@ class TimelineCommunity(BaseModel):
|
|
|
29
31
|
"""
|
|
30
32
|
TimelineCommunity
|
|
31
33
|
""" # noqa: E501
|
|
32
|
-
typename:
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
typename: TypeName = Field(alias="__typename")
|
|
35
|
+
community_results: CommunityResult
|
|
36
|
+
item_type: ContentItemType = Field(alias="itemType")
|
|
37
|
+
__properties: ClassVar[List[str]] = ["__typename", "community_results", "itemType"]
|
|
35
38
|
|
|
36
39
|
model_config = ConfigDict(
|
|
37
40
|
validate_by_name=True,
|
|
@@ -63,10 +66,8 @@ class TimelineCommunity(BaseModel):
|
|
|
63
66
|
* `None` is only added to the output dict for nullable fields that
|
|
64
67
|
were set at model initialization. Other fields with value `None`
|
|
65
68
|
are ignored.
|
|
66
|
-
* Fields in `self.additional_properties` are added to the output dict.
|
|
67
69
|
"""
|
|
68
70
|
excluded_fields: Set[str] = set([
|
|
69
|
-
"additional_properties",
|
|
70
71
|
])
|
|
71
72
|
|
|
72
73
|
_dict = self.model_dump(
|
|
@@ -74,11 +75,9 @@ class TimelineCommunity(BaseModel):
|
|
|
74
75
|
exclude=excluded_fields,
|
|
75
76
|
exclude_none=True,
|
|
76
77
|
)
|
|
77
|
-
#
|
|
78
|
-
if self.
|
|
79
|
-
|
|
80
|
-
_dict[_key] = _value
|
|
81
|
-
|
|
78
|
+
# override the default output from pydantic by calling `to_dict()` of community_results
|
|
79
|
+
if self.community_results:
|
|
80
|
+
_dict['community_results'] = self.community_results.to_dict()
|
|
82
81
|
return _dict
|
|
83
82
|
|
|
84
83
|
@classmethod
|
|
@@ -91,13 +90,10 @@ class TimelineCommunity(BaseModel):
|
|
|
91
90
|
return cls.model_validate(obj)
|
|
92
91
|
|
|
93
92
|
_obj = cls.model_validate({
|
|
94
|
-
"__typename": obj.get("__typename")
|
|
93
|
+
"__typename": obj.get("__typename"),
|
|
94
|
+
"community_results": CommunityResult.from_dict(obj["community_results"]) if obj.get("community_results") is not None else None,
|
|
95
|
+
"itemType": obj.get("itemType")
|
|
95
96
|
})
|
|
96
|
-
# store additional fields in additional_properties
|
|
97
|
-
for _key in obj.keys():
|
|
98
|
-
if _key not in cls.__properties:
|
|
99
|
-
_obj.additional_properties[_key] = obj.get(_key)
|
|
100
|
-
|
|
101
97
|
return _obj
|
|
102
98
|
|
|
103
99
|
|
|
@@ -19,7 +19,9 @@ import re # noqa: F401
|
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
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.timeline_message_prompt_content import TimelineMessagePromptContent
|
|
23
25
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
24
26
|
from typing import Optional, Set
|
|
25
27
|
from typing_extensions import Self
|
|
@@ -29,9 +31,10 @@ class TimelineMessagePrompt(BaseModel):
|
|
|
29
31
|
"""
|
|
30
32
|
TimelineMessagePrompt
|
|
31
33
|
""" # noqa: E501
|
|
32
|
-
typename:
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
typename: TypeName = Field(alias="__typename")
|
|
35
|
+
content: TimelineMessagePromptContent
|
|
36
|
+
item_type: ContentItemType = Field(alias="itemType")
|
|
37
|
+
__properties: ClassVar[List[str]] = ["__typename", "content", "itemType"]
|
|
35
38
|
|
|
36
39
|
model_config = ConfigDict(
|
|
37
40
|
validate_by_name=True,
|
|
@@ -63,10 +66,8 @@ class TimelineMessagePrompt(BaseModel):
|
|
|
63
66
|
* `None` is only added to the output dict for nullable fields that
|
|
64
67
|
were set at model initialization. Other fields with value `None`
|
|
65
68
|
are ignored.
|
|
66
|
-
* Fields in `self.additional_properties` are added to the output dict.
|
|
67
69
|
"""
|
|
68
70
|
excluded_fields: Set[str] = set([
|
|
69
|
-
"additional_properties",
|
|
70
71
|
])
|
|
71
72
|
|
|
72
73
|
_dict = self.model_dump(
|
|
@@ -74,11 +75,9 @@ class TimelineMessagePrompt(BaseModel):
|
|
|
74
75
|
exclude=excluded_fields,
|
|
75
76
|
exclude_none=True,
|
|
76
77
|
)
|
|
77
|
-
#
|
|
78
|
-
if self.
|
|
79
|
-
|
|
80
|
-
_dict[_key] = _value
|
|
81
|
-
|
|
78
|
+
# override the default output from pydantic by calling `to_dict()` of content
|
|
79
|
+
if self.content:
|
|
80
|
+
_dict['content'] = self.content.to_dict()
|
|
82
81
|
return _dict
|
|
83
82
|
|
|
84
83
|
@classmethod
|
|
@@ -91,13 +90,10 @@ class TimelineMessagePrompt(BaseModel):
|
|
|
91
90
|
return cls.model_validate(obj)
|
|
92
91
|
|
|
93
92
|
_obj = cls.model_validate({
|
|
94
|
-
"__typename": obj.get("__typename")
|
|
93
|
+
"__typename": obj.get("__typename"),
|
|
94
|
+
"content": TimelineMessagePromptContent.from_dict(obj["content"]) if obj.get("content") is not None else None,
|
|
95
|
+
"itemType": obj.get("itemType")
|
|
95
96
|
})
|
|
96
|
-
# store additional fields in additional_properties
|
|
97
|
-
for _key in obj.keys():
|
|
98
|
-
if _key not in cls.__properties:
|
|
99
|
-
_obj.additional_properties[_key] = obj.get(_key)
|
|
100
|
-
|
|
101
97
|
return _obj
|
|
102
98
|
|
|
103
99
|
|
|
@@ -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, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_button_action import TimelineMessagePromptButtonAction
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class TimelineMessagePromptButton(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
TimelineMessagePromptButton
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
action: TimelineMessagePromptButtonAction
|
|
33
|
+
text: StrictStr
|
|
34
|
+
__properties: ClassVar[List[str]] = ["action", "text"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
validate_by_name=True,
|
|
38
|
+
validate_by_alias=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def to_str(self) -> str:
|
|
45
|
+
"""Returns the string representation of the model using alias"""
|
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
47
|
+
|
|
48
|
+
def to_json(self) -> str:
|
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
|
50
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of TimelineMessagePromptButton 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 action
|
|
76
|
+
if self.action:
|
|
77
|
+
_dict['action'] = self.action.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 TimelineMessagePromptButton 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
|
+
"action": TimelineMessagePromptButtonAction.from_dict(obj["action"]) if obj.get("action") is not None else None,
|
|
91
|
+
"text": obj.get("text")
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
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, StrictBool, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
|
|
27
|
+
class TimelineMessagePromptButtonAction(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
TimelineMessagePromptButtonAction
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
dismiss_on_click: StrictBool = Field(alias="dismissOnClick")
|
|
32
|
+
url: StrictStr
|
|
33
|
+
__properties: ClassVar[List[str]] = ["dismissOnClick", "url"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
validate_by_name=True,
|
|
37
|
+
validate_by_alias=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
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of TimelineMessagePromptButtonAction 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
|
+
return _dict
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
78
|
+
"""Create an instance of TimelineMessagePromptButtonAction from a dict"""
|
|
79
|
+
if obj is None:
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
if not isinstance(obj, dict):
|
|
83
|
+
return cls.model_validate(obj)
|
|
84
|
+
|
|
85
|
+
_obj = cls.model_validate({
|
|
86
|
+
"dismissOnClick": obj.get("dismissOnClick"),
|
|
87
|
+
"url": obj.get("url")
|
|
88
|
+
})
|
|
89
|
+
return _obj
|
|
90
|
+
|
|
91
|
+
|