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