-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtext_to_speech.go
More file actions
654 lines (597 loc) · 26 KB
/
text_to_speech.go
File metadata and controls
654 lines (597 loc) · 26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
// This file was auto-generated by Fern from our API Definition.
package cambai
import (
json "encoding/json"
fmt "fmt"
core "github.com/camb-ai/cambai-go-sdk/core"
)
type CreateTtsRequestPayload struct {
RunID *int `json:"-" url:"run_id,omitempty"`
ProjectName *string `json:"project_name,omitempty" url:"project_name,omitempty"`
ProjectDescription *string `json:"project_description,omitempty" url:"project_description,omitempty"`
FolderID *int `json:"folder_id,omitempty" url:"folder_id,omitempty"`
Text string `json:"text" url:"text"`
VoiceID int `json:"voice_id" url:"voice_id"`
Language Languages `json:"language" url:"language"`
Gender *Gender `json:"gender,omitempty" url:"gender,omitempty"`
Age *int `json:"age,omitempty" url:"age,omitempty"`
}
type GetTtsResultTtsTaskIDGetRequest struct {
RunID *int `json:"-" url:"run_id,omitempty"`
}
type GetTtsResultDiscordDiscordTtsTaskIDGetRequest struct {
RunID *int `json:"-" url:"run_id,omitempty"`
}
type GetTtsResultsTtsResultsPostRequest struct {
Traceparent *string `json:"-" url:"-"`
RunID *int `json:"-" url:"run_id,omitempty"`
Body *RunIDsRequestPayload `json:"-" url:"-"`
}
func (g *GetTtsResultsTtsResultsPostRequest) UnmarshalJSON(data []byte) error {
body := new(RunIDsRequestPayload)
if err := json.Unmarshal(data, &body); err != nil {
return err
}
g.Body = body
return nil
}
func (g *GetTtsResultsTtsResultsPostRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(g.Body)
}
type GetTtsRunInfoTtsResultRunIDGetRequest struct {
// Output format for the Text To Speech result
OutputType *string `json:"-" url:"output_type,omitempty"`
}
type CreateStreamTtsRequestPayload struct {
Text string `json:"text" url:"text"`
Language CreateStreamTtsRequestPayloadLanguage `json:"language,omitempty" url:"language,omitempty"`
VoiceID int `json:"voice_id" url:"voice_id"`
SpeechModel *CreateStreamTtsRequestPayloadSpeechModel `json:"speech_model,omitempty" url:"speech_model,omitempty"`
UserInstructions *string `json:"user_instructions,omitempty" url:"user_instructions,omitempty"`
EnhanceNamedEntitiesPronunciation *bool `json:"enhance_named_entities_pronunciation,omitempty" url:"enhance_named_entities_pronunciation,omitempty"`
OutputConfiguration *StreamTtsOutputConfiguration `json:"output_configuration,omitempty" url:"output_configuration,omitempty"`
VoiceSettings *StreamTtsVoiceSettings `json:"voice_settings,omitempty" url:"voice_settings,omitempty"`
InferenceOptions *StreamTtsInferenceOptions `json:"inference_options,omitempty" url:"inference_options,omitempty"`
}
type CreateTtsOut struct {
TaskID string `json:"task_id" url:"task_id"`
_rawJSON json.RawMessage
}
func (c *CreateTtsOut) UnmarshalJSON(data []byte) error {
type unmarshaler CreateTtsOut
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*c = CreateTtsOut(value)
c._rawJSON = json.RawMessage(data)
return nil
}
func (c *CreateTtsOut) String() string {
if len(c._rawJSON) > 0 {
if value, err := core.StringifyJSON(c._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(c); err == nil {
return value
}
return fmt.Sprintf("%#v", c)
}
type GetTtsResultOutFileURL struct {
OutputURL string `json:"output_url" url:"output_url"`
_rawJSON json.RawMessage
}
func (g *GetTtsResultOutFileURL) UnmarshalJSON(data []byte) error {
type unmarshaler GetTtsResultOutFileURL
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*g = GetTtsResultOutFileURL(value)
g._rawJSON = json.RawMessage(data)
return nil
}
func (g *GetTtsResultOutFileURL) String() string {
if len(g._rawJSON) > 0 {
if value, err := core.StringifyJSON(g._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(g); err == nil {
return value
}
return fmt.Sprintf("%#v", g)
}
type OutputFormat string
const (
OutputFormatWav OutputFormat = "wav"
OutputFormatFlac OutputFormat = "flac"
OutputFormatAdts OutputFormat = "adts"
OutputFormatMp3 OutputFormat = "mp3"
OutputFormatPcmS16Le OutputFormat = "pcm_s16le"
OutputFormatPcmS16Be OutputFormat = "pcm_s16be"
OutputFormatPcmS32Be OutputFormat = "pcm_s32be"
OutputFormatPcmS32Le OutputFormat = "pcm_s32le"
OutputFormatPcmF32Le OutputFormat = "pcm_f32le"
OutputFormatPcmF32Be OutputFormat = "pcm_f32be"
)
func NewOutputFormatFromString(s string) (OutputFormat, error) {
switch s {
case "wav":
return OutputFormatWav, nil
case "flac":
return OutputFormatFlac, nil
case "adts":
return OutputFormatAdts, nil
case "mp3":
return OutputFormatMp3, nil
case "pcm_s16le":
return OutputFormatPcmS16Le, nil
case "pcm_s16be":
return OutputFormatPcmS16Be, nil
case "pcm_s32be":
return OutputFormatPcmS32Be, nil
case "pcm_s32le":
return OutputFormatPcmS32Le, nil
case "pcm_f32le":
return OutputFormatPcmF32Le, nil
case "pcm_f32be":
return OutputFormatPcmF32Be, nil
}
var t OutputFormat
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (o OutputFormat) Ptr() *OutputFormat {
return &o
}
// Advanced options for controlling the TTS inference process.
//
// These options are only supported for the MARS-8 family of speech models.
//
// Attributes:
//
// stability: A value between 0.0 and 1.0 that controls the stability of
// the output audio.
// temperature: A value between 0.01 and 4.0 that controls the randomness
// of the output. Higher values mean more randomness.
// inference_steps: The number of steps for the diffusion model. A value
// between 1 and 1000.
// speaker_similarity: A value between 0.0 and 1.0 that controls how
// similar the output should be to the reference speaker.
type StreamTtsInferenceOptions struct {
Stability *float64 `json:"stability,omitempty" url:"stability,omitempty"`
Temperature *float64 `json:"temperature,omitempty" url:"temperature,omitempty"`
InferenceSteps *int `json:"inference_steps,omitempty" url:"inference_steps,omitempty"`
SpeakerSimilarity *float64 `json:"speaker_similarity,omitempty" url:"speaker_similarity,omitempty"`
LocalizeSpeakerWeight *float64 `json:"localize_speaker_weight,omitempty" url:"localize_speaker_weight,omitempty"`
AcousticQualityBoost *bool `json:"acoustic_quality_boost,omitempty" url:"acoustic_quality_boost,omitempty"`
_rawJSON json.RawMessage
}
func (s *StreamTtsInferenceOptions) UnmarshalJSON(data []byte) error {
type unmarshaler StreamTtsInferenceOptions
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*s = StreamTtsInferenceOptions(value)
s._rawJSON = json.RawMessage(data)
return nil
}
func (s *StreamTtsInferenceOptions) String() string {
if len(s._rawJSON) > 0 {
if value, err := core.StringifyJSON(s._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(s); err == nil {
return value
}
return fmt.Sprintf("%#v", s)
}
// Configuration for the output audio of Streaming TTS.
//
// Attributes:
//
// format: The format of the output audio. Defaults to MP3.
// duration: The desired duration of the output audio in seconds. If not
// provided, it will be determined automatically.
// apply_enhancement: Whether to apply audio enhancement to the output.
// Defaults to True.
type StreamTtsOutputConfiguration struct {
Format *OutputFormat `json:"format,omitempty" url:"format,omitempty"`
Duration *float64 `json:"duration,omitempty" url:"duration,omitempty"`
ApplyEnhancement *bool `json:"apply_enhancement,omitempty" url:"apply_enhancement,omitempty"`
_rawJSON json.RawMessage
}
func (s *StreamTtsOutputConfiguration) UnmarshalJSON(data []byte) error {
type unmarshaler StreamTtsOutputConfiguration
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*s = StreamTtsOutputConfiguration(value)
s._rawJSON = json.RawMessage(data)
return nil
}
func (s *StreamTtsOutputConfiguration) String() string {
if len(s._rawJSON) > 0 {
if value, err := core.StringifyJSON(s._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(s); err == nil {
return value
}
return fmt.Sprintf("%#v", s)
}
// Advanced settings for voice customization.
//
// Attributes:
//
// enhance_reference_audio_quality: Whether to enhance the quality of the
// reference audio before cloning. Defaults to False.
type StreamTtsVoiceSettings struct {
EnhanceReferenceAudioQuality *bool `json:"enhance_reference_audio_quality,omitempty" url:"enhance_reference_audio_quality,omitempty"`
MaintainSourceAccent *bool `json:"maintain_source_accent,omitempty" url:"maintain_source_accent,omitempty"`
ApplyRefLoudnessNorm *bool `json:"apply_ref_loudness_norm,omitempty" url:"apply_ref_loudness_norm,omitempty"`
_rawJSON json.RawMessage
}
func (s *StreamTtsVoiceSettings) UnmarshalJSON(data []byte) error {
type unmarshaler StreamTtsVoiceSettings
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*s = StreamTtsVoiceSettings(value)
s._rawJSON = json.RawMessage(data)
return nil
}
func (s *StreamTtsVoiceSettings) String() string {
if len(s._rawJSON) > 0 {
if value, err := core.StringifyJSON(s._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(s); err == nil {
return value
}
return fmt.Sprintf("%#v", s)
}
type CreateStreamTtsRequestPayloadLanguage string
const (
CreateStreamTtsRequestPayloadLanguageArKw CreateStreamTtsRequestPayloadLanguage = "ar-kw"
CreateStreamTtsRequestPayloadLanguageDeCh CreateStreamTtsRequestPayloadLanguage = "de-ch"
CreateStreamTtsRequestPayloadLanguageKoKr CreateStreamTtsRequestPayloadLanguage = "ko-kr"
CreateStreamTtsRequestPayloadLanguageThTh CreateStreamTtsRequestPayloadLanguage = "th-th"
CreateStreamTtsRequestPayloadLanguageMlIn CreateStreamTtsRequestPayloadLanguage = "ml-in"
CreateStreamTtsRequestPayloadLanguagePtPt CreateStreamTtsRequestPayloadLanguage = "pt-pt"
CreateStreamTtsRequestPayloadLanguageKnIn CreateStreamTtsRequestPayloadLanguage = "kn-in"
CreateStreamTtsRequestPayloadLanguageFiFi CreateStreamTtsRequestPayloadLanguage = "fi-fi"
CreateStreamTtsRequestPayloadLanguageEsMx CreateStreamTtsRequestPayloadLanguage = "es-mx"
CreateStreamTtsRequestPayloadLanguageFrCa CreateStreamTtsRequestPayloadLanguage = "fr-ca"
CreateStreamTtsRequestPayloadLanguageCsCz CreateStreamTtsRequestPayloadLanguage = "cs-cz"
CreateStreamTtsRequestPayloadLanguagePtBr CreateStreamTtsRequestPayloadLanguage = "pt-br"
CreateStreamTtsRequestPayloadLanguageHiIn CreateStreamTtsRequestPayloadLanguage = "hi-in"
CreateStreamTtsRequestPayloadLanguageArSy CreateStreamTtsRequestPayloadLanguage = "ar-sy"
CreateStreamTtsRequestPayloadLanguageEsUs CreateStreamTtsRequestPayloadLanguage = "es-us"
CreateStreamTtsRequestPayloadLanguageBnBd CreateStreamTtsRequestPayloadLanguage = "bn-bd"
CreateStreamTtsRequestPayloadLanguageJaJp CreateStreamTtsRequestPayloadLanguage = "ja-jp"
CreateStreamTtsRequestPayloadLanguageMrIn CreateStreamTtsRequestPayloadLanguage = "mr-in"
CreateStreamTtsRequestPayloadLanguageArMa CreateStreamTtsRequestPayloadLanguage = "ar-ma"
CreateStreamTtsRequestPayloadLanguageEsEs CreateStreamTtsRequestPayloadLanguage = "es-es"
CreateStreamTtsRequestPayloadLanguageEnUs CreateStreamTtsRequestPayloadLanguage = "en-us"
CreateStreamTtsRequestPayloadLanguageZhCn CreateStreamTtsRequestPayloadLanguage = "zh-cn"
CreateStreamTtsRequestPayloadLanguageElGr CreateStreamTtsRequestPayloadLanguage = "el-gr"
CreateStreamTtsRequestPayloadLanguagePlPl CreateStreamTtsRequestPayloadLanguage = "pl-pl"
CreateStreamTtsRequestPayloadLanguageArOm CreateStreamTtsRequestPayloadLanguage = "ar-om"
CreateStreamTtsRequestPayloadLanguageFrCh CreateStreamTtsRequestPayloadLanguage = "fr-ch"
CreateStreamTtsRequestPayloadLanguageEnUk CreateStreamTtsRequestPayloadLanguage = "en-uk"
CreateStreamTtsRequestPayloadLanguageEnAu CreateStreamTtsRequestPayloadLanguage = "en-au"
CreateStreamTtsRequestPayloadLanguageArJo CreateStreamTtsRequestPayloadLanguage = "ar-jo"
CreateStreamTtsRequestPayloadLanguageArAe CreateStreamTtsRequestPayloadLanguage = "ar-ae"
CreateStreamTtsRequestPayloadLanguageTrTr CreateStreamTtsRequestPayloadLanguage = "tr-tr"
CreateStreamTtsRequestPayloadLanguageArLy CreateStreamTtsRequestPayloadLanguage = "ar-ly"
CreateStreamTtsRequestPayloadLanguageRuRu CreateStreamTtsRequestPayloadLanguage = "ru-ru"
CreateStreamTtsRequestPayloadLanguageEnIn CreateStreamTtsRequestPayloadLanguage = "en-in"
CreateStreamTtsRequestPayloadLanguageArYe CreateStreamTtsRequestPayloadLanguage = "ar-ye"
CreateStreamTtsRequestPayloadLanguageArEg CreateStreamTtsRequestPayloadLanguage = "ar-eg"
CreateStreamTtsRequestPayloadLanguageFrBe CreateStreamTtsRequestPayloadLanguage = "fr-be"
CreateStreamTtsRequestPayloadLanguageTaIn CreateStreamTtsRequestPayloadLanguage = "ta-in"
CreateStreamTtsRequestPayloadLanguageZhTw CreateStreamTtsRequestPayloadLanguage = "zh-tw"
CreateStreamTtsRequestPayloadLanguageViVn CreateStreamTtsRequestPayloadLanguage = "vi-vn"
CreateStreamTtsRequestPayloadLanguageBnIn CreateStreamTtsRequestPayloadLanguage = "bn-in"
CreateStreamTtsRequestPayloadLanguageArSa CreateStreamTtsRequestPayloadLanguage = "ar-sa"
CreateStreamTtsRequestPayloadLanguageDeAt CreateStreamTtsRequestPayloadLanguage = "de-at"
CreateStreamTtsRequestPayloadLanguagePaIn CreateStreamTtsRequestPayloadLanguage = "pa-in"
CreateStreamTtsRequestPayloadLanguageItIt CreateStreamTtsRequestPayloadLanguage = "it-it"
CreateStreamTtsRequestPayloadLanguageNlNl CreateStreamTtsRequestPayloadLanguage = "nl-nl"
CreateStreamTtsRequestPayloadLanguageArBh CreateStreamTtsRequestPayloadLanguage = "ar-bh"
CreateStreamTtsRequestPayloadLanguageFrFr CreateStreamTtsRequestPayloadLanguage = "fr-fr"
CreateStreamTtsRequestPayloadLanguageArQa CreateStreamTtsRequestPayloadLanguage = "ar-qa"
CreateStreamTtsRequestPayloadLanguageUkUa CreateStreamTtsRequestPayloadLanguage = "uk-ua"
CreateStreamTtsRequestPayloadLanguageArTn CreateStreamTtsRequestPayloadLanguage = "ar-tn"
CreateStreamTtsRequestPayloadLanguageDeDe CreateStreamTtsRequestPayloadLanguage = "de-de"
CreateStreamTtsRequestPayloadLanguageArXa CreateStreamTtsRequestPayloadLanguage = "ar-xa"
CreateStreamTtsRequestPayloadLanguageArLb CreateStreamTtsRequestPayloadLanguage = "ar-lb"
CreateStreamTtsRequestPayloadLanguageZhHk CreateStreamTtsRequestPayloadLanguage = "zh-hk"
CreateStreamTtsRequestPayloadLanguageRoRo CreateStreamTtsRequestPayloadLanguage = "ro-ro"
CreateStreamTtsRequestPayloadLanguageAsIn CreateStreamTtsRequestPayloadLanguage = "as-in"
CreateStreamTtsRequestPayloadLanguageArIq CreateStreamTtsRequestPayloadLanguage = "ar-iq"
CreateStreamTtsRequestPayloadLanguageNlBe CreateStreamTtsRequestPayloadLanguage = "nl-be"
CreateStreamTtsRequestPayloadLanguageTeIn CreateStreamTtsRequestPayloadLanguage = "te-in"
CreateStreamTtsRequestPayloadLanguageIdId CreateStreamTtsRequestPayloadLanguage = "id-id"
CreateStreamTtsRequestPayloadLanguageArDz CreateStreamTtsRequestPayloadLanguage = "ar-dz"
)
func NewCreateStreamTtsRequestPayloadLanguageFromString(s string) (CreateStreamTtsRequestPayloadLanguage, error) {
switch s {
case "ar-kw":
return CreateStreamTtsRequestPayloadLanguageArKw, nil
case "de-ch":
return CreateStreamTtsRequestPayloadLanguageDeCh, nil
case "ko-kr":
return CreateStreamTtsRequestPayloadLanguageKoKr, nil
case "th-th":
return CreateStreamTtsRequestPayloadLanguageThTh, nil
case "ml-in":
return CreateStreamTtsRequestPayloadLanguageMlIn, nil
case "pt-pt":
return CreateStreamTtsRequestPayloadLanguagePtPt, nil
case "kn-in":
return CreateStreamTtsRequestPayloadLanguageKnIn, nil
case "fi-fi":
return CreateStreamTtsRequestPayloadLanguageFiFi, nil
case "es-mx":
return CreateStreamTtsRequestPayloadLanguageEsMx, nil
case "fr-ca":
return CreateStreamTtsRequestPayloadLanguageFrCa, nil
case "cs-cz":
return CreateStreamTtsRequestPayloadLanguageCsCz, nil
case "pt-br":
return CreateStreamTtsRequestPayloadLanguagePtBr, nil
case "hi-in":
return CreateStreamTtsRequestPayloadLanguageHiIn, nil
case "ar-sy":
return CreateStreamTtsRequestPayloadLanguageArSy, nil
case "es-us":
return CreateStreamTtsRequestPayloadLanguageEsUs, nil
case "bn-bd":
return CreateStreamTtsRequestPayloadLanguageBnBd, nil
case "ja-jp":
return CreateStreamTtsRequestPayloadLanguageJaJp, nil
case "mr-in":
return CreateStreamTtsRequestPayloadLanguageMrIn, nil
case "ar-ma":
return CreateStreamTtsRequestPayloadLanguageArMa, nil
case "es-es":
return CreateStreamTtsRequestPayloadLanguageEsEs, nil
case "en-us":
return CreateStreamTtsRequestPayloadLanguageEnUs, nil
case "zh-cn":
return CreateStreamTtsRequestPayloadLanguageZhCn, nil
case "el-gr":
return CreateStreamTtsRequestPayloadLanguageElGr, nil
case "pl-pl":
return CreateStreamTtsRequestPayloadLanguagePlPl, nil
case "ar-om":
return CreateStreamTtsRequestPayloadLanguageArOm, nil
case "fr-ch":
return CreateStreamTtsRequestPayloadLanguageFrCh, nil
case "en-uk":
return CreateStreamTtsRequestPayloadLanguageEnUk, nil
case "en-au":
return CreateStreamTtsRequestPayloadLanguageEnAu, nil
case "ar-jo":
return CreateStreamTtsRequestPayloadLanguageArJo, nil
case "ar-ae":
return CreateStreamTtsRequestPayloadLanguageArAe, nil
case "tr-tr":
return CreateStreamTtsRequestPayloadLanguageTrTr, nil
case "ar-ly":
return CreateStreamTtsRequestPayloadLanguageArLy, nil
case "ru-ru":
return CreateStreamTtsRequestPayloadLanguageRuRu, nil
case "en-in":
return CreateStreamTtsRequestPayloadLanguageEnIn, nil
case "ar-ye":
return CreateStreamTtsRequestPayloadLanguageArYe, nil
case "ar-eg":
return CreateStreamTtsRequestPayloadLanguageArEg, nil
case "fr-be":
return CreateStreamTtsRequestPayloadLanguageFrBe, nil
case "ta-in":
return CreateStreamTtsRequestPayloadLanguageTaIn, nil
case "zh-tw":
return CreateStreamTtsRequestPayloadLanguageZhTw, nil
case "vi-vn":
return CreateStreamTtsRequestPayloadLanguageViVn, nil
case "bn-in":
return CreateStreamTtsRequestPayloadLanguageBnIn, nil
case "ar-sa":
return CreateStreamTtsRequestPayloadLanguageArSa, nil
case "de-at":
return CreateStreamTtsRequestPayloadLanguageDeAt, nil
case "pa-in":
return CreateStreamTtsRequestPayloadLanguagePaIn, nil
case "it-it":
return CreateStreamTtsRequestPayloadLanguageItIt, nil
case "nl-nl":
return CreateStreamTtsRequestPayloadLanguageNlNl, nil
case "ar-bh":
return CreateStreamTtsRequestPayloadLanguageArBh, nil
case "fr-fr":
return CreateStreamTtsRequestPayloadLanguageFrFr, nil
case "ar-qa":
return CreateStreamTtsRequestPayloadLanguageArQa, nil
case "uk-ua":
return CreateStreamTtsRequestPayloadLanguageUkUa, nil
case "ar-tn":
return CreateStreamTtsRequestPayloadLanguageArTn, nil
case "de-de":
return CreateStreamTtsRequestPayloadLanguageDeDe, nil
case "ar-xa":
return CreateStreamTtsRequestPayloadLanguageArXa, nil
case "ar-lb":
return CreateStreamTtsRequestPayloadLanguageArLb, nil
case "zh-hk":
return CreateStreamTtsRequestPayloadLanguageZhHk, nil
case "ro-ro":
return CreateStreamTtsRequestPayloadLanguageRoRo, nil
case "as-in":
return CreateStreamTtsRequestPayloadLanguageAsIn, nil
case "ar-iq":
return CreateStreamTtsRequestPayloadLanguageArIq, nil
case "nl-be":
return CreateStreamTtsRequestPayloadLanguageNlBe, nil
case "te-in":
return CreateStreamTtsRequestPayloadLanguageTeIn, nil
case "id-id":
return CreateStreamTtsRequestPayloadLanguageIdId, nil
case "ar-dz":
return CreateStreamTtsRequestPayloadLanguageArDz, nil
}
var t CreateStreamTtsRequestPayloadLanguage
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (c CreateStreamTtsRequestPayloadLanguage) Ptr() *CreateStreamTtsRequestPayloadLanguage {
return &c
}
type CreateStreamTtsRequestPayloadSpeechModel string
const (
CreateStreamTtsRequestPayloadSpeechModelAuto CreateStreamTtsRequestPayloadSpeechModel = "auto"
CreateStreamTtsRequestPayloadSpeechModelMars8 CreateStreamTtsRequestPayloadSpeechModel = "mars-8"
CreateStreamTtsRequestPayloadSpeechModelMars8Flash CreateStreamTtsRequestPayloadSpeechModel = "mars-8-flash"
CreateStreamTtsRequestPayloadSpeechModelMars8Instruct CreateStreamTtsRequestPayloadSpeechModel = "mars-8-instruct"
CreateStreamTtsRequestPayloadSpeechModelMars7 CreateStreamTtsRequestPayloadSpeechModel = "mars-7"
CreateStreamTtsRequestPayloadSpeechModelMars6 CreateStreamTtsRequestPayloadSpeechModel = "mars-6"
CreateStreamTtsRequestPayloadSpeechModelMarsPro CreateStreamTtsRequestPayloadSpeechModel = "mars-pro"
CreateStreamTtsRequestPayloadSpeechModelMarsFlash CreateStreamTtsRequestPayloadSpeechModel = "mars-flash"
CreateStreamTtsRequestPayloadSpeechModelMarsInstruct CreateStreamTtsRequestPayloadSpeechModel = "mars-instruct"
)
func NewCreateStreamTtsRequestPayloadSpeechModelFromString(s string) (CreateStreamTtsRequestPayloadSpeechModel, error) {
switch s {
case "auto":
return CreateStreamTtsRequestPayloadSpeechModelAuto, nil
case "mars-8":
return CreateStreamTtsRequestPayloadSpeechModelMars8, nil
case "mars-8-flash":
return CreateStreamTtsRequestPayloadSpeechModelMars8Flash, nil
case "mars-8-instruct":
return CreateStreamTtsRequestPayloadSpeechModelMars8Instruct, nil
case "mars-7":
return CreateStreamTtsRequestPayloadSpeechModelMars7, nil
case "mars-6":
return CreateStreamTtsRequestPayloadSpeechModelMars6, nil
case "mars-pro":
return CreateStreamTtsRequestPayloadSpeechModelMarsPro, nil
case "mars-flash":
return CreateStreamTtsRequestPayloadSpeechModelMarsFlash, nil
case "mars-instruct":
return CreateStreamTtsRequestPayloadSpeechModelMarsInstruct, nil
}
var t CreateStreamTtsRequestPayloadSpeechModel
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (c CreateStreamTtsRequestPayloadSpeechModel) Ptr() *CreateStreamTtsRequestPayloadSpeechModel {
return &c
}
type GetTtsResultsTtsResultsPostResponseValue struct {
typeName string
String string
GetTtsResultOutFileURL *GetTtsResultOutFileURL
}
func NewGetTtsResultsTtsResultsPostResponseValueFromString(value string) *GetTtsResultsTtsResultsPostResponseValue {
return &GetTtsResultsTtsResultsPostResponseValue{typeName: "string", String: value}
}
func NewGetTtsResultsTtsResultsPostResponseValueFromGetTtsResultOutFileURL(value *GetTtsResultOutFileURL) *GetTtsResultsTtsResultsPostResponseValue {
return &GetTtsResultsTtsResultsPostResponseValue{typeName: "getTtsResultOutFileURL", GetTtsResultOutFileURL: value}
}
func (g *GetTtsResultsTtsResultsPostResponseValue) UnmarshalJSON(data []byte) error {
var valueString string
if err := json.Unmarshal(data, &valueString); err == nil {
g.typeName = "string"
g.String = valueString
return nil
}
valueGetTtsResultOutFileURL := new(GetTtsResultOutFileURL)
if err := json.Unmarshal(data, &valueGetTtsResultOutFileURL); err == nil {
g.typeName = "getTtsResultOutFileURL"
g.GetTtsResultOutFileURL = valueGetTtsResultOutFileURL
return nil
}
return fmt.Errorf("%s cannot be deserialized as a %T", data, g)
}
func (g GetTtsResultsTtsResultsPostResponseValue) MarshalJSON() ([]byte, error) {
switch g.typeName {
default:
return nil, fmt.Errorf("invalid type %s in %T", g.typeName, g)
case "string":
return json.Marshal(g.String)
case "getTtsResultOutFileURL":
return json.Marshal(g.GetTtsResultOutFileURL)
}
}
type GetTtsResultsTtsResultsPostResponseValueVisitor interface {
VisitString(string) error
VisitGetTtsResultOutFileURL(*GetTtsResultOutFileURL) error
}
func (g *GetTtsResultsTtsResultsPostResponseValue) Accept(visitor GetTtsResultsTtsResultsPostResponseValueVisitor) error {
switch g.typeName {
default:
return fmt.Errorf("invalid type %s in %T", g.typeName, g)
case "string":
return visitor.VisitString(g.String)
case "getTtsResultOutFileURL":
return visitor.VisitGetTtsResultOutFileURL(g.GetTtsResultOutFileURL)
}
}
type GetTtsRunInfoTtsResultRunIDGetResponse struct {
typeName string
String string
GetTtsResultOutFileURL *GetTtsResultOutFileURL
}
func NewGetTtsRunInfoTtsResultRunIDGetResponseFromString(value string) *GetTtsRunInfoTtsResultRunIDGetResponse {
return &GetTtsRunInfoTtsResultRunIDGetResponse{typeName: "string", String: value}
}
func NewGetTtsRunInfoTtsResultRunIDGetResponseFromGetTtsResultOutFileURL(value *GetTtsResultOutFileURL) *GetTtsRunInfoTtsResultRunIDGetResponse {
return &GetTtsRunInfoTtsResultRunIDGetResponse{typeName: "getTtsResultOutFileURL", GetTtsResultOutFileURL: value}
}
func (g *GetTtsRunInfoTtsResultRunIDGetResponse) UnmarshalJSON(data []byte) error {
var valueString string
if err := json.Unmarshal(data, &valueString); err == nil {
g.typeName = "string"
g.String = valueString
return nil
}
valueGetTtsResultOutFileURL := new(GetTtsResultOutFileURL)
if err := json.Unmarshal(data, &valueGetTtsResultOutFileURL); err == nil {
g.typeName = "getTtsResultOutFileURL"
g.GetTtsResultOutFileURL = valueGetTtsResultOutFileURL
return nil
}
return fmt.Errorf("%s cannot be deserialized as a %T", data, g)
}
func (g GetTtsRunInfoTtsResultRunIDGetResponse) MarshalJSON() ([]byte, error) {
switch g.typeName {
default:
return nil, fmt.Errorf("invalid type %s in %T", g.typeName, g)
case "string":
return json.Marshal(g.String)
case "getTtsResultOutFileURL":
return json.Marshal(g.GetTtsResultOutFileURL)
}
}
type GetTtsRunInfoTtsResultRunIDGetResponseVisitor interface {
VisitString(string) error
VisitGetTtsResultOutFileURL(*GetTtsResultOutFileURL) error
}
func (g *GetTtsRunInfoTtsResultRunIDGetResponse) Accept(visitor GetTtsRunInfoTtsResultRunIDGetResponseVisitor) error {
switch g.typeName {
default:
return fmt.Errorf("invalid type %s in %T", g.typeName, g)
case "string":
return visitor.VisitString(g.String)
case "getTtsResultOutFileURL":
return visitor.VisitGetTtsResultOutFileURL(g.GetTtsResultOutFileURL)
}
}