Skip to content

Commit

Permalink
feat: add LRS API
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 493338018

Source-Link: googleapis/googleapis@380b2f0

Source-Link: googleapis/googleapis-gen@5802e4b
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuVGV4dFRvU3BlZWNoLlYxQmV0YTEvLk93bEJvdC55YW1sIiwiaCI6IjU4MDJlNGJkMjQ0ZjExYWJmODhjOGVlMzk2OGRjMWQ3MjgxYzQ5NmEifQ==
  • Loading branch information
gcf-owl-bot[bot] authored and jskeet committed Dec 6, 2022
1 parent 5491c8f commit 96674eb
Show file tree
Hide file tree
Showing 14 changed files with 1,843 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace Google.Cloud.TextToSpeech.V1Beta1.Snippets
{
// [START texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_async]
using Google.Cloud.TextToSpeech.V1Beta1;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedTextToSpeechLongAudioSynthesizeClientSnippets
{
/// <summary>Snippet for SynthesizeLongAudioAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task SynthesizeLongAudioRequestObjectAsync()
{
// 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;
}
}
}
// [END texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_async]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace Google.Cloud.TextToSpeech.V1Beta1.Snippets
{
// [START texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_sync]
using Google.Cloud.TextToSpeech.V1Beta1;
using Google.LongRunning;

public sealed partial class GeneratedTextToSpeechLongAudioSynthesizeClientSnippets
{
/// <summary>Snippet for SynthesizeLongAudio</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void SynthesizeLongAudioRequestObject()
{
// 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;
}
}
}
// [END texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_sync]
}
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,83 @@
"type": "SHORT"
}
]
},
{
"regionTag": "texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_sync",
"title": "SynthesizeLongAudioRequestObject",
"description": "Snippet for SynthesizeLongAudio",
"file": "TextToSpeechLongAudioSynthesizeClient.SynthesizeLongAudioRequestObjectSnippet.g.cs",
"language": "C_SHARP",
"clientMethod": {
"shortName": "SynthesizeLongAudio",
"fullName": "Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechLongAudioSynthesizeClient.SynthesizeLongAudio",
"resultType": "Google.LongRunning.Operation<Google.Cloud.TextToSpeech.V1Beta1.SynthesizeLongAudioResponse, Google.Cloud.TextToSpeech.V1Beta1.SynthesizeLongAudioMetadata>",
"client": {
"shortName": "TextToSpeechLongAudioSynthesizeClient",
"fullName": "Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechLongAudioSynthesizeClient"
},
"method": {
"shortName": "SynthesizeLongAudio",
"fullName": "google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesize.SynthesizeLongAudio",
"service": {
"shortName": "TextToSpeechLongAudioSynthesize",
"fullName": "google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesize"
}
}
},
"canonical": true,
"origin": "API_DEFINITION",
"segments": [
{
"start": 20,
"end": 65,
"type": "FULL"
},
{
"start": 35,
"end": 63,
"type": "SHORT"
}
]
},
{
"regionTag": "texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_async",
"title": "SynthesizeLongAudioRequestObjectAsync",
"description": "Snippet for SynthesizeLongAudioAsync",
"file": "TextToSpeechLongAudioSynthesizeClient.SynthesizeLongAudioRequestObjectAsyncSnippet.g.cs",
"language": "C_SHARP",
"clientMethod": {
"shortName": "SynthesizeLongAudioAsync",
"fullName": "Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechLongAudioSynthesizeClient.SynthesizeLongAudioAsync",
"async": true,
"resultType": "System.Threading.Tasks.Task<Google.LongRunning.Operation<Google.Cloud.TextToSpeech.V1Beta1.SynthesizeLongAudioResponse, Google.Cloud.TextToSpeech.V1Beta1.SynthesizeLongAudioMetadata>>",
"client": {
"shortName": "TextToSpeechLongAudioSynthesizeClient",
"fullName": "Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechLongAudioSynthesizeClient"
},
"method": {
"shortName": "SynthesizeLongAudio",
"fullName": "google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesize.SynthesizeLongAudio",
"service": {
"shortName": "TextToSpeechLongAudioSynthesize",
"fullName": "google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesize"
}
}
},
"canonical": true,
"origin": "API_DEFINITION",
"segments": [
{
"start": 20,
"end": 66,
"type": "FULL"
},
{
"start": 36,
"end": 64,
"type": "SHORT"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace Google.Cloud.TextToSpeech.V1Beta1.Snippets
{
using Google.LongRunning;
using System.Threading.Tasks;

/// <summary>Generated snippets.</summary>
public sealed class AllGeneratedTextToSpeechLongAudioSynthesizeClientSnippets
{
/// <summary>Snippet for SynthesizeLongAudio</summary>
public void SynthesizeLongAudioRequestObject()
{
// Snippet: SynthesizeLongAudio(SynthesizeLongAudioRequest, CallSettings)
// 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;
}
// End snippet
}

/// <summary>Snippet for SynthesizeLongAudioAsync</summary>
public async Task SynthesizeLongAudioRequestObjectAsync()
{
// Snippet: SynthesizeLongAudioAsync(SynthesizeLongAudioRequest, CallSettings)
// Additional: SynthesizeLongAudioAsync(SynthesizeLongAudioRequest, CancellationToken)
// 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;
}
// End snippet
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public enum SsmlVoiceGender {
/// </summary>
public enum AudioEncoding {
/// <summary>
/// Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][].
/// Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
/// </summary>
[pbr::OriginalName("AUDIO_ENCODING_UNSPECIFIED")] Unspecified = 0,
/// <summary>
Expand Down Expand Up @@ -1230,8 +1230,8 @@ public enum TimepointType {
/// <summary>
/// Contains text input to be synthesized. Either `text` or `ssml` must be
/// supplied. Supplying both or neither returns
/// [google.rpc.Code.INVALID_ARGUMENT][]. The input size is limited to 5000
/// characters.
/// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. The input size is limited to 5000
/// bytes.
/// </summary>
public sealed partial class SynthesisInput : pb::IMessage<SynthesisInput>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
Expand Down Expand Up @@ -1305,7 +1305,7 @@ public sealed partial class SynthesisInput : pb::IMessage<SynthesisInput>
/// <summary>
/// The SSML document to be synthesized. The SSML document must be valid
/// and well-formed. Otherwise the RPC will fail and return
/// [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
/// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
/// [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
Expand Down Expand Up @@ -1976,7 +1976,7 @@ public sealed partial class AudioConfig : pb::IMessage<AudioConfig>
/// converting to the desired sample rate (which might result in worse audio
/// quality), unless the specified sample rate is not supported for the
/// encoding chosen, in which case it will fail the request and return
/// [google.rpc.Code.INVALID_ARGUMENT][].
/// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// source: google/cloud/texttospeech/v1beta1/cloud_tts.proto
// </auto-generated>
// Original file comments:
// Copyright 2021 Google LLC
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 96674eb

Please sign in to comment.