Skip to content
Permalink
Browse files
feat: Support output transcript to GCS for LongRunningRecognize (#467)
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/fafdc5bd-5ed6-41ca-a975-45f17b90ee7f/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 362294447
Source-Link: googleapis/googleapis@b6ebac1
  • Loading branch information
yoshi-automation committed Mar 16, 2021
1 parent 748dd18 commit 5ad0d367715e59e3565ce62f5edb546047492dda
Showing with 1,654 additions and 401 deletions.
  1. +59 −0 google-cloud-speech/src/main/java/com/google/cloud/speech/v1p1beta1/AdaptationClient.java
  2. +3 −0 google-cloud-speech/src/main/java/com/google/cloud/speech/v1p1beta1/SpeechClient.java
  3. +2 −2 google-cloud-speech/src/main/java/com/google/cloud/speech/v1p1beta1/gapic_metadata.json
  4. +16 −28 google-cloud-speech/src/test/java/com/google/cloud/speech/v1p1beta1/AdaptationClientTest.java
  5. +14 −14 ...peech-v1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/LongRunningRecognizeMetadata.java
  6. +4 −4 ...1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/LongRunningRecognizeMetadataOrBuilder.java
  7. +307 −0 ...speech-v1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/LongRunningRecognizeRequest.java
  8. +41 −0 ...p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/LongRunningRecognizeRequestOrBuilder.java
  9. +22 −31 ...ogle-cloud-speech-v1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/RecognitionAudio.java
  10. +6 −9 ...d-speech-v1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/RecognitionAudioOrBuilder.java
  11. +13 −25 ...gle-cloud-speech-v1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/RecognitionConfig.java
  12. +3 −6 ...-speech-v1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/RecognitionConfigOrBuilder.java
  13. +41 −40 ...cloud-speech-v1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/SpeechAdaptationProto.java
  14. +167 −154 proto-google-cloud-speech-v1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/SpeechProto.java
  15. +21 −21 ...oud-speech-v1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/SpeechRecognitionResult.java
  16. +6 −6 ...h-v1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/SpeechRecognitionResultOrBuilder.java
  17. +21 −21 ...-speech-v1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/StreamingRecognitionResult.java
  18. +6 −6 ...1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/StreamingRecognitionResultOrBuilder.java
  19. +785 −0 ...loud-speech-v1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/TranscriptOutputConfig.java
  20. +71 −0 ...ch-v1p1beta1/src/main/java/com/google/cloud/speech/v1p1beta1/TranscriptOutputConfigOrBuilder.java
  21. +37 −29 proto-google-cloud-speech-v1p1beta1/src/main/proto/google/cloud/speech/v1p1beta1/cloud_speech.proto
  22. +2 −0 ...cloud-speech-v1p1beta1/src/main/proto/google/cloud/speech/v1p1beta1/cloud_speech_adaptation.proto
  23. +7 −5 synth.metadata
@@ -30,6 +30,7 @@
import com.google.cloud.speech.v1p1beta1.stub.AdaptationStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -496,6 +497,35 @@ public final UnaryCallable<ListPhraseSetRequest, ListPhraseSetResponse> listPhra
return stub.listPhraseSetCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Update a phrase set.
*
* <p>Sample code:
*
* <pre>{@code
* try (AdaptationClient adaptationClient = AdaptationClient.create()) {
* PhraseSet phraseSet = PhraseSet.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* PhraseSet response = adaptationClient.updatePhraseSet(phraseSet, updateMask);
* }
* }</pre>
*
* @param phraseSet Required. The phrase set to update.
* <p>The phrase set's `name` field is used to identify the set to be updated. Format:
* {api_version}/projects/{project}/locations/{location}/phraseSets/{phrase_set}
* @param updateMask The list of fields to be updated.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PhraseSet updatePhraseSet(PhraseSet phraseSet, FieldMask updateMask) {
UpdatePhraseSetRequest request =
UpdatePhraseSetRequest.newBuilder()
.setPhraseSet(phraseSet)
.setUpdateMask(updateMask)
.build();
return updatePhraseSet(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Update a phrase set.
@@ -977,6 +1007,35 @@ public final ListCustomClassesPagedResponse listCustomClasses(ListCustomClassesR
return stub.listCustomClassesCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Update a custom class.
*
* <p>Sample code:
*
* <pre>{@code
* try (AdaptationClient adaptationClient = AdaptationClient.create()) {
* CustomClass customClass = CustomClass.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* CustomClass response = adaptationClient.updateCustomClass(customClass, updateMask);
* }
* }</pre>
*
* @param customClass Required. The custom class to update.
* <p>The custom class's `name` field is used to identify the custom class to be updated.
* Format: {api_version}/projects/{project}/locations/{location}/customClasses/{custom_class}
* @param updateMask The list of fields to be updated.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final CustomClass updateCustomClass(CustomClass customClass, FieldMask updateMask) {
UpdateCustomClassRequest request =
UpdateCustomClassRequest.newBuilder()
.setCustomClass(customClass)
.setUpdateMask(updateMask)
.build();
return updateCustomClass(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Update a custom class.
@@ -273,6 +273,7 @@ public final UnaryCallable<RecognizeRequest, RecognizeResponse> recognizeCallabl
* LongRunningRecognizeRequest.newBuilder()
* .setConfig(RecognitionConfig.newBuilder().build())
* .setAudio(RecognitionAudio.newBuilder().build())
* .setOutputConfig(TranscriptOutputConfig.newBuilder().build())
* .build();
* LongRunningRecognizeResponse response = speechClient.longRunningRecognizeAsync(request).get();
* }
@@ -301,6 +302,7 @@ public final UnaryCallable<RecognizeRequest, RecognizeResponse> recognizeCallabl
* LongRunningRecognizeRequest.newBuilder()
* .setConfig(RecognitionConfig.newBuilder().build())
* .setAudio(RecognitionAudio.newBuilder().build())
* .setOutputConfig(TranscriptOutputConfig.newBuilder().build())
* .build();
* OperationFuture<LongRunningRecognizeResponse, LongRunningRecognizeMetadata> future =
* speechClient.longRunningRecognizeOperationCallable().futureCall(request);
@@ -330,6 +332,7 @@ public final UnaryCallable<RecognizeRequest, RecognizeResponse> recognizeCallabl
* LongRunningRecognizeRequest.newBuilder()
* .setConfig(RecognitionConfig.newBuilder().build())
* .setAudio(RecognitionAudio.newBuilder().build())
* .setOutputConfig(TranscriptOutputConfig.newBuilder().build())
* .build();
* ApiFuture<Operation> future = speechClient.longRunningRecognizeCallable().futureCall(request);
* // Do something.
@@ -53,10 +53,10 @@
"methods": ["listPhraseSet", "listPhraseSet", "listPhraseSet", "listPhraseSetPagedCallable", "listPhraseSetCallable"]
},
"UpdateCustomClass": {
"methods": ["updateCustomClass", "updateCustomClassCallable"]
"methods": ["updateCustomClass", "updateCustomClass", "updateCustomClassCallable"]
},
"UpdatePhraseSet": {
"methods": ["updatePhraseSet", "updatePhraseSetCallable"]
"methods": ["updatePhraseSet", "updatePhraseSet", "updatePhraseSetCallable"]
}
}
}
@@ -352,21 +352,18 @@ public void updatePhraseSetTest() throws Exception {
.build();
mockAdaptation.addResponse(expectedResponse);

UpdatePhraseSetRequest request =
UpdatePhraseSetRequest.newBuilder()
.setPhraseSet(PhraseSet.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
PhraseSet phraseSet = PhraseSet.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();

PhraseSet actualResponse = client.updatePhraseSet(request);
PhraseSet actualResponse = client.updatePhraseSet(phraseSet, updateMask);
Assert.assertEquals(expectedResponse, actualResponse);

List<AbstractMessage> actualRequests = mockAdaptation.getRequests();
Assert.assertEquals(1, actualRequests.size());
UpdatePhraseSetRequest actualRequest = ((UpdatePhraseSetRequest) actualRequests.get(0));

Assert.assertEquals(request.getPhraseSet(), actualRequest.getPhraseSet());
Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask());
Assert.assertEquals(phraseSet, actualRequest.getPhraseSet());
Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -379,12 +376,9 @@ public void updatePhraseSetExceptionTest() throws Exception {
mockAdaptation.addException(exception);

try {
UpdatePhraseSetRequest request =
UpdatePhraseSetRequest.newBuilder()
.setPhraseSet(PhraseSet.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
client.updatePhraseSet(request);
PhraseSet phraseSet = PhraseSet.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
client.updatePhraseSet(phraseSet, updateMask);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
@@ -729,21 +723,18 @@ public void updateCustomClassTest() throws Exception {
.build();
mockAdaptation.addResponse(expectedResponse);

UpdateCustomClassRequest request =
UpdateCustomClassRequest.newBuilder()
.setCustomClass(CustomClass.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
CustomClass customClass = CustomClass.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();

CustomClass actualResponse = client.updateCustomClass(request);
CustomClass actualResponse = client.updateCustomClass(customClass, updateMask);
Assert.assertEquals(expectedResponse, actualResponse);

List<AbstractMessage> actualRequests = mockAdaptation.getRequests();
Assert.assertEquals(1, actualRequests.size());
UpdateCustomClassRequest actualRequest = ((UpdateCustomClassRequest) actualRequests.get(0));

Assert.assertEquals(request.getCustomClass(), actualRequest.getCustomClass());
Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask());
Assert.assertEquals(customClass, actualRequest.getCustomClass());
Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -756,12 +747,9 @@ public void updateCustomClassExceptionTest() throws Exception {
mockAdaptation.addException(exception);

try {
UpdateCustomClassRequest request =
UpdateCustomClassRequest.newBuilder()
.setCustomClass(CustomClass.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
client.updateCustomClass(request);
CustomClass customClass = CustomClass.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
client.updateCustomClass(customClass, updateMask);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
@@ -267,8 +267,8 @@ public com.google.protobuf.TimestampOrBuilder getLastUpdateTimeOrBuilder() {
*
*
* <pre>
* Output only. The URI of the audio file being transcribed. Empty if the
* audio was sent as byte content.
* Output only. The URI of the audio file being transcribed. Empty if the audio was sent
* as byte content.
* </pre>
*
* <code>string uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
@@ -291,8 +291,8 @@ public java.lang.String getUri() {
*
*
* <pre>
* Output only. The URI of the audio file being transcribed. Empty if the
* audio was sent as byte content.
* Output only. The URI of the audio file being transcribed. Empty if the audio was sent
* as byte content.
* </pre>
*
* <code>string uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
@@ -1131,8 +1131,8 @@ public com.google.protobuf.TimestampOrBuilder getLastUpdateTimeOrBuilder() {
*
*
* <pre>
* Output only. The URI of the audio file being transcribed. Empty if the
* audio was sent as byte content.
* Output only. The URI of the audio file being transcribed. Empty if the audio was sent
* as byte content.
* </pre>
*
* <code>string uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
@@ -1154,8 +1154,8 @@ public java.lang.String getUri() {
*
*
* <pre>
* Output only. The URI of the audio file being transcribed. Empty if the
* audio was sent as byte content.
* Output only. The URI of the audio file being transcribed. Empty if the audio was sent
* as byte content.
* </pre>
*
* <code>string uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
@@ -1177,8 +1177,8 @@ public com.google.protobuf.ByteString getUriBytes() {
*
*
* <pre>
* Output only. The URI of the audio file being transcribed. Empty if the
* audio was sent as byte content.
* Output only. The URI of the audio file being transcribed. Empty if the audio was sent
* as byte content.
* </pre>
*
* <code>string uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
@@ -1199,8 +1199,8 @@ public Builder setUri(java.lang.String value) {
*
*
* <pre>
* Output only. The URI of the audio file being transcribed. Empty if the
* audio was sent as byte content.
* Output only. The URI of the audio file being transcribed. Empty if the audio was sent
* as byte content.
* </pre>
*
* <code>string uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
@@ -1217,8 +1217,8 @@ public Builder clearUri() {
*
*
* <pre>
* Output only. The URI of the audio file being transcribed. Empty if the
* audio was sent as byte content.
* Output only. The URI of the audio file being transcribed. Empty if the audio was sent
* as byte content.
* </pre>
*
* <code>string uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
@@ -111,8 +111,8 @@
*
*
* <pre>
* Output only. The URI of the audio file being transcribed. Empty if the
* audio was sent as byte content.
* Output only. The URI of the audio file being transcribed. Empty if the audio was sent
* as byte content.
* </pre>
*
* <code>string uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
@@ -124,8 +124,8 @@
*
*
* <pre>
* Output only. The URI of the audio file being transcribed. Empty if the
* audio was sent as byte content.
* Output only. The URI of the audio file being transcribed. Empty if the audio was sent
* as byte content.
* </pre>
*
* <code>string uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>

0 comments on commit 5ad0d36

Please sign in to comment.