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