Google Cloud Text-to-Speech v1 API - Class TextToSpeechLongAudioSynthesizeClient (3.2.0)

public abstract class TextToSpeechLongAudioSynthesizeClient

Reference documentation and code samples for the Google Cloud Text-to-Speech v1 API class TextToSpeechLongAudioSynthesizeClient.

TextToSpeechLongAudioSynthesize client wrapper, for convenient use.

Inheritance

Object > TextToSpeechLongAudioSynthesizeClient

Namespace

Google.Cloud.TextToSpeech.V1

Assembly

Google.Cloud.TextToSpeech.V1.dll

Remarks

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

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the TextToSpeechLongAudioSynthesize service, which is a host of "texttospeech.googleapis.com" and a port of 443.

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default TextToSpeechLongAudioSynthesize scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

The default TextToSpeechLongAudioSynthesize scopes are:

GrpcClient

public virtual TextToSpeechLongAudioSynthesize.TextToSpeechLongAudioSynthesizeClient GrpcClient { get; }

The underlying gRPC TextToSpeechLongAudioSynthesize client

Property Value
TypeDescription
TextToSpeechLongAudioSynthesize.TextToSpeechLongAudioSynthesizeClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

SynthesizeLongAudioOperationsClient

public virtual OperationsClient SynthesizeLongAudioOperationsClient { get; }

The long-running operations client for SynthesizeLongAudio.

Property Value
TypeDescription
OperationsClient

Methods

Create()

public static TextToSpeechLongAudioSynthesizeClient Create()

Synchronously creates a TextToSpeechLongAudioSynthesizeClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use TextToSpeechLongAudioSynthesizeClientBuilder.

Returns
TypeDescription
TextToSpeechLongAudioSynthesizeClient

The created TextToSpeechLongAudioSynthesizeClient.

CreateAsync(CancellationToken)

public static Task<TextToSpeechLongAudioSynthesizeClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))

Asynchronously creates a TextToSpeechLongAudioSynthesizeClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use TextToSpeechLongAudioSynthesizeClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<TextToSpeechLongAudioSynthesizeClient>

The task representing the created TextToSpeechLongAudioSynthesizeClient.

PollOnceSynthesizeLongAudio(String, CallSettings)

public virtual Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> PollOnceSynthesizeLongAudio(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of SynthesizeLongAudio .

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata>

The result of polling the operation.

PollOnceSynthesizeLongAudioAsync(String, CallSettings)

public virtual Task<Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata>> PollOnceSynthesizeLongAudioAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of SynthesizeLongAudio.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata>>

A task representing the result of polling the operation.

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

SynthesizeLongAudio(SynthesizeLongAudioRequest, CallSettings)

public virtual Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> SynthesizeLongAudio(SynthesizeLongAudioRequest request, CallSettings callSettings = null)

Synthesizes long form text asynchronously.

Parameters
NameDescription
requestSynthesizeLongAudioRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata>

The RPC response.

Example
// Create client
TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient = TextToSpeechLongAudioSynthesizeClient.Create();
// Initialize request argument(s)
SynthesizeLongAudioRequest request = new SynthesizeLongAudioRequest
{
    Parent = "",
    Input = new SynthesisInput(),
    AudioConfig = new AudioConfig(),
    OutputGcsUri = "",
    Voice = new VoiceSelectionParams(),
};
// Make the request
Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> response = textToSpeechLongAudioSynthesizeClient.SynthesizeLongAudio(request);

// Poll until the returned long-running operation is complete
Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
SynthesizeLongAudioResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> retrievedResponse = textToSpeechLongAudioSynthesizeClient.PollOnceSynthesizeLongAudio(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    SynthesizeLongAudioResponse retrievedResult = retrievedResponse.Result;
}

SynthesizeLongAudioAsync(SynthesizeLongAudioRequest, CallSettings)

public virtual Task<Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata>> SynthesizeLongAudioAsync(SynthesizeLongAudioRequest request, CallSettings callSettings = null)

Synthesizes long form text asynchronously.

Parameters
NameDescription
requestSynthesizeLongAudioRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata>>

A Task containing the RPC response.

Example
// Create client
TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient = await TextToSpeechLongAudioSynthesizeClient.CreateAsync();
// Initialize request argument(s)
SynthesizeLongAudioRequest request = new SynthesizeLongAudioRequest
{
    Parent = "",
    Input = new SynthesisInput(),
    AudioConfig = new AudioConfig(),
    OutputGcsUri = "",
    Voice = new VoiceSelectionParams(),
};
// Make the request
Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> response = await textToSpeechLongAudioSynthesizeClient.SynthesizeLongAudioAsync(request);

// Poll until the returned long-running operation is complete
Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
SynthesizeLongAudioResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> retrievedResponse = await textToSpeechLongAudioSynthesizeClient.PollOnceSynthesizeLongAudioAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    SynthesizeLongAudioResponse retrievedResult = retrievedResponse.Result;
}

SynthesizeLongAudioAsync(SynthesizeLongAudioRequest, CancellationToken)

public virtual Task<Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata>> SynthesizeLongAudioAsync(SynthesizeLongAudioRequest request, CancellationToken cancellationToken)

Synthesizes long form text asynchronously.

Parameters
NameDescription
requestSynthesizeLongAudioRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata>>

A Task containing the RPC response.

Example
// Create client
TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient = await TextToSpeechLongAudioSynthesizeClient.CreateAsync();
// Initialize request argument(s)
SynthesizeLongAudioRequest request = new SynthesizeLongAudioRequest
{
    Parent = "",
    Input = new SynthesisInput(),
    AudioConfig = new AudioConfig(),
    OutputGcsUri = "",
    Voice = new VoiceSelectionParams(),
};
// Make the request
Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> response = await textToSpeechLongAudioSynthesizeClient.SynthesizeLongAudioAsync(request);

// Poll until the returned long-running operation is complete
Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
SynthesizeLongAudioResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> retrievedResponse = await textToSpeechLongAudioSynthesizeClient.PollOnceSynthesizeLongAudioAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    SynthesizeLongAudioResponse retrievedResult = retrievedResponse.Result;
}