• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 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 
17 package com.google.cloud.dialogflow.v2;
18 
19 import com.google.api.core.ApiFuture;
20 import com.google.api.core.ApiFutures;
21 import com.google.api.gax.core.BackgroundResource;
22 import com.google.api.gax.paging.AbstractFixedSizeCollection;
23 import com.google.api.gax.paging.AbstractPage;
24 import com.google.api.gax.paging.AbstractPagedListResponse;
25 import com.google.api.gax.rpc.BidiStreamingCallable;
26 import com.google.api.gax.rpc.PageContext;
27 import com.google.api.gax.rpc.UnaryCallable;
28 import com.google.cloud.dialogflow.v2.stub.ParticipantsStub;
29 import com.google.cloud.dialogflow.v2.stub.ParticipantsStubSettings;
30 import com.google.cloud.location.GetLocationRequest;
31 import com.google.cloud.location.ListLocationsRequest;
32 import com.google.cloud.location.ListLocationsResponse;
33 import com.google.cloud.location.Location;
34 import com.google.common.util.concurrent.MoreExecutors;
35 import com.google.protobuf.FieldMask;
36 import java.io.IOException;
37 import java.util.List;
38 import java.util.concurrent.TimeUnit;
39 import javax.annotation.Generated;
40 
41 // AUTO-GENERATED DOCUMENTATION AND CLASS.
42 /**
43  * Service Description: Service for managing [Participants][google.cloud.dialogflow.v2.Participant].
44  *
45  * <p>This class provides the ability to make remote calls to the backing service through method
46  * calls that map to API methods. Sample code to get started:
47  *
48  * <pre>{@code
49  * // This snippet has been automatically generated and should be regarded as a code template only.
50  * // It will require modifications to work:
51  * // - It may require correct/in-range values for request initialization.
52  * // - It may require specifying regional endpoints when creating the service client as shown in
53  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
54  * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
55  *   ConversationName parent =
56  *       ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]");
57  *   Participant participant = Participant.newBuilder().build();
58  *   Participant response = participantsClient.createParticipant(parent, participant);
59  * }
60  * }</pre>
61  *
62  * <p>Note: close() needs to be called on the ParticipantsClient object to clean up resources such
63  * as threads. In the example above, try-with-resources is used, which automatically calls close().
64  *
65  * <p>The surface of this class includes several types of Java methods for each of the API's
66  * methods:
67  *
68  * <ol>
69  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
70  *       converted into function parameters. It may be the case that not all fields are available as
71  *       parameters, and not every API method will have a flattened method entry point.
72  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
73  *       which must be constructed before the call. Not every API method will have a request object
74  *       method.
75  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
76  *       callable object, which can be used to initiate calls to the service.
77  * </ol>
78  *
79  * <p>See the individual methods for example code.
80  *
81  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
82  * these names, this class includes a format method for each type of name, and additionally a parse
83  * method to extract the individual identifiers contained within names that are returned.
84  *
85  * <p>This class can be customized by passing in a custom instance of ParticipantsSettings to
86  * create(). For example:
87  *
88  * <p>To customize credentials:
89  *
90  * <pre>{@code
91  * // This snippet has been automatically generated and should be regarded as a code template only.
92  * // It will require modifications to work:
93  * // - It may require correct/in-range values for request initialization.
94  * // - It may require specifying regional endpoints when creating the service client as shown in
95  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
96  * ParticipantsSettings participantsSettings =
97  *     ParticipantsSettings.newBuilder()
98  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
99  *         .build();
100  * ParticipantsClient participantsClient = ParticipantsClient.create(participantsSettings);
101  * }</pre>
102  *
103  * <p>To customize the endpoint:
104  *
105  * <pre>{@code
106  * // This snippet has been automatically generated and should be regarded as a code template only.
107  * // It will require modifications to work:
108  * // - It may require correct/in-range values for request initialization.
109  * // - It may require specifying regional endpoints when creating the service client as shown in
110  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
111  * ParticipantsSettings participantsSettings =
112  *     ParticipantsSettings.newBuilder().setEndpoint(myEndpoint).build();
113  * ParticipantsClient participantsClient = ParticipantsClient.create(participantsSettings);
114  * }</pre>
115  *
116  * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
117  * the wire:
118  *
119  * <pre>{@code
120  * // This snippet has been automatically generated and should be regarded as a code template only.
121  * // It will require modifications to work:
122  * // - It may require correct/in-range values for request initialization.
123  * // - It may require specifying regional endpoints when creating the service client as shown in
124  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
125  * ParticipantsSettings participantsSettings = ParticipantsSettings.newHttpJsonBuilder().build();
126  * ParticipantsClient participantsClient = ParticipantsClient.create(participantsSettings);
127  * }</pre>
128  *
129  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
130  */
131 @Generated("by gapic-generator-java")
132 public class ParticipantsClient implements BackgroundResource {
133   private final ParticipantsSettings settings;
134   private final ParticipantsStub stub;
135 
136   /** Constructs an instance of ParticipantsClient with default settings. */
create()137   public static final ParticipantsClient create() throws IOException {
138     return create(ParticipantsSettings.newBuilder().build());
139   }
140 
141   /**
142    * Constructs an instance of ParticipantsClient, using the given settings. The channels are
143    * created based on the settings passed in, or defaults for any settings that are not set.
144    */
create(ParticipantsSettings settings)145   public static final ParticipantsClient create(ParticipantsSettings settings) throws IOException {
146     return new ParticipantsClient(settings);
147   }
148 
149   /**
150    * Constructs an instance of ParticipantsClient, using the given stub for making calls. This is
151    * for advanced usage - prefer using create(ParticipantsSettings).
152    */
create(ParticipantsStub stub)153   public static final ParticipantsClient create(ParticipantsStub stub) {
154     return new ParticipantsClient(stub);
155   }
156 
157   /**
158    * Constructs an instance of ParticipantsClient, using the given settings. This is protected so
159    * that it is easy to make a subclass, but otherwise, the static factory methods should be
160    * preferred.
161    */
ParticipantsClient(ParticipantsSettings settings)162   protected ParticipantsClient(ParticipantsSettings settings) throws IOException {
163     this.settings = settings;
164     this.stub = ((ParticipantsStubSettings) settings.getStubSettings()).createStub();
165   }
166 
ParticipantsClient(ParticipantsStub stub)167   protected ParticipantsClient(ParticipantsStub stub) {
168     this.settings = null;
169     this.stub = stub;
170   }
171 
getSettings()172   public final ParticipantsSettings getSettings() {
173     return settings;
174   }
175 
getStub()176   public ParticipantsStub getStub() {
177     return stub;
178   }
179 
180   // AUTO-GENERATED DOCUMENTATION AND METHOD.
181   /**
182    * Creates a new participant in a conversation.
183    *
184    * <p>Sample code:
185    *
186    * <pre>{@code
187    * // This snippet has been automatically generated and should be regarded as a code template only.
188    * // It will require modifications to work:
189    * // - It may require correct/in-range values for request initialization.
190    * // - It may require specifying regional endpoints when creating the service client as shown in
191    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
192    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
193    *   ConversationName parent =
194    *       ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]");
195    *   Participant participant = Participant.newBuilder().build();
196    *   Participant response = participantsClient.createParticipant(parent, participant);
197    * }
198    * }</pre>
199    *
200    * @param parent Required. Resource identifier of the conversation adding the participant. Format:
201    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
202    *     ID&gt;`.
203    * @param participant Required. The participant to create.
204    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
205    */
createParticipant(ConversationName parent, Participant participant)206   public final Participant createParticipant(ConversationName parent, Participant participant) {
207     CreateParticipantRequest request =
208         CreateParticipantRequest.newBuilder()
209             .setParent(parent == null ? null : parent.toString())
210             .setParticipant(participant)
211             .build();
212     return createParticipant(request);
213   }
214 
215   // AUTO-GENERATED DOCUMENTATION AND METHOD.
216   /**
217    * Creates a new participant in a conversation.
218    *
219    * <p>Sample code:
220    *
221    * <pre>{@code
222    * // This snippet has been automatically generated and should be regarded as a code template only.
223    * // It will require modifications to work:
224    * // - It may require correct/in-range values for request initialization.
225    * // - It may require specifying regional endpoints when creating the service client as shown in
226    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
227    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
228    *   String parent =
229    *       ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]").toString();
230    *   Participant participant = Participant.newBuilder().build();
231    *   Participant response = participantsClient.createParticipant(parent, participant);
232    * }
233    * }</pre>
234    *
235    * @param parent Required. Resource identifier of the conversation adding the participant. Format:
236    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
237    *     ID&gt;`.
238    * @param participant Required. The participant to create.
239    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
240    */
createParticipant(String parent, Participant participant)241   public final Participant createParticipant(String parent, Participant participant) {
242     CreateParticipantRequest request =
243         CreateParticipantRequest.newBuilder().setParent(parent).setParticipant(participant).build();
244     return createParticipant(request);
245   }
246 
247   // AUTO-GENERATED DOCUMENTATION AND METHOD.
248   /**
249    * Creates a new participant in a conversation.
250    *
251    * <p>Sample code:
252    *
253    * <pre>{@code
254    * // This snippet has been automatically generated and should be regarded as a code template only.
255    * // It will require modifications to work:
256    * // - It may require correct/in-range values for request initialization.
257    * // - It may require specifying regional endpoints when creating the service client as shown in
258    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
259    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
260    *   CreateParticipantRequest request =
261    *       CreateParticipantRequest.newBuilder()
262    *           .setParent(
263    *               ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]")
264    *                   .toString())
265    *           .setParticipant(Participant.newBuilder().build())
266    *           .build();
267    *   Participant response = participantsClient.createParticipant(request);
268    * }
269    * }</pre>
270    *
271    * @param request The request object containing all of the parameters for the API call.
272    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
273    */
createParticipant(CreateParticipantRequest request)274   public final Participant createParticipant(CreateParticipantRequest request) {
275     return createParticipantCallable().call(request);
276   }
277 
278   // AUTO-GENERATED DOCUMENTATION AND METHOD.
279   /**
280    * Creates a new participant in a conversation.
281    *
282    * <p>Sample code:
283    *
284    * <pre>{@code
285    * // This snippet has been automatically generated and should be regarded as a code template only.
286    * // It will require modifications to work:
287    * // - It may require correct/in-range values for request initialization.
288    * // - It may require specifying regional endpoints when creating the service client as shown in
289    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
290    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
291    *   CreateParticipantRequest request =
292    *       CreateParticipantRequest.newBuilder()
293    *           .setParent(
294    *               ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]")
295    *                   .toString())
296    *           .setParticipant(Participant.newBuilder().build())
297    *           .build();
298    *   ApiFuture<Participant> future =
299    *       participantsClient.createParticipantCallable().futureCall(request);
300    *   // Do something.
301    *   Participant response = future.get();
302    * }
303    * }</pre>
304    */
createParticipantCallable()305   public final UnaryCallable<CreateParticipantRequest, Participant> createParticipantCallable() {
306     return stub.createParticipantCallable();
307   }
308 
309   // AUTO-GENERATED DOCUMENTATION AND METHOD.
310   /**
311    * Retrieves a conversation participant.
312    *
313    * <p>Sample code:
314    *
315    * <pre>{@code
316    * // This snippet has been automatically generated and should be regarded as a code template only.
317    * // It will require modifications to work:
318    * // - It may require correct/in-range values for request initialization.
319    * // - It may require specifying regional endpoints when creating the service client as shown in
320    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
321    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
322    *   ParticipantName name =
323    *       ParticipantName.ofProjectConversationParticipantName(
324    *           "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]");
325    *   Participant response = participantsClient.getParticipant(name);
326    * }
327    * }</pre>
328    *
329    * @param name Required. The name of the participant. Format: `projects/&lt;Project
330    *     ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
331    *     ID&gt;/participants/&lt;Participant ID&gt;`.
332    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
333    */
getParticipant(ParticipantName name)334   public final Participant getParticipant(ParticipantName name) {
335     GetParticipantRequest request =
336         GetParticipantRequest.newBuilder().setName(name == null ? null : name.toString()).build();
337     return getParticipant(request);
338   }
339 
340   // AUTO-GENERATED DOCUMENTATION AND METHOD.
341   /**
342    * Retrieves a conversation participant.
343    *
344    * <p>Sample code:
345    *
346    * <pre>{@code
347    * // This snippet has been automatically generated and should be regarded as a code template only.
348    * // It will require modifications to work:
349    * // - It may require correct/in-range values for request initialization.
350    * // - It may require specifying regional endpoints when creating the service client as shown in
351    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
352    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
353    *   String name =
354    *       ParticipantName.ofProjectConversationParticipantName(
355    *               "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
356    *           .toString();
357    *   Participant response = participantsClient.getParticipant(name);
358    * }
359    * }</pre>
360    *
361    * @param name Required. The name of the participant. Format: `projects/&lt;Project
362    *     ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
363    *     ID&gt;/participants/&lt;Participant ID&gt;`.
364    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
365    */
getParticipant(String name)366   public final Participant getParticipant(String name) {
367     GetParticipantRequest request = GetParticipantRequest.newBuilder().setName(name).build();
368     return getParticipant(request);
369   }
370 
371   // AUTO-GENERATED DOCUMENTATION AND METHOD.
372   /**
373    * Retrieves a conversation participant.
374    *
375    * <p>Sample code:
376    *
377    * <pre>{@code
378    * // This snippet has been automatically generated and should be regarded as a code template only.
379    * // It will require modifications to work:
380    * // - It may require correct/in-range values for request initialization.
381    * // - It may require specifying regional endpoints when creating the service client as shown in
382    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
383    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
384    *   GetParticipantRequest request =
385    *       GetParticipantRequest.newBuilder()
386    *           .setName(
387    *               ParticipantName.ofProjectConversationParticipantName(
388    *                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
389    *                   .toString())
390    *           .build();
391    *   Participant response = participantsClient.getParticipant(request);
392    * }
393    * }</pre>
394    *
395    * @param request The request object containing all of the parameters for the API call.
396    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
397    */
getParticipant(GetParticipantRequest request)398   public final Participant getParticipant(GetParticipantRequest request) {
399     return getParticipantCallable().call(request);
400   }
401 
402   // AUTO-GENERATED DOCUMENTATION AND METHOD.
403   /**
404    * Retrieves a conversation participant.
405    *
406    * <p>Sample code:
407    *
408    * <pre>{@code
409    * // This snippet has been automatically generated and should be regarded as a code template only.
410    * // It will require modifications to work:
411    * // - It may require correct/in-range values for request initialization.
412    * // - It may require specifying regional endpoints when creating the service client as shown in
413    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
414    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
415    *   GetParticipantRequest request =
416    *       GetParticipantRequest.newBuilder()
417    *           .setName(
418    *               ParticipantName.ofProjectConversationParticipantName(
419    *                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
420    *                   .toString())
421    *           .build();
422    *   ApiFuture<Participant> future =
423    *       participantsClient.getParticipantCallable().futureCall(request);
424    *   // Do something.
425    *   Participant response = future.get();
426    * }
427    * }</pre>
428    */
getParticipantCallable()429   public final UnaryCallable<GetParticipantRequest, Participant> getParticipantCallable() {
430     return stub.getParticipantCallable();
431   }
432 
433   // AUTO-GENERATED DOCUMENTATION AND METHOD.
434   /**
435    * Returns the list of all participants in the specified conversation.
436    *
437    * <p>Sample code:
438    *
439    * <pre>{@code
440    * // This snippet has been automatically generated and should be regarded as a code template only.
441    * // It will require modifications to work:
442    * // - It may require correct/in-range values for request initialization.
443    * // - It may require specifying regional endpoints when creating the service client as shown in
444    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
445    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
446    *   ConversationName parent =
447    *       ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]");
448    *   for (Participant element : participantsClient.listParticipants(parent).iterateAll()) {
449    *     // doThingsWith(element);
450    *   }
451    * }
452    * }</pre>
453    *
454    * @param parent Required. The conversation to list all participants from. Format:
455    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
456    *     ID&gt;`.
457    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
458    */
listParticipants(ConversationName parent)459   public final ListParticipantsPagedResponse listParticipants(ConversationName parent) {
460     ListParticipantsRequest request =
461         ListParticipantsRequest.newBuilder()
462             .setParent(parent == null ? null : parent.toString())
463             .build();
464     return listParticipants(request);
465   }
466 
467   // AUTO-GENERATED DOCUMENTATION AND METHOD.
468   /**
469    * Returns the list of all participants in the specified conversation.
470    *
471    * <p>Sample code:
472    *
473    * <pre>{@code
474    * // This snippet has been automatically generated and should be regarded as a code template only.
475    * // It will require modifications to work:
476    * // - It may require correct/in-range values for request initialization.
477    * // - It may require specifying regional endpoints when creating the service client as shown in
478    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
479    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
480    *   String parent =
481    *       ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]").toString();
482    *   for (Participant element : participantsClient.listParticipants(parent).iterateAll()) {
483    *     // doThingsWith(element);
484    *   }
485    * }
486    * }</pre>
487    *
488    * @param parent Required. The conversation to list all participants from. Format:
489    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
490    *     ID&gt;`.
491    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
492    */
listParticipants(String parent)493   public final ListParticipantsPagedResponse listParticipants(String parent) {
494     ListParticipantsRequest request =
495         ListParticipantsRequest.newBuilder().setParent(parent).build();
496     return listParticipants(request);
497   }
498 
499   // AUTO-GENERATED DOCUMENTATION AND METHOD.
500   /**
501    * Returns the list of all participants in the specified conversation.
502    *
503    * <p>Sample code:
504    *
505    * <pre>{@code
506    * // This snippet has been automatically generated and should be regarded as a code template only.
507    * // It will require modifications to work:
508    * // - It may require correct/in-range values for request initialization.
509    * // - It may require specifying regional endpoints when creating the service client as shown in
510    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
511    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
512    *   ListParticipantsRequest request =
513    *       ListParticipantsRequest.newBuilder()
514    *           .setParent(
515    *               ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]")
516    *                   .toString())
517    *           .setPageSize(883849137)
518    *           .setPageToken("pageToken873572522")
519    *           .build();
520    *   for (Participant element : participantsClient.listParticipants(request).iterateAll()) {
521    *     // doThingsWith(element);
522    *   }
523    * }
524    * }</pre>
525    *
526    * @param request The request object containing all of the parameters for the API call.
527    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
528    */
listParticipants(ListParticipantsRequest request)529   public final ListParticipantsPagedResponse listParticipants(ListParticipantsRequest request) {
530     return listParticipantsPagedCallable().call(request);
531   }
532 
533   // AUTO-GENERATED DOCUMENTATION AND METHOD.
534   /**
535    * Returns the list of all participants in the specified conversation.
536    *
537    * <p>Sample code:
538    *
539    * <pre>{@code
540    * // This snippet has been automatically generated and should be regarded as a code template only.
541    * // It will require modifications to work:
542    * // - It may require correct/in-range values for request initialization.
543    * // - It may require specifying regional endpoints when creating the service client as shown in
544    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
545    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
546    *   ListParticipantsRequest request =
547    *       ListParticipantsRequest.newBuilder()
548    *           .setParent(
549    *               ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]")
550    *                   .toString())
551    *           .setPageSize(883849137)
552    *           .setPageToken("pageToken873572522")
553    *           .build();
554    *   ApiFuture<Participant> future =
555    *       participantsClient.listParticipantsPagedCallable().futureCall(request);
556    *   // Do something.
557    *   for (Participant element : future.get().iterateAll()) {
558    *     // doThingsWith(element);
559    *   }
560    * }
561    * }</pre>
562    */
563   public final UnaryCallable<ListParticipantsRequest, ListParticipantsPagedResponse>
listParticipantsPagedCallable()564       listParticipantsPagedCallable() {
565     return stub.listParticipantsPagedCallable();
566   }
567 
568   // AUTO-GENERATED DOCUMENTATION AND METHOD.
569   /**
570    * Returns the list of all participants in the specified conversation.
571    *
572    * <p>Sample code:
573    *
574    * <pre>{@code
575    * // This snippet has been automatically generated and should be regarded as a code template only.
576    * // It will require modifications to work:
577    * // - It may require correct/in-range values for request initialization.
578    * // - It may require specifying regional endpoints when creating the service client as shown in
579    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
580    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
581    *   ListParticipantsRequest request =
582    *       ListParticipantsRequest.newBuilder()
583    *           .setParent(
584    *               ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]")
585    *                   .toString())
586    *           .setPageSize(883849137)
587    *           .setPageToken("pageToken873572522")
588    *           .build();
589    *   while (true) {
590    *     ListParticipantsResponse response =
591    *         participantsClient.listParticipantsCallable().call(request);
592    *     for (Participant element : response.getParticipantsList()) {
593    *       // doThingsWith(element);
594    *     }
595    *     String nextPageToken = response.getNextPageToken();
596    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
597    *       request = request.toBuilder().setPageToken(nextPageToken).build();
598    *     } else {
599    *       break;
600    *     }
601    *   }
602    * }
603    * }</pre>
604    */
605   public final UnaryCallable<ListParticipantsRequest, ListParticipantsResponse>
listParticipantsCallable()606       listParticipantsCallable() {
607     return stub.listParticipantsCallable();
608   }
609 
610   // AUTO-GENERATED DOCUMENTATION AND METHOD.
611   /**
612    * Updates the specified participant.
613    *
614    * <p>Sample code:
615    *
616    * <pre>{@code
617    * // This snippet has been automatically generated and should be regarded as a code template only.
618    * // It will require modifications to work:
619    * // - It may require correct/in-range values for request initialization.
620    * // - It may require specifying regional endpoints when creating the service client as shown in
621    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
622    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
623    *   Participant participant = Participant.newBuilder().build();
624    *   FieldMask updateMask = FieldMask.newBuilder().build();
625    *   Participant response = participantsClient.updateParticipant(participant, updateMask);
626    * }
627    * }</pre>
628    *
629    * @param participant Required. The participant to update.
630    * @param updateMask Required. The mask to specify which fields to update.
631    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
632    */
updateParticipant(Participant participant, FieldMask updateMask)633   public final Participant updateParticipant(Participant participant, FieldMask updateMask) {
634     UpdateParticipantRequest request =
635         UpdateParticipantRequest.newBuilder()
636             .setParticipant(participant)
637             .setUpdateMask(updateMask)
638             .build();
639     return updateParticipant(request);
640   }
641 
642   // AUTO-GENERATED DOCUMENTATION AND METHOD.
643   /**
644    * Updates the specified participant.
645    *
646    * <p>Sample code:
647    *
648    * <pre>{@code
649    * // This snippet has been automatically generated and should be regarded as a code template only.
650    * // It will require modifications to work:
651    * // - It may require correct/in-range values for request initialization.
652    * // - It may require specifying regional endpoints when creating the service client as shown in
653    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
654    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
655    *   UpdateParticipantRequest request =
656    *       UpdateParticipantRequest.newBuilder()
657    *           .setParticipant(Participant.newBuilder().build())
658    *           .setUpdateMask(FieldMask.newBuilder().build())
659    *           .build();
660    *   Participant response = participantsClient.updateParticipant(request);
661    * }
662    * }</pre>
663    *
664    * @param request The request object containing all of the parameters for the API call.
665    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
666    */
updateParticipant(UpdateParticipantRequest request)667   public final Participant updateParticipant(UpdateParticipantRequest request) {
668     return updateParticipantCallable().call(request);
669   }
670 
671   // AUTO-GENERATED DOCUMENTATION AND METHOD.
672   /**
673    * Updates the specified participant.
674    *
675    * <p>Sample code:
676    *
677    * <pre>{@code
678    * // This snippet has been automatically generated and should be regarded as a code template only.
679    * // It will require modifications to work:
680    * // - It may require correct/in-range values for request initialization.
681    * // - It may require specifying regional endpoints when creating the service client as shown in
682    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
683    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
684    *   UpdateParticipantRequest request =
685    *       UpdateParticipantRequest.newBuilder()
686    *           .setParticipant(Participant.newBuilder().build())
687    *           .setUpdateMask(FieldMask.newBuilder().build())
688    *           .build();
689    *   ApiFuture<Participant> future =
690    *       participantsClient.updateParticipantCallable().futureCall(request);
691    *   // Do something.
692    *   Participant response = future.get();
693    * }
694    * }</pre>
695    */
updateParticipantCallable()696   public final UnaryCallable<UpdateParticipantRequest, Participant> updateParticipantCallable() {
697     return stub.updateParticipantCallable();
698   }
699 
700   // AUTO-GENERATED DOCUMENTATION AND METHOD.
701   /**
702    * Adds a text (chat, for example), or audio (phone recording, for example) message from a
703    * participant into the conversation.
704    *
705    * <p>Note: Always use agent versions for production traffic sent to virtual agents. See [Versions
706    * and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
707    *
708    * <p>Sample code:
709    *
710    * <pre>{@code
711    * // This snippet has been automatically generated and should be regarded as a code template only.
712    * // It will require modifications to work:
713    * // - It may require correct/in-range values for request initialization.
714    * // - It may require specifying regional endpoints when creating the service client as shown in
715    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
716    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
717    *   ParticipantName participant =
718    *       ParticipantName.ofProjectConversationParticipantName(
719    *           "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]");
720    *   EventInput eventInput = EventInput.newBuilder().build();
721    *   AnalyzeContentResponse response = participantsClient.analyzeContent(participant, eventInput);
722    * }
723    * }</pre>
724    *
725    * @param participant Required. The name of the participant this text comes from. Format:
726    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
727    *     ID&gt;/participants/&lt;Participant ID&gt;`.
728    * @param eventInput An input event to send to Dialogflow.
729    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
730    */
analyzeContent( ParticipantName participant, EventInput eventInput)731   public final AnalyzeContentResponse analyzeContent(
732       ParticipantName participant, EventInput eventInput) {
733     AnalyzeContentRequest request =
734         AnalyzeContentRequest.newBuilder()
735             .setParticipant(participant == null ? null : participant.toString())
736             .setEventInput(eventInput)
737             .build();
738     return analyzeContent(request);
739   }
740 
741   // AUTO-GENERATED DOCUMENTATION AND METHOD.
742   /**
743    * Adds a text (chat, for example), or audio (phone recording, for example) message from a
744    * participant into the conversation.
745    *
746    * <p>Note: Always use agent versions for production traffic sent to virtual agents. See [Versions
747    * and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
748    *
749    * <p>Sample code:
750    *
751    * <pre>{@code
752    * // This snippet has been automatically generated and should be regarded as a code template only.
753    * // It will require modifications to work:
754    * // - It may require correct/in-range values for request initialization.
755    * // - It may require specifying regional endpoints when creating the service client as shown in
756    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
757    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
758    *   ParticipantName participant =
759    *       ParticipantName.ofProjectConversationParticipantName(
760    *           "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]");
761    *   TextInput textInput = TextInput.newBuilder().build();
762    *   AnalyzeContentResponse response = participantsClient.analyzeContent(participant, textInput);
763    * }
764    * }</pre>
765    *
766    * @param participant Required. The name of the participant this text comes from. Format:
767    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
768    *     ID&gt;/participants/&lt;Participant ID&gt;`.
769    * @param textInput The natural language text to be processed.
770    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
771    */
analyzeContent( ParticipantName participant, TextInput textInput)772   public final AnalyzeContentResponse analyzeContent(
773       ParticipantName participant, TextInput textInput) {
774     AnalyzeContentRequest request =
775         AnalyzeContentRequest.newBuilder()
776             .setParticipant(participant == null ? null : participant.toString())
777             .setTextInput(textInput)
778             .build();
779     return analyzeContent(request);
780   }
781 
782   // AUTO-GENERATED DOCUMENTATION AND METHOD.
783   /**
784    * Adds a text (chat, for example), or audio (phone recording, for example) message from a
785    * participant into the conversation.
786    *
787    * <p>Note: Always use agent versions for production traffic sent to virtual agents. See [Versions
788    * and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
789    *
790    * <p>Sample code:
791    *
792    * <pre>{@code
793    * // This snippet has been automatically generated and should be regarded as a code template only.
794    * // It will require modifications to work:
795    * // - It may require correct/in-range values for request initialization.
796    * // - It may require specifying regional endpoints when creating the service client as shown in
797    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
798    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
799    *   String participant =
800    *       ParticipantName.ofProjectConversationParticipantName(
801    *               "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
802    *           .toString();
803    *   EventInput eventInput = EventInput.newBuilder().build();
804    *   AnalyzeContentResponse response = participantsClient.analyzeContent(participant, eventInput);
805    * }
806    * }</pre>
807    *
808    * @param participant Required. The name of the participant this text comes from. Format:
809    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
810    *     ID&gt;/participants/&lt;Participant ID&gt;`.
811    * @param eventInput An input event to send to Dialogflow.
812    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
813    */
analyzeContent(String participant, EventInput eventInput)814   public final AnalyzeContentResponse analyzeContent(String participant, EventInput eventInput) {
815     AnalyzeContentRequest request =
816         AnalyzeContentRequest.newBuilder()
817             .setParticipant(participant)
818             .setEventInput(eventInput)
819             .build();
820     return analyzeContent(request);
821   }
822 
823   // AUTO-GENERATED DOCUMENTATION AND METHOD.
824   /**
825    * Adds a text (chat, for example), or audio (phone recording, for example) message from a
826    * participant into the conversation.
827    *
828    * <p>Note: Always use agent versions for production traffic sent to virtual agents. See [Versions
829    * and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
830    *
831    * <p>Sample code:
832    *
833    * <pre>{@code
834    * // This snippet has been automatically generated and should be regarded as a code template only.
835    * // It will require modifications to work:
836    * // - It may require correct/in-range values for request initialization.
837    * // - It may require specifying regional endpoints when creating the service client as shown in
838    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
839    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
840    *   String participant =
841    *       ParticipantName.ofProjectConversationParticipantName(
842    *               "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
843    *           .toString();
844    *   TextInput textInput = TextInput.newBuilder().build();
845    *   AnalyzeContentResponse response = participantsClient.analyzeContent(participant, textInput);
846    * }
847    * }</pre>
848    *
849    * @param participant Required. The name of the participant this text comes from. Format:
850    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
851    *     ID&gt;/participants/&lt;Participant ID&gt;`.
852    * @param textInput The natural language text to be processed.
853    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
854    */
analyzeContent(String participant, TextInput textInput)855   public final AnalyzeContentResponse analyzeContent(String participant, TextInput textInput) {
856     AnalyzeContentRequest request =
857         AnalyzeContentRequest.newBuilder()
858             .setParticipant(participant)
859             .setTextInput(textInput)
860             .build();
861     return analyzeContent(request);
862   }
863 
864   // AUTO-GENERATED DOCUMENTATION AND METHOD.
865   /**
866    * Adds a text (chat, for example), or audio (phone recording, for example) message from a
867    * participant into the conversation.
868    *
869    * <p>Note: Always use agent versions for production traffic sent to virtual agents. See [Versions
870    * and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
871    *
872    * <p>Sample code:
873    *
874    * <pre>{@code
875    * // This snippet has been automatically generated and should be regarded as a code template only.
876    * // It will require modifications to work:
877    * // - It may require correct/in-range values for request initialization.
878    * // - It may require specifying regional endpoints when creating the service client as shown in
879    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
880    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
881    *   AnalyzeContentRequest request =
882    *       AnalyzeContentRequest.newBuilder()
883    *           .setParticipant(
884    *               ParticipantName.ofProjectConversationParticipantName(
885    *                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
886    *                   .toString())
887    *           .setReplyAudioConfig(OutputAudioConfig.newBuilder().build())
888    *           .setQueryParams(QueryParameters.newBuilder().build())
889    *           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
890    *           .setCxParameters(Struct.newBuilder().build())
891    *           .setRequestId("requestId693933066")
892    *           .build();
893    *   AnalyzeContentResponse response = participantsClient.analyzeContent(request);
894    * }
895    * }</pre>
896    *
897    * @param request The request object containing all of the parameters for the API call.
898    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
899    */
analyzeContent(AnalyzeContentRequest request)900   public final AnalyzeContentResponse analyzeContent(AnalyzeContentRequest request) {
901     return analyzeContentCallable().call(request);
902   }
903 
904   // AUTO-GENERATED DOCUMENTATION AND METHOD.
905   /**
906    * Adds a text (chat, for example), or audio (phone recording, for example) message from a
907    * participant into the conversation.
908    *
909    * <p>Note: Always use agent versions for production traffic sent to virtual agents. See [Versions
910    * and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
911    *
912    * <p>Sample code:
913    *
914    * <pre>{@code
915    * // This snippet has been automatically generated and should be regarded as a code template only.
916    * // It will require modifications to work:
917    * // - It may require correct/in-range values for request initialization.
918    * // - It may require specifying regional endpoints when creating the service client as shown in
919    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
920    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
921    *   AnalyzeContentRequest request =
922    *       AnalyzeContentRequest.newBuilder()
923    *           .setParticipant(
924    *               ParticipantName.ofProjectConversationParticipantName(
925    *                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
926    *                   .toString())
927    *           .setReplyAudioConfig(OutputAudioConfig.newBuilder().build())
928    *           .setQueryParams(QueryParameters.newBuilder().build())
929    *           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
930    *           .setCxParameters(Struct.newBuilder().build())
931    *           .setRequestId("requestId693933066")
932    *           .build();
933    *   ApiFuture<AnalyzeContentResponse> future =
934    *       participantsClient.analyzeContentCallable().futureCall(request);
935    *   // Do something.
936    *   AnalyzeContentResponse response = future.get();
937    * }
938    * }</pre>
939    */
940   public final UnaryCallable<AnalyzeContentRequest, AnalyzeContentResponse>
analyzeContentCallable()941       analyzeContentCallable() {
942     return stub.analyzeContentCallable();
943   }
944 
945   // AUTO-GENERATED DOCUMENTATION AND METHOD.
946   /**
947    * Adds a text (chat, for example), or audio (phone recording, for example) message from a
948    * participant into the conversation. Note: This method is only available through the gRPC API
949    * (not REST).
950    *
951    * <p>The top-level message sent to the client by the server is `StreamingAnalyzeContentResponse`.
952    * Multiple response messages can be returned in order. The first one or more messages contain the
953    * `recognition_result` field. Each result represents a more complete transcript of what the user
954    * said. The next message contains the `reply_text` field and potentially the `reply_audio` field.
955    * The message can also contain the `automated_agent_reply` field.
956    *
957    * <p>Note: Always use agent versions for production traffic sent to virtual agents. See [Versions
958    * and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
959    *
960    * <p>Sample code:
961    *
962    * <pre>{@code
963    * // This snippet has been automatically generated and should be regarded as a code template only.
964    * // It will require modifications to work:
965    * // - It may require correct/in-range values for request initialization.
966    * // - It may require specifying regional endpoints when creating the service client as shown in
967    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
968    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
969    *   BidiStream<StreamingAnalyzeContentRequest, StreamingAnalyzeContentResponse> bidiStream =
970    *       participantsClient.streamingAnalyzeContentCallable().call();
971    *   StreamingAnalyzeContentRequest request =
972    *       StreamingAnalyzeContentRequest.newBuilder()
973    *           .setParticipant(
974    *               ParticipantName.ofProjectConversationParticipantName(
975    *                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
976    *                   .toString())
977    *           .setReplyAudioConfig(OutputAudioConfig.newBuilder().build())
978    *           .setQueryParams(QueryParameters.newBuilder().build())
979    *           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
980    *           .setCxParameters(Struct.newBuilder().build())
981    *           .setEnablePartialAutomatedAgentReply(true)
982    *           .setEnableDebuggingInfo(true)
983    *           .build();
984    *   bidiStream.send(request);
985    *   for (StreamingAnalyzeContentResponse response : bidiStream) {
986    *     // Do something when a response is received.
987    *   }
988    * }
989    * }</pre>
990    */
991   public final BidiStreamingCallable<
992           StreamingAnalyzeContentRequest, StreamingAnalyzeContentResponse>
streamingAnalyzeContentCallable()993       streamingAnalyzeContentCallable() {
994     return stub.streamingAnalyzeContentCallable();
995   }
996 
997   // AUTO-GENERATED DOCUMENTATION AND METHOD.
998   /**
999    * Gets suggested articles for a participant based on specific historical messages.
1000    *
1001    * <p>Sample code:
1002    *
1003    * <pre>{@code
1004    * // This snippet has been automatically generated and should be regarded as a code template only.
1005    * // It will require modifications to work:
1006    * // - It may require correct/in-range values for request initialization.
1007    * // - It may require specifying regional endpoints when creating the service client as shown in
1008    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1009    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1010    *   ParticipantName parent =
1011    *       ParticipantName.ofProjectConversationParticipantName(
1012    *           "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]");
1013    *   SuggestArticlesResponse response = participantsClient.suggestArticles(parent);
1014    * }
1015    * }</pre>
1016    *
1017    * @param parent Required. The name of the participant to fetch suggestion for. Format:
1018    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
1019    *     ID&gt;/participants/&lt;Participant ID&gt;`.
1020    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1021    */
suggestArticles(ParticipantName parent)1022   public final SuggestArticlesResponse suggestArticles(ParticipantName parent) {
1023     SuggestArticlesRequest request =
1024         SuggestArticlesRequest.newBuilder()
1025             .setParent(parent == null ? null : parent.toString())
1026             .build();
1027     return suggestArticles(request);
1028   }
1029 
1030   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1031   /**
1032    * Gets suggested articles for a participant based on specific historical messages.
1033    *
1034    * <p>Sample code:
1035    *
1036    * <pre>{@code
1037    * // This snippet has been automatically generated and should be regarded as a code template only.
1038    * // It will require modifications to work:
1039    * // - It may require correct/in-range values for request initialization.
1040    * // - It may require specifying regional endpoints when creating the service client as shown in
1041    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1042    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1043    *   String parent =
1044    *       ParticipantName.ofProjectConversationParticipantName(
1045    *               "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
1046    *           .toString();
1047    *   SuggestArticlesResponse response = participantsClient.suggestArticles(parent);
1048    * }
1049    * }</pre>
1050    *
1051    * @param parent Required. The name of the participant to fetch suggestion for. Format:
1052    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
1053    *     ID&gt;/participants/&lt;Participant ID&gt;`.
1054    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1055    */
suggestArticles(String parent)1056   public final SuggestArticlesResponse suggestArticles(String parent) {
1057     SuggestArticlesRequest request = SuggestArticlesRequest.newBuilder().setParent(parent).build();
1058     return suggestArticles(request);
1059   }
1060 
1061   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1062   /**
1063    * Gets suggested articles for a participant based on specific historical messages.
1064    *
1065    * <p>Sample code:
1066    *
1067    * <pre>{@code
1068    * // This snippet has been automatically generated and should be regarded as a code template only.
1069    * // It will require modifications to work:
1070    * // - It may require correct/in-range values for request initialization.
1071    * // - It may require specifying regional endpoints when creating the service client as shown in
1072    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1073    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1074    *   SuggestArticlesRequest request =
1075    *       SuggestArticlesRequest.newBuilder()
1076    *           .setParent(
1077    *               ParticipantName.ofProjectConversationParticipantName(
1078    *                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
1079    *                   .toString())
1080    *           .setLatestMessage(
1081    *               MessageName.ofProjectConversationMessageName(
1082    *                       "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
1083    *                   .toString())
1084    *           .setContextSize(1116903569)
1085    *           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
1086    *           .build();
1087    *   SuggestArticlesResponse response = participantsClient.suggestArticles(request);
1088    * }
1089    * }</pre>
1090    *
1091    * @param request The request object containing all of the parameters for the API call.
1092    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1093    */
suggestArticles(SuggestArticlesRequest request)1094   public final SuggestArticlesResponse suggestArticles(SuggestArticlesRequest request) {
1095     return suggestArticlesCallable().call(request);
1096   }
1097 
1098   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1099   /**
1100    * Gets suggested articles for a participant based on specific historical messages.
1101    *
1102    * <p>Sample code:
1103    *
1104    * <pre>{@code
1105    * // This snippet has been automatically generated and should be regarded as a code template only.
1106    * // It will require modifications to work:
1107    * // - It may require correct/in-range values for request initialization.
1108    * // - It may require specifying regional endpoints when creating the service client as shown in
1109    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1110    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1111    *   SuggestArticlesRequest request =
1112    *       SuggestArticlesRequest.newBuilder()
1113    *           .setParent(
1114    *               ParticipantName.ofProjectConversationParticipantName(
1115    *                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
1116    *                   .toString())
1117    *           .setLatestMessage(
1118    *               MessageName.ofProjectConversationMessageName(
1119    *                       "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
1120    *                   .toString())
1121    *           .setContextSize(1116903569)
1122    *           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
1123    *           .build();
1124    *   ApiFuture<SuggestArticlesResponse> future =
1125    *       participantsClient.suggestArticlesCallable().futureCall(request);
1126    *   // Do something.
1127    *   SuggestArticlesResponse response = future.get();
1128    * }
1129    * }</pre>
1130    */
1131   public final UnaryCallable<SuggestArticlesRequest, SuggestArticlesResponse>
suggestArticlesCallable()1132       suggestArticlesCallable() {
1133     return stub.suggestArticlesCallable();
1134   }
1135 
1136   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1137   /**
1138    * Gets suggested faq answers for a participant based on specific historical messages.
1139    *
1140    * <p>Sample code:
1141    *
1142    * <pre>{@code
1143    * // This snippet has been automatically generated and should be regarded as a code template only.
1144    * // It will require modifications to work:
1145    * // - It may require correct/in-range values for request initialization.
1146    * // - It may require specifying regional endpoints when creating the service client as shown in
1147    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1148    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1149    *   ParticipantName parent =
1150    *       ParticipantName.ofProjectConversationParticipantName(
1151    *           "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]");
1152    *   SuggestFaqAnswersResponse response = participantsClient.suggestFaqAnswers(parent);
1153    * }
1154    * }</pre>
1155    *
1156    * @param parent Required. The name of the participant to fetch suggestion for. Format:
1157    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
1158    *     ID&gt;/participants/&lt;Participant ID&gt;`.
1159    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1160    */
suggestFaqAnswers(ParticipantName parent)1161   public final SuggestFaqAnswersResponse suggestFaqAnswers(ParticipantName parent) {
1162     SuggestFaqAnswersRequest request =
1163         SuggestFaqAnswersRequest.newBuilder()
1164             .setParent(parent == null ? null : parent.toString())
1165             .build();
1166     return suggestFaqAnswers(request);
1167   }
1168 
1169   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1170   /**
1171    * Gets suggested faq answers for a participant based on specific historical messages.
1172    *
1173    * <p>Sample code:
1174    *
1175    * <pre>{@code
1176    * // This snippet has been automatically generated and should be regarded as a code template only.
1177    * // It will require modifications to work:
1178    * // - It may require correct/in-range values for request initialization.
1179    * // - It may require specifying regional endpoints when creating the service client as shown in
1180    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1181    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1182    *   String parent =
1183    *       ParticipantName.ofProjectConversationParticipantName(
1184    *               "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
1185    *           .toString();
1186    *   SuggestFaqAnswersResponse response = participantsClient.suggestFaqAnswers(parent);
1187    * }
1188    * }</pre>
1189    *
1190    * @param parent Required. The name of the participant to fetch suggestion for. Format:
1191    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
1192    *     ID&gt;/participants/&lt;Participant ID&gt;`.
1193    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1194    */
suggestFaqAnswers(String parent)1195   public final SuggestFaqAnswersResponse suggestFaqAnswers(String parent) {
1196     SuggestFaqAnswersRequest request =
1197         SuggestFaqAnswersRequest.newBuilder().setParent(parent).build();
1198     return suggestFaqAnswers(request);
1199   }
1200 
1201   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1202   /**
1203    * Gets suggested faq answers for a participant based on specific historical messages.
1204    *
1205    * <p>Sample code:
1206    *
1207    * <pre>{@code
1208    * // This snippet has been automatically generated and should be regarded as a code template only.
1209    * // It will require modifications to work:
1210    * // - It may require correct/in-range values for request initialization.
1211    * // - It may require specifying regional endpoints when creating the service client as shown in
1212    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1213    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1214    *   SuggestFaqAnswersRequest request =
1215    *       SuggestFaqAnswersRequest.newBuilder()
1216    *           .setParent(
1217    *               ParticipantName.ofProjectConversationParticipantName(
1218    *                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
1219    *                   .toString())
1220    *           .setLatestMessage(
1221    *               MessageName.ofProjectConversationMessageName(
1222    *                       "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
1223    *                   .toString())
1224    *           .setContextSize(1116903569)
1225    *           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
1226    *           .build();
1227    *   SuggestFaqAnswersResponse response = participantsClient.suggestFaqAnswers(request);
1228    * }
1229    * }</pre>
1230    *
1231    * @param request The request object containing all of the parameters for the API call.
1232    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1233    */
suggestFaqAnswers(SuggestFaqAnswersRequest request)1234   public final SuggestFaqAnswersResponse suggestFaqAnswers(SuggestFaqAnswersRequest request) {
1235     return suggestFaqAnswersCallable().call(request);
1236   }
1237 
1238   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1239   /**
1240    * Gets suggested faq answers for a participant based on specific historical messages.
1241    *
1242    * <p>Sample code:
1243    *
1244    * <pre>{@code
1245    * // This snippet has been automatically generated and should be regarded as a code template only.
1246    * // It will require modifications to work:
1247    * // - It may require correct/in-range values for request initialization.
1248    * // - It may require specifying regional endpoints when creating the service client as shown in
1249    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1250    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1251    *   SuggestFaqAnswersRequest request =
1252    *       SuggestFaqAnswersRequest.newBuilder()
1253    *           .setParent(
1254    *               ParticipantName.ofProjectConversationParticipantName(
1255    *                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
1256    *                   .toString())
1257    *           .setLatestMessage(
1258    *               MessageName.ofProjectConversationMessageName(
1259    *                       "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
1260    *                   .toString())
1261    *           .setContextSize(1116903569)
1262    *           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
1263    *           .build();
1264    *   ApiFuture<SuggestFaqAnswersResponse> future =
1265    *       participantsClient.suggestFaqAnswersCallable().futureCall(request);
1266    *   // Do something.
1267    *   SuggestFaqAnswersResponse response = future.get();
1268    * }
1269    * }</pre>
1270    */
1271   public final UnaryCallable<SuggestFaqAnswersRequest, SuggestFaqAnswersResponse>
suggestFaqAnswersCallable()1272       suggestFaqAnswersCallable() {
1273     return stub.suggestFaqAnswersCallable();
1274   }
1275 
1276   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1277   /**
1278    * Gets smart replies for a participant based on specific historical messages.
1279    *
1280    * <p>Sample code:
1281    *
1282    * <pre>{@code
1283    * // This snippet has been automatically generated and should be regarded as a code template only.
1284    * // It will require modifications to work:
1285    * // - It may require correct/in-range values for request initialization.
1286    * // - It may require specifying regional endpoints when creating the service client as shown in
1287    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1288    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1289    *   ParticipantName parent =
1290    *       ParticipantName.ofProjectConversationParticipantName(
1291    *           "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]");
1292    *   SuggestSmartRepliesResponse response = participantsClient.suggestSmartReplies(parent);
1293    * }
1294    * }</pre>
1295    *
1296    * @param parent Required. The name of the participant to fetch suggestion for. Format:
1297    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
1298    *     ID&gt;/participants/&lt;Participant ID&gt;`.
1299    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1300    */
suggestSmartReplies(ParticipantName parent)1301   public final SuggestSmartRepliesResponse suggestSmartReplies(ParticipantName parent) {
1302     SuggestSmartRepliesRequest request =
1303         SuggestSmartRepliesRequest.newBuilder()
1304             .setParent(parent == null ? null : parent.toString())
1305             .build();
1306     return suggestSmartReplies(request);
1307   }
1308 
1309   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1310   /**
1311    * Gets smart replies for a participant based on specific historical messages.
1312    *
1313    * <p>Sample code:
1314    *
1315    * <pre>{@code
1316    * // This snippet has been automatically generated and should be regarded as a code template only.
1317    * // It will require modifications to work:
1318    * // - It may require correct/in-range values for request initialization.
1319    * // - It may require specifying regional endpoints when creating the service client as shown in
1320    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1321    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1322    *   String parent =
1323    *       ParticipantName.ofProjectConversationParticipantName(
1324    *               "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
1325    *           .toString();
1326    *   SuggestSmartRepliesResponse response = participantsClient.suggestSmartReplies(parent);
1327    * }
1328    * }</pre>
1329    *
1330    * @param parent Required. The name of the participant to fetch suggestion for. Format:
1331    *     `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/conversations/&lt;Conversation
1332    *     ID&gt;/participants/&lt;Participant ID&gt;`.
1333    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1334    */
suggestSmartReplies(String parent)1335   public final SuggestSmartRepliesResponse suggestSmartReplies(String parent) {
1336     SuggestSmartRepliesRequest request =
1337         SuggestSmartRepliesRequest.newBuilder().setParent(parent).build();
1338     return suggestSmartReplies(request);
1339   }
1340 
1341   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1342   /**
1343    * Gets smart replies for a participant based on specific historical messages.
1344    *
1345    * <p>Sample code:
1346    *
1347    * <pre>{@code
1348    * // This snippet has been automatically generated and should be regarded as a code template only.
1349    * // It will require modifications to work:
1350    * // - It may require correct/in-range values for request initialization.
1351    * // - It may require specifying regional endpoints when creating the service client as shown in
1352    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1353    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1354    *   SuggestSmartRepliesRequest request =
1355    *       SuggestSmartRepliesRequest.newBuilder()
1356    *           .setParent(
1357    *               ParticipantName.ofProjectConversationParticipantName(
1358    *                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
1359    *                   .toString())
1360    *           .setCurrentTextInput(TextInput.newBuilder().build())
1361    *           .setLatestMessage(
1362    *               MessageName.ofProjectConversationMessageName(
1363    *                       "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
1364    *                   .toString())
1365    *           .setContextSize(1116903569)
1366    *           .build();
1367    *   SuggestSmartRepliesResponse response = participantsClient.suggestSmartReplies(request);
1368    * }
1369    * }</pre>
1370    *
1371    * @param request The request object containing all of the parameters for the API call.
1372    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1373    */
suggestSmartReplies(SuggestSmartRepliesRequest request)1374   public final SuggestSmartRepliesResponse suggestSmartReplies(SuggestSmartRepliesRequest request) {
1375     return suggestSmartRepliesCallable().call(request);
1376   }
1377 
1378   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1379   /**
1380    * Gets smart replies for a participant based on specific historical messages.
1381    *
1382    * <p>Sample code:
1383    *
1384    * <pre>{@code
1385    * // This snippet has been automatically generated and should be regarded as a code template only.
1386    * // It will require modifications to work:
1387    * // - It may require correct/in-range values for request initialization.
1388    * // - It may require specifying regional endpoints when creating the service client as shown in
1389    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1390    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1391    *   SuggestSmartRepliesRequest request =
1392    *       SuggestSmartRepliesRequest.newBuilder()
1393    *           .setParent(
1394    *               ParticipantName.ofProjectConversationParticipantName(
1395    *                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
1396    *                   .toString())
1397    *           .setCurrentTextInput(TextInput.newBuilder().build())
1398    *           .setLatestMessage(
1399    *               MessageName.ofProjectConversationMessageName(
1400    *                       "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
1401    *                   .toString())
1402    *           .setContextSize(1116903569)
1403    *           .build();
1404    *   ApiFuture<SuggestSmartRepliesResponse> future =
1405    *       participantsClient.suggestSmartRepliesCallable().futureCall(request);
1406    *   // Do something.
1407    *   SuggestSmartRepliesResponse response = future.get();
1408    * }
1409    * }</pre>
1410    */
1411   public final UnaryCallable<SuggestSmartRepliesRequest, SuggestSmartRepliesResponse>
suggestSmartRepliesCallable()1412       suggestSmartRepliesCallable() {
1413     return stub.suggestSmartRepliesCallable();
1414   }
1415 
1416   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1417   /**
1418    * Lists information about the supported locations for this service.
1419    *
1420    * <p>Sample code:
1421    *
1422    * <pre>{@code
1423    * // This snippet has been automatically generated and should be regarded as a code template only.
1424    * // It will require modifications to work:
1425    * // - It may require correct/in-range values for request initialization.
1426    * // - It may require specifying regional endpoints when creating the service client as shown in
1427    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1428    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1429    *   ListLocationsRequest request =
1430    *       ListLocationsRequest.newBuilder()
1431    *           .setName("name3373707")
1432    *           .setFilter("filter-1274492040")
1433    *           .setPageSize(883849137)
1434    *           .setPageToken("pageToken873572522")
1435    *           .build();
1436    *   for (Location element : participantsClient.listLocations(request).iterateAll()) {
1437    *     // doThingsWith(element);
1438    *   }
1439    * }
1440    * }</pre>
1441    *
1442    * @param request The request object containing all of the parameters for the API call.
1443    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1444    */
listLocations(ListLocationsRequest request)1445   public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
1446     return listLocationsPagedCallable().call(request);
1447   }
1448 
1449   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1450   /**
1451    * Lists information about the supported locations for this service.
1452    *
1453    * <p>Sample code:
1454    *
1455    * <pre>{@code
1456    * // This snippet has been automatically generated and should be regarded as a code template only.
1457    * // It will require modifications to work:
1458    * // - It may require correct/in-range values for request initialization.
1459    * // - It may require specifying regional endpoints when creating the service client as shown in
1460    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1461    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1462    *   ListLocationsRequest request =
1463    *       ListLocationsRequest.newBuilder()
1464    *           .setName("name3373707")
1465    *           .setFilter("filter-1274492040")
1466    *           .setPageSize(883849137)
1467    *           .setPageToken("pageToken873572522")
1468    *           .build();
1469    *   ApiFuture<Location> future =
1470    *       participantsClient.listLocationsPagedCallable().futureCall(request);
1471    *   // Do something.
1472    *   for (Location element : future.get().iterateAll()) {
1473    *     // doThingsWith(element);
1474    *   }
1475    * }
1476    * }</pre>
1477    */
1478   public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable()1479       listLocationsPagedCallable() {
1480     return stub.listLocationsPagedCallable();
1481   }
1482 
1483   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1484   /**
1485    * Lists information about the supported locations for this service.
1486    *
1487    * <p>Sample code:
1488    *
1489    * <pre>{@code
1490    * // This snippet has been automatically generated and should be regarded as a code template only.
1491    * // It will require modifications to work:
1492    * // - It may require correct/in-range values for request initialization.
1493    * // - It may require specifying regional endpoints when creating the service client as shown in
1494    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1495    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1496    *   ListLocationsRequest request =
1497    *       ListLocationsRequest.newBuilder()
1498    *           .setName("name3373707")
1499    *           .setFilter("filter-1274492040")
1500    *           .setPageSize(883849137)
1501    *           .setPageToken("pageToken873572522")
1502    *           .build();
1503    *   while (true) {
1504    *     ListLocationsResponse response = participantsClient.listLocationsCallable().call(request);
1505    *     for (Location element : response.getLocationsList()) {
1506    *       // doThingsWith(element);
1507    *     }
1508    *     String nextPageToken = response.getNextPageToken();
1509    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
1510    *       request = request.toBuilder().setPageToken(nextPageToken).build();
1511    *     } else {
1512    *       break;
1513    *     }
1514    *   }
1515    * }
1516    * }</pre>
1517    */
listLocationsCallable()1518   public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
1519     return stub.listLocationsCallable();
1520   }
1521 
1522   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1523   /**
1524    * Gets information about a location.
1525    *
1526    * <p>Sample code:
1527    *
1528    * <pre>{@code
1529    * // This snippet has been automatically generated and should be regarded as a code template only.
1530    * // It will require modifications to work:
1531    * // - It may require correct/in-range values for request initialization.
1532    * // - It may require specifying regional endpoints when creating the service client as shown in
1533    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1534    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1535    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
1536    *   Location response = participantsClient.getLocation(request);
1537    * }
1538    * }</pre>
1539    *
1540    * @param request The request object containing all of the parameters for the API call.
1541    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1542    */
getLocation(GetLocationRequest request)1543   public final Location getLocation(GetLocationRequest request) {
1544     return getLocationCallable().call(request);
1545   }
1546 
1547   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1548   /**
1549    * Gets information about a location.
1550    *
1551    * <p>Sample code:
1552    *
1553    * <pre>{@code
1554    * // This snippet has been automatically generated and should be regarded as a code template only.
1555    * // It will require modifications to work:
1556    * // - It may require correct/in-range values for request initialization.
1557    * // - It may require specifying regional endpoints when creating the service client as shown in
1558    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1559    * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
1560    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
1561    *   ApiFuture<Location> future = participantsClient.getLocationCallable().futureCall(request);
1562    *   // Do something.
1563    *   Location response = future.get();
1564    * }
1565    * }</pre>
1566    */
getLocationCallable()1567   public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
1568     return stub.getLocationCallable();
1569   }
1570 
1571   @Override
close()1572   public final void close() {
1573     stub.close();
1574   }
1575 
1576   @Override
shutdown()1577   public void shutdown() {
1578     stub.shutdown();
1579   }
1580 
1581   @Override
isShutdown()1582   public boolean isShutdown() {
1583     return stub.isShutdown();
1584   }
1585 
1586   @Override
isTerminated()1587   public boolean isTerminated() {
1588     return stub.isTerminated();
1589   }
1590 
1591   @Override
shutdownNow()1592   public void shutdownNow() {
1593     stub.shutdownNow();
1594   }
1595 
1596   @Override
awaitTermination(long duration, TimeUnit unit)1597   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
1598     return stub.awaitTermination(duration, unit);
1599   }
1600 
1601   public static class ListParticipantsPagedResponse
1602       extends AbstractPagedListResponse<
1603           ListParticipantsRequest,
1604           ListParticipantsResponse,
1605           Participant,
1606           ListParticipantsPage,
1607           ListParticipantsFixedSizeCollection> {
1608 
createAsync( PageContext<ListParticipantsRequest, ListParticipantsResponse, Participant> context, ApiFuture<ListParticipantsResponse> futureResponse)1609     public static ApiFuture<ListParticipantsPagedResponse> createAsync(
1610         PageContext<ListParticipantsRequest, ListParticipantsResponse, Participant> context,
1611         ApiFuture<ListParticipantsResponse> futureResponse) {
1612       ApiFuture<ListParticipantsPage> futurePage =
1613           ListParticipantsPage.createEmptyPage().createPageAsync(context, futureResponse);
1614       return ApiFutures.transform(
1615           futurePage,
1616           input -> new ListParticipantsPagedResponse(input),
1617           MoreExecutors.directExecutor());
1618     }
1619 
ListParticipantsPagedResponse(ListParticipantsPage page)1620     private ListParticipantsPagedResponse(ListParticipantsPage page) {
1621       super(page, ListParticipantsFixedSizeCollection.createEmptyCollection());
1622     }
1623   }
1624 
1625   public static class ListParticipantsPage
1626       extends AbstractPage<
1627           ListParticipantsRequest, ListParticipantsResponse, Participant, ListParticipantsPage> {
1628 
ListParticipantsPage( PageContext<ListParticipantsRequest, ListParticipantsResponse, Participant> context, ListParticipantsResponse response)1629     private ListParticipantsPage(
1630         PageContext<ListParticipantsRequest, ListParticipantsResponse, Participant> context,
1631         ListParticipantsResponse response) {
1632       super(context, response);
1633     }
1634 
createEmptyPage()1635     private static ListParticipantsPage createEmptyPage() {
1636       return new ListParticipantsPage(null, null);
1637     }
1638 
1639     @Override
createPage( PageContext<ListParticipantsRequest, ListParticipantsResponse, Participant> context, ListParticipantsResponse response)1640     protected ListParticipantsPage createPage(
1641         PageContext<ListParticipantsRequest, ListParticipantsResponse, Participant> context,
1642         ListParticipantsResponse response) {
1643       return new ListParticipantsPage(context, response);
1644     }
1645 
1646     @Override
createPageAsync( PageContext<ListParticipantsRequest, ListParticipantsResponse, Participant> context, ApiFuture<ListParticipantsResponse> futureResponse)1647     public ApiFuture<ListParticipantsPage> createPageAsync(
1648         PageContext<ListParticipantsRequest, ListParticipantsResponse, Participant> context,
1649         ApiFuture<ListParticipantsResponse> futureResponse) {
1650       return super.createPageAsync(context, futureResponse);
1651     }
1652   }
1653 
1654   public static class ListParticipantsFixedSizeCollection
1655       extends AbstractFixedSizeCollection<
1656           ListParticipantsRequest,
1657           ListParticipantsResponse,
1658           Participant,
1659           ListParticipantsPage,
1660           ListParticipantsFixedSizeCollection> {
1661 
ListParticipantsFixedSizeCollection( List<ListParticipantsPage> pages, int collectionSize)1662     private ListParticipantsFixedSizeCollection(
1663         List<ListParticipantsPage> pages, int collectionSize) {
1664       super(pages, collectionSize);
1665     }
1666 
createEmptyCollection()1667     private static ListParticipantsFixedSizeCollection createEmptyCollection() {
1668       return new ListParticipantsFixedSizeCollection(null, 0);
1669     }
1670 
1671     @Override
createCollection( List<ListParticipantsPage> pages, int collectionSize)1672     protected ListParticipantsFixedSizeCollection createCollection(
1673         List<ListParticipantsPage> pages, int collectionSize) {
1674       return new ListParticipantsFixedSizeCollection(pages, collectionSize);
1675     }
1676   }
1677 
1678   public static class ListLocationsPagedResponse
1679       extends AbstractPagedListResponse<
1680           ListLocationsRequest,
1681           ListLocationsResponse,
1682           Location,
1683           ListLocationsPage,
1684           ListLocationsFixedSizeCollection> {
1685 
createAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1686     public static ApiFuture<ListLocationsPagedResponse> createAsync(
1687         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1688         ApiFuture<ListLocationsResponse> futureResponse) {
1689       ApiFuture<ListLocationsPage> futurePage =
1690           ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
1691       return ApiFutures.transform(
1692           futurePage,
1693           input -> new ListLocationsPagedResponse(input),
1694           MoreExecutors.directExecutor());
1695     }
1696 
ListLocationsPagedResponse(ListLocationsPage page)1697     private ListLocationsPagedResponse(ListLocationsPage page) {
1698       super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
1699     }
1700   }
1701 
1702   public static class ListLocationsPage
1703       extends AbstractPage<
1704           ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
1705 
ListLocationsPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1706     private ListLocationsPage(
1707         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1708         ListLocationsResponse response) {
1709       super(context, response);
1710     }
1711 
createEmptyPage()1712     private static ListLocationsPage createEmptyPage() {
1713       return new ListLocationsPage(null, null);
1714     }
1715 
1716     @Override
createPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1717     protected ListLocationsPage createPage(
1718         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1719         ListLocationsResponse response) {
1720       return new ListLocationsPage(context, response);
1721     }
1722 
1723     @Override
createPageAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1724     public ApiFuture<ListLocationsPage> createPageAsync(
1725         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1726         ApiFuture<ListLocationsResponse> futureResponse) {
1727       return super.createPageAsync(context, futureResponse);
1728     }
1729   }
1730 
1731   public static class ListLocationsFixedSizeCollection
1732       extends AbstractFixedSizeCollection<
1733           ListLocationsRequest,
1734           ListLocationsResponse,
1735           Location,
1736           ListLocationsPage,
1737           ListLocationsFixedSizeCollection> {
1738 
ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize)1739     private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) {
1740       super(pages, collectionSize);
1741     }
1742 
createEmptyCollection()1743     private static ListLocationsFixedSizeCollection createEmptyCollection() {
1744       return new ListLocationsFixedSizeCollection(null, 0);
1745     }
1746 
1747     @Override
createCollection( List<ListLocationsPage> pages, int collectionSize)1748     protected ListLocationsFixedSizeCollection createCollection(
1749         List<ListLocationsPage> pages, int collectionSize) {
1750       return new ListLocationsFixedSizeCollection(pages, collectionSize);
1751     }
1752   }
1753 }
1754