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.httpjson.longrunning.OperationsClient; 24 import com.google.api.gax.longrunning.OperationFuture; 25 import com.google.api.gax.paging.AbstractFixedSizeCollection; 26 import com.google.api.gax.paging.AbstractPage; 27 import com.google.api.gax.paging.AbstractPagedListResponse; 28 import com.google.api.gax.rpc.OperationCallable; 29 import com.google.api.gax.rpc.PageContext; 30 import com.google.api.gax.rpc.UnaryCallable; 31 import com.google.cloud.dialogflow.v2beta1.stub.AgentsStub; 32 import com.google.cloud.dialogflow.v2beta1.stub.AgentsStubSettings; 33 import com.google.cloud.location.GetLocationRequest; 34 import com.google.cloud.location.ListLocationsRequest; 35 import com.google.cloud.location.ListLocationsResponse; 36 import com.google.cloud.location.Location; 37 import com.google.common.util.concurrent.MoreExecutors; 38 import com.google.longrunning.Operation; 39 import com.google.protobuf.Empty; 40 import com.google.protobuf.Struct; 41 import java.io.IOException; 42 import java.util.List; 43 import java.util.concurrent.TimeUnit; 44 import javax.annotation.Generated; 45 46 // AUTO-GENERATED DOCUMENTATION AND CLASS. 47 /** 48 * Service Description: Service for managing [Agents][google.cloud.dialogflow.v2beta1.Agent]. 49 * 50 * <p>This class provides the ability to make remote calls to the backing service through method 51 * calls that map to API methods. Sample code to get started: 52 * 53 * <pre>{@code 54 * // This snippet has been automatically generated and should be regarded as a code template only. 55 * // It will require modifications to work: 56 * // - It may require correct/in-range values for request initialization. 57 * // - It may require specifying regional endpoints when creating the service client as shown in 58 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 59 * try (AgentsClient agentsClient = AgentsClient.create()) { 60 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 61 * Agent response = agentsClient.getAgent(parent); 62 * } 63 * }</pre> 64 * 65 * <p>Note: close() needs to be called on the AgentsClient object to clean up resources such as 66 * threads. In the example above, try-with-resources is used, which automatically calls close(). 67 * 68 * <p>The surface of this class includes several types of Java methods for each of the API's 69 * methods: 70 * 71 * <ol> 72 * <li>A "flattened" method. With this type of method, the fields of the request type have been 73 * converted into function parameters. It may be the case that not all fields are available as 74 * parameters, and not every API method will have a flattened method entry point. 75 * <li>A "request object" method. This type of method only takes one parameter, a request object, 76 * which must be constructed before the call. Not every API method will have a request object 77 * method. 78 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 79 * callable object, which can be used to initiate calls to the service. 80 * </ol> 81 * 82 * <p>See the individual methods for example code. 83 * 84 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 85 * these names, this class includes a format method for each type of name, and additionally a parse 86 * method to extract the individual identifiers contained within names that are returned. 87 * 88 * <p>This class can be customized by passing in a custom instance of AgentsSettings to create(). 89 * For example: 90 * 91 * <p>To customize credentials: 92 * 93 * <pre>{@code 94 * // This snippet has been automatically generated and should be regarded as a code template only. 95 * // It will require modifications to work: 96 * // - It may require correct/in-range values for request initialization. 97 * // - It may require specifying regional endpoints when creating the service client as shown in 98 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 99 * AgentsSettings agentsSettings = 100 * AgentsSettings.newBuilder() 101 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 102 * .build(); 103 * AgentsClient agentsClient = AgentsClient.create(agentsSettings); 104 * }</pre> 105 * 106 * <p>To customize the endpoint: 107 * 108 * <pre>{@code 109 * // This snippet has been automatically generated and should be regarded as a code template only. 110 * // It will require modifications to work: 111 * // - It may require correct/in-range values for request initialization. 112 * // - It may require specifying regional endpoints when creating the service client as shown in 113 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 114 * AgentsSettings agentsSettings = AgentsSettings.newBuilder().setEndpoint(myEndpoint).build(); 115 * AgentsClient agentsClient = AgentsClient.create(agentsSettings); 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 * AgentsSettings agentsSettings = AgentsSettings.newHttpJsonBuilder().build(); 128 * AgentsClient agentsClient = AgentsClient.create(agentsSettings); 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 AgentsClient implements BackgroundResource { 136 private final AgentsSettings settings; 137 private final AgentsStub stub; 138 private final OperationsClient httpJsonOperationsClient; 139 private final com.google.longrunning.OperationsClient operationsClient; 140 141 /** Constructs an instance of AgentsClient with default settings. */ create()142 public static final AgentsClient create() throws IOException { 143 return create(AgentsSettings.newBuilder().build()); 144 } 145 146 /** 147 * Constructs an instance of AgentsClient, using the given settings. The channels are created 148 * based on the settings passed in, or defaults for any settings that are not set. 149 */ create(AgentsSettings settings)150 public static final AgentsClient create(AgentsSettings settings) throws IOException { 151 return new AgentsClient(settings); 152 } 153 154 /** 155 * Constructs an instance of AgentsClient, using the given stub for making calls. This is for 156 * advanced usage - prefer using create(AgentsSettings). 157 */ create(AgentsStub stub)158 public static final AgentsClient create(AgentsStub stub) { 159 return new AgentsClient(stub); 160 } 161 162 /** 163 * Constructs an instance of AgentsClient, using the given settings. This is protected so that it 164 * is easy to make a subclass, but otherwise, the static factory methods should be preferred. 165 */ AgentsClient(AgentsSettings settings)166 protected AgentsClient(AgentsSettings settings) throws IOException { 167 this.settings = settings; 168 this.stub = ((AgentsStubSettings) settings.getStubSettings()).createStub(); 169 this.operationsClient = 170 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 171 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 172 } 173 AgentsClient(AgentsStub stub)174 protected AgentsClient(AgentsStub stub) { 175 this.settings = null; 176 this.stub = stub; 177 this.operationsClient = 178 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 179 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 180 } 181 getSettings()182 public final AgentsSettings getSettings() { 183 return settings; 184 } 185 getStub()186 public AgentsStub getStub() { 187 return stub; 188 } 189 190 /** 191 * Returns the OperationsClient that can be used to query the status of a long-running operation 192 * returned by another API method call. 193 */ getOperationsClient()194 public final com.google.longrunning.OperationsClient getOperationsClient() { 195 return operationsClient; 196 } 197 198 /** 199 * Returns the OperationsClient that can be used to query the status of a long-running operation 200 * returned by another API method call. 201 */ 202 @BetaApi getHttpJsonOperationsClient()203 public final OperationsClient getHttpJsonOperationsClient() { 204 return httpJsonOperationsClient; 205 } 206 207 // AUTO-GENERATED DOCUMENTATION AND METHOD. 208 /** 209 * Retrieves the specified agent. 210 * 211 * <p>Sample code: 212 * 213 * <pre>{@code 214 * // This snippet has been automatically generated and should be regarded as a code template only. 215 * // It will require modifications to work: 216 * // - It may require correct/in-range values for request initialization. 217 * // - It may require specifying regional endpoints when creating the service client as shown in 218 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 219 * try (AgentsClient agentsClient = AgentsClient.create()) { 220 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 221 * Agent response = agentsClient.getAgent(parent); 222 * } 223 * }</pre> 224 * 225 * @param parent Required. The project that the agent to fetch is associated with. Format: 226 * `projects/<Project ID>` or `projects/<Project ID>/locations/<Location 227 * ID>`. 228 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 229 */ getAgent(LocationName parent)230 public final Agent getAgent(LocationName parent) { 231 GetAgentRequest request = 232 GetAgentRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); 233 return getAgent(request); 234 } 235 236 // AUTO-GENERATED DOCUMENTATION AND METHOD. 237 /** 238 * Retrieves the specified agent. 239 * 240 * <p>Sample code: 241 * 242 * <pre>{@code 243 * // This snippet has been automatically generated and should be regarded as a code template only. 244 * // It will require modifications to work: 245 * // - It may require correct/in-range values for request initialization. 246 * // - It may require specifying regional endpoints when creating the service client as shown in 247 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 248 * try (AgentsClient agentsClient = AgentsClient.create()) { 249 * ProjectName parent = ProjectName.of("[PROJECT]"); 250 * Agent response = agentsClient.getAgent(parent); 251 * } 252 * }</pre> 253 * 254 * @param parent Required. The project that the agent to fetch is associated with. Format: 255 * `projects/<Project ID>` or `projects/<Project ID>/locations/<Location 256 * ID>`. 257 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 258 */ getAgent(ProjectName parent)259 public final Agent getAgent(ProjectName parent) { 260 GetAgentRequest request = 261 GetAgentRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); 262 return getAgent(request); 263 } 264 265 // AUTO-GENERATED DOCUMENTATION AND METHOD. 266 /** 267 * Retrieves the specified agent. 268 * 269 * <p>Sample code: 270 * 271 * <pre>{@code 272 * // This snippet has been automatically generated and should be regarded as a code template only. 273 * // It will require modifications to work: 274 * // - It may require correct/in-range values for request initialization. 275 * // - It may require specifying regional endpoints when creating the service client as shown in 276 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 277 * try (AgentsClient agentsClient = AgentsClient.create()) { 278 * String parent = ProjectName.of("[PROJECT]").toString(); 279 * Agent response = agentsClient.getAgent(parent); 280 * } 281 * }</pre> 282 * 283 * @param parent Required. The project that the agent to fetch is associated with. Format: 284 * `projects/<Project ID>` or `projects/<Project ID>/locations/<Location 285 * ID>`. 286 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 287 */ getAgent(String parent)288 public final Agent getAgent(String parent) { 289 GetAgentRequest request = GetAgentRequest.newBuilder().setParent(parent).build(); 290 return getAgent(request); 291 } 292 293 // AUTO-GENERATED DOCUMENTATION AND METHOD. 294 /** 295 * Retrieves the specified agent. 296 * 297 * <p>Sample code: 298 * 299 * <pre>{@code 300 * // This snippet has been automatically generated and should be regarded as a code template only. 301 * // It will require modifications to work: 302 * // - It may require correct/in-range values for request initialization. 303 * // - It may require specifying regional endpoints when creating the service client as shown in 304 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 305 * try (AgentsClient agentsClient = AgentsClient.create()) { 306 * GetAgentRequest request = 307 * GetAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build(); 308 * Agent response = agentsClient.getAgent(request); 309 * } 310 * }</pre> 311 * 312 * @param request The request object containing all of the parameters for the API call. 313 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 314 */ getAgent(GetAgentRequest request)315 public final Agent getAgent(GetAgentRequest request) { 316 return getAgentCallable().call(request); 317 } 318 319 // AUTO-GENERATED DOCUMENTATION AND METHOD. 320 /** 321 * Retrieves the specified agent. 322 * 323 * <p>Sample code: 324 * 325 * <pre>{@code 326 * // This snippet has been automatically generated and should be regarded as a code template only. 327 * // It will require modifications to work: 328 * // - It may require correct/in-range values for request initialization. 329 * // - It may require specifying regional endpoints when creating the service client as shown in 330 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 331 * try (AgentsClient agentsClient = AgentsClient.create()) { 332 * GetAgentRequest request = 333 * GetAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build(); 334 * ApiFuture<Agent> future = agentsClient.getAgentCallable().futureCall(request); 335 * // Do something. 336 * Agent response = future.get(); 337 * } 338 * }</pre> 339 */ getAgentCallable()340 public final UnaryCallable<GetAgentRequest, Agent> getAgentCallable() { 341 return stub.getAgentCallable(); 342 } 343 344 // AUTO-GENERATED DOCUMENTATION AND METHOD. 345 /** 346 * Creates/updates the specified agent. 347 * 348 * <p>Note: You should always train an agent prior to sending it queries. See the [training 349 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 350 * 351 * <p>Sample code: 352 * 353 * <pre>{@code 354 * // This snippet has been automatically generated and should be regarded as a code template only. 355 * // It will require modifications to work: 356 * // - It may require correct/in-range values for request initialization. 357 * // - It may require specifying regional endpoints when creating the service client as shown in 358 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 359 * try (AgentsClient agentsClient = AgentsClient.create()) { 360 * Agent agent = Agent.newBuilder().build(); 361 * Agent response = agentsClient.setAgent(agent); 362 * } 363 * }</pre> 364 * 365 * @param agent Required. The agent to update. 366 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 367 */ setAgent(Agent agent)368 public final Agent setAgent(Agent agent) { 369 SetAgentRequest request = SetAgentRequest.newBuilder().setAgent(agent).build(); 370 return setAgent(request); 371 } 372 373 // AUTO-GENERATED DOCUMENTATION AND METHOD. 374 /** 375 * Creates/updates the specified agent. 376 * 377 * <p>Note: You should always train an agent prior to sending it queries. See the [training 378 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 379 * 380 * <p>Sample code: 381 * 382 * <pre>{@code 383 * // This snippet has been automatically generated and should be regarded as a code template only. 384 * // It will require modifications to work: 385 * // - It may require correct/in-range values for request initialization. 386 * // - It may require specifying regional endpoints when creating the service client as shown in 387 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 388 * try (AgentsClient agentsClient = AgentsClient.create()) { 389 * SetAgentRequest request = 390 * SetAgentRequest.newBuilder() 391 * .setAgent(Agent.newBuilder().build()) 392 * .setUpdateMask(FieldMask.newBuilder().build()) 393 * .build(); 394 * Agent response = agentsClient.setAgent(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 */ setAgent(SetAgentRequest request)401 public final Agent setAgent(SetAgentRequest request) { 402 return setAgentCallable().call(request); 403 } 404 405 // AUTO-GENERATED DOCUMENTATION AND METHOD. 406 /** 407 * Creates/updates the specified agent. 408 * 409 * <p>Note: You should always train an agent prior to sending it queries. See the [training 410 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 411 * 412 * <p>Sample code: 413 * 414 * <pre>{@code 415 * // This snippet has been automatically generated and should be regarded as a code template only. 416 * // It will require modifications to work: 417 * // - It may require correct/in-range values for request initialization. 418 * // - It may require specifying regional endpoints when creating the service client as shown in 419 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 420 * try (AgentsClient agentsClient = AgentsClient.create()) { 421 * SetAgentRequest request = 422 * SetAgentRequest.newBuilder() 423 * .setAgent(Agent.newBuilder().build()) 424 * .setUpdateMask(FieldMask.newBuilder().build()) 425 * .build(); 426 * ApiFuture<Agent> future = agentsClient.setAgentCallable().futureCall(request); 427 * // Do something. 428 * Agent response = future.get(); 429 * } 430 * }</pre> 431 */ setAgentCallable()432 public final UnaryCallable<SetAgentRequest, Agent> setAgentCallable() { 433 return stub.setAgentCallable(); 434 } 435 436 // AUTO-GENERATED DOCUMENTATION AND METHOD. 437 /** 438 * Deletes the specified agent. 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 (AgentsClient agentsClient = AgentsClient.create()) { 449 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 450 * agentsClient.deleteAgent(parent); 451 * } 452 * }</pre> 453 * 454 * @param parent Required. The project that the agent to delete is associated with. Format: 455 * `projects/<Project ID>` or `projects/<Project ID>/locations/<Location 456 * ID>`. 457 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 458 */ deleteAgent(LocationName parent)459 public final void deleteAgent(LocationName parent) { 460 DeleteAgentRequest request = 461 DeleteAgentRequest.newBuilder() 462 .setParent(parent == null ? null : parent.toString()) 463 .build(); 464 deleteAgent(request); 465 } 466 467 // AUTO-GENERATED DOCUMENTATION AND METHOD. 468 /** 469 * Deletes the specified agent. 470 * 471 * <p>Sample code: 472 * 473 * <pre>{@code 474 * // This snippet has been automatically generated and should be regarded as a code template only. 475 * // It will require modifications to work: 476 * // - It may require correct/in-range values for request initialization. 477 * // - It may require specifying regional endpoints when creating the service client as shown in 478 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 479 * try (AgentsClient agentsClient = AgentsClient.create()) { 480 * ProjectName parent = ProjectName.of("[PROJECT]"); 481 * agentsClient.deleteAgent(parent); 482 * } 483 * }</pre> 484 * 485 * @param parent Required. The project that the agent to delete is associated with. Format: 486 * `projects/<Project ID>` or `projects/<Project ID>/locations/<Location 487 * ID>`. 488 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 489 */ deleteAgent(ProjectName parent)490 public final void deleteAgent(ProjectName parent) { 491 DeleteAgentRequest request = 492 DeleteAgentRequest.newBuilder() 493 .setParent(parent == null ? null : parent.toString()) 494 .build(); 495 deleteAgent(request); 496 } 497 498 // AUTO-GENERATED DOCUMENTATION AND METHOD. 499 /** 500 * Deletes the specified agent. 501 * 502 * <p>Sample code: 503 * 504 * <pre>{@code 505 * // This snippet has been automatically generated and should be regarded as a code template only. 506 * // It will require modifications to work: 507 * // - It may require correct/in-range values for request initialization. 508 * // - It may require specifying regional endpoints when creating the service client as shown in 509 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 510 * try (AgentsClient agentsClient = AgentsClient.create()) { 511 * String parent = ProjectName.of("[PROJECT]").toString(); 512 * agentsClient.deleteAgent(parent); 513 * } 514 * }</pre> 515 * 516 * @param parent Required. The project that the agent to delete is associated with. Format: 517 * `projects/<Project ID>` or `projects/<Project ID>/locations/<Location 518 * ID>`. 519 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 520 */ deleteAgent(String parent)521 public final void deleteAgent(String parent) { 522 DeleteAgentRequest request = DeleteAgentRequest.newBuilder().setParent(parent).build(); 523 deleteAgent(request); 524 } 525 526 // AUTO-GENERATED DOCUMENTATION AND METHOD. 527 /** 528 * Deletes the specified agent. 529 * 530 * <p>Sample code: 531 * 532 * <pre>{@code 533 * // This snippet has been automatically generated and should be regarded as a code template only. 534 * // It will require modifications to work: 535 * // - It may require correct/in-range values for request initialization. 536 * // - It may require specifying regional endpoints when creating the service client as shown in 537 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 538 * try (AgentsClient agentsClient = AgentsClient.create()) { 539 * DeleteAgentRequest request = 540 * DeleteAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build(); 541 * agentsClient.deleteAgent(request); 542 * } 543 * }</pre> 544 * 545 * @param request The request object containing all of the parameters for the API call. 546 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 547 */ deleteAgent(DeleteAgentRequest request)548 public final void deleteAgent(DeleteAgentRequest request) { 549 deleteAgentCallable().call(request); 550 } 551 552 // AUTO-GENERATED DOCUMENTATION AND METHOD. 553 /** 554 * Deletes the specified agent. 555 * 556 * <p>Sample code: 557 * 558 * <pre>{@code 559 * // This snippet has been automatically generated and should be regarded as a code template only. 560 * // It will require modifications to work: 561 * // - It may require correct/in-range values for request initialization. 562 * // - It may require specifying regional endpoints when creating the service client as shown in 563 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 564 * try (AgentsClient agentsClient = AgentsClient.create()) { 565 * DeleteAgentRequest request = 566 * DeleteAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build(); 567 * ApiFuture<Empty> future = agentsClient.deleteAgentCallable().futureCall(request); 568 * // Do something. 569 * future.get(); 570 * } 571 * }</pre> 572 */ deleteAgentCallable()573 public final UnaryCallable<DeleteAgentRequest, Empty> deleteAgentCallable() { 574 return stub.deleteAgentCallable(); 575 } 576 577 // AUTO-GENERATED DOCUMENTATION AND METHOD. 578 /** 579 * Returns the list of agents. Since there is at most one conversational agent per project, this 580 * method is useful primarily for listing all agents across projects the caller has access to. One 581 * can achieve that with a wildcard project collection id "-". Refer to [List 582 * Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). 583 * 584 * <p>Sample code: 585 * 586 * <pre>{@code 587 * // This snippet has been automatically generated and should be regarded as a code template only. 588 * // It will require modifications to work: 589 * // - It may require correct/in-range values for request initialization. 590 * // - It may require specifying regional endpoints when creating the service client as shown in 591 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 592 * try (AgentsClient agentsClient = AgentsClient.create()) { 593 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 594 * for (Agent element : agentsClient.searchAgents(parent).iterateAll()) { 595 * // doThingsWith(element); 596 * } 597 * } 598 * }</pre> 599 * 600 * @param parent Required. The project to list agents from. Format: `projects/<Project ID or 601 * '-'>` or `projects/<Project ID or '-'>/locations/<Location ID>`. 602 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 603 */ searchAgents(LocationName parent)604 public final SearchAgentsPagedResponse searchAgents(LocationName parent) { 605 SearchAgentsRequest request = 606 SearchAgentsRequest.newBuilder() 607 .setParent(parent == null ? null : parent.toString()) 608 .build(); 609 return searchAgents(request); 610 } 611 612 // AUTO-GENERATED DOCUMENTATION AND METHOD. 613 /** 614 * Returns the list of agents. Since there is at most one conversational agent per project, this 615 * method is useful primarily for listing all agents across projects the caller has access to. One 616 * can achieve that with a wildcard project collection id "-". Refer to [List 617 * Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). 618 * 619 * <p>Sample code: 620 * 621 * <pre>{@code 622 * // This snippet has been automatically generated and should be regarded as a code template only. 623 * // It will require modifications to work: 624 * // - It may require correct/in-range values for request initialization. 625 * // - It may require specifying regional endpoints when creating the service client as shown in 626 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 627 * try (AgentsClient agentsClient = AgentsClient.create()) { 628 * ProjectName parent = ProjectName.of("[PROJECT]"); 629 * for (Agent element : agentsClient.searchAgents(parent).iterateAll()) { 630 * // doThingsWith(element); 631 * } 632 * } 633 * }</pre> 634 * 635 * @param parent Required. The project to list agents from. Format: `projects/<Project ID or 636 * '-'>` or `projects/<Project ID or '-'>/locations/<Location ID>`. 637 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 638 */ searchAgents(ProjectName parent)639 public final SearchAgentsPagedResponse searchAgents(ProjectName parent) { 640 SearchAgentsRequest request = 641 SearchAgentsRequest.newBuilder() 642 .setParent(parent == null ? null : parent.toString()) 643 .build(); 644 return searchAgents(request); 645 } 646 647 // AUTO-GENERATED DOCUMENTATION AND METHOD. 648 /** 649 * Returns the list of agents. Since there is at most one conversational agent per project, this 650 * method is useful primarily for listing all agents across projects the caller has access to. One 651 * can achieve that with a wildcard project collection id "-". Refer to [List 652 * Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). 653 * 654 * <p>Sample code: 655 * 656 * <pre>{@code 657 * // This snippet has been automatically generated and should be regarded as a code template only. 658 * // It will require modifications to work: 659 * // - It may require correct/in-range values for request initialization. 660 * // - It may require specifying regional endpoints when creating the service client as shown in 661 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 662 * try (AgentsClient agentsClient = AgentsClient.create()) { 663 * String parent = ProjectName.of("[PROJECT]").toString(); 664 * for (Agent element : agentsClient.searchAgents(parent).iterateAll()) { 665 * // doThingsWith(element); 666 * } 667 * } 668 * }</pre> 669 * 670 * @param parent Required. The project to list agents from. Format: `projects/<Project ID or 671 * '-'>` or `projects/<Project ID or '-'>/locations/<Location ID>`. 672 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 673 */ searchAgents(String parent)674 public final SearchAgentsPagedResponse searchAgents(String parent) { 675 SearchAgentsRequest request = SearchAgentsRequest.newBuilder().setParent(parent).build(); 676 return searchAgents(request); 677 } 678 679 // AUTO-GENERATED DOCUMENTATION AND METHOD. 680 /** 681 * Returns the list of agents. Since there is at most one conversational agent per project, this 682 * method is useful primarily for listing all agents across projects the caller has access to. One 683 * can achieve that with a wildcard project collection id "-". Refer to [List 684 * Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). 685 * 686 * <p>Sample code: 687 * 688 * <pre>{@code 689 * // This snippet has been automatically generated and should be regarded as a code template only. 690 * // It will require modifications to work: 691 * // - It may require correct/in-range values for request initialization. 692 * // - It may require specifying regional endpoints when creating the service client as shown in 693 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 694 * try (AgentsClient agentsClient = AgentsClient.create()) { 695 * SearchAgentsRequest request = 696 * SearchAgentsRequest.newBuilder() 697 * .setParent(ProjectName.of("[PROJECT]").toString()) 698 * .setPageSize(883849137) 699 * .setPageToken("pageToken873572522") 700 * .build(); 701 * for (Agent element : agentsClient.searchAgents(request).iterateAll()) { 702 * // doThingsWith(element); 703 * } 704 * } 705 * }</pre> 706 * 707 * @param request The request object containing all of the parameters for the API call. 708 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 709 */ searchAgents(SearchAgentsRequest request)710 public final SearchAgentsPagedResponse searchAgents(SearchAgentsRequest request) { 711 return searchAgentsPagedCallable().call(request); 712 } 713 714 // AUTO-GENERATED DOCUMENTATION AND METHOD. 715 /** 716 * Returns the list of agents. Since there is at most one conversational agent per project, this 717 * method is useful primarily for listing all agents across projects the caller has access to. One 718 * can achieve that with a wildcard project collection id "-". Refer to [List 719 * Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). 720 * 721 * <p>Sample code: 722 * 723 * <pre>{@code 724 * // This snippet has been automatically generated and should be regarded as a code template only. 725 * // It will require modifications to work: 726 * // - It may require correct/in-range values for request initialization. 727 * // - It may require specifying regional endpoints when creating the service client as shown in 728 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 729 * try (AgentsClient agentsClient = AgentsClient.create()) { 730 * SearchAgentsRequest request = 731 * SearchAgentsRequest.newBuilder() 732 * .setParent(ProjectName.of("[PROJECT]").toString()) 733 * .setPageSize(883849137) 734 * .setPageToken("pageToken873572522") 735 * .build(); 736 * ApiFuture<Agent> future = agentsClient.searchAgentsPagedCallable().futureCall(request); 737 * // Do something. 738 * for (Agent element : future.get().iterateAll()) { 739 * // doThingsWith(element); 740 * } 741 * } 742 * }</pre> 743 */ 744 public final UnaryCallable<SearchAgentsRequest, SearchAgentsPagedResponse> searchAgentsPagedCallable()745 searchAgentsPagedCallable() { 746 return stub.searchAgentsPagedCallable(); 747 } 748 749 // AUTO-GENERATED DOCUMENTATION AND METHOD. 750 /** 751 * Returns the list of agents. Since there is at most one conversational agent per project, this 752 * method is useful primarily for listing all agents across projects the caller has access to. One 753 * can achieve that with a wildcard project collection id "-". Refer to [List 754 * Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). 755 * 756 * <p>Sample code: 757 * 758 * <pre>{@code 759 * // This snippet has been automatically generated and should be regarded as a code template only. 760 * // It will require modifications to work: 761 * // - It may require correct/in-range values for request initialization. 762 * // - It may require specifying regional endpoints when creating the service client as shown in 763 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 764 * try (AgentsClient agentsClient = AgentsClient.create()) { 765 * SearchAgentsRequest request = 766 * SearchAgentsRequest.newBuilder() 767 * .setParent(ProjectName.of("[PROJECT]").toString()) 768 * .setPageSize(883849137) 769 * .setPageToken("pageToken873572522") 770 * .build(); 771 * while (true) { 772 * SearchAgentsResponse response = agentsClient.searchAgentsCallable().call(request); 773 * for (Agent element : response.getAgentsList()) { 774 * // doThingsWith(element); 775 * } 776 * String nextPageToken = response.getNextPageToken(); 777 * if (!Strings.isNullOrEmpty(nextPageToken)) { 778 * request = request.toBuilder().setPageToken(nextPageToken).build(); 779 * } else { 780 * break; 781 * } 782 * } 783 * } 784 * }</pre> 785 */ searchAgentsCallable()786 public final UnaryCallable<SearchAgentsRequest, SearchAgentsResponse> searchAgentsCallable() { 787 return stub.searchAgentsCallable(); 788 } 789 790 // AUTO-GENERATED DOCUMENTATION AND METHOD. 791 /** 792 * Trains the specified agent. 793 * 794 * <p>This method is a [long-running 795 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 796 * returned `Operation` type has the following method-specific fields: 797 * 798 * <p>- `metadata`: An empty [Struct 799 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 800 * - `response`: An [Empty 801 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) 802 * 803 * <p>Note: You should always train an agent prior to sending it queries. See the [training 804 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 805 * 806 * <p>Sample code: 807 * 808 * <pre>{@code 809 * // This snippet has been automatically generated and should be regarded as a code template only. 810 * // It will require modifications to work: 811 * // - It may require correct/in-range values for request initialization. 812 * // - It may require specifying regional endpoints when creating the service client as shown in 813 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 814 * try (AgentsClient agentsClient = AgentsClient.create()) { 815 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 816 * agentsClient.trainAgentAsync(parent).get(); 817 * } 818 * }</pre> 819 * 820 * @param parent Required. The project that the agent to train is associated with. Format: 821 * `projects/<Project ID>` or `projects/<Project ID>/locations/<Location 822 * ID>`. 823 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 824 */ trainAgentAsync(LocationName parent)825 public final OperationFuture<Empty, Struct> trainAgentAsync(LocationName parent) { 826 TrainAgentRequest request = 827 TrainAgentRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); 828 return trainAgentAsync(request); 829 } 830 831 // AUTO-GENERATED DOCUMENTATION AND METHOD. 832 /** 833 * Trains the specified agent. 834 * 835 * <p>This method is a [long-running 836 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 837 * returned `Operation` type has the following method-specific fields: 838 * 839 * <p>- `metadata`: An empty [Struct 840 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 841 * - `response`: An [Empty 842 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) 843 * 844 * <p>Note: You should always train an agent prior to sending it queries. See the [training 845 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 846 * 847 * <p>Sample code: 848 * 849 * <pre>{@code 850 * // This snippet has been automatically generated and should be regarded as a code template only. 851 * // It will require modifications to work: 852 * // - It may require correct/in-range values for request initialization. 853 * // - It may require specifying regional endpoints when creating the service client as shown in 854 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 855 * try (AgentsClient agentsClient = AgentsClient.create()) { 856 * ProjectName parent = ProjectName.of("[PROJECT]"); 857 * agentsClient.trainAgentAsync(parent).get(); 858 * } 859 * }</pre> 860 * 861 * @param parent Required. The project that the agent to train is associated with. Format: 862 * `projects/<Project ID>` or `projects/<Project ID>/locations/<Location 863 * ID>`. 864 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 865 */ trainAgentAsync(ProjectName parent)866 public final OperationFuture<Empty, Struct> trainAgentAsync(ProjectName parent) { 867 TrainAgentRequest request = 868 TrainAgentRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); 869 return trainAgentAsync(request); 870 } 871 872 // AUTO-GENERATED DOCUMENTATION AND METHOD. 873 /** 874 * Trains the specified agent. 875 * 876 * <p>This method is a [long-running 877 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 878 * returned `Operation` type has the following method-specific fields: 879 * 880 * <p>- `metadata`: An empty [Struct 881 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 882 * - `response`: An [Empty 883 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) 884 * 885 * <p>Note: You should always train an agent prior to sending it queries. See the [training 886 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 887 * 888 * <p>Sample code: 889 * 890 * <pre>{@code 891 * // This snippet has been automatically generated and should be regarded as a code template only. 892 * // It will require modifications to work: 893 * // - It may require correct/in-range values for request initialization. 894 * // - It may require specifying regional endpoints when creating the service client as shown in 895 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 896 * try (AgentsClient agentsClient = AgentsClient.create()) { 897 * String parent = ProjectName.of("[PROJECT]").toString(); 898 * agentsClient.trainAgentAsync(parent).get(); 899 * } 900 * }</pre> 901 * 902 * @param parent Required. The project that the agent to train is associated with. Format: 903 * `projects/<Project ID>` or `projects/<Project ID>/locations/<Location 904 * ID>`. 905 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 906 */ trainAgentAsync(String parent)907 public final OperationFuture<Empty, Struct> trainAgentAsync(String parent) { 908 TrainAgentRequest request = TrainAgentRequest.newBuilder().setParent(parent).build(); 909 return trainAgentAsync(request); 910 } 911 912 // AUTO-GENERATED DOCUMENTATION AND METHOD. 913 /** 914 * Trains the specified agent. 915 * 916 * <p>This method is a [long-running 917 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 918 * returned `Operation` type has the following method-specific fields: 919 * 920 * <p>- `metadata`: An empty [Struct 921 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 922 * - `response`: An [Empty 923 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) 924 * 925 * <p>Note: You should always train an agent prior to sending it queries. See the [training 926 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 927 * 928 * <p>Sample code: 929 * 930 * <pre>{@code 931 * // This snippet has been automatically generated and should be regarded as a code template only. 932 * // It will require modifications to work: 933 * // - It may require correct/in-range values for request initialization. 934 * // - It may require specifying regional endpoints when creating the service client as shown in 935 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 936 * try (AgentsClient agentsClient = AgentsClient.create()) { 937 * TrainAgentRequest request = 938 * TrainAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build(); 939 * agentsClient.trainAgentAsync(request).get(); 940 * } 941 * }</pre> 942 * 943 * @param request The request object containing all of the parameters for the API call. 944 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 945 */ trainAgentAsync(TrainAgentRequest request)946 public final OperationFuture<Empty, Struct> trainAgentAsync(TrainAgentRequest request) { 947 return trainAgentOperationCallable().futureCall(request); 948 } 949 950 // AUTO-GENERATED DOCUMENTATION AND METHOD. 951 /** 952 * Trains the specified agent. 953 * 954 * <p>This method is a [long-running 955 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 956 * returned `Operation` type has the following method-specific fields: 957 * 958 * <p>- `metadata`: An empty [Struct 959 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 960 * - `response`: An [Empty 961 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) 962 * 963 * <p>Note: You should always train an agent prior to sending it queries. See the [training 964 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 965 * 966 * <p>Sample code: 967 * 968 * <pre>{@code 969 * // This snippet has been automatically generated and should be regarded as a code template only. 970 * // It will require modifications to work: 971 * // - It may require correct/in-range values for request initialization. 972 * // - It may require specifying regional endpoints when creating the service client as shown in 973 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 974 * try (AgentsClient agentsClient = AgentsClient.create()) { 975 * TrainAgentRequest request = 976 * TrainAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build(); 977 * OperationFuture<Empty, Struct> future = 978 * agentsClient.trainAgentOperationCallable().futureCall(request); 979 * // Do something. 980 * future.get(); 981 * } 982 * }</pre> 983 */ trainAgentOperationCallable()984 public final OperationCallable<TrainAgentRequest, Empty, Struct> trainAgentOperationCallable() { 985 return stub.trainAgentOperationCallable(); 986 } 987 988 // AUTO-GENERATED DOCUMENTATION AND METHOD. 989 /** 990 * Trains the specified agent. 991 * 992 * <p>This method is a [long-running 993 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 994 * returned `Operation` type has the following method-specific fields: 995 * 996 * <p>- `metadata`: An empty [Struct 997 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 998 * - `response`: An [Empty 999 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) 1000 * 1001 * <p>Note: You should always train an agent prior to sending it queries. See the [training 1002 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 1003 * 1004 * <p>Sample code: 1005 * 1006 * <pre>{@code 1007 * // This snippet has been automatically generated and should be regarded as a code template only. 1008 * // It will require modifications to work: 1009 * // - It may require correct/in-range values for request initialization. 1010 * // - It may require specifying regional endpoints when creating the service client as shown in 1011 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1012 * try (AgentsClient agentsClient = AgentsClient.create()) { 1013 * TrainAgentRequest request = 1014 * TrainAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build(); 1015 * ApiFuture<Operation> future = agentsClient.trainAgentCallable().futureCall(request); 1016 * // Do something. 1017 * future.get(); 1018 * } 1019 * }</pre> 1020 */ trainAgentCallable()1021 public final UnaryCallable<TrainAgentRequest, Operation> trainAgentCallable() { 1022 return stub.trainAgentCallable(); 1023 } 1024 1025 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1026 /** 1027 * Exports the specified agent to a ZIP file. 1028 * 1029 * <p>This method is a [long-running 1030 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 1031 * returned `Operation` type has the following method-specific fields: 1032 * 1033 * <p>- `metadata`: An empty [Struct 1034 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 1035 * - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse] 1036 * 1037 * <p>Sample code: 1038 * 1039 * <pre>{@code 1040 * // This snippet has been automatically generated and should be regarded as a code template only. 1041 * // It will require modifications to work: 1042 * // - It may require correct/in-range values for request initialization. 1043 * // - It may require specifying regional endpoints when creating the service client as shown in 1044 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1045 * try (AgentsClient agentsClient = AgentsClient.create()) { 1046 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 1047 * ExportAgentResponse response = agentsClient.exportAgentAsync(parent).get(); 1048 * } 1049 * }</pre> 1050 * 1051 * @param parent Required. The project that the agent to export is associated with. Format: 1052 * `projects/<Project ID>` or `projects/<Project ID>/locations/<Location 1053 * ID>`. 1054 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1055 */ exportAgentAsync(LocationName parent)1056 public final OperationFuture<ExportAgentResponse, Struct> exportAgentAsync(LocationName parent) { 1057 ExportAgentRequest request = 1058 ExportAgentRequest.newBuilder() 1059 .setParent(parent == null ? null : parent.toString()) 1060 .build(); 1061 return exportAgentAsync(request); 1062 } 1063 1064 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1065 /** 1066 * Exports the specified agent to a ZIP file. 1067 * 1068 * <p>This method is a [long-running 1069 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 1070 * returned `Operation` type has the following method-specific fields: 1071 * 1072 * <p>- `metadata`: An empty [Struct 1073 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 1074 * - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse] 1075 * 1076 * <p>Sample code: 1077 * 1078 * <pre>{@code 1079 * // This snippet has been automatically generated and should be regarded as a code template only. 1080 * // It will require modifications to work: 1081 * // - It may require correct/in-range values for request initialization. 1082 * // - It may require specifying regional endpoints when creating the service client as shown in 1083 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1084 * try (AgentsClient agentsClient = AgentsClient.create()) { 1085 * ProjectName parent = ProjectName.of("[PROJECT]"); 1086 * ExportAgentResponse response = agentsClient.exportAgentAsync(parent).get(); 1087 * } 1088 * }</pre> 1089 * 1090 * @param parent Required. The project that the agent to export is associated with. Format: 1091 * `projects/<Project ID>` or `projects/<Project ID>/locations/<Location 1092 * ID>`. 1093 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1094 */ exportAgentAsync(ProjectName parent)1095 public final OperationFuture<ExportAgentResponse, Struct> exportAgentAsync(ProjectName parent) { 1096 ExportAgentRequest request = 1097 ExportAgentRequest.newBuilder() 1098 .setParent(parent == null ? null : parent.toString()) 1099 .build(); 1100 return exportAgentAsync(request); 1101 } 1102 1103 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1104 /** 1105 * Exports the specified agent to a ZIP file. 1106 * 1107 * <p>This method is a [long-running 1108 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 1109 * returned `Operation` type has the following method-specific fields: 1110 * 1111 * <p>- `metadata`: An empty [Struct 1112 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 1113 * - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse] 1114 * 1115 * <p>Sample code: 1116 * 1117 * <pre>{@code 1118 * // This snippet has been automatically generated and should be regarded as a code template only. 1119 * // It will require modifications to work: 1120 * // - It may require correct/in-range values for request initialization. 1121 * // - It may require specifying regional endpoints when creating the service client as shown in 1122 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1123 * try (AgentsClient agentsClient = AgentsClient.create()) { 1124 * String parent = ProjectName.of("[PROJECT]").toString(); 1125 * ExportAgentResponse response = agentsClient.exportAgentAsync(parent).get(); 1126 * } 1127 * }</pre> 1128 * 1129 * @param parent Required. The project that the agent to export is associated with. Format: 1130 * `projects/<Project ID>` or `projects/<Project ID>/locations/<Location 1131 * ID>`. 1132 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1133 */ exportAgentAsync(String parent)1134 public final OperationFuture<ExportAgentResponse, Struct> exportAgentAsync(String parent) { 1135 ExportAgentRequest request = ExportAgentRequest.newBuilder().setParent(parent).build(); 1136 return exportAgentAsync(request); 1137 } 1138 1139 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1140 /** 1141 * Exports the specified agent to a ZIP file. 1142 * 1143 * <p>This method is a [long-running 1144 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 1145 * returned `Operation` type has the following method-specific fields: 1146 * 1147 * <p>- `metadata`: An empty [Struct 1148 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 1149 * - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse] 1150 * 1151 * <p>Sample code: 1152 * 1153 * <pre>{@code 1154 * // This snippet has been automatically generated and should be regarded as a code template only. 1155 * // It will require modifications to work: 1156 * // - It may require correct/in-range values for request initialization. 1157 * // - It may require specifying regional endpoints when creating the service client as shown in 1158 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1159 * try (AgentsClient agentsClient = AgentsClient.create()) { 1160 * ExportAgentRequest request = 1161 * ExportAgentRequest.newBuilder() 1162 * .setParent(ProjectName.of("[PROJECT]").toString()) 1163 * .setAgentUri("agentUri1469149223") 1164 * .build(); 1165 * ExportAgentResponse response = agentsClient.exportAgentAsync(request).get(); 1166 * } 1167 * }</pre> 1168 * 1169 * @param request The request object containing all of the parameters for the API call. 1170 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1171 */ exportAgentAsync( ExportAgentRequest request)1172 public final OperationFuture<ExportAgentResponse, Struct> exportAgentAsync( 1173 ExportAgentRequest request) { 1174 return exportAgentOperationCallable().futureCall(request); 1175 } 1176 1177 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1178 /** 1179 * Exports the specified agent to a ZIP file. 1180 * 1181 * <p>This method is a [long-running 1182 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 1183 * returned `Operation` type has the following method-specific fields: 1184 * 1185 * <p>- `metadata`: An empty [Struct 1186 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 1187 * - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse] 1188 * 1189 * <p>Sample code: 1190 * 1191 * <pre>{@code 1192 * // This snippet has been automatically generated and should be regarded as a code template only. 1193 * // It will require modifications to work: 1194 * // - It may require correct/in-range values for request initialization. 1195 * // - It may require specifying regional endpoints when creating the service client as shown in 1196 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1197 * try (AgentsClient agentsClient = AgentsClient.create()) { 1198 * ExportAgentRequest request = 1199 * ExportAgentRequest.newBuilder() 1200 * .setParent(ProjectName.of("[PROJECT]").toString()) 1201 * .setAgentUri("agentUri1469149223") 1202 * .build(); 1203 * OperationFuture<ExportAgentResponse, Struct> future = 1204 * agentsClient.exportAgentOperationCallable().futureCall(request); 1205 * // Do something. 1206 * ExportAgentResponse response = future.get(); 1207 * } 1208 * }</pre> 1209 */ 1210 public final OperationCallable<ExportAgentRequest, ExportAgentResponse, Struct> exportAgentOperationCallable()1211 exportAgentOperationCallable() { 1212 return stub.exportAgentOperationCallable(); 1213 } 1214 1215 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1216 /** 1217 * Exports the specified agent to a ZIP file. 1218 * 1219 * <p>This method is a [long-running 1220 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 1221 * returned `Operation` type has the following method-specific fields: 1222 * 1223 * <p>- `metadata`: An empty [Struct 1224 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 1225 * - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse] 1226 * 1227 * <p>Sample code: 1228 * 1229 * <pre>{@code 1230 * // This snippet has been automatically generated and should be regarded as a code template only. 1231 * // It will require modifications to work: 1232 * // - It may require correct/in-range values for request initialization. 1233 * // - It may require specifying regional endpoints when creating the service client as shown in 1234 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1235 * try (AgentsClient agentsClient = AgentsClient.create()) { 1236 * ExportAgentRequest request = 1237 * ExportAgentRequest.newBuilder() 1238 * .setParent(ProjectName.of("[PROJECT]").toString()) 1239 * .setAgentUri("agentUri1469149223") 1240 * .build(); 1241 * ApiFuture<Operation> future = agentsClient.exportAgentCallable().futureCall(request); 1242 * // Do something. 1243 * Operation response = future.get(); 1244 * } 1245 * }</pre> 1246 */ exportAgentCallable()1247 public final UnaryCallable<ExportAgentRequest, Operation> exportAgentCallable() { 1248 return stub.exportAgentCallable(); 1249 } 1250 1251 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1252 /** 1253 * Imports the specified agent from a ZIP file. 1254 * 1255 * <p>Uploads new intents and entity types without deleting the existing ones. Intents and entity 1256 * types with the same name are replaced with the new versions from 1257 * [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. After the import, the 1258 * imported draft agent will be trained automatically (unless disabled in agent settings). 1259 * However, once the import is done, training may not be completed yet. Please call 1260 * [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it 1261 * returns in order to train explicitly. 1262 * 1263 * <p>This method is a [long-running 1264 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 1265 * returned `Operation` type has the following method-specific fields: 1266 * 1267 * <p>- `metadata`: An empty [Struct 1268 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 1269 * - `response`: An [Empty 1270 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) 1271 * 1272 * <p>The operation only tracks when importing is complete, not when it is done training. 1273 * 1274 * <p>Note: You should always train an agent prior to sending it queries. See the [training 1275 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 1276 * 1277 * <p>Sample code: 1278 * 1279 * <pre>{@code 1280 * // This snippet has been automatically generated and should be regarded as a code template only. 1281 * // It will require modifications to work: 1282 * // - It may require correct/in-range values for request initialization. 1283 * // - It may require specifying regional endpoints when creating the service client as shown in 1284 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1285 * try (AgentsClient agentsClient = AgentsClient.create()) { 1286 * ImportAgentRequest request = 1287 * ImportAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build(); 1288 * agentsClient.importAgentAsync(request).get(); 1289 * } 1290 * }</pre> 1291 * 1292 * @param request The request object containing all of the parameters for the API call. 1293 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1294 */ importAgentAsync(ImportAgentRequest request)1295 public final OperationFuture<Empty, Struct> importAgentAsync(ImportAgentRequest request) { 1296 return importAgentOperationCallable().futureCall(request); 1297 } 1298 1299 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1300 /** 1301 * Imports the specified agent from a ZIP file. 1302 * 1303 * <p>Uploads new intents and entity types without deleting the existing ones. Intents and entity 1304 * types with the same name are replaced with the new versions from 1305 * [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. After the import, the 1306 * imported draft agent will be trained automatically (unless disabled in agent settings). 1307 * However, once the import is done, training may not be completed yet. Please call 1308 * [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it 1309 * returns in order to train explicitly. 1310 * 1311 * <p>This method is a [long-running 1312 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 1313 * returned `Operation` type has the following method-specific fields: 1314 * 1315 * <p>- `metadata`: An empty [Struct 1316 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 1317 * - `response`: An [Empty 1318 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) 1319 * 1320 * <p>The operation only tracks when importing is complete, not when it is done training. 1321 * 1322 * <p>Note: You should always train an agent prior to sending it queries. See the [training 1323 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 1324 * 1325 * <p>Sample code: 1326 * 1327 * <pre>{@code 1328 * // This snippet has been automatically generated and should be regarded as a code template only. 1329 * // It will require modifications to work: 1330 * // - It may require correct/in-range values for request initialization. 1331 * // - It may require specifying regional endpoints when creating the service client as shown in 1332 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1333 * try (AgentsClient agentsClient = AgentsClient.create()) { 1334 * ImportAgentRequest request = 1335 * ImportAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build(); 1336 * OperationFuture<Empty, Struct> future = 1337 * agentsClient.importAgentOperationCallable().futureCall(request); 1338 * // Do something. 1339 * future.get(); 1340 * } 1341 * }</pre> 1342 */ importAgentOperationCallable()1343 public final OperationCallable<ImportAgentRequest, Empty, Struct> importAgentOperationCallable() { 1344 return stub.importAgentOperationCallable(); 1345 } 1346 1347 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1348 /** 1349 * Imports the specified agent from a ZIP file. 1350 * 1351 * <p>Uploads new intents and entity types without deleting the existing ones. Intents and entity 1352 * types with the same name are replaced with the new versions from 1353 * [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. After the import, the 1354 * imported draft agent will be trained automatically (unless disabled in agent settings). 1355 * However, once the import is done, training may not be completed yet. Please call 1356 * [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it 1357 * returns in order to train explicitly. 1358 * 1359 * <p>This method is a [long-running 1360 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 1361 * returned `Operation` type has the following method-specific fields: 1362 * 1363 * <p>- `metadata`: An empty [Struct 1364 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 1365 * - `response`: An [Empty 1366 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) 1367 * 1368 * <p>The operation only tracks when importing is complete, not when it is done training. 1369 * 1370 * <p>Note: You should always train an agent prior to sending it queries. See the [training 1371 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 1372 * 1373 * <p>Sample code: 1374 * 1375 * <pre>{@code 1376 * // This snippet has been automatically generated and should be regarded as a code template only. 1377 * // It will require modifications to work: 1378 * // - It may require correct/in-range values for request initialization. 1379 * // - It may require specifying regional endpoints when creating the service client as shown in 1380 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1381 * try (AgentsClient agentsClient = AgentsClient.create()) { 1382 * ImportAgentRequest request = 1383 * ImportAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build(); 1384 * ApiFuture<Operation> future = agentsClient.importAgentCallable().futureCall(request); 1385 * // Do something. 1386 * future.get(); 1387 * } 1388 * }</pre> 1389 */ importAgentCallable()1390 public final UnaryCallable<ImportAgentRequest, Operation> importAgentCallable() { 1391 return stub.importAgentCallable(); 1392 } 1393 1394 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1395 /** 1396 * Restores the specified agent from a ZIP file. 1397 * 1398 * <p>Replaces the current agent version with a new one. All the intents and entity types in the 1399 * older version are deleted. After the restore, the restored draft agent will be trained 1400 * automatically (unless disabled in agent settings). However, once the restore is done, training 1401 * may not be completed yet. Please call 1402 * [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it 1403 * returns in order to train explicitly. 1404 * 1405 * <p>This method is a [long-running 1406 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 1407 * returned `Operation` type has the following method-specific fields: 1408 * 1409 * <p>- `metadata`: An empty [Struct 1410 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 1411 * - `response`: An [Empty 1412 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) 1413 * 1414 * <p>The operation only tracks when restoring is complete, not when it is done training. 1415 * 1416 * <p>Note: You should always train an agent prior to sending it queries. See the [training 1417 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 1418 * 1419 * <p>Sample code: 1420 * 1421 * <pre>{@code 1422 * // This snippet has been automatically generated and should be regarded as a code template only. 1423 * // It will require modifications to work: 1424 * // - It may require correct/in-range values for request initialization. 1425 * // - It may require specifying regional endpoints when creating the service client as shown in 1426 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1427 * try (AgentsClient agentsClient = AgentsClient.create()) { 1428 * RestoreAgentRequest request = 1429 * RestoreAgentRequest.newBuilder() 1430 * .setParent(ProjectName.of("[PROJECT]").toString()) 1431 * .build(); 1432 * agentsClient.restoreAgentAsync(request).get(); 1433 * } 1434 * }</pre> 1435 * 1436 * @param request The request object containing all of the parameters for the API call. 1437 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1438 */ restoreAgentAsync(RestoreAgentRequest request)1439 public final OperationFuture<Empty, Struct> restoreAgentAsync(RestoreAgentRequest request) { 1440 return restoreAgentOperationCallable().futureCall(request); 1441 } 1442 1443 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1444 /** 1445 * Restores the specified agent from a ZIP file. 1446 * 1447 * <p>Replaces the current agent version with a new one. All the intents and entity types in the 1448 * older version are deleted. After the restore, the restored draft agent will be trained 1449 * automatically (unless disabled in agent settings). However, once the restore is done, training 1450 * may not be completed yet. Please call 1451 * [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it 1452 * returns in order to train explicitly. 1453 * 1454 * <p>This method is a [long-running 1455 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 1456 * returned `Operation` type has the following method-specific fields: 1457 * 1458 * <p>- `metadata`: An empty [Struct 1459 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 1460 * - `response`: An [Empty 1461 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) 1462 * 1463 * <p>The operation only tracks when restoring is complete, not when it is done training. 1464 * 1465 * <p>Note: You should always train an agent prior to sending it queries. See the [training 1466 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 1467 * 1468 * <p>Sample code: 1469 * 1470 * <pre>{@code 1471 * // This snippet has been automatically generated and should be regarded as a code template only. 1472 * // It will require modifications to work: 1473 * // - It may require correct/in-range values for request initialization. 1474 * // - It may require specifying regional endpoints when creating the service client as shown in 1475 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1476 * try (AgentsClient agentsClient = AgentsClient.create()) { 1477 * RestoreAgentRequest request = 1478 * RestoreAgentRequest.newBuilder() 1479 * .setParent(ProjectName.of("[PROJECT]").toString()) 1480 * .build(); 1481 * OperationFuture<Empty, Struct> future = 1482 * agentsClient.restoreAgentOperationCallable().futureCall(request); 1483 * // Do something. 1484 * future.get(); 1485 * } 1486 * }</pre> 1487 */ 1488 public final OperationCallable<RestoreAgentRequest, Empty, Struct> restoreAgentOperationCallable()1489 restoreAgentOperationCallable() { 1490 return stub.restoreAgentOperationCallable(); 1491 } 1492 1493 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1494 /** 1495 * Restores the specified agent from a ZIP file. 1496 * 1497 * <p>Replaces the current agent version with a new one. All the intents and entity types in the 1498 * older version are deleted. After the restore, the restored draft agent will be trained 1499 * automatically (unless disabled in agent settings). However, once the restore is done, training 1500 * may not be completed yet. Please call 1501 * [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it 1502 * returns in order to train explicitly. 1503 * 1504 * <p>This method is a [long-running 1505 * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The 1506 * returned `Operation` type has the following method-specific fields: 1507 * 1508 * <p>- `metadata`: An empty [Struct 1509 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) 1510 * - `response`: An [Empty 1511 * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) 1512 * 1513 * <p>The operation only tracks when restoring is complete, not when it is done training. 1514 * 1515 * <p>Note: You should always train an agent prior to sending it queries. See the [training 1516 * documentation](https://cloud.google.com/dialogflow/es/docs/training). 1517 * 1518 * <p>Sample code: 1519 * 1520 * <pre>{@code 1521 * // This snippet has been automatically generated and should be regarded as a code template only. 1522 * // It will require modifications to work: 1523 * // - It may require correct/in-range values for request initialization. 1524 * // - It may require specifying regional endpoints when creating the service client as shown in 1525 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1526 * try (AgentsClient agentsClient = AgentsClient.create()) { 1527 * RestoreAgentRequest request = 1528 * RestoreAgentRequest.newBuilder() 1529 * .setParent(ProjectName.of("[PROJECT]").toString()) 1530 * .build(); 1531 * ApiFuture<Operation> future = agentsClient.restoreAgentCallable().futureCall(request); 1532 * // Do something. 1533 * future.get(); 1534 * } 1535 * }</pre> 1536 */ restoreAgentCallable()1537 public final UnaryCallable<RestoreAgentRequest, Operation> restoreAgentCallable() { 1538 return stub.restoreAgentCallable(); 1539 } 1540 1541 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1542 /** 1543 * Gets agent validation result. Agent validation is performed during training time and is updated 1544 * automatically when training is completed. 1545 * 1546 * <p>Sample code: 1547 * 1548 * <pre>{@code 1549 * // This snippet has been automatically generated and should be regarded as a code template only. 1550 * // It will require modifications to work: 1551 * // - It may require correct/in-range values for request initialization. 1552 * // - It may require specifying regional endpoints when creating the service client as shown in 1553 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1554 * try (AgentsClient agentsClient = AgentsClient.create()) { 1555 * GetValidationResultRequest request = 1556 * GetValidationResultRequest.newBuilder() 1557 * .setParent(ProjectName.of("[PROJECT]").toString()) 1558 * .setLanguageCode("languageCode-2092349083") 1559 * .build(); 1560 * ValidationResult response = agentsClient.getValidationResult(request); 1561 * } 1562 * }</pre> 1563 * 1564 * @param request The request object containing all of the parameters for the API call. 1565 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1566 */ getValidationResult(GetValidationResultRequest request)1567 public final ValidationResult getValidationResult(GetValidationResultRequest request) { 1568 return getValidationResultCallable().call(request); 1569 } 1570 1571 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1572 /** 1573 * Gets agent validation result. Agent validation is performed during training time and is updated 1574 * automatically when training is completed. 1575 * 1576 * <p>Sample code: 1577 * 1578 * <pre>{@code 1579 * // This snippet has been automatically generated and should be regarded as a code template only. 1580 * // It will require modifications to work: 1581 * // - It may require correct/in-range values for request initialization. 1582 * // - It may require specifying regional endpoints when creating the service client as shown in 1583 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1584 * try (AgentsClient agentsClient = AgentsClient.create()) { 1585 * GetValidationResultRequest request = 1586 * GetValidationResultRequest.newBuilder() 1587 * .setParent(ProjectName.of("[PROJECT]").toString()) 1588 * .setLanguageCode("languageCode-2092349083") 1589 * .build(); 1590 * ApiFuture<ValidationResult> future = 1591 * agentsClient.getValidationResultCallable().futureCall(request); 1592 * // Do something. 1593 * ValidationResult response = future.get(); 1594 * } 1595 * }</pre> 1596 */ 1597 public final UnaryCallable<GetValidationResultRequest, ValidationResult> getValidationResultCallable()1598 getValidationResultCallable() { 1599 return stub.getValidationResultCallable(); 1600 } 1601 1602 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1603 /** 1604 * Lists information about the supported locations for this service. 1605 * 1606 * <p>Sample code: 1607 * 1608 * <pre>{@code 1609 * // This snippet has been automatically generated and should be regarded as a code template only. 1610 * // It will require modifications to work: 1611 * // - It may require correct/in-range values for request initialization. 1612 * // - It may require specifying regional endpoints when creating the service client as shown in 1613 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1614 * try (AgentsClient agentsClient = AgentsClient.create()) { 1615 * ListLocationsRequest request = 1616 * ListLocationsRequest.newBuilder() 1617 * .setName("name3373707") 1618 * .setFilter("filter-1274492040") 1619 * .setPageSize(883849137) 1620 * .setPageToken("pageToken873572522") 1621 * .build(); 1622 * for (Location element : agentsClient.listLocations(request).iterateAll()) { 1623 * // doThingsWith(element); 1624 * } 1625 * } 1626 * }</pre> 1627 * 1628 * @param request The request object containing all of the parameters for the API call. 1629 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1630 */ listLocations(ListLocationsRequest request)1631 public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { 1632 return listLocationsPagedCallable().call(request); 1633 } 1634 1635 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1636 /** 1637 * Lists information about the supported locations for this service. 1638 * 1639 * <p>Sample code: 1640 * 1641 * <pre>{@code 1642 * // This snippet has been automatically generated and should be regarded as a code template only. 1643 * // It will require modifications to work: 1644 * // - It may require correct/in-range values for request initialization. 1645 * // - It may require specifying regional endpoints when creating the service client as shown in 1646 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1647 * try (AgentsClient agentsClient = AgentsClient.create()) { 1648 * ListLocationsRequest request = 1649 * ListLocationsRequest.newBuilder() 1650 * .setName("name3373707") 1651 * .setFilter("filter-1274492040") 1652 * .setPageSize(883849137) 1653 * .setPageToken("pageToken873572522") 1654 * .build(); 1655 * ApiFuture<Location> future = agentsClient.listLocationsPagedCallable().futureCall(request); 1656 * // Do something. 1657 * for (Location element : future.get().iterateAll()) { 1658 * // doThingsWith(element); 1659 * } 1660 * } 1661 * }</pre> 1662 */ 1663 public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> listLocationsPagedCallable()1664 listLocationsPagedCallable() { 1665 return stub.listLocationsPagedCallable(); 1666 } 1667 1668 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1669 /** 1670 * Lists information about the supported locations for this service. 1671 * 1672 * <p>Sample code: 1673 * 1674 * <pre>{@code 1675 * // This snippet has been automatically generated and should be regarded as a code template only. 1676 * // It will require modifications to work: 1677 * // - It may require correct/in-range values for request initialization. 1678 * // - It may require specifying regional endpoints when creating the service client as shown in 1679 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1680 * try (AgentsClient agentsClient = AgentsClient.create()) { 1681 * ListLocationsRequest request = 1682 * ListLocationsRequest.newBuilder() 1683 * .setName("name3373707") 1684 * .setFilter("filter-1274492040") 1685 * .setPageSize(883849137) 1686 * .setPageToken("pageToken873572522") 1687 * .build(); 1688 * while (true) { 1689 * ListLocationsResponse response = agentsClient.listLocationsCallable().call(request); 1690 * for (Location element : response.getLocationsList()) { 1691 * // doThingsWith(element); 1692 * } 1693 * String nextPageToken = response.getNextPageToken(); 1694 * if (!Strings.isNullOrEmpty(nextPageToken)) { 1695 * request = request.toBuilder().setPageToken(nextPageToken).build(); 1696 * } else { 1697 * break; 1698 * } 1699 * } 1700 * } 1701 * }</pre> 1702 */ listLocationsCallable()1703 public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { 1704 return stub.listLocationsCallable(); 1705 } 1706 1707 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1708 /** 1709 * Gets information about a location. 1710 * 1711 * <p>Sample code: 1712 * 1713 * <pre>{@code 1714 * // This snippet has been automatically generated and should be regarded as a code template only. 1715 * // It will require modifications to work: 1716 * // - It may require correct/in-range values for request initialization. 1717 * // - It may require specifying regional endpoints when creating the service client as shown in 1718 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1719 * try (AgentsClient agentsClient = AgentsClient.create()) { 1720 * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); 1721 * Location response = agentsClient.getLocation(request); 1722 * } 1723 * }</pre> 1724 * 1725 * @param request The request object containing all of the parameters for the API call. 1726 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1727 */ getLocation(GetLocationRequest request)1728 public final Location getLocation(GetLocationRequest request) { 1729 return getLocationCallable().call(request); 1730 } 1731 1732 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1733 /** 1734 * Gets information about a location. 1735 * 1736 * <p>Sample code: 1737 * 1738 * <pre>{@code 1739 * // This snippet has been automatically generated and should be regarded as a code template only. 1740 * // It will require modifications to work: 1741 * // - It may require correct/in-range values for request initialization. 1742 * // - It may require specifying regional endpoints when creating the service client as shown in 1743 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1744 * try (AgentsClient agentsClient = AgentsClient.create()) { 1745 * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); 1746 * ApiFuture<Location> future = agentsClient.getLocationCallable().futureCall(request); 1747 * // Do something. 1748 * Location response = future.get(); 1749 * } 1750 * }</pre> 1751 */ getLocationCallable()1752 public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() { 1753 return stub.getLocationCallable(); 1754 } 1755 1756 @Override close()1757 public final void close() { 1758 stub.close(); 1759 } 1760 1761 @Override shutdown()1762 public void shutdown() { 1763 stub.shutdown(); 1764 } 1765 1766 @Override isShutdown()1767 public boolean isShutdown() { 1768 return stub.isShutdown(); 1769 } 1770 1771 @Override isTerminated()1772 public boolean isTerminated() { 1773 return stub.isTerminated(); 1774 } 1775 1776 @Override shutdownNow()1777 public void shutdownNow() { 1778 stub.shutdownNow(); 1779 } 1780 1781 @Override awaitTermination(long duration, TimeUnit unit)1782 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 1783 return stub.awaitTermination(duration, unit); 1784 } 1785 1786 public static class SearchAgentsPagedResponse 1787 extends AbstractPagedListResponse< 1788 SearchAgentsRequest, 1789 SearchAgentsResponse, 1790 Agent, 1791 SearchAgentsPage, 1792 SearchAgentsFixedSizeCollection> { 1793 createAsync( PageContext<SearchAgentsRequest, SearchAgentsResponse, Agent> context, ApiFuture<SearchAgentsResponse> futureResponse)1794 public static ApiFuture<SearchAgentsPagedResponse> createAsync( 1795 PageContext<SearchAgentsRequest, SearchAgentsResponse, Agent> context, 1796 ApiFuture<SearchAgentsResponse> futureResponse) { 1797 ApiFuture<SearchAgentsPage> futurePage = 1798 SearchAgentsPage.createEmptyPage().createPageAsync(context, futureResponse); 1799 return ApiFutures.transform( 1800 futurePage, 1801 input -> new SearchAgentsPagedResponse(input), 1802 MoreExecutors.directExecutor()); 1803 } 1804 SearchAgentsPagedResponse(SearchAgentsPage page)1805 private SearchAgentsPagedResponse(SearchAgentsPage page) { 1806 super(page, SearchAgentsFixedSizeCollection.createEmptyCollection()); 1807 } 1808 } 1809 1810 public static class SearchAgentsPage 1811 extends AbstractPage<SearchAgentsRequest, SearchAgentsResponse, Agent, SearchAgentsPage> { 1812 SearchAgentsPage( PageContext<SearchAgentsRequest, SearchAgentsResponse, Agent> context, SearchAgentsResponse response)1813 private SearchAgentsPage( 1814 PageContext<SearchAgentsRequest, SearchAgentsResponse, Agent> context, 1815 SearchAgentsResponse response) { 1816 super(context, response); 1817 } 1818 createEmptyPage()1819 private static SearchAgentsPage createEmptyPage() { 1820 return new SearchAgentsPage(null, null); 1821 } 1822 1823 @Override createPage( PageContext<SearchAgentsRequest, SearchAgentsResponse, Agent> context, SearchAgentsResponse response)1824 protected SearchAgentsPage createPage( 1825 PageContext<SearchAgentsRequest, SearchAgentsResponse, Agent> context, 1826 SearchAgentsResponse response) { 1827 return new SearchAgentsPage(context, response); 1828 } 1829 1830 @Override createPageAsync( PageContext<SearchAgentsRequest, SearchAgentsResponse, Agent> context, ApiFuture<SearchAgentsResponse> futureResponse)1831 public ApiFuture<SearchAgentsPage> createPageAsync( 1832 PageContext<SearchAgentsRequest, SearchAgentsResponse, Agent> context, 1833 ApiFuture<SearchAgentsResponse> futureResponse) { 1834 return super.createPageAsync(context, futureResponse); 1835 } 1836 } 1837 1838 public static class SearchAgentsFixedSizeCollection 1839 extends AbstractFixedSizeCollection< 1840 SearchAgentsRequest, 1841 SearchAgentsResponse, 1842 Agent, 1843 SearchAgentsPage, 1844 SearchAgentsFixedSizeCollection> { 1845 SearchAgentsFixedSizeCollection(List<SearchAgentsPage> pages, int collectionSize)1846 private SearchAgentsFixedSizeCollection(List<SearchAgentsPage> pages, int collectionSize) { 1847 super(pages, collectionSize); 1848 } 1849 createEmptyCollection()1850 private static SearchAgentsFixedSizeCollection createEmptyCollection() { 1851 return new SearchAgentsFixedSizeCollection(null, 0); 1852 } 1853 1854 @Override createCollection( List<SearchAgentsPage> pages, int collectionSize)1855 protected SearchAgentsFixedSizeCollection createCollection( 1856 List<SearchAgentsPage> pages, int collectionSize) { 1857 return new SearchAgentsFixedSizeCollection(pages, collectionSize); 1858 } 1859 } 1860 1861 public static class ListLocationsPagedResponse 1862 extends AbstractPagedListResponse< 1863 ListLocationsRequest, 1864 ListLocationsResponse, 1865 Location, 1866 ListLocationsPage, 1867 ListLocationsFixedSizeCollection> { 1868 createAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1869 public static ApiFuture<ListLocationsPagedResponse> createAsync( 1870 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 1871 ApiFuture<ListLocationsResponse> futureResponse) { 1872 ApiFuture<ListLocationsPage> futurePage = 1873 ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); 1874 return ApiFutures.transform( 1875 futurePage, 1876 input -> new ListLocationsPagedResponse(input), 1877 MoreExecutors.directExecutor()); 1878 } 1879 ListLocationsPagedResponse(ListLocationsPage page)1880 private ListLocationsPagedResponse(ListLocationsPage page) { 1881 super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); 1882 } 1883 } 1884 1885 public static class ListLocationsPage 1886 extends AbstractPage< 1887 ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { 1888 ListLocationsPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1889 private ListLocationsPage( 1890 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 1891 ListLocationsResponse response) { 1892 super(context, response); 1893 } 1894 createEmptyPage()1895 private static ListLocationsPage createEmptyPage() { 1896 return new ListLocationsPage(null, null); 1897 } 1898 1899 @Override createPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1900 protected ListLocationsPage createPage( 1901 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 1902 ListLocationsResponse response) { 1903 return new ListLocationsPage(context, response); 1904 } 1905 1906 @Override createPageAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1907 public ApiFuture<ListLocationsPage> createPageAsync( 1908 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 1909 ApiFuture<ListLocationsResponse> futureResponse) { 1910 return super.createPageAsync(context, futureResponse); 1911 } 1912 } 1913 1914 public static class ListLocationsFixedSizeCollection 1915 extends AbstractFixedSizeCollection< 1916 ListLocationsRequest, 1917 ListLocationsResponse, 1918 Location, 1919 ListLocationsPage, 1920 ListLocationsFixedSizeCollection> { 1921 ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize)1922 private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) { 1923 super(pages, collectionSize); 1924 } 1925 createEmptyCollection()1926 private static ListLocationsFixedSizeCollection createEmptyCollection() { 1927 return new ListLocationsFixedSizeCollection(null, 0); 1928 } 1929 1930 @Override createCollection( List<ListLocationsPage> pages, int collectionSize)1931 protected ListLocationsFixedSizeCollection createCollection( 1932 List<ListLocationsPage> pages, int collectionSize) { 1933 return new ListLocationsFixedSizeCollection(pages, collectionSize); 1934 } 1935 } 1936 } 1937