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.
- universal_mcp/applications/ahrefs/README.md +51 -0
- universal_mcp/applications/ahrefs/__init__.py +1 -0
- universal_mcp/applications/ahrefs/app.py +2291 -0
- universal_mcp/applications/airtable/README.md +22 -0
- universal_mcp/applications/airtable/__init__.py +1 -0
- universal_mcp/applications/airtable/app.py +479 -0
- universal_mcp/applications/apollo/README.md +44 -0
- universal_mcp/applications/apollo/__init__.py +1 -0
- universal_mcp/applications/apollo/app.py +1847 -0
- universal_mcp/applications/asana/README.md +199 -0
- universal_mcp/applications/asana/__init__.py +1 -0
- universal_mcp/applications/asana/app.py +9509 -0
- universal_mcp/applications/aws-s3/README.md +0 -0
- universal_mcp/applications/aws-s3/__init__.py +1 -0
- universal_mcp/applications/aws-s3/app.py +552 -0
- universal_mcp/applications/bill/README.md +0 -0
- universal_mcp/applications/bill/__init__.py +1 -0
- universal_mcp/applications/bill/app.py +8705 -0
- universal_mcp/applications/box/README.md +307 -0
- universal_mcp/applications/box/__init__.py +1 -0
- universal_mcp/applications/box/app.py +15987 -0
- universal_mcp/applications/braze/README.md +106 -0
- universal_mcp/applications/braze/__init__.py +1 -0
- universal_mcp/applications/braze/app.py +4754 -0
- universal_mcp/applications/cal-com-v2/README.md +150 -0
- universal_mcp/applications/cal-com-v2/__init__.py +1 -0
- universal_mcp/applications/cal-com-v2/app.py +5541 -0
- universal_mcp/applications/calendly/README.md +53 -0
- universal_mcp/applications/calendly/__init__.py +1 -0
- universal_mcp/applications/calendly/app.py +1436 -0
- universal_mcp/applications/canva/README.md +43 -0
- universal_mcp/applications/canva/__init__.py +1 -0
- universal_mcp/applications/canva/app.py +941 -0
- universal_mcp/applications/clickup/README.md +135 -0
- universal_mcp/applications/clickup/__init__.py +1 -0
- universal_mcp/applications/clickup/app.py +5009 -0
- universal_mcp/applications/coda/README.md +108 -0
- universal_mcp/applications/coda/__init__.py +1 -0
- universal_mcp/applications/coda/app.py +3671 -0
- universal_mcp/applications/confluence/README.md +198 -0
- universal_mcp/applications/confluence/__init__.py +1 -0
- universal_mcp/applications/confluence/app.py +6273 -0
- universal_mcp/applications/contentful/README.md +17 -0
- universal_mcp/applications/contentful/__init__.py +1 -0
- universal_mcp/applications/contentful/app.py +364 -0
- universal_mcp/applications/crustdata/README.md +25 -0
- universal_mcp/applications/crustdata/__init__.py +1 -0
- universal_mcp/applications/crustdata/app.py +586 -0
- universal_mcp/applications/dialpad/README.md +202 -0
- universal_mcp/applications/dialpad/__init__.py +1 -0
- universal_mcp/applications/dialpad/app.py +5949 -0
- universal_mcp/applications/digitalocean/README.md +463 -0
- universal_mcp/applications/digitalocean/__init__.py +1 -0
- universal_mcp/applications/digitalocean/app.py +20835 -0
- universal_mcp/applications/domain-checker/README.md +13 -0
- universal_mcp/applications/domain-checker/__init__.py +1 -0
- universal_mcp/applications/domain-checker/app.py +265 -0
- universal_mcp/applications/e2b/README.md +12 -0
- universal_mcp/applications/e2b/__init__.py +1 -0
- universal_mcp/applications/e2b/app.py +187 -0
- universal_mcp/applications/elevenlabs/README.md +88 -0
- universal_mcp/applications/elevenlabs/__init__.py +1 -0
- universal_mcp/applications/elevenlabs/app.py +3235 -0
- universal_mcp/applications/exa/README.md +15 -0
- universal_mcp/applications/exa/__init__.py +1 -0
- universal_mcp/applications/exa/app.py +221 -0
- universal_mcp/applications/falai/README.md +17 -0
- universal_mcp/applications/falai/__init__.py +1 -0
- universal_mcp/applications/falai/app.py +331 -0
- universal_mcp/applications/figma/README.md +49 -0
- universal_mcp/applications/figma/__init__.py +1 -0
- universal_mcp/applications/figma/app.py +1090 -0
- universal_mcp/applications/firecrawl/README.md +20 -0
- universal_mcp/applications/firecrawl/__init__.py +1 -0
- universal_mcp/applications/firecrawl/app.py +514 -0
- universal_mcp/applications/fireflies/README.md +25 -0
- universal_mcp/applications/fireflies/__init__.py +1 -0
- universal_mcp/applications/fireflies/app.py +506 -0
- universal_mcp/applications/fpl/README.md +23 -0
- universal_mcp/applications/fpl/__init__.py +1 -0
- universal_mcp/applications/fpl/app.py +1327 -0
- universal_mcp/applications/fpl/utils/api.py +142 -0
- universal_mcp/applications/fpl/utils/fixtures.py +629 -0
- universal_mcp/applications/fpl/utils/helper.py +982 -0
- universal_mcp/applications/fpl/utils/league_utils.py +546 -0
- universal_mcp/applications/fpl/utils/position_utils.py +68 -0
- universal_mcp/applications/ghost-content/README.md +25 -0
- universal_mcp/applications/ghost-content/__init__.py +1 -0
- universal_mcp/applications/ghost-content/app.py +654 -0
- universal_mcp/applications/github/README.md +1049 -0
- universal_mcp/applications/github/__init__.py +1 -0
- universal_mcp/applications/github/app.py +50600 -0
- universal_mcp/applications/gong/README.md +63 -0
- universal_mcp/applications/gong/__init__.py +1 -0
- universal_mcp/applications/gong/app.py +2297 -0
- universal_mcp/applications/google-ads/README.md +0 -0
- universal_mcp/applications/google-ads/__init__.py +1 -0
- universal_mcp/applications/google-ads/app.py +23 -0
- universal_mcp/applications/google-calendar/README.md +21 -0
- universal_mcp/applications/google-calendar/__init__.py +1 -0
- universal_mcp/applications/google-calendar/app.py +574 -0
- universal_mcp/applications/google-docs/README.md +25 -0
- universal_mcp/applications/google-docs/__init__.py +1 -0
- universal_mcp/applications/google-docs/app.py +760 -0
- universal_mcp/applications/google-drive/README.md +68 -0
- universal_mcp/applications/google-drive/__init__.py +1 -0
- universal_mcp/applications/google-drive/app.py +4936 -0
- universal_mcp/applications/google-gemini/README.md +25 -0
- universal_mcp/applications/google-gemini/__init__.py +1 -0
- universal_mcp/applications/google-gemini/app.py +663 -0
- universal_mcp/applications/google-mail/README.md +31 -0
- universal_mcp/applications/google-mail/__init__.py +1 -0
- universal_mcp/applications/google-mail/app.py +1354 -0
- universal_mcp/applications/google-searchconsole/README.md +21 -0
- universal_mcp/applications/google-searchconsole/__init__.py +1 -0
- universal_mcp/applications/google-searchconsole/app.py +320 -0
- universal_mcp/applications/google-sheet/README.md +36 -0
- universal_mcp/applications/google-sheet/__init__.py +1 -0
- universal_mcp/applications/google-sheet/app.py +1941 -0
- universal_mcp/applications/hashnode/README.md +20 -0
- universal_mcp/applications/hashnode/__init__.py +1 -0
- universal_mcp/applications/hashnode/app.py +455 -0
- universal_mcp/applications/heygen/README.md +44 -0
- universal_mcp/applications/heygen/__init__.py +1 -0
- universal_mcp/applications/heygen/app.py +961 -0
- universal_mcp/applications/http-tools/README.md +16 -0
- universal_mcp/applications/http-tools/__init__.py +1 -0
- universal_mcp/applications/http-tools/app.py +153 -0
- universal_mcp/applications/hubspot/README.md +239 -0
- universal_mcp/applications/hubspot/__init__.py +1 -0
- universal_mcp/applications/hubspot/app.py +416 -0
- universal_mcp/applications/jira/README.md +600 -0
- universal_mcp/applications/jira/__init__.py +1 -0
- universal_mcp/applications/jira/app.py +28804 -0
- universal_mcp/applications/klaviyo/README.md +313 -0
- universal_mcp/applications/klaviyo/__init__.py +1 -0
- universal_mcp/applications/klaviyo/app.py +11236 -0
- universal_mcp/applications/linkedin/README.md +15 -0
- universal_mcp/applications/linkedin/__init__.py +1 -0
- universal_mcp/applications/linkedin/app.py +243 -0
- universal_mcp/applications/mailchimp/README.md +281 -0
- universal_mcp/applications/mailchimp/__init__.py +1 -0
- universal_mcp/applications/mailchimp/app.py +10937 -0
- universal_mcp/applications/markitdown/README.md +12 -0
- universal_mcp/applications/markitdown/__init__.py +1 -0
- universal_mcp/applications/markitdown/app.py +63 -0
- universal_mcp/applications/miro/README.md +151 -0
- universal_mcp/applications/miro/__init__.py +1 -0
- universal_mcp/applications/miro/app.py +5429 -0
- universal_mcp/applications/ms-teams/README.md +42 -0
- universal_mcp/applications/ms-teams/__init__.py +1 -0
- universal_mcp/applications/ms-teams/app.py +1823 -0
- universal_mcp/applications/neon/README.md +74 -0
- universal_mcp/applications/neon/__init__.py +1 -0
- universal_mcp/applications/neon/app.py +2018 -0
- universal_mcp/applications/notion/README.md +30 -0
- universal_mcp/applications/notion/__init__.py +1 -0
- universal_mcp/applications/notion/app.py +527 -0
- universal_mcp/applications/openai/README.md +22 -0
- universal_mcp/applications/openai/__init__.py +1 -0
- universal_mcp/applications/openai/app.py +759 -0
- universal_mcp/applications/outlook/README.md +20 -0
- universal_mcp/applications/outlook/__init__.py +1 -0
- universal_mcp/applications/outlook/app.py +444 -0
- universal_mcp/applications/perplexity/README.md +12 -0
- universal_mcp/applications/perplexity/__init__.py +1 -0
- universal_mcp/applications/perplexity/app.py +65 -0
- universal_mcp/applications/pipedrive/README.md +284 -0
- universal_mcp/applications/pipedrive/__init__.py +1 -0
- universal_mcp/applications/pipedrive/app.py +12924 -0
- universal_mcp/applications/posthog/README.md +132 -0
- universal_mcp/applications/posthog/__init__.py +1 -0
- universal_mcp/applications/posthog/app.py +7125 -0
- universal_mcp/applications/reddit/README.md +135 -0
- universal_mcp/applications/reddit/__init__.py +1 -0
- universal_mcp/applications/reddit/app.py +4652 -0
- universal_mcp/applications/replicate/README.md +18 -0
- universal_mcp/applications/replicate/__init__.py +1 -0
- universal_mcp/applications/replicate/app.py +495 -0
- universal_mcp/applications/resend/README.md +40 -0
- universal_mcp/applications/resend/__init__.py +1 -0
- universal_mcp/applications/resend/app.py +881 -0
- universal_mcp/applications/retell/README.md +21 -0
- universal_mcp/applications/retell/__init__.py +1 -0
- universal_mcp/applications/retell/app.py +333 -0
- universal_mcp/applications/rocketlane/README.md +70 -0
- universal_mcp/applications/rocketlane/__init__.py +1 -0
- universal_mcp/applications/rocketlane/app.py +4346 -0
- universal_mcp/applications/semanticscholar/README.md +25 -0
- universal_mcp/applications/semanticscholar/__init__.py +1 -0
- universal_mcp/applications/semanticscholar/app.py +482 -0
- universal_mcp/applications/semrush/README.md +44 -0
- universal_mcp/applications/semrush/__init__.py +1 -0
- universal_mcp/applications/semrush/app.py +2081 -0
- universal_mcp/applications/sendgrid/README.md +362 -0
- universal_mcp/applications/sendgrid/__init__.py +1 -0
- universal_mcp/applications/sendgrid/app.py +9752 -0
- universal_mcp/applications/sentry/README.md +186 -0
- universal_mcp/applications/sentry/__init__.py +1 -0
- universal_mcp/applications/sentry/app.py +7471 -0
- universal_mcp/applications/serpapi/README.md +14 -0
- universal_mcp/applications/serpapi/__init__.py +1 -0
- universal_mcp/applications/serpapi/app.py +293 -0
- universal_mcp/applications/sharepoint/README.md +0 -0
- universal_mcp/applications/sharepoint/__init__.py +1 -0
- universal_mcp/applications/sharepoint/app.py +215 -0
- universal_mcp/applications/shopify/README.md +321 -0
- universal_mcp/applications/shopify/__init__.py +1 -0
- universal_mcp/applications/shopify/app.py +15392 -0
- universal_mcp/applications/shortcut/README.md +128 -0
- universal_mcp/applications/shortcut/__init__.py +1 -0
- universal_mcp/applications/shortcut/app.py +4478 -0
- universal_mcp/applications/slack/README.md +0 -0
- universal_mcp/applications/slack/__init__.py +1 -0
- universal_mcp/applications/slack/app.py +570 -0
- universal_mcp/applications/spotify/README.md +91 -0
- universal_mcp/applications/spotify/__init__.py +1 -0
- universal_mcp/applications/spotify/app.py +2526 -0
- universal_mcp/applications/supabase/README.md +87 -0
- universal_mcp/applications/supabase/__init__.py +1 -0
- universal_mcp/applications/supabase/app.py +2970 -0
- universal_mcp/applications/tavily/README.md +12 -0
- universal_mcp/applications/tavily/__init__.py +1 -0
- universal_mcp/applications/tavily/app.py +51 -0
- universal_mcp/applications/trello/README.md +266 -0
- universal_mcp/applications/trello/__init__.py +1 -0
- universal_mcp/applications/trello/app.py +10875 -0
- universal_mcp/applications/twillo/README.md +0 -0
- universal_mcp/applications/twillo/__init__.py +1 -0
- universal_mcp/applications/twillo/app.py +269 -0
- universal_mcp/applications/twitter/README.md +100 -0
- universal_mcp/applications/twitter/__init__.py +1 -0
- universal_mcp/applications/twitter/api_segments/__init__.py +0 -0
- universal_mcp/applications/twitter/api_segments/api_segment_base.py +51 -0
- universal_mcp/applications/twitter/api_segments/compliance_api.py +122 -0
- universal_mcp/applications/twitter/api_segments/dm_conversations_api.py +255 -0
- universal_mcp/applications/twitter/api_segments/dm_events_api.py +140 -0
- universal_mcp/applications/twitter/api_segments/likes_api.py +159 -0
- universal_mcp/applications/twitter/api_segments/lists_api.py +395 -0
- universal_mcp/applications/twitter/api_segments/openapi_json_api.py +34 -0
- universal_mcp/applications/twitter/api_segments/spaces_api.py +309 -0
- universal_mcp/applications/twitter/api_segments/trends_api.py +40 -0
- universal_mcp/applications/twitter/api_segments/tweets_api.py +1403 -0
- universal_mcp/applications/twitter/api_segments/usage_api.py +40 -0
- universal_mcp/applications/twitter/api_segments/users_api.py +1498 -0
- universal_mcp/applications/twitter/app.py +46 -0
- universal_mcp/applications/unipile/README.md +28 -0
- universal_mcp/applications/unipile/__init__.py +1 -0
- universal_mcp/applications/unipile/app.py +829 -0
- universal_mcp/applications/whatsapp/README.md +23 -0
- universal_mcp/applications/whatsapp/__init__.py +1 -0
- universal_mcp/applications/whatsapp/app.py +595 -0
- universal_mcp/applications/whatsapp-business/README.md +34 -0
- universal_mcp/applications/whatsapp-business/__init__.py +1 -0
- universal_mcp/applications/whatsapp-business/app.py +1065 -0
- universal_mcp/applications/wrike/README.md +46 -0
- universal_mcp/applications/wrike/__init__.py +1 -0
- universal_mcp/applications/wrike/app.py +1583 -0
- universal_mcp/applications/youtube/README.md +57 -0
- universal_mcp/applications/youtube/__init__.py +1 -0
- universal_mcp/applications/youtube/app.py +1696 -0
- universal_mcp/applications/zenquotes/README.md +12 -0
- universal_mcp/applications/zenquotes/__init__.py +1 -0
- universal_mcp/applications/zenquotes/app.py +31 -0
- universal_mcp_applications-0.1.1.dist-info/METADATA +172 -0
- universal_mcp_applications-0.1.1.dist-info/RECORD +268 -0
- universal_mcp_applications-0.1.1.dist-info/WHEEL +4 -0
- universal_mcp_applications-0.1.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from .api_segment_base import APISegmentBase
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ListsApi(APISegmentBase):
|
|
7
|
+
def __init__(self, main_app_client: Any):
|
|
8
|
+
super().__init__(main_app_client)
|
|
9
|
+
|
|
10
|
+
def list_id_create(
|
|
11
|
+
self, description=None, name=None, private=None
|
|
12
|
+
) -> dict[str, Any]:
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
Creates a new Twitter list using the X API v2 and returns the newly created list's details.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
description (string): description
|
|
19
|
+
name (string): name
|
|
20
|
+
private (boolean): private
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
dict[str, Any]: The request has succeeded.
|
|
24
|
+
|
|
25
|
+
Raises:
|
|
26
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
27
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
28
|
+
|
|
29
|
+
Tags:
|
|
30
|
+
Lists
|
|
31
|
+
"""
|
|
32
|
+
request_body_data = None
|
|
33
|
+
request_body_data = {
|
|
34
|
+
"description": description,
|
|
35
|
+
"name": name,
|
|
36
|
+
"private": private,
|
|
37
|
+
}
|
|
38
|
+
request_body_data = {
|
|
39
|
+
k: v for k, v in request_body_data.items() if v is not None
|
|
40
|
+
}
|
|
41
|
+
url = f"{self.main_app_client.base_url}/2/lists"
|
|
42
|
+
query_params = {}
|
|
43
|
+
response = self._post(
|
|
44
|
+
url,
|
|
45
|
+
data=request_body_data,
|
|
46
|
+
params=query_params,
|
|
47
|
+
content_type="application/json",
|
|
48
|
+
)
|
|
49
|
+
response.raise_for_status()
|
|
50
|
+
return response.json()
|
|
51
|
+
|
|
52
|
+
def list_id_delete(self, id) -> dict[str, Any]:
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
Deletes a list specified by its ID using the DELETE method.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
id (string): id
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
dict[str, Any]: The request has succeeded.
|
|
62
|
+
|
|
63
|
+
Raises:
|
|
64
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
65
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
66
|
+
|
|
67
|
+
Tags:
|
|
68
|
+
Lists
|
|
69
|
+
"""
|
|
70
|
+
if id is None:
|
|
71
|
+
raise ValueError("Missing required parameter 'id'.")
|
|
72
|
+
url = f"{self.main_app_client.base_url}/2/lists/{id}"
|
|
73
|
+
query_params = {}
|
|
74
|
+
response = self._delete(url, params=query_params)
|
|
75
|
+
response.raise_for_status()
|
|
76
|
+
return response.json()
|
|
77
|
+
|
|
78
|
+
def list_id_get(
|
|
79
|
+
self, id, list_fields=None, expansions=None, user_fields=None
|
|
80
|
+
) -> dict[str, Any]:
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
Retrieves detailed information about a specific Twitter List by its unique identifier, including optional expansions and fields for lists and users.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
id (string): id
|
|
87
|
+
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']".
|
|
88
|
+
expansions (array): A comma separated list of fields to expand. Example: "['owner_id']".
|
|
89
|
+
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']".
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
dict[str, Any]: The request has succeeded.
|
|
93
|
+
|
|
94
|
+
Raises:
|
|
95
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
96
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
97
|
+
|
|
98
|
+
Tags:
|
|
99
|
+
Lists
|
|
100
|
+
"""
|
|
101
|
+
if id is None:
|
|
102
|
+
raise ValueError("Missing required parameter 'id'.")
|
|
103
|
+
url = f"{self.main_app_client.base_url}/2/lists/{id}"
|
|
104
|
+
query_params = {
|
|
105
|
+
k: v
|
|
106
|
+
for k, v in [
|
|
107
|
+
("list.fields", list_fields),
|
|
108
|
+
("expansions", expansions),
|
|
109
|
+
("user.fields", user_fields),
|
|
110
|
+
]
|
|
111
|
+
if v is not None
|
|
112
|
+
}
|
|
113
|
+
response = self._get(url, params=query_params)
|
|
114
|
+
response.raise_for_status()
|
|
115
|
+
return response.json()
|
|
116
|
+
|
|
117
|
+
def list_id_update(
|
|
118
|
+
self, id, description=None, name=None, private=None
|
|
119
|
+
) -> dict[str, Any]:
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
Updates a list specified by the ID using the provided JSON payload, authenticating with OAuth2 or user tokens.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
id (string): id
|
|
126
|
+
description (string): description
|
|
127
|
+
name (string): name
|
|
128
|
+
private (boolean): private
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
dict[str, Any]: The request has succeeded.
|
|
132
|
+
|
|
133
|
+
Raises:
|
|
134
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
135
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
136
|
+
|
|
137
|
+
Tags:
|
|
138
|
+
Lists
|
|
139
|
+
"""
|
|
140
|
+
if id is None:
|
|
141
|
+
raise ValueError("Missing required parameter 'id'.")
|
|
142
|
+
request_body_data = None
|
|
143
|
+
request_body_data = {
|
|
144
|
+
"description": description,
|
|
145
|
+
"name": name,
|
|
146
|
+
"private": private,
|
|
147
|
+
}
|
|
148
|
+
request_body_data = {
|
|
149
|
+
k: v for k, v in request_body_data.items() if v is not None
|
|
150
|
+
}
|
|
151
|
+
url = f"{self.main_app_client.base_url}/2/lists/{id}"
|
|
152
|
+
query_params = {}
|
|
153
|
+
response = self._put(
|
|
154
|
+
url,
|
|
155
|
+
data=request_body_data,
|
|
156
|
+
params=query_params,
|
|
157
|
+
content_type="application/json",
|
|
158
|
+
)
|
|
159
|
+
response.raise_for_status()
|
|
160
|
+
return response.json()
|
|
161
|
+
|
|
162
|
+
def list_get_followers(
|
|
163
|
+
self,
|
|
164
|
+
id,
|
|
165
|
+
max_results=None,
|
|
166
|
+
pagination_token=None,
|
|
167
|
+
user_fields=None,
|
|
168
|
+
expansions=None,
|
|
169
|
+
tweet_fields=None,
|
|
170
|
+
) -> dict[str, Any]:
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
Retrieves a list of users who follow a specified Twitter list using the list ID, with optional parameters for pagination and user data customization.
|
|
174
|
+
|
|
175
|
+
Args:
|
|
176
|
+
id (string): id
|
|
177
|
+
max_results (integer): Specifies the maximum number of follower results to return, with a default value of 100.
|
|
178
|
+
pagination_token (string): The pagination_token query parameter is an optional cursor used to retrieve the next page of results when paginating through the followers of a list.
|
|
179
|
+
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']".
|
|
180
|
+
expansions (array): A comma separated list of fields to expand. Example: "['affiliation.user_id', 'most_recent_tweet_id', 'pinned_tweet_id']".
|
|
181
|
+
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']".
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
dict[str, Any]: The request has succeeded.
|
|
185
|
+
|
|
186
|
+
Raises:
|
|
187
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
188
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
189
|
+
|
|
190
|
+
Tags:
|
|
191
|
+
Users
|
|
192
|
+
"""
|
|
193
|
+
if id is None:
|
|
194
|
+
raise ValueError("Missing required parameter 'id'.")
|
|
195
|
+
url = f"{self.main_app_client.base_url}/2/lists/{id}/followers"
|
|
196
|
+
query_params = {
|
|
197
|
+
k: v
|
|
198
|
+
for k, v in [
|
|
199
|
+
("max_results", max_results),
|
|
200
|
+
("pagination_token", pagination_token),
|
|
201
|
+
("user.fields", user_fields),
|
|
202
|
+
("expansions", expansions),
|
|
203
|
+
("tweet.fields", tweet_fields),
|
|
204
|
+
]
|
|
205
|
+
if v is not None
|
|
206
|
+
}
|
|
207
|
+
response = self._get(url, params=query_params)
|
|
208
|
+
response.raise_for_status()
|
|
209
|
+
return response.json()
|
|
210
|
+
|
|
211
|
+
def list_get_members(
|
|
212
|
+
self,
|
|
213
|
+
id,
|
|
214
|
+
max_results=None,
|
|
215
|
+
pagination_token=None,
|
|
216
|
+
user_fields=None,
|
|
217
|
+
expansions=None,
|
|
218
|
+
tweet_fields=None,
|
|
219
|
+
) -> dict[str, Any]:
|
|
220
|
+
"""
|
|
221
|
+
|
|
222
|
+
Retrieves a list of User objects that are members of a specified Twitter List by the provided List ID.
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
id (string): id
|
|
226
|
+
max_results (integer): The maximum number of list members to return per page, defaulting to 100.
|
|
227
|
+
pagination_token (string): Optional token used for cursor-based pagination, allowing retrieval of the next subset of members in the list.
|
|
228
|
+
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']".
|
|
229
|
+
expansions (array): A comma separated list of fields to expand. Example: "['affiliation.user_id', 'most_recent_tweet_id', 'pinned_tweet_id']".
|
|
230
|
+
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']".
|
|
231
|
+
|
|
232
|
+
Returns:
|
|
233
|
+
dict[str, Any]: The request has succeeded.
|
|
234
|
+
|
|
235
|
+
Raises:
|
|
236
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
237
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
238
|
+
|
|
239
|
+
Tags:
|
|
240
|
+
Users
|
|
241
|
+
"""
|
|
242
|
+
if id is None:
|
|
243
|
+
raise ValueError("Missing required parameter 'id'.")
|
|
244
|
+
url = f"{self.main_app_client.base_url}/2/lists/{id}/members"
|
|
245
|
+
query_params = {
|
|
246
|
+
k: v
|
|
247
|
+
for k, v in [
|
|
248
|
+
("max_results", max_results),
|
|
249
|
+
("pagination_token", pagination_token),
|
|
250
|
+
("user.fields", user_fields),
|
|
251
|
+
("expansions", expansions),
|
|
252
|
+
("tweet.fields", tweet_fields),
|
|
253
|
+
]
|
|
254
|
+
if v is not None
|
|
255
|
+
}
|
|
256
|
+
response = self._get(url, params=query_params)
|
|
257
|
+
response.raise_for_status()
|
|
258
|
+
return response.json()
|
|
259
|
+
|
|
260
|
+
def list_add_member(self, id, user_id=None) -> dict[str, Any]:
|
|
261
|
+
"""
|
|
262
|
+
|
|
263
|
+
Adds one or more members to a specified list by list ID using the POST method.
|
|
264
|
+
|
|
265
|
+
Args:
|
|
266
|
+
id (string): id
|
|
267
|
+
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'.
|
|
268
|
+
|
|
269
|
+
Returns:
|
|
270
|
+
dict[str, Any]: The request has succeeded.
|
|
271
|
+
|
|
272
|
+
Raises:
|
|
273
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
274
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
275
|
+
|
|
276
|
+
Tags:
|
|
277
|
+
Lists
|
|
278
|
+
"""
|
|
279
|
+
if id is None:
|
|
280
|
+
raise ValueError("Missing required parameter 'id'.")
|
|
281
|
+
request_body_data = None
|
|
282
|
+
request_body_data = {"user_id": user_id}
|
|
283
|
+
request_body_data = {
|
|
284
|
+
k: v for k, v in request_body_data.items() if v is not None
|
|
285
|
+
}
|
|
286
|
+
url = f"{self.main_app_client.base_url}/2/lists/{id}/members"
|
|
287
|
+
query_params = {}
|
|
288
|
+
response = self._post(
|
|
289
|
+
url,
|
|
290
|
+
data=request_body_data,
|
|
291
|
+
params=query_params,
|
|
292
|
+
content_type="application/json",
|
|
293
|
+
)
|
|
294
|
+
response.raise_for_status()
|
|
295
|
+
return response.json()
|
|
296
|
+
|
|
297
|
+
def list_remove_member(self, id, user_id) -> dict[str, Any]:
|
|
298
|
+
"""
|
|
299
|
+
|
|
300
|
+
Removes a member from a list using the provided list ID and user ID, requiring appropriate permissions for the operation.
|
|
301
|
+
|
|
302
|
+
Args:
|
|
303
|
+
id (string): id
|
|
304
|
+
user_id (string): user_id
|
|
305
|
+
|
|
306
|
+
Returns:
|
|
307
|
+
dict[str, Any]: The request has succeeded.
|
|
308
|
+
|
|
309
|
+
Raises:
|
|
310
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
311
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
312
|
+
|
|
313
|
+
Tags:
|
|
314
|
+
Lists
|
|
315
|
+
"""
|
|
316
|
+
if id is None:
|
|
317
|
+
raise ValueError("Missing required parameter 'id'.")
|
|
318
|
+
if user_id is None:
|
|
319
|
+
raise ValueError("Missing required parameter 'user_id'.")
|
|
320
|
+
url = f"{self.main_app_client.base_url}/2/lists/{id}/members/{user_id}"
|
|
321
|
+
query_params = {}
|
|
322
|
+
response = self._delete(url, params=query_params)
|
|
323
|
+
response.raise_for_status()
|
|
324
|
+
return response.json()
|
|
325
|
+
|
|
326
|
+
def lists_id_tweets(
|
|
327
|
+
self,
|
|
328
|
+
id,
|
|
329
|
+
max_results=None,
|
|
330
|
+
pagination_token=None,
|
|
331
|
+
tweet_fields=None,
|
|
332
|
+
expansions=None,
|
|
333
|
+
media_fields=None,
|
|
334
|
+
poll_fields=None,
|
|
335
|
+
user_fields=None,
|
|
336
|
+
place_fields=None,
|
|
337
|
+
) -> dict[str, Any]:
|
|
338
|
+
"""
|
|
339
|
+
|
|
340
|
+
Retrieves a list of tweets for a specified list by ID using the "GET" method, allowing optional parameters for pagination and field customization.
|
|
341
|
+
|
|
342
|
+
Args:
|
|
343
|
+
id (string): id
|
|
344
|
+
max_results (integer): The maximum number of tweets to return per request, with a default value of 100.
|
|
345
|
+
pagination_token (string): Optional query parameter used to request the next page of results by passing the `next_token` value from the previous response.
|
|
346
|
+
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']".
|
|
347
|
+
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']".
|
|
348
|
+
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']".
|
|
349
|
+
poll_fields (array): A comma separated list of Poll fields to display. Example: "['duration_minutes', 'end_datetime', 'id', 'options', 'voting_status']".
|
|
350
|
+
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']".
|
|
351
|
+
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']".
|
|
352
|
+
|
|
353
|
+
Returns:
|
|
354
|
+
dict[str, Any]: The request has succeeded.
|
|
355
|
+
|
|
356
|
+
Raises:
|
|
357
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
358
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
359
|
+
|
|
360
|
+
Tags:
|
|
361
|
+
Tweets
|
|
362
|
+
"""
|
|
363
|
+
if id is None:
|
|
364
|
+
raise ValueError("Missing required parameter 'id'.")
|
|
365
|
+
url = f"{self.main_app_client.base_url}/2/lists/{id}/tweets"
|
|
366
|
+
query_params = {
|
|
367
|
+
k: v
|
|
368
|
+
for k, v in [
|
|
369
|
+
("max_results", max_results),
|
|
370
|
+
("pagination_token", pagination_token),
|
|
371
|
+
("tweet.fields", tweet_fields),
|
|
372
|
+
("expansions", expansions),
|
|
373
|
+
("media.fields", media_fields),
|
|
374
|
+
("poll.fields", poll_fields),
|
|
375
|
+
("user.fields", user_fields),
|
|
376
|
+
("place.fields", place_fields),
|
|
377
|
+
]
|
|
378
|
+
if v is not None
|
|
379
|
+
}
|
|
380
|
+
response = self._get(url, params=query_params)
|
|
381
|
+
response.raise_for_status()
|
|
382
|
+
return response.json()
|
|
383
|
+
|
|
384
|
+
def list_tools(self):
|
|
385
|
+
return [
|
|
386
|
+
self.list_id_create,
|
|
387
|
+
self.list_id_delete,
|
|
388
|
+
self.list_id_get,
|
|
389
|
+
self.list_id_update,
|
|
390
|
+
self.list_get_followers,
|
|
391
|
+
self.list_get_members,
|
|
392
|
+
self.list_add_member,
|
|
393
|
+
self.list_remove_member,
|
|
394
|
+
self.lists_id_tweets,
|
|
395
|
+
]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from .api_segment_base import APISegmentBase
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class OpenapiJsonApi(APISegmentBase):
|
|
7
|
+
def __init__(self, main_app_client: Any):
|
|
8
|
+
super().__init__(main_app_client)
|
|
9
|
+
|
|
10
|
+
def get_open_api_spec(self) -> dict[str, Any]:
|
|
11
|
+
"""
|
|
12
|
+
Args:
|
|
13
|
+
None
|
|
14
|
+
|
|
15
|
+
Retrieves the OpenAPI JSON file at the specified path "/2/openapi.json" using the GET method.
|
|
16
|
+
|
|
17
|
+
Returns:
|
|
18
|
+
dict[str, Any]: The request was successful
|
|
19
|
+
|
|
20
|
+
Raises:
|
|
21
|
+
HTTPError: Raised when the API request fails (e.g., non-2XX status code).
|
|
22
|
+
JSONDecodeError: Raised if the response body cannot be parsed as JSON.
|
|
23
|
+
|
|
24
|
+
Tags:
|
|
25
|
+
General
|
|
26
|
+
"""
|
|
27
|
+
url = f"{self.main_app_client.base_url}/2/openapi.json"
|
|
28
|
+
query_params = {}
|
|
29
|
+
response = self._get(url, params=query_params)
|
|
30
|
+
response.raise_for_status()
|
|
31
|
+
return response.json()
|
|
32
|
+
|
|
33
|
+
def list_tools(self):
|
|
34
|
+
return [self.get_open_api_spec]
|