universal-mcp-applications 0.1.33__py3-none-any.whl → 0.1.39rc16__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.

Potentially problematic release.


This version of universal-mcp-applications might be problematic. Click here for more details.

Files changed (119) hide show
  1. universal_mcp/applications/BEST_PRACTICES.md +1 -1
  2. universal_mcp/applications/ahrefs/app.py +92 -238
  3. universal_mcp/applications/airtable/app.py +36 -135
  4. universal_mcp/applications/apollo/app.py +124 -477
  5. universal_mcp/applications/asana/app.py +605 -1755
  6. universal_mcp/applications/aws_s3/app.py +63 -119
  7. universal_mcp/applications/bill/app.py +644 -2055
  8. universal_mcp/applications/box/app.py +1246 -4159
  9. universal_mcp/applications/braze/app.py +410 -1476
  10. universal_mcp/applications/browser_use/README.md +15 -1
  11. universal_mcp/applications/browser_use/__init__.py +1 -0
  12. universal_mcp/applications/browser_use/app.py +91 -26
  13. universal_mcp/applications/cal_com_v2/app.py +207 -625
  14. universal_mcp/applications/calendly/app.py +103 -242
  15. universal_mcp/applications/canva/app.py +75 -140
  16. universal_mcp/applications/clickup/app.py +331 -798
  17. universal_mcp/applications/coda/app.py +240 -520
  18. universal_mcp/applications/confluence/app.py +497 -1285
  19. universal_mcp/applications/contentful/app.py +40 -155
  20. universal_mcp/applications/crustdata/app.py +44 -123
  21. universal_mcp/applications/dialpad/app.py +451 -924
  22. universal_mcp/applications/digitalocean/app.py +2071 -6082
  23. universal_mcp/applications/domain_checker/app.py +3 -54
  24. universal_mcp/applications/e2b/app.py +17 -68
  25. universal_mcp/applications/elevenlabs/README.md +27 -3
  26. universal_mcp/applications/elevenlabs/app.py +741 -74
  27. universal_mcp/applications/exa/README.md +8 -4
  28. universal_mcp/applications/exa/app.py +415 -186
  29. universal_mcp/applications/falai/README.md +5 -7
  30. universal_mcp/applications/falai/app.py +156 -232
  31. universal_mcp/applications/figma/app.py +91 -175
  32. universal_mcp/applications/file_system/app.py +2 -13
  33. universal_mcp/applications/firecrawl/app.py +198 -176
  34. universal_mcp/applications/fireflies/app.py +59 -281
  35. universal_mcp/applications/fpl/app.py +92 -529
  36. universal_mcp/applications/fpl/utils/fixtures.py +15 -49
  37. universal_mcp/applications/fpl/utils/helper.py +25 -89
  38. universal_mcp/applications/fpl/utils/league_utils.py +20 -64
  39. universal_mcp/applications/ghost_content/app.py +70 -179
  40. universal_mcp/applications/github/app.py +30 -67
  41. universal_mcp/applications/gong/app.py +142 -302
  42. universal_mcp/applications/google_calendar/app.py +26 -78
  43. universal_mcp/applications/google_docs/README.md +15 -14
  44. universal_mcp/applications/google_docs/app.py +103 -206
  45. universal_mcp/applications/google_drive/app.py +194 -793
  46. universal_mcp/applications/google_gemini/app.py +68 -59
  47. universal_mcp/applications/google_mail/README.md +1 -0
  48. universal_mcp/applications/google_mail/app.py +93 -214
  49. universal_mcp/applications/google_searchconsole/app.py +25 -58
  50. universal_mcp/applications/google_sheet/README.md +2 -1
  51. universal_mcp/applications/google_sheet/app.py +226 -624
  52. universal_mcp/applications/google_sheet/helper.py +26 -53
  53. universal_mcp/applications/hashnode/app.py +57 -269
  54. universal_mcp/applications/heygen/README.md +10 -32
  55. universal_mcp/applications/heygen/app.py +339 -811
  56. universal_mcp/applications/http_tools/app.py +10 -32
  57. universal_mcp/applications/hubspot/README.md +1 -1
  58. universal_mcp/applications/hubspot/app.py +7508 -99
  59. universal_mcp/applications/jira/app.py +2419 -8334
  60. universal_mcp/applications/klaviyo/app.py +739 -1621
  61. universal_mcp/applications/linkedin/README.md +18 -1
  62. universal_mcp/applications/linkedin/app.py +729 -251
  63. universal_mcp/applications/mailchimp/app.py +696 -1851
  64. universal_mcp/applications/markitdown/app.py +8 -20
  65. universal_mcp/applications/miro/app.py +333 -815
  66. universal_mcp/applications/ms_teams/app.py +420 -1407
  67. universal_mcp/applications/neon/app.py +144 -250
  68. universal_mcp/applications/notion/app.py +38 -53
  69. universal_mcp/applications/onedrive/app.py +26 -48
  70. universal_mcp/applications/openai/app.py +43 -166
  71. universal_mcp/applications/outlook/README.md +22 -9
  72. universal_mcp/applications/outlook/app.py +403 -141
  73. universal_mcp/applications/perplexity/README.md +2 -1
  74. universal_mcp/applications/perplexity/app.py +161 -20
  75. universal_mcp/applications/pipedrive/app.py +1021 -3331
  76. universal_mcp/applications/posthog/app.py +272 -541
  77. universal_mcp/applications/reddit/app.py +65 -164
  78. universal_mcp/applications/resend/app.py +72 -139
  79. universal_mcp/applications/retell/app.py +23 -50
  80. universal_mcp/applications/rocketlane/app.py +252 -965
  81. universal_mcp/applications/scraper/app.py +114 -142
  82. universal_mcp/applications/semanticscholar/app.py +36 -78
  83. universal_mcp/applications/semrush/app.py +44 -78
  84. universal_mcp/applications/sendgrid/app.py +826 -1576
  85. universal_mcp/applications/sentry/app.py +444 -1079
  86. universal_mcp/applications/serpapi/app.py +44 -146
  87. universal_mcp/applications/sharepoint/app.py +27 -49
  88. universal_mcp/applications/shopify/app.py +1748 -4486
  89. universal_mcp/applications/shortcut/app.py +275 -536
  90. universal_mcp/applications/slack/app.py +43 -125
  91. universal_mcp/applications/spotify/app.py +206 -405
  92. universal_mcp/applications/supabase/app.py +174 -283
  93. universal_mcp/applications/tavily/app.py +2 -2
  94. universal_mcp/applications/trello/app.py +853 -2816
  95. universal_mcp/applications/twilio/app.py +27 -62
  96. universal_mcp/applications/twitter/api_segments/compliance_api.py +4 -14
  97. universal_mcp/applications/twitter/api_segments/dm_conversations_api.py +6 -18
  98. universal_mcp/applications/twitter/api_segments/likes_api.py +1 -3
  99. universal_mcp/applications/twitter/api_segments/lists_api.py +5 -15
  100. universal_mcp/applications/twitter/api_segments/trends_api.py +1 -3
  101. universal_mcp/applications/twitter/api_segments/tweets_api.py +9 -31
  102. universal_mcp/applications/twitter/api_segments/usage_api.py +1 -5
  103. universal_mcp/applications/twitter/api_segments/users_api.py +14 -42
  104. universal_mcp/applications/whatsapp/app.py +35 -186
  105. universal_mcp/applications/whatsapp/audio.py +2 -6
  106. universal_mcp/applications/whatsapp/whatsapp.py +17 -51
  107. universal_mcp/applications/whatsapp_business/app.py +86 -299
  108. universal_mcp/applications/wrike/app.py +80 -153
  109. universal_mcp/applications/yahoo_finance/app.py +19 -65
  110. universal_mcp/applications/youtube/app.py +120 -306
  111. universal_mcp/applications/zenquotes/app.py +3 -3
  112. {universal_mcp_applications-0.1.33.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/METADATA +4 -2
  113. {universal_mcp_applications-0.1.33.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/RECORD +115 -119
  114. {universal_mcp_applications-0.1.33.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/WHEEL +1 -1
  115. universal_mcp/applications/hubspot/api_segments/__init__.py +0 -0
  116. universal_mcp/applications/hubspot/api_segments/api_segment_base.py +0 -54
  117. universal_mcp/applications/hubspot/api_segments/crm_api.py +0 -7337
  118. universal_mcp/applications/hubspot/api_segments/marketing_api.py +0 -1467
  119. {universal_mcp_applications-0.1.33.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/licenses/LICENSE +0 -0
@@ -1,5 +1,6 @@
1
- from typing import Any
2
-
1
+ from typing import Any, Literal, Optional, Dict, Union
2
+ import httpx
3
+ import logging
3
4
  from universal_mcp.applications.application import APIApplication
4
5
  from universal_mcp.integrations import Integration
5
6
 
@@ -9,102 +10,17 @@ class HeygenApp(APIApplication):
9
10
  super().__init__(name="heygen", integration=integration, **kwargs)
10
11
  self.base_url = "https://api.heygen.com"
11
12
 
12
- def _get_headers(self) -> dict[str, Any]:
13
- credentials = self.integration.get_credentials()
14
- api_key = (
15
- credentials.get("api_key")
16
- or credentials.get("API_KEY")
17
- or credentials.get("apiKey")
18
- )
19
- return {
20
- "x-api-key": f"{api_key}",
21
- "Content-Type": "application/json",
22
- "Accept": "application/json",
23
- }
24
-
25
- def get_v1_voice_list(
26
- self,
27
- ) -> Any:
28
- """
29
- Retrieves the list of available voices from the v1 voice API endpoint.
30
-
31
- Args:
32
- None: This function takes no arguments
33
-
34
- Returns:
35
- dict: A dictionary containing the JSON response with details about the available voices.
36
-
37
- Raises:
38
- HTTPError: If the HTTP request to the voice API endpoint results in an unsuccessful status code.
39
-
40
- Tags:
41
- get, list, voice, api
42
- """
43
- url = f"{self.base_url}/v1/voice.list"
44
- query_params = {}
45
- response = self._get(url, params=query_params)
46
- response.raise_for_status()
47
- return response.json()
48
-
49
- def get_v1_avatar_list(
50
- self,
51
- ) -> Any:
52
- """
53
- Retrieves a list of available avatars from the v1 API endpoint.
54
-
55
- Args:
56
- None: This function takes no arguments
57
-
58
- Returns:
59
- A JSON-decoded object containing the list of avatars returned by the API.
60
-
61
- Raises:
62
- requests.exceptions.HTTPError: If the HTTP request to the avatar list endpoint fails, such as due to a non-2xx response.
63
-
64
- Tags:
65
- get, list, avatar, api, important
66
- """
67
- url = f"{self.base_url}/v1/avatar.list"
68
- query_params = {}
69
- response = self._get(url, params=query_params)
70
- response.raise_for_status()
71
- return response.json()
72
-
73
- def get_v2_voices(
74
- self,
75
- ) -> Any:
76
- """
77
- Retrieves the list of available v2 voices from the API endpoint.
78
-
79
- Args:
80
- None: This function takes no arguments
81
-
82
- Returns:
83
- A JSON-decoded object containing information about available v2 voices.
13
+ async def _aget_headers(self) -> dict[str, Any]:
14
+ # credentials = await self.integration.get_credentials_async()
15
+ api_key = "sk_V2_hgu_kDFhhfTyiu2_7Fhxk5cwM4bwjNZjFH6xKwwguEW5jdkj" # credentials.get("api_key") or credentials.get("API_KEY") or credentials.get("apiKey")
16
+ return {"x-api-key": f"{api_key}", "Content-Type": "application/json", "Accept": "application/json"}
84
17
 
85
- Raises:
86
- requests.HTTPError: If the HTTP request to the voices endpoint returns an unsuccessful status code.
87
-
88
- Tags:
89
- get, list, voices, api, important
90
- """
91
- url = f"{self.base_url}/v2/voices"
92
- query_params = {}
93
- response = self._get(url, params=query_params)
94
- response.raise_for_status()
95
- return response.json()
96
-
97
- def get_v2_avatars(
98
- self,
99
- ) -> Any:
18
+ async def get_v2_avatars(self) -> Any:
100
19
  """
101
20
  Retrieves a list of avatar objects from the /v2/avatars API endpoint.
102
21
 
103
- Args:
104
- None: This function takes no arguments
105
-
106
22
  Returns:
107
- A JSON-decoded object containing the list of avatars as returned by the API.
23
+ A JSON-decoded object containing the paginated list of avatars.
108
24
 
109
25
  Raises:
110
26
  requests.exceptions.HTTPError: If the HTTP request to the /v2/avatars endpoint returns an unsuccessful status code.
@@ -113,849 +29,461 @@ class HeygenApp(APIApplication):
113
29
  get, list, avatars, api
114
30
  """
115
31
  url = f"{self.base_url}/v2/avatars"
116
- query_params = {}
117
- response = self._get(url, params=query_params)
118
- response.raise_for_status()
119
- return response.json()
32
+ response = await self._aget(url=url)
33
+ return self._handle_response(response)
120
34
 
121
- def get_v1_video_list(
122
- self,
123
- ) -> Any:
35
+ async def list_avatar_groups(self, include_public: bool = False) -> Any:
124
36
  """
125
- Retrieves a list of videos from the v1 API endpoint.
37
+ Retrieves a list of avatar groups from the /v2/avatar_group.list API endpoint.
126
38
 
127
39
  Args:
128
- None: This function takes no arguments
40
+ include_public: Whether to include public avatar groups in the response. Defaults to False.
129
41
 
130
42
  Returns:
131
- A JSON-decoded object containing the list of videos as returned by the API.
43
+ A JSON-decoded object containing the list of avatar groups.
132
44
 
133
45
  Raises:
134
- requests.HTTPError: If the HTTP request to the API endpoint fails or returns an unsuccessful status code.
46
+ requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
135
47
 
136
48
  Tags:
137
- get, list, video, api
49
+ list, avatar_groups, api
138
50
  """
139
- url = f"{self.base_url}/v1/video.list"
140
- query_params = {}
141
- response = self._get(url, params=query_params)
142
- response.raise_for_status()
143
- return response.json()
51
+ url = f"{self.base_url}/v2/avatar_group.list"
52
+ params = {"include_public": str(include_public).lower()}
53
+ response = await self._aget(url=url, params=params)
54
+ return self._handle_response(response)
144
55
 
145
- def post_v2_video_generate(
146
- self,
147
- video_inputs,
148
- title=None,
149
- test=None,
150
- callback_id=None,
151
- dimension=None,
152
- aspect_ratio=None,
153
- ) -> Any:
56
+ async def list_avatars_in_group(self, group_id: str) -> Any:
154
57
  """
155
- Submits a request to generate a video using specified input parameters via the v2 video generate API endpoint.
58
+ Retrieves a list of avatars from a specific avatar group.
156
59
 
157
60
  Args:
158
- video_inputs: A required object or list containing the video inputs used for generation. Must not be None.
159
- title: Optional; a string specifying the title of the generated video.
160
- test: Optional; a flag or parameter used for testing purposes. Its type and effect depend on the API implementation.
161
- callback_id: Optional; a string or identifier for callback tracking after video generation.
162
- dimension: Optional; defines the desired dimensions for the generated video.
163
- aspect_ratio: Optional; defines the desired aspect ratio for the generated video.
61
+ group_id: The unique identifier of the avatar group.
164
62
 
165
63
  Returns:
166
- A dictionary containing the API response parsed from JSON, typically including information about the video generation job.
64
+ A JSON-decoded object containing the list of avatars in the group.
167
65
 
168
66
  Raises:
169
- ValueError: Raised if 'video_inputs' is None.
170
- requests.HTTPError: Raised if the HTTP request to the video generation endpoint fails (e.g., non-2xx response).
67
+ requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
171
68
 
172
69
  Tags:
173
- create, video, generate, api, async-job
70
+ list, avatars, avatar_group, api
174
71
  """
175
- if video_inputs is None:
176
- raise ValueError("Missing required parameter 'video_inputs'")
177
- request_body = {
178
- "title": title,
179
- "video_inputs": video_inputs,
180
- "test": test,
181
- "callback_id": callback_id,
182
- "dimension": dimension,
183
- "aspect_ratio": aspect_ratio,
184
- }
185
- request_body = {k: v for k, v in request_body.items() if v is not None}
186
- url = f"{self.base_url}/v2/video/generate"
187
- query_params = {}
188
- response = self._post(url, data=request_body, params=query_params)
189
- response.raise_for_status()
190
- return response.json()
72
+ url = f"{self.base_url}/v2/avatar_group/{group_id}/avatars"
73
+ response = await self._aget(url=url)
74
+ return self._handle_response(response)
191
75
 
192
- def delete_v1_video(self, video_id=None) -> Any:
76
+ async def get_avatar_details(self, avatar_id: str) -> Any:
193
77
  """
194
- Deletes a video using the v1 API endpoint with the specified video ID.
78
+ Retrieves detailed information about a specific avatar by its ID.
195
79
 
196
80
  Args:
197
- video_id: Optional; The unique identifier of the video to delete. If None, no video is specified in the request.
81
+ avatar_id: The unique identifier of the avatar.
198
82
 
199
83
  Returns:
200
- Parsed JSON response from the API indicating the result of the delete operation.
84
+ A JSON-decoded object containing the avatar details.
201
85
 
202
86
  Raises:
203
- requests.HTTPError: If the HTTP request fails or the server returns an error response.
87
+ requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
204
88
 
205
89
  Tags:
206
- delete, video, api, v1, management
90
+ get, avatar, details, api
207
91
  """
208
- url = f"{self.base_url}/v1/video.delete"
209
- query_params = {k: v for k, v in [("video_id", video_id)] if v is not None}
210
- response = self._delete(url, params=query_params)
211
- response.raise_for_status()
212
- return response.json()
92
+ url = f"{self.base_url}/v2/avatar/{avatar_id}/details"
93
+ response = await self._aget(url=url)
94
+ return self._handle_response(response)
213
95
 
214
- def get_v2_templates(
96
+
97
+ async def create_avatar_video(
215
98
  self,
99
+ # --- Character ---
100
+ avatar_id: str = None,
101
+ talking_photo_id: str = None,
102
+ avatar_style: str = "normal",
103
+ talking_style: str = "stable",
104
+ talking_photo_style: str = "circle",
105
+
106
+ # --- Voice ---
107
+ input_text: str = None,
108
+ voice_id: str = None,
109
+ voice_type: Literal["text", "audio", "silence"] = "text",
110
+ silence_duration: float = 1,
111
+ voice_speed: float = 1.0,
112
+ voice_pitch: int = 0,
113
+ voice_emotion: Optional[Literal["Excited", "Friendly", "Serious", "Soothing", "Broadcaster"]] = None,
114
+ audio_asset_id: str = None,
115
+ audio_url: str = None,
116
+
117
+ # --- Background ---
118
+ background_type: Literal["color", "image", "video"] = "color",
119
+ background_value: str = "#008000",
120
+ background_play_style: Literal["freeze", "loop", "fit_to_scene", "once"] = "freeze",
121
+ background_fit: Literal["crop", "cover", "contain", "none"] = "cover",
122
+ background_url: str = None,
123
+ background_image_asset_id: str = None,
124
+ background_video_asset_id: str = None,
125
+
126
+ # --- Text Overlay ---
127
+ overlay_text: str = None,
128
+ overlay_font_size: float = None,
129
+ overlay_font_weight: Optional[Literal["bold"]] = None,
130
+ overlay_color: str = None,
131
+ overlay_position: Dict[str, Any] = None,
132
+ overlay_text_align: Optional[Literal["left", "center", "right"]] = None,
133
+ line_height: float = 1.0,
134
+
135
+ # --- Top Level ---
136
+ title: str = None,
137
+ caption: bool = False,
138
+ callback_id: str = None,
139
+ width: int = 1280,
140
+ height: int = 720,
141
+ folder_id: str = None,
142
+ callback_url: str = None,
216
143
  ) -> Any:
217
144
  """
218
- Retrieves the list of v2 templates from the API endpoint.
219
-
220
- Args:
221
- None: This function takes no arguments
222
-
223
- Returns:
224
- Parsed JSON data from the API response containing the v2 templates.
225
-
226
- Raises:
227
- HTTPError: If the HTTP request to the API endpoint fails or returns an error status.
228
-
229
- Tags:
230
- get, templates, api, http
145
+ Creates a new avatar video using the /v2/video/generate API endpoint.
146
+
147
+ Args:
148
+ avatar_id: The unique identifier of the avatar to use.
149
+ talking_photo_id: The unique identifier of the talking photo to use.
150
+ avatar_style: Style of the avatar (e.g., "normal", "casual"). Defaults to "normal".
151
+ talking_style: Speaking style for talking photo (e.g., "stable"). Defaults to "stable".
152
+ talking_photo_style: Visual style for talking photo (e.g., "circle", "square"). Defaults to "circle".
153
+ input_text: The text script for the avatar/voice to speak.
154
+ voice_id: Unique identifier for the voice.
155
+ voice_type: Type of voice input ("text", "audio", "silence"). Defaults to "text".
156
+ silence_duration: Duration of silence in seconds (if voice_type is "silence").
157
+ voice_speed: Speed of the voice (0.5 to 2.0). Defaults to 1.0.
158
+ voice_pitch: Pitch of the voice (-20 to 20). Defaults to 0.
159
+ voice_emotion: Emotion of the voice (e.g., "Excited", "Friendly").
160
+ audio_asset_id: ID of an uploaded audio asset (if voice_type is "audio").
161
+ audio_url: URL of an audio file (if voice_type is "audio").
162
+ background_type: Type of background ("color", "image", "video"). Defaults to "color".
163
+ background_value: Hex color code (if background_type is "color"). Defaults to "#008000".
164
+ background_play_style: Play style for image/video backgrounds ("freeze", "loop", etc.). Defaults to "freeze".
165
+ background_fit: How the background fits ("cover", "contain", etc.). Defaults to "cover".
166
+ background_url: URL for background image/video.
167
+ background_image_asset_id: Asset ID for background image.
168
+ background_video_asset_id: Asset ID for background video.
169
+ overlay_text: Text to display on the video.
170
+ overlay_font_size: Font size for overlay text.
171
+ overlay_font_weight: Font weight (e.g., "bold").
172
+ overlay_color: Hex color for overlay text.
173
+ overlay_position: Dictionary for position (e.g., {"x": 10, "y": 10}).
174
+ overlay_text_align: Text alignment ("left", "center", "right").
175
+ line_height: Line height for overlay text. Defaults to 1.0.
176
+ title: Title of the video.
177
+ caption: Whether to include captions. Defaults to False.
178
+ callback_id: Custom ID for callback tracking.
179
+ width: Video width. Defaults to 1280.
180
+ height: Video height. Defaults to 720.
181
+ folder_id: ID of the folder to save the video in.
182
+ callback_url: Webhook URL for status updates.
183
+
184
+ Returns:
185
+ A JSON-decoded object containing the generated video details (e.g., video_id).
186
+
187
+ Raises:
188
+ requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
189
+
190
+ Tags:
191
+ create, video, avatar, api, important
231
192
  """
232
- url = f"{self.base_url}/v2/templates"
233
- query_params = {}
234
- response = self._get(url, params=query_params)
235
- response.raise_for_status()
236
- return response.json()
237
-
238
- def get_v2_template_by_id(self, id) -> Any:
239
- """
240
- Retrieves a v2 template resource by its unique identifier.
241
-
242
- Args:
243
- id: The unique identifier of the v2 template to retrieve.
244
-
245
- Returns:
246
- The parsed JSON response containing the template data.
247
-
248
- Raises:
249
- ValueError: Raised if the 'id' parameter is None.
250
- requests.HTTPError: Raised if the HTTP request to retrieve the template fails.
251
-
252
- Tags:
253
- get, template, id-lookup, api
254
- """
255
- if id is None:
256
- raise ValueError("Missing required parameter 'id'")
257
- url = f"{self.base_url}/v2/template/{id}"
258
- query_params = {}
259
- response = self._get(url, params=query_params)
260
- response.raise_for_status()
261
- return response.json()
262
-
263
- def post_v2_template_generate_by_id(
264
- self, id, title, variables, test=None, caption=None, dimension=None
265
- ) -> Any:
266
- """
267
- Generates content from a template specified by ID using the provided title and variables, and returns the generation result.
268
-
269
- Args:
270
- id: str. The unique identifier of the template to use for content generation. Required.
271
- title: str. The title associated with the generated content. Required.
272
- variables: dict. The variables to substitute into the template. Required.
273
- test: bool, optional. If set, indicates whether to perform a test generation without committing changes.
274
- caption: str, optional. Caption to include with the generated content.
275
- dimension: str or dict, optional. Specifies dimensions or formatting options for generation.
276
-
277
- Returns:
278
- dict. The JSON response containing the generated content and metadata from the API.
279
-
280
- Raises:
281
- ValueError: If 'id', 'title', or 'variables' are not provided.
282
- requests.HTTPError: If the API response contains an HTTP error status.
193
+ url = f"{self.base_url}/v2/video/generate"
283
194
 
284
- Tags:
285
- generate, template, post, ai
286
- """
287
- if id is None:
288
- raise ValueError("Missing required parameter 'id'")
289
- if title is None:
290
- raise ValueError("Missing required parameter 'title'")
291
- if variables is None:
292
- raise ValueError("Missing required parameter 'variables'")
293
- request_body = {
294
- "title": title,
295
- "variables": variables,
296
- "test": test,
297
- "caption": caption,
298
- "dimension": dimension,
195
+ # 1. Character construction
196
+ character = {}
197
+ if avatar_id:
198
+ character["type"] = "avatar"
199
+ character["avatar_id"] = avatar_id
200
+ character["avatar_style"] = avatar_style
201
+ elif talking_photo_id:
202
+ character["type"] = "talking_photo"
203
+ character["talking_photo_id"] = talking_photo_id
204
+ character["talking_style"] = talking_style
205
+ if talking_photo_style:
206
+ character["talking_photo_style"] = talking_photo_style
207
+
208
+ # 2. Voice construction
209
+ voice = {"type": voice_type}
210
+
211
+ if voice_type == "text":
212
+ if input_text: voice["input_text"] = input_text
213
+ if voice_id: voice["voice_id"] = voice_id
214
+
215
+ # Optional attributes for text voice
216
+ if voice_speed != 1.0: voice["speed"] = voice_speed
217
+ if voice_pitch != 0: voice["pitch"] = voice_pitch
218
+ if voice_emotion: voice["emotion"] = voice_emotion
219
+
220
+ elif voice_type == "silence":
221
+ if silence_duration:
222
+ # Docs specify this must be a string
223
+ voice["duration"] = str(silence_duration)
224
+
225
+ elif voice_type == "audio":
226
+ if audio_asset_id: voice["audio_asset_id"] = audio_asset_id
227
+ if audio_url: voice["audio_url"] = audio_url
228
+
229
+ # 3. Background construction
230
+ background = {"type": background_type}
231
+ if background_type == "color":
232
+ background["value"] = background_value
233
+ elif background_type in ["image", "video"]:
234
+ background["play_style"] = background_play_style
235
+ background["fit"] = background_fit
236
+ if background_url:
237
+ background["url"] = background_url
238
+ if background_image_asset_id:
239
+ background["image_asset_id"] = background_image_asset_id
240
+ if background_video_asset_id:
241
+ background["video_asset_id"] = background_video_asset_id
242
+
243
+ # 4. Video Input Assembly
244
+ video_input = {
245
+ "character": character,
246
+ "voice": voice,
247
+ "background": background,
248
+ "dimension": {
249
+ "width": width,
250
+ "height": height
251
+ }
299
252
  }
300
- request_body = {k: v for k, v in request_body.items() if v is not None}
301
- url = f"{self.base_url}/v2/template/{id}/generate"
302
- query_params = {}
303
- response = self._post(url, data=request_body, params=query_params)
304
- response.raise_for_status()
305
- return response.json()
306
-
307
- def get_v2_video_translate_target_languages(
308
- self,
309
- ) -> Any:
310
- """
311
- Retrieves the list of supported target languages for video translation via the v2 API.
312
253
 
313
- Args:
314
- None: This function takes no arguments
254
+ # 5. Text Overlay construction (Optional)
255
+ if overlay_text:
256
+ text_obj = {
257
+ "type": "text", # Allowed: text (hardcoded as it is the only option)
258
+ "text": overlay_text,
259
+ "line_height": line_height
260
+ }
261
+ if overlay_font_size: text_obj["font_size"] = overlay_font_size
262
+ if overlay_font_weight: text_obj["font_weight"] = overlay_font_weight
263
+ if overlay_color: text_obj["color"] = overlay_color
264
+ if overlay_position: text_obj["position"] = overlay_position
265
+ if overlay_text_align: text_obj["text_align"] = overlay_text_align
266
+
267
+ video_input["text"] = text_obj
268
+
269
+ # 6. Final Payload
270
+ payload = {
271
+ "video_inputs": [video_input],
272
+ "caption": caption
273
+ }
315
274
 
316
- Returns:
317
- dict: A JSON-decoded dictionary containing the available target languages for video translation.
275
+ if title: payload["title"] = title
276
+ if callback_id: payload["callback_id"] = callback_id
277
+ if folder_id: payload["folder_id"] = folder_id
278
+ if callback_url: payload["callback_url"] = callback_url
318
279
 
319
- Raises:
320
- requests.HTTPError: If the HTTP response indicates an unsuccessful status code.
280
+ response = await self._apost(url=url, data=payload)
281
+ return self._handle_response(response)
321
282
 
322
- Tags:
323
- get, list, api, video-translation, languages
324
- """
325
- url = f"{self.base_url}/v2/video_translate/target_languages"
326
- query_params = {}
327
- response = self._get(url, params=query_params)
328
- response.raise_for_status()
329
- return response.json()
330
-
331
- def post_v2_video_translate(
283
+ async def get_video_status(
332
284
  self,
333
- video_url,
334
- output_language,
335
- title=None,
336
- translate_audio_only=None,
337
- speaker_num=None,
285
+ video_id: str
338
286
  ) -> Any:
339
287
  """
340
- Submits a video translation request and returns the API response as JSON.
288
+ Retrieves the status and details of a specific video by ID using the /v1/video_status.get endpoint.
341
289
 
342
290
  Args:
343
- video_url: str. The URL of the source video to translate. Must not be None.
344
- output_language: str. The target language code for translation output. Must not be None.
345
- title: Optional[str]. The title to assign to the translated video. Defaults to None.
346
- translate_audio_only: Optional[bool]. If True, only translates audio (not on-screen text). Defaults to None.
347
- speaker_num: Optional[int]. Number of speakers in the video, if known. Defaults to None.
291
+ video_id: The unique identifier of the video.
348
292
 
349
293
  Returns:
350
- dict. The JSON response from the translation API containing the translation job details or result.
294
+ A JSON-decoded object containing the video status and details (e.g., status, video_url).
351
295
 
352
296
  Raises:
353
- ValueError: If 'video_url' or 'output_language' is not provided.
354
- requests.HTTPError: If the HTTP request to the translation API fails (non-success status code).
297
+ requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
355
298
 
356
299
  Tags:
357
- video, translate, ai, async-job, post
300
+ get, video, status, api
358
301
  """
359
- if video_url is None:
360
- raise ValueError("Missing required parameter 'video_url'")
361
- if output_language is None:
362
- raise ValueError("Missing required parameter 'output_language'")
363
- request_body = {
364
- "title": title,
365
- "video_url": video_url,
366
- "output_language": output_language,
367
- "translate_audio_only": translate_audio_only,
368
- "speaker_num": speaker_num,
302
+ url = f"{self.base_url}/v1/video_status.get"
303
+
304
+ params = {
305
+ "video_id": video_id
369
306
  }
370
- request_body = {k: v for k, v in request_body.items() if v is not None}
371
- url = f"{self.base_url}/v2/video_translate"
372
- query_params = {}
373
- response = self._post(url, data=request_body, params=query_params)
374
- response.raise_for_status()
375
- return response.json()
376
-
377
- def get_v2_video_translate_status_by_id(self, id) -> Any:
378
- """
379
- Retrieves the status of a video translation job by its unique identifier.
380
-
381
- Args:
382
- id: The unique identifier of the video translation job to check.
383
-
384
- Returns:
385
- A dictionary representing the status and details of the video translation job.
386
-
387
- Raises:
388
- ValueError: Raised if the 'id' parameter is None.
389
- HTTPError: Raised if the HTTP request to retrieve the job status fails.
307
+
308
+ response = await self._aget(url=url, params=params)
309
+ return self._handle_response(response)
390
310
 
391
- Tags:
392
- get, video-translate, status, ai
393
- """
394
- if id is None:
395
- raise ValueError("Missing required parameter 'id'")
396
- url = f"{self.base_url}/v2/video_translate/{id}"
397
- query_params = {}
398
- response = self._get(url, params=query_params)
399
- response.raise_for_status()
400
- return response.json()
401
-
402
- def post_streaming_new(self, quality=None) -> Any:
403
- """
404
- Initiates a new streaming session with optional quality parameter and returns the server's JSON response.
405
-
406
- Args:
407
- quality: Optional quality setting for the streaming session (type: Any). If None, the default server quality will be used.
408
-
409
- Returns:
410
- A JSON-decoded response (type: Any) from the server containing information about the newly created streaming session.
411
-
412
- Raises:
413
- requests.HTTPError: If the HTTP request to start the streaming session fails or returns a non-success status code.
414
-
415
- Tags:
416
- post, streaming, async-job, start, api
417
- """
418
- request_body = {
419
- "quality": quality,
420
- }
421
- request_body = {k: v for k, v in request_body.items() if v is not None}
422
- url = f"{self.base_url}/v1/streaming.new"
423
- query_params = {}
424
- response = self._post(url, data=request_body, params=query_params)
425
- response.raise_for_status()
426
- return response.json()
427
-
428
- def get_streaming_list(
311
+ async def create_folder(
429
312
  self,
313
+ name: str,
314
+ # Allowed values from screenshot: video_translate, instant_avatar, video, asset, brand_kit, mixed
315
+ project_type: Literal[
316
+ "video_translate",
317
+ "instant_avatar",
318
+ "video",
319
+ "asset",
320
+ "brand_kit",
321
+ "mixed"
322
+ ] = "mixed",
323
+ parent_id: Optional[str] = None
430
324
  ) -> Any:
431
325
  """
432
- Retrieves the list of available streaming resources from the remote API.
326
+ Creates a new folder under your account using the /v1/folders/create endpoint.
433
327
 
434
328
  Args:
435
- None: This function takes no arguments
329
+ name: The name of the folder.
330
+ project_type: The type of projects the folder will contain. Defaults to "mixed".
331
+ Allowed values: "video_translate", "instant_avatar", "video", "asset", "brand_kit", "mixed".
332
+ parent_id: Optional ID of the parent folder.
436
333
 
437
334
  Returns:
438
- The parsed JSON response containing the list of streaming resources.
335
+ A JSON-decoded object containing the created folder details.
439
336
 
440
337
  Raises:
441
- requests.HTTPError: If the HTTP request to the streaming list endpoint fails or returns an error status code.
338
+ requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
442
339
 
443
340
  Tags:
444
- get, list, streaming, api
445
- """
446
- url = f"{self.base_url}/v1/streaming.list"
447
- query_params = {}
448
- response = self._get(url, params=query_params)
449
- response.raise_for_status()
450
- return response.json()
451
-
452
- def post_streaming_ice(self, session_id, candidate) -> Any:
341
+ create, folder, api
453
342
  """
454
- Sends an ICE candidate for a streaming session to the server and returns the JSON response.
455
-
456
- Args:
457
- session_id: Unique identifier for the streaming session. Must not be None.
458
- candidate: ICE candidate information to be sent to the server. Must not be None.
459
-
460
- Returns:
461
- Parsed JSON response from the server as a Python object.
462
-
463
- Raises:
464
- ValueError: Raised if 'session_id' or 'candidate' is None.
465
- requests.HTTPError: Raised if the HTTP request to the server fails.
466
-
467
- Tags:
468
- post, streaming, ice, async-job, ai
469
- """
470
- if session_id is None:
471
- raise ValueError("Missing required parameter 'session_id'")
472
- if candidate is None:
473
- raise ValueError("Missing required parameter 'candidate'")
474
- request_body = {
475
- "session_id": session_id,
476
- "candidate": candidate,
343
+ url = f"{self.base_url}/v1/folders/create"
344
+
345
+ payload = {
346
+ "name": name,
347
+ "project_type": project_type
477
348
  }
478
- request_body = {k: v for k, v in request_body.items() if v is not None}
479
- url = f"{self.base_url}/v1/streaming.ice"
480
- query_params = {}
481
- response = self._post(url, data=request_body, params=query_params)
482
- response.raise_for_status()
483
- return response.json()
484
-
485
- def post_streaming_task(self, session_id, text) -> Any:
486
- """
487
- Submits a streaming task for the specified session and text input, returning the response from the remote API.
488
-
489
- Args:
490
- session_id: The unique identifier for the streaming session. Must not be None.
491
- text: The text content to be processed in the streaming task. Must not be None.
492
-
493
- Returns:
494
- The parsed JSON response from the streaming task API call.
495
-
496
- Raises:
497
- ValueError: If either 'session_id' or 'text' is None.
498
- requests.HTTPError: If the API request fails or returns an unsuccessful status code.
499
-
500
- Tags:
501
- post, streaming-task, api, start
502
- """
503
- if session_id is None:
504
- raise ValueError("Missing required parameter 'session_id'")
505
- if text is None:
506
- raise ValueError("Missing required parameter 'text'")
507
- request_body = {
508
- "session_id": session_id,
509
- "text": text,
510
- }
511
- request_body = {k: v for k, v in request_body.items() if v is not None}
512
- url = f"{self.base_url}/v1/streaming.task"
513
- query_params = {}
514
- response = self._post(url, data=request_body, params=query_params)
515
- response.raise_for_status()
516
- return response.json()
517
-
518
- def post_streaming_stop(self, session_id) -> Any:
519
- """
520
- Stops an ongoing streaming session by sending a stop request for the specified session ID.
521
-
522
- Args:
523
- session_id: The unique identifier of the streaming session to be stopped.
524
-
525
- Returns:
526
- The parsed JSON response from the stop request, typically containing the status or result of the streaming stop operation.
527
-
528
- Raises:
529
- ValueError: If 'session_id' is None.
530
- requests.HTTPError: If the HTTP request to stop the streaming session fails or returns an error response.
531
-
532
- Tags:
533
- stop, streaming, management, async-job
534
- """
535
- if session_id is None:
536
- raise ValueError("Missing required parameter 'session_id'")
537
- request_body = {
538
- "session_id": session_id,
539
- }
540
- request_body = {k: v for k, v in request_body.items() if v is not None}
541
- url = f"{self.base_url}/v1/streaming.stop"
542
- query_params = {}
543
- response = self._post(url, data=request_body, params=query_params)
544
- response.raise_for_status()
545
- return response.json()
546
-
547
- def post_streaming_interrupt(self, session_id) -> Any:
548
- """
549
- Sends a request to interrupt an active streaming session identified by the given session ID.
550
-
551
- Args:
552
- session_id: The unique identifier of the streaming session to be interrupted.
553
-
554
- Returns:
555
- A dictionary containing the server's response to the interrupt request.
556
-
557
- Raises:
558
- ValueError: Raised if 'session_id' is None.
559
- requests.HTTPError: Raised if the HTTP request to interrupt the session fails.
560
-
561
- Tags:
562
- interrupt, streaming, management
563
- """
564
- if session_id is None:
565
- raise ValueError("Missing required parameter 'session_id'")
566
- request_body = {
567
- "session_id": session_id,
568
- }
569
- request_body = {k: v for k, v in request_body.items() if v is not None}
570
- url = f"{self.base_url}/v1/streaming.interrupt"
571
- query_params = {}
572
- response = self._post(url, data=request_body, params=query_params)
573
- response.raise_for_status()
574
- return response.json()
575
-
576
- def post_streaming_create_token(self, expiry=None) -> Any:
577
- """
578
- Creates a new streaming token with an optional expiry time by sending a POST request to the streaming token API endpoint.
579
-
580
- Args:
581
- expiry: Optional expiry time for the token in seconds. If None, the token will not have an explicit expiration.
582
-
583
- Returns:
584
- dict: The JSON response from the API containing the new streaming token and related metadata.
585
-
586
- Raises:
587
- requests.exceptions.HTTPError: If the HTTP request returned an unsuccessful status code.
588
-
589
- Tags:
590
- create, streaming, token, api
591
- """
592
- request_body = {
593
- "expiry": expiry,
594
- }
595
- request_body = {k: v for k, v in request_body.items() if v is not None}
596
- url = f"{self.base_url}/v1/streaming.create_token"
597
- query_params = {}
598
- response = self._post(url, data=request_body, params=query_params)
599
- response.raise_for_status()
600
- return response.json()
601
-
602
- def get_streaming_avatar_list(
349
+
350
+ if parent_id:
351
+ payload["parent_id"] = parent_id
352
+
353
+ response = await self._apost(url=url, data=payload)
354
+ return self._handle_response(response)
355
+
356
+ async def list_folders(
603
357
  self,
358
+ limit: Optional[int] = None, # Accepts values from 0 to 100
359
+ parent_id: Optional[str] = None,
360
+ name_filter: Optional[str] = None,
361
+ is_trash: bool = False,
362
+ token: Optional[str] = None
604
363
  ) -> Any:
605
364
  """
606
- Retrieves a list of available streaming avatars from the API endpoint.
365
+ Retrieves a paginated list of folders created under your account using the /v1/folders endpoint.
607
366
 
608
367
  Args:
609
- None: This function takes no arguments
368
+ limit: The maximum number of folders to return (0 to 100).
369
+ parent_id: Optional ID of the parent folder to list children of.
370
+ name_filter: Optional string to filter folders by name.
371
+ is_trash: Whether to list folders in the trash. Defaults to False.
372
+ token: Pagination token for retrieving the next page of results.
610
373
 
611
374
  Returns:
612
- A JSON-decoded object representing the list of streaming avatars.
375
+ A JSON-decoded object containing the list of folders and pagination info.
613
376
 
614
377
  Raises:
615
- requests.exceptions.HTTPError: If the HTTP request to the streaming avatar endpoint returns an unsuccessful status code.
378
+ requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
616
379
 
617
380
  Tags:
618
- list, streaming, avatar, api
381
+ list, folders, api
619
382
  """
620
- url = f"{self.base_url}/v1/streaming/avatar.list"
621
- query_params = {}
622
- response = self._get(url, params=query_params)
623
- response.raise_for_status()
624
- return response.json()
383
+ url = f"{self.base_url}/v1/folders"
384
+
385
+ params = {}
386
+
387
+ if limit is not None:
388
+ params["limit"] = limit
389
+ if parent_id:
390
+ params["parent_id"] = parent_id
391
+ if name_filter:
392
+ params["name_filter"] = name_filter
393
+ if is_trash:
394
+ params["is_trash"] = "true"
395
+ if token:
396
+ params["token"] = token
397
+
398
+ response = await self._aget(url=url, params=params)
399
+ return self._handle_response(response)
625
400
 
626
- def get_v1_webhook_list(
401
+ async def update_folder(
627
402
  self,
403
+ folder_id: str,
404
+ name: str
628
405
  ) -> Any:
629
406
  """
630
- Retrieves a list of all registered webhooks via the v1 API endpoint.
407
+ Updates the name of an existing folder using the /v1/folders/{folder_id} endpoint.
631
408
 
632
409
  Args:
633
- None: This function takes no arguments
410
+ folder_id: The unique identifier of the folder to update.
411
+ name: The new name for the folder.
634
412
 
635
413
  Returns:
636
- The parsed JSON response containing webhook list data.
414
+ A JSON-decoded object containing the updated folder details.
637
415
 
638
416
  Raises:
639
- requests.HTTPError: If the HTTP request fails or an error response is returned from the server.
417
+ requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
640
418
 
641
419
  Tags:
642
- list, webhook, api, management
420
+ update, folder, api
643
421
  """
644
- url = f"{self.base_url}/v1/webhook/webhook.list"
645
- query_params = {}
646
- response = self._get(url, params=query_params)
647
- response.raise_for_status()
648
- return response.json()
649
-
650
- def post_v1_webhook_endpoint_add(self, url, events) -> Any:
651
- """
652
- Registers a new webhook endpoint with the specified URL and events.
653
-
654
- Args:
655
- url: str. The callback URL where webhook notifications will be sent. Must not be None.
656
- events: list. A list of event types to subscribe the webhook to. Must not be None.
657
-
658
- Returns:
659
- dict. The JSON response from the API containing details about the created webhook endpoint.
660
-
661
- Raises:
662
- ValueError: Raised if the 'url' or 'events' parameter is None.
663
- requests.HTTPError: Raised if the HTTP request to the endpoint fails.
664
-
665
- Tags:
666
- add, webhook, endpoint, api
667
- """
668
- if url is None:
669
- raise ValueError("Missing required parameter 'url'")
670
- if events is None:
671
- raise ValueError("Missing required parameter 'events'")
672
- request_body = {
673
- "url": url,
674
- "events": events,
422
+ url = f"{self.base_url}/v1/folders/{folder_id}"
423
+ payload = {
424
+ "name": name
675
425
  }
676
- request_body = {k: v for k, v in request_body.items() if v is not None}
677
- url = f"{self.base_url}/v1/webhook/endpoint.add"
678
- query_params = {}
679
- response = self._post(url, data=request_body, params=query_params)
680
- response.raise_for_status()
681
- return response.json()
682
-
683
- def delete_v1_webhook_endpoint_by_id(self, endpoint_id) -> Any:
684
- """
685
- Deletes a webhook endpoint identified by its ID via a DELETE request to the v1 API.
686
-
687
- Args:
688
- endpoint_id: The unique identifier of the webhook endpoint to delete. Must not be None.
689
-
690
- Returns:
691
- The response payload parsed as JSON from the DELETE request.
692
-
693
- Raises:
694
- ValueError: If the 'endpoint_id' parameter is None.
695
- requests.HTTPError: If the DELETE request returns an unsuccessful HTTP status code.
696
-
697
- Tags:
698
- delete, webhook, endpoint, api
699
- """
700
- if endpoint_id is None:
701
- raise ValueError("Missing required parameter 'endpoint_id'")
702
- url = f"{self.base_url}/v1/webhook/endpoint.delete/{endpoint_id}"
703
- query_params = {}
704
- response = self._delete(url, params=query_params)
705
- response.raise_for_status()
706
- return response.json()
707
-
708
- def get_v1_webhook_endpoint_list(
709
- self,
710
- ) -> Any:
711
- """
712
- Retrieves a list of webhook endpoints from the v1 API.
713
-
714
- Args:
715
- None: This function takes no arguments
716
-
717
- Returns:
718
- A JSON-compatible object containing the list of webhook endpoints.
719
-
720
- Raises:
721
- requests.HTTPError: If the HTTP request to the webhook endpoint API fails or returns an unsuccessful status code.
722
-
723
- Tags:
724
- get, list, webhook, endpoint, api
725
- """
726
- url = f"{self.base_url}/v1/webhook/endpoint.list"
727
- query_params = {}
728
- response = self._get(url, params=query_params)
729
- response.raise_for_status()
730
- return response.json()
426
+
427
+ response = await self._apost(url=url, data=payload)
428
+ return self._handle_response(response)
731
429
 
732
- def get_v1_talking_photo_list(
430
+ async def trash_folder(
733
431
  self,
432
+ folder_id: str
734
433
  ) -> Any:
735
434
  """
736
- Retrieves the list of talking photos from the v1 API endpoint.
435
+ Deletes (trashes) a specific folder by its unique folder ID using the /v1/folders/{folder_id}/trash endpoint.
737
436
 
738
437
  Args:
739
- None: This function takes no arguments
438
+ folder_id: The unique identifier of the folder to move to trash.
740
439
 
741
440
  Returns:
742
- The JSON-decoded response containing the list of talking photos.
441
+ A JSON-decoded object confirming the action.
743
442
 
744
443
  Raises:
745
- requests.HTTPError: If the HTTP request to the API endpoint returns an unsuccessful status code.
444
+ requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
746
445
 
747
446
  Tags:
748
- get, list, api, talking-photo
447
+ delete, trash, folder, api
749
448
  """
750
- url = f"{self.base_url}/v1/talking_photo.list"
751
- query_params = {}
752
- response = self._get(url, params=query_params)
753
- response.raise_for_status()
754
- return response.json()
449
+ url = f"{self.base_url}/v1/folders/{folder_id}/trash"
450
+ response = await self._apost(url=url, data={})
451
+ return self._handle_response(response)
755
452
 
756
- def delete_v2_talking_photo_by_id(self, id) -> Any:
757
- """
758
- Deletes a v2 talking photo resource identified by its unique ID.
759
-
760
- Args:
761
- id: The unique identifier of the v2 talking photo to be deleted.
762
-
763
- Returns:
764
- The response data as a JSON object if the deletion is successful.
765
-
766
- Raises:
767
- ValueError: Raised if the 'id' parameter is None.
768
- HTTPError: Raised if the HTTP request fails with an error status code.
769
-
770
- Tags:
771
- delete, talking-photo, v2, api, management
772
- """
773
- if id is None:
774
- raise ValueError("Missing required parameter 'id'")
775
- url = f"{self.base_url}/v2/talking_photo/{id}"
776
- query_params = {}
777
- response = self._delete(url, params=query_params)
778
- response.raise_for_status()
779
- return response.json()
780
-
781
- def post_personalized_video_add_contact(self, project_id, variables_list) -> Any:
782
- """
783
- Adds a new contact to a personalized video project by sending the contact variables to the server.
784
-
785
- Args:
786
- project_id: The unique identifier for the personalized video project. Must not be None.
787
- variables_list: A list containing variables for the new contact. Must not be None.
788
-
789
- Returns:
790
- A dictionary representing the JSON response from the server, usually containing details or status of the added contact.
791
-
792
- Raises:
793
- ValueError: Raised if either 'project_id' or 'variables_list' is None.
794
- requests.HTTPError: Raised if the HTTP request fails or returns an error status code.
795
-
796
- Tags:
797
- add, contact, personalized-video, api, async_job
798
- """
799
- if project_id is None:
800
- raise ValueError("Missing required parameter 'project_id'")
801
- if variables_list is None:
802
- raise ValueError("Missing required parameter 'variables_list'")
803
- request_body = {
804
- "project_id": project_id,
805
- "variables_list": variables_list,
806
- }
807
- request_body = {k: v for k, v in request_body.items() if v is not None}
808
- url = f"{self.base_url}/v1/personalized_video/add_contact"
809
- query_params = {}
810
- response = self._post(url, data=request_body, params=query_params)
811
- response.raise_for_status()
812
- return response.json()
813
-
814
- def get_personalized_video_audience_detail(self, id=None) -> Any:
815
- """
816
- Retrieves detailed information about a personalized video audience by ID.
817
-
818
- Args:
819
- id: Optional; The unique identifier of the personalized video audience to retrieve details for. If None, details for all audiences may be returned depending on API behavior.
820
-
821
- Returns:
822
- A JSON-decoded Python object containing the audience detail information provided by the API.
823
-
824
- Raises:
825
- requests.HTTPError: If the HTTP request returned an unsuccessful status code.
826
-
827
- Tags:
828
- get, detail, audience, video, api
829
- """
830
- url = f"{self.base_url}/v1/personalized_video/audience/detail"
831
- query_params = {k: v for k, v in [("id", id)] if v is not None}
832
- response = self._get(url, params=query_params)
833
- response.raise_for_status()
834
- return response.json()
835
-
836
- def get_personalized_video_project_detail(self, id=None) -> Any:
837
- """
838
- Retrieves the details of a personalized video project by its unique identifier.
839
-
840
- Args:
841
- id: Optional; The unique identifier of the personalized video project to retrieve. If None, no project ID is passed as a parameter.
842
-
843
- Returns:
844
- A JSON-decoded Python object containing the details of the personalized video project.
845
-
846
- Raises:
847
- requests.HTTPError: If the HTTP request fails or returns a non-success status code, an HTTPError is raised.
848
-
849
- Tags:
850
- get, personalized-video, project-detail, api
851
- """
852
- url = f"{self.base_url}/v1/personalized_video/project/detail"
853
- query_params = {k: v for k, v in [("id", id)] if v is not None}
854
- response = self._get(url, params=query_params)
855
- response.raise_for_status()
856
- return response.json()
857
-
858
- def get_v2_user_remaining_quota(
453
+ async def restore_folder(
859
454
  self,
455
+ folder_id: str
860
456
  ) -> Any:
861
457
  """
862
- Retrieves the current remaining quota information for the user from the v2 API endpoint.
458
+ Restores a previously deleted folder using the /v1/folders/{folder_id}/restore endpoint.
863
459
 
864
460
  Args:
865
- None: This function takes no arguments
461
+ folder_id: The unique identifier of the folder to restore.
866
462
 
867
463
  Returns:
868
- dict: A dictionary containing remaining quota details for the user as returned by the API.
464
+ A JSON-decoded object confirming the action.
869
465
 
870
466
  Raises:
871
- requests.HTTPError: If the HTTP request to the quota endpoint fails or returns a non-success status code.
467
+ requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
872
468
 
873
469
  Tags:
874
- get, quota, user-management, api
470
+ restore, folder, api
875
471
  """
876
- url = f"{self.base_url}/v2/user/remaining_quota"
877
- query_params = {}
878
- response = self._get(url, params=query_params)
879
- response.raise_for_status()
880
- return response.json()
881
-
882
- def post_v1_asset_upload(self, request_body=None) -> Any:
883
- """
884
- Uploads an asset to the server using a POST request to the '/v1/asset' endpoint.
885
-
886
- Args:
887
- request_body: Optional. The data to include in the POST request body, typically representing the asset to upload.
888
-
889
- Returns:
890
- The parsed JSON response from the server, containing information about the uploaded asset.
891
-
892
- Raises:
893
- requests.HTTPError: If the HTTP request returned an unsuccessful status code.
894
-
895
- Tags:
896
- upload, asset, post, api
897
- """
898
- url = f"{self.base_url}/v1/asset"
899
- query_params = {}
900
- response = self._post(url, data=request_body, params=query_params)
901
- response.raise_for_status()
902
- return response.json()
903
-
904
- def get_v1_video_status(self, video_id=None) -> Any:
905
- """
906
- Retrieves the status of a video by making a GET request to the v1 video_status endpoint.
907
-
908
- Args:
909
- video_id: Optional; The unique identifier of the video whose status is to be retrieved. If not provided, the request may fail or return an error depending on the API.
910
-
911
- Returns:
912
- A JSON-decoded object containing the status information of the requested video.
913
-
914
- Raises:
915
- requests.HTTPError: Raised if the HTTP request fails or the server returns an unsuccessful status code.
916
-
917
- Tags:
918
- get, video, status, api
919
- """
920
- url = f"{self.base_url}/v1/video_status.get"
921
- query_params = {k: v for k, v in [("video_id", video_id)] if v is not None}
922
- response = self._get(url, params=query_params)
923
- response.raise_for_status()
924
- return response.json()
472
+ url = f"{self.base_url}/v1/folders/{folder_id}/restore"
473
+ response = await self._apost(url=url, data={})
474
+ return self._handle_response(response)
925
475
 
926
476
  def list_tools(self):
927
477
  return [
928
- self.get_v1_voice_list,
929
- self.get_v1_avatar_list,
930
- self.get_v2_voices,
931
478
  self.get_v2_avatars,
932
- self.get_v1_video_list,
933
- self.post_v2_video_generate,
934
- self.delete_v1_video,
935
- self.get_v2_templates,
936
- self.get_v2_template_by_id,
937
- self.post_v2_template_generate_by_id,
938
- self.get_v2_video_translate_target_languages,
939
- self.post_v2_video_translate,
940
- self.get_v2_video_translate_status_by_id,
941
- self.post_streaming_new,
942
- self.get_streaming_list,
943
- self.post_streaming_ice,
944
- self.post_streaming_task,
945
- self.post_streaming_stop,
946
- self.post_streaming_interrupt,
947
- self.post_streaming_create_token,
948
- self.get_streaming_avatar_list,
949
- self.get_v1_webhook_list,
950
- self.post_v1_webhook_endpoint_add,
951
- self.delete_v1_webhook_endpoint_by_id,
952
- self.get_v1_webhook_endpoint_list,
953
- self.get_v1_talking_photo_list,
954
- self.delete_v2_talking_photo_by_id,
955
- self.post_personalized_video_add_contact,
956
- self.get_personalized_video_audience_detail,
957
- self.get_personalized_video_project_detail,
958
- self.get_v2_user_remaining_quota,
959
- self.post_v1_asset_upload,
960
- self.get_v1_video_status,
479
+ self.list_avatar_groups,
480
+ self.list_avatars_in_group,
481
+ self.get_avatar_details,
482
+ self.create_avatar_video,
483
+ self.get_video_status,
484
+ self.create_folder,
485
+ self.list_folders,
486
+ self.update_folder,
487
+ self.trash_folder,
488
+ self.restore_folder,
961
489
  ]