universal-mcp-applications 0.1.39rc8__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.
- universal_mcp/applications/BEST_PRACTICES.md +1 -1
- universal_mcp/applications/airtable/app.py +13 -13
- universal_mcp/applications/apollo/app.py +2 -2
- universal_mcp/applications/aws_s3/app.py +30 -19
- universal_mcp/applications/browser_use/app.py +10 -7
- universal_mcp/applications/contentful/app.py +4 -4
- universal_mcp/applications/crustdata/app.py +2 -2
- universal_mcp/applications/e2b/app.py +3 -4
- universal_mcp/applications/elevenlabs/README.md +27 -3
- universal_mcp/applications/elevenlabs/app.py +753 -48
- universal_mcp/applications/exa/app.py +18 -11
- universal_mcp/applications/falai/README.md +5 -7
- universal_mcp/applications/falai/app.py +160 -159
- universal_mcp/applications/firecrawl/app.py +14 -15
- universal_mcp/applications/ghost_content/app.py +4 -4
- universal_mcp/applications/github/app.py +2 -2
- universal_mcp/applications/gong/app.py +2 -2
- universal_mcp/applications/google_docs/README.md +15 -14
- universal_mcp/applications/google_docs/app.py +5 -4
- universal_mcp/applications/google_gemini/app.py +61 -17
- universal_mcp/applications/google_sheet/README.md +2 -1
- universal_mcp/applications/google_sheet/app.py +55 -0
- universal_mcp/applications/heygen/README.md +10 -32
- universal_mcp/applications/heygen/app.py +350 -744
- universal_mcp/applications/klaviyo/app.py +2 -2
- universal_mcp/applications/linkedin/README.md +14 -2
- universal_mcp/applications/linkedin/app.py +411 -38
- universal_mcp/applications/ms_teams/app.py +420 -1285
- universal_mcp/applications/notion/app.py +2 -2
- universal_mcp/applications/openai/app.py +1 -1
- universal_mcp/applications/perplexity/app.py +6 -7
- universal_mcp/applications/reddit/app.py +4 -4
- universal_mcp/applications/resend/app.py +31 -32
- universal_mcp/applications/rocketlane/app.py +2 -2
- universal_mcp/applications/scraper/app.py +51 -21
- universal_mcp/applications/semrush/app.py +1 -1
- universal_mcp/applications/serpapi/app.py +8 -7
- universal_mcp/applications/shopify/app.py +5 -7
- universal_mcp/applications/shortcut/app.py +3 -2
- universal_mcp/applications/slack/app.py +2 -2
- universal_mcp/applications/twilio/app.py +14 -13
- {universal_mcp_applications-0.1.39rc8.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/METADATA +1 -1
- {universal_mcp_applications-0.1.39rc8.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/RECORD +45 -45
- {universal_mcp_applications-0.1.39rc8.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/WHEEL +0 -0
- {universal_mcp_applications-0.1.39rc8.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
from typing import Any
|
|
1
|
+
from typing import Any, Literal, Optional, Dict, Union
|
|
2
|
+
import httpx
|
|
3
|
+
import logging
|
|
2
4
|
from universal_mcp.applications.application import APIApplication
|
|
3
5
|
from universal_mcp.integrations import Integration
|
|
4
6
|
|
|
@@ -8,86 +10,17 @@ class HeygenApp(APIApplication):
|
|
|
8
10
|
super().__init__(name="heygen", integration=integration, **kwargs)
|
|
9
11
|
self.base_url = "https://api.heygen.com"
|
|
10
12
|
|
|
11
|
-
def
|
|
12
|
-
credentials = self.integration.
|
|
13
|
-
api_key = credentials.get("api_key") or credentials.get("API_KEY") or credentials.get("apiKey")
|
|
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")
|
|
14
16
|
return {"x-api-key": f"{api_key}", "Content-Type": "application/json", "Accept": "application/json"}
|
|
15
17
|
|
|
16
|
-
async def get_v1_voice_list(self) -> Any:
|
|
17
|
-
"""
|
|
18
|
-
Retrieves the list of available voices from the v1 voice API endpoint.
|
|
19
|
-
|
|
20
|
-
Args:
|
|
21
|
-
None: This function takes no arguments
|
|
22
|
-
|
|
23
|
-
Returns:
|
|
24
|
-
dict: A dictionary containing the JSON response with details about the available voices.
|
|
25
|
-
|
|
26
|
-
Raises:
|
|
27
|
-
HTTPError: If the HTTP request to the voice API endpoint results in an unsuccessful status code.
|
|
28
|
-
|
|
29
|
-
Tags:
|
|
30
|
-
get, list, voice, api
|
|
31
|
-
"""
|
|
32
|
-
url = f"{self.base_url}/v1/voice.list"
|
|
33
|
-
query_params = {}
|
|
34
|
-
response = await self._aget(url, params=query_params)
|
|
35
|
-
response.raise_for_status()
|
|
36
|
-
return response.json()
|
|
37
|
-
|
|
38
|
-
async def get_v1_avatar_list(self) -> Any:
|
|
39
|
-
"""
|
|
40
|
-
Retrieves a list of available avatars from the v1 API endpoint.
|
|
41
|
-
|
|
42
|
-
Args:
|
|
43
|
-
None: This function takes no arguments
|
|
44
|
-
|
|
45
|
-
Returns:
|
|
46
|
-
A JSON-decoded object containing the list of avatars returned by the API.
|
|
47
|
-
|
|
48
|
-
Raises:
|
|
49
|
-
requests.exceptions.HTTPError: If the HTTP request to the avatar list endpoint fails, such as due to a non-2xx response.
|
|
50
|
-
|
|
51
|
-
Tags:
|
|
52
|
-
get, list, avatar, api, important
|
|
53
|
-
"""
|
|
54
|
-
url = f"{self.base_url}/v1/avatar.list"
|
|
55
|
-
query_params = {}
|
|
56
|
-
response = await self._aget(url, params=query_params)
|
|
57
|
-
response.raise_for_status()
|
|
58
|
-
return response.json()
|
|
59
|
-
|
|
60
|
-
async def get_v2_voices(self) -> Any:
|
|
61
|
-
"""
|
|
62
|
-
Retrieves the list of available v2 voices from the API endpoint.
|
|
63
|
-
|
|
64
|
-
Args:
|
|
65
|
-
None: This function takes no arguments
|
|
66
|
-
|
|
67
|
-
Returns:
|
|
68
|
-
A JSON-decoded object containing information about available v2 voices.
|
|
69
|
-
|
|
70
|
-
Raises:
|
|
71
|
-
requests.HTTPError: If the HTTP request to the voices endpoint returns an unsuccessful status code.
|
|
72
|
-
|
|
73
|
-
Tags:
|
|
74
|
-
get, list, voices, api, important
|
|
75
|
-
"""
|
|
76
|
-
url = f"{self.base_url}/v2/voices"
|
|
77
|
-
query_params = {}
|
|
78
|
-
response = await self._aget(url, params=query_params)
|
|
79
|
-
response.raise_for_status()
|
|
80
|
-
return response.json()
|
|
81
|
-
|
|
82
18
|
async def get_v2_avatars(self) -> Any:
|
|
83
19
|
"""
|
|
84
20
|
Retrieves a list of avatar objects from the /v2/avatars API endpoint.
|
|
85
21
|
|
|
86
|
-
Args:
|
|
87
|
-
None: This function takes no arguments
|
|
88
|
-
|
|
89
22
|
Returns:
|
|
90
|
-
A JSON-decoded object containing the list of avatars
|
|
23
|
+
A JSON-decoded object containing the paginated list of avatars.
|
|
91
24
|
|
|
92
25
|
Raises:
|
|
93
26
|
requests.exceptions.HTTPError: If the HTTP request to the /v2/avatars endpoint returns an unsuccessful status code.
|
|
@@ -96,788 +29,461 @@ class HeygenApp(APIApplication):
|
|
|
96
29
|
get, list, avatars, api
|
|
97
30
|
"""
|
|
98
31
|
url = f"{self.base_url}/v2/avatars"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
response.raise_for_status()
|
|
102
|
-
return response.json()
|
|
32
|
+
response = await self._aget(url=url)
|
|
33
|
+
return self._handle_response(response)
|
|
103
34
|
|
|
104
|
-
async def
|
|
35
|
+
async def list_avatar_groups(self, include_public: bool = False) -> Any:
|
|
105
36
|
"""
|
|
106
|
-
Retrieves a list of
|
|
37
|
+
Retrieves a list of avatar groups from the /v2/avatar_group.list API endpoint.
|
|
107
38
|
|
|
108
39
|
Args:
|
|
109
|
-
|
|
40
|
+
include_public: Whether to include public avatar groups in the response. Defaults to False.
|
|
110
41
|
|
|
111
42
|
Returns:
|
|
112
|
-
A JSON-decoded object containing the list of
|
|
43
|
+
A JSON-decoded object containing the list of avatar groups.
|
|
113
44
|
|
|
114
45
|
Raises:
|
|
115
|
-
requests.HTTPError: If the HTTP request
|
|
46
|
+
requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
|
|
116
47
|
|
|
117
48
|
Tags:
|
|
118
|
-
|
|
49
|
+
list, avatar_groups, api
|
|
119
50
|
"""
|
|
120
|
-
url = f"{self.base_url}/
|
|
121
|
-
|
|
122
|
-
response = await self._aget(url, params=
|
|
123
|
-
|
|
124
|
-
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)
|
|
125
55
|
|
|
126
|
-
async def
|
|
56
|
+
async def list_avatars_in_group(self, group_id: str) -> Any:
|
|
127
57
|
"""
|
|
128
|
-
|
|
58
|
+
Retrieves a list of avatars from a specific avatar group.
|
|
129
59
|
|
|
130
60
|
Args:
|
|
131
|
-
|
|
132
|
-
title: Optional; a string specifying the title of the generated video.
|
|
133
|
-
test: Optional; a flag or parameter used for testing purposes. Its type and effect depend on the API implementation.
|
|
134
|
-
callback_id: Optional; a string or identifier for callback tracking after video generation.
|
|
135
|
-
dimension: Optional; defines the desired dimensions for the generated video.
|
|
136
|
-
aspect_ratio: Optional; defines the desired aspect ratio for the generated video.
|
|
61
|
+
group_id: The unique identifier of the avatar group.
|
|
137
62
|
|
|
138
63
|
Returns:
|
|
139
|
-
A
|
|
64
|
+
A JSON-decoded object containing the list of avatars in the group.
|
|
140
65
|
|
|
141
66
|
Raises:
|
|
142
|
-
|
|
143
|
-
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.
|
|
144
68
|
|
|
145
69
|
Tags:
|
|
146
|
-
|
|
70
|
+
list, avatars, avatar_group, api
|
|
147
71
|
"""
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
"title": title,
|
|
152
|
-
"video_inputs": video_inputs,
|
|
153
|
-
"test": test,
|
|
154
|
-
"callback_id": callback_id,
|
|
155
|
-
"dimension": dimension,
|
|
156
|
-
"aspect_ratio": aspect_ratio,
|
|
157
|
-
}
|
|
158
|
-
request_body = {k: v for k, v in request_body.items() if v is not None}
|
|
159
|
-
url = f"{self.base_url}/v2/video/generate"
|
|
160
|
-
query_params = {}
|
|
161
|
-
response = await self._apost(url, data=request_body, params=query_params)
|
|
162
|
-
response.raise_for_status()
|
|
163
|
-
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)
|
|
164
75
|
|
|
165
|
-
async def
|
|
76
|
+
async def get_avatar_details(self, avatar_id: str) -> Any:
|
|
166
77
|
"""
|
|
167
|
-
|
|
78
|
+
Retrieves detailed information about a specific avatar by its ID.
|
|
168
79
|
|
|
169
80
|
Args:
|
|
170
|
-
|
|
81
|
+
avatar_id: The unique identifier of the avatar.
|
|
171
82
|
|
|
172
83
|
Returns:
|
|
173
|
-
|
|
84
|
+
A JSON-decoded object containing the avatar details.
|
|
174
85
|
|
|
175
86
|
Raises:
|
|
176
|
-
requests.HTTPError: If the HTTP request
|
|
87
|
+
requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
|
|
177
88
|
|
|
178
89
|
Tags:
|
|
179
|
-
|
|
180
|
-
"""
|
|
181
|
-
url = f"{self.base_url}/v1/video.delete"
|
|
182
|
-
query_params = {k: v for k, v in [("video_id", video_id)] if v is not None}
|
|
183
|
-
response = await self._adelete(url, params=query_params)
|
|
184
|
-
response.raise_for_status()
|
|
185
|
-
return response.json()
|
|
186
|
-
|
|
187
|
-
async def get_v2_templates(self) -> Any:
|
|
90
|
+
get, avatar, details, api
|
|
188
91
|
"""
|
|
189
|
-
|
|
92
|
+
url = f"{self.base_url}/v2/avatar/{avatar_id}/details"
|
|
93
|
+
response = await self._aget(url=url)
|
|
94
|
+
return self._handle_response(response)
|
|
190
95
|
|
|
191
|
-
Args:
|
|
192
|
-
None: This function takes no arguments
|
|
193
|
-
|
|
194
|
-
Returns:
|
|
195
|
-
Parsed JSON data from the API response containing the v2 templates.
|
|
196
|
-
|
|
197
|
-
Raises:
|
|
198
|
-
HTTPError: If the HTTP request to the API endpoint fails or returns an error status.
|
|
199
|
-
|
|
200
|
-
Tags:
|
|
201
|
-
get, templates, api, http
|
|
202
|
-
"""
|
|
203
|
-
url = f"{self.base_url}/v2/templates"
|
|
204
|
-
query_params = {}
|
|
205
|
-
response = await self._aget(url, params=query_params)
|
|
206
|
-
response.raise_for_status()
|
|
207
|
-
return response.json()
|
|
208
96
|
|
|
209
|
-
async def
|
|
97
|
+
async def create_avatar_video(
|
|
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,
|
|
143
|
+
) -> Any:
|
|
210
144
|
"""
|
|
211
|
-
|
|
145
|
+
Creates a new avatar video using the /v2/video/generate API endpoint.
|
|
212
146
|
|
|
213
147
|
Args:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
|
235
192
|
"""
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
Args:
|
|
239
|
-
id: str. The unique identifier of the template to use for content generation. Required.
|
|
240
|
-
title: str. The title associated with the generated content. Required.
|
|
241
|
-
variables: dict. The variables to substitute into the template. Required.
|
|
242
|
-
test: bool, optional. If set, indicates whether to perform a test generation without committing changes.
|
|
243
|
-
caption: str, optional. Caption to include with the generated content.
|
|
244
|
-
dimension: str or dict, optional. Specifies dimensions or formatting options for generation.
|
|
245
|
-
|
|
246
|
-
Returns:
|
|
247
|
-
dict. The JSON response containing the generated content and metadata from the API.
|
|
248
|
-
|
|
249
|
-
Raises:
|
|
250
|
-
ValueError: If 'id', 'title', or 'variables' are not provided.
|
|
251
|
-
requests.HTTPError: If the API response contains an HTTP error status.
|
|
252
|
-
|
|
253
|
-
Tags:
|
|
254
|
-
generate, template, post, ai
|
|
255
|
-
"""
|
|
256
|
-
if id is None:
|
|
257
|
-
raise ValueError("Missing required parameter 'id'")
|
|
258
|
-
if title is None:
|
|
259
|
-
raise ValueError("Missing required parameter 'title'")
|
|
260
|
-
if variables is None:
|
|
261
|
-
raise ValueError("Missing required parameter 'variables'")
|
|
262
|
-
request_body = {"title": title, "variables": variables, "test": test, "caption": caption, "dimension": dimension}
|
|
263
|
-
request_body = {k: v for k, v in request_body.items() if v is not None}
|
|
264
|
-
url = f"{self.base_url}/v2/template/{id}/generate"
|
|
265
|
-
query_params = {}
|
|
266
|
-
response = await self._apost(url, data=request_body, params=query_params)
|
|
267
|
-
response.raise_for_status()
|
|
268
|
-
return response.json()
|
|
269
|
-
|
|
270
|
-
async def get_v2_video_translate_target_languages(self) -> Any:
|
|
271
|
-
"""
|
|
272
|
-
Retrieves the list of supported target languages for video translation via the v2 API.
|
|
273
|
-
|
|
274
|
-
Args:
|
|
275
|
-
None: This function takes no arguments
|
|
276
|
-
|
|
277
|
-
Returns:
|
|
278
|
-
dict: A JSON-decoded dictionary containing the available target languages for video translation.
|
|
279
|
-
|
|
280
|
-
Raises:
|
|
281
|
-
requests.HTTPError: If the HTTP response indicates an unsuccessful status code.
|
|
282
|
-
|
|
283
|
-
Tags:
|
|
284
|
-
get, list, api, video-translation, languages
|
|
285
|
-
"""
|
|
286
|
-
url = f"{self.base_url}/v2/video_translate/target_languages"
|
|
287
|
-
query_params = {}
|
|
288
|
-
response = await self._aget(url, params=query_params)
|
|
289
|
-
response.raise_for_status()
|
|
290
|
-
return response.json()
|
|
291
|
-
|
|
292
|
-
async def post_v2_video_translate(self, video_url, output_language, title=None, translate_audio_only=None, speaker_num=None) -> Any:
|
|
293
|
-
"""
|
|
294
|
-
Submits a video translation request and returns the API response as JSON.
|
|
295
|
-
|
|
296
|
-
Args:
|
|
297
|
-
video_url: str. The URL of the source video to translate. Must not be None.
|
|
298
|
-
output_language: str. The target language code for translation output. Must not be None.
|
|
299
|
-
title: Optional[str]. The title to assign to the translated video. Defaults to None.
|
|
300
|
-
translate_audio_only: Optional[bool]. If True, only translates audio (not on-screen text). Defaults to None.
|
|
301
|
-
speaker_num: Optional[int]. Number of speakers in the video, if known. Defaults to None.
|
|
302
|
-
|
|
303
|
-
Returns:
|
|
304
|
-
dict. The JSON response from the translation API containing the translation job details or result.
|
|
305
|
-
|
|
306
|
-
Raises:
|
|
307
|
-
ValueError: If 'video_url' or 'output_language' is not provided.
|
|
308
|
-
requests.HTTPError: If the HTTP request to the translation API fails (non-success status code).
|
|
193
|
+
url = f"{self.base_url}/v2/video/generate"
|
|
309
194
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
"
|
|
319
|
-
"
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
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
|
+
}
|
|
323
252
|
}
|
|
324
|
-
request_body = {k: v for k, v in request_body.items() if v is not None}
|
|
325
|
-
url = f"{self.base_url}/v2/video_translate"
|
|
326
|
-
query_params = {}
|
|
327
|
-
response = await self._apost(url, data=request_body, params=query_params)
|
|
328
|
-
response.raise_for_status()
|
|
329
|
-
return response.json()
|
|
330
|
-
|
|
331
|
-
async def get_v2_video_translate_status_by_id(self, id) -> Any:
|
|
332
|
-
"""
|
|
333
|
-
Retrieves the status of a video translation job by its unique identifier.
|
|
334
|
-
|
|
335
|
-
Args:
|
|
336
|
-
id: The unique identifier of the video translation job to check.
|
|
337
|
-
|
|
338
|
-
Returns:
|
|
339
|
-
A dictionary representing the status and details of the video translation job.
|
|
340
|
-
|
|
341
|
-
Raises:
|
|
342
|
-
ValueError: Raised if the 'id' parameter is None.
|
|
343
|
-
HTTPError: Raised if the HTTP request to retrieve the job status fails.
|
|
344
|
-
|
|
345
|
-
Tags:
|
|
346
|
-
get, video-translate, status, ai
|
|
347
|
-
"""
|
|
348
|
-
if id is None:
|
|
349
|
-
raise ValueError("Missing required parameter 'id'")
|
|
350
|
-
url = f"{self.base_url}/v2/video_translate/{id}"
|
|
351
|
-
query_params = {}
|
|
352
|
-
response = await self._aget(url, params=query_params)
|
|
353
|
-
response.raise_for_status()
|
|
354
|
-
return response.json()
|
|
355
|
-
|
|
356
|
-
async def post_streaming_new(self, quality=None) -> Any:
|
|
357
|
-
"""
|
|
358
|
-
Initiates a new streaming session with optional quality parameter and returns the server's JSON response.
|
|
359
|
-
|
|
360
|
-
Args:
|
|
361
|
-
quality: Optional quality setting for the streaming session (type: Any). If None, the default server quality will be used.
|
|
362
|
-
|
|
363
|
-
Returns:
|
|
364
|
-
A JSON-decoded response (type: Any) from the server containing information about the newly created streaming session.
|
|
365
|
-
|
|
366
|
-
Raises:
|
|
367
|
-
requests.HTTPError: If the HTTP request to start the streaming session fails or returns a non-success status code.
|
|
368
|
-
|
|
369
|
-
Tags:
|
|
370
|
-
post, streaming, async-job, start, api
|
|
371
|
-
"""
|
|
372
|
-
request_body = {"quality": quality}
|
|
373
|
-
request_body = {k: v for k, v in request_body.items() if v is not None}
|
|
374
|
-
url = f"{self.base_url}/v1/streaming.new"
|
|
375
|
-
query_params = {}
|
|
376
|
-
response = await self._apost(url, data=request_body, params=query_params)
|
|
377
|
-
response.raise_for_status()
|
|
378
|
-
return response.json()
|
|
379
|
-
|
|
380
|
-
async def get_streaming_list(self) -> Any:
|
|
381
|
-
"""
|
|
382
|
-
Retrieves the list of available streaming resources from the remote API.
|
|
383
|
-
|
|
384
|
-
Args:
|
|
385
|
-
None: This function takes no arguments
|
|
386
|
-
|
|
387
|
-
Returns:
|
|
388
|
-
The parsed JSON response containing the list of streaming resources.
|
|
389
|
-
|
|
390
|
-
Raises:
|
|
391
|
-
requests.HTTPError: If the HTTP request to the streaming list endpoint fails or returns an error status code.
|
|
392
|
-
|
|
393
|
-
Tags:
|
|
394
|
-
get, list, streaming, api
|
|
395
|
-
"""
|
|
396
|
-
url = f"{self.base_url}/v1/streaming.list"
|
|
397
|
-
query_params = {}
|
|
398
|
-
response = await self._aget(url, params=query_params)
|
|
399
|
-
response.raise_for_status()
|
|
400
|
-
return response.json()
|
|
401
|
-
|
|
402
|
-
async def post_streaming_ice(self, session_id, candidate) -> Any:
|
|
403
|
-
"""
|
|
404
|
-
Sends an ICE candidate for a streaming session to the server and returns the JSON response.
|
|
405
|
-
|
|
406
|
-
Args:
|
|
407
|
-
session_id: Unique identifier for the streaming session. Must not be None.
|
|
408
|
-
candidate: ICE candidate information to be sent to the server. Must not be None.
|
|
409
|
-
|
|
410
|
-
Returns:
|
|
411
|
-
Parsed JSON response from the server as a Python object.
|
|
412
|
-
|
|
413
|
-
Raises:
|
|
414
|
-
ValueError: Raised if 'session_id' or 'candidate' is None.
|
|
415
|
-
requests.HTTPError: Raised if the HTTP request to the server fails.
|
|
416
|
-
|
|
417
|
-
Tags:
|
|
418
|
-
post, streaming, ice, async-job, ai
|
|
419
|
-
"""
|
|
420
|
-
if session_id is None:
|
|
421
|
-
raise ValueError("Missing required parameter 'session_id'")
|
|
422
|
-
if candidate is None:
|
|
423
|
-
raise ValueError("Missing required parameter 'candidate'")
|
|
424
|
-
request_body = {"session_id": session_id, "candidate": candidate}
|
|
425
|
-
request_body = {k: v for k, v in request_body.items() if v is not None}
|
|
426
|
-
url = f"{self.base_url}/v1/streaming.ice"
|
|
427
|
-
query_params = {}
|
|
428
|
-
response = await self._apost(url, data=request_body, params=query_params)
|
|
429
|
-
response.raise_for_status()
|
|
430
|
-
return response.json()
|
|
431
|
-
|
|
432
|
-
async def post_streaming_task(self, session_id, text) -> Any:
|
|
433
|
-
"""
|
|
434
|
-
Submits a streaming task for the specified session and text input, returning the response from the remote API.
|
|
435
|
-
|
|
436
|
-
Args:
|
|
437
|
-
session_id: The unique identifier for the streaming session. Must not be None.
|
|
438
|
-
text: The text content to be processed in the streaming task. Must not be None.
|
|
439
|
-
|
|
440
|
-
Returns:
|
|
441
|
-
The parsed JSON response from the streaming task API call.
|
|
442
|
-
|
|
443
|
-
Raises:
|
|
444
|
-
ValueError: If either 'session_id' or 'text' is None.
|
|
445
|
-
requests.HTTPError: If the API request fails or returns an unsuccessful status code.
|
|
446
|
-
|
|
447
|
-
Tags:
|
|
448
|
-
post, streaming-task, api, start
|
|
449
|
-
"""
|
|
450
|
-
if session_id is None:
|
|
451
|
-
raise ValueError("Missing required parameter 'session_id'")
|
|
452
|
-
if text is None:
|
|
453
|
-
raise ValueError("Missing required parameter 'text'")
|
|
454
|
-
request_body = {"session_id": session_id, "text": text}
|
|
455
|
-
request_body = {k: v for k, v in request_body.items() if v is not None}
|
|
456
|
-
url = f"{self.base_url}/v1/streaming.task"
|
|
457
|
-
query_params = {}
|
|
458
|
-
response = await self._apost(url, data=request_body, params=query_params)
|
|
459
|
-
response.raise_for_status()
|
|
460
|
-
return response.json()
|
|
461
|
-
|
|
462
|
-
async def post_streaming_stop(self, session_id) -> Any:
|
|
463
|
-
"""
|
|
464
|
-
Stops an ongoing streaming session by sending a stop request for the specified session ID.
|
|
465
|
-
|
|
466
|
-
Args:
|
|
467
|
-
session_id: The unique identifier of the streaming session to be stopped.
|
|
468
|
-
|
|
469
|
-
Returns:
|
|
470
|
-
The parsed JSON response from the stop request, typically containing the status or result of the streaming stop operation.
|
|
471
|
-
|
|
472
|
-
Raises:
|
|
473
|
-
ValueError: If 'session_id' is None.
|
|
474
|
-
requests.HTTPError: If the HTTP request to stop the streaming session fails or returns an error response.
|
|
475
|
-
|
|
476
|
-
Tags:
|
|
477
|
-
stop, streaming, management, async-job
|
|
478
|
-
"""
|
|
479
|
-
if session_id is None:
|
|
480
|
-
raise ValueError("Missing required parameter 'session_id'")
|
|
481
|
-
request_body = {"session_id": session_id}
|
|
482
|
-
request_body = {k: v for k, v in request_body.items() if v is not None}
|
|
483
|
-
url = f"{self.base_url}/v1/streaming.stop"
|
|
484
|
-
query_params = {}
|
|
485
|
-
response = await self._apost(url, data=request_body, params=query_params)
|
|
486
|
-
response.raise_for_status()
|
|
487
|
-
return response.json()
|
|
488
|
-
|
|
489
|
-
async def post_streaming_interrupt(self, session_id) -> Any:
|
|
490
|
-
"""
|
|
491
|
-
Sends a request to interrupt an active streaming session identified by the given session ID.
|
|
492
|
-
|
|
493
|
-
Args:
|
|
494
|
-
session_id: The unique identifier of the streaming session to be interrupted.
|
|
495
|
-
|
|
496
|
-
Returns:
|
|
497
|
-
A dictionary containing the server's response to the interrupt request.
|
|
498
|
-
|
|
499
|
-
Raises:
|
|
500
|
-
ValueError: Raised if 'session_id' is None.
|
|
501
|
-
requests.HTTPError: Raised if the HTTP request to interrupt the session fails.
|
|
502
253
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
Returns:
|
|
524
|
-
dict: The JSON response from the API containing the new streaming token and related metadata.
|
|
525
|
-
|
|
526
|
-
Raises:
|
|
527
|
-
requests.exceptions.HTTPError: If the HTTP request returned an unsuccessful status code.
|
|
528
|
-
|
|
529
|
-
Tags:
|
|
530
|
-
create, streaming, token, api
|
|
531
|
-
"""
|
|
532
|
-
request_body = {"expiry": expiry}
|
|
533
|
-
request_body = {k: v for k, v in request_body.items() if v is not None}
|
|
534
|
-
url = f"{self.base_url}/v1/streaming.create_token"
|
|
535
|
-
query_params = {}
|
|
536
|
-
response = await self._apost(url, data=request_body, params=query_params)
|
|
537
|
-
response.raise_for_status()
|
|
538
|
-
return response.json()
|
|
539
|
-
|
|
540
|
-
async def get_streaming_avatar_list(self) -> Any:
|
|
541
|
-
"""
|
|
542
|
-
Retrieves a list of available streaming avatars from the API endpoint.
|
|
543
|
-
|
|
544
|
-
Args:
|
|
545
|
-
None: This function takes no arguments
|
|
546
|
-
|
|
547
|
-
Returns:
|
|
548
|
-
A JSON-decoded object representing the list of streaming avatars.
|
|
549
|
-
|
|
550
|
-
Raises:
|
|
551
|
-
requests.exceptions.HTTPError: If the HTTP request to the streaming avatar endpoint returns an unsuccessful status code.
|
|
552
|
-
|
|
553
|
-
Tags:
|
|
554
|
-
list, streaming, avatar, api
|
|
555
|
-
"""
|
|
556
|
-
url = f"{self.base_url}/v1/streaming/avatar.list"
|
|
557
|
-
query_params = {}
|
|
558
|
-
response = await self._aget(url, params=query_params)
|
|
559
|
-
response.raise_for_status()
|
|
560
|
-
return response.json()
|
|
561
|
-
|
|
562
|
-
async def get_v1_webhook_list(self) -> Any:
|
|
563
|
-
"""
|
|
564
|
-
Retrieves a list of all registered webhooks via the v1 API endpoint.
|
|
565
|
-
|
|
566
|
-
Args:
|
|
567
|
-
None: This function takes no arguments
|
|
568
|
-
|
|
569
|
-
Returns:
|
|
570
|
-
The parsed JSON response containing webhook list data.
|
|
571
|
-
|
|
572
|
-
Raises:
|
|
573
|
-
requests.HTTPError: If the HTTP request fails or an error response is returned from the server.
|
|
574
|
-
|
|
575
|
-
Tags:
|
|
576
|
-
list, webhook, api, management
|
|
577
|
-
"""
|
|
578
|
-
url = f"{self.base_url}/v1/webhook/webhook.list"
|
|
579
|
-
query_params = {}
|
|
580
|
-
response = await self._aget(url, params=query_params)
|
|
581
|
-
response.raise_for_status()
|
|
582
|
-
return response.json()
|
|
583
|
-
|
|
584
|
-
async def post_v1_webhook_endpoint_add(self, url, events) -> Any:
|
|
585
|
-
"""
|
|
586
|
-
Registers a new webhook endpoint with the specified URL and events.
|
|
587
|
-
|
|
588
|
-
Args:
|
|
589
|
-
url: str. The callback URL where webhook notifications will be sent. Must not be None.
|
|
590
|
-
events: list. A list of event types to subscribe the webhook to. Must not be None.
|
|
591
|
-
|
|
592
|
-
Returns:
|
|
593
|
-
dict. The JSON response from the API containing details about the created webhook endpoint.
|
|
594
|
-
|
|
595
|
-
Raises:
|
|
596
|
-
ValueError: Raised if the 'url' or 'events' parameter is None.
|
|
597
|
-
requests.HTTPError: Raised if the HTTP request to the endpoint fails.
|
|
598
|
-
|
|
599
|
-
Tags:
|
|
600
|
-
add, webhook, endpoint, api
|
|
601
|
-
"""
|
|
602
|
-
if url is None:
|
|
603
|
-
raise ValueError("Missing required parameter 'url'")
|
|
604
|
-
if events is None:
|
|
605
|
-
raise ValueError("Missing required parameter 'events'")
|
|
606
|
-
request_body = {"url": url, "events": events}
|
|
607
|
-
request_body = {k: v for k, v in request_body.items() if v is not None}
|
|
608
|
-
url = f"{self.base_url}/v1/webhook/endpoint.add"
|
|
609
|
-
query_params = {}
|
|
610
|
-
response = await self._apost(url, data=request_body, params=query_params)
|
|
611
|
-
response.raise_for_status()
|
|
612
|
-
return response.json()
|
|
613
|
-
|
|
614
|
-
async def delete_v1_webhook_endpoint_by_id(self, endpoint_id) -> Any:
|
|
615
|
-
"""
|
|
616
|
-
Deletes a webhook endpoint identified by its ID via a DELETE request to the v1 API.
|
|
617
|
-
|
|
618
|
-
Args:
|
|
619
|
-
endpoint_id: The unique identifier of the webhook endpoint to delete. Must not be None.
|
|
620
|
-
|
|
621
|
-
Returns:
|
|
622
|
-
The response payload parsed as JSON from the DELETE request.
|
|
623
|
-
|
|
624
|
-
Raises:
|
|
625
|
-
ValueError: If the 'endpoint_id' parameter is None.
|
|
626
|
-
requests.HTTPError: If the DELETE request returns an unsuccessful HTTP status code.
|
|
627
|
-
|
|
628
|
-
Tags:
|
|
629
|
-
delete, webhook, endpoint, api
|
|
630
|
-
"""
|
|
631
|
-
if endpoint_id is None:
|
|
632
|
-
raise ValueError("Missing required parameter 'endpoint_id'")
|
|
633
|
-
url = f"{self.base_url}/v1/webhook/endpoint.delete/{endpoint_id}"
|
|
634
|
-
query_params = {}
|
|
635
|
-
response = await self._adelete(url, params=query_params)
|
|
636
|
-
response.raise_for_status()
|
|
637
|
-
return response.json()
|
|
638
|
-
|
|
639
|
-
async def get_v1_webhook_endpoint_list(self) -> Any:
|
|
640
|
-
"""
|
|
641
|
-
Retrieves a list of webhook endpoints from the v1 API.
|
|
642
|
-
|
|
643
|
-
Args:
|
|
644
|
-
None: This function takes no arguments
|
|
645
|
-
|
|
646
|
-
Returns:
|
|
647
|
-
A JSON-compatible object containing the list of webhook endpoints.
|
|
648
|
-
|
|
649
|
-
Raises:
|
|
650
|
-
requests.HTTPError: If the HTTP request to the webhook endpoint API fails or returns an unsuccessful status code.
|
|
651
|
-
|
|
652
|
-
Tags:
|
|
653
|
-
get, list, webhook, endpoint, api
|
|
654
|
-
"""
|
|
655
|
-
url = f"{self.base_url}/v1/webhook/endpoint.list"
|
|
656
|
-
query_params = {}
|
|
657
|
-
response = await self._aget(url, params=query_params)
|
|
658
|
-
response.raise_for_status()
|
|
659
|
-
return response.json()
|
|
660
|
-
|
|
661
|
-
async def get_v1_talking_photo_list(self) -> Any:
|
|
662
|
-
"""
|
|
663
|
-
Retrieves the list of talking photos from the v1 API endpoint.
|
|
664
|
-
|
|
665
|
-
Args:
|
|
666
|
-
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
|
+
}
|
|
667
274
|
|
|
668
|
-
|
|
669
|
-
|
|
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
|
|
670
279
|
|
|
671
|
-
|
|
672
|
-
|
|
280
|
+
response = await self._apost(url=url, data=payload)
|
|
281
|
+
return self._handle_response(response)
|
|
673
282
|
|
|
674
|
-
|
|
675
|
-
|
|
283
|
+
async def get_video_status(
|
|
284
|
+
self,
|
|
285
|
+
video_id: str
|
|
286
|
+
) -> Any:
|
|
676
287
|
"""
|
|
677
|
-
|
|
678
|
-
query_params = {}
|
|
679
|
-
response = await self._aget(url, params=query_params)
|
|
680
|
-
response.raise_for_status()
|
|
681
|
-
return response.json()
|
|
682
|
-
|
|
683
|
-
async def delete_v2_talking_photo_by_id(self, id) -> Any:
|
|
684
|
-
"""
|
|
685
|
-
Deletes a v2 talking photo resource identified by its unique ID.
|
|
288
|
+
Retrieves the status and details of a specific video by ID using the /v1/video_status.get endpoint.
|
|
686
289
|
|
|
687
290
|
Args:
|
|
688
|
-
|
|
291
|
+
video_id: The unique identifier of the video.
|
|
689
292
|
|
|
690
293
|
Returns:
|
|
691
|
-
|
|
294
|
+
A JSON-decoded object containing the video status and details (e.g., status, video_url).
|
|
692
295
|
|
|
693
296
|
Raises:
|
|
694
|
-
|
|
695
|
-
HTTPError: Raised if the HTTP request fails with an error status code.
|
|
297
|
+
requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
|
|
696
298
|
|
|
697
299
|
Tags:
|
|
698
|
-
|
|
699
|
-
"""
|
|
700
|
-
if id is None:
|
|
701
|
-
raise ValueError("Missing required parameter 'id'")
|
|
702
|
-
url = f"{self.base_url}/v2/talking_photo/{id}"
|
|
703
|
-
query_params = {}
|
|
704
|
-
response = await self._adelete(url, params=query_params)
|
|
705
|
-
response.raise_for_status()
|
|
706
|
-
return response.json()
|
|
707
|
-
|
|
708
|
-
async def post_personalized_video_add_contact(self, project_id, variables_list) -> Any:
|
|
300
|
+
get, video, status, api
|
|
709
301
|
"""
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
Raises:
|
|
720
|
-
ValueError: Raised if either 'project_id' or 'variables_list' is None.
|
|
721
|
-
requests.HTTPError: Raised if the HTTP request fails or returns an error status code.
|
|
302
|
+
url = f"{self.base_url}/v1/video_status.get"
|
|
303
|
+
|
|
304
|
+
params = {
|
|
305
|
+
"video_id": video_id
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
response = await self._aget(url=url, params=params)
|
|
309
|
+
return self._handle_response(response)
|
|
722
310
|
|
|
723
|
-
|
|
724
|
-
|
|
311
|
+
async def create_folder(
|
|
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
|
|
324
|
+
) -> Any:
|
|
725
325
|
"""
|
|
726
|
-
|
|
727
|
-
raise ValueError("Missing required parameter 'project_id'")
|
|
728
|
-
if variables_list is None:
|
|
729
|
-
raise ValueError("Missing required parameter 'variables_list'")
|
|
730
|
-
request_body = {"project_id": project_id, "variables_list": variables_list}
|
|
731
|
-
request_body = {k: v for k, v in request_body.items() if v is not None}
|
|
732
|
-
url = f"{self.base_url}/v1/personalized_video/add_contact"
|
|
733
|
-
query_params = {}
|
|
734
|
-
response = await self._apost(url, data=request_body, params=query_params)
|
|
735
|
-
response.raise_for_status()
|
|
736
|
-
return response.json()
|
|
737
|
-
|
|
738
|
-
async def get_personalized_video_audience_detail(self, id=None) -> Any:
|
|
739
|
-
"""
|
|
740
|
-
Retrieves detailed information about a personalized video audience by ID.
|
|
326
|
+
Creates a new folder under your account using the /v1/folders/create endpoint.
|
|
741
327
|
|
|
742
328
|
Args:
|
|
743
|
-
|
|
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.
|
|
744
333
|
|
|
745
334
|
Returns:
|
|
746
|
-
A JSON-decoded
|
|
335
|
+
A JSON-decoded object containing the created folder details.
|
|
747
336
|
|
|
748
337
|
Raises:
|
|
749
|
-
requests.HTTPError: If the HTTP request
|
|
338
|
+
requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
|
|
750
339
|
|
|
751
340
|
Tags:
|
|
752
|
-
|
|
341
|
+
create, folder, api
|
|
753
342
|
"""
|
|
754
|
-
url = f"{self.base_url}/v1/
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
343
|
+
url = f"{self.base_url}/v1/folders/create"
|
|
344
|
+
|
|
345
|
+
payload = {
|
|
346
|
+
"name": name,
|
|
347
|
+
"project_type": project_type
|
|
348
|
+
}
|
|
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)
|
|
759
355
|
|
|
760
|
-
async def
|
|
356
|
+
async def list_folders(
|
|
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
|
|
363
|
+
) -> Any:
|
|
761
364
|
"""
|
|
762
|
-
Retrieves
|
|
365
|
+
Retrieves a paginated list of folders created under your account using the /v1/folders endpoint.
|
|
763
366
|
|
|
764
367
|
Args:
|
|
765
|
-
|
|
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.
|
|
766
373
|
|
|
767
374
|
Returns:
|
|
768
|
-
A JSON-decoded
|
|
375
|
+
A JSON-decoded object containing the list of folders and pagination info.
|
|
769
376
|
|
|
770
377
|
Raises:
|
|
771
|
-
requests.HTTPError: If the HTTP request
|
|
378
|
+
requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
|
|
772
379
|
|
|
773
380
|
Tags:
|
|
774
|
-
|
|
381
|
+
list, folders, api
|
|
775
382
|
"""
|
|
776
|
-
url = f"{self.base_url}/v1/
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
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)
|
|
781
400
|
|
|
782
|
-
async def
|
|
401
|
+
async def update_folder(
|
|
402
|
+
self,
|
|
403
|
+
folder_id: str,
|
|
404
|
+
name: str
|
|
405
|
+
) -> Any:
|
|
783
406
|
"""
|
|
784
|
-
|
|
407
|
+
Updates the name of an existing folder using the /v1/folders/{folder_id} endpoint.
|
|
785
408
|
|
|
786
409
|
Args:
|
|
787
|
-
|
|
410
|
+
folder_id: The unique identifier of the folder to update.
|
|
411
|
+
name: The new name for the folder.
|
|
788
412
|
|
|
789
413
|
Returns:
|
|
790
|
-
|
|
414
|
+
A JSON-decoded object containing the updated folder details.
|
|
791
415
|
|
|
792
416
|
Raises:
|
|
793
|
-
requests.HTTPError: If the HTTP request
|
|
417
|
+
requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
|
|
794
418
|
|
|
795
419
|
Tags:
|
|
796
|
-
|
|
420
|
+
update, folder, api
|
|
797
421
|
"""
|
|
798
|
-
url = f"{self.base_url}/
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
422
|
+
url = f"{self.base_url}/v1/folders/{folder_id}"
|
|
423
|
+
payload = {
|
|
424
|
+
"name": name
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
response = await self._apost(url=url, data=payload)
|
|
428
|
+
return self._handle_response(response)
|
|
803
429
|
|
|
804
|
-
async def
|
|
430
|
+
async def trash_folder(
|
|
431
|
+
self,
|
|
432
|
+
folder_id: str
|
|
433
|
+
) -> Any:
|
|
805
434
|
"""
|
|
806
|
-
|
|
435
|
+
Deletes (trashes) a specific folder by its unique folder ID using the /v1/folders/{folder_id}/trash endpoint.
|
|
807
436
|
|
|
808
437
|
Args:
|
|
809
|
-
|
|
438
|
+
folder_id: The unique identifier of the folder to move to trash.
|
|
810
439
|
|
|
811
440
|
Returns:
|
|
812
|
-
|
|
441
|
+
A JSON-decoded object confirming the action.
|
|
813
442
|
|
|
814
443
|
Raises:
|
|
815
|
-
requests.HTTPError: If the HTTP request
|
|
444
|
+
requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
|
|
816
445
|
|
|
817
446
|
Tags:
|
|
818
|
-
|
|
447
|
+
delete, trash, folder, api
|
|
819
448
|
"""
|
|
820
|
-
url = f"{self.base_url}/v1/
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
response.raise_for_status()
|
|
824
|
-
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)
|
|
825
452
|
|
|
826
|
-
async def
|
|
453
|
+
async def restore_folder(
|
|
454
|
+
self,
|
|
455
|
+
folder_id: str
|
|
456
|
+
) -> Any:
|
|
827
457
|
"""
|
|
828
|
-
|
|
458
|
+
Restores a previously deleted folder using the /v1/folders/{folder_id}/restore endpoint.
|
|
829
459
|
|
|
830
460
|
Args:
|
|
831
|
-
|
|
461
|
+
folder_id: The unique identifier of the folder to restore.
|
|
832
462
|
|
|
833
463
|
Returns:
|
|
834
|
-
A JSON-decoded object
|
|
464
|
+
A JSON-decoded object confirming the action.
|
|
835
465
|
|
|
836
466
|
Raises:
|
|
837
|
-
requests.HTTPError:
|
|
467
|
+
requests.exceptions.HTTPError: If the HTTP request returns an unsuccessful status code.
|
|
838
468
|
|
|
839
469
|
Tags:
|
|
840
|
-
|
|
470
|
+
restore, folder, api
|
|
841
471
|
"""
|
|
842
|
-
url = f"{self.base_url}/v1/
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
response.raise_for_status()
|
|
846
|
-
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)
|
|
847
475
|
|
|
848
476
|
def list_tools(self):
|
|
849
477
|
return [
|
|
850
|
-
self.get_v1_voice_list,
|
|
851
|
-
self.get_v1_avatar_list,
|
|
852
|
-
self.get_v2_voices,
|
|
853
478
|
self.get_v2_avatars,
|
|
854
|
-
self.
|
|
855
|
-
self.
|
|
856
|
-
self.
|
|
857
|
-
self.
|
|
858
|
-
self.
|
|
859
|
-
self.
|
|
860
|
-
self.
|
|
861
|
-
self.
|
|
862
|
-
self.
|
|
863
|
-
self.
|
|
864
|
-
self.get_streaming_list,
|
|
865
|
-
self.post_streaming_ice,
|
|
866
|
-
self.post_streaming_task,
|
|
867
|
-
self.post_streaming_stop,
|
|
868
|
-
self.post_streaming_interrupt,
|
|
869
|
-
self.post_streaming_create_token,
|
|
870
|
-
self.get_streaming_avatar_list,
|
|
871
|
-
self.get_v1_webhook_list,
|
|
872
|
-
self.post_v1_webhook_endpoint_add,
|
|
873
|
-
self.delete_v1_webhook_endpoint_by_id,
|
|
874
|
-
self.get_v1_webhook_endpoint_list,
|
|
875
|
-
self.get_v1_talking_photo_list,
|
|
876
|
-
self.delete_v2_talking_photo_by_id,
|
|
877
|
-
self.post_personalized_video_add_contact,
|
|
878
|
-
self.get_personalized_video_audience_detail,
|
|
879
|
-
self.get_personalized_video_project_detail,
|
|
880
|
-
self.get_v2_user_remaining_quota,
|
|
881
|
-
self.post_v1_asset_upload,
|
|
882
|
-
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,
|
|
883
489
|
]
|