@wave-av/sdk 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +27 -23
  3. package/dist/audience.js +93 -0
  4. package/dist/audience.mjs +9 -0
  5. package/dist/camera-control.js +95 -0
  6. package/dist/camera-control.mjs +71 -0
  7. package/dist/captions-types.js +18 -0
  8. package/dist/captions-types.mjs +0 -0
  9. package/dist/captions.js +266 -0
  10. package/dist/captions.mjs +9 -0
  11. package/dist/chapters-types.js +18 -0
  12. package/dist/chapters-types.mjs +0 -0
  13. package/dist/chapters.js +280 -0
  14. package/dist/chapters.mjs +9 -0
  15. package/dist/chunk-362MRITF.mjs +46 -0
  16. package/dist/chunk-3ZLK4J3V.mjs +69 -0
  17. package/dist/chunk-4DG4OBRD.mjs +52 -0
  18. package/dist/chunk-4G7FMCMJ.mjs +68 -0
  19. package/dist/chunk-4KD5F6E3.mjs +0 -0
  20. package/dist/chunk-7M6XVUUK.mjs +241 -0
  21. package/dist/chunk-A344OOT7.mjs +243 -0
  22. package/dist/chunk-AI64YR5W.mjs +173 -0
  23. package/dist/chunk-C2GQ756E.mjs +57 -0
  24. package/dist/chunk-CO2VB72Z.mjs +255 -0
  25. package/dist/chunk-DWXWAILB.mjs +44 -0
  26. package/dist/chunk-FLEFYLDM.mjs +71 -0
  27. package/dist/chunk-H2YYTNUH.mjs +266 -0
  28. package/dist/chunk-IGDBED5P.mjs +246 -0
  29. package/dist/chunk-IL2SGWBC.mjs +0 -0
  30. package/dist/chunk-IVFZ5X4W.mjs +68 -0
  31. package/dist/chunk-JC32PG3T.mjs +114 -0
  32. package/dist/chunk-K5X42NLD.mjs +54 -0
  33. package/dist/chunk-KCEPNS2U.mjs +276 -0
  34. package/dist/chunk-LVOVF6XC.mjs +54 -0
  35. package/dist/chunk-M4Z33V3N.mjs +247 -0
  36. package/dist/chunk-M6FKIX75.mjs +0 -0
  37. package/dist/chunk-M744Z327.mjs +244 -0
  38. package/dist/chunk-MRFDPPFK.mjs +61 -0
  39. package/dist/chunk-MXU3Q23F.mjs +68 -0
  40. package/dist/chunk-NCVUZ746.mjs +60 -0
  41. package/dist/chunk-NLQVD2LF.mjs +210 -0
  42. package/dist/chunk-O6DOGYP5.mjs +238 -0
  43. package/dist/chunk-S25NY5GE.mjs +124 -0
  44. package/dist/chunk-TFHXBICQ.mjs +305 -0
  45. package/dist/chunk-TXWOA2VR.mjs +57 -0
  46. package/dist/chunk-UCDSNV22.mjs +63 -0
  47. package/dist/chunk-V5DWA5P4.mjs +279 -0
  48. package/dist/chunk-VLQQDYGP.mjs +173 -0
  49. package/dist/chunk-VPKZUXZW.mjs +53 -0
  50. package/dist/chunk-WS3PEFYJ.mjs +60 -0
  51. package/dist/chunk-XGAYMWRH.mjs +74 -0
  52. package/dist/chunk-XMM5J57W.mjs +0 -0
  53. package/dist/chunk-XWABBOSX.mjs +278 -0
  54. package/dist/chunk-Y6FXYEAI.mjs +10 -0
  55. package/dist/chunk-YBLXHI3M.mjs +257 -0
  56. package/dist/chunk-YEK26SSO.mjs +100 -0
  57. package/dist/chunk-YLCQKCZL.mjs +0 -0
  58. package/dist/chunk-YRKO4XI7.mjs +0 -0
  59. package/dist/chunk-ZJO7AP4Q.mjs +0 -0
  60. package/dist/client-types.js +18 -0
  61. package/dist/client-types.mjs +0 -0
  62. package/dist/client.js +311 -0
  63. package/dist/client.mjs +14 -0
  64. package/dist/clips-types.js +18 -0
  65. package/dist/clips-types.mjs +0 -0
  66. package/dist/clips.js +198 -0
  67. package/dist/clips.mjs +9 -0
  68. package/dist/cloud-switcher.js +80 -0
  69. package/dist/cloud-switcher.mjs +56 -0
  70. package/dist/collab-types.js +18 -0
  71. package/dist/collab-types.mjs +1 -0
  72. package/dist/collab.js +304 -0
  73. package/dist/collab.mjs +10 -0
  74. package/dist/connect.js +85 -0
  75. package/dist/connect.mjs +9 -0
  76. package/dist/creator.js +79 -0
  77. package/dist/creator.mjs +9 -0
  78. package/dist/desktop.js +77 -0
  79. package/dist/desktop.mjs +9 -0
  80. package/dist/distribution.js +88 -0
  81. package/dist/distribution.mjs +9 -0
  82. package/dist/drm.js +85 -0
  83. package/dist/drm.mjs +9 -0
  84. package/dist/edge.js +93 -0
  85. package/dist/edge.mjs +9 -0
  86. package/dist/editor-types.js +18 -0
  87. package/dist/editor-types.mjs +1 -0
  88. package/dist/editor.js +330 -0
  89. package/dist/editor.mjs +10 -0
  90. package/dist/fleet.js +149 -0
  91. package/dist/fleet.mjs +9 -0
  92. package/dist/ghost.js +139 -0
  93. package/dist/ghost.mjs +9 -0
  94. package/dist/index.js +0 -250
  95. package/dist/index.mjs +161 -5445
  96. package/dist/marketplace.js +82 -0
  97. package/dist/marketplace.mjs +9 -0
  98. package/dist/mesh.js +198 -0
  99. package/dist/mesh.mjs +9 -0
  100. package/dist/notifications.js +79 -0
  101. package/dist/notifications.mjs +9 -0
  102. package/dist/phone-types.js +18 -0
  103. package/dist/phone-types.mjs +0 -0
  104. package/dist/phone.js +269 -0
  105. package/dist/phone.mjs +9 -0
  106. package/dist/pipeline-types.js +18 -0
  107. package/dist/pipeline-types.mjs +0 -0
  108. package/dist/pipeline.js +263 -0
  109. package/dist/pipeline.mjs +9 -0
  110. package/dist/podcast.js +94 -0
  111. package/dist/podcast.mjs +9 -0
  112. package/dist/prism.js +82 -0
  113. package/dist/prism.mjs +9 -0
  114. package/dist/prompter.js +99 -0
  115. package/dist/prompter.mjs +76 -0
  116. package/dist/pulse.js +99 -0
  117. package/dist/pulse.mjs +9 -0
  118. package/dist/qr.js +71 -0
  119. package/dist/qr.mjs +9 -0
  120. package/dist/replay.js +62 -0
  121. package/dist/replay.mjs +38 -0
  122. package/dist/scene-types.js +18 -0
  123. package/dist/scene-types.mjs +1 -0
  124. package/dist/scene.js +271 -0
  125. package/dist/scene.mjs +10 -0
  126. package/dist/search-types.js +18 -0
  127. package/dist/search-types.mjs +1 -0
  128. package/dist/search.js +268 -0
  129. package/dist/search.mjs +10 -0
  130. package/dist/sentiment-types.js +18 -0
  131. package/dist/sentiment-types.mjs +0 -0
  132. package/dist/sentiment.js +235 -0
  133. package/dist/sentiment.mjs +9 -0
  134. package/dist/signage.js +93 -0
  135. package/dist/signage.mjs +9 -0
  136. package/dist/slides.js +78 -0
  137. package/dist/slides.mjs +9 -0
  138. package/dist/studio-ai-types.js +18 -0
  139. package/dist/studio-ai-types.mjs +1 -0
  140. package/dist/studio-ai.js +301 -0
  141. package/dist/studio-ai.mjs +10 -0
  142. package/dist/studio-types.js +18 -0
  143. package/dist/studio-types.mjs +1 -0
  144. package/dist/studio.js +303 -0
  145. package/dist/studio.mjs +10 -0
  146. package/dist/telemetry.js +124 -0
  147. package/dist/telemetry.mjs +15 -0
  148. package/dist/transcribe-types.js +18 -0
  149. package/dist/transcribe-types.mjs +1 -0
  150. package/dist/transcribe.js +282 -0
  151. package/dist/transcribe.mjs +10 -0
  152. package/dist/usb.js +69 -0
  153. package/dist/usb.mjs +9 -0
  154. package/dist/vault.js +96 -0
  155. package/dist/vault.mjs +9 -0
  156. package/dist/voice-types.js +18 -0
  157. package/dist/voice-types.mjs +0 -0
  158. package/dist/voice.js +272 -0
  159. package/dist/voice.mjs +9 -0
  160. package/dist/zoom.js +86 -0
  161. package/dist/zoom.mjs +9 -0
  162. package/package.json +3 -3
@@ -0,0 +1,54 @@
1
+ // src/notifications.ts
2
+ var NotificationsAPI = class {
3
+ client;
4
+ basePath = "/v1/notifications";
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /** List notifications with optional filters. */
9
+ async list(params) {
10
+ return this.client.get(this.basePath, {
11
+ params
12
+ });
13
+ }
14
+ /** Get a single notification by ID. */
15
+ async get(notificationId) {
16
+ return this.client.get(`${this.basePath}/${notificationId}`);
17
+ }
18
+ /** Mark a notification as read. */
19
+ async markAsRead(notificationId) {
20
+ return this.client.post(`${this.basePath}/${notificationId}/read`);
21
+ }
22
+ /** Mark all notifications as read. */
23
+ async markAllRead() {
24
+ return this.client.post(`${this.basePath}/mark-all-read`);
25
+ }
26
+ /** Archive a notification. */
27
+ async archive(notificationId) {
28
+ return this.client.post(`${this.basePath}/${notificationId}/archive`);
29
+ }
30
+ /** Delete a notification. */
31
+ async remove(notificationId) {
32
+ await this.client.delete(`${this.basePath}/${notificationId}`);
33
+ }
34
+ /** Get unread count. */
35
+ async getUnreadCount() {
36
+ return this.client.get(`${this.basePath}/unread-count`);
37
+ }
38
+ /** Get notification preferences. */
39
+ async getPreferences() {
40
+ return this.client.get(`${this.basePath}/preferences`);
41
+ }
42
+ /** Update notification preferences. */
43
+ async updatePreferences(preferences) {
44
+ return this.client.patch(`${this.basePath}/preferences`, preferences);
45
+ }
46
+ };
47
+ function createNotificationsAPI(client) {
48
+ return new NotificationsAPI(client);
49
+ }
50
+
51
+ export {
52
+ NotificationsAPI,
53
+ createNotificationsAPI
54
+ };
@@ -0,0 +1,276 @@
1
+ // src/studio-ai.ts
2
+ var StudioAIAPI = class {
3
+ client;
4
+ basePath = "/v1/studio-ai";
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * Start an AI assistant
10
+ *
11
+ * Requires: studio-ai:create permission
12
+ */
13
+ async startAssistant(request) {
14
+ return this.client.post(`${this.basePath}/assistants`, request);
15
+ }
16
+ /**
17
+ * Get an assistant by ID
18
+ *
19
+ * Requires: studio-ai:read permission
20
+ */
21
+ async getAssistant(assistantId) {
22
+ return this.client.get(`${this.basePath}/assistants/${assistantId}`);
23
+ }
24
+ /**
25
+ * Update an assistant
26
+ *
27
+ * Requires: studio-ai:update permission
28
+ */
29
+ async updateAssistant(assistantId, request) {
30
+ return this.client.patch(
31
+ `${this.basePath}/assistants/${assistantId}`,
32
+ request
33
+ );
34
+ }
35
+ /**
36
+ * Stop an assistant
37
+ *
38
+ * Requires: studio-ai:manage permission
39
+ */
40
+ async stopAssistant(assistantId) {
41
+ return this.client.post(
42
+ `${this.basePath}/assistants/${assistantId}/stop`
43
+ );
44
+ }
45
+ /**
46
+ * Pause an assistant
47
+ *
48
+ * Requires: studio-ai:manage permission
49
+ */
50
+ async pauseAssistant(assistantId) {
51
+ return this.updateAssistant(assistantId, { status: "paused" });
52
+ }
53
+ /**
54
+ * Resume an assistant
55
+ *
56
+ * Requires: studio-ai:manage permission
57
+ */
58
+ async resumeAssistant(assistantId) {
59
+ return this.updateAssistant(assistantId, { status: "active" });
60
+ }
61
+ /**
62
+ * List assistants
63
+ *
64
+ * Requires: studio-ai:read permission
65
+ */
66
+ async listAssistants(params) {
67
+ return this.client.get(
68
+ `${this.basePath}/assistants`,
69
+ { params }
70
+ );
71
+ }
72
+ /**
73
+ * Get assistant statistics
74
+ *
75
+ * Requires: studio-ai:read permission
76
+ */
77
+ async getAssistantStats(assistantId) {
78
+ return this.client.get(
79
+ `${this.basePath}/assistants/${assistantId}/stats`
80
+ );
81
+ }
82
+ /**
83
+ * List suggestions
84
+ *
85
+ * Requires: studio-ai:read permission
86
+ */
87
+ async listSuggestions(params) {
88
+ return this.client.get(
89
+ `${this.basePath}/suggestions`,
90
+ { params }
91
+ );
92
+ }
93
+ /**
94
+ * Get a suggestion by ID
95
+ *
96
+ * Requires: studio-ai:read permission
97
+ */
98
+ async getSuggestion(suggestionId) {
99
+ return this.client.get(
100
+ `${this.basePath}/suggestions/${suggestionId}`
101
+ );
102
+ }
103
+ /**
104
+ * Accept a suggestion
105
+ *
106
+ * Requires: studio-ai:apply permission
107
+ */
108
+ async acceptSuggestion(suggestionId) {
109
+ return this.client.post(
110
+ `${this.basePath}/suggestions/${suggestionId}/accept`
111
+ );
112
+ }
113
+ /**
114
+ * Reject a suggestion
115
+ *
116
+ * Requires: studio-ai:apply permission
117
+ */
118
+ async rejectSuggestion(suggestionId, reason) {
119
+ return this.client.post(
120
+ `${this.basePath}/suggestions/${suggestionId}/reject`,
121
+ { reason }
122
+ );
123
+ }
124
+ /**
125
+ * Apply a suggestion immediately
126
+ *
127
+ * Requires: studio-ai:apply permission
128
+ */
129
+ async applySuggestion(suggestionId) {
130
+ return this.client.post(
131
+ `${this.basePath}/suggestions/${suggestionId}/apply`
132
+ );
133
+ }
134
+ /**
135
+ * Get scene recommendations
136
+ *
137
+ * Requires: studio-ai:read permission
138
+ */
139
+ async getSceneRecommendations(assistantId) {
140
+ return this.client.get(
141
+ `${this.basePath}/assistants/${assistantId}/director/scenes`
142
+ );
143
+ }
144
+ /**
145
+ * Set auto-director rules
146
+ *
147
+ * Requires: studio-ai:update permission
148
+ */
149
+ async setDirectorRules(assistantId, rules) {
150
+ return this.client.post(`${this.basePath}/assistants/${assistantId}/director/rules`, {
151
+ rules
152
+ });
153
+ }
154
+ /**
155
+ * Trigger manual scene switch via AI
156
+ *
157
+ * Requires: studio-ai:apply permission
158
+ */
159
+ async suggestSceneSwitch(assistantId, options) {
160
+ return this.client.post(
161
+ `${this.basePath}/assistants/${assistantId}/director/suggest`,
162
+ options
163
+ );
164
+ }
165
+ /**
166
+ * Get graphics suggestions
167
+ *
168
+ * Requires: studio-ai:read permission
169
+ */
170
+ async getGraphicsSuggestions(assistantId) {
171
+ return this.client.get(
172
+ `${this.basePath}/assistants/${assistantId}/graphics/suggestions`
173
+ );
174
+ }
175
+ /**
176
+ * Generate lower third for speaker
177
+ *
178
+ * Requires: studio-ai:apply permission
179
+ */
180
+ async generateLowerThird(assistantId, speakerInfo) {
181
+ return this.client.post(
182
+ `${this.basePath}/assistants/${assistantId}/graphics/lower-third`,
183
+ speakerInfo
184
+ );
185
+ }
186
+ /**
187
+ * Get audio mix suggestions
188
+ *
189
+ * Requires: studio-ai:read permission
190
+ */
191
+ async getAudioSuggestions(assistantId) {
192
+ return this.client.get(
193
+ `${this.basePath}/assistants/${assistantId}/audio/suggestions`
194
+ );
195
+ }
196
+ /**
197
+ * Auto-level audio sources
198
+ *
199
+ * Requires: studio-ai:apply permission
200
+ */
201
+ async autoLevelAudio(assistantId) {
202
+ return this.client.post(`${this.basePath}/assistants/${assistantId}/audio/auto-level`);
203
+ }
204
+ /**
205
+ * Get moderation alerts
206
+ *
207
+ * Requires: studio-ai:read permission
208
+ */
209
+ async getModerationAlerts(assistantId, params) {
210
+ return this.client.get(
211
+ `${this.basePath}/assistants/${assistantId}/moderation/alerts`,
212
+ { params }
213
+ );
214
+ }
215
+ /**
216
+ * Dismiss a moderation alert
217
+ *
218
+ * Requires: studio-ai:apply permission
219
+ */
220
+ async dismissAlert(assistantId, alertId) {
221
+ await this.client.post(
222
+ `${this.basePath}/assistants/${assistantId}/moderation/alerts/${alertId}/dismiss`
223
+ );
224
+ }
225
+ /**
226
+ * Set moderation sensitivity
227
+ *
228
+ * Requires: studio-ai:update permission
229
+ */
230
+ async setModerationSensitivity(assistantId, settings) {
231
+ return this.client.post(
232
+ `${this.basePath}/assistants/${assistantId}/moderation/sensitivity`,
233
+ settings
234
+ );
235
+ }
236
+ /**
237
+ * Get engagement insights
238
+ *
239
+ * Requires: studio-ai:read permission
240
+ */
241
+ async getEngagementInsights(assistantId, params) {
242
+ return this.client.get(
243
+ `${this.basePath}/assistants/${assistantId}/engagement/insights`,
244
+ { params }
245
+ );
246
+ }
247
+ /**
248
+ * Get optimal interaction times
249
+ *
250
+ * Requires: studio-ai:read permission
251
+ */
252
+ async getOptimalInteractionTimes(assistantId) {
253
+ return this.client.get(
254
+ `${this.basePath}/assistants/${assistantId}/engagement/optimal-times`
255
+ );
256
+ }
257
+ /**
258
+ * Generate engagement suggestion
259
+ *
260
+ * Requires: studio-ai:apply permission
261
+ */
262
+ async generateEngagementAction(assistantId, type) {
263
+ return this.client.post(
264
+ `${this.basePath}/assistants/${assistantId}/engagement/generate`,
265
+ { type }
266
+ );
267
+ }
268
+ };
269
+ function createStudioAIAPI(client) {
270
+ return new StudioAIAPI(client);
271
+ }
272
+
273
+ export {
274
+ StudioAIAPI,
275
+ createStudioAIAPI
276
+ };
@@ -0,0 +1,54 @@
1
+ // src/creator.ts
2
+ var CreatorAPI = class {
3
+ client;
4
+ basePath = "/v1/creators";
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async getProfile(creatorId) {
9
+ return this.client.get(`${this.basePath}/${creatorId}`);
10
+ }
11
+ async updateProfile(creatorId, request) {
12
+ return this.client.patch(`${this.basePath}/${creatorId}`, request);
13
+ }
14
+ async getRevenue(creatorId, params) {
15
+ return this.client.get(`${this.basePath}/${creatorId}/revenue`, {
16
+ params
17
+ });
18
+ }
19
+ async listSubscriptions(creatorId, params) {
20
+ return this.client.get(
21
+ `${this.basePath}/${creatorId}/subscriptions`,
22
+ { params }
23
+ );
24
+ }
25
+ async listTips(creatorId, params) {
26
+ return this.client.get(`${this.basePath}/${creatorId}/tips`, {
27
+ params
28
+ });
29
+ }
30
+ async createTipJar(creatorId, config) {
31
+ return this.client.post(`${this.basePath}/${creatorId}/tip-jar`, config);
32
+ }
33
+ async listPayouts(creatorId, params) {
34
+ return this.client.get(`${this.basePath}/${creatorId}/payouts`, {
35
+ params
36
+ });
37
+ }
38
+ async requestPayout(creatorId, request) {
39
+ return this.client.post(`${this.basePath}/${creatorId}/payouts`, request);
40
+ }
41
+ async getAnalytics(creatorId, params) {
42
+ return this.client.get(`${this.basePath}/${creatorId}/analytics`, {
43
+ params
44
+ });
45
+ }
46
+ };
47
+ function createCreatorAPI(client) {
48
+ return new CreatorAPI(client);
49
+ }
50
+
51
+ export {
52
+ CreatorAPI,
53
+ createCreatorAPI
54
+ };
@@ -0,0 +1,247 @@
1
+ // src/voice.ts
2
+ var VoiceAPI = class {
3
+ client;
4
+ basePath = "/v1/voice";
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ // ==========================================================================
9
+ // Voices
10
+ // ==========================================================================
11
+ /**
12
+ * List available voices
13
+ *
14
+ * Requires: voice:read permission
15
+ */
16
+ async listVoices(params) {
17
+ const queryParams = {
18
+ ...params,
19
+ tags: params?.tags?.join(",")
20
+ };
21
+ return this.client.get(`${this.basePath}/voices`, {
22
+ params: queryParams
23
+ });
24
+ }
25
+ /**
26
+ * Get a voice by ID
27
+ *
28
+ * Requires: voice:read permission
29
+ */
30
+ async getVoice(voiceId) {
31
+ return this.client.get(`${this.basePath}/voices/${voiceId}`);
32
+ }
33
+ /**
34
+ * Get default voice settings for a voice
35
+ *
36
+ * Requires: voice:read permission
37
+ */
38
+ async getVoiceSettings(voiceId) {
39
+ return this.client.get(
40
+ `${this.basePath}/voices/${voiceId}/settings`
41
+ );
42
+ }
43
+ /**
44
+ * Update voice settings for a cloned voice
45
+ *
46
+ * Requires: voice:update permission
47
+ */
48
+ async updateVoiceSettings(voiceId, settings) {
49
+ return this.client.patch(
50
+ `${this.basePath}/voices/${voiceId}/settings`,
51
+ settings
52
+ );
53
+ }
54
+ /**
55
+ * Remove a cloned voice
56
+ *
57
+ * Requires: voice:remove permission (server-side RBAC enforced)
58
+ */
59
+ async removeVoice(voiceId) {
60
+ await this.client.delete(
61
+ `${this.basePath}/voices/${voiceId}`,
62
+ { method: "DELETE" }
63
+ );
64
+ }
65
+ // ==========================================================================
66
+ // Speech Synthesis
67
+ // ==========================================================================
68
+ /**
69
+ * Synthesize text to speech
70
+ *
71
+ * Requires: voice:synthesize permission
72
+ */
73
+ async synthesize(request) {
74
+ return this.client.post(
75
+ `${this.basePath}/synthesize`,
76
+ request
77
+ );
78
+ }
79
+ /**
80
+ * Get synthesis job status
81
+ *
82
+ * Requires: voice:read permission
83
+ */
84
+ async getSynthesis(synthesisId) {
85
+ return this.client.get(
86
+ `${this.basePath}/synthesize/${synthesisId}`
87
+ );
88
+ }
89
+ /**
90
+ * List synthesis jobs
91
+ *
92
+ * Requires: voice:read permission
93
+ */
94
+ async listSyntheses(params) {
95
+ return this.client.get(
96
+ `${this.basePath}/synthesize`,
97
+ { params }
98
+ );
99
+ }
100
+ /**
101
+ * Synthesize speech and stream the audio
102
+ *
103
+ * Requires: voice:synthesize permission
104
+ *
105
+ * @returns ReadableStream of audio data
106
+ */
107
+ async synthesizeStream(request) {
108
+ const response = await fetch(
109
+ `${this.client["config"].baseUrl}${this.basePath}/synthesize/stream`,
110
+ {
111
+ method: "POST",
112
+ headers: {
113
+ "Authorization": `Bearer ${this.client["config"].apiKey}`,
114
+ "Content-Type": "application/json",
115
+ "Accept": "audio/mpeg"
116
+ },
117
+ body: JSON.stringify(request)
118
+ }
119
+ );
120
+ if (!response.ok) {
121
+ throw new Error(`Synthesis stream failed: ${response.statusText}`);
122
+ }
123
+ if (!response.body) {
124
+ throw new Error("No response body");
125
+ }
126
+ return response.body;
127
+ }
128
+ /**
129
+ * Wait for synthesis to complete
130
+ */
131
+ async waitForSynthesis(synthesisId, options) {
132
+ const pollInterval = options?.pollInterval || 1e3;
133
+ const timeout = options?.timeout || 12e4;
134
+ const startTime = Date.now();
135
+ while (Date.now() - startTime < timeout) {
136
+ const synthesis = await this.getSynthesis(synthesisId);
137
+ if (options?.onProgress) {
138
+ options.onProgress(synthesis);
139
+ }
140
+ if (synthesis.status === "ready") {
141
+ return synthesis;
142
+ }
143
+ if (synthesis.status === "failed") {
144
+ throw new Error(`Synthesis failed: ${synthesis.error || "Unknown error"}`);
145
+ }
146
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
147
+ }
148
+ throw new Error(`Synthesis timed out after ${timeout}ms`);
149
+ }
150
+ // ==========================================================================
151
+ // Voice Cloning
152
+ // ==========================================================================
153
+ /**
154
+ * Start voice cloning job
155
+ *
156
+ * Requires: voice:clone permission
157
+ */
158
+ async cloneVoice(request) {
159
+ return this.client.post(
160
+ `${this.basePath}/clone`,
161
+ request
162
+ );
163
+ }
164
+ /**
165
+ * Get voice clone job status
166
+ *
167
+ * Requires: voice:read permission
168
+ */
169
+ async getCloneJob(jobId) {
170
+ return this.client.get(
171
+ `${this.basePath}/clone/${jobId}`
172
+ );
173
+ }
174
+ /**
175
+ * List voice clone jobs
176
+ *
177
+ * Requires: voice:read permission
178
+ */
179
+ async listCloneJobs(params) {
180
+ return this.client.get(
181
+ `${this.basePath}/clone`,
182
+ { params }
183
+ );
184
+ }
185
+ /**
186
+ * Cancel a voice clone job
187
+ *
188
+ * Requires: voice:clone permission
189
+ */
190
+ async cancelCloneJob(jobId) {
191
+ return this.client.post(
192
+ `${this.basePath}/clone/${jobId}/cancel`
193
+ );
194
+ }
195
+ /**
196
+ * Wait for voice cloning to complete
197
+ */
198
+ async waitForClone(jobId, options) {
199
+ const pollInterval = options?.pollInterval || 5e3;
200
+ const timeout = options?.timeout || 36e5;
201
+ const startTime = Date.now();
202
+ while (Date.now() - startTime < timeout) {
203
+ const job = await this.getCloneJob(jobId);
204
+ if (options?.onProgress) {
205
+ options.onProgress(job);
206
+ }
207
+ if (job.status === "ready") {
208
+ return job;
209
+ }
210
+ if (job.status === "failed") {
211
+ throw new Error(`Voice cloning failed: ${job.error || "Unknown error"}`);
212
+ }
213
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
214
+ }
215
+ throw new Error(`Voice cloning timed out after ${timeout}ms`);
216
+ }
217
+ // ==========================================================================
218
+ // Utilities
219
+ // ==========================================================================
220
+ /**
221
+ * Estimate synthesis cost
222
+ *
223
+ * Requires: voice:read permission
224
+ */
225
+ async estimateCost(text, voiceId) {
226
+ return this.client.post(`${this.basePath}/estimate`, {
227
+ text,
228
+ voice_id: voiceId
229
+ });
230
+ }
231
+ /**
232
+ * Get supported languages
233
+ *
234
+ * Requires: voice:read permission
235
+ */
236
+ async getSupportedLanguages() {
237
+ return this.client.get(`${this.basePath}/languages`);
238
+ }
239
+ };
240
+ function createVoiceAPI(client) {
241
+ return new VoiceAPI(client);
242
+ }
243
+
244
+ export {
245
+ VoiceAPI,
246
+ createVoiceAPI
247
+ };
File without changes