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