summaryrefslogtreecommitdiff
path: root/java/com/android/voicemail/impl/transcribe/grpc
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/voicemail/impl/transcribe/grpc')
-rw-r--r--java/com/android/voicemail/impl/transcribe/grpc/TranscriptionClient.java11
-rw-r--r--java/com/android/voicemail/impl/transcribe/grpc/TranscriptionFeedbackResponseAsync.java35
-rw-r--r--java/com/android/voicemail/impl/transcribe/grpc/voicemail_transcription.proto2
3 files changed, 47 insertions, 1 deletions
diff --git a/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionClient.java b/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionClient.java
index b18d95627..381cb3268 100644
--- a/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionClient.java
+++ b/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionClient.java
@@ -17,6 +17,7 @@ package com.android.voicemail.impl.transcribe.grpc;
import android.support.annotation.WorkerThread;
import com.google.internal.communications.voicemailtranscription.v1.GetTranscriptRequest;
+import com.google.internal.communications.voicemailtranscription.v1.SendTranscriptionFeedbackRequest;
import com.google.internal.communications.voicemailtranscription.v1.TranscribeVoicemailAsyncRequest;
import com.google.internal.communications.voicemailtranscription.v1.TranscribeVoicemailRequest;
import com.google.internal.communications.voicemailtranscription.v1.VoicemailTranscriptionServiceGrpc;
@@ -58,4 +59,14 @@ public class TranscriptionClient {
return new GetTranscriptResponseAsync(e.getStatus());
}
}
+
+ @WorkerThread
+ public TranscriptionFeedbackResponseAsync sendTranscriptFeedbackRequest(
+ SendTranscriptionFeedbackRequest request) {
+ try {
+ return new TranscriptionFeedbackResponseAsync(stub.sendTranscriptionFeedback(request));
+ } catch (StatusRuntimeException e) {
+ return new TranscriptionFeedbackResponseAsync(e.getStatus());
+ }
+ }
}
diff --git a/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionFeedbackResponseAsync.java b/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionFeedbackResponseAsync.java
new file mode 100644
index 000000000..bc6155bbd
--- /dev/null
+++ b/java/com/android/voicemail/impl/transcribe/grpc/TranscriptionFeedbackResponseAsync.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * 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
+ *
+ * http://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
+ */
+package com.android.voicemail.impl.transcribe.grpc;
+
+import android.support.annotation.VisibleForTesting;
+import com.android.dialer.common.Assert;
+import com.google.internal.communications.voicemailtranscription.v1.SendTranscriptionFeedbackResponse;
+import io.grpc.Status;
+
+/** Container for response and status objects for an asynchronous transcription feedback request */
+public class TranscriptionFeedbackResponseAsync extends TranscriptionResponse {
+
+ @VisibleForTesting
+ public TranscriptionFeedbackResponseAsync(SendTranscriptionFeedbackResponse response) {
+ Assert.checkArgument(response != null);
+ }
+
+ @VisibleForTesting
+ public TranscriptionFeedbackResponseAsync(Status status) {
+ super(status);
+ }
+}
diff --git a/java/com/android/voicemail/impl/transcribe/grpc/voicemail_transcription.proto b/java/com/android/voicemail/impl/transcribe/grpc/voicemail_transcription.proto
index c46fb2176..8248b02a7 100644
--- a/java/com/android/voicemail/impl/transcribe/grpc/voicemail_transcription.proto
+++ b/java/com/android/voicemail/impl/transcribe/grpc/voicemail_transcription.proto
@@ -184,7 +184,7 @@ service VoicemailTranscriptionService {
// Uploads user's transcription feedback. Feedback will only be collected from
// user's who have consented to donate their voicemails.
- rpc SendTranscriptionFeedback(SendTranscriptionFeedbackResponse)
+ rpc SendTranscriptionFeedback(SendTranscriptionFeedbackRequest)
returns (SendTranscriptionFeedbackResponse) {
}
}