com.google.cloud.dialogflow.v2beta1.IntentsClient Maven / Gradle / Ivy
Show all versions of google-cloud-dialogflow Show documentation
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.dialogflow.v2beta1;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.dialogflow.v2beta1.stub.IntentsStub;
import com.google.cloud.dialogflow.v2beta1.stub.IntentsStubSettings;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import com.google.protobuf.Struct;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: Service for managing [Intents][google.cloud.dialogflow.v2beta1.Intent].
*
* This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* IntentName name = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]");
* Intent response = intentsClient.getIntent(name);
* }
* }
*
* Note: close() needs to be called on the IntentsClient object to clean up resources such as
* threads. In the example above, try-with-resources is used, which automatically calls close().
*
*
* Methods
*
* Method
* Description
* Method Variants
*
*
* ListIntents
* Returns the list of all intents in the specified agent.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* listIntents(ListIntentsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listIntents(AgentName parent)
*
listIntents(String parent)
*
listIntents(AgentName parent, String languageCode)
*
listIntents(String parent, String languageCode)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listIntentsPagedCallable()
*
listIntentsCallable()
*
*
*
*
* GetIntent
* Retrieves the specified intent.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getIntent(GetIntentRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getIntent(IntentName name)
*
getIntent(String name)
*
getIntent(IntentName name, String languageCode)
*
getIntent(String name, String languageCode)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getIntentCallable()
*
*
*
*
* CreateIntent
* Creates an intent in the specified agent.
*
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* createIntent(CreateIntentRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* createIntent(AgentName parent, Intent intent)
*
createIntent(String parent, Intent intent)
*
createIntent(AgentName parent, Intent intent, String languageCode)
*
createIntent(String parent, Intent intent, String languageCode)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* createIntentCallable()
*
*
*
*
* UpdateIntent
* Updates the specified intent.
*
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* updateIntent(UpdateIntentRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* updateIntent(Intent intent)
*
updateIntent(Intent intent, FieldMask updateMask)
*
updateIntent(Intent intent, String languageCode)
*
updateIntent(Intent intent, String languageCode, FieldMask updateMask)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* updateIntentCallable()
*
*
*
*
* DeleteIntent
* Deletes the specified intent and its direct or indirect followup intents.
*
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* deleteIntent(DeleteIntentRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* deleteIntent(IntentName name)
*
deleteIntent(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* deleteIntentCallable()
*
*
*
*
* BatchUpdateIntents
* Updates/Creates multiple intents in the specified agent.
*
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
*
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
*
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* batchUpdateIntentsAsync(BatchUpdateIntentsRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* batchUpdateIntentsAsync(AgentName parent, IntentBatch intentBatchInline)
*
batchUpdateIntentsAsync(AgentName parent, String intentBatchUri)
*
batchUpdateIntentsAsync(String parent, IntentBatch intentBatchInline)
*
batchUpdateIntentsAsync(String parent, String intentBatchUri)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* batchUpdateIntentsOperationCallable()
*
batchUpdateIntentsCallable()
*
*
*
*
* BatchDeleteIntents
* Deletes intents in the specified agent.
*
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
*
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
*
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* batchDeleteIntentsAsync(BatchDeleteIntentsRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* batchDeleteIntentsAsync(AgentName parent, List<Intent> intents)
*
batchDeleteIntentsAsync(String parent, List<Intent> intents)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* batchDeleteIntentsOperationCallable()
*
batchDeleteIntentsCallable()
*
*
*
*
* ListLocations
* Lists information about the supported locations for this service.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* listLocations(ListLocationsRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listLocationsPagedCallable()
*
listLocationsCallable()
*
*
*
*
* GetLocation
* Gets information about a location.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getLocation(GetLocationRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getLocationCallable()
*
*
*
*
*
* See the individual methods for example code.
*
*
Many parameters require resource names to be formatted in a particular way. To assist with
* these names, this class includes a format method for each type of name, and additionally a parse
* method to extract the individual identifiers contained within names that are returned.
*
*
This class can be customized by passing in a custom instance of IntentsSettings to create().
* For example:
*
*
To customize credentials:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* IntentsSettings intentsSettings =
* IntentsSettings.newBuilder()
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();
* IntentsClient intentsClient = IntentsClient.create(intentsSettings);
* }
*
* To customize the endpoint:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* IntentsSettings intentsSettings = IntentsSettings.newBuilder().setEndpoint(myEndpoint).build();
* IntentsClient intentsClient = IntentsClient.create(intentsSettings);
* }
*
* To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
* the wire:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* IntentsSettings intentsSettings = IntentsSettings.newHttpJsonBuilder().build();
* IntentsClient intentsClient = IntentsClient.create(intentsSettings);
* }
*
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@BetaApi
@Generated("by gapic-generator-java")
public class IntentsClient implements BackgroundResource {
private final IntentsSettings settings;
private final IntentsStub stub;
private final OperationsClient httpJsonOperationsClient;
private final com.google.longrunning.OperationsClient operationsClient;
/** Constructs an instance of IntentsClient with default settings. */
public static final IntentsClient create() throws IOException {
return create(IntentsSettings.newBuilder().build());
}
/**
* Constructs an instance of IntentsClient, using the given settings. The channels are created
* based on the settings passed in, or defaults for any settings that are not set.
*/
public static final IntentsClient create(IntentsSettings settings) throws IOException {
return new IntentsClient(settings);
}
/**
* Constructs an instance of IntentsClient, using the given stub for making calls. This is for
* advanced usage - prefer using create(IntentsSettings).
*/
public static final IntentsClient create(IntentsStub stub) {
return new IntentsClient(stub);
}
/**
* Constructs an instance of IntentsClient, using the given settings. This is protected so that it
* is easy to make a subclass, but otherwise, the static factory methods should be preferred.
*/
protected IntentsClient(IntentsSettings settings) throws IOException {
this.settings = settings;
this.stub = ((IntentsStubSettings) settings.getStubSettings()).createStub();
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}
protected IntentsClient(IntentsStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}
public final IntentsSettings getSettings() {
return settings;
}
public IntentsStub getStub() {
return stub;
}
/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
public final com.google.longrunning.OperationsClient getOperationsClient() {
return operationsClient;
}
/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
@BetaApi
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the list of all intents in the specified agent.
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* AgentName parent = AgentName.ofProjectName("[PROJECT]");
* for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The agent to list all intents from. Format: `projects/<Project
* ID>/agent` or `projects/<Project ID>/locations/<Location ID>/agent`.
* Alternatively, you can specify the environment to list intents for. Format:
* `projects/<Project ID>/agent/environments/<Environment ID>` or
* `projects/<Project ID>/locations/<Location
* ID>/agent/environments/<Environment ID>`. Note: training phrases of the intents
* will not be returned for non-draft environment.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListIntentsPagedResponse listIntents(AgentName parent) {
ListIntentsRequest request =
ListIntentsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listIntents(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the list of all intents in the specified agent.
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* String parent = AgentName.ofProjectName("[PROJECT]").toString();
* for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The agent to list all intents from. Format: `projects/<Project
* ID>/agent` or `projects/<Project ID>/locations/<Location ID>/agent`.
* Alternatively, you can specify the environment to list intents for. Format:
* `projects/<Project ID>/agent/environments/<Environment ID>` or
* `projects/<Project ID>/locations/<Location
* ID>/agent/environments/<Environment ID>`. Note: training phrases of the intents
* will not be returned for non-draft environment.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListIntentsPagedResponse listIntents(String parent) {
ListIntentsRequest request = ListIntentsRequest.newBuilder().setParent(parent).build();
return listIntents(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the list of all intents in the specified agent.
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* AgentName parent = AgentName.ofProjectName("[PROJECT]");
* String languageCode = "languageCode-2092349083";
* for (Intent element : intentsClient.listIntents(parent, languageCode).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The agent to list all intents from. Format: `projects/<Project
* ID>/agent` or `projects/<Project ID>/locations/<Location ID>/agent`.
* Alternatively, you can specify the environment to list intents for. Format:
* `projects/<Project ID>/agent/environments/<Environment ID>` or
* `projects/<Project ID>/locations/<Location
* ID>/agent/environments/<Environment ID>`. Note: training phrases of the intents
* will not be returned for non-draft environment.
* @param languageCode Optional. The language used to access language-specific data. If not
* specified, the agent's default language is used. For more information, see [Multilingual
* intent and entity
* data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListIntentsPagedResponse listIntents(AgentName parent, String languageCode) {
ListIntentsRequest request =
ListIntentsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setLanguageCode(languageCode)
.build();
return listIntents(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the list of all intents in the specified agent.
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* String parent = AgentName.ofProjectName("[PROJECT]").toString();
* String languageCode = "languageCode-2092349083";
* for (Intent element : intentsClient.listIntents(parent, languageCode).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The agent to list all intents from. Format: `projects/<Project
* ID>/agent` or `projects/<Project ID>/locations/<Location ID>/agent`.
* Alternatively, you can specify the environment to list intents for. Format:
* `projects/<Project ID>/agent/environments/<Environment ID>` or
* `projects/<Project ID>/locations/<Location
* ID>/agent/environments/<Environment ID>`. Note: training phrases of the intents
* will not be returned for non-draft environment.
* @param languageCode Optional. The language used to access language-specific data. If not
* specified, the agent's default language is used. For more information, see [Multilingual
* intent and entity
* data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListIntentsPagedResponse listIntents(String parent, String languageCode) {
ListIntentsRequest request =
ListIntentsRequest.newBuilder().setParent(parent).setLanguageCode(languageCode).build();
return listIntents(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the list of all intents in the specified agent.
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* ListIntentsRequest request =
* ListIntentsRequest.newBuilder()
* .setParent(AgentName.ofProjectName("[PROJECT]").toString())
* .setLanguageCode("languageCode-2092349083")
* .setIntentView(IntentView.forNumber(0))
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (Intent element : intentsClient.listIntents(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListIntentsPagedResponse listIntents(ListIntentsRequest request) {
return listIntentsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the list of all intents in the specified agent.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* ListIntentsRequest request =
* ListIntentsRequest.newBuilder()
* .setParent(AgentName.ofProjectName("[PROJECT]").toString())
* .setLanguageCode("languageCode-2092349083")
* .setIntentView(IntentView.forNumber(0))
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future = intentsClient.listIntentsPagedCallable().futureCall(request);
* // Do something.
* for (Intent element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listIntentsPagedCallable() {
return stub.listIntentsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the list of all intents in the specified agent.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* ListIntentsRequest request =
* ListIntentsRequest.newBuilder()
* .setParent(AgentName.ofProjectName("[PROJECT]").toString())
* .setLanguageCode("languageCode-2092349083")
* .setIntentView(IntentView.forNumber(0))
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListIntentsResponse response = intentsClient.listIntentsCallable().call(request);
* for (Intent element : response.getIntentsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable listIntentsCallable() {
return stub.listIntentsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified intent.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* IntentName name = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]");
* Intent response = intentsClient.getIntent(name);
* }
* }
*
* @param name Required. The name of the intent. Supported formats:
* - `projects/<Project ID>/agent/intents/<Intent ID>` - `projects/<Project
* ID>/locations/<Location ID>/agent/intents/<Intent ID>`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent getIntent(IntentName name) {
GetIntentRequest request =
GetIntentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified intent.
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* String name = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString();
* Intent response = intentsClient.getIntent(name);
* }
* }
*
* @param name Required. The name of the intent. Supported formats:
* - `projects/<Project ID>/agent/intents/<Intent ID>` - `projects/<Project
* ID>/locations/<Location ID>/agent/intents/<Intent ID>`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent getIntent(String name) {
GetIntentRequest request = GetIntentRequest.newBuilder().setName(name).build();
return getIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified intent.
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* IntentName name = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]");
* String languageCode = "languageCode-2092349083";
* Intent response = intentsClient.getIntent(name, languageCode);
* }
* }
*
* @param name Required. The name of the intent. Supported formats:
* - `projects/<Project ID>/agent/intents/<Intent ID>` - `projects/<Project
* ID>/locations/<Location ID>/agent/intents/<Intent ID>`
* @param languageCode Optional. The language used to access language-specific data. If not
* specified, the agent's default language is used. For more information, see [Multilingual
* intent and entity
* data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent getIntent(IntentName name, String languageCode) {
GetIntentRequest request =
GetIntentRequest.newBuilder()
.setName(name == null ? null : name.toString())
.setLanguageCode(languageCode)
.build();
return getIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified intent.
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* String name = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString();
* String languageCode = "languageCode-2092349083";
* Intent response = intentsClient.getIntent(name, languageCode);
* }
* }
*
* @param name Required. The name of the intent. Supported formats:
* - `projects/<Project ID>/agent/intents/<Intent ID>` - `projects/<Project
* ID>/locations/<Location ID>/agent/intents/<Intent ID>`
* @param languageCode Optional. The language used to access language-specific data. If not
* specified, the agent's default language is used. For more information, see [Multilingual
* intent and entity
* data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent getIntent(String name, String languageCode) {
GetIntentRequest request =
GetIntentRequest.newBuilder().setName(name).setLanguageCode(languageCode).build();
return getIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified intent.
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* GetIntentRequest request =
* GetIntentRequest.newBuilder()
* .setName(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
* .setLanguageCode("languageCode-2092349083")
* .setIntentView(IntentView.forNumber(0))
* .build();
* Intent response = intentsClient.getIntent(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent getIntent(GetIntentRequest request) {
return getIntentCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified intent.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* GetIntentRequest request =
* GetIntentRequest.newBuilder()
* .setName(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
* .setLanguageCode("languageCode-2092349083")
* .setIntentView(IntentView.forNumber(0))
* .build();
* ApiFuture future = intentsClient.getIntentCallable().futureCall(request);
* // Do something.
* Intent response = future.get();
* }
* }
*/
public final UnaryCallable getIntentCallable() {
return stub.getIntentCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates an intent in the specified agent.
*
* Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* AgentName parent = AgentName.ofProjectName("[PROJECT]");
* Intent intent = Intent.newBuilder().build();
* Intent response = intentsClient.createIntent(parent, intent);
* }
* }
*
* @param parent Required. The agent to create a intent for. Supported formats:
* - `projects/<Project ID>/agent` - `projects/<Project
* ID>/locations/<Location ID>/agent`
* @param intent Required. The intent to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent createIntent(AgentName parent, Intent intent) {
CreateIntentRequest request =
CreateIntentRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setIntent(intent)
.build();
return createIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates an intent in the specified agent.
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* String parent = AgentName.ofProjectName("[PROJECT]").toString();
* Intent intent = Intent.newBuilder().build();
* Intent response = intentsClient.createIntent(parent, intent);
* }
* }
*
* @param parent Required. The agent to create a intent for. Supported formats:
* - `projects/<Project ID>/agent` - `projects/<Project
* ID>/locations/<Location ID>/agent`
* @param intent Required. The intent to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent createIntent(String parent, Intent intent) {
CreateIntentRequest request =
CreateIntentRequest.newBuilder().setParent(parent).setIntent(intent).build();
return createIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates an intent in the specified agent.
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* AgentName parent = AgentName.ofProjectName("[PROJECT]");
* Intent intent = Intent.newBuilder().build();
* String languageCode = "languageCode-2092349083";
* Intent response = intentsClient.createIntent(parent, intent, languageCode);
* }
* }
*
* @param parent Required. The agent to create a intent for. Supported formats:
* - `projects/<Project ID>/agent` - `projects/<Project
* ID>/locations/<Location ID>/agent`
* @param intent Required. The intent to create.
* @param languageCode Optional. The language used to access language-specific data. If not
* specified, the agent's default language is used. For more information, see [Multilingual
* intent and entity
* data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent createIntent(AgentName parent, Intent intent, String languageCode) {
CreateIntentRequest request =
CreateIntentRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setIntent(intent)
.setLanguageCode(languageCode)
.build();
return createIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates an intent in the specified agent.
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* String parent = AgentName.ofProjectName("[PROJECT]").toString();
* Intent intent = Intent.newBuilder().build();
* String languageCode = "languageCode-2092349083";
* Intent response = intentsClient.createIntent(parent, intent, languageCode);
* }
* }
*
* @param parent Required. The agent to create a intent for. Supported formats:
* - `projects/<Project ID>/agent` - `projects/<Project
* ID>/locations/<Location ID>/agent`
* @param intent Required. The intent to create.
* @param languageCode Optional. The language used to access language-specific data. If not
* specified, the agent's default language is used. For more information, see [Multilingual
* intent and entity
* data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent createIntent(String parent, Intent intent, String languageCode) {
CreateIntentRequest request =
CreateIntentRequest.newBuilder()
.setParent(parent)
.setIntent(intent)
.setLanguageCode(languageCode)
.build();
return createIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates an intent in the specified agent.
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* CreateIntentRequest request =
* CreateIntentRequest.newBuilder()
* .setParent(AgentName.ofProjectName("[PROJECT]").toString())
* .setIntent(Intent.newBuilder().build())
* .setLanguageCode("languageCode-2092349083")
* .setIntentView(IntentView.forNumber(0))
* .build();
* Intent response = intentsClient.createIntent(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent createIntent(CreateIntentRequest request) {
return createIntentCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates an intent in the specified agent.
*
* Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* CreateIntentRequest request =
* CreateIntentRequest.newBuilder()
* .setParent(AgentName.ofProjectName("[PROJECT]").toString())
* .setIntent(Intent.newBuilder().build())
* .setLanguageCode("languageCode-2092349083")
* .setIntentView(IntentView.forNumber(0))
* .build();
* ApiFuture future = intentsClient.createIntentCallable().futureCall(request);
* // Do something.
* Intent response = future.get();
* }
* }
*/
public final UnaryCallable createIntentCallable() {
return stub.createIntentCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the specified intent.
*
* Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* Intent intent = Intent.newBuilder().build();
* Intent response = intentsClient.updateIntent(intent);
* }
* }
*
* @param intent Required. The intent to update.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent updateIntent(Intent intent) {
UpdateIntentRequest request = UpdateIntentRequest.newBuilder().setIntent(intent).build();
return updateIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the specified intent.
*
* Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* Intent intent = Intent.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* Intent response = intentsClient.updateIntent(intent, updateMask);
* }
* }
*
* @param intent Required. The intent to update.
* @param updateMask Optional. The mask to control which fields get updated.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent updateIntent(Intent intent, FieldMask updateMask) {
UpdateIntentRequest request =
UpdateIntentRequest.newBuilder().setIntent(intent).setUpdateMask(updateMask).build();
return updateIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the specified intent.
*
* Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* Intent intent = Intent.newBuilder().build();
* String languageCode = "languageCode-2092349083";
* Intent response = intentsClient.updateIntent(intent, languageCode);
* }
* }
*
* @param intent Required. The intent to update.
* @param languageCode Optional. The language used to access language-specific data. If not
* specified, the agent's default language is used. For more information, see [Multilingual
* intent and entity
* data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent updateIntent(Intent intent, String languageCode) {
UpdateIntentRequest request =
UpdateIntentRequest.newBuilder().setIntent(intent).setLanguageCode(languageCode).build();
return updateIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the specified intent.
*
* Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* Intent intent = Intent.newBuilder().build();
* String languageCode = "languageCode-2092349083";
* FieldMask updateMask = FieldMask.newBuilder().build();
* Intent response = intentsClient.updateIntent(intent, languageCode, updateMask);
* }
* }
*
* @param intent Required. The intent to update.
* @param languageCode Optional. The language used to access language-specific data. If not
* specified, the agent's default language is used. For more information, see [Multilingual
* intent and entity
* data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
* @param updateMask Optional. The mask to control which fields get updated.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent updateIntent(Intent intent, String languageCode, FieldMask updateMask) {
UpdateIntentRequest request =
UpdateIntentRequest.newBuilder()
.setIntent(intent)
.setLanguageCode(languageCode)
.setUpdateMask(updateMask)
.build();
return updateIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the specified intent.
*
* Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* UpdateIntentRequest request =
* UpdateIntentRequest.newBuilder()
* .setIntent(Intent.newBuilder().build())
* .setLanguageCode("languageCode-2092349083")
* .setUpdateMask(FieldMask.newBuilder().build())
* .setIntentView(IntentView.forNumber(0))
* .build();
* Intent response = intentsClient.updateIntent(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Intent updateIntent(UpdateIntentRequest request) {
return updateIntentCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the specified intent.
*
* Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* UpdateIntentRequest request =
* UpdateIntentRequest.newBuilder()
* .setIntent(Intent.newBuilder().build())
* .setLanguageCode("languageCode-2092349083")
* .setUpdateMask(FieldMask.newBuilder().build())
* .setIntentView(IntentView.forNumber(0))
* .build();
* ApiFuture future = intentsClient.updateIntentCallable().futureCall(request);
* // Do something.
* Intent response = future.get();
* }
* }
*/
public final UnaryCallable updateIntentCallable() {
return stub.updateIntentCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the specified intent and its direct or indirect followup intents.
*
* Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* IntentName name = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]");
* intentsClient.deleteIntent(name);
* }
* }
*
* @param name Required. The name of the intent to delete. If this intent has direct or indirect
* followup intents, we also delete them.
* Supported formats:
*
- `projects/<Project ID>/agent/intents/<Intent ID>` - `projects/<Project
* ID>/locations/<Location ID>/agent/intents/<Intent ID>`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteIntent(IntentName name) {
DeleteIntentRequest request =
DeleteIntentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
deleteIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the specified intent and its direct or indirect followup intents.
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* String name = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString();
* intentsClient.deleteIntent(name);
* }
* }
*
* @param name Required. The name of the intent to delete. If this intent has direct or indirect
* followup intents, we also delete them.
* Supported formats:
*
- `projects/<Project ID>/agent/intents/<Intent ID>` - `projects/<Project
* ID>/locations/<Location ID>/agent/intents/<Intent ID>`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteIntent(String name) {
DeleteIntentRequest request = DeleteIntentRequest.newBuilder().setName(name).build();
deleteIntent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the specified intent and its direct or indirect followup intents.
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* DeleteIntentRequest request =
* DeleteIntentRequest.newBuilder()
* .setName(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
* .build();
* intentsClient.deleteIntent(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteIntent(DeleteIntentRequest request) {
deleteIntentCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the specified intent and its direct or indirect followup intents.
*
* Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* DeleteIntentRequest request =
* DeleteIntentRequest.newBuilder()
* .setName(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
* .build();
* ApiFuture future = intentsClient.deleteIntentCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable deleteIntentCallable() {
return stub.deleteIntentCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates/Creates multiple intents in the specified agent.
*
* This method is a [long-running
* operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The
* returned `Operation` type has the following method-specific fields:
*
*
- `metadata`: An empty [Struct
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
* - `response`:
* [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* AgentName parent = AgentName.ofProjectName("[PROJECT]");
* IntentBatch intentBatchInline = IntentBatch.newBuilder().build();
* BatchUpdateIntentsResponse response =
* intentsClient.batchUpdateIntentsAsync(parent, intentBatchInline).get();
* }
* }
*
* @param parent Required. The name of the agent to update or create intents in. Supported
* formats:
* - `projects/<Project ID>/agent` - `projects/<Project
* ID>/locations/<Location ID>/agent`
* @param intentBatchInline The collection of intents to update or create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture batchUpdateIntentsAsync(
AgentName parent, IntentBatch intentBatchInline) {
BatchUpdateIntentsRequest request =
BatchUpdateIntentsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setIntentBatchInline(intentBatchInline)
.build();
return batchUpdateIntentsAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates/Creates multiple intents in the specified agent.
*
* This method is a [long-running
* operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The
* returned `Operation` type has the following method-specific fields:
*
*
- `metadata`: An empty [Struct
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
* - `response`:
* [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* AgentName parent = AgentName.ofProjectName("[PROJECT]");
* String intentBatchUri = "intentBatchUri544125582";
* BatchUpdateIntentsResponse response =
* intentsClient.batchUpdateIntentsAsync(parent, intentBatchUri).get();
* }
* }
*
* @param parent Required. The name of the agent to update or create intents in. Supported
* formats:
* - `projects/<Project ID>/agent` - `projects/<Project
* ID>/locations/<Location ID>/agent`
* @param intentBatchUri The URI to a Google Cloud Storage file containing intents to update or
* create. The file format can either be a serialized proto (of IntentBatch type) or JSON
* object. Note: The URI must start with "gs://".
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture batchUpdateIntentsAsync(
AgentName parent, String intentBatchUri) {
BatchUpdateIntentsRequest request =
BatchUpdateIntentsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setIntentBatchUri(intentBatchUri)
.build();
return batchUpdateIntentsAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates/Creates multiple intents in the specified agent.
*
* This method is a [long-running
* operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The
* returned `Operation` type has the following method-specific fields:
*
*
- `metadata`: An empty [Struct
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
* - `response`:
* [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* String parent = AgentName.ofProjectName("[PROJECT]").toString();
* IntentBatch intentBatchInline = IntentBatch.newBuilder().build();
* BatchUpdateIntentsResponse response =
* intentsClient.batchUpdateIntentsAsync(parent, intentBatchInline).get();
* }
* }
*
* @param parent Required. The name of the agent to update or create intents in. Supported
* formats:
* - `projects/<Project ID>/agent` - `projects/<Project
* ID>/locations/<Location ID>/agent`
* @param intentBatchInline The collection of intents to update or create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture batchUpdateIntentsAsync(
String parent, IntentBatch intentBatchInline) {
BatchUpdateIntentsRequest request =
BatchUpdateIntentsRequest.newBuilder()
.setParent(parent)
.setIntentBatchInline(intentBatchInline)
.build();
return batchUpdateIntentsAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates/Creates multiple intents in the specified agent.
*
* This method is a [long-running
* operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The
* returned `Operation` type has the following method-specific fields:
*
*
- `metadata`: An empty [Struct
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
* - `response`:
* [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* String parent = AgentName.ofProjectName("[PROJECT]").toString();
* String intentBatchUri = "intentBatchUri544125582";
* BatchUpdateIntentsResponse response =
* intentsClient.batchUpdateIntentsAsync(parent, intentBatchUri).get();
* }
* }
*
* @param parent Required. The name of the agent to update or create intents in. Supported
* formats:
* - `projects/<Project ID>/agent` - `projects/<Project
* ID>/locations/<Location ID>/agent`
* @param intentBatchUri The URI to a Google Cloud Storage file containing intents to update or
* create. The file format can either be a serialized proto (of IntentBatch type) or JSON
* object. Note: The URI must start with "gs://".
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture batchUpdateIntentsAsync(
String parent, String intentBatchUri) {
BatchUpdateIntentsRequest request =
BatchUpdateIntentsRequest.newBuilder()
.setParent(parent)
.setIntentBatchUri(intentBatchUri)
.build();
return batchUpdateIntentsAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates/Creates multiple intents in the specified agent.
*
* This method is a [long-running
* operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The
* returned `Operation` type has the following method-specific fields:
*
*
- `metadata`: An empty [Struct
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
* - `response`:
* [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* BatchUpdateIntentsRequest request =
* BatchUpdateIntentsRequest.newBuilder()
* .setParent(AgentName.ofProjectName("[PROJECT]").toString())
* .setLanguageCode("languageCode-2092349083")
* .setUpdateMask(FieldMask.newBuilder().build())
* .setIntentView(IntentView.forNumber(0))
* .build();
* BatchUpdateIntentsResponse response = intentsClient.batchUpdateIntentsAsync(request).get();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture batchUpdateIntentsAsync(
BatchUpdateIntentsRequest request) {
return batchUpdateIntentsOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates/Creates multiple intents in the specified agent.
*
* This method is a [long-running
* operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The
* returned `Operation` type has the following method-specific fields:
*
*
- `metadata`: An empty [Struct
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
* - `response`:
* [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* BatchUpdateIntentsRequest request =
* BatchUpdateIntentsRequest.newBuilder()
* .setParent(AgentName.ofProjectName("[PROJECT]").toString())
* .setLanguageCode("languageCode-2092349083")
* .setUpdateMask(FieldMask.newBuilder().build())
* .setIntentView(IntentView.forNumber(0))
* .build();
* OperationFuture future =
* intentsClient.batchUpdateIntentsOperationCallable().futureCall(request);
* // Do something.
* BatchUpdateIntentsResponse response = future.get();
* }
* }
*/
public final OperationCallable
batchUpdateIntentsOperationCallable() {
return stub.batchUpdateIntentsOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates/Creates multiple intents in the specified agent.
*
* This method is a [long-running
* operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The
* returned `Operation` type has the following method-specific fields:
*
*
- `metadata`: An empty [Struct
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
* - `response`:
* [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* BatchUpdateIntentsRequest request =
* BatchUpdateIntentsRequest.newBuilder()
* .setParent(AgentName.ofProjectName("[PROJECT]").toString())
* .setLanguageCode("languageCode-2092349083")
* .setUpdateMask(FieldMask.newBuilder().build())
* .setIntentView(IntentView.forNumber(0))
* .build();
* ApiFuture future = intentsClient.batchUpdateIntentsCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable batchUpdateIntentsCallable() {
return stub.batchUpdateIntentsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes intents in the specified agent.
*
* This method is a [long-running
* operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The
* returned `Operation` type has the following method-specific fields:
*
*
- `metadata`: An empty [Struct
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
* - `response`: An [Empty
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* AgentName parent = AgentName.ofProjectName("[PROJECT]");
* List intents = new ArrayList<>();
* intentsClient.batchDeleteIntentsAsync(parent, intents).get();
* }
* }
*
* @param parent Required. The name of the agent to delete all entities types for. Supported
* formats:
* - `projects/<Project ID>/agent` - `projects/<Project
* ID>/locations/<Location ID>/agent`
* @param intents Required. The collection of intents to delete. Only intent `name` must be filled
* in.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture batchDeleteIntentsAsync(
AgentName parent, List intents) {
BatchDeleteIntentsRequest request =
BatchDeleteIntentsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.addAllIntents(intents)
.build();
return batchDeleteIntentsAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes intents in the specified agent.
*
* This method is a [long-running
* operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The
* returned `Operation` type has the following method-specific fields:
*
*
- `metadata`: An empty [Struct
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
* - `response`: An [Empty
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* String parent = AgentName.ofProjectName("[PROJECT]").toString();
* List intents = new ArrayList<>();
* intentsClient.batchDeleteIntentsAsync(parent, intents).get();
* }
* }
*
* @param parent Required. The name of the agent to delete all entities types for. Supported
* formats:
* - `projects/<Project ID>/agent` - `projects/<Project
* ID>/locations/<Location ID>/agent`
* @param intents Required. The collection of intents to delete. Only intent `name` must be filled
* in.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture batchDeleteIntentsAsync(
String parent, List intents) {
BatchDeleteIntentsRequest request =
BatchDeleteIntentsRequest.newBuilder().setParent(parent).addAllIntents(intents).build();
return batchDeleteIntentsAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes intents in the specified agent.
*
* This method is a [long-running
* operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The
* returned `Operation` type has the following method-specific fields:
*
*
- `metadata`: An empty [Struct
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
* - `response`: An [Empty
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* BatchDeleteIntentsRequest request =
* BatchDeleteIntentsRequest.newBuilder()
* .setParent(AgentName.ofProjectName("[PROJECT]").toString())
* .addAllIntents(new ArrayList())
* .build();
* intentsClient.batchDeleteIntentsAsync(request).get();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture batchDeleteIntentsAsync(
BatchDeleteIntentsRequest request) {
return batchDeleteIntentsOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes intents in the specified agent.
*
* This method is a [long-running
* operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The
* returned `Operation` type has the following method-specific fields:
*
*
- `metadata`: An empty [Struct
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
* - `response`: An [Empty
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* BatchDeleteIntentsRequest request =
* BatchDeleteIntentsRequest.newBuilder()
* .setParent(AgentName.ofProjectName("[PROJECT]").toString())
* .addAllIntents(new ArrayList())
* .build();
* OperationFuture future =
* intentsClient.batchDeleteIntentsOperationCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final OperationCallable
batchDeleteIntentsOperationCallable() {
return stub.batchDeleteIntentsOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes intents in the specified agent.
*
* This method is a [long-running
* operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The
* returned `Operation` type has the following method-specific fields:
*
*
- `metadata`: An empty [Struct
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
* - `response`: An [Empty
* message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
*
*
Note: You should always train an agent prior to sending it queries. See the [training
* documentation](https://cloud.google.com/dialogflow/es/docs/training).
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* BatchDeleteIntentsRequest request =
* BatchDeleteIntentsRequest.newBuilder()
* .setParent(AgentName.ofProjectName("[PROJECT]").toString())
* .addAllIntents(new ArrayList())
* .build();
* ApiFuture future = intentsClient.batchDeleteIntentsCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable batchDeleteIntentsCallable() {
return stub.batchDeleteIntentsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* ListLocationsRequest request =
* ListLocationsRequest.newBuilder()
* .setName("name3373707")
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (Location element : intentsClient.listLocations(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
return listLocationsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* ListLocationsRequest request =
* ListLocationsRequest.newBuilder()
* .setName("name3373707")
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future = intentsClient.listLocationsPagedCallable().futureCall(request);
* // Do something.
* for (Location element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listLocationsPagedCallable() {
return stub.listLocationsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* ListLocationsRequest request =
* ListLocationsRequest.newBuilder()
* .setName("name3373707")
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListLocationsResponse response = intentsClient.listLocationsCallable().call(request);
* for (Location element : response.getLocationsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable listLocationsCallable() {
return stub.listLocationsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a location.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
* Location response = intentsClient.getLocation(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Location getLocation(GetLocationRequest request) {
return getLocationCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a location.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
* ApiFuture future = intentsClient.getLocationCallable().futureCall(request);
* // Do something.
* Location response = future.get();
* }
* }
*/
public final UnaryCallable getLocationCallable() {
return stub.getLocationCallable();
}
@Override
public final void close() {
stub.close();
}
@Override
public void shutdown() {
stub.shutdown();
}
@Override
public boolean isShutdown() {
return stub.isShutdown();
}
@Override
public boolean isTerminated() {
return stub.isTerminated();
}
@Override
public void shutdownNow() {
stub.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return stub.awaitTermination(duration, unit);
}
public static class ListIntentsPagedResponse
extends AbstractPagedListResponse<
ListIntentsRequest,
ListIntentsResponse,
Intent,
ListIntentsPage,
ListIntentsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListIntentsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage, input -> new ListIntentsPagedResponse(input), MoreExecutors.directExecutor());
}
private ListIntentsPagedResponse(ListIntentsPage page) {
super(page, ListIntentsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListIntentsPage
extends AbstractPage {
private ListIntentsPage(
PageContext context,
ListIntentsResponse response) {
super(context, response);
}
private static ListIntentsPage createEmptyPage() {
return new ListIntentsPage(null, null);
}
@Override
protected ListIntentsPage createPage(
PageContext context,
ListIntentsResponse response) {
return new ListIntentsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListIntentsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListIntentsRequest,
ListIntentsResponse,
Intent,
ListIntentsPage,
ListIntentsFixedSizeCollection> {
private ListIntentsFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListIntentsFixedSizeCollection createEmptyCollection() {
return new ListIntentsFixedSizeCollection(null, 0);
}
@Override
protected ListIntentsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListIntentsFixedSizeCollection(pages, collectionSize);
}
}
public static class ListLocationsPagedResponse
extends AbstractPagedListResponse<
ListLocationsRequest,
ListLocationsResponse,
Location,
ListLocationsPage,
ListLocationsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListLocationsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListLocationsPagedResponse(ListLocationsPage page) {
super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListLocationsPage
extends AbstractPage<
ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
private ListLocationsPage(
PageContext context,
ListLocationsResponse response) {
super(context, response);
}
private static ListLocationsPage createEmptyPage() {
return new ListLocationsPage(null, null);
}
@Override
protected ListLocationsPage createPage(
PageContext context,
ListLocationsResponse response) {
return new ListLocationsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListLocationsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListLocationsRequest,
ListLocationsResponse,
Location,
ListLocationsPage,
ListLocationsFixedSizeCollection> {
private ListLocationsFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListLocationsFixedSizeCollection createEmptyCollection() {
return new ListLocationsFixedSizeCollection(null, 0);
}
@Override
protected ListLocationsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListLocationsFixedSizeCollection(pages, collectionSize);
}
}
}