Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Commit

Permalink
feat: Support output transcript to GCS for LongRunningRecognize (#471)
Browse files Browse the repository at this point in the history
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 59d5abf
Show file tree
Hide file tree
Showing 12 changed files with 1,083 additions and 91 deletions.
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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);
Expand Down
Expand Up @@ -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));
Expand All @@ -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())));
}
Expand All @@ -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));
Expand All @@ -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())));
}
Expand All @@ -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())));
}
Expand Down
Expand Up @@ -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));
Expand All @@ -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())));
}
Expand All @@ -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));
Expand All @@ -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())));
}
Expand All @@ -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));
Expand All @@ -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())));
}
Expand All @@ -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));
Expand All @@ -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())));
}
Expand All @@ -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));
Expand All @@ -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())));
}
Expand All @@ -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));
Expand All @@ -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())));
}
Expand All @@ -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));
Expand All @@ -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())));
}
Expand All @@ -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));
Expand All @@ -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())));
}
Expand All @@ -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));
Expand All @@ -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())));
}
Expand All @@ -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));
Expand All @@ -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())));
}
Expand Down
Expand Up @@ -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));
Expand All @@ -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())));
}
Expand All @@ -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));
Expand All @@ -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())));
}
Expand All @@ -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())));
}
Expand Down
Expand Up @@ -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()
Expand Down

0 comments on commit 59d5abf

Please sign in to comment.