@Generated(value="by gapic-generator-java") public class ConversationModelsClient extends Object implements BackgroundResource
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:
// 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
String name = "name3373707";
ConversationModel response = conversationModelsClient.getConversationModel(name);
}
Note: close() needs to be called on the ConversationModelsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
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 ConversationModelsSettings to create(). For example:
To customize credentials:
// 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
ConversationModelsSettings conversationModelsSettings =
ConversationModelsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ConversationModelsClient conversationModelsClient =
ConversationModelsClient.create(conversationModelsSettings);
To customize the endpoint:
// 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
ConversationModelsSettings conversationModelsSettings =
ConversationModelsSettings.newBuilder().setEndpoint(myEndpoint).build();
ConversationModelsClient conversationModelsClient =
ConversationModelsClient.create(conversationModelsSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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
ConversationModelsSettings conversationModelsSettings =
ConversationModelsSettings.newBuilder()
.setTransportChannelProvider(
ConversationModelsSettings.defaultHttpJsonTransportProviderBuilder().build())
.build();
ConversationModelsClient conversationModelsClient =
ConversationModelsClient.create(conversationModelsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Modifier and Type | Class and Description |
---|---|
static class |
ConversationModelsClient.ListConversationModelEvaluationsFixedSizeCollection |
static class |
ConversationModelsClient.ListConversationModelEvaluationsPage |
static class |
ConversationModelsClient.ListConversationModelEvaluationsPagedResponse |
static class |
ConversationModelsClient.ListConversationModelsFixedSizeCollection |
static class |
ConversationModelsClient.ListConversationModelsPage |
static class |
ConversationModelsClient.ListConversationModelsPagedResponse |
static class |
ConversationModelsClient.ListLocationsFixedSizeCollection |
static class |
ConversationModelsClient.ListLocationsPage |
static class |
ConversationModelsClient.ListLocationsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
ConversationModelsClient(ConversationModelsSettings settings)
Constructs an instance of ConversationModelsClient, using the given settings.
|
protected |
ConversationModelsClient(ConversationModelsStub stub) |
protected ConversationModelsClient(ConversationModelsSettings settings) throws IOException
IOException
protected ConversationModelsClient(ConversationModelsStub stub)
public static final ConversationModelsClient create() throws IOException
IOException
public static final ConversationModelsClient create(ConversationModelsSettings settings) throws IOException
IOException
public static final ConversationModelsClient create(ConversationModelsStub stub)
public final ConversationModelsSettings getSettings()
public ConversationModelsStub getStub()
public final OperationsClient getOperationsClient()
@BetaApi public final OperationsClient getHttpJsonOperationsClient()
public final OperationFuture<ConversationModel,CreateConversationModelOperationMetadata> createConversationModelAsync(String parent, ConversationModel conversationModel)
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`: [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata] - `response`: [ConversationModel][google.cloud.dialogflow.v2.ConversationModel]
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
String parent = "parent-995424086";
ConversationModel conversationModel = ConversationModel.newBuilder().build();
ConversationModel response =
conversationModelsClient.createConversationModelAsync(parent, conversationModel).get();
}
parent
- The project to create conversation model for. Format: `projects/<Project
ID>`conversationModel
- Required. The conversation model to create.ApiException
- if the remote call failspublic final OperationFuture<ConversationModel,CreateConversationModelOperationMetadata> createConversationModelAsync(CreateConversationModelRequest request)
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`: [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata] - `response`: [ConversationModel][google.cloud.dialogflow.v2.ConversationModel]
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
CreateConversationModelRequest request =
CreateConversationModelRequest.newBuilder()
.setParent("parent-995424086")
.setConversationModel(ConversationModel.newBuilder().build())
.build();
ConversationModel response =
conversationModelsClient.createConversationModelAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final OperationCallable<CreateConversationModelRequest,ConversationModel,CreateConversationModelOperationMetadata> createConversationModelOperationCallable()
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`: [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata] - `response`: [ConversationModel][google.cloud.dialogflow.v2.ConversationModel]
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
CreateConversationModelRequest request =
CreateConversationModelRequest.newBuilder()
.setParent("parent-995424086")
.setConversationModel(ConversationModel.newBuilder().build())
.build();
OperationFuture<ConversationModel, CreateConversationModelOperationMetadata> future =
conversationModelsClient.createConversationModelOperationCallable().futureCall(request);
// Do something.
ConversationModel response = future.get();
}
public final UnaryCallable<CreateConversationModelRequest,Operation> createConversationModelCallable()
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`: [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata] - `response`: [ConversationModel][google.cloud.dialogflow.v2.ConversationModel]
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
CreateConversationModelRequest request =
CreateConversationModelRequest.newBuilder()
.setParent("parent-995424086")
.setConversationModel(ConversationModel.newBuilder().build())
.build();
ApiFuture<Operation> future =
conversationModelsClient.createConversationModelCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final ConversationModel getConversationModel(String name)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
String name = "name3373707";
ConversationModel response = conversationModelsClient.getConversationModel(name);
}
name
- Required. The conversation model to retrieve. Format: `projects/<Project
ID>/conversationModels/<Conversation Model ID>`ApiException
- if the remote call failspublic final ConversationModel getConversationModel(GetConversationModelRequest request)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
GetConversationModelRequest request =
GetConversationModelRequest.newBuilder().setName("name3373707").build();
ConversationModel response = conversationModelsClient.getConversationModel(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<GetConversationModelRequest,ConversationModel> getConversationModelCallable()
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
GetConversationModelRequest request =
GetConversationModelRequest.newBuilder().setName("name3373707").build();
ApiFuture<ConversationModel> future =
conversationModelsClient.getConversationModelCallable().futureCall(request);
// Do something.
ConversationModel response = future.get();
}
public final ConversationModelsClient.ListConversationModelsPagedResponse listConversationModels(String parent)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
String parent = "parent-995424086";
for (ConversationModel element :
conversationModelsClient.listConversationModels(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The project to list all conversation models for. Format:
`projects/<Project ID>`ApiException
- if the remote call failspublic final ConversationModelsClient.ListConversationModelsPagedResponse listConversationModels(ListConversationModelsRequest request)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
ListConversationModelsRequest request =
ListConversationModelsRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (ConversationModel element :
conversationModelsClient.listConversationModels(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<ListConversationModelsRequest,ConversationModelsClient.ListConversationModelsPagedResponse> listConversationModelsPagedCallable()
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
ListConversationModelsRequest request =
ListConversationModelsRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<ConversationModel> future =
conversationModelsClient.listConversationModelsPagedCallable().futureCall(request);
// Do something.
for (ConversationModel element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListConversationModelsRequest,ListConversationModelsResponse> listConversationModelsCallable()
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
ListConversationModelsRequest request =
ListConversationModelsRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListConversationModelsResponse response =
conversationModelsClient.listConversationModelsCallable().call(request);
for (ConversationModel element : response.getConversationModelsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final OperationFuture<Empty,DeleteConversationModelOperationMetadata> deleteConversationModelAsync(String name)
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`: [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
String name = "name3373707";
conversationModelsClient.deleteConversationModelAsync(name).get();
}
name
- Required. The conversation model to delete. Format: `projects/<Project
ID>/conversationModels/<Conversation Model ID>`ApiException
- if the remote call failspublic final OperationFuture<Empty,DeleteConversationModelOperationMetadata> deleteConversationModelAsync(DeleteConversationModelRequest request)
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`: [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
DeleteConversationModelRequest request =
DeleteConversationModelRequest.newBuilder().setName("name3373707").build();
conversationModelsClient.deleteConversationModelAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final OperationCallable<DeleteConversationModelRequest,Empty,DeleteConversationModelOperationMetadata> deleteConversationModelOperationCallable()
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`: [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
DeleteConversationModelRequest request =
DeleteConversationModelRequest.newBuilder().setName("name3373707").build();
OperationFuture<Empty, DeleteConversationModelOperationMetadata> future =
conversationModelsClient.deleteConversationModelOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final UnaryCallable<DeleteConversationModelRequest,Operation> deleteConversationModelCallable()
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`: [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
DeleteConversationModelRequest request =
DeleteConversationModelRequest.newBuilder().setName("name3373707").build();
ApiFuture<Operation> future =
conversationModelsClient.deleteConversationModelCallable().futureCall(request);
// Do something.
future.get();
}
public final OperationFuture<Empty,DeployConversationModelOperationMetadata> deployConversationModelAsync(DeployConversationModelRequest request)
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`: [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
DeployConversationModelRequest request =
DeployConversationModelRequest.newBuilder().setName("name3373707").build();
conversationModelsClient.deployConversationModelAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final OperationCallable<DeployConversationModelRequest,Empty,DeployConversationModelOperationMetadata> deployConversationModelOperationCallable()
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`: [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
DeployConversationModelRequest request =
DeployConversationModelRequest.newBuilder().setName("name3373707").build();
OperationFuture<Empty, DeployConversationModelOperationMetadata> future =
conversationModelsClient.deployConversationModelOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final UnaryCallable<DeployConversationModelRequest,Operation> deployConversationModelCallable()
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`: [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
DeployConversationModelRequest request =
DeployConversationModelRequest.newBuilder().setName("name3373707").build();
ApiFuture<Operation> future =
conversationModelsClient.deployConversationModelCallable().futureCall(request);
// Do something.
future.get();
}
public final OperationFuture<Empty,UndeployConversationModelOperationMetadata> undeployConversationModelAsync(UndeployConversationModelRequest request)
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`: [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
UndeployConversationModelRequest request =
UndeployConversationModelRequest.newBuilder().setName("name3373707").build();
conversationModelsClient.undeployConversationModelAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final OperationCallable<UndeployConversationModelRequest,Empty,UndeployConversationModelOperationMetadata> undeployConversationModelOperationCallable()
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`: [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
UndeployConversationModelRequest request =
UndeployConversationModelRequest.newBuilder().setName("name3373707").build();
OperationFuture<Empty, UndeployConversationModelOperationMetadata> future =
conversationModelsClient.undeployConversationModelOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final UnaryCallable<UndeployConversationModelRequest,Operation> undeployConversationModelCallable()
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`: [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
UndeployConversationModelRequest request =
UndeployConversationModelRequest.newBuilder().setName("name3373707").build();
ApiFuture<Operation> future =
conversationModelsClient.undeployConversationModelCallable().futureCall(request);
// Do something.
future.get();
}
public final ConversationModelEvaluation getConversationModelEvaluation(String name)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
String name = "name3373707";
ConversationModelEvaluation response =
conversationModelsClient.getConversationModelEvaluation(name);
}
name
- Required. The conversation model evaluation resource name. Format:
`projects/<Project ID>/conversationModels/<Conversation Model
ID>/evaluations/<Evaluation ID>`ApiException
- if the remote call failspublic final ConversationModelEvaluation getConversationModelEvaluation(GetConversationModelEvaluationRequest request)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
GetConversationModelEvaluationRequest request =
GetConversationModelEvaluationRequest.newBuilder().setName("name3373707").build();
ConversationModelEvaluation response =
conversationModelsClient.getConversationModelEvaluation(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<GetConversationModelEvaluationRequest,ConversationModelEvaluation> getConversationModelEvaluationCallable()
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
GetConversationModelEvaluationRequest request =
GetConversationModelEvaluationRequest.newBuilder().setName("name3373707").build();
ApiFuture<ConversationModelEvaluation> future =
conversationModelsClient.getConversationModelEvaluationCallable().futureCall(request);
// Do something.
ConversationModelEvaluation response = future.get();
}
public final ConversationModelsClient.ListConversationModelEvaluationsPagedResponse listConversationModelEvaluations(String parent)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
String parent = "parent-995424086";
for (ConversationModelEvaluation element :
conversationModelsClient.listConversationModelEvaluations(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The conversation model resource name. Format: `projects/<Project
ID>/conversationModels/<Conversation Model ID>`ApiException
- if the remote call failspublic final ConversationModelsClient.ListConversationModelEvaluationsPagedResponse listConversationModelEvaluations(ListConversationModelEvaluationsRequest request)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
ListConversationModelEvaluationsRequest request =
ListConversationModelEvaluationsRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (ConversationModelEvaluation element :
conversationModelsClient.listConversationModelEvaluations(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<ListConversationModelEvaluationsRequest,ConversationModelsClient.ListConversationModelEvaluationsPagedResponse> listConversationModelEvaluationsPagedCallable()
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
ListConversationModelEvaluationsRequest request =
ListConversationModelEvaluationsRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<ConversationModelEvaluation> future =
conversationModelsClient
.listConversationModelEvaluationsPagedCallable()
.futureCall(request);
// Do something.
for (ConversationModelEvaluation element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListConversationModelEvaluationsRequest,ListConversationModelEvaluationsResponse> listConversationModelEvaluationsCallable()
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
ListConversationModelEvaluationsRequest request =
ListConversationModelEvaluationsRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListConversationModelEvaluationsResponse response =
conversationModelsClient.listConversationModelEvaluationsCallable().call(request);
for (ConversationModelEvaluation element : response.getConversationModelEvaluationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final OperationFuture<ConversationModelEvaluation,CreateConversationModelEvaluationOperationMetadata> createConversationModelEvaluationAsync(ConversationModelName parent, ConversationModelEvaluation conversationModelEvaluation)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
ConversationModelName parent =
ConversationModelName.ofProjectLocationConversationModelName(
"[PROJECT]", "[LOCATION]", "[CONVERSATION_MODEL]");
ConversationModelEvaluation conversationModelEvaluation =
ConversationModelEvaluation.newBuilder().build();
ConversationModelEvaluation response =
conversationModelsClient
.createConversationModelEvaluationAsync(parent, conversationModelEvaluation)
.get();
}
parent
- Required. The conversation model resource name. Format: `projects/<Project
ID>/locations/<Location ID>/conversationModels/<Conversation Model ID>`conversationModelEvaluation
- Required. The conversation model evaluation to be created.ApiException
- if the remote call failspublic final OperationFuture<ConversationModelEvaluation,CreateConversationModelEvaluationOperationMetadata> createConversationModelEvaluationAsync(String parent, ConversationModelEvaluation conversationModelEvaluation)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
String parent =
ConversationModelName.ofProjectLocationConversationModelName(
"[PROJECT]", "[LOCATION]", "[CONVERSATION_MODEL]")
.toString();
ConversationModelEvaluation conversationModelEvaluation =
ConversationModelEvaluation.newBuilder().build();
ConversationModelEvaluation response =
conversationModelsClient
.createConversationModelEvaluationAsync(parent, conversationModelEvaluation)
.get();
}
parent
- Required. The conversation model resource name. Format: `projects/<Project
ID>/locations/<Location ID>/conversationModels/<Conversation Model ID>`conversationModelEvaluation
- Required. The conversation model evaluation to be created.ApiException
- if the remote call failspublic final OperationFuture<ConversationModelEvaluation,CreateConversationModelEvaluationOperationMetadata> createConversationModelEvaluationAsync(CreateConversationModelEvaluationRequest request)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
CreateConversationModelEvaluationRequest request =
CreateConversationModelEvaluationRequest.newBuilder()
.setParent(
ConversationModelName.ofProjectLocationConversationModelName(
"[PROJECT]", "[LOCATION]", "[CONVERSATION_MODEL]")
.toString())
.setConversationModelEvaluation(ConversationModelEvaluation.newBuilder().build())
.build();
ConversationModelEvaluation response =
conversationModelsClient.createConversationModelEvaluationAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final OperationCallable<CreateConversationModelEvaluationRequest,ConversationModelEvaluation,CreateConversationModelEvaluationOperationMetadata> createConversationModelEvaluationOperationCallable()
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
CreateConversationModelEvaluationRequest request =
CreateConversationModelEvaluationRequest.newBuilder()
.setParent(
ConversationModelName.ofProjectLocationConversationModelName(
"[PROJECT]", "[LOCATION]", "[CONVERSATION_MODEL]")
.toString())
.setConversationModelEvaluation(ConversationModelEvaluation.newBuilder().build())
.build();
OperationFuture<
ConversationModelEvaluation, CreateConversationModelEvaluationOperationMetadata>
future =
conversationModelsClient
.createConversationModelEvaluationOperationCallable()
.futureCall(request);
// Do something.
ConversationModelEvaluation response = future.get();
}
public final UnaryCallable<CreateConversationModelEvaluationRequest,Operation> createConversationModelEvaluationCallable()
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
CreateConversationModelEvaluationRequest request =
CreateConversationModelEvaluationRequest.newBuilder()
.setParent(
ConversationModelName.ofProjectLocationConversationModelName(
"[PROJECT]", "[LOCATION]", "[CONVERSATION_MODEL]")
.toString())
.setConversationModelEvaluation(ConversationModelEvaluation.newBuilder().build())
.build();
ApiFuture<Operation> future =
conversationModelsClient.createConversationModelEvaluationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final ConversationModelsClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : conversationModelsClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.location.ListLocationsRequest,ConversationModelsClient.ListLocationsPagedResponse> listLocationsPagedCallable()
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
conversationModelsClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response =
conversationModelsClient.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 com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = conversationModelsClient.getLocation(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
Sample 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 (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future =
conversationModelsClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2022 Google LLC. All rights reserved.