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