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