# Cloud Text-to-Speech V1beta1 API - Class Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::Client (v0.31.0)

0.31.0 (latest) 0.30.0 0.29.0 0.28.0 0.27.1 0.26.0 0.25.0 0.24.0 0.23.0 0.22.0 0.21.0 0.20.1 0.19.0 0.18.0 0.17.0 0.16.0 0.15.2 0.14.0 0.13.2 0.12.1 0.11.1 0.10.1 0.9.1 0.8.0 0.7.1 Reference documentation and code samples for the Cloud Text-to-Speech V1beta1 API class Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::Client.

REST client for the TextToSpeech service.


<br />

Service that implements Google Cloud Text-to-Speech API.

## Inherits

- Object

## Includes

- [Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-TextToSpeech-Paths)

## Methods

### .configure

    def self.configure() { |config| ... } -> Client::Configuration

Configure the TextToSpeech Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-TextToSpeech-Rest-Client-Configuration "Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-TextToSpeech-Rest-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-TextToSpeech-Rest-Client-Configuration))
**Example**

```ruby
# Modify the configuration for all TextToSpeech clients
::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::Client.configure do |config|
  config.timeout = 10.0
end
```

### #configure

    def configure() { |config| ... } -> Client::Configuration

Configure the TextToSpeech Client instance.


The configuration is set to the derived mode, meaning that values can be changed,
but structural changes (adding new fields, etc.) are not allowed. Structural changes
should be made on [Client.configure](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-TextToSpeech-Rest-Client#Google__Cloud__TextToSpeech__V1beta1__TextToSpeech__Rest__Client_configure_class_ "Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-TextToSpeech-Rest-Client-Configuration "Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-TextToSpeech-Rest-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-TextToSpeech-Rest-Client-Configuration))

### #initialize

    def initialize() { |config| ... } -> Client

Create a new TextToSpeech REST client object.
**Yields**

- (config) --- Configure the TextToSpeech client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-TextToSpeech-Rest-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-TextToSpeech-Rest-Client)) --- a new instance of Client
**Example**

```ruby
# Create a client using the default configuration
client = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::Client.new do |config|
  config.timeout = 10.0
end
```

### #list_voices

    def list_voices(request, options = nil) -> ::Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse
    def list_voices(language_code: nil) -> ::Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse

Returns a list of Voice supported for synthesis.
**Overloads**

    def list_voices(request, options = nil) -> ::Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse

Pass arguments to `list_voices` via a request object, either of type [ListVoicesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-ListVoicesRequest "Google::Cloud::TextToSpeech::V1beta1::ListVoicesRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::TextToSpeech::V1beta1::ListVoicesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-ListVoicesRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

    def list_voices(language_code: nil) -> ::Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse

Pass arguments to `list_voices` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameter**

- **language_code** (::String) --- Optional. Recommended. [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If not specified, the API will return all supported voices. If specified, the ListVoices call will only return voices that can be used to synthesize this language_code. For example, if you specify `"en-NZ"`, all `"en-NZ"` voices will be returned. If you specify `"no"`, both `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be returned.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** ([::Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-ListVoicesResponse))
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- ([::Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-ListVoicesResponse))
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/text_to_speech/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::TextToSpeech::V1beta1::ListVoicesRequest.new

# Call the list_voices method.
result = client.list_voices request

# The returned object is of type Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse.
p result
```

### #logger

    def logger() -> Logger

The logger used for request/response debug logging.
**Returns**

- (Logger)

### #synthesize_speech

    def synthesize_speech(request, options = nil) -> ::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse
    def synthesize_speech(input: nil, voice: nil, audio_config: nil, enable_time_pointing: nil, advanced_voice_options: nil) -> ::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse

Synthesizes speech synchronously: receive results after all text input
has been processed.
**Overloads**

    def synthesize_speech(request, options = nil) -> ::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse

Pass arguments to `synthesize_speech` via a request object, either of type [SynthesizeSpeechRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-SynthesizeSpeechRequest "Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-SynthesizeSpeechRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

    def synthesize_speech(input: nil, voice: nil, audio_config: nil, enable_time_pointing: nil, advanced_voice_options: nil) -> ::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse

Pass arguments to `synthesize_speech` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **input** ([::Google::Cloud::TextToSpeech::V1beta1::SynthesisInput](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-SynthesisInput), ::Hash) --- Required. The Synthesizer requires either plain text or SSML as input.
- **voice** ([::Google::Cloud::TextToSpeech::V1beta1::VoiceSelectionParams](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-VoiceSelectionParams), ::Hash) --- Required. The desired voice of the synthesized audio.
- **audio_config** ([::Google::Cloud::TextToSpeech::V1beta1::AudioConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-AudioConfig), ::Hash) --- Required. The configuration of the synthesized audio.
- **enable_time_pointing** (::Array\<[::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechRequest::TimepointType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-SynthesizeSpeechRequest-TimepointType)\>) --- Whether and what timepoints are returned in the response.
- **advanced_voice_options** ([::Google::Cloud::TextToSpeech::V1beta1::AdvancedVoiceOptions](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-AdvancedVoiceOptions), ::Hash) --- Optional. Advanced voice options.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** ([::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-SynthesizeSpeechResponse))
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- ([::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest/Google-Cloud-TextToSpeech-V1beta1-SynthesizeSpeechResponse))
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/text_to_speech/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechRequest.new

# Call the synthesize_speech method.
result = client.synthesize_speech request

# The returned object is of type Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse.
p result
```

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)