twitter-openapi-python-generated 0.0.34__py3-none-any.whl → 0.0.35__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 (227) hide show
  1. twitter_openapi_python_generated/__init__.py +165 -1
  2. twitter_openapi_python_generated/api/post_api.py +2079 -203
  3. twitter_openapi_python_generated/api/tweet_api.py +3207 -231
  4. twitter_openapi_python_generated/api/user_api.py +969 -66
  5. twitter_openapi_python_generated/api/user_list_api.py +1907 -0
  6. twitter_openapi_python_generated/api_client.py +47 -9
  7. twitter_openapi_python_generated/configuration.py +55 -6
  8. twitter_openapi_python_generated/models/__init__.py +82 -0
  9. twitter_openapi_python_generated/models/additional_media_info.py +3 -1
  10. twitter_openapi_python_generated/models/article_cover_media.py +2 -5
  11. twitter_openapi_python_generated/models/article_cover_media_color_info.py +1 -2
  12. twitter_openapi_python_generated/models/article_result.py +3 -7
  13. twitter_openapi_python_generated/models/badge_counts.py +97 -0
  14. twitter_openapi_python_generated/models/birdwatch_entity_ref.py +3 -1
  15. twitter_openapi_python_generated/models/birdwatch_pivot_footer.py +1 -2
  16. twitter_openapi_python_generated/models/birdwatch_pivot_note.py +2 -5
  17. twitter_openapi_python_generated/models/birdwatch_pivot_subtitle.py +1 -2
  18. twitter_openapi_python_generated/models/bookmarks_response.py +1 -2
  19. twitter_openapi_python_generated/models/cashtag_attachment.py +89 -0
  20. twitter_openapi_python_generated/models/community.py +4 -9
  21. twitter_openapi_python_generated/models/community_about_timeline_response.py +1 -2
  22. twitter_openapi_python_generated/models/community_discovery_timeline_response.py +102 -0
  23. twitter_openapi_python_generated/models/community_discovery_timeline_response_data.py +93 -0
  24. twitter_openapi_python_generated/models/community_discovery_timeline_viewer.py +93 -0
  25. twitter_openapi_python_generated/models/community_join_action_result_union.py +3 -2
  26. twitter_openapi_python_generated/models/community_media_timeline_response.py +1 -2
  27. twitter_openapi_python_generated/models/community_relationship.py +2 -5
  28. twitter_openapi_python_generated/models/community_rule.py +2 -5
  29. twitter_openapi_python_generated/models/community_tweets_timeline_response.py +1 -2
  30. twitter_openapi_python_generated/models/community_union.py +3 -2
  31. twitter_openapi_python_generated/models/connect_tab_timeline_response.py +102 -0
  32. twitter_openapi_python_generated/models/connect_tab_timeline_response_data.py +93 -0
  33. twitter_openapi_python_generated/models/content_disclosure_ai_generated_disclosure.py +2 -2
  34. twitter_openapi_python_generated/models/content_item_type.py +3 -0
  35. twitter_openapi_python_generated/models/content_union.py +3 -2
  36. twitter_openapi_python_generated/models/cover_cta.py +1 -2
  37. twitter_openapi_python_generated/models/create_bookmark_response.py +1 -2
  38. twitter_openapi_python_generated/models/create_draft_tweet_response.py +102 -0
  39. twitter_openapi_python_generated/models/create_draft_tweet_response_data.py +93 -0
  40. twitter_openapi_python_generated/models/create_draft_tweet_response_tweet.py +97 -0
  41. twitter_openapi_python_generated/models/create_retweet_response.py +1 -2
  42. twitter_openapi_python_generated/models/create_tweet_response.py +1 -2
  43. twitter_openapi_python_generated/models/delete_bookmark_response.py +1 -2
  44. twitter_openapi_python_generated/models/delete_draft_tweets_response.py +102 -0
  45. twitter_openapi_python_generated/models/delete_draft_tweets_response_data.py +89 -0
  46. twitter_openapi_python_generated/models/delete_list_response.py +102 -0
  47. twitter_openapi_python_generated/models/delete_list_response_data.py +89 -0
  48. twitter_openapi_python_generated/models/delete_retweet.py +1 -2
  49. twitter_openapi_python_generated/models/delete_retweet_response.py +1 -2
  50. twitter_openapi_python_generated/models/delete_tweet_response.py +1 -2
  51. twitter_openapi_python_generated/models/draft_list.py +96 -0
  52. twitter_openapi_python_generated/models/draft_tweet.py +109 -0
  53. twitter_openapi_python_generated/models/draft_tweet_create_request.py +99 -0
  54. twitter_openapi_python_generated/models/draft_tweet_user.py +100 -0
  55. twitter_openapi_python_generated/models/draft_tweet_user_results.py +93 -0
  56. twitter_openapi_python_generated/models/draft_tweets_viewer.py +93 -0
  57. twitter_openapi_python_generated/models/entities.py +7 -9
  58. twitter_openapi_python_generated/models/error_extensions.py +1 -1
  59. twitter_openapi_python_generated/models/error_response.py +3 -5
  60. twitter_openapi_python_generated/models/explore_page.py +95 -0
  61. twitter_openapi_python_generated/models/explore_page_body.py +104 -0
  62. twitter_openapi_python_generated/models/explore_page_response.py +102 -0
  63. twitter_openapi_python_generated/models/explore_page_response_data.py +93 -0
  64. twitter_openapi_python_generated/models/explore_timeline.py +105 -0
  65. twitter_openapi_python_generated/models/explore_timeline_scribe_config.py +91 -0
  66. twitter_openapi_python_generated/models/extended_entities.py +1 -2
  67. twitter_openapi_python_generated/models/favorite_tweet_response.py +1 -2
  68. twitter_openapi_python_generated/models/fetch_draft_tweets_response.py +102 -0
  69. twitter_openapi_python_generated/models/fetch_draft_tweets_response_data.py +93 -0
  70. twitter_openapi_python_generated/models/fetch_scheduled_tweets_response.py +102 -0
  71. twitter_openapi_python_generated/models/fetch_scheduled_tweets_response_data.py +93 -0
  72. twitter_openapi_python_generated/models/follow_response.py +1 -2
  73. twitter_openapi_python_generated/models/generic_timeline_by_id_response.py +102 -0
  74. twitter_openapi_python_generated/models/generic_timeline_by_id_response_data.py +93 -0
  75. twitter_openapi_python_generated/models/grok_share_attachment.py +1 -2
  76. twitter_openapi_python_generated/models/grok_translated_bio.py +101 -0
  77. twitter_openapi_python_generated/models/grok_translated_bio_with_availability.py +97 -0
  78. twitter_openapi_python_generated/models/grok_translated_community_note.py +1 -2
  79. twitter_openapi_python_generated/models/highlight.py +1 -2
  80. twitter_openapi_python_generated/models/instruction_union.py +3 -2
  81. twitter_openapi_python_generated/models/item_content_union.py +68 -10
  82. twitter_openapi_python_generated/models/list_banner_media.py +93 -0
  83. twitter_openapi_python_generated/models/list_banner_media_info.py +99 -0
  84. twitter_openapi_python_generated/models/list_banner_media_salient_rect.py +95 -0
  85. twitter_openapi_python_generated/models/list_latest_tweets_timeline_response.py +1 -2
  86. twitter_openapi_python_generated/models/list_members_list.py +93 -0
  87. twitter_openapi_python_generated/models/list_members_response.py +102 -0
  88. twitter_openapi_python_generated/models/list_members_response_data.py +93 -0
  89. twitter_openapi_python_generated/models/list_recommended_users_list.py +93 -0
  90. twitter_openapi_python_generated/models/list_recommended_users_response.py +102 -0
  91. twitter_openapi_python_generated/models/list_recommended_users_response_data.py +93 -0
  92. twitter_openapi_python_generated/models/list_response.py +102 -0
  93. twitter_openapi_python_generated/models/list_response_data.py +93 -0
  94. twitter_openapi_python_generated/models/list_subscribers_list.py +93 -0
  95. twitter_openapi_python_generated/models/list_subscribers_response.py +102 -0
  96. twitter_openapi_python_generated/models/list_subscribers_response_data.py +93 -0
  97. twitter_openapi_python_generated/models/media.py +16 -17
  98. twitter_openapi_python_generated/models/media_extended.py +13 -16
  99. twitter_openapi_python_generated/models/media_original_info.py +1 -2
  100. twitter_openapi_python_generated/models/media_video_info.py +1 -2
  101. twitter_openapi_python_generated/models/module_item.py +2 -5
  102. twitter_openapi_python_generated/models/note_tweet_result_data.py +2 -5
  103. twitter_openapi_python_generated/models/note_tweet_result_media.py +1 -2
  104. twitter_openapi_python_generated/models/note_tweet_result_media_inline_media.py +2 -5
  105. twitter_openapi_python_generated/models/note_tweet_result_rich_text.py +1 -2
  106. twitter_openapi_python_generated/models/notifications_result.py +2 -5
  107. twitter_openapi_python_generated/models/notifications_timeline_response.py +1 -2
  108. twitter_openapi_python_generated/models/post_create_bookmark_request.py +1 -1
  109. twitter_openapi_python_generated/models/post_create_bookmark_request_variables.py +2 -2
  110. twitter_openapi_python_generated/models/post_create_draft_tweet_request.py +95 -0
  111. twitter_openapi_python_generated/models/post_create_draft_tweet_request_variables.py +93 -0
  112. twitter_openapi_python_generated/models/post_create_draft_tweet_request_variables_post_tweet_request.py +97 -0
  113. twitter_openapi_python_generated/models/post_create_list_request.py +101 -0
  114. twitter_openapi_python_generated/models/post_create_list_request_features.py +97 -0
  115. twitter_openapi_python_generated/models/post_create_list_request_variables.py +93 -0
  116. twitter_openapi_python_generated/models/post_create_retweet_request.py +1 -1
  117. twitter_openapi_python_generated/models/post_create_retweet_request_variables.py +3 -3
  118. twitter_openapi_python_generated/models/post_create_tweet_request.py +2 -2
  119. twitter_openapi_python_generated/models/post_create_tweet_request_features.py +43 -41
  120. twitter_openapi_python_generated/models/post_create_tweet_request_variables.py +4 -4
  121. twitter_openapi_python_generated/models/post_create_tweet_request_variables_conversation_control.py +2 -2
  122. twitter_openapi_python_generated/models/post_create_tweet_request_variables_media.py +3 -4
  123. twitter_openapi_python_generated/models/post_create_tweet_request_variables_media_media_entities_inner.py +2 -2
  124. twitter_openapi_python_generated/models/post_create_tweet_request_variables_reply.py +2 -2
  125. twitter_openapi_python_generated/models/post_cta_title_text.py +1 -2
  126. twitter_openapi_python_generated/models/post_delete_bookmark_request.py +1 -1
  127. twitter_openapi_python_generated/models/post_delete_draft_tweets_request.py +95 -0
  128. twitter_openapi_python_generated/models/post_delete_draft_tweets_request_variables.py +89 -0
  129. twitter_openapi_python_generated/models/post_delete_list_request.py +95 -0
  130. twitter_openapi_python_generated/models/post_delete_list_request_variables.py +89 -0
  131. twitter_openapi_python_generated/models/post_delete_retweet_request.py +1 -1
  132. twitter_openapi_python_generated/models/post_delete_retweet_request_variables.py +3 -3
  133. twitter_openapi_python_generated/models/post_delete_tweet_request.py +2 -2
  134. twitter_openapi_python_generated/models/post_favorite_tweet_request.py +1 -1
  135. twitter_openapi_python_generated/models/post_list_add_member_request.py +101 -0
  136. twitter_openapi_python_generated/models/post_list_add_member_request_variables.py +91 -0
  137. twitter_openapi_python_generated/models/post_list_remove_member_request.py +101 -0
  138. twitter_openapi_python_generated/models/post_unfavorite_tweet_request.py +1 -1
  139. twitter_openapi_python_generated/models/primary_community_topic.py +2 -5
  140. twitter_openapi_python_generated/models/profile_bio.py +11 -3
  141. twitter_openapi_python_generated/models/profile_bio_entities.py +98 -0
  142. twitter_openapi_python_generated/models/profile_bio_entities_urls.py +96 -0
  143. twitter_openapi_python_generated/models/profile_response.py +1 -2
  144. twitter_openapi_python_generated/models/retweet.py +4 -7
  145. twitter_openapi_python_generated/models/scheduled_tweets_viewer.py +89 -0
  146. twitter_openapi_python_generated/models/search_timeline_response.py +1 -2
  147. twitter_openapi_python_generated/models/self_thread.py +2 -5
  148. twitter_openapi_python_generated/models/session.py +8 -20
  149. twitter_openapi_python_generated/models/social_context_union.py +3 -2
  150. twitter_openapi_python_generated/models/text.py +1 -2
  151. twitter_openapi_python_generated/models/timeline.py +1 -2
  152. twitter_openapi_python_generated/models/timeline_add_entries.py +1 -2
  153. twitter_openapi_python_generated/models/timeline_add_entry.py +4 -10
  154. twitter_openapi_python_generated/models/timeline_add_to_module.py +1 -2
  155. twitter_openapi_python_generated/models/timeline_frame.py +97 -0
  156. twitter_openapi_python_generated/models/timeline_half_cover.py +1 -2
  157. twitter_openapi_python_generated/models/timeline_label.py +101 -0
  158. twitter_openapi_python_generated/models/timeline_mark_entries_unread_greater_than_sort_index.py +2 -5
  159. twitter_openapi_python_generated/models/timeline_response.py +1 -2
  160. twitter_openapi_python_generated/models/timeline_show_alert.py +7 -3
  161. twitter_openapi_python_generated/models/timeline_timeline_module.py +1 -2
  162. twitter_openapi_python_generated/models/timeline_trend.py +16 -4
  163. twitter_openapi_python_generated/models/timeline_twitter_list.py +101 -0
  164. twitter_openapi_python_generated/models/tombstone_rich_text.py +1 -2
  165. twitter_openapi_python_generated/models/tracing.py +2 -5
  166. twitter_openapi_python_generated/models/trend_metadata.py +4 -2
  167. twitter_openapi_python_generated/models/trend_results.py +2 -5
  168. twitter_openapi_python_generated/models/tweet.py +17 -6
  169. twitter_openapi_python_generated/models/tweet_card_legacy.py +2 -4
  170. twitter_openapi_python_generated/models/tweet_card_platform_device.py +2 -5
  171. twitter_openapi_python_generated/models/tweet_detail_response.py +1 -2
  172. twitter_openapi_python_generated/models/tweet_edit_control.py +6 -15
  173. twitter_openapi_python_generated/models/tweet_edit_control_initial.py +4 -10
  174. twitter_openapi_python_generated/models/tweet_favoriters_response.py +1 -2
  175. twitter_openapi_python_generated/models/tweet_interstitial_reveal_text.py +1 -2
  176. twitter_openapi_python_generated/models/tweet_interstitial_text.py +1 -2
  177. twitter_openapi_python_generated/models/tweet_legacy.py +15 -36
  178. twitter_openapi_python_generated/models/tweet_limited_action_results.py +1 -2
  179. twitter_openapi_python_generated/models/tweet_preview_display_tweet.py +5 -11
  180. twitter_openapi_python_generated/models/tweet_preview_display_tweet_view_count.py +2 -5
  181. twitter_openapi_python_generated/models/tweet_result_by_rest_id_response.py +1 -2
  182. twitter_openapi_python_generated/models/tweet_retweeters_response.py +1 -2
  183. twitter_openapi_python_generated/models/tweet_union.py +3 -2
  184. twitter_openapi_python_generated/models/tweet_view.py +2 -5
  185. twitter_openapi_python_generated/models/twitter_list.py +146 -0
  186. twitter_openapi_python_generated/models/type_name.py +4 -0
  187. twitter_openapi_python_generated/models/unfavorite_tweet_response.py +1 -2
  188. twitter_openapi_python_generated/models/urt_endpoint_options.py +3 -4
  189. twitter_openapi_python_generated/models/user.py +75 -13
  190. twitter_openapi_python_generated/models/user_action_counts.py +89 -0
  191. twitter_openapi_python_generated/models/user_banner.py +89 -0
  192. twitter_openapi_python_generated/models/user_core.py +3 -6
  193. twitter_openapi_python_generated/models/user_highlights_tweets_response.py +1 -2
  194. twitter_openapi_python_generated/models/user_legacy.py +3 -6
  195. twitter_openapi_python_generated/models/user_notifications_settings.py +89 -0
  196. twitter_openapi_python_generated/models/user_pinned_items.py +90 -0
  197. twitter_openapi_python_generated/models/user_professional.py +3 -7
  198. twitter_openapi_python_generated/models/user_profile_metadata.py +89 -0
  199. twitter_openapi_python_generated/models/user_profile_translation.py +89 -0
  200. twitter_openapi_python_generated/models/user_relationship_counts.py +91 -0
  201. twitter_openapi_python_generated/models/user_relationship_perspectives.py +6 -2
  202. twitter_openapi_python_generated/models/user_response.py +1 -2
  203. twitter_openapi_python_generated/models/user_result_by_screen_name.py +2 -5
  204. twitter_openapi_python_generated/models/user_result_by_screen_name_result.py +8 -12
  205. twitter_openapi_python_generated/models/user_result_core.py +3 -1
  206. twitter_openapi_python_generated/models/user_results.py +3 -1
  207. twitter_openapi_python_generated/models/user_tweet_counts.py +91 -0
  208. twitter_openapi_python_generated/models/user_tweets_response.py +1 -2
  209. twitter_openapi_python_generated/models/user_union.py +6 -3
  210. twitter_openapi_python_generated/models/user_value.py +8 -9
  211. twitter_openapi_python_generated/models/user_verification_info_reason.py +2 -5
  212. twitter_openapi_python_generated/models/user_verification_info_reason_description.py +1 -2
  213. twitter_openapi_python_generated/models/user_website.py +89 -0
  214. twitter_openapi_python_generated/models/users_response.py +1 -2
  215. twitter_openapi_python_generated/models/users_response_data.py +1 -2
  216. twitter_openapi_python_generated/models/viewer_badge_counts_response.py +102 -0
  217. twitter_openapi_python_generated/models/viewer_badge_counts_response_data.py +93 -0
  218. twitter_openapi_python_generated/models/viewer_badge_counts_result.py +96 -0
  219. twitter_openapi_python_generated/models/viewer_badge_counts_user_results.py +93 -0
  220. twitter_openapi_python_generated/models/viewer_badge_counts_viewer.py +93 -0
  221. twitter_openapi_python_generated/rest.py +79 -8
  222. {twitter_openapi_python_generated-0.0.34.dist-info → twitter_openapi_python_generated-0.0.35.dist-info}/METADATA +926 -816
  223. {twitter_openapi_python_generated-0.0.34.dist-info → twitter_openapi_python_generated-0.0.35.dist-info}/RECORD +227 -145
  224. {twitter_openapi_python_generated-0.0.34.dist-info → twitter_openapi_python_generated-0.0.35.dist-info}/WHEEL +1 -1
  225. {twitter_openapi_python_generated-0.0.34.dist-info → twitter_openapi_python_generated-0.0.35.dist-info}/licenses/LICENSE +31 -31
  226. {twitter_openapi_python_generated-0.0.34.dist-info → twitter_openapi_python_generated-0.0.35.dist-info}/licenses/LICENSE.AGPL +660 -660
  227. {twitter_openapi_python_generated-0.0.34.dist-info → twitter_openapi_python_generated-0.0.35.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,97 @@
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, StrictInt
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 BadgeCounts(BaseModel):
28
+ """
29
+ BadgeCounts
30
+ """ # noqa: E501
31
+ dm_unread_count: StrictInt
32
+ is_from_urt: StrictBool
33
+ ntab_unread_count: StrictInt
34
+ total_unread_count: StrictInt
35
+ xchat_unread_count: StrictInt
36
+ __properties: ClassVar[List[str]] = ["dm_unread_count", "is_from_urt", "ntab_unread_count", "total_unread_count", "xchat_unread_count"]
37
+
38
+ model_config = ConfigDict(
39
+ validate_by_name=True,
40
+ validate_by_alias=True,
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
44
+
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ return json.dumps(to_jsonable_python(self.to_dict()))
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of BadgeCounts from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ ])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of BadgeCounts from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate({
89
+ "dm_unread_count": obj.get("dm_unread_count"),
90
+ "is_from_urt": obj.get("is_from_urt"),
91
+ "ntab_unread_count": obj.get("ntab_unread_count"),
92
+ "total_unread_count": obj.get("total_unread_count"),
93
+ "xchat_unread_count": obj.get("xchat_unread_count")
94
+ })
95
+ return _obj
96
+
97
+
@@ -28,11 +28,12 @@ class BirdwatchEntityRef(BaseModel):
28
28
  """
29
29
  BirdwatchEntityRef
30
30
  """ # noqa: E501
31
+ expanded_url: Optional[StrictStr] = Field(default=None, alias="expandedUrl")
31
32
  text: Optional[StrictStr] = None
32
33
  type: StrictStr
33
34
  url: Optional[StrictStr] = None
34
35
  url_type: Optional[StrictStr] = Field(default=None, alias="urlType")
35
- __properties: ClassVar[List[str]] = ["text", "type", "url", "urlType"]
36
+ __properties: ClassVar[List[str]] = ["expandedUrl", "text", "type", "url", "urlType"]
36
37
 
37
38
  @field_validator('type')
38
39
  def type_validate_enum(cls, value):
@@ -102,6 +103,7 @@ class BirdwatchEntityRef(BaseModel):
102
103
  return cls.model_validate(obj)
103
104
 
104
105
  _obj = cls.model_validate({
106
+ "expandedUrl": obj.get("expandedUrl"),
105
107
  "text": obj.get("text"),
106
108
  "type": obj.get("type"),
107
109
  "url": obj.get("url"),
@@ -76,8 +76,7 @@ class BirdwatchPivotFooter(BaseModel):
76
76
  _items = []
77
77
  if self.entities:
78
78
  for _item_entities in self.entities:
79
- if _item_entities:
80
- _items.append(_item_entities.to_dict())
79
+ _items.append(_item_entities.to_dict() if _item_entities is not None else None)
81
80
  _dict['entities'] = _items
82
81
  return _dict
83
82
 
@@ -36,13 +36,10 @@ class BirdwatchPivotNote(BaseModel):
36
36
  rest_id: Annotated[str, Field(strict=True)]
37
37
  __properties: ClassVar[List[str]] = ["grok_translated_community_note_with_availability", "is_community_note_translatable", "language", "rest_id"]
38
38
 
39
- @field_validator('rest_id')
39
+ @field_validator('rest_id', mode="before")
40
40
  def rest_id_validate_regular_expression(cls, value):
41
41
  """Validates the regular expression"""
42
- if not isinstance(value, str):
43
- value = str(value)
44
-
45
- if not re.match(r"^[0-9]+$", value):
42
+ if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
46
43
  raise ValueError(r"must validate the regular expression /^[0-9]+$/")
47
44
  return value
48
45
 
@@ -76,8 +76,7 @@ class BirdwatchPivotSubtitle(BaseModel):
76
76
  _items = []
77
77
  if self.entities:
78
78
  for _item_entities in self.entities:
79
- if _item_entities:
80
- _items.append(_item_entities.to_dict())
79
+ _items.append(_item_entities.to_dict() if _item_entities is not None else None)
81
80
  _dict['entities'] = _items
82
81
  return _dict
83
82
 
@@ -80,8 +80,7 @@ class BookmarksResponse(BaseModel):
80
80
  _items = []
81
81
  if self.errors:
82
82
  for _item_errors in self.errors:
83
- if _item_errors:
84
- _items.append(_item_errors.to_dict())
83
+ _items.append(_item_errors.to_dict() if _item_errors is not None else None)
85
84
  _dict['errors'] = _items
86
85
  return _dict
87
86
 
@@ -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 CashtagAttachment(BaseModel):
28
+ """
29
+ CashtagAttachment
30
+ """ # noqa: E501
31
+ rest_id: StrictStr
32
+ __properties: ClassVar[List[str]] = ["rest_id"]
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 CashtagAttachment 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 CashtagAttachment 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
+ "rest_id": obj.get("rest_id")
86
+ })
87
+ return _obj
88
+
89
+
@@ -65,16 +65,13 @@ class Community(BaseModel):
65
65
  viewer_relationship: Optional[Dict[str, Any]] = None
66
66
  __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"]
67
67
 
68
- @field_validator('id_str')
68
+ @field_validator('id_str', mode="before")
69
69
  def id_str_validate_regular_expression(cls, value):
70
70
  """Validates the regular expression"""
71
71
  if value is None:
72
72
  return value
73
73
 
74
- if not isinstance(value, str):
75
- value = str(value)
76
-
77
- if not re.match(r"^[0-9]+$", value):
74
+ if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
78
75
  raise ValueError(r"must validate the regular expression /^[0-9]+$/")
79
76
  return value
80
77
 
@@ -166,8 +163,7 @@ class Community(BaseModel):
166
163
  _items = []
167
164
  if self.members_facepile_results:
168
165
  for _item_members_facepile_results in self.members_facepile_results:
169
- if _item_members_facepile_results:
170
- _items.append(_item_members_facepile_results.to_dict())
166
+ _items.append(_item_members_facepile_results.to_dict() if _item_members_facepile_results is not None else None)
171
167
  _dict['members_facepile_results'] = _items
172
168
  # override the default output from pydantic by calling `to_dict()` of primary_community_topic
173
169
  if self.primary_community_topic:
@@ -176,8 +172,7 @@ class Community(BaseModel):
176
172
  _items = []
177
173
  if self.rules:
178
174
  for _item_rules in self.rules:
179
- if _item_rules:
180
- _items.append(_item_rules.to_dict())
175
+ _items.append(_item_rules.to_dict() if _item_rules is not None else None)
181
176
  _dict['rules'] = _items
182
177
  # override the default output from pydantic by calling `to_dict()` of urls
183
178
  if self.urls:
@@ -80,8 +80,7 @@ class CommunityAboutTimelineResponse(BaseModel):
80
80
  _items = []
81
81
  if self.errors:
82
82
  for _item_errors in self.errors:
83
- if _item_errors:
84
- _items.append(_item_errors.to_dict())
83
+ _items.append(_item_errors.to_dict() if _item_errors is not None else None)
85
84
  _dict['errors'] = _items
86
85
  return _dict
87
86
 
@@ -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
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from twitter_openapi_python_generated.models.community_discovery_timeline_response_data import CommunityDiscoveryTimelineResponseData
24
+ from twitter_openapi_python_generated.models.error_response import ErrorResponse
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+ from pydantic_core import to_jsonable_python
28
+
29
+ class CommunityDiscoveryTimelineResponse(BaseModel):
30
+ """
31
+ CommunityDiscoveryTimelineResponse
32
+ """ # noqa: E501
33
+ data: CommunityDiscoveryTimelineResponseData
34
+ errors: Optional[List[ErrorResponse]] = None
35
+ __properties: ClassVar[List[str]] = ["data", "errors"]
36
+
37
+ model_config = ConfigDict(
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+
45
+ def to_str(self) -> str:
46
+ """Returns the string representation of the model using alias"""
47
+ return pprint.pformat(self.model_dump(by_alias=True))
48
+
49
+ def to_json(self) -> str:
50
+ """Returns the JSON representation of the model using alias"""
51
+ return json.dumps(to_jsonable_python(self.to_dict()))
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of CommunityDiscoveryTimelineResponse from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # override the default output from pydantic by calling `to_dict()` of data
77
+ if self.data:
78
+ _dict['data'] = self.data.to_dict()
79
+ # override the default output from pydantic by calling `to_dict()` of each item in errors (list)
80
+ _items = []
81
+ if self.errors:
82
+ for _item_errors in self.errors:
83
+ _items.append(_item_errors.to_dict() if _item_errors is not None else None)
84
+ _dict['errors'] = _items
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of CommunityDiscoveryTimelineResponse 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
+ "data": CommunityDiscoveryTimelineResponseData.from_dict(obj["data"]) if obj.get("data") is not None else None,
98
+ "errors": [ErrorResponse.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None
99
+ })
100
+ return _obj
101
+
102
+
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict
22
+ from typing import Any, ClassVar, Dict, List
23
+ from twitter_openapi_python_generated.models.community_discovery_timeline_viewer import CommunityDiscoveryTimelineViewer
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class CommunityDiscoveryTimelineResponseData(BaseModel):
29
+ """
30
+ CommunityDiscoveryTimelineResponseData
31
+ """ # noqa: E501
32
+ viewer: CommunityDiscoveryTimelineViewer
33
+ __properties: ClassVar[List[str]] = ["viewer"]
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 CommunityDiscoveryTimelineResponseData from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of viewer
75
+ if self.viewer:
76
+ _dict['viewer'] = self.viewer.to_dict()
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of CommunityDiscoveryTimelineResponseData from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate({
89
+ "viewer": CommunityDiscoveryTimelineViewer.from_dict(obj["viewer"]) if obj.get("viewer") is not None else None
90
+ })
91
+ return _obj
92
+
93
+
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict
22
+ from typing import Any, ClassVar, Dict, List
23
+ from twitter_openapi_python_generated.models.timeline_result import TimelineResult
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class CommunityDiscoveryTimelineViewer(BaseModel):
29
+ """
30
+ CommunityDiscoveryTimelineViewer
31
+ """ # noqa: E501
32
+ community_discovery_timeline: TimelineResult
33
+ __properties: ClassVar[List[str]] = ["community_discovery_timeline"]
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 CommunityDiscoveryTimelineViewer from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of community_discovery_timeline
75
+ if self.community_discovery_timeline:
76
+ _dict['community_discovery_timeline'] = self.community_discovery_timeline.to_dict()
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of CommunityDiscoveryTimelineViewer from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate({
89
+ "community_discovery_timeline": TimelineResult.from_dict(obj["community_discovery_timeline"]) if obj.get("community_discovery_timeline") is not None else None
90
+ })
91
+ return _obj
92
+
93
+
@@ -92,9 +92,10 @@ class CommunityJoinActionResultUnion(BaseModel):
92
92
  match = 0
93
93
 
94
94
  # use oneOf discriminator to lookup the data type
95
- _data_type = json.loads(json_str).get("__typename")
95
+ _discriminator_property = "__typename"
96
+ _data_type = json.loads(json_str).get(_discriminator_property)
96
97
  if not _data_type:
97
- raise ValueError("Failed to lookup data type from the field `__typename` in the input.")
98
+ raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.")
98
99
 
99
100
  # check if data type is `CommunityJoinAction`
100
101
  if _data_type == "CommunityJoinAction":
@@ -80,8 +80,7 @@ class CommunityMediaTimelineResponse(BaseModel):
80
80
  _items = []
81
81
  if self.errors:
82
82
  for _item_errors in self.errors:
83
- if _item_errors:
84
- _items.append(_item_errors.to_dict())
83
+ _items.append(_item_errors.to_dict() if _item_errors is not None else None)
85
84
  _dict['errors'] = _items
86
85
  return _dict
87
86
 
@@ -36,13 +36,10 @@ class CommunityRelationship(BaseModel):
36
36
  rest_id: Annotated[str, Field(strict=True)]
37
37
  __properties: ClassVar[List[str]] = ["actions", "id", "moderation_state", "rest_id"]
38
38
 
39
- @field_validator('rest_id')
39
+ @field_validator('rest_id', mode="before")
40
40
  def rest_id_validate_regular_expression(cls, value):
41
41
  """Validates the regular expression"""
42
- if not isinstance(value, str):
43
- value = str(value)
44
-
45
- if not re.match(r"^[0-9]+$", value):
42
+ if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
46
43
  raise ValueError(r"must validate the regular expression /^[0-9]+$/")
47
44
  return value
48
45
 
@@ -34,13 +34,10 @@ class CommunityRule(BaseModel):
34
34
  rest_id: Annotated[str, Field(strict=True)]
35
35
  __properties: ClassVar[List[str]] = ["description", "name", "rest_id"]
36
36
 
37
- @field_validator('rest_id')
37
+ @field_validator('rest_id', mode="before")
38
38
  def rest_id_validate_regular_expression(cls, value):
39
39
  """Validates the regular expression"""
40
- if not isinstance(value, str):
41
- value = str(value)
42
-
43
- if not re.match(r"^[0-9]+$", value):
40
+ if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
44
41
  raise ValueError(r"must validate the regular expression /^[0-9]+$/")
45
42
  return value
46
43
 
@@ -80,8 +80,7 @@ class CommunityTweetsTimelineResponse(BaseModel):
80
80
  _items = []
81
81
  if self.errors:
82
82
  for _item_errors in self.errors:
83
- if _item_errors:
84
- _items.append(_item_errors.to_dict())
83
+ _items.append(_item_errors.to_dict() if _item_errors is not None else None)
85
84
  _dict['errors'] = _items
86
85
  return _dict
87
86