diff --git a/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1/cloud_tts.proto b/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1/cloud_tts.proto index a2715c81899..3de9cc439f5 100644 --- a/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1/cloud_tts.proto +++ b/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1/cloud_tts.proto @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -161,18 +161,85 @@ message Voice { // Used for advanced voice options. message AdvancedVoiceOptions { + // Safety setting for a single harm category. + message SafetySetting { + // The harm category to apply the safety setting to. + HarmCategory category = 1; + + // The harm block threshold for the safety setting. + HarmBlockThreshold threshold = 2; + } + + // Safety settings for the request. + message SafetySettings { + // The safety settings for the request. + repeated SafetySetting settings = 1; + } + + // Harm categories that will block the content. + enum HarmCategory { + // Default value. This value is unused. + HARM_CATEGORY_UNSPECIFIED = 0; + + // Content that promotes violence or incites hatred against individuals or + // groups based on certain attributes. + HARM_CATEGORY_HATE_SPEECH = 1; + + // Content that promotes, facilitates, or enables dangerous activities. + HARM_CATEGORY_DANGEROUS_CONTENT = 2; + + // Abusive, threatening, or content intended to bully, torment, or ridicule. + HARM_CATEGORY_HARASSMENT = 3; + + // Content that contains sexually explicit material. + HARM_CATEGORY_SEXUALLY_EXPLICIT = 4; + } + + // Harm block thresholds for the safety settings. + enum HarmBlockThreshold { + // The harm block threshold is unspecified. + HARM_BLOCK_THRESHOLD_UNSPECIFIED = 0; + + // Block content with a low harm probability or higher. + BLOCK_LOW_AND_ABOVE = 1; + + // Block content with a medium harm probability or higher. + BLOCK_MEDIUM_AND_ABOVE = 2; + + // Block content with a high harm probability. + BLOCK_ONLY_HIGH = 3; + + // Do not block any content, regardless of its harm probability. + BLOCK_NONE = 4; + + // Turn off the safety filter entirely. + OFF = 5; + } + // Only for Journey voices. If false, the synthesis is context aware // and has a higher latency. optional bool low_latency_journey_synthesis = 1; - // Optional. Input only. If true, relaxes safety filters for Gemini TTS. Only - // supported for accounts linked to Invoiced (Offline) Cloud billing accounts. - // Otherwise, will return result - // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + // Optional. Input only. Deprecated, use safety_settings instead. + // If true, relaxes safety filters for Gemini TTS. bool relax_safety_filters = 8 [ + deprecated = true, (google.api.field_behavior) = INPUT_ONLY, (google.api.field_behavior) = OPTIONAL ]; + + // Optional. Input only. This applies to Gemini TTS only. If set, the category + // specified in the safety setting will be blocked if the harm probability is + // above the threshold. Otherwise, the safety filter will be disabled by + // default. + SafetySettings safety_settings = 9 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. If true, textnorm will be applied to text input. This feature is + // enabled by default. Only applies for Gemini TTS. + optional bool enable_textnorm = 2 [(google.api.field_behavior) = OPTIONAL]; } // The top-level message sent by the client for the `SynthesizeSpeech` method. @@ -186,8 +253,9 @@ message SynthesizeSpeechRequest { // Required. The configuration of the synthesized audio. AudioConfig audio_config = 3 [(google.api.field_behavior) = REQUIRED]; - // Advanced voice options. - optional AdvancedVoiceOptions advanced_voice_options = 8; + // Optional. Advanced voice options. + optional AdvancedVoiceOptions advanced_voice_options = 8 + [(google.api.field_behavior) = OPTIONAL]; } // Pronunciation customization for a phrase. @@ -296,8 +364,8 @@ message SynthesisInput { // The raw text to be synthesized. string text = 1; - // Markup for HD voices specifically. This field may not be used with any - // other voices. + // Markup for Chirp 3: HD voices specifically. This field may not be used + // with any other voices. string markup = 5; // The SSML document to be synthesized. The SSML document must be valid @@ -522,6 +590,10 @@ message StreamingSynthesizeConfig { // be inside a phoneme tag. CustomPronunciations custom_pronunciations = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Advanced voice options. + optional AdvancedVoiceOptions advanced_voice_options = 7 + [(google.api.field_behavior) = OPTIONAL]; } // Input to be synthesized. @@ -532,8 +604,8 @@ message StreamingSynthesisInput { // in the output audio. string text = 1; - // Markup for HD voices specifically. This field may not be used with any - // other voices. + // Markup for Chirp 3: HD voices specifically. This field may not be used + // with any other voices. string markup = 5; // Multi-speaker markup for Gemini TTS. This field may not diff --git a/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1/cloud_tts_lrs.proto b/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1/cloud_tts_lrs.proto index b226ac49580..3a663ab5030 100644 --- a/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1/cloud_tts_lrs.proto +++ b/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1/cloud_tts_lrs.proto @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1beta1/cloud_tts.proto b/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1beta1/cloud_tts.proto index 06604341871..d13736651fc 100644 --- a/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1beta1/cloud_tts.proto +++ b/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1beta1/cloud_tts.proto @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -164,18 +164,85 @@ message Voice { // Used for advanced voice options. message AdvancedVoiceOptions { + // Safety setting for a single harm category. + message SafetySetting { + // The harm category to apply the safety setting to. + HarmCategory category = 1; + + // The harm block threshold for the safety setting. + HarmBlockThreshold threshold = 2; + } + + // Safety settings for the request. + message SafetySettings { + // The safety settings for the request. + repeated SafetySetting settings = 1; + } + + // Harm categories that will block the content. + enum HarmCategory { + // Default value. This value is unused. + HARM_CATEGORY_UNSPECIFIED = 0; + + // Content that promotes violence or incites hatred against individuals or + // groups based on certain attributes. + HARM_CATEGORY_HATE_SPEECH = 1; + + // Content that promotes, facilitates, or enables dangerous activities. + HARM_CATEGORY_DANGEROUS_CONTENT = 2; + + // Abusive, threatening, or content intended to bully, torment, or ridicule. + HARM_CATEGORY_HARASSMENT = 3; + + // Content that contains sexually explicit material. + HARM_CATEGORY_SEXUALLY_EXPLICIT = 4; + } + + // Harm block thresholds for the safety settings. + enum HarmBlockThreshold { + // The harm block threshold is unspecified. + HARM_BLOCK_THRESHOLD_UNSPECIFIED = 0; + + // Block content with a low harm probability or higher. + BLOCK_LOW_AND_ABOVE = 1; + + // Block content with a medium harm probability or higher. + BLOCK_MEDIUM_AND_ABOVE = 2; + + // Block content with a high harm probability. + BLOCK_ONLY_HIGH = 3; + + // Do not block any content, regardless of its harm probability. + BLOCK_NONE = 4; + + // Turn off the safety filter entirely. + OFF = 5; + } + // Only for Journey voices. If false, the synthesis is context aware // and has a higher latency. optional bool low_latency_journey_synthesis = 1; - // Optional. Input only. If true, relaxes safety filters for Gemini TTS. Only - // supported for accounts linked to Invoiced (Offline) Cloud billing accounts. - // Otherwise, will return result - // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + // Optional. Input only. Deprecated, use safety_settings instead. + // If true, relaxes safety filters for Gemini TTS. bool relax_safety_filters = 8 [ + deprecated = true, (google.api.field_behavior) = INPUT_ONLY, (google.api.field_behavior) = OPTIONAL ]; + + // Optional. Input only. This applies to Gemini TTS only. If set, the category + // specified in the safety setting will be blocked if the harm probability is + // above the threshold. Otherwise, the safety filter will be disabled by + // default. + SafetySettings safety_settings = 9 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. If true, textnorm will be applied to text input. This feature is + // enabled by default. Only applies for Gemini TTS. + optional bool enable_textnorm = 2 [(google.api.field_behavior) = OPTIONAL]; } // The top-level message sent by the client for the `SynthesizeSpeech` method. @@ -201,8 +268,9 @@ message SynthesizeSpeechRequest { // Whether and what timepoints are returned in the response. repeated TimepointType enable_time_pointing = 4; - // Advanced voice options. - optional AdvancedVoiceOptions advanced_voice_options = 8; + // Optional. Advanced voice options. + optional AdvancedVoiceOptions advanced_voice_options = 8 + [(google.api.field_behavior) = OPTIONAL]; } // Pronunciation customization for a phrase. @@ -311,8 +379,8 @@ message SynthesisInput { // The raw text to be synthesized. string text = 1; - // Markup for HD voices specifically. This field may not be used with any - // other voices. + // Markup for Chirp 3: HD voices specifically. This field may not be used + // with any other voices. string markup = 5; // The SSML document to be synthesized. The SSML document must be valid @@ -554,6 +622,10 @@ message StreamingSynthesizeConfig { // be inside a phoneme tag. CustomPronunciations custom_pronunciations = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Advanced voice options. + optional AdvancedVoiceOptions advanced_voice_options = 7 + [(google.api.field_behavior) = OPTIONAL]; } // Input to be synthesized. @@ -564,8 +636,8 @@ message StreamingSynthesisInput { // in the output audio. string text = 1; - // Markup for HD voices specifically. This field may not be used with any - // other voices. + // Markup for Chirp 3: HD voices specifically. This field may not be used + // with any other voices. string markup = 5; // Multi-speaker markup for Gemini TTS. This field may not diff --git a/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto b/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto index 4fe7d56130a..4b8a9c012e3 100644 --- a/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto +++ b/packages/google-cloud-texttospeech/protos/google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-texttospeech/protos/protos.d.ts b/packages/google-cloud-texttospeech/protos/protos.d.ts index e55509fc8c3..e0431f9f8d1 100644 --- a/packages/google-cloud-texttospeech/protos/protos.d.ts +++ b/packages/google-cloud-texttospeech/protos/protos.d.ts @@ -450,6 +450,12 @@ export namespace google { /** AdvancedVoiceOptions relaxSafetyFilters */ relaxSafetyFilters?: (boolean|null); + + /** AdvancedVoiceOptions safetySettings */ + safetySettings?: (google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySettings|null); + + /** AdvancedVoiceOptions enableTextnorm */ + enableTextnorm?: (boolean|null); } /** Represents an AdvancedVoiceOptions. */ @@ -467,6 +473,12 @@ export namespace google { /** AdvancedVoiceOptions relaxSafetyFilters. */ public relaxSafetyFilters: boolean; + /** AdvancedVoiceOptions safetySettings. */ + public safetySettings?: (google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySettings|null); + + /** AdvancedVoiceOptions enableTextnorm. */ + public enableTextnorm?: (boolean|null); + /** * Creates a new AdvancedVoiceOptions instance using the specified properties. * @param [properties] Properties to set @@ -545,6 +557,228 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace AdvancedVoiceOptions { + + /** Properties of a SafetySetting. */ + interface ISafetySetting { + + /** SafetySetting category */ + category?: (google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmCategory|keyof typeof google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmCategory|null); + + /** SafetySetting threshold */ + threshold?: (google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmBlockThreshold|keyof typeof google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmBlockThreshold|null); + } + + /** Represents a SafetySetting. */ + class SafetySetting implements ISafetySetting { + + /** + * Constructs a new SafetySetting. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySetting); + + /** SafetySetting category. */ + public category: (google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmCategory|keyof typeof google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmCategory); + + /** SafetySetting threshold. */ + public threshold: (google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmBlockThreshold|keyof typeof google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmBlockThreshold); + + /** + * Creates a new SafetySetting instance using the specified properties. + * @param [properties] Properties to set + * @returns SafetySetting instance + */ + public static create(properties?: google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySetting): google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting; + + /** + * Encodes the specified SafetySetting message. Does not implicitly {@link google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting.verify|verify} messages. + * @param message SafetySetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SafetySetting message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting.verify|verify} messages. + * @param message SafetySetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SafetySetting message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SafetySetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting; + + /** + * Decodes a SafetySetting message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SafetySetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting; + + /** + * Verifies a SafetySetting message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SafetySetting message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SafetySetting + */ + public static fromObject(object: { [k: string]: any }): google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting; + + /** + * Creates a plain object from a SafetySetting message. Also converts values to other types if specified. + * @param message SafetySetting + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SafetySetting to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SafetySetting + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SafetySettings. */ + interface ISafetySettings { + + /** SafetySettings settings */ + settings?: (google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySetting[]|null); + } + + /** Represents a SafetySettings. */ + class SafetySettings implements ISafetySettings { + + /** + * Constructs a new SafetySettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySettings); + + /** SafetySettings settings. */ + public settings: google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySetting[]; + + /** + * Creates a new SafetySettings instance using the specified properties. + * @param [properties] Properties to set + * @returns SafetySettings instance + */ + public static create(properties?: google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySettings): google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings; + + /** + * Encodes the specified SafetySettings message. Does not implicitly {@link google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings.verify|verify} messages. + * @param message SafetySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SafetySettings message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings.verify|verify} messages. + * @param message SafetySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SafetySettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SafetySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings; + + /** + * Decodes a SafetySettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SafetySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings; + + /** + * Verifies a SafetySettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SafetySettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SafetySettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings; + + /** + * Creates a plain object from a SafetySettings message. Also converts values to other types if specified. + * @param message SafetySettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SafetySettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SafetySettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** HarmCategory enum. */ + enum HarmCategory { + HARM_CATEGORY_UNSPECIFIED = 0, + HARM_CATEGORY_HATE_SPEECH = 1, + HARM_CATEGORY_DANGEROUS_CONTENT = 2, + HARM_CATEGORY_HARASSMENT = 3, + HARM_CATEGORY_SEXUALLY_EXPLICIT = 4 + } + + /** HarmBlockThreshold enum. */ + enum HarmBlockThreshold { + HARM_BLOCK_THRESHOLD_UNSPECIFIED = 0, + BLOCK_LOW_AND_ABOVE = 1, + BLOCK_MEDIUM_AND_ABOVE = 2, + BLOCK_ONLY_HIGH = 3, + BLOCK_NONE = 4, + OFF = 5 + } + } + /** Properties of a SynthesizeSpeechRequest. */ interface ISynthesizeSpeechRequest { @@ -2098,6 +2332,9 @@ export namespace google { /** StreamingSynthesizeConfig customPronunciations */ customPronunciations?: (google.cloud.texttospeech.v1.ICustomPronunciations|null); + + /** StreamingSynthesizeConfig advancedVoiceOptions */ + advancedVoiceOptions?: (google.cloud.texttospeech.v1.IAdvancedVoiceOptions|null); } /** Represents a StreamingSynthesizeConfig. */ @@ -2118,6 +2355,9 @@ export namespace google { /** StreamingSynthesizeConfig customPronunciations. */ public customPronunciations?: (google.cloud.texttospeech.v1.ICustomPronunciations|null); + /** StreamingSynthesizeConfig advancedVoiceOptions. */ + public advancedVoiceOptions?: (google.cloud.texttospeech.v1.IAdvancedVoiceOptions|null); + /** * Creates a new StreamingSynthesizeConfig instance using the specified properties. * @param [properties] Properties to set @@ -3312,6 +3552,12 @@ export namespace google { /** AdvancedVoiceOptions relaxSafetyFilters */ relaxSafetyFilters?: (boolean|null); + + /** AdvancedVoiceOptions safetySettings */ + safetySettings?: (google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySettings|null); + + /** AdvancedVoiceOptions enableTextnorm */ + enableTextnorm?: (boolean|null); } /** Represents an AdvancedVoiceOptions. */ @@ -3329,6 +3575,12 @@ export namespace google { /** AdvancedVoiceOptions relaxSafetyFilters. */ public relaxSafetyFilters: boolean; + /** AdvancedVoiceOptions safetySettings. */ + public safetySettings?: (google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySettings|null); + + /** AdvancedVoiceOptions enableTextnorm. */ + public enableTextnorm?: (boolean|null); + /** * Creates a new AdvancedVoiceOptions instance using the specified properties. * @param [properties] Properties to set @@ -3407,6 +3659,228 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace AdvancedVoiceOptions { + + /** Properties of a SafetySetting. */ + interface ISafetySetting { + + /** SafetySetting category */ + category?: (google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmCategory|keyof typeof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmCategory|null); + + /** SafetySetting threshold */ + threshold?: (google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmBlockThreshold|keyof typeof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmBlockThreshold|null); + } + + /** Represents a SafetySetting. */ + class SafetySetting implements ISafetySetting { + + /** + * Constructs a new SafetySetting. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySetting); + + /** SafetySetting category. */ + public category: (google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmCategory|keyof typeof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmCategory); + + /** SafetySetting threshold. */ + public threshold: (google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmBlockThreshold|keyof typeof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmBlockThreshold); + + /** + * Creates a new SafetySetting instance using the specified properties. + * @param [properties] Properties to set + * @returns SafetySetting instance + */ + public static create(properties?: google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySetting): google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting; + + /** + * Encodes the specified SafetySetting message. Does not implicitly {@link google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting.verify|verify} messages. + * @param message SafetySetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SafetySetting message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting.verify|verify} messages. + * @param message SafetySetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SafetySetting message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SafetySetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting; + + /** + * Decodes a SafetySetting message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SafetySetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting; + + /** + * Verifies a SafetySetting message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SafetySetting message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SafetySetting + */ + public static fromObject(object: { [k: string]: any }): google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting; + + /** + * Creates a plain object from a SafetySetting message. Also converts values to other types if specified. + * @param message SafetySetting + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SafetySetting to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SafetySetting + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SafetySettings. */ + interface ISafetySettings { + + /** SafetySettings settings */ + settings?: (google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySetting[]|null); + } + + /** Represents a SafetySettings. */ + class SafetySettings implements ISafetySettings { + + /** + * Constructs a new SafetySettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySettings); + + /** SafetySettings settings. */ + public settings: google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySetting[]; + + /** + * Creates a new SafetySettings instance using the specified properties. + * @param [properties] Properties to set + * @returns SafetySettings instance + */ + public static create(properties?: google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySettings): google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings; + + /** + * Encodes the specified SafetySettings message. Does not implicitly {@link google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings.verify|verify} messages. + * @param message SafetySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SafetySettings message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings.verify|verify} messages. + * @param message SafetySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SafetySettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SafetySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings; + + /** + * Decodes a SafetySettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SafetySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings; + + /** + * Verifies a SafetySettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SafetySettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SafetySettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings; + + /** + * Creates a plain object from a SafetySettings message. Also converts values to other types if specified. + * @param message SafetySettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SafetySettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SafetySettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** HarmCategory enum. */ + enum HarmCategory { + HARM_CATEGORY_UNSPECIFIED = 0, + HARM_CATEGORY_HATE_SPEECH = 1, + HARM_CATEGORY_DANGEROUS_CONTENT = 2, + HARM_CATEGORY_HARASSMENT = 3, + HARM_CATEGORY_SEXUALLY_EXPLICIT = 4 + } + + /** HarmBlockThreshold enum. */ + enum HarmBlockThreshold { + HARM_BLOCK_THRESHOLD_UNSPECIFIED = 0, + BLOCK_LOW_AND_ABOVE = 1, + BLOCK_MEDIUM_AND_ABOVE = 2, + BLOCK_ONLY_HIGH = 3, + BLOCK_NONE = 4, + OFF = 5 + } + } + /** Properties of a SynthesizeSpeechRequest. */ interface ISynthesizeSpeechRequest { @@ -5090,6 +5564,9 @@ export namespace google { /** StreamingSynthesizeConfig customPronunciations */ customPronunciations?: (google.cloud.texttospeech.v1beta1.ICustomPronunciations|null); + + /** StreamingSynthesizeConfig advancedVoiceOptions */ + advancedVoiceOptions?: (google.cloud.texttospeech.v1beta1.IAdvancedVoiceOptions|null); } /** Represents a StreamingSynthesizeConfig. */ @@ -5110,6 +5587,9 @@ export namespace google { /** StreamingSynthesizeConfig customPronunciations. */ public customPronunciations?: (google.cloud.texttospeech.v1beta1.ICustomPronunciations|null); + /** StreamingSynthesizeConfig advancedVoiceOptions. */ + public advancedVoiceOptions?: (google.cloud.texttospeech.v1beta1.IAdvancedVoiceOptions|null); + /** * Creates a new StreamingSynthesizeConfig instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-texttospeech/protos/protos.js b/packages/google-cloud-texttospeech/protos/protos.js index 806ed535b83..fe271e7098d 100644 --- a/packages/google-cloud-texttospeech/protos/protos.js +++ b/packages/google-cloud-texttospeech/protos/protos.js @@ -1004,6 +1004,8 @@ * @interface IAdvancedVoiceOptions * @property {boolean|null} [lowLatencyJourneySynthesis] AdvancedVoiceOptions lowLatencyJourneySynthesis * @property {boolean|null} [relaxSafetyFilters] AdvancedVoiceOptions relaxSafetyFilters + * @property {google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySettings|null} [safetySettings] AdvancedVoiceOptions safetySettings + * @property {boolean|null} [enableTextnorm] AdvancedVoiceOptions enableTextnorm */ /** @@ -1037,6 +1039,22 @@ */ AdvancedVoiceOptions.prototype.relaxSafetyFilters = false; + /** + * AdvancedVoiceOptions safetySettings. + * @member {google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySettings|null|undefined} safetySettings + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions + * @instance + */ + AdvancedVoiceOptions.prototype.safetySettings = null; + + /** + * AdvancedVoiceOptions enableTextnorm. + * @member {boolean|null|undefined} enableTextnorm + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions + * @instance + */ + AdvancedVoiceOptions.prototype.enableTextnorm = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -1046,6 +1064,12 @@ set: $util.oneOfSetter($oneOfFields) }); + // Virtual OneOf for proto3 optional field + Object.defineProperty(AdvancedVoiceOptions.prototype, "_enableTextnorm", { + get: $util.oneOfGetter($oneOfFields = ["enableTextnorm"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new AdvancedVoiceOptions instance using the specified properties. * @function create @@ -1072,8 +1096,12 @@ writer = $Writer.create(); if (message.lowLatencyJourneySynthesis != null && Object.hasOwnProperty.call(message, "lowLatencyJourneySynthesis")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.lowLatencyJourneySynthesis); + if (message.enableTextnorm != null && Object.hasOwnProperty.call(message, "enableTextnorm")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.enableTextnorm); if (message.relaxSafetyFilters != null && Object.hasOwnProperty.call(message, "relaxSafetyFilters")) writer.uint32(/* id 8, wireType 0 =*/64).bool(message.relaxSafetyFilters); + if (message.safetySettings != null && Object.hasOwnProperty.call(message, "safetySettings")) + $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings.encode(message.safetySettings, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); return writer; }; @@ -1118,6 +1146,14 @@ message.relaxSafetyFilters = reader.bool(); break; } + case 9: { + message.safetySettings = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings.decode(reader, reader.uint32()); + break; + } + case 2: { + message.enableTextnorm = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -1162,6 +1198,16 @@ if (message.relaxSafetyFilters != null && message.hasOwnProperty("relaxSafetyFilters")) if (typeof message.relaxSafetyFilters !== "boolean") return "relaxSafetyFilters: boolean expected"; + if (message.safetySettings != null && message.hasOwnProperty("safetySettings")) { + var error = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings.verify(message.safetySettings); + if (error) + return "safetySettings." + error; + } + if (message.enableTextnorm != null && message.hasOwnProperty("enableTextnorm")) { + properties._enableTextnorm = 1; + if (typeof message.enableTextnorm !== "boolean") + return "enableTextnorm: boolean expected"; + } return null; }; @@ -1181,6 +1227,13 @@ message.lowLatencyJourneySynthesis = Boolean(object.lowLatencyJourneySynthesis); if (object.relaxSafetyFilters != null) message.relaxSafetyFilters = Boolean(object.relaxSafetyFilters); + if (object.safetySettings != null) { + if (typeof object.safetySettings !== "object") + throw TypeError(".google.cloud.texttospeech.v1.AdvancedVoiceOptions.safetySettings: object expected"); + message.safetySettings = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings.fromObject(object.safetySettings); + } + if (object.enableTextnorm != null) + message.enableTextnorm = Boolean(object.enableTextnorm); return message; }; @@ -1197,15 +1250,24 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.relaxSafetyFilters = false; + object.safetySettings = null; + } if (message.lowLatencyJourneySynthesis != null && message.hasOwnProperty("lowLatencyJourneySynthesis")) { object.lowLatencyJourneySynthesis = message.lowLatencyJourneySynthesis; if (options.oneofs) object._lowLatencyJourneySynthesis = "lowLatencyJourneySynthesis"; } + if (message.enableTextnorm != null && message.hasOwnProperty("enableTextnorm")) { + object.enableTextnorm = message.enableTextnorm; + if (options.oneofs) + object._enableTextnorm = "enableTextnorm"; + } if (message.relaxSafetyFilters != null && message.hasOwnProperty("relaxSafetyFilters")) object.relaxSafetyFilters = message.relaxSafetyFilters; + if (message.safetySettings != null && message.hasOwnProperty("safetySettings")) + object.safetySettings = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings.toObject(message.safetySettings, options); return object; }; @@ -1235,339 +1297,600 @@ return typeUrlPrefix + "/google.cloud.texttospeech.v1.AdvancedVoiceOptions"; }; - return AdvancedVoiceOptions; - })(); - - v1.SynthesizeSpeechRequest = (function() { - - /** - * Properties of a SynthesizeSpeechRequest. - * @memberof google.cloud.texttospeech.v1 - * @interface ISynthesizeSpeechRequest - * @property {google.cloud.texttospeech.v1.ISynthesisInput|null} [input] SynthesizeSpeechRequest input - * @property {google.cloud.texttospeech.v1.IVoiceSelectionParams|null} [voice] SynthesizeSpeechRequest voice - * @property {google.cloud.texttospeech.v1.IAudioConfig|null} [audioConfig] SynthesizeSpeechRequest audioConfig - * @property {google.cloud.texttospeech.v1.IAdvancedVoiceOptions|null} [advancedVoiceOptions] SynthesizeSpeechRequest advancedVoiceOptions - */ - - /** - * Constructs a new SynthesizeSpeechRequest. - * @memberof google.cloud.texttospeech.v1 - * @classdesc Represents a SynthesizeSpeechRequest. - * @implements ISynthesizeSpeechRequest - * @constructor - * @param {google.cloud.texttospeech.v1.ISynthesizeSpeechRequest=} [properties] Properties to set - */ - function SynthesizeSpeechRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + AdvancedVoiceOptions.SafetySetting = (function() { - /** - * SynthesizeSpeechRequest input. - * @member {google.cloud.texttospeech.v1.ISynthesisInput|null|undefined} input - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @instance - */ - SynthesizeSpeechRequest.prototype.input = null; + /** + * Properties of a SafetySetting. + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions + * @interface ISafetySetting + * @property {google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmCategory|null} [category] SafetySetting category + * @property {google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmBlockThreshold|null} [threshold] SafetySetting threshold + */ - /** - * SynthesizeSpeechRequest voice. - * @member {google.cloud.texttospeech.v1.IVoiceSelectionParams|null|undefined} voice - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @instance - */ - SynthesizeSpeechRequest.prototype.voice = null; + /** + * Constructs a new SafetySetting. + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions + * @classdesc Represents a SafetySetting. + * @implements ISafetySetting + * @constructor + * @param {google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySetting=} [properties] Properties to set + */ + function SafetySetting(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * SynthesizeSpeechRequest audioConfig. - * @member {google.cloud.texttospeech.v1.IAudioConfig|null|undefined} audioConfig - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @instance - */ - SynthesizeSpeechRequest.prototype.audioConfig = null; + /** + * SafetySetting category. + * @member {google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmCategory} category + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting + * @instance + */ + SafetySetting.prototype.category = 0; - /** - * SynthesizeSpeechRequest advancedVoiceOptions. - * @member {google.cloud.texttospeech.v1.IAdvancedVoiceOptions|null|undefined} advancedVoiceOptions - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @instance - */ - SynthesizeSpeechRequest.prototype.advancedVoiceOptions = null; + /** + * SafetySetting threshold. + * @member {google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmBlockThreshold} threshold + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting + * @instance + */ + SafetySetting.prototype.threshold = 0; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Creates a new SafetySetting instance using the specified properties. + * @function create + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySetting=} [properties] Properties to set + * @returns {google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting} SafetySetting instance + */ + SafetySetting.create = function create(properties) { + return new SafetySetting(properties); + }; - // Virtual OneOf for proto3 optional field - Object.defineProperty(SynthesizeSpeechRequest.prototype, "_advancedVoiceOptions", { - get: $util.oneOfGetter($oneOfFields = ["advancedVoiceOptions"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Encodes the specified SafetySetting message. Does not implicitly {@link google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting.verify|verify} messages. + * @function encode + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySetting} message SafetySetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SafetySetting.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.category != null && Object.hasOwnProperty.call(message, "category")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.category); + if (message.threshold != null && Object.hasOwnProperty.call(message, "threshold")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.threshold); + return writer; + }; - /** - * Creates a new SynthesizeSpeechRequest instance using the specified properties. - * @function create - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @static - * @param {google.cloud.texttospeech.v1.ISynthesizeSpeechRequest=} [properties] Properties to set - * @returns {google.cloud.texttospeech.v1.SynthesizeSpeechRequest} SynthesizeSpeechRequest instance - */ - SynthesizeSpeechRequest.create = function create(properties) { - return new SynthesizeSpeechRequest(properties); - }; + /** + * Encodes the specified SafetySetting message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySetting} message SafetySetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SafetySetting.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Encodes the specified SynthesizeSpeechRequest message. Does not implicitly {@link google.cloud.texttospeech.v1.SynthesizeSpeechRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @static - * @param {google.cloud.texttospeech.v1.ISynthesizeSpeechRequest} message SynthesizeSpeechRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SynthesizeSpeechRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.input != null && Object.hasOwnProperty.call(message, "input")) - $root.google.cloud.texttospeech.v1.SynthesisInput.encode(message.input, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.voice != null && Object.hasOwnProperty.call(message, "voice")) - $root.google.cloud.texttospeech.v1.VoiceSelectionParams.encode(message.voice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.audioConfig != null && Object.hasOwnProperty.call(message, "audioConfig")) - $root.google.cloud.texttospeech.v1.AudioConfig.encode(message.audioConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.advancedVoiceOptions != null && Object.hasOwnProperty.call(message, "advancedVoiceOptions")) - $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.encode(message.advancedVoiceOptions, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - return writer; - }; + /** + * Decodes a SafetySetting message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting} SafetySetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SafetySetting.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.category = reader.int32(); + break; + } + case 2: { + message.threshold = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified SynthesizeSpeechRequest message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1.SynthesizeSpeechRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @static - * @param {google.cloud.texttospeech.v1.ISynthesizeSpeechRequest} message SynthesizeSpeechRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SynthesizeSpeechRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Decodes a SafetySetting message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting} SafetySetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SafetySetting.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Decodes a SynthesizeSpeechRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.texttospeech.v1.SynthesizeSpeechRequest} SynthesizeSpeechRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SynthesizeSpeechRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.texttospeech.v1.SynthesizeSpeechRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.input = $root.google.cloud.texttospeech.v1.SynthesisInput.decode(reader, reader.uint32()); + /** + * Verifies a SafetySetting message. + * @function verify + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SafetySetting.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.category != null && message.hasOwnProperty("category")) + switch (message.category) { + default: + return "category: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: break; } - case 2: { - message.voice = $root.google.cloud.texttospeech.v1.VoiceSelectionParams.decode(reader, reader.uint32()); + if (message.threshold != null && message.hasOwnProperty("threshold")) + switch (message.threshold) { + default: + return "threshold: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: break; } - case 3: { - message.audioConfig = $root.google.cloud.texttospeech.v1.AudioConfig.decode(reader, reader.uint32()); + return null; + }; + + /** + * Creates a SafetySetting message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting} SafetySetting + */ + SafetySetting.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting) + return object; + var message = new $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting(); + switch (object.category) { + default: + if (typeof object.category === "number") { + message.category = object.category; break; } - case 8: { - message.advancedVoiceOptions = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.decode(reader, reader.uint32()); + break; + case "HARM_CATEGORY_UNSPECIFIED": + case 0: + message.category = 0; + break; + case "HARM_CATEGORY_HATE_SPEECH": + case 1: + message.category = 1; + break; + case "HARM_CATEGORY_DANGEROUS_CONTENT": + case 2: + message.category = 2; + break; + case "HARM_CATEGORY_HARASSMENT": + case 3: + message.category = 3; + break; + case "HARM_CATEGORY_SEXUALLY_EXPLICIT": + case 4: + message.category = 4; + break; + } + switch (object.threshold) { + default: + if (typeof object.threshold === "number") { + message.threshold = object.threshold; break; } - default: - reader.skipType(tag & 7); + break; + case "HARM_BLOCK_THRESHOLD_UNSPECIFIED": + case 0: + message.threshold = 0; + break; + case "BLOCK_LOW_AND_ABOVE": + case 1: + message.threshold = 1; + break; + case "BLOCK_MEDIUM_AND_ABOVE": + case 2: + message.threshold = 2; + break; + case "BLOCK_ONLY_HIGH": + case 3: + message.threshold = 3; + break; + case "BLOCK_NONE": + case 4: + message.threshold = 4; + break; + case "OFF": + case 5: + message.threshold = 5; break; } - } - return message; - }; + return message; + }; - /** - * Decodes a SynthesizeSpeechRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.texttospeech.v1.SynthesizeSpeechRequest} SynthesizeSpeechRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SynthesizeSpeechRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates a plain object from a SafetySetting message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting} message SafetySetting + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SafetySetting.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.category = options.enums === String ? "HARM_CATEGORY_UNSPECIFIED" : 0; + object.threshold = options.enums === String ? "HARM_BLOCK_THRESHOLD_UNSPECIFIED" : 0; + } + if (message.category != null && message.hasOwnProperty("category")) + object.category = options.enums === String ? $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmCategory[message.category] === undefined ? message.category : $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmCategory[message.category] : message.category; + if (message.threshold != null && message.hasOwnProperty("threshold")) + object.threshold = options.enums === String ? $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmBlockThreshold[message.threshold] === undefined ? message.threshold : $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmBlockThreshold[message.threshold] : message.threshold; + return object; + }; - /** - * Verifies a SynthesizeSpeechRequest message. - * @function verify - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SynthesizeSpeechRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.input != null && message.hasOwnProperty("input")) { - var error = $root.google.cloud.texttospeech.v1.SynthesisInput.verify(message.input); - if (error) - return "input." + error; - } - if (message.voice != null && message.hasOwnProperty("voice")) { - var error = $root.google.cloud.texttospeech.v1.VoiceSelectionParams.verify(message.voice); - if (error) - return "voice." + error; - } - if (message.audioConfig != null && message.hasOwnProperty("audioConfig")) { - var error = $root.google.cloud.texttospeech.v1.AudioConfig.verify(message.audioConfig); - if (error) - return "audioConfig." + error; - } - if (message.advancedVoiceOptions != null && message.hasOwnProperty("advancedVoiceOptions")) { - properties._advancedVoiceOptions = 1; - { - var error = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.verify(message.advancedVoiceOptions); - if (error) - return "advancedVoiceOptions." + error; + /** + * Converts this SafetySetting to JSON. + * @function toJSON + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting + * @instance + * @returns {Object.} JSON object + */ + SafetySetting.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SafetySetting + * @function getTypeUrl + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SafetySetting.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } - } - return null; - }; + return typeUrlPrefix + "/google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting"; + }; - /** - * Creates a SynthesizeSpeechRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.texttospeech.v1.SynthesizeSpeechRequest} SynthesizeSpeechRequest - */ - SynthesizeSpeechRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.texttospeech.v1.SynthesizeSpeechRequest) - return object; - var message = new $root.google.cloud.texttospeech.v1.SynthesizeSpeechRequest(); - if (object.input != null) { - if (typeof object.input !== "object") - throw TypeError(".google.cloud.texttospeech.v1.SynthesizeSpeechRequest.input: object expected"); - message.input = $root.google.cloud.texttospeech.v1.SynthesisInput.fromObject(object.input); - } - if (object.voice != null) { - if (typeof object.voice !== "object") - throw TypeError(".google.cloud.texttospeech.v1.SynthesizeSpeechRequest.voice: object expected"); - message.voice = $root.google.cloud.texttospeech.v1.VoiceSelectionParams.fromObject(object.voice); - } - if (object.audioConfig != null) { - if (typeof object.audioConfig !== "object") - throw TypeError(".google.cloud.texttospeech.v1.SynthesizeSpeechRequest.audioConfig: object expected"); - message.audioConfig = $root.google.cloud.texttospeech.v1.AudioConfig.fromObject(object.audioConfig); - } - if (object.advancedVoiceOptions != null) { - if (typeof object.advancedVoiceOptions !== "object") - throw TypeError(".google.cloud.texttospeech.v1.SynthesizeSpeechRequest.advancedVoiceOptions: object expected"); - message.advancedVoiceOptions = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.fromObject(object.advancedVoiceOptions); - } - return message; - }; + return SafetySetting; + })(); - /** - * Creates a plain object from a SynthesizeSpeechRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @static - * @param {google.cloud.texttospeech.v1.SynthesizeSpeechRequest} message SynthesizeSpeechRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SynthesizeSpeechRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.input = null; - object.voice = null; - object.audioConfig = null; - } - if (message.input != null && message.hasOwnProperty("input")) - object.input = $root.google.cloud.texttospeech.v1.SynthesisInput.toObject(message.input, options); - if (message.voice != null && message.hasOwnProperty("voice")) - object.voice = $root.google.cloud.texttospeech.v1.VoiceSelectionParams.toObject(message.voice, options); - if (message.audioConfig != null && message.hasOwnProperty("audioConfig")) - object.audioConfig = $root.google.cloud.texttospeech.v1.AudioConfig.toObject(message.audioConfig, options); - if (message.advancedVoiceOptions != null && message.hasOwnProperty("advancedVoiceOptions")) { - object.advancedVoiceOptions = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.toObject(message.advancedVoiceOptions, options); - if (options.oneofs) - object._advancedVoiceOptions = "advancedVoiceOptions"; - } - return object; - }; + AdvancedVoiceOptions.SafetySettings = (function() { - /** - * Converts this SynthesizeSpeechRequest to JSON. - * @function toJSON - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @instance - * @returns {Object.} JSON object - */ - SynthesizeSpeechRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Properties of a SafetySettings. + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions + * @interface ISafetySettings + * @property {Array.|null} [settings] SafetySettings settings + */ - /** - * Gets the default type url for SynthesizeSpeechRequest - * @function getTypeUrl - * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SynthesizeSpeechRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + /** + * Constructs a new SafetySettings. + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions + * @classdesc Represents a SafetySettings. + * @implements ISafetySettings + * @constructor + * @param {google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySettings=} [properties] Properties to set + */ + function SafetySettings(properties) { + this.settings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - return typeUrlPrefix + "/google.cloud.texttospeech.v1.SynthesizeSpeechRequest"; - }; - return SynthesizeSpeechRequest; - })(); + /** + * SafetySettings settings. + * @member {Array.} settings + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings + * @instance + */ + SafetySettings.prototype.settings = $util.emptyArray; - v1.CustomPronunciationParams = (function() { + /** + * Creates a new SafetySettings instance using the specified properties. + * @function create + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySettings=} [properties] Properties to set + * @returns {google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings} SafetySettings instance + */ + SafetySettings.create = function create(properties) { + return new SafetySettings(properties); + }; - /** - * Properties of a CustomPronunciationParams. - * @memberof google.cloud.texttospeech.v1 - * @interface ICustomPronunciationParams - * @property {string|null} [phrase] CustomPronunciationParams phrase - * @property {google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding|null} [phoneticEncoding] CustomPronunciationParams phoneticEncoding - * @property {string|null} [pronunciation] CustomPronunciationParams pronunciation - */ + /** + * Encodes the specified SafetySettings message. Does not implicitly {@link google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySettings} message SafetySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SafetySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.settings != null && message.settings.length) + for (var i = 0; i < message.settings.length; ++i) + $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting.encode(message.settings[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * Constructs a new CustomPronunciationParams. - * @memberof google.cloud.texttospeech.v1 - * @classdesc Represents a CustomPronunciationParams. - * @implements ICustomPronunciationParams + /** + * Encodes the specified SafetySettings message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {google.cloud.texttospeech.v1.AdvancedVoiceOptions.ISafetySettings} message SafetySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SafetySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SafetySettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings} SafetySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SafetySettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.settings && message.settings.length)) + message.settings = []; + message.settings.push($root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SafetySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings} SafetySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SafetySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SafetySettings message. + * @function verify + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SafetySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.settings != null && message.hasOwnProperty("settings")) { + if (!Array.isArray(message.settings)) + return "settings: array expected"; + for (var i = 0; i < message.settings.length; ++i) { + var error = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting.verify(message.settings[i]); + if (error) + return "settings." + error; + } + } + return null; + }; + + /** + * Creates a SafetySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings} SafetySettings + */ + SafetySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings) + return object; + var message = new $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings(); + if (object.settings) { + if (!Array.isArray(object.settings)) + throw TypeError(".google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings.settings: array expected"); + message.settings = []; + for (var i = 0; i < object.settings.length; ++i) { + if (typeof object.settings[i] !== "object") + throw TypeError(".google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings.settings: object expected"); + message.settings[i] = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting.fromObject(object.settings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SafetySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings} message SafetySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SafetySettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.settings = []; + if (message.settings && message.settings.length) { + object.settings = []; + for (var j = 0; j < message.settings.length; ++j) + object.settings[j] = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting.toObject(message.settings[j], options); + } + return object; + }; + + /** + * Converts this SafetySettings to JSON. + * @function toJSON + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings + * @instance + * @returns {Object.} JSON object + */ + SafetySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SafetySettings + * @function getTypeUrl + * @memberof google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SafetySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings"; + }; + + return SafetySettings; + })(); + + /** + * HarmCategory enum. + * @name google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmCategory + * @enum {number} + * @property {number} HARM_CATEGORY_UNSPECIFIED=0 HARM_CATEGORY_UNSPECIFIED value + * @property {number} HARM_CATEGORY_HATE_SPEECH=1 HARM_CATEGORY_HATE_SPEECH value + * @property {number} HARM_CATEGORY_DANGEROUS_CONTENT=2 HARM_CATEGORY_DANGEROUS_CONTENT value + * @property {number} HARM_CATEGORY_HARASSMENT=3 HARM_CATEGORY_HARASSMENT value + * @property {number} HARM_CATEGORY_SEXUALLY_EXPLICIT=4 HARM_CATEGORY_SEXUALLY_EXPLICIT value + */ + AdvancedVoiceOptions.HarmCategory = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HARM_CATEGORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "HARM_CATEGORY_HATE_SPEECH"] = 1; + values[valuesById[2] = "HARM_CATEGORY_DANGEROUS_CONTENT"] = 2; + values[valuesById[3] = "HARM_CATEGORY_HARASSMENT"] = 3; + values[valuesById[4] = "HARM_CATEGORY_SEXUALLY_EXPLICIT"] = 4; + return values; + })(); + + /** + * HarmBlockThreshold enum. + * @name google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmBlockThreshold + * @enum {number} + * @property {number} HARM_BLOCK_THRESHOLD_UNSPECIFIED=0 HARM_BLOCK_THRESHOLD_UNSPECIFIED value + * @property {number} BLOCK_LOW_AND_ABOVE=1 BLOCK_LOW_AND_ABOVE value + * @property {number} BLOCK_MEDIUM_AND_ABOVE=2 BLOCK_MEDIUM_AND_ABOVE value + * @property {number} BLOCK_ONLY_HIGH=3 BLOCK_ONLY_HIGH value + * @property {number} BLOCK_NONE=4 BLOCK_NONE value + * @property {number} OFF=5 OFF value + */ + AdvancedVoiceOptions.HarmBlockThreshold = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HARM_BLOCK_THRESHOLD_UNSPECIFIED"] = 0; + values[valuesById[1] = "BLOCK_LOW_AND_ABOVE"] = 1; + values[valuesById[2] = "BLOCK_MEDIUM_AND_ABOVE"] = 2; + values[valuesById[3] = "BLOCK_ONLY_HIGH"] = 3; + values[valuesById[4] = "BLOCK_NONE"] = 4; + values[valuesById[5] = "OFF"] = 5; + return values; + })(); + + return AdvancedVoiceOptions; + })(); + + v1.SynthesizeSpeechRequest = (function() { + + /** + * Properties of a SynthesizeSpeechRequest. + * @memberof google.cloud.texttospeech.v1 + * @interface ISynthesizeSpeechRequest + * @property {google.cloud.texttospeech.v1.ISynthesisInput|null} [input] SynthesizeSpeechRequest input + * @property {google.cloud.texttospeech.v1.IVoiceSelectionParams|null} [voice] SynthesizeSpeechRequest voice + * @property {google.cloud.texttospeech.v1.IAudioConfig|null} [audioConfig] SynthesizeSpeechRequest audioConfig + * @property {google.cloud.texttospeech.v1.IAdvancedVoiceOptions|null} [advancedVoiceOptions] SynthesizeSpeechRequest advancedVoiceOptions + */ + + /** + * Constructs a new SynthesizeSpeechRequest. + * @memberof google.cloud.texttospeech.v1 + * @classdesc Represents a SynthesizeSpeechRequest. + * @implements ISynthesizeSpeechRequest * @constructor - * @param {google.cloud.texttospeech.v1.ICustomPronunciationParams=} [properties] Properties to set + * @param {google.cloud.texttospeech.v1.ISynthesizeSpeechRequest=} [properties] Properties to set */ - function CustomPronunciationParams(properties) { + function SynthesizeSpeechRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1575,126 +1898,128 @@ } /** - * CustomPronunciationParams phrase. - * @member {string|null|undefined} phrase - * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * SynthesizeSpeechRequest input. + * @member {google.cloud.texttospeech.v1.ISynthesisInput|null|undefined} input + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest * @instance */ - CustomPronunciationParams.prototype.phrase = null; + SynthesizeSpeechRequest.prototype.input = null; /** - * CustomPronunciationParams phoneticEncoding. - * @member {google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding|null|undefined} phoneticEncoding - * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * SynthesizeSpeechRequest voice. + * @member {google.cloud.texttospeech.v1.IVoiceSelectionParams|null|undefined} voice + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest * @instance */ - CustomPronunciationParams.prototype.phoneticEncoding = null; + SynthesizeSpeechRequest.prototype.voice = null; /** - * CustomPronunciationParams pronunciation. - * @member {string|null|undefined} pronunciation - * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * SynthesizeSpeechRequest audioConfig. + * @member {google.cloud.texttospeech.v1.IAudioConfig|null|undefined} audioConfig + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest * @instance */ - CustomPronunciationParams.prototype.pronunciation = null; + SynthesizeSpeechRequest.prototype.audioConfig = null; + + /** + * SynthesizeSpeechRequest advancedVoiceOptions. + * @member {google.cloud.texttospeech.v1.IAdvancedVoiceOptions|null|undefined} advancedVoiceOptions + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest + * @instance + */ + SynthesizeSpeechRequest.prototype.advancedVoiceOptions = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; // Virtual OneOf for proto3 optional field - Object.defineProperty(CustomPronunciationParams.prototype, "_phrase", { - get: $util.oneOfGetter($oneOfFields = ["phrase"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(CustomPronunciationParams.prototype, "_phoneticEncoding", { - get: $util.oneOfGetter($oneOfFields = ["phoneticEncoding"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(CustomPronunciationParams.prototype, "_pronunciation", { - get: $util.oneOfGetter($oneOfFields = ["pronunciation"]), + Object.defineProperty(SynthesizeSpeechRequest.prototype, "_advancedVoiceOptions", { + get: $util.oneOfGetter($oneOfFields = ["advancedVoiceOptions"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new CustomPronunciationParams instance using the specified properties. + * Creates a new SynthesizeSpeechRequest instance using the specified properties. * @function create - * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest * @static - * @param {google.cloud.texttospeech.v1.ICustomPronunciationParams=} [properties] Properties to set - * @returns {google.cloud.texttospeech.v1.CustomPronunciationParams} CustomPronunciationParams instance + * @param {google.cloud.texttospeech.v1.ISynthesizeSpeechRequest=} [properties] Properties to set + * @returns {google.cloud.texttospeech.v1.SynthesizeSpeechRequest} SynthesizeSpeechRequest instance */ - CustomPronunciationParams.create = function create(properties) { - return new CustomPronunciationParams(properties); + SynthesizeSpeechRequest.create = function create(properties) { + return new SynthesizeSpeechRequest(properties); }; /** - * Encodes the specified CustomPronunciationParams message. Does not implicitly {@link google.cloud.texttospeech.v1.CustomPronunciationParams.verify|verify} messages. + * Encodes the specified SynthesizeSpeechRequest message. Does not implicitly {@link google.cloud.texttospeech.v1.SynthesizeSpeechRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest * @static - * @param {google.cloud.texttospeech.v1.ICustomPronunciationParams} message CustomPronunciationParams message or plain object to encode + * @param {google.cloud.texttospeech.v1.ISynthesizeSpeechRequest} message SynthesizeSpeechRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomPronunciationParams.encode = function encode(message, writer) { + SynthesizeSpeechRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.phrase != null && Object.hasOwnProperty.call(message, "phrase")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.phrase); - if (message.phoneticEncoding != null && Object.hasOwnProperty.call(message, "phoneticEncoding")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.phoneticEncoding); - if (message.pronunciation != null && Object.hasOwnProperty.call(message, "pronunciation")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pronunciation); + if (message.input != null && Object.hasOwnProperty.call(message, "input")) + $root.google.cloud.texttospeech.v1.SynthesisInput.encode(message.input, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.voice != null && Object.hasOwnProperty.call(message, "voice")) + $root.google.cloud.texttospeech.v1.VoiceSelectionParams.encode(message.voice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.audioConfig != null && Object.hasOwnProperty.call(message, "audioConfig")) + $root.google.cloud.texttospeech.v1.AudioConfig.encode(message.audioConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.advancedVoiceOptions != null && Object.hasOwnProperty.call(message, "advancedVoiceOptions")) + $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.encode(message.advancedVoiceOptions, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; }; /** - * Encodes the specified CustomPronunciationParams message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1.CustomPronunciationParams.verify|verify} messages. + * Encodes the specified SynthesizeSpeechRequest message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1.SynthesizeSpeechRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest * @static - * @param {google.cloud.texttospeech.v1.ICustomPronunciationParams} message CustomPronunciationParams message or plain object to encode + * @param {google.cloud.texttospeech.v1.ISynthesizeSpeechRequest} message SynthesizeSpeechRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomPronunciationParams.encodeDelimited = function encodeDelimited(message, writer) { + SynthesizeSpeechRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CustomPronunciationParams message from the specified reader or buffer. + * Decodes a SynthesizeSpeechRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.texttospeech.v1.CustomPronunciationParams} CustomPronunciationParams + * @returns {google.cloud.texttospeech.v1.SynthesizeSpeechRequest} SynthesizeSpeechRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomPronunciationParams.decode = function decode(reader, length, error) { + SynthesizeSpeechRequest.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.texttospeech.v1.CustomPronunciationParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.texttospeech.v1.SynthesizeSpeechRequest(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - message.phrase = reader.string(); + message.input = $root.google.cloud.texttospeech.v1.SynthesisInput.decode(reader, reader.uint32()); break; } case 2: { - message.phoneticEncoding = reader.int32(); + message.voice = $root.google.cloud.texttospeech.v1.VoiceSelectionParams.decode(reader, reader.uint32()); break; } case 3: { - message.pronunciation = reader.string(); + message.audioConfig = $root.google.cloud.texttospeech.v1.AudioConfig.decode(reader, reader.uint32()); + break; + } + case 8: { + message.advancedVoiceOptions = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.decode(reader, reader.uint32()); break; } default: @@ -1706,205 +2031,175 @@ }; /** - * Decodes a CustomPronunciationParams message from the specified reader or buffer, length delimited. + * Decodes a SynthesizeSpeechRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.texttospeech.v1.CustomPronunciationParams} CustomPronunciationParams + * @returns {google.cloud.texttospeech.v1.SynthesizeSpeechRequest} SynthesizeSpeechRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomPronunciationParams.decodeDelimited = function decodeDelimited(reader) { + SynthesizeSpeechRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CustomPronunciationParams message. + * Verifies a SynthesizeSpeechRequest message. * @function verify - * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CustomPronunciationParams.verify = function verify(message) { + SynthesizeSpeechRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.phrase != null && message.hasOwnProperty("phrase")) { - properties._phrase = 1; - if (!$util.isString(message.phrase)) - return "phrase: string expected"; + if (message.input != null && message.hasOwnProperty("input")) { + var error = $root.google.cloud.texttospeech.v1.SynthesisInput.verify(message.input); + if (error) + return "input." + error; } - if (message.phoneticEncoding != null && message.hasOwnProperty("phoneticEncoding")) { - properties._phoneticEncoding = 1; - switch (message.phoneticEncoding) { - default: - return "phoneticEncoding: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } + if (message.voice != null && message.hasOwnProperty("voice")) { + var error = $root.google.cloud.texttospeech.v1.VoiceSelectionParams.verify(message.voice); + if (error) + return "voice." + error; } - if (message.pronunciation != null && message.hasOwnProperty("pronunciation")) { - properties._pronunciation = 1; - if (!$util.isString(message.pronunciation)) - return "pronunciation: string expected"; + if (message.audioConfig != null && message.hasOwnProperty("audioConfig")) { + var error = $root.google.cloud.texttospeech.v1.AudioConfig.verify(message.audioConfig); + if (error) + return "audioConfig." + error; + } + if (message.advancedVoiceOptions != null && message.hasOwnProperty("advancedVoiceOptions")) { + properties._advancedVoiceOptions = 1; + { + var error = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.verify(message.advancedVoiceOptions); + if (error) + return "advancedVoiceOptions." + error; + } } return null; }; /** - * Creates a CustomPronunciationParams message from a plain object. Also converts values to their respective internal types. + * Creates a SynthesizeSpeechRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.texttospeech.v1.CustomPronunciationParams} CustomPronunciationParams + * @returns {google.cloud.texttospeech.v1.SynthesizeSpeechRequest} SynthesizeSpeechRequest */ - CustomPronunciationParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.texttospeech.v1.CustomPronunciationParams) + SynthesizeSpeechRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.texttospeech.v1.SynthesizeSpeechRequest) return object; - var message = new $root.google.cloud.texttospeech.v1.CustomPronunciationParams(); - if (object.phrase != null) - message.phrase = String(object.phrase); - switch (object.phoneticEncoding) { - default: - if (typeof object.phoneticEncoding === "number") { - message.phoneticEncoding = object.phoneticEncoding; - break; - } - break; - case "PHONETIC_ENCODING_UNSPECIFIED": - case 0: - message.phoneticEncoding = 0; - break; - case "PHONETIC_ENCODING_IPA": - case 1: - message.phoneticEncoding = 1; - break; - case "PHONETIC_ENCODING_X_SAMPA": - case 2: - message.phoneticEncoding = 2; - break; - case "PHONETIC_ENCODING_JAPANESE_YOMIGANA": - case 3: - message.phoneticEncoding = 3; - break; - case "PHONETIC_ENCODING_PINYIN": - case 4: - message.phoneticEncoding = 4; - break; + var message = new $root.google.cloud.texttospeech.v1.SynthesizeSpeechRequest(); + if (object.input != null) { + if (typeof object.input !== "object") + throw TypeError(".google.cloud.texttospeech.v1.SynthesizeSpeechRequest.input: object expected"); + message.input = $root.google.cloud.texttospeech.v1.SynthesisInput.fromObject(object.input); + } + if (object.voice != null) { + if (typeof object.voice !== "object") + throw TypeError(".google.cloud.texttospeech.v1.SynthesizeSpeechRequest.voice: object expected"); + message.voice = $root.google.cloud.texttospeech.v1.VoiceSelectionParams.fromObject(object.voice); + } + if (object.audioConfig != null) { + if (typeof object.audioConfig !== "object") + throw TypeError(".google.cloud.texttospeech.v1.SynthesizeSpeechRequest.audioConfig: object expected"); + message.audioConfig = $root.google.cloud.texttospeech.v1.AudioConfig.fromObject(object.audioConfig); + } + if (object.advancedVoiceOptions != null) { + if (typeof object.advancedVoiceOptions !== "object") + throw TypeError(".google.cloud.texttospeech.v1.SynthesizeSpeechRequest.advancedVoiceOptions: object expected"); + message.advancedVoiceOptions = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.fromObject(object.advancedVoiceOptions); } - if (object.pronunciation != null) - message.pronunciation = String(object.pronunciation); return message; }; /** - * Creates a plain object from a CustomPronunciationParams message. Also converts values to other types if specified. + * Creates a plain object from a SynthesizeSpeechRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest * @static - * @param {google.cloud.texttospeech.v1.CustomPronunciationParams} message CustomPronunciationParams + * @param {google.cloud.texttospeech.v1.SynthesizeSpeechRequest} message SynthesizeSpeechRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CustomPronunciationParams.toObject = function toObject(message, options) { + SynthesizeSpeechRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.phrase != null && message.hasOwnProperty("phrase")) { - object.phrase = message.phrase; - if (options.oneofs) - object._phrase = "phrase"; - } - if (message.phoneticEncoding != null && message.hasOwnProperty("phoneticEncoding")) { - object.phoneticEncoding = options.enums === String ? $root.google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding[message.phoneticEncoding] === undefined ? message.phoneticEncoding : $root.google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding[message.phoneticEncoding] : message.phoneticEncoding; - if (options.oneofs) - object._phoneticEncoding = "phoneticEncoding"; + if (options.defaults) { + object.input = null; + object.voice = null; + object.audioConfig = null; } - if (message.pronunciation != null && message.hasOwnProperty("pronunciation")) { - object.pronunciation = message.pronunciation; + if (message.input != null && message.hasOwnProperty("input")) + object.input = $root.google.cloud.texttospeech.v1.SynthesisInput.toObject(message.input, options); + if (message.voice != null && message.hasOwnProperty("voice")) + object.voice = $root.google.cloud.texttospeech.v1.VoiceSelectionParams.toObject(message.voice, options); + if (message.audioConfig != null && message.hasOwnProperty("audioConfig")) + object.audioConfig = $root.google.cloud.texttospeech.v1.AudioConfig.toObject(message.audioConfig, options); + if (message.advancedVoiceOptions != null && message.hasOwnProperty("advancedVoiceOptions")) { + object.advancedVoiceOptions = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.toObject(message.advancedVoiceOptions, options); if (options.oneofs) - object._pronunciation = "pronunciation"; + object._advancedVoiceOptions = "advancedVoiceOptions"; } return object; }; /** - * Converts this CustomPronunciationParams to JSON. + * Converts this SynthesizeSpeechRequest to JSON. * @function toJSON - * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest * @instance * @returns {Object.} JSON object */ - CustomPronunciationParams.prototype.toJSON = function toJSON() { + SynthesizeSpeechRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for CustomPronunciationParams + * Gets the default type url for SynthesizeSpeechRequest * @function getTypeUrl - * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @memberof google.cloud.texttospeech.v1.SynthesizeSpeechRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - CustomPronunciationParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + SynthesizeSpeechRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.texttospeech.v1.CustomPronunciationParams"; + return typeUrlPrefix + "/google.cloud.texttospeech.v1.SynthesizeSpeechRequest"; }; - /** - * PhoneticEncoding enum. - * @name google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding - * @enum {number} - * @property {number} PHONETIC_ENCODING_UNSPECIFIED=0 PHONETIC_ENCODING_UNSPECIFIED value - * @property {number} PHONETIC_ENCODING_IPA=1 PHONETIC_ENCODING_IPA value - * @property {number} PHONETIC_ENCODING_X_SAMPA=2 PHONETIC_ENCODING_X_SAMPA value - * @property {number} PHONETIC_ENCODING_JAPANESE_YOMIGANA=3 PHONETIC_ENCODING_JAPANESE_YOMIGANA value - * @property {number} PHONETIC_ENCODING_PINYIN=4 PHONETIC_ENCODING_PINYIN value - */ - CustomPronunciationParams.PhoneticEncoding = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "PHONETIC_ENCODING_UNSPECIFIED"] = 0; - values[valuesById[1] = "PHONETIC_ENCODING_IPA"] = 1; - values[valuesById[2] = "PHONETIC_ENCODING_X_SAMPA"] = 2; - values[valuesById[3] = "PHONETIC_ENCODING_JAPANESE_YOMIGANA"] = 3; - values[valuesById[4] = "PHONETIC_ENCODING_PINYIN"] = 4; - return values; - })(); - - return CustomPronunciationParams; + return SynthesizeSpeechRequest; })(); - v1.CustomPronunciations = (function() { + v1.CustomPronunciationParams = (function() { /** - * Properties of a CustomPronunciations. + * Properties of a CustomPronunciationParams. * @memberof google.cloud.texttospeech.v1 - * @interface ICustomPronunciations - * @property {Array.|null} [pronunciations] CustomPronunciations pronunciations + * @interface ICustomPronunciationParams + * @property {string|null} [phrase] CustomPronunciationParams phrase + * @property {google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding|null} [phoneticEncoding] CustomPronunciationParams phoneticEncoding + * @property {string|null} [pronunciation] CustomPronunciationParams pronunciation */ /** - * Constructs a new CustomPronunciations. + * Constructs a new CustomPronunciationParams. * @memberof google.cloud.texttospeech.v1 - * @classdesc Represents a CustomPronunciations. - * @implements ICustomPronunciations + * @classdesc Represents a CustomPronunciationParams. + * @implements ICustomPronunciationParams * @constructor - * @param {google.cloud.texttospeech.v1.ICustomPronunciations=} [properties] Properties to set + * @param {google.cloud.texttospeech.v1.ICustomPronunciationParams=} [properties] Properties to set */ - function CustomPronunciations(properties) { - this.pronunciations = []; + function CustomPronunciationParams(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1912,80 +2207,126 @@ } /** - * CustomPronunciations pronunciations. - * @member {Array.} pronunciations - * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * CustomPronunciationParams phrase. + * @member {string|null|undefined} phrase + * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams * @instance */ - CustomPronunciations.prototype.pronunciations = $util.emptyArray; + CustomPronunciationParams.prototype.phrase = null; /** - * Creates a new CustomPronunciations instance using the specified properties. - * @function create - * @memberof google.cloud.texttospeech.v1.CustomPronunciations - * @static - * @param {google.cloud.texttospeech.v1.ICustomPronunciations=} [properties] Properties to set - * @returns {google.cloud.texttospeech.v1.CustomPronunciations} CustomPronunciations instance + * CustomPronunciationParams phoneticEncoding. + * @member {google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding|null|undefined} phoneticEncoding + * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @instance */ - CustomPronunciations.create = function create(properties) { - return new CustomPronunciations(properties); - }; + CustomPronunciationParams.prototype.phoneticEncoding = null; /** - * Encodes the specified CustomPronunciations message. Does not implicitly {@link google.cloud.texttospeech.v1.CustomPronunciations.verify|verify} messages. - * @function encode - * @memberof google.cloud.texttospeech.v1.CustomPronunciations - * @static - * @param {google.cloud.texttospeech.v1.ICustomPronunciations} message CustomPronunciations message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * CustomPronunciationParams pronunciation. + * @member {string|null|undefined} pronunciation + * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @instance */ - CustomPronunciations.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pronunciations != null && message.pronunciations.length) - for (var i = 0; i < message.pronunciations.length; ++i) - $root.google.cloud.texttospeech.v1.CustomPronunciationParams.encode(message.pronunciations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + CustomPronunciationParams.prototype.pronunciation = null; - /** - * Encodes the specified CustomPronunciations message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1.CustomPronunciations.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.texttospeech.v1.CustomPronunciations - * @static - * @param {google.cloud.texttospeech.v1.ICustomPronunciations} message CustomPronunciations message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomPronunciations.encodeDelimited = function encodeDelimited(message, writer) { + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CustomPronunciationParams.prototype, "_phrase", { + get: $util.oneOfGetter($oneOfFields = ["phrase"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CustomPronunciationParams.prototype, "_phoneticEncoding", { + get: $util.oneOfGetter($oneOfFields = ["phoneticEncoding"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CustomPronunciationParams.prototype, "_pronunciation", { + get: $util.oneOfGetter($oneOfFields = ["pronunciation"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CustomPronunciationParams instance using the specified properties. + * @function create + * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @static + * @param {google.cloud.texttospeech.v1.ICustomPronunciationParams=} [properties] Properties to set + * @returns {google.cloud.texttospeech.v1.CustomPronunciationParams} CustomPronunciationParams instance + */ + CustomPronunciationParams.create = function create(properties) { + return new CustomPronunciationParams(properties); + }; + + /** + * Encodes the specified CustomPronunciationParams message. Does not implicitly {@link google.cloud.texttospeech.v1.CustomPronunciationParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @static + * @param {google.cloud.texttospeech.v1.ICustomPronunciationParams} message CustomPronunciationParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomPronunciationParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.phrase != null && Object.hasOwnProperty.call(message, "phrase")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.phrase); + if (message.phoneticEncoding != null && Object.hasOwnProperty.call(message, "phoneticEncoding")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.phoneticEncoding); + if (message.pronunciation != null && Object.hasOwnProperty.call(message, "pronunciation")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pronunciation); + return writer; + }; + + /** + * Encodes the specified CustomPronunciationParams message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1.CustomPronunciationParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams + * @static + * @param {google.cloud.texttospeech.v1.ICustomPronunciationParams} message CustomPronunciationParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomPronunciationParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CustomPronunciations message from the specified reader or buffer. + * Decodes a CustomPronunciationParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.texttospeech.v1.CustomPronunciations} CustomPronunciations + * @returns {google.cloud.texttospeech.v1.CustomPronunciationParams} CustomPronunciationParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomPronunciations.decode = function decode(reader, length, error) { + CustomPronunciationParams.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.texttospeech.v1.CustomPronunciations(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.texttospeech.v1.CustomPronunciationParams(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - if (!(message.pronunciations && message.pronunciations.length)) - message.pronunciations = []; - message.pronunciations.push($root.google.cloud.texttospeech.v1.CustomPronunciationParams.decode(reader, reader.uint32())); + message.phrase = reader.string(); + break; + } + case 2: { + message.phoneticEncoding = reader.int32(); + break; + } + case 3: { + message.pronunciation = reader.string(); break; } default: @@ -1997,136 +2338,427 @@ }; /** - * Decodes a CustomPronunciations message from the specified reader or buffer, length delimited. + * Decodes a CustomPronunciationParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.texttospeech.v1.CustomPronunciations} CustomPronunciations + * @returns {google.cloud.texttospeech.v1.CustomPronunciationParams} CustomPronunciationParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomPronunciations.decodeDelimited = function decodeDelimited(reader) { + CustomPronunciationParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CustomPronunciations message. + * Verifies a CustomPronunciationParams message. * @function verify - * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CustomPronunciations.verify = function verify(message) { + CustomPronunciationParams.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.pronunciations != null && message.hasOwnProperty("pronunciations")) { - if (!Array.isArray(message.pronunciations)) - return "pronunciations: array expected"; - for (var i = 0; i < message.pronunciations.length; ++i) { - var error = $root.google.cloud.texttospeech.v1.CustomPronunciationParams.verify(message.pronunciations[i]); - if (error) - return "pronunciations." + error; + var properties = {}; + if (message.phrase != null && message.hasOwnProperty("phrase")) { + properties._phrase = 1; + if (!$util.isString(message.phrase)) + return "phrase: string expected"; + } + if (message.phoneticEncoding != null && message.hasOwnProperty("phoneticEncoding")) { + properties._phoneticEncoding = 1; + switch (message.phoneticEncoding) { + default: + return "phoneticEncoding: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; } } + if (message.pronunciation != null && message.hasOwnProperty("pronunciation")) { + properties._pronunciation = 1; + if (!$util.isString(message.pronunciation)) + return "pronunciation: string expected"; + } return null; }; /** - * Creates a CustomPronunciations message from a plain object. Also converts values to their respective internal types. + * Creates a CustomPronunciationParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.texttospeech.v1.CustomPronunciations} CustomPronunciations + * @returns {google.cloud.texttospeech.v1.CustomPronunciationParams} CustomPronunciationParams */ - CustomPronunciations.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.texttospeech.v1.CustomPronunciations) + CustomPronunciationParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.texttospeech.v1.CustomPronunciationParams) return object; - var message = new $root.google.cloud.texttospeech.v1.CustomPronunciations(); - if (object.pronunciations) { - if (!Array.isArray(object.pronunciations)) - throw TypeError(".google.cloud.texttospeech.v1.CustomPronunciations.pronunciations: array expected"); - message.pronunciations = []; - for (var i = 0; i < object.pronunciations.length; ++i) { - if (typeof object.pronunciations[i] !== "object") - throw TypeError(".google.cloud.texttospeech.v1.CustomPronunciations.pronunciations: object expected"); - message.pronunciations[i] = $root.google.cloud.texttospeech.v1.CustomPronunciationParams.fromObject(object.pronunciations[i]); + var message = new $root.google.cloud.texttospeech.v1.CustomPronunciationParams(); + if (object.phrase != null) + message.phrase = String(object.phrase); + switch (object.phoneticEncoding) { + default: + if (typeof object.phoneticEncoding === "number") { + message.phoneticEncoding = object.phoneticEncoding; + break; } + break; + case "PHONETIC_ENCODING_UNSPECIFIED": + case 0: + message.phoneticEncoding = 0; + break; + case "PHONETIC_ENCODING_IPA": + case 1: + message.phoneticEncoding = 1; + break; + case "PHONETIC_ENCODING_X_SAMPA": + case 2: + message.phoneticEncoding = 2; + break; + case "PHONETIC_ENCODING_JAPANESE_YOMIGANA": + case 3: + message.phoneticEncoding = 3; + break; + case "PHONETIC_ENCODING_PINYIN": + case 4: + message.phoneticEncoding = 4; + break; } + if (object.pronunciation != null) + message.pronunciation = String(object.pronunciation); return message; }; /** - * Creates a plain object from a CustomPronunciations message. Also converts values to other types if specified. + * Creates a plain object from a CustomPronunciationParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams * @static - * @param {google.cloud.texttospeech.v1.CustomPronunciations} message CustomPronunciations + * @param {google.cloud.texttospeech.v1.CustomPronunciationParams} message CustomPronunciationParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CustomPronunciations.toObject = function toObject(message, options) { + CustomPronunciationParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.pronunciations = []; - if (message.pronunciations && message.pronunciations.length) { - object.pronunciations = []; - for (var j = 0; j < message.pronunciations.length; ++j) - object.pronunciations[j] = $root.google.cloud.texttospeech.v1.CustomPronunciationParams.toObject(message.pronunciations[j], options); + if (message.phrase != null && message.hasOwnProperty("phrase")) { + object.phrase = message.phrase; + if (options.oneofs) + object._phrase = "phrase"; + } + if (message.phoneticEncoding != null && message.hasOwnProperty("phoneticEncoding")) { + object.phoneticEncoding = options.enums === String ? $root.google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding[message.phoneticEncoding] === undefined ? message.phoneticEncoding : $root.google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding[message.phoneticEncoding] : message.phoneticEncoding; + if (options.oneofs) + object._phoneticEncoding = "phoneticEncoding"; + } + if (message.pronunciation != null && message.hasOwnProperty("pronunciation")) { + object.pronunciation = message.pronunciation; + if (options.oneofs) + object._pronunciation = "pronunciation"; } return object; }; /** - * Converts this CustomPronunciations to JSON. + * Converts this CustomPronunciationParams to JSON. * @function toJSON - * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams * @instance * @returns {Object.} JSON object */ - CustomPronunciations.prototype.toJSON = function toJSON() { + CustomPronunciationParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for CustomPronunciations + * Gets the default type url for CustomPronunciationParams * @function getTypeUrl - * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @memberof google.cloud.texttospeech.v1.CustomPronunciationParams * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - CustomPronunciations.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + CustomPronunciationParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.texttospeech.v1.CustomPronunciations"; + return typeUrlPrefix + "/google.cloud.texttospeech.v1.CustomPronunciationParams"; }; - return CustomPronunciations; + /** + * PhoneticEncoding enum. + * @name google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding + * @enum {number} + * @property {number} PHONETIC_ENCODING_UNSPECIFIED=0 PHONETIC_ENCODING_UNSPECIFIED value + * @property {number} PHONETIC_ENCODING_IPA=1 PHONETIC_ENCODING_IPA value + * @property {number} PHONETIC_ENCODING_X_SAMPA=2 PHONETIC_ENCODING_X_SAMPA value + * @property {number} PHONETIC_ENCODING_JAPANESE_YOMIGANA=3 PHONETIC_ENCODING_JAPANESE_YOMIGANA value + * @property {number} PHONETIC_ENCODING_PINYIN=4 PHONETIC_ENCODING_PINYIN value + */ + CustomPronunciationParams.PhoneticEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PHONETIC_ENCODING_UNSPECIFIED"] = 0; + values[valuesById[1] = "PHONETIC_ENCODING_IPA"] = 1; + values[valuesById[2] = "PHONETIC_ENCODING_X_SAMPA"] = 2; + values[valuesById[3] = "PHONETIC_ENCODING_JAPANESE_YOMIGANA"] = 3; + values[valuesById[4] = "PHONETIC_ENCODING_PINYIN"] = 4; + return values; + })(); + + return CustomPronunciationParams; })(); - v1.MultiSpeakerMarkup = (function() { + v1.CustomPronunciations = (function() { /** - * Properties of a MultiSpeakerMarkup. + * Properties of a CustomPronunciations. * @memberof google.cloud.texttospeech.v1 - * @interface IMultiSpeakerMarkup - * @property {Array.|null} [turns] MultiSpeakerMarkup turns + * @interface ICustomPronunciations + * @property {Array.|null} [pronunciations] CustomPronunciations pronunciations */ /** - * Constructs a new MultiSpeakerMarkup. + * Constructs a new CustomPronunciations. * @memberof google.cloud.texttospeech.v1 - * @classdesc Represents a MultiSpeakerMarkup. - * @implements IMultiSpeakerMarkup - * @constructor + * @classdesc Represents a CustomPronunciations. + * @implements ICustomPronunciations + * @constructor + * @param {google.cloud.texttospeech.v1.ICustomPronunciations=} [properties] Properties to set + */ + function CustomPronunciations(properties) { + this.pronunciations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomPronunciations pronunciations. + * @member {Array.} pronunciations + * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @instance + */ + CustomPronunciations.prototype.pronunciations = $util.emptyArray; + + /** + * Creates a new CustomPronunciations instance using the specified properties. + * @function create + * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @static + * @param {google.cloud.texttospeech.v1.ICustomPronunciations=} [properties] Properties to set + * @returns {google.cloud.texttospeech.v1.CustomPronunciations} CustomPronunciations instance + */ + CustomPronunciations.create = function create(properties) { + return new CustomPronunciations(properties); + }; + + /** + * Encodes the specified CustomPronunciations message. Does not implicitly {@link google.cloud.texttospeech.v1.CustomPronunciations.verify|verify} messages. + * @function encode + * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @static + * @param {google.cloud.texttospeech.v1.ICustomPronunciations} message CustomPronunciations message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomPronunciations.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pronunciations != null && message.pronunciations.length) + for (var i = 0; i < message.pronunciations.length; ++i) + $root.google.cloud.texttospeech.v1.CustomPronunciationParams.encode(message.pronunciations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CustomPronunciations message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1.CustomPronunciations.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @static + * @param {google.cloud.texttospeech.v1.ICustomPronunciations} message CustomPronunciations message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomPronunciations.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomPronunciations message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.texttospeech.v1.CustomPronunciations} CustomPronunciations + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomPronunciations.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.texttospeech.v1.CustomPronunciations(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.pronunciations && message.pronunciations.length)) + message.pronunciations = []; + message.pronunciations.push($root.google.cloud.texttospeech.v1.CustomPronunciationParams.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomPronunciations message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.texttospeech.v1.CustomPronunciations} CustomPronunciations + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomPronunciations.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomPronunciations message. + * @function verify + * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomPronunciations.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pronunciations != null && message.hasOwnProperty("pronunciations")) { + if (!Array.isArray(message.pronunciations)) + return "pronunciations: array expected"; + for (var i = 0; i < message.pronunciations.length; ++i) { + var error = $root.google.cloud.texttospeech.v1.CustomPronunciationParams.verify(message.pronunciations[i]); + if (error) + return "pronunciations." + error; + } + } + return null; + }; + + /** + * Creates a CustomPronunciations message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.texttospeech.v1.CustomPronunciations} CustomPronunciations + */ + CustomPronunciations.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.texttospeech.v1.CustomPronunciations) + return object; + var message = new $root.google.cloud.texttospeech.v1.CustomPronunciations(); + if (object.pronunciations) { + if (!Array.isArray(object.pronunciations)) + throw TypeError(".google.cloud.texttospeech.v1.CustomPronunciations.pronunciations: array expected"); + message.pronunciations = []; + for (var i = 0; i < object.pronunciations.length; ++i) { + if (typeof object.pronunciations[i] !== "object") + throw TypeError(".google.cloud.texttospeech.v1.CustomPronunciations.pronunciations: object expected"); + message.pronunciations[i] = $root.google.cloud.texttospeech.v1.CustomPronunciationParams.fromObject(object.pronunciations[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a CustomPronunciations message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @static + * @param {google.cloud.texttospeech.v1.CustomPronunciations} message CustomPronunciations + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomPronunciations.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.pronunciations = []; + if (message.pronunciations && message.pronunciations.length) { + object.pronunciations = []; + for (var j = 0; j < message.pronunciations.length; ++j) + object.pronunciations[j] = $root.google.cloud.texttospeech.v1.CustomPronunciationParams.toObject(message.pronunciations[j], options); + } + return object; + }; + + /** + * Converts this CustomPronunciations to JSON. + * @function toJSON + * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @instance + * @returns {Object.} JSON object + */ + CustomPronunciations.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CustomPronunciations + * @function getTypeUrl + * @memberof google.cloud.texttospeech.v1.CustomPronunciations + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomPronunciations.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.texttospeech.v1.CustomPronunciations"; + }; + + return CustomPronunciations; + })(); + + v1.MultiSpeakerMarkup = (function() { + + /** + * Properties of a MultiSpeakerMarkup. + * @memberof google.cloud.texttospeech.v1 + * @interface IMultiSpeakerMarkup + * @property {Array.|null} [turns] MultiSpeakerMarkup turns + */ + + /** + * Constructs a new MultiSpeakerMarkup. + * @memberof google.cloud.texttospeech.v1 + * @classdesc Represents a MultiSpeakerMarkup. + * @implements IMultiSpeakerMarkup + * @constructor * @param {google.cloud.texttospeech.v1.IMultiSpeakerMarkup=} [properties] Properties to set */ function MultiSpeakerMarkup(properties) { @@ -5173,6 +5805,7 @@ * @property {google.cloud.texttospeech.v1.IVoiceSelectionParams|null} [voice] StreamingSynthesizeConfig voice * @property {google.cloud.texttospeech.v1.IStreamingAudioConfig|null} [streamingAudioConfig] StreamingSynthesizeConfig streamingAudioConfig * @property {google.cloud.texttospeech.v1.ICustomPronunciations|null} [customPronunciations] StreamingSynthesizeConfig customPronunciations + * @property {google.cloud.texttospeech.v1.IAdvancedVoiceOptions|null} [advancedVoiceOptions] StreamingSynthesizeConfig advancedVoiceOptions */ /** @@ -5214,6 +5847,23 @@ */ StreamingSynthesizeConfig.prototype.customPronunciations = null; + /** + * StreamingSynthesizeConfig advancedVoiceOptions. + * @member {google.cloud.texttospeech.v1.IAdvancedVoiceOptions|null|undefined} advancedVoiceOptions + * @memberof google.cloud.texttospeech.v1.StreamingSynthesizeConfig + * @instance + */ + StreamingSynthesizeConfig.prototype.advancedVoiceOptions = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(StreamingSynthesizeConfig.prototype, "_advancedVoiceOptions", { + get: $util.oneOfGetter($oneOfFields = ["advancedVoiceOptions"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new StreamingSynthesizeConfig instance using the specified properties. * @function create @@ -5244,6 +5894,8 @@ $root.google.cloud.texttospeech.v1.StreamingAudioConfig.encode(message.streamingAudioConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.customPronunciations != null && Object.hasOwnProperty.call(message, "customPronunciations")) $root.google.cloud.texttospeech.v1.CustomPronunciations.encode(message.customPronunciations, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.advancedVoiceOptions != null && Object.hasOwnProperty.call(message, "advancedVoiceOptions")) + $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.encode(message.advancedVoiceOptions, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; @@ -5292,6 +5944,10 @@ message.customPronunciations = $root.google.cloud.texttospeech.v1.CustomPronunciations.decode(reader, reader.uint32()); break; } + case 7: { + message.advancedVoiceOptions = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -5327,6 +5983,7 @@ StreamingSynthesizeConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.voice != null && message.hasOwnProperty("voice")) { var error = $root.google.cloud.texttospeech.v1.VoiceSelectionParams.verify(message.voice); if (error) @@ -5342,13 +5999,21 @@ if (error) return "customPronunciations." + error; } - return null; - }; - - /** - * Creates a StreamingSynthesizeConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.texttospeech.v1.StreamingSynthesizeConfig + if (message.advancedVoiceOptions != null && message.hasOwnProperty("advancedVoiceOptions")) { + properties._advancedVoiceOptions = 1; + { + var error = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.verify(message.advancedVoiceOptions); + if (error) + return "advancedVoiceOptions." + error; + } + } + return null; + }; + + /** + * Creates a StreamingSynthesizeConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.texttospeech.v1.StreamingSynthesizeConfig * @static * @param {Object.} object Plain object * @returns {google.cloud.texttospeech.v1.StreamingSynthesizeConfig} StreamingSynthesizeConfig @@ -5372,6 +6037,11 @@ throw TypeError(".google.cloud.texttospeech.v1.StreamingSynthesizeConfig.customPronunciations: object expected"); message.customPronunciations = $root.google.cloud.texttospeech.v1.CustomPronunciations.fromObject(object.customPronunciations); } + if (object.advancedVoiceOptions != null) { + if (typeof object.advancedVoiceOptions !== "object") + throw TypeError(".google.cloud.texttospeech.v1.StreamingSynthesizeConfig.advancedVoiceOptions: object expected"); + message.advancedVoiceOptions = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.fromObject(object.advancedVoiceOptions); + } return message; }; @@ -5399,6 +6069,11 @@ object.streamingAudioConfig = $root.google.cloud.texttospeech.v1.StreamingAudioConfig.toObject(message.streamingAudioConfig, options); if (message.customPronunciations != null && message.hasOwnProperty("customPronunciations")) object.customPronunciations = $root.google.cloud.texttospeech.v1.CustomPronunciations.toObject(message.customPronunciations, options); + if (message.advancedVoiceOptions != null && message.hasOwnProperty("advancedVoiceOptions")) { + object.advancedVoiceOptions = $root.google.cloud.texttospeech.v1.AdvancedVoiceOptions.toObject(message.advancedVoiceOptions, options); + if (options.oneofs) + object._advancedVoiceOptions = "advancedVoiceOptions"; + } return object; }; @@ -8001,6 +8676,8 @@ * @interface IAdvancedVoiceOptions * @property {boolean|null} [lowLatencyJourneySynthesis] AdvancedVoiceOptions lowLatencyJourneySynthesis * @property {boolean|null} [relaxSafetyFilters] AdvancedVoiceOptions relaxSafetyFilters + * @property {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySettings|null} [safetySettings] AdvancedVoiceOptions safetySettings + * @property {boolean|null} [enableTextnorm] AdvancedVoiceOptions enableTextnorm */ /** @@ -8034,6 +8711,22 @@ */ AdvancedVoiceOptions.prototype.relaxSafetyFilters = false; + /** + * AdvancedVoiceOptions safetySettings. + * @member {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySettings|null|undefined} safetySettings + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions + * @instance + */ + AdvancedVoiceOptions.prototype.safetySettings = null; + + /** + * AdvancedVoiceOptions enableTextnorm. + * @member {boolean|null|undefined} enableTextnorm + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions + * @instance + */ + AdvancedVoiceOptions.prototype.enableTextnorm = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -8043,6 +8736,12 @@ set: $util.oneOfSetter($oneOfFields) }); + // Virtual OneOf for proto3 optional field + Object.defineProperty(AdvancedVoiceOptions.prototype, "_enableTextnorm", { + get: $util.oneOfGetter($oneOfFields = ["enableTextnorm"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new AdvancedVoiceOptions instance using the specified properties. * @function create @@ -8069,8 +8768,12 @@ writer = $Writer.create(); if (message.lowLatencyJourneySynthesis != null && Object.hasOwnProperty.call(message, "lowLatencyJourneySynthesis")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.lowLatencyJourneySynthesis); + if (message.enableTextnorm != null && Object.hasOwnProperty.call(message, "enableTextnorm")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.enableTextnorm); if (message.relaxSafetyFilters != null && Object.hasOwnProperty.call(message, "relaxSafetyFilters")) writer.uint32(/* id 8, wireType 0 =*/64).bool(message.relaxSafetyFilters); + if (message.safetySettings != null && Object.hasOwnProperty.call(message, "safetySettings")) + $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings.encode(message.safetySettings, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); return writer; }; @@ -8110,127 +8813,731 @@ case 1: { message.lowLatencyJourneySynthesis = reader.bool(); break; - } - case 8: { - message.relaxSafetyFilters = reader.bool(); + } + case 8: { + message.relaxSafetyFilters = reader.bool(); + break; + } + case 9: { + message.safetySettings = $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings.decode(reader, reader.uint32()); + break; + } + case 2: { + message.enableTextnorm = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AdvancedVoiceOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions} AdvancedVoiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AdvancedVoiceOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AdvancedVoiceOptions message. + * @function verify + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AdvancedVoiceOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.lowLatencyJourneySynthesis != null && message.hasOwnProperty("lowLatencyJourneySynthesis")) { + properties._lowLatencyJourneySynthesis = 1; + if (typeof message.lowLatencyJourneySynthesis !== "boolean") + return "lowLatencyJourneySynthesis: boolean expected"; + } + if (message.relaxSafetyFilters != null && message.hasOwnProperty("relaxSafetyFilters")) + if (typeof message.relaxSafetyFilters !== "boolean") + return "relaxSafetyFilters: boolean expected"; + if (message.safetySettings != null && message.hasOwnProperty("safetySettings")) { + var error = $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings.verify(message.safetySettings); + if (error) + return "safetySettings." + error; + } + if (message.enableTextnorm != null && message.hasOwnProperty("enableTextnorm")) { + properties._enableTextnorm = 1; + if (typeof message.enableTextnorm !== "boolean") + return "enableTextnorm: boolean expected"; + } + return null; + }; + + /** + * Creates an AdvancedVoiceOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions} AdvancedVoiceOptions + */ + AdvancedVoiceOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions) + return object; + var message = new $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions(); + if (object.lowLatencyJourneySynthesis != null) + message.lowLatencyJourneySynthesis = Boolean(object.lowLatencyJourneySynthesis); + if (object.relaxSafetyFilters != null) + message.relaxSafetyFilters = Boolean(object.relaxSafetyFilters); + if (object.safetySettings != null) { + if (typeof object.safetySettings !== "object") + throw TypeError(".google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.safetySettings: object expected"); + message.safetySettings = $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings.fromObject(object.safetySettings); + } + if (object.enableTextnorm != null) + message.enableTextnorm = Boolean(object.enableTextnorm); + return message; + }; + + /** + * Creates a plain object from an AdvancedVoiceOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions + * @static + * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions} message AdvancedVoiceOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AdvancedVoiceOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.relaxSafetyFilters = false; + object.safetySettings = null; + } + if (message.lowLatencyJourneySynthesis != null && message.hasOwnProperty("lowLatencyJourneySynthesis")) { + object.lowLatencyJourneySynthesis = message.lowLatencyJourneySynthesis; + if (options.oneofs) + object._lowLatencyJourneySynthesis = "lowLatencyJourneySynthesis"; + } + if (message.enableTextnorm != null && message.hasOwnProperty("enableTextnorm")) { + object.enableTextnorm = message.enableTextnorm; + if (options.oneofs) + object._enableTextnorm = "enableTextnorm"; + } + if (message.relaxSafetyFilters != null && message.hasOwnProperty("relaxSafetyFilters")) + object.relaxSafetyFilters = message.relaxSafetyFilters; + if (message.safetySettings != null && message.hasOwnProperty("safetySettings")) + object.safetySettings = $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings.toObject(message.safetySettings, options); + return object; + }; + + /** + * Converts this AdvancedVoiceOptions to JSON. + * @function toJSON + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions + * @instance + * @returns {Object.} JSON object + */ + AdvancedVoiceOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AdvancedVoiceOptions + * @function getTypeUrl + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AdvancedVoiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions"; + }; + + AdvancedVoiceOptions.SafetySetting = (function() { + + /** + * Properties of a SafetySetting. + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions + * @interface ISafetySetting + * @property {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmCategory|null} [category] SafetySetting category + * @property {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmBlockThreshold|null} [threshold] SafetySetting threshold + */ + + /** + * Constructs a new SafetySetting. + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions + * @classdesc Represents a SafetySetting. + * @implements ISafetySetting + * @constructor + * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySetting=} [properties] Properties to set + */ + function SafetySetting(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SafetySetting category. + * @member {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmCategory} category + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting + * @instance + */ + SafetySetting.prototype.category = 0; + + /** + * SafetySetting threshold. + * @member {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmBlockThreshold} threshold + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting + * @instance + */ + SafetySetting.prototype.threshold = 0; + + /** + * Creates a new SafetySetting instance using the specified properties. + * @function create + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySetting=} [properties] Properties to set + * @returns {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting} SafetySetting instance + */ + SafetySetting.create = function create(properties) { + return new SafetySetting(properties); + }; + + /** + * Encodes the specified SafetySetting message. Does not implicitly {@link google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting.verify|verify} messages. + * @function encode + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySetting} message SafetySetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SafetySetting.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.category != null && Object.hasOwnProperty.call(message, "category")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.category); + if (message.threshold != null && Object.hasOwnProperty.call(message, "threshold")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.threshold); + return writer; + }; + + /** + * Encodes the specified SafetySetting message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySetting} message SafetySetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SafetySetting.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SafetySetting message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting} SafetySetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SafetySetting.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.category = reader.int32(); + break; + } + case 2: { + message.threshold = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SafetySetting message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting} SafetySetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SafetySetting.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SafetySetting message. + * @function verify + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SafetySetting.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.category != null && message.hasOwnProperty("category")) + switch (message.category) { + default: + return "category: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.threshold != null && message.hasOwnProperty("threshold")) + switch (message.threshold) { + default: + return "threshold: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + return null; + }; + + /** + * Creates a SafetySetting message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting} SafetySetting + */ + SafetySetting.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting) + return object; + var message = new $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting(); + switch (object.category) { + default: + if (typeof object.category === "number") { + message.category = object.category; + break; + } + break; + case "HARM_CATEGORY_UNSPECIFIED": + case 0: + message.category = 0; + break; + case "HARM_CATEGORY_HATE_SPEECH": + case 1: + message.category = 1; + break; + case "HARM_CATEGORY_DANGEROUS_CONTENT": + case 2: + message.category = 2; + break; + case "HARM_CATEGORY_HARASSMENT": + case 3: + message.category = 3; + break; + case "HARM_CATEGORY_SEXUALLY_EXPLICIT": + case 4: + message.category = 4; + break; + } + switch (object.threshold) { + default: + if (typeof object.threshold === "number") { + message.threshold = object.threshold; + break; + } + break; + case "HARM_BLOCK_THRESHOLD_UNSPECIFIED": + case 0: + message.threshold = 0; + break; + case "BLOCK_LOW_AND_ABOVE": + case 1: + message.threshold = 1; + break; + case "BLOCK_MEDIUM_AND_ABOVE": + case 2: + message.threshold = 2; + break; + case "BLOCK_ONLY_HIGH": + case 3: + message.threshold = 3; + break; + case "BLOCK_NONE": + case 4: + message.threshold = 4; + break; + case "OFF": + case 5: + message.threshold = 5; + break; + } + return message; + }; + + /** + * Creates a plain object from a SafetySetting message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting} message SafetySetting + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SafetySetting.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.category = options.enums === String ? "HARM_CATEGORY_UNSPECIFIED" : 0; + object.threshold = options.enums === String ? "HARM_BLOCK_THRESHOLD_UNSPECIFIED" : 0; + } + if (message.category != null && message.hasOwnProperty("category")) + object.category = options.enums === String ? $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmCategory[message.category] === undefined ? message.category : $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmCategory[message.category] : message.category; + if (message.threshold != null && message.hasOwnProperty("threshold")) + object.threshold = options.enums === String ? $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmBlockThreshold[message.threshold] === undefined ? message.threshold : $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmBlockThreshold[message.threshold] : message.threshold; + return object; + }; + + /** + * Converts this SafetySetting to JSON. + * @function toJSON + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting + * @instance + * @returns {Object.} JSON object + */ + SafetySetting.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SafetySetting + * @function getTypeUrl + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SafetySetting.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting"; + }; + + return SafetySetting; + })(); + + AdvancedVoiceOptions.SafetySettings = (function() { + + /** + * Properties of a SafetySettings. + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions + * @interface ISafetySettings + * @property {Array.|null} [settings] SafetySettings settings + */ + + /** + * Constructs a new SafetySettings. + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions + * @classdesc Represents a SafetySettings. + * @implements ISafetySettings + * @constructor + * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySettings=} [properties] Properties to set + */ + function SafetySettings(properties) { + this.settings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SafetySettings settings. + * @member {Array.} settings + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings + * @instance + */ + SafetySettings.prototype.settings = $util.emptyArray; + + /** + * Creates a new SafetySettings instance using the specified properties. + * @function create + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySettings=} [properties] Properties to set + * @returns {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings} SafetySettings instance + */ + SafetySettings.create = function create(properties) { + return new SafetySettings(properties); + }; + + /** + * Encodes the specified SafetySettings message. Does not implicitly {@link google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySettings} message SafetySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SafetySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.settings != null && message.settings.length) + for (var i = 0; i < message.settings.length; ++i) + $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting.encode(message.settings[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SafetySettings message, length delimited. Does not implicitly {@link google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.ISafetySettings} message SafetySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SafetySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SafetySettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings} SafetySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SafetySettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.settings && message.settings.length)) + message.settings = []; + message.settings.push($root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); break; } - default: - reader.skipType(tag & 7); - break; } - } - return message; - }; + return message; + }; - /** - * Decodes an AdvancedVoiceOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions} AdvancedVoiceOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AdvancedVoiceOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a SafetySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings} SafetySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SafetySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies an AdvancedVoiceOptions message. - * @function verify - * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AdvancedVoiceOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.lowLatencyJourneySynthesis != null && message.hasOwnProperty("lowLatencyJourneySynthesis")) { - properties._lowLatencyJourneySynthesis = 1; - if (typeof message.lowLatencyJourneySynthesis !== "boolean") - return "lowLatencyJourneySynthesis: boolean expected"; - } - if (message.relaxSafetyFilters != null && message.hasOwnProperty("relaxSafetyFilters")) - if (typeof message.relaxSafetyFilters !== "boolean") - return "relaxSafetyFilters: boolean expected"; - return null; - }; + /** + * Verifies a SafetySettings message. + * @function verify + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SafetySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.settings != null && message.hasOwnProperty("settings")) { + if (!Array.isArray(message.settings)) + return "settings: array expected"; + for (var i = 0; i < message.settings.length; ++i) { + var error = $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting.verify(message.settings[i]); + if (error) + return "settings." + error; + } + } + return null; + }; - /** - * Creates an AdvancedVoiceOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions} AdvancedVoiceOptions - */ - AdvancedVoiceOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions) + /** + * Creates a SafetySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings} SafetySettings + */ + SafetySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings) + return object; + var message = new $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings(); + if (object.settings) { + if (!Array.isArray(object.settings)) + throw TypeError(".google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings.settings: array expected"); + message.settings = []; + for (var i = 0; i < object.settings.length; ++i) { + if (typeof object.settings[i] !== "object") + throw TypeError(".google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings.settings: object expected"); + message.settings[i] = $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting.fromObject(object.settings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SafetySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings} message SafetySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SafetySettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.settings = []; + if (message.settings && message.settings.length) { + object.settings = []; + for (var j = 0; j < message.settings.length; ++j) + object.settings[j] = $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySetting.toObject(message.settings[j], options); + } return object; - var message = new $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions(); - if (object.lowLatencyJourneySynthesis != null) - message.lowLatencyJourneySynthesis = Boolean(object.lowLatencyJourneySynthesis); - if (object.relaxSafetyFilters != null) - message.relaxSafetyFilters = Boolean(object.relaxSafetyFilters); - return message; - }; + }; - /** - * Creates a plain object from an AdvancedVoiceOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions - * @static - * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions} message AdvancedVoiceOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AdvancedVoiceOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.relaxSafetyFilters = false; - if (message.lowLatencyJourneySynthesis != null && message.hasOwnProperty("lowLatencyJourneySynthesis")) { - object.lowLatencyJourneySynthesis = message.lowLatencyJourneySynthesis; - if (options.oneofs) - object._lowLatencyJourneySynthesis = "lowLatencyJourneySynthesis"; - } - if (message.relaxSafetyFilters != null && message.hasOwnProperty("relaxSafetyFilters")) - object.relaxSafetyFilters = message.relaxSafetyFilters; - return object; - }; + /** + * Converts this SafetySettings to JSON. + * @function toJSON + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings + * @instance + * @returns {Object.} JSON object + */ + SafetySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SafetySettings + * @function getTypeUrl + * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SafetySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.SafetySettings"; + }; + + return SafetySettings; + })(); /** - * Converts this AdvancedVoiceOptions to JSON. - * @function toJSON - * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions - * @instance - * @returns {Object.} JSON object + * HarmCategory enum. + * @name google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmCategory + * @enum {number} + * @property {number} HARM_CATEGORY_UNSPECIFIED=0 HARM_CATEGORY_UNSPECIFIED value + * @property {number} HARM_CATEGORY_HATE_SPEECH=1 HARM_CATEGORY_HATE_SPEECH value + * @property {number} HARM_CATEGORY_DANGEROUS_CONTENT=2 HARM_CATEGORY_DANGEROUS_CONTENT value + * @property {number} HARM_CATEGORY_HARASSMENT=3 HARM_CATEGORY_HARASSMENT value + * @property {number} HARM_CATEGORY_SEXUALLY_EXPLICIT=4 HARM_CATEGORY_SEXUALLY_EXPLICIT value */ - AdvancedVoiceOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + AdvancedVoiceOptions.HarmCategory = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HARM_CATEGORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "HARM_CATEGORY_HATE_SPEECH"] = 1; + values[valuesById[2] = "HARM_CATEGORY_DANGEROUS_CONTENT"] = 2; + values[valuesById[3] = "HARM_CATEGORY_HARASSMENT"] = 3; + values[valuesById[4] = "HARM_CATEGORY_SEXUALLY_EXPLICIT"] = 4; + return values; + })(); /** - * Gets the default type url for AdvancedVoiceOptions - * @function getTypeUrl - * @memberof google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AdvancedVoiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions"; - }; + * HarmBlockThreshold enum. + * @name google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.HarmBlockThreshold + * @enum {number} + * @property {number} HARM_BLOCK_THRESHOLD_UNSPECIFIED=0 HARM_BLOCK_THRESHOLD_UNSPECIFIED value + * @property {number} BLOCK_LOW_AND_ABOVE=1 BLOCK_LOW_AND_ABOVE value + * @property {number} BLOCK_MEDIUM_AND_ABOVE=2 BLOCK_MEDIUM_AND_ABOVE value + * @property {number} BLOCK_ONLY_HIGH=3 BLOCK_ONLY_HIGH value + * @property {number} BLOCK_NONE=4 BLOCK_NONE value + * @property {number} OFF=5 OFF value + */ + AdvancedVoiceOptions.HarmBlockThreshold = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HARM_BLOCK_THRESHOLD_UNSPECIFIED"] = 0; + values[valuesById[1] = "BLOCK_LOW_AND_ABOVE"] = 1; + values[valuesById[2] = "BLOCK_MEDIUM_AND_ABOVE"] = 2; + values[valuesById[3] = "BLOCK_ONLY_HIGH"] = 3; + values[valuesById[4] = "BLOCK_NONE"] = 4; + values[valuesById[5] = "OFF"] = 5; + return values; + })(); return AdvancedVoiceOptions; })(); @@ -12564,6 +13871,7 @@ * @property {google.cloud.texttospeech.v1beta1.IVoiceSelectionParams|null} [voice] StreamingSynthesizeConfig voice * @property {google.cloud.texttospeech.v1beta1.IStreamingAudioConfig|null} [streamingAudioConfig] StreamingSynthesizeConfig streamingAudioConfig * @property {google.cloud.texttospeech.v1beta1.ICustomPronunciations|null} [customPronunciations] StreamingSynthesizeConfig customPronunciations + * @property {google.cloud.texttospeech.v1beta1.IAdvancedVoiceOptions|null} [advancedVoiceOptions] StreamingSynthesizeConfig advancedVoiceOptions */ /** @@ -12605,6 +13913,23 @@ */ StreamingSynthesizeConfig.prototype.customPronunciations = null; + /** + * StreamingSynthesizeConfig advancedVoiceOptions. + * @member {google.cloud.texttospeech.v1beta1.IAdvancedVoiceOptions|null|undefined} advancedVoiceOptions + * @memberof google.cloud.texttospeech.v1beta1.StreamingSynthesizeConfig + * @instance + */ + StreamingSynthesizeConfig.prototype.advancedVoiceOptions = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(StreamingSynthesizeConfig.prototype, "_advancedVoiceOptions", { + get: $util.oneOfGetter($oneOfFields = ["advancedVoiceOptions"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new StreamingSynthesizeConfig instance using the specified properties. * @function create @@ -12635,6 +13960,8 @@ $root.google.cloud.texttospeech.v1beta1.StreamingAudioConfig.encode(message.streamingAudioConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.customPronunciations != null && Object.hasOwnProperty.call(message, "customPronunciations")) $root.google.cloud.texttospeech.v1beta1.CustomPronunciations.encode(message.customPronunciations, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.advancedVoiceOptions != null && Object.hasOwnProperty.call(message, "advancedVoiceOptions")) + $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.encode(message.advancedVoiceOptions, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; @@ -12683,6 +14010,10 @@ message.customPronunciations = $root.google.cloud.texttospeech.v1beta1.CustomPronunciations.decode(reader, reader.uint32()); break; } + case 7: { + message.advancedVoiceOptions = $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -12718,6 +14049,7 @@ StreamingSynthesizeConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.voice != null && message.hasOwnProperty("voice")) { var error = $root.google.cloud.texttospeech.v1beta1.VoiceSelectionParams.verify(message.voice); if (error) @@ -12733,6 +14065,14 @@ if (error) return "customPronunciations." + error; } + if (message.advancedVoiceOptions != null && message.hasOwnProperty("advancedVoiceOptions")) { + properties._advancedVoiceOptions = 1; + { + var error = $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.verify(message.advancedVoiceOptions); + if (error) + return "advancedVoiceOptions." + error; + } + } return null; }; @@ -12763,6 +14103,11 @@ throw TypeError(".google.cloud.texttospeech.v1beta1.StreamingSynthesizeConfig.customPronunciations: object expected"); message.customPronunciations = $root.google.cloud.texttospeech.v1beta1.CustomPronunciations.fromObject(object.customPronunciations); } + if (object.advancedVoiceOptions != null) { + if (typeof object.advancedVoiceOptions !== "object") + throw TypeError(".google.cloud.texttospeech.v1beta1.StreamingSynthesizeConfig.advancedVoiceOptions: object expected"); + message.advancedVoiceOptions = $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.fromObject(object.advancedVoiceOptions); + } return message; }; @@ -12790,6 +14135,11 @@ object.streamingAudioConfig = $root.google.cloud.texttospeech.v1beta1.StreamingAudioConfig.toObject(message.streamingAudioConfig, options); if (message.customPronunciations != null && message.hasOwnProperty("customPronunciations")) object.customPronunciations = $root.google.cloud.texttospeech.v1beta1.CustomPronunciations.toObject(message.customPronunciations, options); + if (message.advancedVoiceOptions != null && message.hasOwnProperty("advancedVoiceOptions")) { + object.advancedVoiceOptions = $root.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions.toObject(message.advancedVoiceOptions, options); + if (options.oneofs) + object._advancedVoiceOptions = "advancedVoiceOptions"; + } return object; }; diff --git a/packages/google-cloud-texttospeech/protos/protos.json b/packages/google-cloud-texttospeech/protos/protos.json index d7307f2330f..7479bbfb250 100644 --- a/packages/google-cloud-texttospeech/protos/protos.json +++ b/packages/google-cloud-texttospeech/protos/protos.json @@ -139,6 +139,11 @@ "oneof": [ "lowLatencyJourneySynthesis" ] + }, + "_enableTextnorm": { + "oneof": [ + "enableTextnorm" + ] } }, "fields": { @@ -152,9 +157,67 @@ "relaxSafetyFilters": { "type": "bool", "id": 8, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "safetySettings": { + "type": "SafetySettings", + "id": 9, "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "enableTextnorm": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + } + }, + "nested": { + "SafetySetting": { + "fields": { + "category": { + "type": "HarmCategory", + "id": 1 + }, + "threshold": { + "type": "HarmBlockThreshold", + "id": 2 + } + } + }, + "SafetySettings": { + "fields": { + "settings": { + "rule": "repeated", + "type": "SafetySetting", + "id": 1 + } + } + }, + "HarmCategory": { + "values": { + "HARM_CATEGORY_UNSPECIFIED": 0, + "HARM_CATEGORY_HATE_SPEECH": 1, + "HARM_CATEGORY_DANGEROUS_CONTENT": 2, + "HARM_CATEGORY_HARASSMENT": 3, + "HARM_CATEGORY_SEXUALLY_EXPLICIT": 4 + } + }, + "HarmBlockThreshold": { + "values": { + "HARM_BLOCK_THRESHOLD_UNSPECIFIED": 0, + "BLOCK_LOW_AND_ABOVE": 1, + "BLOCK_MEDIUM_AND_ABOVE": 2, + "BLOCK_ONLY_HIGH": 3, + "BLOCK_NONE": 4, + "OFF": 5 + } } } }, @@ -192,6 +255,7 @@ "type": "AdvancedVoiceOptions", "id": 8, "options": { + "(google.api.field_behavior)": "OPTIONAL", "proto3_optional": true } } @@ -535,6 +599,13 @@ } }, "StreamingSynthesizeConfig": { + "oneofs": { + "_advancedVoiceOptions": { + "oneof": [ + "advancedVoiceOptions" + ] + } + }, "fields": { "voice": { "type": "VoiceSelectionParams", @@ -556,6 +627,14 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "advancedVoiceOptions": { + "type": "AdvancedVoiceOptions", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } } } }, @@ -850,6 +929,11 @@ "oneof": [ "lowLatencyJourneySynthesis" ] + }, + "_enableTextnorm": { + "oneof": [ + "enableTextnorm" + ] } }, "fields": { @@ -863,9 +947,67 @@ "relaxSafetyFilters": { "type": "bool", "id": 8, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "safetySettings": { + "type": "SafetySettings", + "id": 9, "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "enableTextnorm": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + } + }, + "nested": { + "SafetySetting": { + "fields": { + "category": { + "type": "HarmCategory", + "id": 1 + }, + "threshold": { + "type": "HarmBlockThreshold", + "id": 2 + } + } + }, + "SafetySettings": { + "fields": { + "settings": { + "rule": "repeated", + "type": "SafetySetting", + "id": 1 + } + } + }, + "HarmCategory": { + "values": { + "HARM_CATEGORY_UNSPECIFIED": 0, + "HARM_CATEGORY_HATE_SPEECH": 1, + "HARM_CATEGORY_DANGEROUS_CONTENT": 2, + "HARM_CATEGORY_HARASSMENT": 3, + "HARM_CATEGORY_SEXUALLY_EXPLICIT": 4 + } + }, + "HarmBlockThreshold": { + "values": { + "HARM_BLOCK_THRESHOLD_UNSPECIFIED": 0, + "BLOCK_LOW_AND_ABOVE": 1, + "BLOCK_MEDIUM_AND_ABOVE": 2, + "BLOCK_ONLY_HIGH": 3, + "BLOCK_NONE": 4, + "OFF": 5 + } } } }, @@ -908,6 +1050,7 @@ "type": "AdvancedVoiceOptions", "id": 8, "options": { + "(google.api.field_behavior)": "OPTIONAL", "proto3_optional": true } } @@ -1280,6 +1423,13 @@ } }, "StreamingSynthesizeConfig": { + "oneofs": { + "_advancedVoiceOptions": { + "oneof": [ + "advancedVoiceOptions" + ] + } + }, "fields": { "voice": { "type": "VoiceSelectionParams", @@ -1301,6 +1451,14 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "advancedVoiceOptions": { + "type": "AdvancedVoiceOptions", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } } } }, diff --git a/packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js b/packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js index 87ceddc160c..0231f1eec11 100644 --- a/packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js +++ b/packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js @@ -41,7 +41,7 @@ function main(input, voice, audioConfig) { */ // const audioConfig = {} /** - * Advanced voice options. + * Optional. Advanced voice options. */ // const advancedVoiceOptions = {} diff --git a/packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.synthesize_speech.js b/packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.synthesize_speech.js index 9276ef9deca..28f85e1ad89 100644 --- a/packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.synthesize_speech.js +++ b/packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.synthesize_speech.js @@ -45,7 +45,7 @@ function main(input, voice, audioConfig) { */ // const enableTimePointing = [1,2,3,4] /** - * Advanced voice options. + * Optional. Advanced voice options. */ // const advancedVoiceOptions = {} diff --git a/packages/google-cloud-texttospeech/src/v1/text_to_speech_client.ts b/packages/google-cloud-texttospeech/src/v1/text_to_speech_client.ts index 2533baed6a5..515cbbd36e8 100644 --- a/packages/google-cloud-texttospeech/src/v1/text_to_speech_client.ts +++ b/packages/google-cloud-texttospeech/src/v1/text_to_speech_client.ts @@ -449,8 +449,8 @@ export class TextToSpeechClient { * Required. The desired voice of the synthesized audio. * @param {google.cloud.texttospeech.v1.AudioConfig} request.audioConfig * Required. The configuration of the synthesized audio. - * @param {google.cloud.texttospeech.v1.AdvancedVoiceOptions} request.advancedVoiceOptions - * Advanced voice options. + * @param {google.cloud.texttospeech.v1.AdvancedVoiceOptions} [request.advancedVoiceOptions] + * Optional. Advanced voice options. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. diff --git a/packages/google-cloud-texttospeech/src/v1beta1/text_to_speech_client.ts b/packages/google-cloud-texttospeech/src/v1beta1/text_to_speech_client.ts index 3f0cf13b1bb..5ae1cf956fb 100644 --- a/packages/google-cloud-texttospeech/src/v1beta1/text_to_speech_client.ts +++ b/packages/google-cloud-texttospeech/src/v1beta1/text_to_speech_client.ts @@ -451,8 +451,8 @@ export class TextToSpeechClient { * Required. The configuration of the synthesized audio. * @param {number[]} request.enableTimePointing * Whether and what timepoints are returned in the response. - * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions} request.advancedVoiceOptions - * Advanced voice options. + * @param {google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions} [request.advancedVoiceOptions] + * Optional. Advanced voice options. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array.