universal-mcp-applications 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.
Files changed (268) hide show
  1. universal_mcp/applications/ahrefs/README.md +51 -0
  2. universal_mcp/applications/ahrefs/__init__.py +1 -0
  3. universal_mcp/applications/ahrefs/app.py +2291 -0
  4. universal_mcp/applications/airtable/README.md +22 -0
  5. universal_mcp/applications/airtable/__init__.py +1 -0
  6. universal_mcp/applications/airtable/app.py +479 -0
  7. universal_mcp/applications/apollo/README.md +44 -0
  8. universal_mcp/applications/apollo/__init__.py +1 -0
  9. universal_mcp/applications/apollo/app.py +1847 -0
  10. universal_mcp/applications/asana/README.md +199 -0
  11. universal_mcp/applications/asana/__init__.py +1 -0
  12. universal_mcp/applications/asana/app.py +9509 -0
  13. universal_mcp/applications/aws-s3/README.md +0 -0
  14. universal_mcp/applications/aws-s3/__init__.py +1 -0
  15. universal_mcp/applications/aws-s3/app.py +552 -0
  16. universal_mcp/applications/bill/README.md +0 -0
  17. universal_mcp/applications/bill/__init__.py +1 -0
  18. universal_mcp/applications/bill/app.py +8705 -0
  19. universal_mcp/applications/box/README.md +307 -0
  20. universal_mcp/applications/box/__init__.py +1 -0
  21. universal_mcp/applications/box/app.py +15987 -0
  22. universal_mcp/applications/braze/README.md +106 -0
  23. universal_mcp/applications/braze/__init__.py +1 -0
  24. universal_mcp/applications/braze/app.py +4754 -0
  25. universal_mcp/applications/cal-com-v2/README.md +150 -0
  26. universal_mcp/applications/cal-com-v2/__init__.py +1 -0
  27. universal_mcp/applications/cal-com-v2/app.py +5541 -0
  28. universal_mcp/applications/calendly/README.md +53 -0
  29. universal_mcp/applications/calendly/__init__.py +1 -0
  30. universal_mcp/applications/calendly/app.py +1436 -0
  31. universal_mcp/applications/canva/README.md +43 -0
  32. universal_mcp/applications/canva/__init__.py +1 -0
  33. universal_mcp/applications/canva/app.py +941 -0
  34. universal_mcp/applications/clickup/README.md +135 -0
  35. universal_mcp/applications/clickup/__init__.py +1 -0
  36. universal_mcp/applications/clickup/app.py +5009 -0
  37. universal_mcp/applications/coda/README.md +108 -0
  38. universal_mcp/applications/coda/__init__.py +1 -0
  39. universal_mcp/applications/coda/app.py +3671 -0
  40. universal_mcp/applications/confluence/README.md +198 -0
  41. universal_mcp/applications/confluence/__init__.py +1 -0
  42. universal_mcp/applications/confluence/app.py +6273 -0
  43. universal_mcp/applications/contentful/README.md +17 -0
  44. universal_mcp/applications/contentful/__init__.py +1 -0
  45. universal_mcp/applications/contentful/app.py +364 -0
  46. universal_mcp/applications/crustdata/README.md +25 -0
  47. universal_mcp/applications/crustdata/__init__.py +1 -0
  48. universal_mcp/applications/crustdata/app.py +586 -0
  49. universal_mcp/applications/dialpad/README.md +202 -0
  50. universal_mcp/applications/dialpad/__init__.py +1 -0
  51. universal_mcp/applications/dialpad/app.py +5949 -0
  52. universal_mcp/applications/digitalocean/README.md +463 -0
  53. universal_mcp/applications/digitalocean/__init__.py +1 -0
  54. universal_mcp/applications/digitalocean/app.py +20835 -0
  55. universal_mcp/applications/domain-checker/README.md +13 -0
  56. universal_mcp/applications/domain-checker/__init__.py +1 -0
  57. universal_mcp/applications/domain-checker/app.py +265 -0
  58. universal_mcp/applications/e2b/README.md +12 -0
  59. universal_mcp/applications/e2b/__init__.py +1 -0
  60. universal_mcp/applications/e2b/app.py +187 -0
  61. universal_mcp/applications/elevenlabs/README.md +88 -0
  62. universal_mcp/applications/elevenlabs/__init__.py +1 -0
  63. universal_mcp/applications/elevenlabs/app.py +3235 -0
  64. universal_mcp/applications/exa/README.md +15 -0
  65. universal_mcp/applications/exa/__init__.py +1 -0
  66. universal_mcp/applications/exa/app.py +221 -0
  67. universal_mcp/applications/falai/README.md +17 -0
  68. universal_mcp/applications/falai/__init__.py +1 -0
  69. universal_mcp/applications/falai/app.py +331 -0
  70. universal_mcp/applications/figma/README.md +49 -0
  71. universal_mcp/applications/figma/__init__.py +1 -0
  72. universal_mcp/applications/figma/app.py +1090 -0
  73. universal_mcp/applications/firecrawl/README.md +20 -0
  74. universal_mcp/applications/firecrawl/__init__.py +1 -0
  75. universal_mcp/applications/firecrawl/app.py +514 -0
  76. universal_mcp/applications/fireflies/README.md +25 -0
  77. universal_mcp/applications/fireflies/__init__.py +1 -0
  78. universal_mcp/applications/fireflies/app.py +506 -0
  79. universal_mcp/applications/fpl/README.md +23 -0
  80. universal_mcp/applications/fpl/__init__.py +1 -0
  81. universal_mcp/applications/fpl/app.py +1327 -0
  82. universal_mcp/applications/fpl/utils/api.py +142 -0
  83. universal_mcp/applications/fpl/utils/fixtures.py +629 -0
  84. universal_mcp/applications/fpl/utils/helper.py +982 -0
  85. universal_mcp/applications/fpl/utils/league_utils.py +546 -0
  86. universal_mcp/applications/fpl/utils/position_utils.py +68 -0
  87. universal_mcp/applications/ghost-content/README.md +25 -0
  88. universal_mcp/applications/ghost-content/__init__.py +1 -0
  89. universal_mcp/applications/ghost-content/app.py +654 -0
  90. universal_mcp/applications/github/README.md +1049 -0
  91. universal_mcp/applications/github/__init__.py +1 -0
  92. universal_mcp/applications/github/app.py +50600 -0
  93. universal_mcp/applications/gong/README.md +63 -0
  94. universal_mcp/applications/gong/__init__.py +1 -0
  95. universal_mcp/applications/gong/app.py +2297 -0
  96. universal_mcp/applications/google-ads/README.md +0 -0
  97. universal_mcp/applications/google-ads/__init__.py +1 -0
  98. universal_mcp/applications/google-ads/app.py +23 -0
  99. universal_mcp/applications/google-calendar/README.md +21 -0
  100. universal_mcp/applications/google-calendar/__init__.py +1 -0
  101. universal_mcp/applications/google-calendar/app.py +574 -0
  102. universal_mcp/applications/google-docs/README.md +25 -0
  103. universal_mcp/applications/google-docs/__init__.py +1 -0
  104. universal_mcp/applications/google-docs/app.py +760 -0
  105. universal_mcp/applications/google-drive/README.md +68 -0
  106. universal_mcp/applications/google-drive/__init__.py +1 -0
  107. universal_mcp/applications/google-drive/app.py +4936 -0
  108. universal_mcp/applications/google-gemini/README.md +25 -0
  109. universal_mcp/applications/google-gemini/__init__.py +1 -0
  110. universal_mcp/applications/google-gemini/app.py +663 -0
  111. universal_mcp/applications/google-mail/README.md +31 -0
  112. universal_mcp/applications/google-mail/__init__.py +1 -0
  113. universal_mcp/applications/google-mail/app.py +1354 -0
  114. universal_mcp/applications/google-searchconsole/README.md +21 -0
  115. universal_mcp/applications/google-searchconsole/__init__.py +1 -0
  116. universal_mcp/applications/google-searchconsole/app.py +320 -0
  117. universal_mcp/applications/google-sheet/README.md +36 -0
  118. universal_mcp/applications/google-sheet/__init__.py +1 -0
  119. universal_mcp/applications/google-sheet/app.py +1941 -0
  120. universal_mcp/applications/hashnode/README.md +20 -0
  121. universal_mcp/applications/hashnode/__init__.py +1 -0
  122. universal_mcp/applications/hashnode/app.py +455 -0
  123. universal_mcp/applications/heygen/README.md +44 -0
  124. universal_mcp/applications/heygen/__init__.py +1 -0
  125. universal_mcp/applications/heygen/app.py +961 -0
  126. universal_mcp/applications/http-tools/README.md +16 -0
  127. universal_mcp/applications/http-tools/__init__.py +1 -0
  128. universal_mcp/applications/http-tools/app.py +153 -0
  129. universal_mcp/applications/hubspot/README.md +239 -0
  130. universal_mcp/applications/hubspot/__init__.py +1 -0
  131. universal_mcp/applications/hubspot/app.py +416 -0
  132. universal_mcp/applications/jira/README.md +600 -0
  133. universal_mcp/applications/jira/__init__.py +1 -0
  134. universal_mcp/applications/jira/app.py +28804 -0
  135. universal_mcp/applications/klaviyo/README.md +313 -0
  136. universal_mcp/applications/klaviyo/__init__.py +1 -0
  137. universal_mcp/applications/klaviyo/app.py +11236 -0
  138. universal_mcp/applications/linkedin/README.md +15 -0
  139. universal_mcp/applications/linkedin/__init__.py +1 -0
  140. universal_mcp/applications/linkedin/app.py +243 -0
  141. universal_mcp/applications/mailchimp/README.md +281 -0
  142. universal_mcp/applications/mailchimp/__init__.py +1 -0
  143. universal_mcp/applications/mailchimp/app.py +10937 -0
  144. universal_mcp/applications/markitdown/README.md +12 -0
  145. universal_mcp/applications/markitdown/__init__.py +1 -0
  146. universal_mcp/applications/markitdown/app.py +63 -0
  147. universal_mcp/applications/miro/README.md +151 -0
  148. universal_mcp/applications/miro/__init__.py +1 -0
  149. universal_mcp/applications/miro/app.py +5429 -0
  150. universal_mcp/applications/ms-teams/README.md +42 -0
  151. universal_mcp/applications/ms-teams/__init__.py +1 -0
  152. universal_mcp/applications/ms-teams/app.py +1823 -0
  153. universal_mcp/applications/neon/README.md +74 -0
  154. universal_mcp/applications/neon/__init__.py +1 -0
  155. universal_mcp/applications/neon/app.py +2018 -0
  156. universal_mcp/applications/notion/README.md +30 -0
  157. universal_mcp/applications/notion/__init__.py +1 -0
  158. universal_mcp/applications/notion/app.py +527 -0
  159. universal_mcp/applications/openai/README.md +22 -0
  160. universal_mcp/applications/openai/__init__.py +1 -0
  161. universal_mcp/applications/openai/app.py +759 -0
  162. universal_mcp/applications/outlook/README.md +20 -0
  163. universal_mcp/applications/outlook/__init__.py +1 -0
  164. universal_mcp/applications/outlook/app.py +444 -0
  165. universal_mcp/applications/perplexity/README.md +12 -0
  166. universal_mcp/applications/perplexity/__init__.py +1 -0
  167. universal_mcp/applications/perplexity/app.py +65 -0
  168. universal_mcp/applications/pipedrive/README.md +284 -0
  169. universal_mcp/applications/pipedrive/__init__.py +1 -0
  170. universal_mcp/applications/pipedrive/app.py +12924 -0
  171. universal_mcp/applications/posthog/README.md +132 -0
  172. universal_mcp/applications/posthog/__init__.py +1 -0
  173. universal_mcp/applications/posthog/app.py +7125 -0
  174. universal_mcp/applications/reddit/README.md +135 -0
  175. universal_mcp/applications/reddit/__init__.py +1 -0
  176. universal_mcp/applications/reddit/app.py +4652 -0
  177. universal_mcp/applications/replicate/README.md +18 -0
  178. universal_mcp/applications/replicate/__init__.py +1 -0
  179. universal_mcp/applications/replicate/app.py +495 -0
  180. universal_mcp/applications/resend/README.md +40 -0
  181. universal_mcp/applications/resend/__init__.py +1 -0
  182. universal_mcp/applications/resend/app.py +881 -0
  183. universal_mcp/applications/retell/README.md +21 -0
  184. universal_mcp/applications/retell/__init__.py +1 -0
  185. universal_mcp/applications/retell/app.py +333 -0
  186. universal_mcp/applications/rocketlane/README.md +70 -0
  187. universal_mcp/applications/rocketlane/__init__.py +1 -0
  188. universal_mcp/applications/rocketlane/app.py +4346 -0
  189. universal_mcp/applications/semanticscholar/README.md +25 -0
  190. universal_mcp/applications/semanticscholar/__init__.py +1 -0
  191. universal_mcp/applications/semanticscholar/app.py +482 -0
  192. universal_mcp/applications/semrush/README.md +44 -0
  193. universal_mcp/applications/semrush/__init__.py +1 -0
  194. universal_mcp/applications/semrush/app.py +2081 -0
  195. universal_mcp/applications/sendgrid/README.md +362 -0
  196. universal_mcp/applications/sendgrid/__init__.py +1 -0
  197. universal_mcp/applications/sendgrid/app.py +9752 -0
  198. universal_mcp/applications/sentry/README.md +186 -0
  199. universal_mcp/applications/sentry/__init__.py +1 -0
  200. universal_mcp/applications/sentry/app.py +7471 -0
  201. universal_mcp/applications/serpapi/README.md +14 -0
  202. universal_mcp/applications/serpapi/__init__.py +1 -0
  203. universal_mcp/applications/serpapi/app.py +293 -0
  204. universal_mcp/applications/sharepoint/README.md +0 -0
  205. universal_mcp/applications/sharepoint/__init__.py +1 -0
  206. universal_mcp/applications/sharepoint/app.py +215 -0
  207. universal_mcp/applications/shopify/README.md +321 -0
  208. universal_mcp/applications/shopify/__init__.py +1 -0
  209. universal_mcp/applications/shopify/app.py +15392 -0
  210. universal_mcp/applications/shortcut/README.md +128 -0
  211. universal_mcp/applications/shortcut/__init__.py +1 -0
  212. universal_mcp/applications/shortcut/app.py +4478 -0
  213. universal_mcp/applications/slack/README.md +0 -0
  214. universal_mcp/applications/slack/__init__.py +1 -0
  215. universal_mcp/applications/slack/app.py +570 -0
  216. universal_mcp/applications/spotify/README.md +91 -0
  217. universal_mcp/applications/spotify/__init__.py +1 -0
  218. universal_mcp/applications/spotify/app.py +2526 -0
  219. universal_mcp/applications/supabase/README.md +87 -0
  220. universal_mcp/applications/supabase/__init__.py +1 -0
  221. universal_mcp/applications/supabase/app.py +2970 -0
  222. universal_mcp/applications/tavily/README.md +12 -0
  223. universal_mcp/applications/tavily/__init__.py +1 -0
  224. universal_mcp/applications/tavily/app.py +51 -0
  225. universal_mcp/applications/trello/README.md +266 -0
  226. universal_mcp/applications/trello/__init__.py +1 -0
  227. universal_mcp/applications/trello/app.py +10875 -0
  228. universal_mcp/applications/twillo/README.md +0 -0
  229. universal_mcp/applications/twillo/__init__.py +1 -0
  230. universal_mcp/applications/twillo/app.py +269 -0
  231. universal_mcp/applications/twitter/README.md +100 -0
  232. universal_mcp/applications/twitter/__init__.py +1 -0
  233. universal_mcp/applications/twitter/api_segments/__init__.py +0 -0
  234. universal_mcp/applications/twitter/api_segments/api_segment_base.py +51 -0
  235. universal_mcp/applications/twitter/api_segments/compliance_api.py +122 -0
  236. universal_mcp/applications/twitter/api_segments/dm_conversations_api.py +255 -0
  237. universal_mcp/applications/twitter/api_segments/dm_events_api.py +140 -0
  238. universal_mcp/applications/twitter/api_segments/likes_api.py +159 -0
  239. universal_mcp/applications/twitter/api_segments/lists_api.py +395 -0
  240. universal_mcp/applications/twitter/api_segments/openapi_json_api.py +34 -0
  241. universal_mcp/applications/twitter/api_segments/spaces_api.py +309 -0
  242. universal_mcp/applications/twitter/api_segments/trends_api.py +40 -0
  243. universal_mcp/applications/twitter/api_segments/tweets_api.py +1403 -0
  244. universal_mcp/applications/twitter/api_segments/usage_api.py +40 -0
  245. universal_mcp/applications/twitter/api_segments/users_api.py +1498 -0
  246. universal_mcp/applications/twitter/app.py +46 -0
  247. universal_mcp/applications/unipile/README.md +28 -0
  248. universal_mcp/applications/unipile/__init__.py +1 -0
  249. universal_mcp/applications/unipile/app.py +829 -0
  250. universal_mcp/applications/whatsapp/README.md +23 -0
  251. universal_mcp/applications/whatsapp/__init__.py +1 -0
  252. universal_mcp/applications/whatsapp/app.py +595 -0
  253. universal_mcp/applications/whatsapp-business/README.md +34 -0
  254. universal_mcp/applications/whatsapp-business/__init__.py +1 -0
  255. universal_mcp/applications/whatsapp-business/app.py +1065 -0
  256. universal_mcp/applications/wrike/README.md +46 -0
  257. universal_mcp/applications/wrike/__init__.py +1 -0
  258. universal_mcp/applications/wrike/app.py +1583 -0
  259. universal_mcp/applications/youtube/README.md +57 -0
  260. universal_mcp/applications/youtube/__init__.py +1 -0
  261. universal_mcp/applications/youtube/app.py +1696 -0
  262. universal_mcp/applications/zenquotes/README.md +12 -0
  263. universal_mcp/applications/zenquotes/__init__.py +1 -0
  264. universal_mcp/applications/zenquotes/app.py +31 -0
  265. universal_mcp_applications-0.1.1.dist-info/METADATA +172 -0
  266. universal_mcp_applications-0.1.1.dist-info/RECORD +268 -0
  267. universal_mcp_applications-0.1.1.dist-info/WHEEL +4 -0
  268. universal_mcp_applications-0.1.1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,1498 @@
1
+ from typing import Any
2
+
3
+ from .api_segment_base import APISegmentBase
4
+
5
+
6
+ class UsersApi(APISegmentBase):
7
+ def __init__(self, main_app_client: Any):
8
+ super().__init__(main_app_client)
9
+
10
+ def find_users_by_id(
11
+ self, ids, user_fields=None, expansions=None, tweet_fields=None
12
+ ) -> dict[str, Any]:
13
+ """
14
+
15
+ Retrieves information about one or more users specified by their IDs, allowing for customization with user fields and expansions.
16
+
17
+ Args:
18
+ ids (array): A required query parameter specifying an array of user IDs to retrieve information for multiple users in a single request. Example: '2244994945,6253282,12'.
19
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
20
+ expansions (array): A comma separated list of fields to expand. Example: "['affiliation.user_id', 'most_recent_tweet_id', 'pinned_tweet_id']".
21
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
22
+
23
+ Returns:
24
+ dict[str, Any]: The request has succeeded.
25
+
26
+ Raises:
27
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
28
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
29
+
30
+ Tags:
31
+ Users
32
+ """
33
+ url = f"{self.main_app_client.base_url}/2/users"
34
+ query_params = {
35
+ k: v
36
+ for k, v in [
37
+ ("ids", ids),
38
+ ("user.fields", user_fields),
39
+ ("expansions", expansions),
40
+ ("tweet.fields", tweet_fields),
41
+ ]
42
+ if v is not None
43
+ }
44
+ response = self._get(url, params=query_params)
45
+ response.raise_for_status()
46
+ return response.json()
47
+
48
+ def find_users_by_username(
49
+ self, usernames, user_fields=None, expansions=None, tweet_fields=None
50
+ ) -> dict[str, Any]:
51
+ """
52
+
53
+ Retrieves information about one or more users specified by their usernames using the Twitter API, allowing optional specification of additional user fields and expansions.
54
+
55
+ Args:
56
+ usernames (array): Required array of usernames to filter users by. Example: 'TwitterDev,TwitterAPI'.
57
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
58
+ expansions (array): A comma separated list of fields to expand. Example: "['affiliation.user_id', 'most_recent_tweet_id', 'pinned_tweet_id']".
59
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
60
+
61
+ Returns:
62
+ dict[str, Any]: The request has succeeded.
63
+
64
+ Raises:
65
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
66
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
67
+
68
+ Tags:
69
+ Users
70
+ """
71
+ url = f"{self.main_app_client.base_url}/2/users/by"
72
+ query_params = {
73
+ k: v
74
+ for k, v in [
75
+ ("usernames", usernames),
76
+ ("user.fields", user_fields),
77
+ ("expansions", expansions),
78
+ ("tweet.fields", tweet_fields),
79
+ ]
80
+ if v is not None
81
+ }
82
+ response = self._get(url, params=query_params)
83
+ response.raise_for_status()
84
+ return response.json()
85
+
86
+ def find_user_by_username(
87
+ self, username, user_fields=None, expansions=None, tweet_fields=None
88
+ ) -> dict[str, Any]:
89
+ """
90
+
91
+ Retrieves information about a user specified by their username, optionally including additional fields and expansions, using the "GET" method with authentication.
92
+
93
+ Args:
94
+ username (string): username
95
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
96
+ expansions (array): A comma separated list of fields to expand. Example: "['affiliation.user_id', 'most_recent_tweet_id', 'pinned_tweet_id']".
97
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
98
+
99
+ Returns:
100
+ dict[str, Any]: The request has succeeded.
101
+
102
+ Raises:
103
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
104
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
105
+
106
+ Tags:
107
+ Users
108
+ """
109
+ if username is None:
110
+ raise ValueError("Missing required parameter 'username'.")
111
+ url = f"{self.main_app_client.base_url}/2/users/by/username/{username}"
112
+ query_params = {
113
+ k: v
114
+ for k, v in [
115
+ ("user.fields", user_fields),
116
+ ("expansions", expansions),
117
+ ("tweet.fields", tweet_fields),
118
+ ]
119
+ if v is not None
120
+ }
121
+ response = self._get(url, params=query_params)
122
+ response.raise_for_status()
123
+ return response.json()
124
+
125
+ def get_users_compliance_stream(
126
+ self, partition, backfill_minutes=None, start_time=None, end_time=None
127
+ ) -> Any:
128
+ """
129
+
130
+ Streams compliance data for users using the "GET" method, supporting optional backfill minutes, start and end times, and requiring a partition parameter.
131
+
132
+ Args:
133
+ partition (integer): The "partition" parameter is a required integer query parameter that determines which partition of the compliance stream data to retrieve.
134
+ backfill_minutes (integer): Optional integer parameter to specify the number of minutes of missed data to recover after a disconnection; valid values are between 1 and 5 minutes.
135
+ start_time (string): Optional start time in string format for filtering the compliance stream. Example: '2021-02-01T18:40:40.000Z'.
136
+ end_time (string): Optional end time for filtering the compliance stream data, specified as a string. Example: '2021-02-01T18:40:40.000Z'.
137
+
138
+ Returns:
139
+ Any: The request has succeeded.
140
+
141
+ Raises:
142
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
143
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
144
+
145
+ Tags:
146
+ Compliance
147
+ """
148
+ url = f"{self.main_app_client.base_url}/2/users/compliance/stream"
149
+ query_params = {
150
+ k: v
151
+ for k, v in [
152
+ ("backfill_minutes", backfill_minutes),
153
+ ("partition", partition),
154
+ ("start_time", start_time),
155
+ ("end_time", end_time),
156
+ ]
157
+ if v is not None
158
+ }
159
+ response = self._get(url, params=query_params)
160
+ response.raise_for_status()
161
+ return response.json()
162
+
163
+ def find_my_user(
164
+ self, user_fields=None, expansions=None, tweet_fields=None
165
+ ) -> dict[str, Any]:
166
+ """
167
+
168
+ Retrieves detailed information about the authenticated user, including optional expansions and fields for user and tweet data.
169
+
170
+ Args:
171
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
172
+ expansions (array): A comma separated list of fields to expand. Example: "['affiliation.user_id', 'most_recent_tweet_id', 'pinned_tweet_id']".
173
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
174
+
175
+ Returns:
176
+ dict[str, Any]: The request has succeeded.
177
+
178
+ Raises:
179
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
180
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
181
+
182
+ Tags:
183
+ Users
184
+ """
185
+ url = f"{self.main_app_client.base_url}/2/users/me"
186
+ query_params = {
187
+ k: v
188
+ for k, v in [
189
+ ("user.fields", user_fields),
190
+ ("expansions", expansions),
191
+ ("tweet.fields", tweet_fields),
192
+ ]
193
+ if v is not None
194
+ }
195
+ response = self._get(url, params=query_params)
196
+ response.raise_for_status()
197
+ return response.json()
198
+
199
+ def search_user_by_query(
200
+ self,
201
+ query,
202
+ max_results=None,
203
+ next_token=None,
204
+ user_fields=None,
205
+ expansions=None,
206
+ tweet_fields=None,
207
+ ) -> dict[str, Any]:
208
+ """
209
+
210
+ Searches for users using a query string, returning a list of matching users with optional fields for user details, expansions, and related tweet fields.
211
+
212
+ Args:
213
+ query (string): Search query to filter users based on specific criteria. Example: 'someXUser'.
214
+ max_results (integer): Maximum number of results to return in the search query, with a default of 100.
215
+ next_token (string): The token used for pagination to retrieve the next set of user search results.
216
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
217
+ expansions (array): A comma separated list of fields to expand. Example: "['affiliation.user_id', 'most_recent_tweet_id', 'pinned_tweet_id']".
218
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
219
+
220
+ Returns:
221
+ dict[str, Any]: The request has succeeded.
222
+
223
+ Raises:
224
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
225
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
226
+
227
+ Tags:
228
+ Users
229
+ """
230
+ url = f"{self.main_app_client.base_url}/2/users/search"
231
+ query_params = {
232
+ k: v
233
+ for k, v in [
234
+ ("query", query),
235
+ ("max_results", max_results),
236
+ ("next_token", next_token),
237
+ ("user.fields", user_fields),
238
+ ("expansions", expansions),
239
+ ("tweet.fields", tweet_fields),
240
+ ]
241
+ if v is not None
242
+ }
243
+ response = self._get(url, params=query_params)
244
+ response.raise_for_status()
245
+ return response.json()
246
+
247
+ def find_user_by_id(
248
+ self, id, user_fields=None, expansions=None, tweet_fields=None
249
+ ) -> dict[str, Any]:
250
+ """
251
+
252
+ Retrieves information about a user specified by their ID, with optional parameters for specifying additional user fields, expansions, and tweet fields.
253
+
254
+ Args:
255
+ id (string): id
256
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
257
+ expansions (array): A comma separated list of fields to expand. Example: "['affiliation.user_id', 'most_recent_tweet_id', 'pinned_tweet_id']".
258
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
259
+
260
+ Returns:
261
+ dict[str, Any]: The request has succeeded.
262
+
263
+ Raises:
264
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
265
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
266
+
267
+ Tags:
268
+ Users
269
+ """
270
+ if id is None:
271
+ raise ValueError("Missing required parameter 'id'.")
272
+ url = f"{self.main_app_client.base_url}/2/users/{id}"
273
+ query_params = {
274
+ k: v
275
+ for k, v in [
276
+ ("user.fields", user_fields),
277
+ ("expansions", expansions),
278
+ ("tweet.fields", tweet_fields),
279
+ ]
280
+ if v is not None
281
+ }
282
+ response = self._get(url, params=query_params)
283
+ response.raise_for_status()
284
+ return response.json()
285
+
286
+ def users_id_blocking(
287
+ self,
288
+ id,
289
+ max_results=None,
290
+ pagination_token=None,
291
+ user_fields=None,
292
+ expansions=None,
293
+ tweet_fields=None,
294
+ ) -> dict[str, Any]:
295
+ """
296
+
297
+ Retrieves a list of user objects that are blocked by the specified user ID, allowing for additional fields and expansions to be specified.
298
+
299
+ Args:
300
+ id (string): id
301
+ max_results (integer): Limits the number of user blocking records returned in the response, with no default value set and requiring an integer input.
302
+ pagination_token (string): The pagination_token query parameter is an optional opaque string token used to retrieve the next page of results when paginating through a user's blocked accounts.
303
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
304
+ expansions (array): A comma separated list of fields to expand. Example: "['affiliation.user_id', 'most_recent_tweet_id', 'pinned_tweet_id']".
305
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
306
+
307
+ Returns:
308
+ dict[str, Any]: The request has succeeded.
309
+
310
+ Raises:
311
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
312
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
313
+
314
+ Tags:
315
+ Users
316
+ """
317
+ if id is None:
318
+ raise ValueError("Missing required parameter 'id'.")
319
+ url = f"{self.main_app_client.base_url}/2/users/{id}/blocking"
320
+ query_params = {
321
+ k: v
322
+ for k, v in [
323
+ ("max_results", max_results),
324
+ ("pagination_token", pagination_token),
325
+ ("user.fields", user_fields),
326
+ ("expansions", expansions),
327
+ ("tweet.fields", tweet_fields),
328
+ ]
329
+ if v is not None
330
+ }
331
+ response = self._get(url, params=query_params)
332
+ response.raise_for_status()
333
+ return response.json()
334
+
335
+ def get_users_id_bookmarks(
336
+ self,
337
+ id,
338
+ max_results=None,
339
+ pagination_token=None,
340
+ tweet_fields=None,
341
+ expansions=None,
342
+ media_fields=None,
343
+ poll_fields=None,
344
+ user_fields=None,
345
+ place_fields=None,
346
+ ) -> dict[str, Any]:
347
+ """
348
+
349
+ Retrieves a list of bookmarks for a user with the specified ID, allowing optional pagination and customization of returned fields.
350
+
351
+ Args:
352
+ id (string): id
353
+ max_results (integer): The "max_results" parameter, an optional integer query parameter with a default value of 2, limits the number of bookmark results returned when retrieving a user's bookmarks via the GET operation at "/2/users/{id}/bookmarks".
354
+ pagination_token (string): The pagination_token query parameter is an optional token used to retrieve the next page of results in a paginated response for the user's bookmarks.
355
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
356
+ expansions (array): A comma separated list of fields to expand. Example: "['article.cover_media', 'article.media_entities', 'attachments.media_keys', 'attachments.media_source_tweet', 'attachments.poll_ids', 'author_id', 'edit_history_tweet_ids', 'entities.mentions.username', 'geo.place_id', 'in_reply_to_user_id', 'entities.note.mentions.username', 'referenced_tweets.id', 'referenced_tweets.id.author_id', 'author_screen_name']".
357
+ media_fields (array): A comma separated list of Media fields to display. Example: "['alt_text', 'duration_ms', 'height', 'media_key', 'non_public_metrics', 'organic_metrics', 'preview_image_url', 'promoted_metrics', 'public_metrics', 'type', 'url', 'variants', 'width']".
358
+ poll_fields (array): A comma separated list of Poll fields to display. Example: "['duration_minutes', 'end_datetime', 'id', 'options', 'voting_status']".
359
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
360
+ place_fields (array): A comma separated list of Place fields to display. Example: "['contained_within', 'country', 'country_code', 'full_name', 'geo', 'id', 'name', 'place_type']".
361
+
362
+ Returns:
363
+ dict[str, Any]: The request has succeeded.
364
+
365
+ Raises:
366
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
367
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
368
+
369
+ Tags:
370
+ Bookmarks
371
+ """
372
+ if id is None:
373
+ raise ValueError("Missing required parameter 'id'.")
374
+ url = f"{self.main_app_client.base_url}/2/users/{id}/bookmarks"
375
+ query_params = {
376
+ k: v
377
+ for k, v in [
378
+ ("max_results", max_results),
379
+ ("pagination_token", pagination_token),
380
+ ("tweet.fields", tweet_fields),
381
+ ("expansions", expansions),
382
+ ("media.fields", media_fields),
383
+ ("poll.fields", poll_fields),
384
+ ("user.fields", user_fields),
385
+ ("place.fields", place_fields),
386
+ ]
387
+ if v is not None
388
+ }
389
+ response = self._get(url, params=query_params)
390
+ response.raise_for_status()
391
+ return response.json()
392
+
393
+ def post_users_id_bookmarks(self, id, tweet_id) -> dict[str, Any]:
394
+ """
395
+
396
+ Adds bookmarks for a specified user using the provided JSON data and returns a successful response upon completion.
397
+
398
+ Args:
399
+ id (string): id
400
+ tweet_id (string): Unique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers. Example: '1346889436626259968'.
401
+
402
+ Returns:
403
+ dict[str, Any]: The request has succeeded.
404
+
405
+ Raises:
406
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
407
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
408
+
409
+ Tags:
410
+ Bookmarks
411
+ """
412
+ if id is None:
413
+ raise ValueError("Missing required parameter 'id'.")
414
+ request_body_data = None
415
+ request_body_data = {"tweet_id": tweet_id}
416
+ request_body_data = {
417
+ k: v for k, v in request_body_data.items() if v is not None
418
+ }
419
+ url = f"{self.main_app_client.base_url}/2/users/{id}/bookmarks"
420
+ query_params = {}
421
+ response = self._post(
422
+ url,
423
+ data=request_body_data,
424
+ params=query_params,
425
+ content_type="application/json",
426
+ )
427
+ response.raise_for_status()
428
+ return response.json()
429
+
430
+ def users_id_bookmarks_delete(self, id, tweet_id) -> dict[str, Any]:
431
+ """
432
+
433
+ Deletes a bookmarked tweet for a specified user using the "DELETE" method.
434
+
435
+ Args:
436
+ id (string): id
437
+ tweet_id (string): tweet_id
438
+
439
+ Returns:
440
+ dict[str, Any]: The request has succeeded.
441
+
442
+ Raises:
443
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
444
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
445
+
446
+ Tags:
447
+ Bookmarks
448
+ """
449
+ if id is None:
450
+ raise ValueError("Missing required parameter 'id'.")
451
+ if tweet_id is None:
452
+ raise ValueError("Missing required parameter 'tweet_id'.")
453
+ url = f"{self.main_app_client.base_url}/2/users/{id}/bookmarks/{tweet_id}"
454
+ query_params = {}
455
+ response = self._delete(url, params=query_params)
456
+ response.raise_for_status()
457
+ return response.json()
458
+
459
+ def user_followed_lists(
460
+ self,
461
+ id,
462
+ max_results=None,
463
+ pagination_token=None,
464
+ list_fields=None,
465
+ expansions=None,
466
+ user_fields=None,
467
+ ) -> dict[str, Any]:
468
+ """
469
+
470
+ Retrieves a list of Twitter lists followed by a specified user, with optional parameters for pagination, list fields, and user fields.
471
+
472
+ Args:
473
+ id (string): id
474
+ max_results (integer): Specifies the maximum number of followed lists to return per page, with a default value of 100.
475
+ pagination_token (string): The pagination_token query parameter is an optional token used to retrieve the next page of results in a paginated response for followed lists.
476
+ list_fields (array): A comma separated list of List fields to display. Example: "['created_at', 'description', 'follower_count', 'id', 'member_count', 'name', 'owner_id', 'private']".
477
+ expansions (array): A comma separated list of fields to expand. Example: "['owner_id']".
478
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
479
+
480
+ Returns:
481
+ dict[str, Any]: The request has succeeded.
482
+
483
+ Raises:
484
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
485
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
486
+
487
+ Tags:
488
+ Lists
489
+ """
490
+ if id is None:
491
+ raise ValueError("Missing required parameter 'id'.")
492
+ url = f"{self.main_app_client.base_url}/2/users/{id}/followed_lists"
493
+ query_params = {
494
+ k: v
495
+ for k, v in [
496
+ ("max_results", max_results),
497
+ ("pagination_token", pagination_token),
498
+ ("list.fields", list_fields),
499
+ ("expansions", expansions),
500
+ ("user.fields", user_fields),
501
+ ]
502
+ if v is not None
503
+ }
504
+ response = self._get(url, params=query_params)
505
+ response.raise_for_status()
506
+ return response.json()
507
+
508
+ def list_user_follow(self, id, list_id=None) -> dict[str, Any]:
509
+ """
510
+
511
+ Adds a Twitter user to a list of followed lists using the Twitter API and returns a status message.
512
+
513
+ Args:
514
+ id (string): id
515
+ list_id (string): The unique identifier of this List. Example: '1146654567674912769'.
516
+
517
+ Returns:
518
+ dict[str, Any]: The request has succeeded.
519
+
520
+ Raises:
521
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
522
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
523
+
524
+ Tags:
525
+ Lists
526
+ """
527
+ if id is None:
528
+ raise ValueError("Missing required parameter 'id'.")
529
+ request_body_data = None
530
+ request_body_data = {"list_id": list_id}
531
+ request_body_data = {
532
+ k: v for k, v in request_body_data.items() if v is not None
533
+ }
534
+ url = f"{self.main_app_client.base_url}/2/users/{id}/followed_lists"
535
+ query_params = {}
536
+ response = self._post(
537
+ url,
538
+ data=request_body_data,
539
+ params=query_params,
540
+ content_type="application/json",
541
+ )
542
+ response.raise_for_status()
543
+ return response.json()
544
+
545
+ def list_user_unfollow(self, id, list_id) -> dict[str, Any]:
546
+ """
547
+
548
+ Deletes the specified list followed by the user identified by the given user ID and list ID.
549
+
550
+ Args:
551
+ id (string): id
552
+ list_id (string): list_id
553
+
554
+ Returns:
555
+ dict[str, Any]: The request has succeeded.
556
+
557
+ Raises:
558
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
559
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
560
+
561
+ Tags:
562
+ Lists
563
+ """
564
+ if id is None:
565
+ raise ValueError("Missing required parameter 'id'.")
566
+ if list_id is None:
567
+ raise ValueError("Missing required parameter 'list_id'.")
568
+ url = f"{self.main_app_client.base_url}/2/users/{id}/followed_lists/{list_id}"
569
+ query_params = {}
570
+ response = self._delete(url, params=query_params)
571
+ response.raise_for_status()
572
+ return response.json()
573
+
574
+ def users_id_followers(
575
+ self,
576
+ id,
577
+ max_results=None,
578
+ pagination_token=None,
579
+ user_fields=None,
580
+ expansions=None,
581
+ tweet_fields=None,
582
+ ) -> dict[str, Any]:
583
+ """
584
+
585
+ Retrieves a list of users who follow a specified user using the Twitter API, with optional parameters for result pagination and additional user or tweet fields.
586
+
587
+ Args:
588
+ id (string): id
589
+ max_results (integer): The maximum number of follower results to return in the response.
590
+ pagination_token (string): An optional token used for pagination to continue retrieving followers from a specific point in the dataset.
591
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
592
+ expansions (array): A comma separated list of fields to expand. Example: "['affiliation.user_id', 'most_recent_tweet_id', 'pinned_tweet_id']".
593
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
594
+
595
+ Returns:
596
+ dict[str, Any]: The request has succeeded.
597
+
598
+ Raises:
599
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
600
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
601
+
602
+ Tags:
603
+ Users
604
+ """
605
+ if id is None:
606
+ raise ValueError("Missing required parameter 'id'.")
607
+ url = f"{self.main_app_client.base_url}/2/users/{id}/followers"
608
+ query_params = {
609
+ k: v
610
+ for k, v in [
611
+ ("max_results", max_results),
612
+ ("pagination_token", pagination_token),
613
+ ("user.fields", user_fields),
614
+ ("expansions", expansions),
615
+ ("tweet.fields", tweet_fields),
616
+ ]
617
+ if v is not None
618
+ }
619
+ response = self._get(url, params=query_params)
620
+ response.raise_for_status()
621
+ return response.json()
622
+
623
+ def users_id_following(
624
+ self,
625
+ id,
626
+ max_results=None,
627
+ pagination_token=None,
628
+ user_fields=None,
629
+ expansions=None,
630
+ tweet_fields=None,
631
+ ) -> dict[str, Any]:
632
+ """
633
+
634
+ Retrieves a list of users followed by the specified user ID, allowing optional parameters to customize the response with additional user fields, expansions, and tweet fields.
635
+
636
+ Args:
637
+ id (string): id
638
+ max_results (integer): Optional parameter to limit the number of results returned in the response for the GET operation at "/2/users/{id}/following", specified as an integer.
639
+ pagination_token (string): An opaque token used for pagination, allowing the retrieval of the next batch of results when navigating through a large dataset of users that the specified user is following.
640
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
641
+ expansions (array): A comma separated list of fields to expand. Example: "['affiliation.user_id', 'most_recent_tweet_id', 'pinned_tweet_id']".
642
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
643
+
644
+ Returns:
645
+ dict[str, Any]: The request has succeeded.
646
+
647
+ Raises:
648
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
649
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
650
+
651
+ Tags:
652
+ Users
653
+ """
654
+ if id is None:
655
+ raise ValueError("Missing required parameter 'id'.")
656
+ url = f"{self.main_app_client.base_url}/2/users/{id}/following"
657
+ query_params = {
658
+ k: v
659
+ for k, v in [
660
+ ("max_results", max_results),
661
+ ("pagination_token", pagination_token),
662
+ ("user.fields", user_fields),
663
+ ("expansions", expansions),
664
+ ("tweet.fields", tweet_fields),
665
+ ]
666
+ if v is not None
667
+ }
668
+ response = self._get(url, params=query_params)
669
+ response.raise_for_status()
670
+ return response.json()
671
+
672
+ def users_id_follow(self, id, target_user_id=None) -> dict[str, Any]:
673
+ """
674
+
675
+ Follows another user on behalf of the current user using the Twitter API, returning a status message indicating whether the action was successful.
676
+
677
+ Args:
678
+ id (string): id
679
+ target_user_id (string): Unique identifier of this User. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers. Example: '2244994945'.
680
+
681
+ Returns:
682
+ dict[str, Any]: The request has succeeded.
683
+
684
+ Raises:
685
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
686
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
687
+
688
+ Tags:
689
+ Users
690
+ """
691
+ if id is None:
692
+ raise ValueError("Missing required parameter 'id'.")
693
+ request_body_data = None
694
+ request_body_data = {"target_user_id": target_user_id}
695
+ request_body_data = {
696
+ k: v for k, v in request_body_data.items() if v is not None
697
+ }
698
+ url = f"{self.main_app_client.base_url}/2/users/{id}/following"
699
+ query_params = {}
700
+ response = self._post(
701
+ url,
702
+ data=request_body_data,
703
+ params=query_params,
704
+ content_type="application/json",
705
+ )
706
+ response.raise_for_status()
707
+ return response.json()
708
+
709
+ def users_id_liked_tweets(
710
+ self,
711
+ id,
712
+ max_results=None,
713
+ pagination_token=None,
714
+ tweet_fields=None,
715
+ expansions=None,
716
+ media_fields=None,
717
+ poll_fields=None,
718
+ user_fields=None,
719
+ place_fields=None,
720
+ ) -> dict[str, Any]:
721
+ """
722
+
723
+ Retrieves a list of tweets liked by the specified user, supporting pagination and optional expansions and fields for tweets, users, media, polls, and places.
724
+
725
+ Args:
726
+ id (string): id
727
+ max_results (integer): Optional integer parameter to limit the number of liked tweets returned in the response.
728
+ pagination_token (string): The pagination_token query parameter is an optional opaque string token used to fetch the next page of results in the user's liked tweets timeline.
729
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
730
+ expansions (array): A comma separated list of fields to expand. Example: "['article.cover_media', 'article.media_entities', 'attachments.media_keys', 'attachments.media_source_tweet', 'attachments.poll_ids', 'author_id', 'edit_history_tweet_ids', 'entities.mentions.username', 'geo.place_id', 'in_reply_to_user_id', 'entities.note.mentions.username', 'referenced_tweets.id', 'referenced_tweets.id.author_id', 'author_screen_name']".
731
+ media_fields (array): A comma separated list of Media fields to display. Example: "['alt_text', 'duration_ms', 'height', 'media_key', 'non_public_metrics', 'organic_metrics', 'preview_image_url', 'promoted_metrics', 'public_metrics', 'type', 'url', 'variants', 'width']".
732
+ poll_fields (array): A comma separated list of Poll fields to display. Example: "['duration_minutes', 'end_datetime', 'id', 'options', 'voting_status']".
733
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
734
+ place_fields (array): A comma separated list of Place fields to display. Example: "['contained_within', 'country', 'country_code', 'full_name', 'geo', 'id', 'name', 'place_type']".
735
+
736
+ Returns:
737
+ dict[str, Any]: The request has succeeded.
738
+
739
+ Raises:
740
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
741
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
742
+
743
+ Tags:
744
+ Tweets
745
+ """
746
+ if id is None:
747
+ raise ValueError("Missing required parameter 'id'.")
748
+ url = f"{self.main_app_client.base_url}/2/users/{id}/liked_tweets"
749
+ query_params = {
750
+ k: v
751
+ for k, v in [
752
+ ("max_results", max_results),
753
+ ("pagination_token", pagination_token),
754
+ ("tweet.fields", tweet_fields),
755
+ ("expansions", expansions),
756
+ ("media.fields", media_fields),
757
+ ("poll.fields", poll_fields),
758
+ ("user.fields", user_fields),
759
+ ("place.fields", place_fields),
760
+ ]
761
+ if v is not None
762
+ }
763
+ response = self._get(url, params=query_params)
764
+ response.raise_for_status()
765
+ return response.json()
766
+
767
+ def users_id_like(self, id, tweet_id=None) -> dict[str, Any]:
768
+ """
769
+
770
+ Creates a new like for a user's content using the provided user ID and returns a status message.
771
+
772
+ Args:
773
+ id (string): id
774
+ tweet_id (string): Unique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers. Example: '1346889436626259968'.
775
+
776
+ Returns:
777
+ dict[str, Any]: The request has succeeded.
778
+
779
+ Raises:
780
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
781
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
782
+
783
+ Tags:
784
+ Tweets
785
+ """
786
+ if id is None:
787
+ raise ValueError("Missing required parameter 'id'.")
788
+ request_body_data = None
789
+ request_body_data = {"tweet_id": tweet_id}
790
+ request_body_data = {
791
+ k: v for k, v in request_body_data.items() if v is not None
792
+ }
793
+ url = f"{self.main_app_client.base_url}/2/users/{id}/likes"
794
+ query_params = {}
795
+ response = self._post(
796
+ url,
797
+ data=request_body_data,
798
+ params=query_params,
799
+ content_type="application/json",
800
+ )
801
+ response.raise_for_status()
802
+ return response.json()
803
+
804
+ def users_id_unlike(self, id, tweet_id) -> dict[str, Any]:
805
+ """
806
+
807
+ Deletes a user's like on a specific tweet using the provided user ID and tweet ID, requiring OAuth2UserToken with "like.write," "tweet.read," and "users.read" permissions.
808
+
809
+ Args:
810
+ id (string): id
811
+ tweet_id (string): tweet_id
812
+
813
+ Returns:
814
+ dict[str, Any]: The request has succeeded.
815
+
816
+ Raises:
817
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
818
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
819
+
820
+ Tags:
821
+ Tweets
822
+ """
823
+ if id is None:
824
+ raise ValueError("Missing required parameter 'id'.")
825
+ if tweet_id is None:
826
+ raise ValueError("Missing required parameter 'tweet_id'.")
827
+ url = f"{self.main_app_client.base_url}/2/users/{id}/likes/{tweet_id}"
828
+ query_params = {}
829
+ response = self._delete(url, params=query_params)
830
+ response.raise_for_status()
831
+ return response.json()
832
+
833
+ def get_user_list_memberships(
834
+ self,
835
+ id,
836
+ max_results=None,
837
+ pagination_token=None,
838
+ list_fields=None,
839
+ expansions=None,
840
+ user_fields=None,
841
+ ) -> dict[str, Any]:
842
+ """
843
+
844
+ Retrieves a list of memberships for a specified user using their ID, allowing for optional filtering by maximum results and pagination, and returns the membership details.
845
+
846
+ Args:
847
+ id (string): id
848
+ max_results (integer): The maximum number of membership results to return, defaulting to 100 if not specified.
849
+ pagination_token (string): An optional token used for pagination to navigate through the list of memberships for a user, typically provided in the response of a previous request.
850
+ list_fields (array): A comma separated list of List fields to display. Example: "['created_at', 'description', 'follower_count', 'id', 'member_count', 'name', 'owner_id', 'private']".
851
+ expansions (array): A comma separated list of fields to expand. Example: "['owner_id']".
852
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
853
+
854
+ Returns:
855
+ dict[str, Any]: The request has succeeded.
856
+
857
+ Raises:
858
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
859
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
860
+
861
+ Tags:
862
+ Lists
863
+ """
864
+ if id is None:
865
+ raise ValueError("Missing required parameter 'id'.")
866
+ url = f"{self.main_app_client.base_url}/2/users/{id}/list_memberships"
867
+ query_params = {
868
+ k: v
869
+ for k, v in [
870
+ ("max_results", max_results),
871
+ ("pagination_token", pagination_token),
872
+ ("list.fields", list_fields),
873
+ ("expansions", expansions),
874
+ ("user.fields", user_fields),
875
+ ]
876
+ if v is not None
877
+ }
878
+ response = self._get(url, params=query_params)
879
+ response.raise_for_status()
880
+ return response.json()
881
+
882
+ def users_id_mentions(
883
+ self,
884
+ id,
885
+ since_id=None,
886
+ until_id=None,
887
+ max_results=None,
888
+ pagination_token=None,
889
+ start_time=None,
890
+ end_time=None,
891
+ tweet_fields=None,
892
+ expansions=None,
893
+ media_fields=None,
894
+ poll_fields=None,
895
+ user_fields=None,
896
+ place_fields=None,
897
+ ) -> dict[str, Any]:
898
+ """
899
+
900
+ Retrieves the timeline of tweets that mention the user associated with the provided ID, allowing for customization with parameters such as since and until IDs, pagination tokens, and various field expansions.
901
+
902
+ Args:
903
+ id (string): id
904
+ since_id (string): Optional parameter to return results with an ID greater than (i.e., more recent than) the specified ID. Example: '1346889436626259968'.
905
+ until_id (string): Optional identifier to fetch mentions until this specific user ID. Example: '1346889436626259968'.
906
+ max_results (integer): Limits the number of mention items returned in the response.
907
+ pagination_token (string): Optional token used for pagination, allowing continuation from a specific point in the list of mentions.
908
+ start_time (string): Optional start time in string format to filter mentions. Example: '2021-02-01T18:40:40.000Z'.
909
+ end_time (string): Optional end time filter for retrieving user mentions, specified in a string format. Example: '2021-02-14T18:40:40.000Z'.
910
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
911
+ expansions (array): A comma separated list of fields to expand. Example: "['article.cover_media', 'article.media_entities', 'attachments.media_keys', 'attachments.media_source_tweet', 'attachments.poll_ids', 'author_id', 'edit_history_tweet_ids', 'entities.mentions.username', 'geo.place_id', 'in_reply_to_user_id', 'entities.note.mentions.username', 'referenced_tweets.id', 'referenced_tweets.id.author_id', 'author_screen_name']".
912
+ media_fields (array): A comma separated list of Media fields to display. Example: "['alt_text', 'duration_ms', 'height', 'media_key', 'non_public_metrics', 'organic_metrics', 'preview_image_url', 'promoted_metrics', 'public_metrics', 'type', 'url', 'variants', 'width']".
913
+ poll_fields (array): A comma separated list of Poll fields to display. Example: "['duration_minutes', 'end_datetime', 'id', 'options', 'voting_status']".
914
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
915
+ place_fields (array): A comma separated list of Place fields to display. Example: "['contained_within', 'country', 'country_code', 'full_name', 'geo', 'id', 'name', 'place_type']".
916
+
917
+ Returns:
918
+ dict[str, Any]: The request has succeeded.
919
+
920
+ Raises:
921
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
922
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
923
+
924
+ Tags:
925
+ Tweets
926
+ """
927
+ if id is None:
928
+ raise ValueError("Missing required parameter 'id'.")
929
+ url = f"{self.main_app_client.base_url}/2/users/{id}/mentions"
930
+ query_params = {
931
+ k: v
932
+ for k, v in [
933
+ ("since_id", since_id),
934
+ ("until_id", until_id),
935
+ ("max_results", max_results),
936
+ ("pagination_token", pagination_token),
937
+ ("start_time", start_time),
938
+ ("end_time", end_time),
939
+ ("tweet.fields", tweet_fields),
940
+ ("expansions", expansions),
941
+ ("media.fields", media_fields),
942
+ ("poll.fields", poll_fields),
943
+ ("user.fields", user_fields),
944
+ ("place.fields", place_fields),
945
+ ]
946
+ if v is not None
947
+ }
948
+ response = self._get(url, params=query_params)
949
+ response.raise_for_status()
950
+ return response.json()
951
+
952
+ def users_id_muting(
953
+ self,
954
+ id,
955
+ max_results=None,
956
+ pagination_token=None,
957
+ user_fields=None,
958
+ expansions=None,
959
+ tweet_fields=None,
960
+ ) -> dict[str, Any]:
961
+ """
962
+
963
+ Retrieves a list of users muted by the specified user using the Twitter API with optional filtering by max results, pagination token, user fields, user expansions, tweet fields, and returns the response upon authorization with the required "mute.read," "tweet.read," and "users.read" scopes.
964
+
965
+ Args:
966
+ id (string): id
967
+ max_results (integer): The "max_results" parameter limits the number of results returned in the response for the GET operation at "/2/users/{id}/muting", with a default value of 100.
968
+ pagination_token (string): The token to retrieve the next page of results when paginating through muted users; omit to start from the first page.
969
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
970
+ expansions (array): A comma separated list of fields to expand. Example: "['affiliation.user_id', 'most_recent_tweet_id', 'pinned_tweet_id']".
971
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
972
+
973
+ Returns:
974
+ dict[str, Any]: The request has succeeded.
975
+
976
+ Raises:
977
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
978
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
979
+
980
+ Tags:
981
+ Users
982
+ """
983
+ if id is None:
984
+ raise ValueError("Missing required parameter 'id'.")
985
+ url = f"{self.main_app_client.base_url}/2/users/{id}/muting"
986
+ query_params = {
987
+ k: v
988
+ for k, v in [
989
+ ("max_results", max_results),
990
+ ("pagination_token", pagination_token),
991
+ ("user.fields", user_fields),
992
+ ("expansions", expansions),
993
+ ("tweet.fields", tweet_fields),
994
+ ]
995
+ if v is not None
996
+ }
997
+ response = self._get(url, params=query_params)
998
+ response.raise_for_status()
999
+ return response.json()
1000
+
1001
+ def users_id_mute(self, id, target_user_id=None) -> dict[str, Any]:
1002
+ """
1003
+
1004
+ Mutes a user identified by their ID using the API, requiring a POST request with appropriate OAuth2 credentials.
1005
+
1006
+ Args:
1007
+ id (string): id
1008
+ target_user_id (string): Unique identifier of this User. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers. Example: '2244994945'.
1009
+
1010
+ Returns:
1011
+ dict[str, Any]: The request has succeeded.
1012
+
1013
+ Raises:
1014
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
1015
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
1016
+
1017
+ Tags:
1018
+ Users
1019
+ """
1020
+ if id is None:
1021
+ raise ValueError("Missing required parameter 'id'.")
1022
+ request_body_data = None
1023
+ request_body_data = {"target_user_id": target_user_id}
1024
+ request_body_data = {
1025
+ k: v for k, v in request_body_data.items() if v is not None
1026
+ }
1027
+ url = f"{self.main_app_client.base_url}/2/users/{id}/muting"
1028
+ query_params = {}
1029
+ response = self._post(
1030
+ url,
1031
+ data=request_body_data,
1032
+ params=query_params,
1033
+ content_type="application/json",
1034
+ )
1035
+ response.raise_for_status()
1036
+ return response.json()
1037
+
1038
+ def list_user_owned_lists(
1039
+ self,
1040
+ id,
1041
+ max_results=None,
1042
+ pagination_token=None,
1043
+ list_fields=None,
1044
+ expansions=None,
1045
+ user_fields=None,
1046
+ ) -> dict[str, Any]:
1047
+ """
1048
+
1049
+ Retrieves a list of Twitter Lists owned by the specified user, supporting optional pagination and field expansions.
1050
+
1051
+ Args:
1052
+ id (string): id
1053
+ max_results (integer): Maximum number of owned lists to return in the response; defaults to 100 if not specified.
1054
+ pagination_token (string): An optional token used for pagination, allowing users to fetch subsequent pages of results for the owned lists of a specified user.
1055
+ list_fields (array): A comma separated list of List fields to display. Example: "['created_at', 'description', 'follower_count', 'id', 'member_count', 'name', 'owner_id', 'private']".
1056
+ expansions (array): A comma separated list of fields to expand. Example: "['owner_id']".
1057
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
1058
+
1059
+ Returns:
1060
+ dict[str, Any]: The request has succeeded.
1061
+
1062
+ Raises:
1063
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
1064
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
1065
+
1066
+ Tags:
1067
+ Lists
1068
+ """
1069
+ if id is None:
1070
+ raise ValueError("Missing required parameter 'id'.")
1071
+ url = f"{self.main_app_client.base_url}/2/users/{id}/owned_lists"
1072
+ query_params = {
1073
+ k: v
1074
+ for k, v in [
1075
+ ("max_results", max_results),
1076
+ ("pagination_token", pagination_token),
1077
+ ("list.fields", list_fields),
1078
+ ("expansions", expansions),
1079
+ ("user.fields", user_fields),
1080
+ ]
1081
+ if v is not None
1082
+ }
1083
+ response = self._get(url, params=query_params)
1084
+ response.raise_for_status()
1085
+ return response.json()
1086
+
1087
+ def list_user_pinned_lists(
1088
+ self, id, list_fields=None, expansions=None, user_fields=None
1089
+ ) -> dict[str, Any]:
1090
+ """
1091
+
1092
+ Retrieves the pinned Lists of a specified user by their user ID, returning detailed information about each pinned List.
1093
+
1094
+ Args:
1095
+ id (string): id
1096
+ list_fields (array): A comma separated list of List fields to display. Example: "['created_at', 'description', 'follower_count', 'id', 'member_count', 'name', 'owner_id', 'private']".
1097
+ expansions (array): A comma separated list of fields to expand. Example: "['owner_id']".
1098
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
1099
+
1100
+ Returns:
1101
+ dict[str, Any]: The request has succeeded.
1102
+
1103
+ Raises:
1104
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
1105
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
1106
+
1107
+ Tags:
1108
+ Lists
1109
+ """
1110
+ if id is None:
1111
+ raise ValueError("Missing required parameter 'id'.")
1112
+ url = f"{self.main_app_client.base_url}/2/users/{id}/pinned_lists"
1113
+ query_params = {
1114
+ k: v
1115
+ for k, v in [
1116
+ ("list.fields", list_fields),
1117
+ ("expansions", expansions),
1118
+ ("user.fields", user_fields),
1119
+ ]
1120
+ if v is not None
1121
+ }
1122
+ response = self._get(url, params=query_params)
1123
+ response.raise_for_status()
1124
+ return response.json()
1125
+
1126
+ def list_user_pin(self, id, list_id) -> dict[str, Any]:
1127
+ """
1128
+
1129
+ Creates a pinned list for a user identified by {id} using JSON data and OAuth2UserToken or UserToken authentication.
1130
+
1131
+ Args:
1132
+ id (string): id
1133
+ list_id (string): The unique identifier of this List. Example: '1146654567674912769'.
1134
+
1135
+ Returns:
1136
+ dict[str, Any]: The request has succeeded.
1137
+
1138
+ Raises:
1139
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
1140
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
1141
+
1142
+ Tags:
1143
+ Lists
1144
+ """
1145
+ if id is None:
1146
+ raise ValueError("Missing required parameter 'id'.")
1147
+ request_body_data = None
1148
+ request_body_data = {"list_id": list_id}
1149
+ request_body_data = {
1150
+ k: v for k, v in request_body_data.items() if v is not None
1151
+ }
1152
+ url = f"{self.main_app_client.base_url}/2/users/{id}/pinned_lists"
1153
+ query_params = {}
1154
+ response = self._post(
1155
+ url,
1156
+ data=request_body_data,
1157
+ params=query_params,
1158
+ content_type="application/json",
1159
+ )
1160
+ response.raise_for_status()
1161
+ return response.json()
1162
+
1163
+ def list_user_unpin(self, id, list_id) -> dict[str, Any]:
1164
+ """
1165
+
1166
+ Deletes a specified pinned list from a user's account by user ID and list ID.
1167
+
1168
+ Args:
1169
+ id (string): id
1170
+ list_id (string): list_id
1171
+
1172
+ Returns:
1173
+ dict[str, Any]: The request has succeeded.
1174
+
1175
+ Raises:
1176
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
1177
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
1178
+
1179
+ Tags:
1180
+ Lists
1181
+ """
1182
+ if id is None:
1183
+ raise ValueError("Missing required parameter 'id'.")
1184
+ if list_id is None:
1185
+ raise ValueError("Missing required parameter 'list_id'.")
1186
+ url = f"{self.main_app_client.base_url}/2/users/{id}/pinned_lists/{list_id}"
1187
+ query_params = {}
1188
+ response = self._delete(url, params=query_params)
1189
+ response.raise_for_status()
1190
+ return response.json()
1191
+
1192
+ def users_id_retweets(self, id, tweet_id=None) -> dict[str, Any]:
1193
+ """
1194
+
1195
+ Retweets a post using the X API on behalf of a specified user, requiring authentication with OAuth2UserToken and appropriate permissions.
1196
+
1197
+ Args:
1198
+ id (string): id
1199
+ tweet_id (string): Unique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers. Example: '1346889436626259968'.
1200
+
1201
+ Returns:
1202
+ dict[str, Any]: The request has succeeded.
1203
+
1204
+ Raises:
1205
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
1206
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
1207
+
1208
+ Tags:
1209
+ Tweets
1210
+ """
1211
+ if id is None:
1212
+ raise ValueError("Missing required parameter 'id'.")
1213
+ request_body_data = None
1214
+ request_body_data = {"tweet_id": tweet_id}
1215
+ request_body_data = {
1216
+ k: v for k, v in request_body_data.items() if v is not None
1217
+ }
1218
+ url = f"{self.main_app_client.base_url}/2/users/{id}/retweets"
1219
+ query_params = {}
1220
+ response = self._post(
1221
+ url,
1222
+ data=request_body_data,
1223
+ params=query_params,
1224
+ content_type="application/json",
1225
+ )
1226
+ response.raise_for_status()
1227
+ return response.json()
1228
+
1229
+ def users_id_unretweets(self, id, source_tweet_id) -> dict[str, Any]:
1230
+ """
1231
+
1232
+ Undoes a retweet of a specified tweet by a user using the Twitter API v2, requiring OAuth authentication and user permissions.
1233
+
1234
+ Args:
1235
+ id (string): id
1236
+ source_tweet_id (string): source_tweet_id
1237
+
1238
+ Returns:
1239
+ dict[str, Any]: The request has succeeded.
1240
+
1241
+ Raises:
1242
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
1243
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
1244
+
1245
+ Tags:
1246
+ Tweets
1247
+ """
1248
+ if id is None:
1249
+ raise ValueError("Missing required parameter 'id'.")
1250
+ if source_tweet_id is None:
1251
+ raise ValueError("Missing required parameter 'source_tweet_id'.")
1252
+ url = f"{self.main_app_client.base_url}/2/users/{id}/retweets/{source_tweet_id}"
1253
+ query_params = {}
1254
+ response = self._delete(url, params=query_params)
1255
+ response.raise_for_status()
1256
+ return response.json()
1257
+
1258
+ def users_id_timeline(
1259
+ self,
1260
+ id,
1261
+ since_id=None,
1262
+ until_id=None,
1263
+ max_results=None,
1264
+ pagination_token=None,
1265
+ exclude=None,
1266
+ start_time=None,
1267
+ end_time=None,
1268
+ tweet_fields=None,
1269
+ expansions=None,
1270
+ media_fields=None,
1271
+ poll_fields=None,
1272
+ user_fields=None,
1273
+ place_fields=None,
1274
+ ) -> dict[str, Any]:
1275
+ """
1276
+
1277
+ Retrieves a user's reverse chronological timeline, returning tweets in the order they were posted, with optional filtering by time range, tweet IDs, and additional metadata fields.
1278
+
1279
+ Args:
1280
+ id (string): id
1281
+ since_id (string): The `since_id` parameter specifies the smallest ID of the statuses to be returned, retrieving the newest statuses first, but it may not return all statuses if there are too many between the newest and the specified ID. Example: '791775337160081409'.
1282
+ until_id (string): Optional ID to retrieve timelines up to this user ID in reverse chronological order. Example: '1346889436626259968'.
1283
+ max_results (integer): **max_results**: Optional integer parameter specifying the maximum number of results to return for the GET operation.
1284
+ pagination_token (string): Optional token used to paginate the response, specifying the point to start retrieving resources from in the reverse chronological timeline.
1285
+ exclude (array): A query parameter to specify an array of fields or properties to exclude from the response. Example: "['replies', 'retweets']".
1286
+ start_time (string): Optional start time parameter to filter timelines by specifying the earliest date and time for which entries should be included. Example: '2021-02-01T18:40:40.000Z'.
1287
+ end_time (string): The end_time query parameter specifies the optional timestamp that defines the upper bound (latest) for filtering tweets in the reverse chronological timeline of a user. Example: '2021-02-14T18:40:40.000Z'.
1288
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
1289
+ expansions (array): A comma separated list of fields to expand. Example: "['article.cover_media', 'article.media_entities', 'attachments.media_keys', 'attachments.media_source_tweet', 'attachments.poll_ids', 'author_id', 'edit_history_tweet_ids', 'entities.mentions.username', 'geo.place_id', 'in_reply_to_user_id', 'entities.note.mentions.username', 'referenced_tweets.id', 'referenced_tweets.id.author_id', 'author_screen_name']".
1290
+ media_fields (array): A comma separated list of Media fields to display. Example: "['alt_text', 'duration_ms', 'height', 'media_key', 'non_public_metrics', 'organic_metrics', 'preview_image_url', 'promoted_metrics', 'public_metrics', 'type', 'url', 'variants', 'width']".
1291
+ poll_fields (array): A comma separated list of Poll fields to display. Example: "['duration_minutes', 'end_datetime', 'id', 'options', 'voting_status']".
1292
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
1293
+ place_fields (array): A comma separated list of Place fields to display. Example: "['contained_within', 'country', 'country_code', 'full_name', 'geo', 'id', 'name', 'place_type']".
1294
+
1295
+ Returns:
1296
+ dict[str, Any]: The request has succeeded.
1297
+
1298
+ Raises:
1299
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
1300
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
1301
+
1302
+ Tags:
1303
+ Tweets
1304
+ """
1305
+ if id is None:
1306
+ raise ValueError("Missing required parameter 'id'.")
1307
+ url = f"{self.main_app_client.base_url}/2/users/{id}/timelines/reverse_chronological"
1308
+ query_params = {
1309
+ k: v
1310
+ for k, v in [
1311
+ ("since_id", since_id),
1312
+ ("until_id", until_id),
1313
+ ("max_results", max_results),
1314
+ ("pagination_token", pagination_token),
1315
+ ("exclude", exclude),
1316
+ ("start_time", start_time),
1317
+ ("end_time", end_time),
1318
+ ("tweet.fields", tweet_fields),
1319
+ ("expansions", expansions),
1320
+ ("media.fields", media_fields),
1321
+ ("poll.fields", poll_fields),
1322
+ ("user.fields", user_fields),
1323
+ ("place.fields", place_fields),
1324
+ ]
1325
+ if v is not None
1326
+ }
1327
+ response = self._get(url, params=query_params)
1328
+ response.raise_for_status()
1329
+ return response.json()
1330
+
1331
+ def users_id_tweets(
1332
+ self,
1333
+ id,
1334
+ since_id=None,
1335
+ until_id=None,
1336
+ max_results=None,
1337
+ pagination_token=None,
1338
+ exclude=None,
1339
+ start_time=None,
1340
+ end_time=None,
1341
+ tweet_fields=None,
1342
+ expansions=None,
1343
+ media_fields=None,
1344
+ poll_fields=None,
1345
+ user_fields=None,
1346
+ place_fields=None,
1347
+ ) -> dict[str, Any]:
1348
+ """
1349
+
1350
+ Retrieves a list of tweets for a user with the specified ID, allowing optional filtering by tweet ID range, result count, pagination token, excluded fields, and time range, using the "GET" method.
1351
+
1352
+ Args:
1353
+ id (string): id
1354
+ since_id (string): Returns only Tweets with IDs greater than (more recent than) the specified ID, allowing retrieval of Tweets posted after that ID. Example: '791775337160081409'.
1355
+ until_id (string): Returns tweets with IDs less than (older than) the specified until_id, limiting results to tweets posted before that ID. Example: '1346889436626259968'.
1356
+ max_results (integer): Specifies the maximum number of tweets to return per GET request for a user's tweets, with this parameter being optional and of type integer.
1357
+ pagination_token (string): Optional token used for pagination to continue retrieving results from a previous query.
1358
+ exclude (array): A query parameter to exclude specific properties from the response; accepts an array of property names to omit. Example: "['replies', 'retweets']".
1359
+ start_time (string): The start_time query parameter is an optional ISO 8601 timestamp string used to specify the earliest time from which to retrieve tweets for the user. Example: '2021-02-01T18:40:40.000Z'.
1360
+ end_time (string): Optional query parameter to filter tweets by specifying the end time, in string format, for retrieving tweets before this time. Example: '2021-02-14T18:40:40.000Z'.
1361
+ tweet_fields (array): A comma separated list of Tweet fields to display. Example: "['article', 'attachments', 'author_id', 'card_uri', 'context_annotations', 'conversation_id', 'created_at', 'edit_controls', 'edit_history_tweet_ids', 'entities', 'geo', 'id', 'in_reply_to_user_id', 'lang', 'non_public_metrics', 'note_tweet', 'organic_metrics', 'possibly_sensitive', 'promoted_metrics', 'public_metrics', 'referenced_tweets', 'reply_settings', 'scopes', 'source', 'text', 'username', 'withheld']".
1362
+ expansions (array): A comma separated list of fields to expand. Example: "['article.cover_media', 'article.media_entities', 'attachments.media_keys', 'attachments.media_source_tweet', 'attachments.poll_ids', 'author_id', 'edit_history_tweet_ids', 'entities.mentions.username', 'geo.place_id', 'in_reply_to_user_id', 'entities.note.mentions.username', 'referenced_tweets.id', 'referenced_tweets.id.author_id', 'author_screen_name']".
1363
+ media_fields (array): A comma separated list of Media fields to display. Example: "['alt_text', 'duration_ms', 'height', 'media_key', 'non_public_metrics', 'organic_metrics', 'preview_image_url', 'promoted_metrics', 'public_metrics', 'type', 'url', 'variants', 'width']".
1364
+ poll_fields (array): A comma separated list of Poll fields to display. Example: "['duration_minutes', 'end_datetime', 'id', 'options', 'voting_status']".
1365
+ user_fields (array): A comma separated list of User fields to display. Example: "['affiliation', 'connection_status', 'created_at', 'description', 'entities', 'id', 'location', 'most_recent_tweet_id', 'name', 'pinned_tweet_id', 'profile_banner_url', 'profile_image_url', 'protected', 'public_metrics', 'receives_your_dm', 'subscription_type', 'url', 'username', 'verified', 'verified_type', 'withheld']".
1366
+ place_fields (array): A comma separated list of Place fields to display. Example: "['contained_within', 'country', 'country_code', 'full_name', 'geo', 'id', 'name', 'place_type']".
1367
+
1368
+ Returns:
1369
+ dict[str, Any]: The request has succeeded.
1370
+
1371
+ Raises:
1372
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
1373
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
1374
+
1375
+ Tags:
1376
+ Tweets
1377
+ """
1378
+ if id is None:
1379
+ raise ValueError("Missing required parameter 'id'.")
1380
+ url = f"{self.main_app_client.base_url}/2/users/{id}/tweets"
1381
+ query_params = {
1382
+ k: v
1383
+ for k, v in [
1384
+ ("since_id", since_id),
1385
+ ("until_id", until_id),
1386
+ ("max_results", max_results),
1387
+ ("pagination_token", pagination_token),
1388
+ ("exclude", exclude),
1389
+ ("start_time", start_time),
1390
+ ("end_time", end_time),
1391
+ ("tweet.fields", tweet_fields),
1392
+ ("expansions", expansions),
1393
+ ("media.fields", media_fields),
1394
+ ("poll.fields", poll_fields),
1395
+ ("user.fields", user_fields),
1396
+ ("place.fields", place_fields),
1397
+ ]
1398
+ if v is not None
1399
+ }
1400
+ response = self._get(url, params=query_params)
1401
+ response.raise_for_status()
1402
+ return response.json()
1403
+
1404
+ def users_id_unfollow(self, source_user_id, target_user_id) -> dict[str, Any]:
1405
+ """
1406
+
1407
+ Unfollows a target user by deleting the follow relationship between the source user and the target user using the "DELETE" method.
1408
+
1409
+ Args:
1410
+ source_user_id (string): source_user_id
1411
+ target_user_id (string): target_user_id
1412
+
1413
+ Returns:
1414
+ dict[str, Any]: The request has succeeded.
1415
+
1416
+ Raises:
1417
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
1418
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
1419
+
1420
+ Tags:
1421
+ Users
1422
+ """
1423
+ if source_user_id is None:
1424
+ raise ValueError("Missing required parameter 'source_user_id'.")
1425
+ if target_user_id is None:
1426
+ raise ValueError("Missing required parameter 'target_user_id'.")
1427
+ url = f"{self.main_app_client.base_url}/2/users/{source_user_id}/following/{target_user_id}"
1428
+ query_params = {}
1429
+ response = self._delete(url, params=query_params)
1430
+ response.raise_for_status()
1431
+ return response.json()
1432
+
1433
+ def users_id_unmute(self, source_user_id, target_user_id) -> dict[str, Any]:
1434
+ """
1435
+
1436
+ Unmutes a target user using the "DELETE" method on the "/2/users/{source_user_id}/muting/{target_user_id}" path, reversing the mute action applied by the source user to the target user.
1437
+
1438
+ Args:
1439
+ source_user_id (string): source_user_id
1440
+ target_user_id (string): target_user_id
1441
+
1442
+ Returns:
1443
+ dict[str, Any]: The request has succeeded.
1444
+
1445
+ Raises:
1446
+ HTTPError: Raised when the API request fails (e.g., non-2XX status code).
1447
+ JSONDecodeError: Raised if the response body cannot be parsed as JSON.
1448
+
1449
+ Tags:
1450
+ Users
1451
+ """
1452
+ if source_user_id is None:
1453
+ raise ValueError("Missing required parameter 'source_user_id'.")
1454
+ if target_user_id is None:
1455
+ raise ValueError("Missing required parameter 'target_user_id'.")
1456
+ url = f"{self.main_app_client.base_url}/2/users/{source_user_id}/muting/{target_user_id}"
1457
+ query_params = {}
1458
+ response = self._delete(url, params=query_params)
1459
+ response.raise_for_status()
1460
+ return response.json()
1461
+
1462
+ def list_tools(self):
1463
+ return [
1464
+ self.find_users_by_id,
1465
+ self.find_users_by_username,
1466
+ self.find_user_by_username,
1467
+ self.get_users_compliance_stream,
1468
+ self.find_my_user,
1469
+ self.search_user_by_query,
1470
+ self.find_user_by_id,
1471
+ self.users_id_blocking,
1472
+ self.get_users_id_bookmarks,
1473
+ self.post_users_id_bookmarks,
1474
+ self.users_id_bookmarks_delete,
1475
+ self.user_followed_lists,
1476
+ self.list_user_follow,
1477
+ self.list_user_unfollow,
1478
+ self.users_id_followers,
1479
+ self.users_id_following,
1480
+ self.users_id_follow,
1481
+ self.users_id_liked_tweets,
1482
+ self.users_id_like,
1483
+ self.users_id_unlike,
1484
+ self.get_user_list_memberships,
1485
+ self.users_id_mentions,
1486
+ self.users_id_muting,
1487
+ self.users_id_mute,
1488
+ self.list_user_owned_lists,
1489
+ self.list_user_pinned_lists,
1490
+ self.list_user_pin,
1491
+ self.list_user_unpin,
1492
+ self.users_id_retweets,
1493
+ self.users_id_unretweets,
1494
+ self.users_id_timeline,
1495
+ self.users_id_tweets,
1496
+ self.users_id_unfollow,
1497
+ self.users_id_unmute,
1498
+ ]