• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.cloud.dialogflow.v2;
17 
18 import static io.grpc.MethodDescriptor.generateFullMethodName;
19 
20 /**
21  *
22  *
23  * <pre>
24  * Service for managing
25  * [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord].
26  * </pre>
27  */
28 @javax.annotation.Generated(
29     value = "by gRPC proto compiler",
30     comments = "Source: google/cloud/dialogflow/v2/answer_record.proto")
31 @io.grpc.stub.annotations.GrpcGenerated
32 public final class AnswerRecordsGrpc {
33 
AnswerRecordsGrpc()34   private AnswerRecordsGrpc() {}
35 
36   public static final String SERVICE_NAME = "google.cloud.dialogflow.v2.AnswerRecords";
37 
38   // Static method descriptors that strictly reflect the proto.
39   private static volatile io.grpc.MethodDescriptor<
40           com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest,
41           com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse>
42       getListAnswerRecordsMethod;
43 
44   @io.grpc.stub.annotations.RpcMethod(
45       fullMethodName = SERVICE_NAME + '/' + "ListAnswerRecords",
46       requestType = com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest.class,
47       responseType = com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse.class,
48       methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
49   public static io.grpc.MethodDescriptor<
50           com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest,
51           com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse>
getListAnswerRecordsMethod()52       getListAnswerRecordsMethod() {
53     io.grpc.MethodDescriptor<
54             com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest,
55             com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse>
56         getListAnswerRecordsMethod;
57     if ((getListAnswerRecordsMethod = AnswerRecordsGrpc.getListAnswerRecordsMethod) == null) {
58       synchronized (AnswerRecordsGrpc.class) {
59         if ((getListAnswerRecordsMethod = AnswerRecordsGrpc.getListAnswerRecordsMethod) == null) {
60           AnswerRecordsGrpc.getListAnswerRecordsMethod =
61               getListAnswerRecordsMethod =
62                   io.grpc.MethodDescriptor
63                       .<com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest,
64                           com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse>
65                           newBuilder()
66                       .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
67                       .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListAnswerRecords"))
68                       .setSampledToLocalTracing(true)
69                       .setRequestMarshaller(
70                           io.grpc.protobuf.ProtoUtils.marshaller(
71                               com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest
72                                   .getDefaultInstance()))
73                       .setResponseMarshaller(
74                           io.grpc.protobuf.ProtoUtils.marshaller(
75                               com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse
76                                   .getDefaultInstance()))
77                       .setSchemaDescriptor(
78                           new AnswerRecordsMethodDescriptorSupplier("ListAnswerRecords"))
79                       .build();
80         }
81       }
82     }
83     return getListAnswerRecordsMethod;
84   }
85 
86   private static volatile io.grpc.MethodDescriptor<
87           com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest,
88           com.google.cloud.dialogflow.v2.AnswerRecord>
89       getUpdateAnswerRecordMethod;
90 
91   @io.grpc.stub.annotations.RpcMethod(
92       fullMethodName = SERVICE_NAME + '/' + "UpdateAnswerRecord",
93       requestType = com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest.class,
94       responseType = com.google.cloud.dialogflow.v2.AnswerRecord.class,
95       methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
96   public static io.grpc.MethodDescriptor<
97           com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest,
98           com.google.cloud.dialogflow.v2.AnswerRecord>
getUpdateAnswerRecordMethod()99       getUpdateAnswerRecordMethod() {
100     io.grpc.MethodDescriptor<
101             com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest,
102             com.google.cloud.dialogflow.v2.AnswerRecord>
103         getUpdateAnswerRecordMethod;
104     if ((getUpdateAnswerRecordMethod = AnswerRecordsGrpc.getUpdateAnswerRecordMethod) == null) {
105       synchronized (AnswerRecordsGrpc.class) {
106         if ((getUpdateAnswerRecordMethod = AnswerRecordsGrpc.getUpdateAnswerRecordMethod) == null) {
107           AnswerRecordsGrpc.getUpdateAnswerRecordMethod =
108               getUpdateAnswerRecordMethod =
109                   io.grpc.MethodDescriptor
110                       .<com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest,
111                           com.google.cloud.dialogflow.v2.AnswerRecord>
112                           newBuilder()
113                       .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
114                       .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateAnswerRecord"))
115                       .setSampledToLocalTracing(true)
116                       .setRequestMarshaller(
117                           io.grpc.protobuf.ProtoUtils.marshaller(
118                               com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest
119                                   .getDefaultInstance()))
120                       .setResponseMarshaller(
121                           io.grpc.protobuf.ProtoUtils.marshaller(
122                               com.google.cloud.dialogflow.v2.AnswerRecord.getDefaultInstance()))
123                       .setSchemaDescriptor(
124                           new AnswerRecordsMethodDescriptorSupplier("UpdateAnswerRecord"))
125                       .build();
126         }
127       }
128     }
129     return getUpdateAnswerRecordMethod;
130   }
131 
132   /** Creates a new async stub that supports all call types for the service */
newStub(io.grpc.Channel channel)133   public static AnswerRecordsStub newStub(io.grpc.Channel channel) {
134     io.grpc.stub.AbstractStub.StubFactory<AnswerRecordsStub> factory =
135         new io.grpc.stub.AbstractStub.StubFactory<AnswerRecordsStub>() {
136           @java.lang.Override
137           public AnswerRecordsStub newStub(
138               io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
139             return new AnswerRecordsStub(channel, callOptions);
140           }
141         };
142     return AnswerRecordsStub.newStub(factory, channel);
143   }
144 
145   /**
146    * Creates a new blocking-style stub that supports unary and streaming output calls on the service
147    */
newBlockingStub(io.grpc.Channel channel)148   public static AnswerRecordsBlockingStub newBlockingStub(io.grpc.Channel channel) {
149     io.grpc.stub.AbstractStub.StubFactory<AnswerRecordsBlockingStub> factory =
150         new io.grpc.stub.AbstractStub.StubFactory<AnswerRecordsBlockingStub>() {
151           @java.lang.Override
152           public AnswerRecordsBlockingStub newStub(
153               io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
154             return new AnswerRecordsBlockingStub(channel, callOptions);
155           }
156         };
157     return AnswerRecordsBlockingStub.newStub(factory, channel);
158   }
159 
160   /** Creates a new ListenableFuture-style stub that supports unary calls on the service */
newFutureStub(io.grpc.Channel channel)161   public static AnswerRecordsFutureStub newFutureStub(io.grpc.Channel channel) {
162     io.grpc.stub.AbstractStub.StubFactory<AnswerRecordsFutureStub> factory =
163         new io.grpc.stub.AbstractStub.StubFactory<AnswerRecordsFutureStub>() {
164           @java.lang.Override
165           public AnswerRecordsFutureStub newStub(
166               io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
167             return new AnswerRecordsFutureStub(channel, callOptions);
168           }
169         };
170     return AnswerRecordsFutureStub.newStub(factory, channel);
171   }
172 
173   /**
174    *
175    *
176    * <pre>
177    * Service for managing
178    * [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord].
179    * </pre>
180    */
181   public interface AsyncService {
182 
183     /**
184      *
185      *
186      * <pre>
187      * Returns the list of all answer records in the specified project in reverse
188      * chronological order.
189      * </pre>
190      */
listAnswerRecords( com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest request, io.grpc.stub.StreamObserver<com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse> responseObserver)191     default void listAnswerRecords(
192         com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest request,
193         io.grpc.stub.StreamObserver<com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse>
194             responseObserver) {
195       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
196           getListAnswerRecordsMethod(), responseObserver);
197     }
198 
199     /**
200      *
201      *
202      * <pre>
203      * Updates the specified answer record.
204      * </pre>
205      */
updateAnswerRecord( com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest request, io.grpc.stub.StreamObserver<com.google.cloud.dialogflow.v2.AnswerRecord> responseObserver)206     default void updateAnswerRecord(
207         com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest request,
208         io.grpc.stub.StreamObserver<com.google.cloud.dialogflow.v2.AnswerRecord> responseObserver) {
209       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
210           getUpdateAnswerRecordMethod(), responseObserver);
211     }
212   }
213 
214   /**
215    * Base class for the server implementation of the service AnswerRecords.
216    *
217    * <pre>
218    * Service for managing
219    * [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord].
220    * </pre>
221    */
222   public abstract static class AnswerRecordsImplBase
223       implements io.grpc.BindableService, AsyncService {
224 
225     @java.lang.Override
bindService()226     public final io.grpc.ServerServiceDefinition bindService() {
227       return AnswerRecordsGrpc.bindService(this);
228     }
229   }
230 
231   /**
232    * A stub to allow clients to do asynchronous rpc calls to service AnswerRecords.
233    *
234    * <pre>
235    * Service for managing
236    * [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord].
237    * </pre>
238    */
239   public static final class AnswerRecordsStub
240       extends io.grpc.stub.AbstractAsyncStub<AnswerRecordsStub> {
AnswerRecordsStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)241     private AnswerRecordsStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
242       super(channel, callOptions);
243     }
244 
245     @java.lang.Override
build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)246     protected AnswerRecordsStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
247       return new AnswerRecordsStub(channel, callOptions);
248     }
249 
250     /**
251      *
252      *
253      * <pre>
254      * Returns the list of all answer records in the specified project in reverse
255      * chronological order.
256      * </pre>
257      */
listAnswerRecords( com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest request, io.grpc.stub.StreamObserver<com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse> responseObserver)258     public void listAnswerRecords(
259         com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest request,
260         io.grpc.stub.StreamObserver<com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse>
261             responseObserver) {
262       io.grpc.stub.ClientCalls.asyncUnaryCall(
263           getChannel().newCall(getListAnswerRecordsMethod(), getCallOptions()),
264           request,
265           responseObserver);
266     }
267 
268     /**
269      *
270      *
271      * <pre>
272      * Updates the specified answer record.
273      * </pre>
274      */
updateAnswerRecord( com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest request, io.grpc.stub.StreamObserver<com.google.cloud.dialogflow.v2.AnswerRecord> responseObserver)275     public void updateAnswerRecord(
276         com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest request,
277         io.grpc.stub.StreamObserver<com.google.cloud.dialogflow.v2.AnswerRecord> responseObserver) {
278       io.grpc.stub.ClientCalls.asyncUnaryCall(
279           getChannel().newCall(getUpdateAnswerRecordMethod(), getCallOptions()),
280           request,
281           responseObserver);
282     }
283   }
284 
285   /**
286    * A stub to allow clients to do synchronous rpc calls to service AnswerRecords.
287    *
288    * <pre>
289    * Service for managing
290    * [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord].
291    * </pre>
292    */
293   public static final class AnswerRecordsBlockingStub
294       extends io.grpc.stub.AbstractBlockingStub<AnswerRecordsBlockingStub> {
AnswerRecordsBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)295     private AnswerRecordsBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
296       super(channel, callOptions);
297     }
298 
299     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)300     protected AnswerRecordsBlockingStub build(
301         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
302       return new AnswerRecordsBlockingStub(channel, callOptions);
303     }
304 
305     /**
306      *
307      *
308      * <pre>
309      * Returns the list of all answer records in the specified project in reverse
310      * chronological order.
311      * </pre>
312      */
listAnswerRecords( com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest request)313     public com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse listAnswerRecords(
314         com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest request) {
315       return io.grpc.stub.ClientCalls.blockingUnaryCall(
316           getChannel(), getListAnswerRecordsMethod(), getCallOptions(), request);
317     }
318 
319     /**
320      *
321      *
322      * <pre>
323      * Updates the specified answer record.
324      * </pre>
325      */
updateAnswerRecord( com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest request)326     public com.google.cloud.dialogflow.v2.AnswerRecord updateAnswerRecord(
327         com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest request) {
328       return io.grpc.stub.ClientCalls.blockingUnaryCall(
329           getChannel(), getUpdateAnswerRecordMethod(), getCallOptions(), request);
330     }
331   }
332 
333   /**
334    * A stub to allow clients to do ListenableFuture-style rpc calls to service AnswerRecords.
335    *
336    * <pre>
337    * Service for managing
338    * [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord].
339    * </pre>
340    */
341   public static final class AnswerRecordsFutureStub
342       extends io.grpc.stub.AbstractFutureStub<AnswerRecordsFutureStub> {
AnswerRecordsFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)343     private AnswerRecordsFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
344       super(channel, callOptions);
345     }
346 
347     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)348     protected AnswerRecordsFutureStub build(
349         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
350       return new AnswerRecordsFutureStub(channel, callOptions);
351     }
352 
353     /**
354      *
355      *
356      * <pre>
357      * Returns the list of all answer records in the specified project in reverse
358      * chronological order.
359      * </pre>
360      */
361     public com.google.common.util.concurrent.ListenableFuture<
362             com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse>
listAnswerRecords(com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest request)363         listAnswerRecords(com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest request) {
364       return io.grpc.stub.ClientCalls.futureUnaryCall(
365           getChannel().newCall(getListAnswerRecordsMethod(), getCallOptions()), request);
366     }
367 
368     /**
369      *
370      *
371      * <pre>
372      * Updates the specified answer record.
373      * </pre>
374      */
375     public com.google.common.util.concurrent.ListenableFuture<
376             com.google.cloud.dialogflow.v2.AnswerRecord>
updateAnswerRecord(com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest request)377         updateAnswerRecord(com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest request) {
378       return io.grpc.stub.ClientCalls.futureUnaryCall(
379           getChannel().newCall(getUpdateAnswerRecordMethod(), getCallOptions()), request);
380     }
381   }
382 
383   private static final int METHODID_LIST_ANSWER_RECORDS = 0;
384   private static final int METHODID_UPDATE_ANSWER_RECORD = 1;
385 
386   private static final class MethodHandlers<Req, Resp>
387       implements io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
388           io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
389           io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
390           io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
391     private final AsyncService serviceImpl;
392     private final int methodId;
393 
MethodHandlers(AsyncService serviceImpl, int methodId)394     MethodHandlers(AsyncService serviceImpl, int methodId) {
395       this.serviceImpl = serviceImpl;
396       this.methodId = methodId;
397     }
398 
399     @java.lang.Override
400     @java.lang.SuppressWarnings("unchecked")
invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)401     public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
402       switch (methodId) {
403         case METHODID_LIST_ANSWER_RECORDS:
404           serviceImpl.listAnswerRecords(
405               (com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest) request,
406               (io.grpc.stub.StreamObserver<
407                       com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse>)
408                   responseObserver);
409           break;
410         case METHODID_UPDATE_ANSWER_RECORD:
411           serviceImpl.updateAnswerRecord(
412               (com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest) request,
413               (io.grpc.stub.StreamObserver<com.google.cloud.dialogflow.v2.AnswerRecord>)
414                   responseObserver);
415           break;
416         default:
417           throw new AssertionError();
418       }
419     }
420 
421     @java.lang.Override
422     @java.lang.SuppressWarnings("unchecked")
invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)423     public io.grpc.stub.StreamObserver<Req> invoke(
424         io.grpc.stub.StreamObserver<Resp> responseObserver) {
425       switch (methodId) {
426         default:
427           throw new AssertionError();
428       }
429     }
430   }
431 
bindService(AsyncService service)432   public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
433     return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
434         .addMethod(
435             getListAnswerRecordsMethod(),
436             io.grpc.stub.ServerCalls.asyncUnaryCall(
437                 new MethodHandlers<
438                     com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest,
439                     com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse>(
440                     service, METHODID_LIST_ANSWER_RECORDS)))
441         .addMethod(
442             getUpdateAnswerRecordMethod(),
443             io.grpc.stub.ServerCalls.asyncUnaryCall(
444                 new MethodHandlers<
445                     com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest,
446                     com.google.cloud.dialogflow.v2.AnswerRecord>(
447                     service, METHODID_UPDATE_ANSWER_RECORD)))
448         .build();
449   }
450 
451   private abstract static class AnswerRecordsBaseDescriptorSupplier
452       implements io.grpc.protobuf.ProtoFileDescriptorSupplier,
453           io.grpc.protobuf.ProtoServiceDescriptorSupplier {
AnswerRecordsBaseDescriptorSupplier()454     AnswerRecordsBaseDescriptorSupplier() {}
455 
456     @java.lang.Override
getFileDescriptor()457     public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
458       return com.google.cloud.dialogflow.v2.AnswerRecordsProto.getDescriptor();
459     }
460 
461     @java.lang.Override
getServiceDescriptor()462     public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
463       return getFileDescriptor().findServiceByName("AnswerRecords");
464     }
465   }
466 
467   private static final class AnswerRecordsFileDescriptorSupplier
468       extends AnswerRecordsBaseDescriptorSupplier {
AnswerRecordsFileDescriptorSupplier()469     AnswerRecordsFileDescriptorSupplier() {}
470   }
471 
472   private static final class AnswerRecordsMethodDescriptorSupplier
473       extends AnswerRecordsBaseDescriptorSupplier
474       implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
475     private final String methodName;
476 
AnswerRecordsMethodDescriptorSupplier(String methodName)477     AnswerRecordsMethodDescriptorSupplier(String methodName) {
478       this.methodName = methodName;
479     }
480 
481     @java.lang.Override
getMethodDescriptor()482     public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
483       return getServiceDescriptor().findMethodByName(methodName);
484     }
485   }
486 
487   private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
488 
getServiceDescriptor()489   public static io.grpc.ServiceDescriptor getServiceDescriptor() {
490     io.grpc.ServiceDescriptor result = serviceDescriptor;
491     if (result == null) {
492       synchronized (AnswerRecordsGrpc.class) {
493         result = serviceDescriptor;
494         if (result == null) {
495           serviceDescriptor =
496               result =
497                   io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
498                       .setSchemaDescriptor(new AnswerRecordsFileDescriptorSupplier())
499                       .addMethod(getListAnswerRecordsMethod())
500                       .addMethod(getUpdateAnswerRecordMethod())
501                       .build();
502         }
503       }
504     }
505     return result;
506   }
507 }
508