@supertone/supertone 0.1.3 → 0.1.5

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 (181) hide show
  1. package/README.md +281 -9
  2. package/custom_test/test_real_api.ts +149 -13
  3. package/dist/commonjs/funcs/customVoicesCreateClonedVoice.d.ts +1 -1
  4. package/dist/commonjs/funcs/customVoicesCreateClonedVoice.d.ts.map +1 -1
  5. package/dist/commonjs/funcs/customVoicesCreateClonedVoice.js +6 -2
  6. package/dist/commonjs/funcs/customVoicesCreateClonedVoice.js.map +1 -1
  7. package/dist/commonjs/funcs/customVoicesEditCustomVoice.d.ts +1 -1
  8. package/dist/commonjs/funcs/customVoicesEditCustomVoice.js +2 -2
  9. package/dist/commonjs/funcs/customVoicesGetCustomVoice.d.ts +1 -1
  10. package/dist/commonjs/funcs/customVoicesGetCustomVoice.d.ts.map +1 -1
  11. package/dist/commonjs/funcs/customVoicesGetCustomVoice.js +1 -1
  12. package/dist/commonjs/funcs/customVoicesGetCustomVoice.js.map +1 -1
  13. package/dist/commonjs/funcs/textToSpeechPredictDuration.js +3 -1
  14. package/dist/commonjs/funcs/textToSpeechPredictDuration.js.map +1 -1
  15. package/dist/commonjs/lib/config.d.ts +3 -3
  16. package/dist/commonjs/lib/config.d.ts.map +1 -1
  17. package/dist/commonjs/lib/config.js +3 -3
  18. package/dist/commonjs/lib/config.js.map +1 -1
  19. package/dist/commonjs/models/apiconverttexttospeechusingcharacterrequest.d.ts +3 -0
  20. package/dist/commonjs/models/apiconverttexttospeechusingcharacterrequest.d.ts.map +1 -1
  21. package/dist/commonjs/models/apiconverttexttospeechusingcharacterrequest.js +1 -0
  22. package/dist/commonjs/models/apiconverttexttospeechusingcharacterrequest.js.map +1 -1
  23. package/dist/commonjs/models/createcustomvoiceresponse.d.ts +32 -0
  24. package/dist/commonjs/models/createcustomvoiceresponse.d.ts.map +1 -0
  25. package/dist/commonjs/models/{createclonedvoiceuploadresponse.js → createcustomvoiceresponse.js} +17 -17
  26. package/dist/commonjs/models/createcustomvoiceresponse.js.map +1 -0
  27. package/dist/commonjs/models/getcustomvoicelistresponse.d.ts +3 -3
  28. package/dist/commonjs/models/getcustomvoicelistresponse.d.ts.map +1 -1
  29. package/dist/commonjs/models/getcustomvoicelistresponse.js +3 -3
  30. package/dist/commonjs/models/getcustomvoicelistresponse.js.map +1 -1
  31. package/dist/commonjs/models/getcustomvoiceresponse.d.ts +42 -0
  32. package/dist/commonjs/models/getcustomvoiceresponse.d.ts.map +1 -0
  33. package/dist/commonjs/models/{getcustomvoiceresponsedata.js → getcustomvoiceresponse.js} +17 -17
  34. package/dist/commonjs/models/getcustomvoiceresponse.js.map +1 -0
  35. package/dist/commonjs/models/index.d.ts +5 -6
  36. package/dist/commonjs/models/index.d.ts.map +1 -1
  37. package/dist/commonjs/models/index.js +5 -6
  38. package/dist/commonjs/models/index.js.map +1 -1
  39. package/dist/commonjs/models/operations/editcustomvoice.d.ts +2 -2
  40. package/dist/commonjs/models/operations/editcustomvoice.js +4 -4
  41. package/dist/commonjs/models/operations/predictduration.d.ts +2 -2
  42. package/dist/commonjs/models/operations/predictduration.d.ts.map +1 -1
  43. package/dist/commonjs/models/operations/predictduration.js +4 -4
  44. package/dist/commonjs/models/operations/predictduration.js.map +1 -1
  45. package/dist/commonjs/models/{predictttsdurationusingcharacterrequest.d.ts → predictttsdurationrequest.d.ts} +41 -38
  46. package/dist/commonjs/models/predictttsdurationrequest.d.ts.map +1 -0
  47. package/dist/commonjs/models/predictttsdurationrequest.js +181 -0
  48. package/dist/commonjs/models/predictttsdurationrequest.js.map +1 -0
  49. package/dist/commonjs/models/updatecustomvoicerequest.d.ts +37 -0
  50. package/dist/commonjs/models/{updateclonedvoicerequest.d.ts.map → updatecustomvoicerequest.d.ts.map} +1 -1
  51. package/dist/commonjs/models/{updateclonedvoicerequest.js → updatecustomvoicerequest.js} +17 -17
  52. package/dist/commonjs/models/{updateclonedvoicerequest.js.map → updatecustomvoicerequest.js.map} +1 -1
  53. package/dist/commonjs/models/updatecustomvoiceresponse.d.ts +42 -0
  54. package/dist/commonjs/models/{updateclonedvoiceresponse.d.ts.map → updatecustomvoiceresponse.d.ts.map} +1 -1
  55. package/dist/commonjs/models/{updateclonedvoiceresponse.js → updatecustomvoiceresponse.js} +17 -17
  56. package/dist/commonjs/models/{updateclonedvoiceresponse.js.map → updatecustomvoiceresponse.js.map} +1 -1
  57. package/dist/commonjs/sdk/customvoices.d.ts +3 -3
  58. package/dist/commonjs/sdk/customvoices.d.ts.map +1 -1
  59. package/dist/commonjs/sdk/texttospeech.d.ts +6 -13
  60. package/dist/commonjs/sdk/texttospeech.d.ts.map +1 -1
  61. package/dist/commonjs/sdk/texttospeech.js +12 -9
  62. package/dist/commonjs/sdk/texttospeech.js.map +1 -1
  63. package/dist/esm/funcs/customVoicesCreateClonedVoice.d.ts +1 -1
  64. package/dist/esm/funcs/customVoicesCreateClonedVoice.d.ts.map +1 -1
  65. package/dist/esm/funcs/customVoicesCreateClonedVoice.js +6 -2
  66. package/dist/esm/funcs/customVoicesCreateClonedVoice.js.map +1 -1
  67. package/dist/esm/funcs/customVoicesEditCustomVoice.d.ts +1 -1
  68. package/dist/esm/funcs/customVoicesEditCustomVoice.js +2 -2
  69. package/dist/esm/funcs/customVoicesGetCustomVoice.d.ts +1 -1
  70. package/dist/esm/funcs/customVoicesGetCustomVoice.d.ts.map +1 -1
  71. package/dist/esm/funcs/customVoicesGetCustomVoice.js +1 -1
  72. package/dist/esm/funcs/customVoicesGetCustomVoice.js.map +1 -1
  73. package/dist/esm/funcs/textToSpeechPredictDuration.js +3 -1
  74. package/dist/esm/funcs/textToSpeechPredictDuration.js.map +1 -1
  75. package/dist/esm/lib/config.d.ts +3 -3
  76. package/dist/esm/lib/config.d.ts.map +1 -1
  77. package/dist/esm/lib/config.js +3 -3
  78. package/dist/esm/lib/config.js.map +1 -1
  79. package/dist/esm/models/apiconverttexttospeechusingcharacterrequest.d.ts +3 -0
  80. package/dist/esm/models/apiconverttexttospeechusingcharacterrequest.d.ts.map +1 -1
  81. package/dist/esm/models/apiconverttexttospeechusingcharacterrequest.js +1 -0
  82. package/dist/esm/models/apiconverttexttospeechusingcharacterrequest.js.map +1 -1
  83. package/dist/esm/models/createcustomvoiceresponse.d.ts +32 -0
  84. package/dist/esm/models/createcustomvoiceresponse.d.ts.map +1 -0
  85. package/dist/esm/models/createcustomvoiceresponse.js +40 -0
  86. package/dist/esm/models/createcustomvoiceresponse.js.map +1 -0
  87. package/dist/esm/models/getcustomvoicelistresponse.d.ts +3 -3
  88. package/dist/esm/models/getcustomvoicelistresponse.d.ts.map +1 -1
  89. package/dist/esm/models/getcustomvoicelistresponse.js +3 -3
  90. package/dist/esm/models/getcustomvoicelistresponse.js.map +1 -1
  91. package/dist/esm/models/getcustomvoiceresponse.d.ts +42 -0
  92. package/dist/esm/models/getcustomvoiceresponse.d.ts.map +1 -0
  93. package/dist/esm/models/getcustomvoiceresponse.js +44 -0
  94. package/dist/esm/models/getcustomvoiceresponse.js.map +1 -0
  95. package/dist/esm/models/index.d.ts +5 -6
  96. package/dist/esm/models/index.d.ts.map +1 -1
  97. package/dist/esm/models/index.js +5 -6
  98. package/dist/esm/models/index.js.map +1 -1
  99. package/dist/esm/models/operations/editcustomvoice.d.ts +2 -2
  100. package/dist/esm/models/operations/editcustomvoice.js +4 -4
  101. package/dist/esm/models/operations/predictduration.d.ts +2 -2
  102. package/dist/esm/models/operations/predictduration.d.ts.map +1 -1
  103. package/dist/esm/models/operations/predictduration.js +4 -4
  104. package/dist/esm/models/operations/predictduration.js.map +1 -1
  105. package/dist/esm/models/{predictttsdurationusingcharacterrequest.d.ts → predictttsdurationrequest.d.ts} +41 -38
  106. package/dist/esm/models/predictttsdurationrequest.d.ts.map +1 -0
  107. package/dist/esm/models/predictttsdurationrequest.js +143 -0
  108. package/dist/esm/models/predictttsdurationrequest.js.map +1 -0
  109. package/dist/esm/models/updatecustomvoicerequest.d.ts +37 -0
  110. package/dist/esm/models/{updateclonedvoicerequest.d.ts.map → updatecustomvoicerequest.d.ts.map} +1 -1
  111. package/dist/esm/models/updatecustomvoicerequest.js +33 -0
  112. package/dist/esm/models/{updateclonedvoicerequest.js.map → updatecustomvoicerequest.js.map} +1 -1
  113. package/dist/esm/models/updatecustomvoiceresponse.d.ts +42 -0
  114. package/dist/esm/models/{updateclonedvoiceresponse.d.ts.map → updatecustomvoiceresponse.d.ts.map} +1 -1
  115. package/dist/esm/models/updatecustomvoiceresponse.js +44 -0
  116. package/dist/esm/models/{updateclonedvoiceresponse.js.map → updatecustomvoiceresponse.js.map} +1 -1
  117. package/dist/esm/sdk/customvoices.d.ts +3 -3
  118. package/dist/esm/sdk/customvoices.d.ts.map +1 -1
  119. package/dist/esm/sdk/texttospeech.d.ts +6 -13
  120. package/dist/esm/sdk/texttospeech.d.ts.map +1 -1
  121. package/dist/esm/sdk/texttospeech.js +13 -10
  122. package/dist/esm/sdk/texttospeech.js.map +1 -1
  123. package/jsr.json +1 -1
  124. package/openapi.json +85 -49
  125. package/package.json +1 -1
  126. package/src/funcs/customVoicesCreateClonedVoice.ts +9 -5
  127. package/src/funcs/customVoicesEditCustomVoice.ts +5 -5
  128. package/src/funcs/customVoicesGetCustomVoice.ts +4 -4
  129. package/src/funcs/textToSpeechPredictDuration.ts +3 -5
  130. package/src/lib/config.ts +41 -41
  131. package/src/models/apiconverttexttospeechusingcharacterrequest.ts +1 -0
  132. package/src/models/createcustomvoiceresponse.ts +78 -0
  133. package/src/models/getcustomvoicelistresponse.ts +9 -9
  134. package/src/models/getcustomvoiceresponse.ts +92 -0
  135. package/src/models/index.ts +5 -6
  136. package/src/models/operations/editcustomvoice.ts +6 -6
  137. package/src/models/operations/predictduration.ts +6 -12
  138. package/src/models/predictttsdurationrequest.ts +256 -0
  139. package/src/models/updatecustomvoicerequest.ts +76 -0
  140. package/src/models/{updateclonedvoiceresponse.ts → updatecustomvoiceresponse.ts} +21 -21
  141. package/src/sdk/customvoices.ts +3 -3
  142. package/src/sdk/texttospeech.ts +54 -40
  143. package/dist/commonjs/models/createclonedvoiceuploadresponse.d.ts +0 -32
  144. package/dist/commonjs/models/createclonedvoiceuploadresponse.d.ts.map +0 -1
  145. package/dist/commonjs/models/createclonedvoiceuploadresponse.js.map +0 -1
  146. package/dist/commonjs/models/getcustomvoiceresponsedata.d.ts +0 -42
  147. package/dist/commonjs/models/getcustomvoiceresponsedata.d.ts.map +0 -1
  148. package/dist/commonjs/models/getcustomvoiceresponsedata.js.map +0 -1
  149. package/dist/commonjs/models/getsingleclonedvoiceresponse.d.ts +0 -42
  150. package/dist/commonjs/models/getsingleclonedvoiceresponse.d.ts.map +0 -1
  151. package/dist/commonjs/models/getsingleclonedvoiceresponse.js +0 -82
  152. package/dist/commonjs/models/getsingleclonedvoiceresponse.js.map +0 -1
  153. package/dist/commonjs/models/predictttsdurationusingcharacterrequest.d.ts.map +0 -1
  154. package/dist/commonjs/models/predictttsdurationusingcharacterrequest.js +0 -182
  155. package/dist/commonjs/models/predictttsdurationusingcharacterrequest.js.map +0 -1
  156. package/dist/commonjs/models/updateclonedvoicerequest.d.ts +0 -37
  157. package/dist/commonjs/models/updateclonedvoiceresponse.d.ts +0 -42
  158. package/dist/esm/models/createclonedvoiceuploadresponse.d.ts +0 -32
  159. package/dist/esm/models/createclonedvoiceuploadresponse.d.ts.map +0 -1
  160. package/dist/esm/models/createclonedvoiceuploadresponse.js +0 -40
  161. package/dist/esm/models/createclonedvoiceuploadresponse.js.map +0 -1
  162. package/dist/esm/models/getcustomvoiceresponsedata.d.ts +0 -42
  163. package/dist/esm/models/getcustomvoiceresponsedata.d.ts.map +0 -1
  164. package/dist/esm/models/getcustomvoiceresponsedata.js +0 -44
  165. package/dist/esm/models/getcustomvoiceresponsedata.js.map +0 -1
  166. package/dist/esm/models/getsingleclonedvoiceresponse.d.ts +0 -42
  167. package/dist/esm/models/getsingleclonedvoiceresponse.d.ts.map +0 -1
  168. package/dist/esm/models/getsingleclonedvoiceresponse.js +0 -44
  169. package/dist/esm/models/getsingleclonedvoiceresponse.js.map +0 -1
  170. package/dist/esm/models/predictttsdurationusingcharacterrequest.d.ts.map +0 -1
  171. package/dist/esm/models/predictttsdurationusingcharacterrequest.js +0 -144
  172. package/dist/esm/models/predictttsdurationusingcharacterrequest.js.map +0 -1
  173. package/dist/esm/models/updateclonedvoicerequest.d.ts +0 -37
  174. package/dist/esm/models/updateclonedvoicerequest.js +0 -33
  175. package/dist/esm/models/updateclonedvoiceresponse.d.ts +0 -42
  176. package/dist/esm/models/updateclonedvoiceresponse.js +0 -44
  177. package/src/models/createclonedvoiceuploadresponse.ts +0 -80
  178. package/src/models/getcustomvoiceresponsedata.ts +0 -92
  179. package/src/models/getsingleclonedvoiceresponse.ts +0 -94
  180. package/src/models/predictttsdurationusingcharacterrequest.ts +0 -276
  181. package/src/models/updateclonedvoicerequest.ts +0 -76
@@ -0,0 +1,256 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { safeParse } from "../lib/schemas.js";
8
+ import { ClosedEnum } from "../types/enums.js";
9
+ import { Result as SafeParseResult } from "../types/fp.js";
10
+ import {
11
+ ConvertTextToSpeechParameters,
12
+ ConvertTextToSpeechParameters$inboundSchema,
13
+ ConvertTextToSpeechParameters$Outbound,
14
+ ConvertTextToSpeechParameters$outboundSchema,
15
+ } from "./converttexttospeechparameters.js";
16
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
17
+
18
+ /**
19
+ * Language code of the voice
20
+ */
21
+ export const PredictTTSDurationRequestLanguage = {
22
+ En: "en",
23
+ Ko: "ko",
24
+ Ja: "ja",
25
+ Bg: "bg",
26
+ Cs: "cs",
27
+ Da: "da",
28
+ El: "el",
29
+ Es: "es",
30
+ Et: "et",
31
+ Fi: "fi",
32
+ Hu: "hu",
33
+ It: "it",
34
+ Nl: "nl",
35
+ Pl: "pl",
36
+ Pt: "pt",
37
+ Ro: "ro",
38
+ Ar: "ar",
39
+ De: "de",
40
+ Fr: "fr",
41
+ Hi: "hi",
42
+ Id: "id",
43
+ Ru: "ru",
44
+ Vi: "vi",
45
+ } as const;
46
+ /**
47
+ * Language code of the voice
48
+ */
49
+ export type PredictTTSDurationRequestLanguage = ClosedEnum<
50
+ typeof PredictTTSDurationRequestLanguage
51
+ >;
52
+
53
+ /**
54
+ * The model type to use for the text-to-speech conversion
55
+ */
56
+ export const PredictTTSDurationRequestModel = {
57
+ SonaSpeech1: "sona_speech_1",
58
+ SonaSpeech2: "sona_speech_2",
59
+ SonaSpeech2t: "sona_speech_2t",
60
+ SonaSpeech2Flash: "sona_speech_2_flash",
61
+ SupertonicApi1: "supertonic_api_1",
62
+ } as const;
63
+ /**
64
+ * The model type to use for the text-to-speech conversion
65
+ */
66
+ export type PredictTTSDurationRequestModel = ClosedEnum<
67
+ typeof PredictTTSDurationRequestModel
68
+ >;
69
+
70
+ /**
71
+ * The desired output format of the audio file (wav, mp3). Default is wav.
72
+ */
73
+ export const PredictTTSDurationRequestOutputFormat = {
74
+ Wav: "wav",
75
+ Mp3: "mp3",
76
+ } as const;
77
+ /**
78
+ * The desired output format of the audio file (wav, mp3). Default is wav.
79
+ */
80
+ export type PredictTTSDurationRequestOutputFormat = ClosedEnum<
81
+ typeof PredictTTSDurationRequestOutputFormat
82
+ >;
83
+
84
+ export type PredictTTSDurationRequest = {
85
+ /**
86
+ * The text to convert to speech. Max length is 300 characters.
87
+ */
88
+ text: string;
89
+ /**
90
+ * Language code of the voice
91
+ */
92
+ language: PredictTTSDurationRequestLanguage;
93
+ /**
94
+ * The style of character to use for the text-to-speech conversion
95
+ */
96
+ style?: string | undefined;
97
+ /**
98
+ * The model type to use for the text-to-speech conversion
99
+ */
100
+ model?: PredictTTSDurationRequestModel | undefined;
101
+ /**
102
+ * The desired output format of the audio file (wav, mp3). Default is wav.
103
+ */
104
+ outputFormat?: PredictTTSDurationRequestOutputFormat | undefined;
105
+ voiceSettings?: ConvertTextToSpeechParameters | undefined;
106
+ };
107
+
108
+ /** @internal */
109
+ export const PredictTTSDurationRequestLanguage$inboundSchema: z.ZodNativeEnum<
110
+ typeof PredictTTSDurationRequestLanguage
111
+ > = z.nativeEnum(PredictTTSDurationRequestLanguage);
112
+
113
+ /** @internal */
114
+ export const PredictTTSDurationRequestLanguage$outboundSchema: z.ZodNativeEnum<
115
+ typeof PredictTTSDurationRequestLanguage
116
+ > = PredictTTSDurationRequestLanguage$inboundSchema;
117
+
118
+ /**
119
+ * @internal
120
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
121
+ */
122
+ export namespace PredictTTSDurationRequestLanguage$ {
123
+ /** @deprecated use `PredictTTSDurationRequestLanguage$inboundSchema` instead. */
124
+ export const inboundSchema = PredictTTSDurationRequestLanguage$inboundSchema;
125
+ /** @deprecated use `PredictTTSDurationRequestLanguage$outboundSchema` instead. */
126
+ export const outboundSchema =
127
+ PredictTTSDurationRequestLanguage$outboundSchema;
128
+ }
129
+
130
+ /** @internal */
131
+ export const PredictTTSDurationRequestModel$inboundSchema: z.ZodNativeEnum<
132
+ typeof PredictTTSDurationRequestModel
133
+ > = z.nativeEnum(PredictTTSDurationRequestModel);
134
+
135
+ /** @internal */
136
+ export const PredictTTSDurationRequestModel$outboundSchema: z.ZodNativeEnum<
137
+ typeof PredictTTSDurationRequestModel
138
+ > = PredictTTSDurationRequestModel$inboundSchema;
139
+
140
+ /**
141
+ * @internal
142
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
143
+ */
144
+ export namespace PredictTTSDurationRequestModel$ {
145
+ /** @deprecated use `PredictTTSDurationRequestModel$inboundSchema` instead. */
146
+ export const inboundSchema = PredictTTSDurationRequestModel$inboundSchema;
147
+ /** @deprecated use `PredictTTSDurationRequestModel$outboundSchema` instead. */
148
+ export const outboundSchema = PredictTTSDurationRequestModel$outboundSchema;
149
+ }
150
+
151
+ /** @internal */
152
+ export const PredictTTSDurationRequestOutputFormat$inboundSchema:
153
+ z.ZodNativeEnum<typeof PredictTTSDurationRequestOutputFormat> = z.nativeEnum(
154
+ PredictTTSDurationRequestOutputFormat,
155
+ );
156
+
157
+ /** @internal */
158
+ export const PredictTTSDurationRequestOutputFormat$outboundSchema:
159
+ z.ZodNativeEnum<typeof PredictTTSDurationRequestOutputFormat> =
160
+ PredictTTSDurationRequestOutputFormat$inboundSchema;
161
+
162
+ /**
163
+ * @internal
164
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
165
+ */
166
+ export namespace PredictTTSDurationRequestOutputFormat$ {
167
+ /** @deprecated use `PredictTTSDurationRequestOutputFormat$inboundSchema` instead. */
168
+ export const inboundSchema =
169
+ PredictTTSDurationRequestOutputFormat$inboundSchema;
170
+ /** @deprecated use `PredictTTSDurationRequestOutputFormat$outboundSchema` instead. */
171
+ export const outboundSchema =
172
+ PredictTTSDurationRequestOutputFormat$outboundSchema;
173
+ }
174
+
175
+ /** @internal */
176
+ export const PredictTTSDurationRequest$inboundSchema: z.ZodType<
177
+ PredictTTSDurationRequest,
178
+ z.ZodTypeDef,
179
+ unknown
180
+ > = z.object({
181
+ text: z.string(),
182
+ language: PredictTTSDurationRequestLanguage$inboundSchema,
183
+ style: z.string().optional(),
184
+ model: PredictTTSDurationRequestModel$inboundSchema.default("sona_speech_1"),
185
+ output_format: PredictTTSDurationRequestOutputFormat$inboundSchema.default(
186
+ "wav",
187
+ ),
188
+ voice_settings: ConvertTextToSpeechParameters$inboundSchema.optional(),
189
+ }).transform((v) => {
190
+ return remap$(v, {
191
+ "output_format": "outputFormat",
192
+ "voice_settings": "voiceSettings",
193
+ });
194
+ });
195
+
196
+ /** @internal */
197
+ export type PredictTTSDurationRequest$Outbound = {
198
+ text: string;
199
+ language: string;
200
+ style?: string | undefined;
201
+ model: string;
202
+ output_format: string;
203
+ voice_settings?: ConvertTextToSpeechParameters$Outbound | undefined;
204
+ };
205
+
206
+ /** @internal */
207
+ export const PredictTTSDurationRequest$outboundSchema: z.ZodType<
208
+ PredictTTSDurationRequest$Outbound,
209
+ z.ZodTypeDef,
210
+ PredictTTSDurationRequest
211
+ > = z.object({
212
+ text: z.string(),
213
+ language: PredictTTSDurationRequestLanguage$outboundSchema,
214
+ style: z.string().optional(),
215
+ model: PredictTTSDurationRequestModel$outboundSchema.default("sona_speech_1"),
216
+ outputFormat: PredictTTSDurationRequestOutputFormat$outboundSchema.default(
217
+ "wav",
218
+ ),
219
+ voiceSettings: ConvertTextToSpeechParameters$outboundSchema.optional(),
220
+ }).transform((v) => {
221
+ return remap$(v, {
222
+ outputFormat: "output_format",
223
+ voiceSettings: "voice_settings",
224
+ });
225
+ });
226
+
227
+ /**
228
+ * @internal
229
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
230
+ */
231
+ export namespace PredictTTSDurationRequest$ {
232
+ /** @deprecated use `PredictTTSDurationRequest$inboundSchema` instead. */
233
+ export const inboundSchema = PredictTTSDurationRequest$inboundSchema;
234
+ /** @deprecated use `PredictTTSDurationRequest$outboundSchema` instead. */
235
+ export const outboundSchema = PredictTTSDurationRequest$outboundSchema;
236
+ /** @deprecated use `PredictTTSDurationRequest$Outbound` instead. */
237
+ export type Outbound = PredictTTSDurationRequest$Outbound;
238
+ }
239
+
240
+ export function predictTTSDurationRequestToJSON(
241
+ predictTTSDurationRequest: PredictTTSDurationRequest,
242
+ ): string {
243
+ return JSON.stringify(
244
+ PredictTTSDurationRequest$outboundSchema.parse(predictTTSDurationRequest),
245
+ );
246
+ }
247
+
248
+ export function predictTTSDurationRequestFromJSON(
249
+ jsonString: string,
250
+ ): SafeParseResult<PredictTTSDurationRequest, SDKValidationError> {
251
+ return safeParse(
252
+ jsonString,
253
+ (x) => PredictTTSDurationRequest$inboundSchema.parse(JSON.parse(x)),
254
+ `Failed to parse 'PredictTTSDurationRequest' from JSON`,
255
+ );
256
+ }
@@ -0,0 +1,76 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../types/fp.js";
8
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
9
+
10
+ export type UpdateCustomVoiceRequest = {
11
+ /**
12
+ * Name of the voice
13
+ */
14
+ name?: string | undefined;
15
+ /**
16
+ * Description of the voice
17
+ */
18
+ description?: string | undefined;
19
+ };
20
+
21
+ /** @internal */
22
+ export const UpdateCustomVoiceRequest$inboundSchema: z.ZodType<
23
+ UpdateCustomVoiceRequest,
24
+ z.ZodTypeDef,
25
+ unknown
26
+ > = z.object({
27
+ name: z.string().optional(),
28
+ description: z.string().optional(),
29
+ });
30
+
31
+ /** @internal */
32
+ export type UpdateCustomVoiceRequest$Outbound = {
33
+ name?: string | undefined;
34
+ description?: string | undefined;
35
+ };
36
+
37
+ /** @internal */
38
+ export const UpdateCustomVoiceRequest$outboundSchema: z.ZodType<
39
+ UpdateCustomVoiceRequest$Outbound,
40
+ z.ZodTypeDef,
41
+ UpdateCustomVoiceRequest
42
+ > = z.object({
43
+ name: z.string().optional(),
44
+ description: z.string().optional(),
45
+ });
46
+
47
+ /**
48
+ * @internal
49
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
50
+ */
51
+ export namespace UpdateCustomVoiceRequest$ {
52
+ /** @deprecated use `UpdateCustomVoiceRequest$inboundSchema` instead. */
53
+ export const inboundSchema = UpdateCustomVoiceRequest$inboundSchema;
54
+ /** @deprecated use `UpdateCustomVoiceRequest$outboundSchema` instead. */
55
+ export const outboundSchema = UpdateCustomVoiceRequest$outboundSchema;
56
+ /** @deprecated use `UpdateCustomVoiceRequest$Outbound` instead. */
57
+ export type Outbound = UpdateCustomVoiceRequest$Outbound;
58
+ }
59
+
60
+ export function updateCustomVoiceRequestToJSON(
61
+ updateCustomVoiceRequest: UpdateCustomVoiceRequest,
62
+ ): string {
63
+ return JSON.stringify(
64
+ UpdateCustomVoiceRequest$outboundSchema.parse(updateCustomVoiceRequest),
65
+ );
66
+ }
67
+
68
+ export function updateCustomVoiceRequestFromJSON(
69
+ jsonString: string,
70
+ ): SafeParseResult<UpdateCustomVoiceRequest, SDKValidationError> {
71
+ return safeParse(
72
+ jsonString,
73
+ (x) => UpdateCustomVoiceRequest$inboundSchema.parse(JSON.parse(x)),
74
+ `Failed to parse 'UpdateCustomVoiceRequest' from JSON`,
75
+ );
76
+ }
@@ -8,7 +8,7 @@ import { safeParse } from "../lib/schemas.js";
8
8
  import { Result as SafeParseResult } from "../types/fp.js";
9
9
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
10
10
 
11
- export type UpdateClonedVoiceResponse = {
11
+ export type UpdateCustomVoiceResponse = {
12
12
  /**
13
13
  * Unique identifier for the voice
14
14
  */
@@ -24,8 +24,8 @@ export type UpdateClonedVoiceResponse = {
24
24
  };
25
25
 
26
26
  /** @internal */
27
- export const UpdateClonedVoiceResponse$inboundSchema: z.ZodType<
28
- UpdateClonedVoiceResponse,
27
+ export const UpdateCustomVoiceResponse$inboundSchema: z.ZodType<
28
+ UpdateCustomVoiceResponse,
29
29
  z.ZodTypeDef,
30
30
  unknown
31
31
  > = z.object({
@@ -39,17 +39,17 @@ export const UpdateClonedVoiceResponse$inboundSchema: z.ZodType<
39
39
  });
40
40
 
41
41
  /** @internal */
42
- export type UpdateClonedVoiceResponse$Outbound = {
42
+ export type UpdateCustomVoiceResponse$Outbound = {
43
43
  voice_id: string;
44
44
  name: string;
45
45
  description: string;
46
46
  };
47
47
 
48
48
  /** @internal */
49
- export const UpdateClonedVoiceResponse$outboundSchema: z.ZodType<
50
- UpdateClonedVoiceResponse$Outbound,
49
+ export const UpdateCustomVoiceResponse$outboundSchema: z.ZodType<
50
+ UpdateCustomVoiceResponse$Outbound,
51
51
  z.ZodTypeDef,
52
- UpdateClonedVoiceResponse
52
+ UpdateCustomVoiceResponse
53
53
  > = z.object({
54
54
  voiceId: z.string(),
55
55
  name: z.string(),
@@ -64,29 +64,29 @@ export const UpdateClonedVoiceResponse$outboundSchema: z.ZodType<
64
64
  * @internal
65
65
  * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
66
66
  */
67
- export namespace UpdateClonedVoiceResponse$ {
68
- /** @deprecated use `UpdateClonedVoiceResponse$inboundSchema` instead. */
69
- export const inboundSchema = UpdateClonedVoiceResponse$inboundSchema;
70
- /** @deprecated use `UpdateClonedVoiceResponse$outboundSchema` instead. */
71
- export const outboundSchema = UpdateClonedVoiceResponse$outboundSchema;
72
- /** @deprecated use `UpdateClonedVoiceResponse$Outbound` instead. */
73
- export type Outbound = UpdateClonedVoiceResponse$Outbound;
67
+ export namespace UpdateCustomVoiceResponse$ {
68
+ /** @deprecated use `UpdateCustomVoiceResponse$inboundSchema` instead. */
69
+ export const inboundSchema = UpdateCustomVoiceResponse$inboundSchema;
70
+ /** @deprecated use `UpdateCustomVoiceResponse$outboundSchema` instead. */
71
+ export const outboundSchema = UpdateCustomVoiceResponse$outboundSchema;
72
+ /** @deprecated use `UpdateCustomVoiceResponse$Outbound` instead. */
73
+ export type Outbound = UpdateCustomVoiceResponse$Outbound;
74
74
  }
75
75
 
76
- export function updateClonedVoiceResponseToJSON(
77
- updateClonedVoiceResponse: UpdateClonedVoiceResponse,
76
+ export function updateCustomVoiceResponseToJSON(
77
+ updateCustomVoiceResponse: UpdateCustomVoiceResponse,
78
78
  ): string {
79
79
  return JSON.stringify(
80
- UpdateClonedVoiceResponse$outboundSchema.parse(updateClonedVoiceResponse),
80
+ UpdateCustomVoiceResponse$outboundSchema.parse(updateCustomVoiceResponse),
81
81
  );
82
82
  }
83
83
 
84
- export function updateClonedVoiceResponseFromJSON(
84
+ export function updateCustomVoiceResponseFromJSON(
85
85
  jsonString: string,
86
- ): SafeParseResult<UpdateClonedVoiceResponse, SDKValidationError> {
86
+ ): SafeParseResult<UpdateCustomVoiceResponse, SDKValidationError> {
87
87
  return safeParse(
88
88
  jsonString,
89
- (x) => UpdateClonedVoiceResponse$inboundSchema.parse(JSON.parse(x)),
90
- `Failed to parse 'UpdateClonedVoiceResponse' from JSON`,
89
+ (x) => UpdateCustomVoiceResponse$inboundSchema.parse(JSON.parse(x)),
90
+ `Failed to parse 'UpdateCustomVoiceResponse' from JSON`,
91
91
  );
92
92
  }
@@ -23,7 +23,7 @@ export class CustomVoices extends ClientSDK {
23
23
  async createClonedVoice(
24
24
  request: operations.CreateClonedVoiceRequest,
25
25
  options?: RequestOptions,
26
- ): Promise<models.CreateClonedVoiceUploadResponse> {
26
+ ): Promise<models.CreateCustomVoiceResponse> {
27
27
  return unwrapAsync(customVoicesCreateClonedVoice(
28
28
  this,
29
29
  request,
@@ -74,7 +74,7 @@ export class CustomVoices extends ClientSDK {
74
74
  async getCustomVoice(
75
75
  request: operations.GetCustomVoiceRequest,
76
76
  options?: RequestOptions,
77
- ): Promise<models.GetSingleClonedVoiceResponse> {
77
+ ): Promise<models.GetCustomVoiceResponse> {
78
78
  return unwrapAsync(customVoicesGetCustomVoice(
79
79
  this,
80
80
  request,
@@ -91,7 +91,7 @@ export class CustomVoices extends ClientSDK {
91
91
  async editCustomVoice(
92
92
  request: operations.EditCustomVoiceRequest,
93
93
  options?: RequestOptions,
94
- ): Promise<models.UpdateClonedVoiceResponse> {
94
+ ): Promise<models.UpdateCustomVoiceResponse> {
95
95
  return unwrapAsync(customVoicesEditCustomVoice(
96
96
  this,
97
97
  request,
@@ -16,12 +16,12 @@ import * as operations from "../models/operations/index.js";
16
16
  import { unwrapAsync } from "../types/fp.js";
17
17
  // #region imports
18
18
  import {
19
+ applyPronunciationDictionary,
19
20
  chunkText,
20
21
  DEFAULT_MAX_TEXT_LENGTH,
21
22
  detectAudioFormat,
22
23
  mergeMp3Binary,
23
24
  mergeWavBinary,
24
- applyPronunciationDictionary,
25
25
  type PronunciationDictionaryEntry,
26
26
  removeMp3Header,
27
27
  removeWavHeader,
@@ -72,7 +72,7 @@ export class TextToSpeech extends ClientSDK {
72
72
  */
73
73
  private applyPronunciationDictionary(
74
74
  text: string,
75
- pronunciationDictionary?: PronunciationDictionaryEntry[]
75
+ pronunciationDictionary?: PronunciationDictionaryEntry[],
76
76
  ): string {
77
77
  if (!pronunciationDictionary) return text;
78
78
  return applyPronunciationDictionary(text, pronunciationDictionary);
@@ -82,7 +82,7 @@ export class TextToSpeech extends ClientSDK {
82
82
  * Extract audio data from response
83
83
  */
84
84
  private async extractAudioFromResponse(
85
- response: operations.CreateSpeechResponse | operations.StreamSpeechResponse
85
+ response: operations.CreateSpeechResponse | operations.StreamSpeechResponse,
86
86
  ): Promise<Uint8Array> {
87
87
  const result = response.result;
88
88
 
@@ -99,9 +99,9 @@ export class TextToSpeech extends ClientSDK {
99
99
  }
100
100
 
101
101
  if (
102
- typeof result === "object" &&
103
- result !== null &&
104
- "getReader" in result
102
+ typeof result === "object"
103
+ && result !== null
104
+ && "getReader" in result
105
105
  ) {
106
106
  // ReadableStream
107
107
  const reader = (result as ReadableStream<Uint8Array>).getReader();
@@ -156,15 +156,14 @@ export class TextToSpeech extends ClientSDK {
156
156
  // Enhanced error message with object inspection
157
157
  const resultType = typeof result;
158
158
  const resultConstructor = result?.constructor?.name || "unknown";
159
- const resultKeys =
160
- result && typeof result === "object"
161
- ? Object.keys(result).join(", ")
162
- : "N/A";
159
+ const resultKeys = result && typeof result === "object"
160
+ ? Object.keys(result).join(", ")
161
+ : "N/A";
163
162
 
164
163
  throw new Error(
165
- `Unsupported result type: ${resultType}, ` +
166
- `constructor: ${resultConstructor}, ` +
167
- `keys: [${resultKeys}]`
164
+ `Unsupported result type: ${resultType}, `
165
+ + `constructor: ${resultConstructor}, `
166
+ + `keys: [${resultKeys}]`,
168
167
  );
169
168
  }
170
169
 
@@ -172,7 +171,7 @@ export class TextToSpeech extends ClientSDK {
172
171
  * Merge multiple audio responses into one
173
172
  */
174
173
  private async mergeAudioResponses(
175
- responses: operations.CreateSpeechResponse[]
174
+ responses: operations.CreateSpeechResponse[],
176
175
  ): Promise<operations.CreateSpeechResponse> {
177
176
  if (responses.length === 0) {
178
177
  throw new Error("No responses to merge");
@@ -189,7 +188,7 @@ export class TextToSpeech extends ClientSDK {
189
188
 
190
189
  // Extract audio data from all responses
191
190
  const audioChunks: Uint8Array[] = await Promise.all(
192
- responses.map((r) => this.extractAudioFromResponse(r))
191
+ responses.map((r) => this.extractAudioFromResponse(r)),
193
192
  );
194
193
 
195
194
  const firstChunk = audioChunks[0];
@@ -234,14 +233,14 @@ export class TextToSpeech extends ClientSDK {
234
233
  originalRequest: operations.StreamSpeechRequest,
235
234
  options?: RequestOptions & {
236
235
  acceptHeaderOverride?: StreamSpeechAcceptEnum;
237
- }
236
+ },
238
237
  ): operations.StreamSpeechResponse {
239
238
  let audioFormat: "wav" | "mp3" | null = null;
240
239
  let isFirstAudioChunk = true;
241
240
 
242
241
  // Use arrow function to preserve 'this' context
243
242
  const processStream = async (
244
- controller: ReadableStreamDefaultController<Uint8Array>
243
+ controller: ReadableStreamDefaultController<Uint8Array>,
245
244
  ) => {
246
245
  try {
247
246
  // Stream first response (first text chunk)
@@ -289,7 +288,7 @@ export class TextToSpeech extends ClientSDK {
289
288
  }
290
289
  const chunkResponse = await this._streamSpeechOriginal(
291
290
  chunkRequest,
292
- options
291
+ options,
293
292
  );
294
293
 
295
294
  // Stream this text chunk's audio
@@ -349,15 +348,15 @@ export class TextToSpeech extends ClientSDK {
349
348
  */
350
349
  private async createSpeechWithChunking(
351
350
  request: operations.CreateSpeechRequest,
352
- options?: CreateSpeechOptions
351
+ options?: CreateSpeechOptions,
353
352
  ): Promise<operations.CreateSpeechResponse> {
354
353
  const { pronunciationDictionary, ...restOptions } = options ?? {};
355
354
  const maxLength = options?.maxTextLength ?? DEFAULT_MAX_TEXT_LENGTH;
356
- const text =
357
- request.apiConvertTextToSpeechUsingCharacterRequest?.text ?? "";
355
+ const text = request.apiConvertTextToSpeechUsingCharacterRequest?.text
356
+ ?? "";
358
357
  const normalizedText = this.applyPronunciationDictionary(
359
358
  text,
360
- pronunciationDictionary
359
+ pronunciationDictionary,
361
360
  );
362
361
 
363
362
  const baseRequest: operations.CreateSpeechRequest = {
@@ -380,12 +379,11 @@ export class TextToSpeech extends ClientSDK {
380
379
  const textChunks = chunkText(normalizedText, maxLength);
381
380
 
382
381
  // Determine Accept header based on output format
383
- const outputFormat =
384
- baseRequest.apiConvertTextToSpeechUsingCharacterRequest?.outputFormat;
385
- const acceptHeader: CreateSpeechAcceptEnum =
386
- outputFormat === "mp3"
387
- ? CreateSpeechAcceptEnum.audioMpeg
388
- : CreateSpeechAcceptEnum.audioWav;
382
+ const outputFormat = baseRequest.apiConvertTextToSpeechUsingCharacterRequest
383
+ ?.outputFormat;
384
+ const acceptHeader: CreateSpeechAcceptEnum = outputFormat === "mp3"
385
+ ? CreateSpeechAcceptEnum.audioMpeg
386
+ : CreateSpeechAcceptEnum.audioWav;
389
387
 
390
388
  // Process chunks sequentially to avoid race conditions in schema parsing
391
389
  const responses: operations.CreateSpeechResponse[] = [];
@@ -415,15 +413,15 @@ export class TextToSpeech extends ClientSDK {
415
413
  */
416
414
  private async streamSpeechWithChunking(
417
415
  request: operations.StreamSpeechRequest,
418
- options?: StreamSpeechOptions
416
+ options?: StreamSpeechOptions,
419
417
  ): Promise<operations.StreamSpeechResponse> {
420
418
  const { pronunciationDictionary, ...restOptions } = options ?? {};
421
419
  const maxLength = options?.maxTextLength ?? DEFAULT_MAX_TEXT_LENGTH;
422
- const text =
423
- request.apiConvertTextToSpeechUsingCharacterRequest?.text ?? "";
420
+ const text = request.apiConvertTextToSpeechUsingCharacterRequest?.text
421
+ ?? "";
424
422
  const normalizedText = this.applyPronunciationDictionary(
425
423
  text,
426
- pronunciationDictionary
424
+ pronunciationDictionary,
427
425
  );
428
426
 
429
427
  const baseRequest: operations.StreamSpeechRequest = {
@@ -468,7 +466,7 @@ export class TextToSpeech extends ClientSDK {
468
466
  }
469
467
  const firstResponse = await this._streamSpeechOriginal(
470
468
  firstChunkRequest,
471
- restOptions
469
+ restOptions,
472
470
  );
473
471
 
474
472
  // Single chunk: return as-is
@@ -482,7 +480,7 @@ export class TextToSpeech extends ClientSDK {
482
480
  firstResponse,
483
481
  remainingChunks,
484
482
  baseRequest,
485
- restOptions
483
+ restOptions,
486
484
  );
487
485
  }
488
486
  // #endregion sdk-class-body
@@ -495,9 +493,15 @@ export class TextToSpeech extends ClientSDK {
495
493
  */
496
494
  async createSpeech(
497
495
  request: operations.CreateSpeechRequest,
498
- options?: CreateSpeechOptions
496
+ options?: RequestOptions & {
497
+ acceptHeaderOverride?: CreateSpeechAcceptEnum;
498
+ },
499
499
  ): Promise<operations.CreateSpeechResponse> {
500
- return unwrapAsync(textToSpeechCreateSpeech(this, request, options));
500
+ return unwrapAsync(textToSpeechCreateSpeech(
501
+ this,
502
+ request,
503
+ options,
504
+ ));
501
505
  }
502
506
 
503
507
  /**
@@ -508,9 +512,15 @@ export class TextToSpeech extends ClientSDK {
508
512
  */
509
513
  async streamSpeech(
510
514
  request: operations.StreamSpeechRequest,
511
- options?: StreamSpeechOptions
515
+ options?: RequestOptions & {
516
+ acceptHeaderOverride?: StreamSpeechAcceptEnum;
517
+ },
512
518
  ): Promise<operations.StreamSpeechResponse> {
513
- return unwrapAsync(textToSpeechStreamSpeech(this, request, options));
519
+ return unwrapAsync(textToSpeechStreamSpeech(
520
+ this,
521
+ request,
522
+ options,
523
+ ));
514
524
  }
515
525
 
516
526
  /**
@@ -521,8 +531,12 @@ export class TextToSpeech extends ClientSDK {
521
531
  */
522
532
  async predictDuration(
523
533
  request: operations.PredictDurationRequest,
524
- options?: RequestOptions
534
+ options?: RequestOptions,
525
535
  ): Promise<operations.PredictDurationResponse> {
526
- return unwrapAsync(textToSpeechPredictDuration(this, request, options));
536
+ return unwrapAsync(textToSpeechPredictDuration(
537
+ this,
538
+ request,
539
+ options,
540
+ ));
527
541
  }
528
542
  }