twitter-openapi-python-generated 0.1.0__py3-none-any.whl → 0.1.2__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.
Files changed (149) hide show
  1. twitter_openapi_python_generated/__init__.py +235 -1
  2. twitter_openapi_python_generated/api/__init__.py +2 -0
  3. twitter_openapi_python_generated/api/birdwatch_api.py +1609 -0
  4. twitter_openapi_python_generated/api/community_api.py +1910 -0
  5. twitter_openapi_python_generated/api/default_api.py +1522 -0
  6. twitter_openapi_python_generated/api/tweet_api.py +778 -142
  7. twitter_openapi_python_generated/api/user_list_api.py +1145 -192
  8. twitter_openapi_python_generated/api/users_api.py +318 -0
  9. twitter_openapi_python_generated/api_client.py +1 -1
  10. twitter_openapi_python_generated/configuration.py +1 -1
  11. twitter_openapi_python_generated/models/__init__.py +115 -0
  12. twitter_openapi_python_generated/models/ad_metadata_container.py +5 -3
  13. twitter_openapi_python_generated/models/authenticate_periscope_response.py +102 -0
  14. twitter_openapi_python_generated/models/authenticate_periscope_response_data.py +89 -0
  15. twitter_openapi_python_generated/models/birdwatch_alias_self_select_status.py +91 -0
  16. twitter_openapi_python_generated/models/birdwatch_fetch_alias_self_select_status_response.py +102 -0
  17. twitter_openapi_python_generated/models/birdwatch_fetch_alias_self_select_status_response_data.py +93 -0
  18. twitter_openapi_python_generated/models/birdwatch_fetch_authenticated_user_profile_response.py +102 -0
  19. twitter_openapi_python_generated/models/birdwatch_fetch_authenticated_user_profile_response_data.py +93 -0
  20. twitter_openapi_python_generated/models/birdwatch_fetch_birdwatch_profile_response.py +102 -0
  21. twitter_openapi_python_generated/models/birdwatch_fetch_birdwatch_profile_response_data.py +93 -0
  22. twitter_openapi_python_generated/models/birdwatch_fetch_global_timeline_response.py +102 -0
  23. twitter_openapi_python_generated/models/birdwatch_fetch_global_timeline_response_data.py +93 -0
  24. twitter_openapi_python_generated/models/birdwatch_fetch_public_data_response.py +102 -0
  25. twitter_openapi_python_generated/models/birdwatch_fetch_public_data_response_data.py +93 -0
  26. twitter_openapi_python_generated/models/birdwatch_home_page.py +101 -0
  27. twitter_openapi_python_generated/models/birdwatch_home_page_body.py +104 -0
  28. twitter_openapi_python_generated/models/birdwatch_home_timeline.py +97 -0
  29. twitter_openapi_python_generated/models/birdwatch_profile.py +89 -0
  30. twitter_openapi_python_generated/models/birdwatch_public_data_file.py +91 -0
  31. twitter_openapi_python_generated/models/birdwatch_public_data_file_bundle.py +113 -0
  32. twitter_openapi_python_generated/models/birdwatch_viewer.py +93 -0
  33. twitter_openapi_python_generated/models/bookmark_search.py +93 -0
  34. twitter_openapi_python_generated/models/bookmark_search_timeline_response.py +102 -0
  35. twitter_openapi_python_generated/models/bookmark_search_timeline_response_data.py +93 -0
  36. twitter_openapi_python_generated/models/client_event_info_details.py +8 -2
  37. twitter_openapi_python_generated/models/communities_fetch_one_query_response.py +102 -0
  38. twitter_openapi_python_generated/models/communities_fetch_one_query_response_data.py +93 -0
  39. twitter_openapi_python_generated/models/communities_search_query_response.py +102 -0
  40. twitter_openapi_python_generated/models/communities_search_query_response_data.py +93 -0
  41. twitter_openapi_python_generated/models/communities_search_slice.py +102 -0
  42. twitter_openapi_python_generated/models/community.py +3 -1
  43. twitter_openapi_python_generated/models/community_facepile_user.py +98 -0
  44. twitter_openapi_python_generated/models/community_facepile_user_results.py +95 -0
  45. twitter_openapi_python_generated/models/community_hashtag.py +91 -0
  46. twitter_openapi_python_generated/models/community_hashtag_slice.py +99 -0
  47. twitter_openapi_python_generated/models/community_id_user_results.py +95 -0
  48. twitter_openapi_python_generated/models/community_list_members_action_result.py +90 -0
  49. twitter_openapi_python_generated/models/community_page_actions.py +113 -0
  50. twitter_openapi_python_generated/models/community_page_community.py +187 -0
  51. twitter_openapi_python_generated/models/community_page_delete_action_result.py +94 -0
  52. twitter_openapi_python_generated/models/community_page_invites_result.py +96 -0
  53. twitter_openapi_python_generated/models/community_page_join_action_result.py +92 -0
  54. twitter_openapi_python_generated/models/community_page_leave_action_result.py +96 -0
  55. twitter_openapi_python_generated/models/community_page_pin_action_result.py +92 -0
  56. twitter_openapi_python_generated/models/community_page_results.py +95 -0
  57. twitter_openapi_python_generated/models/community_primary_topic_name.py +89 -0
  58. twitter_openapi_python_generated/models/community_query_response.py +102 -0
  59. twitter_openapi_python_generated/models/community_query_response_data.py +93 -0
  60. twitter_openapi_python_generated/models/community_relay_rule.py +103 -0
  61. twitter_openapi_python_generated/models/community_search_community.py +134 -0
  62. twitter_openapi_python_generated/models/community_search_results.py +95 -0
  63. twitter_openapi_python_generated/models/community_settings_actions.py +101 -0
  64. twitter_openapi_python_generated/models/community_settings_community.py +183 -0
  65. twitter_openapi_python_generated/models/community_settings_creator.py +106 -0
  66. twitter_openapi_python_generated/models/community_settings_creator_core.py +89 -0
  67. twitter_openapi_python_generated/models/community_settings_creator_results.py +95 -0
  68. twitter_openapi_python_generated/models/community_settings_creator_verification.py +89 -0
  69. twitter_openapi_python_generated/models/community_settings_invites_result.py +90 -0
  70. twitter_openapi_python_generated/models/community_settings_results.py +95 -0
  71. twitter_openapi_python_generated/models/community_subtopic.py +99 -0
  72. twitter_openapi_python_generated/models/community_topic.py +108 -0
  73. twitter_openapi_python_generated/models/community_topic_results.py +96 -0
  74. twitter_openapi_python_generated/models/content_item_type.py +1 -0
  75. twitter_openapi_python_generated/models/creator_studio_tab_bar_item_query_response.py +102 -0
  76. twitter_openapi_python_generated/models/creator_studio_tab_bar_item_query_response_data.py +89 -0
  77. twitter_openapi_python_generated/models/data_saver_mode_response.py +102 -0
  78. twitter_openapi_python_generated/models/data_saver_mode_response_data.py +89 -0
  79. twitter_openapi_python_generated/models/error_extensions.py +1 -1
  80. twitter_openapi_python_generated/models/error_response.py +1 -1
  81. twitter_openapi_python_generated/models/event_summary_ad_metadata_container.py +91 -0
  82. twitter_openapi_python_generated/models/event_summary_event.py +97 -0
  83. twitter_openapi_python_generated/models/event_summary_media.py +99 -0
  84. twitter_openapi_python_generated/models/event_summary_media_entity.py +95 -0
  85. twitter_openapi_python_generated/models/event_summary_media_key.py +91 -0
  86. twitter_openapi_python_generated/models/event_summary_promoted_metadata.py +117 -0
  87. twitter_openapi_python_generated/models/explore_sidebar_response.py +102 -0
  88. twitter_openapi_python_generated/models/explore_sidebar_response_data.py +93 -0
  89. twitter_openapi_python_generated/models/feedback_action.py +0 -7
  90. twitter_openapi_python_generated/models/global_communities_latest_post_search.py +93 -0
  91. twitter_openapi_python_generated/models/global_communities_latest_post_search_timeline_response.py +102 -0
  92. twitter_openapi_python_generated/models/global_communities_latest_post_search_timeline_response_data.py +93 -0
  93. twitter_openapi_python_generated/models/global_communities_post_search.py +93 -0
  94. twitter_openapi_python_generated/models/global_communities_post_search_timeline_response.py +102 -0
  95. twitter_openapi_python_generated/models/global_communities_post_search_timeline_response_data.py +93 -0
  96. twitter_openapi_python_generated/models/grok_home.py +114 -0
  97. twitter_openapi_python_generated/models/grok_home_layout.py +98 -0
  98. twitter_openapi_python_generated/models/grok_home_layout_section.py +98 -0
  99. twitter_openapi_python_generated/models/grok_home_prompt.py +99 -0
  100. twitter_openapi_python_generated/models/grok_home_response.py +102 -0
  101. twitter_openapi_python_generated/models/grok_home_response_data.py +93 -0
  102. twitter_openapi_python_generated/models/grok_model_option.py +103 -0
  103. twitter_openapi_python_generated/models/grouped_trend.py +95 -0
  104. twitter_openapi_python_generated/models/item_content_union.py +27 -8
  105. twitter_openapi_python_generated/models/list_search.py +93 -0
  106. twitter_openapi_python_generated/models/list_search_timeline_response.py +102 -0
  107. twitter_openapi_python_generated/models/list_search_timeline_response_data.py +93 -0
  108. twitter_openapi_python_generated/models/lists_management_page_timeline_response.py +102 -0
  109. twitter_openapi_python_generated/models/lists_management_page_timeline_response_data.py +93 -0
  110. twitter_openapi_python_generated/models/lists_management_viewer.py +93 -0
  111. twitter_openapi_python_generated/models/module_footer.py +1 -8
  112. twitter_openapi_python_generated/models/notification_details.py +91 -0
  113. twitter_openapi_python_generated/models/pinned_timelines.py +89 -0
  114. twitter_openapi_python_generated/models/pinned_timelines_response.py +102 -0
  115. twitter_openapi_python_generated/models/pinned_timelines_response_data.py +93 -0
  116. twitter_openapi_python_generated/models/promoted_trend.py +97 -0
  117. twitter_openapi_python_generated/models/rich_message.py +10 -1
  118. twitter_openapi_python_generated/models/rich_message_entity.py +97 -0
  119. twitter_openapi_python_generated/models/rich_message_entity_ref.py +117 -0
  120. twitter_openapi_python_generated/models/search_timeline.py +2 -2
  121. twitter_openapi_python_generated/models/slice_info.py +89 -0
  122. twitter_openapi_python_generated/models/timeline_community.py +13 -17
  123. twitter_openapi_python_generated/models/timeline_event_summary.py +121 -0
  124. twitter_openapi_python_generated/models/timeline_message_prompt.py +13 -17
  125. twitter_openapi_python_generated/models/timeline_message_prompt_button.py +95 -0
  126. twitter_openapi_python_generated/models/timeline_message_prompt_button_action.py +91 -0
  127. twitter_openapi_python_generated/models/timeline_message_prompt_content.py +112 -0
  128. twitter_openapi_python_generated/models/timeline_message_prompt_rich_text.py +98 -0
  129. twitter_openapi_python_generated/models/timeline_message_prompt_rich_text_entity.py +97 -0
  130. twitter_openapi_python_generated/models/timeline_message_prompt_rich_text_entity_ref.py +107 -0
  131. twitter_openapi_python_generated/models/timeline_prompt.py +19 -17
  132. twitter_openapi_python_generated/models/timeline_prompt_callback.py +89 -0
  133. twitter_openapi_python_generated/models/timeline_prompt_content.py +124 -0
  134. twitter_openapi_python_generated/models/timeline_trend.py +18 -1
  135. twitter_openapi_python_generated/models/topic_carousel_query_response.py +102 -0
  136. twitter_openapi_python_generated/models/topic_carousel_query_response_data.py +93 -0
  137. twitter_openapi_python_generated/models/trend_metadata.py +3 -1
  138. twitter_openapi_python_generated/models/trend_promoted_metadata.py +111 -0
  139. twitter_openapi_python_generated/models/type_name.py +3 -0
  140. twitter_openapi_python_generated/models/users_verified_avatars_response.py +102 -0
  141. twitter_openapi_python_generated/models/users_verified_avatars_response_data.py +96 -0
  142. twitter_openapi_python_generated/models/verified_avatar_user.py +112 -0
  143. twitter_openapi_python_generated/models/verified_avatar_user_results.py +93 -0
  144. {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.2.dist-info}/METADATA +145 -9
  145. {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.2.dist-info}/RECORD +149 -32
  146. {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.2.dist-info}/WHEEL +0 -0
  147. {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.2.dist-info}/licenses/LICENSE +0 -0
  148. {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.2.dist-info}/licenses/LICENSE.AGPL +0 -0
  149. {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,117 @@
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, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from twitter_openapi_python_generated.models.user_results import UserResults
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+ from pydantic_core import to_jsonable_python
28
+
29
+ class RichMessageEntityRef(BaseModel):
30
+ """
31
+ RichMessageEntityRef
32
+ """ # noqa: E501
33
+ id: Optional[Annotated[str, Field(strict=True)]] = None
34
+ type: StrictStr
35
+ url: Optional[StrictStr] = None
36
+ user_results: Optional[UserResults] = None
37
+ __properties: ClassVar[List[str]] = ["id", "type", "url", "user_results"]
38
+
39
+ @field_validator('id', mode="before")
40
+ def id_validate_regular_expression(cls, value):
41
+ """Validates the regular expression"""
42
+ if value is None:
43
+ return value
44
+
45
+ if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
46
+ raise ValueError(r"must validate the regular expression /^[0-9]+$/")
47
+ return value
48
+
49
+ @field_validator('type')
50
+ def type_validate_enum(cls, value):
51
+ """Validates the enum"""
52
+ if value not in set(['TimelineRichTextUser', 'TimelineRichTextList']):
53
+ raise ValueError("must be one of enum values ('TimelineRichTextUser', 'TimelineRichTextList')")
54
+ return value
55
+
56
+ model_config = ConfigDict(
57
+ validate_by_name=True,
58
+ validate_by_alias=True,
59
+ validate_assignment=True,
60
+ protected_namespaces=(),
61
+ )
62
+
63
+
64
+ def to_str(self) -> str:
65
+ """Returns the string representation of the model using alias"""
66
+ return pprint.pformat(self.model_dump(by_alias=True))
67
+
68
+ def to_json(self) -> str:
69
+ """Returns the JSON representation of the model using alias"""
70
+ return json.dumps(to_jsonable_python(self.to_dict()))
71
+
72
+ @classmethod
73
+ def from_json(cls, json_str: str) -> Optional[Self]:
74
+ """Create an instance of RichMessageEntityRef from a JSON string"""
75
+ return cls.from_dict(json.loads(json_str))
76
+
77
+ def to_dict(self) -> Dict[str, Any]:
78
+ """Return the dictionary representation of the model using alias.
79
+
80
+ This has the following differences from calling pydantic's
81
+ `self.model_dump(by_alias=True)`:
82
+
83
+ * `None` is only added to the output dict for nullable fields that
84
+ were set at model initialization. Other fields with value `None`
85
+ are ignored.
86
+ """
87
+ excluded_fields: Set[str] = set([
88
+ ])
89
+
90
+ _dict = self.model_dump(
91
+ by_alias=True,
92
+ exclude=excluded_fields,
93
+ exclude_none=True,
94
+ )
95
+ # override the default output from pydantic by calling `to_dict()` of user_results
96
+ if self.user_results:
97
+ _dict['user_results'] = self.user_results.to_dict()
98
+ return _dict
99
+
100
+ @classmethod
101
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
+ """Create an instance of RichMessageEntityRef from a dict"""
103
+ if obj is None:
104
+ return None
105
+
106
+ if not isinstance(obj, dict):
107
+ return cls.model_validate(obj)
108
+
109
+ _obj = cls.model_validate({
110
+ "id": obj.get("id"),
111
+ "type": obj.get("type"),
112
+ "url": obj.get("url"),
113
+ "user_results": UserResults.from_dict(obj["user_results"]) if obj.get("user_results") is not None else None
114
+ })
115
+ return _obj
116
+
117
+
@@ -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(
@@ -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, 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 SliceInfo(BaseModel):
28
+ """
29
+ SliceInfo
30
+ """ # noqa: E501
31
+ next_cursor: StrictStr
32
+ __properties: ClassVar[List[str]] = ["next_cursor"]
33
+
34
+ model_config = ConfigDict(
35
+ validate_by_name=True,
36
+ validate_by_alias=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of SliceInfo 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 SliceInfo 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
+ "next_cursor": obj.get("next_cursor")
86
+ })
87
+ return _obj
88
+
89
+
@@ -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, Optional
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: Optional[TypeName] = Field(default=None, alias="__typename")
33
- additional_properties: Dict[str, Any] = {}
34
- __properties: ClassVar[List[str]] = ["__typename"]
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
- # puts key-value pairs in additional_properties in the top level
78
- if self.additional_properties is not None:
79
- for _key, _value in self.additional_properties.items():
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
 
@@ -0,0 +1,121 @@
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.event_summary_event import EventSummaryEvent
25
+ from twitter_openapi_python_generated.models.event_summary_media import EventSummaryMedia
26
+ from twitter_openapi_python_generated.models.event_summary_promoted_metadata import EventSummaryPromotedMetadata
27
+ from twitter_openapi_python_generated.models.social_context_landing_url import SocialContextLandingUrl
28
+ from twitter_openapi_python_generated.models.type_name import TypeName
29
+ from typing import Optional, Set
30
+ from typing_extensions import Self
31
+ from pydantic_core import to_jsonable_python
32
+
33
+ class TimelineEventSummary(BaseModel):
34
+ """
35
+ TimelineEventSummary
36
+ """ # noqa: E501
37
+ typename: TypeName = Field(alias="__typename")
38
+ event: EventSummaryEvent
39
+ event_summary_display_type: StrictStr = Field(alias="eventSummaryDisplayType")
40
+ event_summary_url: SocialContextLandingUrl = Field(alias="eventSummaryUrl")
41
+ item_type: ContentItemType = Field(alias="itemType")
42
+ media: EventSummaryMedia
43
+ promoted_metadata: EventSummaryPromotedMetadata = Field(alias="promotedMetadata")
44
+ title: StrictStr
45
+ __properties: ClassVar[List[str]] = ["__typename", "event", "eventSummaryDisplayType", "eventSummaryUrl", "itemType", "media", "promotedMetadata", "title"]
46
+
47
+ model_config = ConfigDict(
48
+ validate_by_name=True,
49
+ validate_by_alias=True,
50
+ validate_assignment=True,
51
+ protected_namespaces=(),
52
+ )
53
+
54
+
55
+ def to_str(self) -> str:
56
+ """Returns the string representation of the model using alias"""
57
+ return pprint.pformat(self.model_dump(by_alias=True))
58
+
59
+ def to_json(self) -> str:
60
+ """Returns the JSON representation of the model using alias"""
61
+ return json.dumps(to_jsonable_python(self.to_dict()))
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of TimelineEventSummary from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ """
78
+ excluded_fields: Set[str] = set([
79
+ ])
80
+
81
+ _dict = self.model_dump(
82
+ by_alias=True,
83
+ exclude=excluded_fields,
84
+ exclude_none=True,
85
+ )
86
+ # override the default output from pydantic by calling `to_dict()` of event
87
+ if self.event:
88
+ _dict['event'] = self.event.to_dict()
89
+ # override the default output from pydantic by calling `to_dict()` of event_summary_url
90
+ if self.event_summary_url:
91
+ _dict['eventSummaryUrl'] = self.event_summary_url.to_dict()
92
+ # override the default output from pydantic by calling `to_dict()` of media
93
+ if self.media:
94
+ _dict['media'] = self.media.to_dict()
95
+ # override the default output from pydantic by calling `to_dict()` of promoted_metadata
96
+ if self.promoted_metadata:
97
+ _dict['promotedMetadata'] = self.promoted_metadata.to_dict()
98
+ return _dict
99
+
100
+ @classmethod
101
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
+ """Create an instance of TimelineEventSummary from a dict"""
103
+ if obj is None:
104
+ return None
105
+
106
+ if not isinstance(obj, dict):
107
+ return cls.model_validate(obj)
108
+
109
+ _obj = cls.model_validate({
110
+ "__typename": obj.get("__typename"),
111
+ "event": EventSummaryEvent.from_dict(obj["event"]) if obj.get("event") is not None else None,
112
+ "eventSummaryDisplayType": obj.get("eventSummaryDisplayType"),
113
+ "eventSummaryUrl": SocialContextLandingUrl.from_dict(obj["eventSummaryUrl"]) if obj.get("eventSummaryUrl") is not None else None,
114
+ "itemType": obj.get("itemType"),
115
+ "media": EventSummaryMedia.from_dict(obj["media"]) if obj.get("media") is not None else None,
116
+ "promotedMetadata": EventSummaryPromotedMetadata.from_dict(obj["promotedMetadata"]) if obj.get("promotedMetadata") is not None else None,
117
+ "title": obj.get("title")
118
+ })
119
+ return _obj
120
+
121
+
@@ -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, Optional
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: Optional[TypeName] = Field(default=None, alias="__typename")
33
- additional_properties: Dict[str, Any] = {}
34
- __properties: ClassVar[List[str]] = ["__typename"]
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
- # puts key-value pairs in additional_properties in the top level
78
- if self.additional_properties is not None:
79
- for _key, _value in self.additional_properties.items():
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
+