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

Synth log will be available here:
https://source.cloud.google.com/results/invocations/6052dd28-5243-4ec5-b111-b1f991d613d9/targets

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

PiperOrigin-RevId: 362934100
Source-Link: googleapis/googleapis@7232686
PiperOrigin-RevId: 362856902
Source-Link: googleapis/googleapis@1305ca4

chore: update java microgenerator to 1.0.2 Adds request initialization to sample code
  • Loading branch information
yoshi-automation committed Mar 16, 2021
1 parent 5ad0d36 commit 59d5abfd75d24e87bd5b98600dafcbf674316f54
@@ -478,6 +478,12 @@ public final ListPhraseSetPagedResponse listPhraseSet(ListPhraseSetRequest reque
*
* <pre>{@code
* try (AdaptationClient adaptationClient = AdaptationClient.create()) {
* ListPhraseSetRequest request =
* ListPhraseSetRequest.newBuilder()
* .setParent(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListPhraseSetResponse response = adaptationClient.listPhraseSetCallable().call(request);
* for (PhraseSet element : response.getResponsesList()) {
@@ -986,6 +992,12 @@ public final ListCustomClassesPagedResponse listCustomClasses(ListCustomClassesR
*
* <pre>{@code
* try (AdaptationClient adaptationClient = AdaptationClient.create()) {
* ListCustomClassesRequest request =
* ListCustomClassesRequest.newBuilder()
* .setParent(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListCustomClassesResponse response =
* adaptationClient.listCustomClassesCallable().call(request);
@@ -62,7 +62,7 @@ public void reset() {
@Override
public void recognize(
RecognizeRequest request, StreamObserver<RecognizeResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof RecognizeResponse) {
requests.add(request);
responseObserver.onNext(((RecognizeResponse) response));
@@ -74,7 +74,7 @@ public void recognize(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method Recognize, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
RecognizeResponse.class.getName(),
Exception.class.getName())));
}
@@ -83,7 +83,7 @@ public void recognize(
@Override
public void longRunningRecognize(
LongRunningRecognizeRequest request, StreamObserver<Operation> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Operation) {
requests.add(request);
responseObserver.onNext(((Operation) response));
@@ -95,7 +95,7 @@ public void longRunningRecognize(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method LongRunningRecognize, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Operation.class.getName(),
Exception.class.getName())));
}
@@ -119,7 +119,7 @@ public void onNext(StreamingRecognizeRequest value) {
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method StreamingRecognize, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
StreamingRecognizeResponse.class.getName(),
Exception.class.getName())));
}
@@ -62,7 +62,7 @@ public void reset() {
@Override
public void createPhraseSet(
CreatePhraseSetRequest request, StreamObserver<PhraseSet> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof PhraseSet) {
requests.add(request);
responseObserver.onNext(((PhraseSet) response));
@@ -74,7 +74,7 @@ public void createPhraseSet(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method CreatePhraseSet, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
PhraseSet.class.getName(),
Exception.class.getName())));
}
@@ -83,7 +83,7 @@ public void createPhraseSet(
@Override
public void getPhraseSet(
GetPhraseSetRequest request, StreamObserver<PhraseSet> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof PhraseSet) {
requests.add(request);
responseObserver.onNext(((PhraseSet) response));
@@ -95,7 +95,7 @@ public void getPhraseSet(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method GetPhraseSet, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
PhraseSet.class.getName(),
Exception.class.getName())));
}
@@ -104,7 +104,7 @@ public void getPhraseSet(
@Override
public void listPhraseSet(
ListPhraseSetRequest request, StreamObserver<ListPhraseSetResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof ListPhraseSetResponse) {
requests.add(request);
responseObserver.onNext(((ListPhraseSetResponse) response));
@@ -116,7 +116,7 @@ public void listPhraseSet(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method ListPhraseSet, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
ListPhraseSetResponse.class.getName(),
Exception.class.getName())));
}
@@ -125,7 +125,7 @@ public void listPhraseSet(
@Override
public void updatePhraseSet(
UpdatePhraseSetRequest request, StreamObserver<PhraseSet> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof PhraseSet) {
requests.add(request);
responseObserver.onNext(((PhraseSet) response));
@@ -137,7 +137,7 @@ public void updatePhraseSet(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method UpdatePhraseSet, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
PhraseSet.class.getName(),
Exception.class.getName())));
}
@@ -146,7 +146,7 @@ public void updatePhraseSet(
@Override
public void deletePhraseSet(
DeletePhraseSetRequest request, StreamObserver<Empty> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Empty) {
requests.add(request);
responseObserver.onNext(((Empty) response));
@@ -158,7 +158,7 @@ public void deletePhraseSet(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method DeletePhraseSet, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Empty.class.getName(),
Exception.class.getName())));
}
@@ -167,7 +167,7 @@ public void deletePhraseSet(
@Override
public void createCustomClass(
CreateCustomClassRequest request, StreamObserver<CustomClass> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof CustomClass) {
requests.add(request);
responseObserver.onNext(((CustomClass) response));
@@ -179,7 +179,7 @@ public void createCustomClass(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method CreateCustomClass, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
CustomClass.class.getName(),
Exception.class.getName())));
}
@@ -188,7 +188,7 @@ public void createCustomClass(
@Override
public void getCustomClass(
GetCustomClassRequest request, StreamObserver<CustomClass> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof CustomClass) {
requests.add(request);
responseObserver.onNext(((CustomClass) response));
@@ -200,7 +200,7 @@ public void getCustomClass(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method GetCustomClass, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
CustomClass.class.getName(),
Exception.class.getName())));
}
@@ -210,7 +210,7 @@ public void getCustomClass(
public void listCustomClasses(
ListCustomClassesRequest request,
StreamObserver<ListCustomClassesResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof ListCustomClassesResponse) {
requests.add(request);
responseObserver.onNext(((ListCustomClassesResponse) response));
@@ -222,7 +222,7 @@ public void listCustomClasses(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method ListCustomClasses, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
ListCustomClassesResponse.class.getName(),
Exception.class.getName())));
}
@@ -231,7 +231,7 @@ public void listCustomClasses(
@Override
public void updateCustomClass(
UpdateCustomClassRequest request, StreamObserver<CustomClass> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof CustomClass) {
requests.add(request);
responseObserver.onNext(((CustomClass) response));
@@ -243,7 +243,7 @@ public void updateCustomClass(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method UpdateCustomClass, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
CustomClass.class.getName(),
Exception.class.getName())));
}
@@ -252,7 +252,7 @@ public void updateCustomClass(
@Override
public void deleteCustomClass(
DeleteCustomClassRequest request, StreamObserver<Empty> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Empty) {
requests.add(request);
responseObserver.onNext(((Empty) response));
@@ -264,7 +264,7 @@ public void deleteCustomClass(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method DeleteCustomClass, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Empty.class.getName(),
Exception.class.getName())));
}
@@ -62,7 +62,7 @@ public void reset() {
@Override
public void recognize(
RecognizeRequest request, StreamObserver<RecognizeResponse> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof RecognizeResponse) {
requests.add(request);
responseObserver.onNext(((RecognizeResponse) response));
@@ -74,7 +74,7 @@ public void recognize(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method Recognize, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
RecognizeResponse.class.getName(),
Exception.class.getName())));
}
@@ -83,7 +83,7 @@ public void recognize(
@Override
public void longRunningRecognize(
LongRunningRecognizeRequest request, StreamObserver<Operation> responseObserver) {
Object response = responses.remove();
Object response = responses.poll();
if (response instanceof Operation) {
requests.add(request);
responseObserver.onNext(((Operation) response));
@@ -95,7 +95,7 @@ public void longRunningRecognize(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method LongRunningRecognize, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
Operation.class.getName(),
Exception.class.getName())));
}
@@ -119,7 +119,7 @@ public void onNext(StreamingRecognizeRequest value) {
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method StreamingRecognize, expected %s or %s",
response.getClass().getName(),
response == null ? "null" : response.getClass().getName(),
StreamingRecognizeResponse.class.getName(),
Exception.class.getName())));
}
@@ -130,6 +130,8 @@ public void longRunningRecognizeTest() throws Exception {
LongRunningRecognizeResponse expectedResponse =
LongRunningRecognizeResponse.newBuilder()
.addAllResults(new ArrayList<SpeechRecognitionResult>())
.setOutputConfig(TranscriptOutputConfig.newBuilder().build())
.setOutputError(Status.newBuilder().build())
.build();
Operation resultOperation =
Operation.newBuilder()

0 comments on commit 59d5abf

Please sign in to comment.