@Generated(value="by GAPIC v0.0.5") @BetaApi public class SessionEntityTypesClient extends Object implements com.google.api.gax.core.BackgroundResource
Session entity types can be redefined on a session level, allowing for specific concepts, like a user's playlists.
Standard methods.
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:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityTypeName name = SessionEntityTypeName.of("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]");
SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(name);
}
Note: close() needs to be called on the sessionEntityTypesClient 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 SessionEntityTypesSettings to create(). For example:
To customize credentials:
SessionEntityTypesSettings sessionEntityTypesSettings =
SessionEntityTypesSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SessionEntityTypesClient sessionEntityTypesClient =
SessionEntityTypesClient.create(sessionEntityTypesSettings);
To customize the endpoint:
SessionEntityTypesSettings sessionEntityTypesSettings =
SessionEntityTypesSettings.newBuilder().setEndpoint(myEndpoint).build();
SessionEntityTypesClient sessionEntityTypesClient =
SessionEntityTypesClient.create(sessionEntityTypesSettings);
| Modifier | Constructor and Description |
|---|---|
protected |
SessionEntityTypesClient(SessionEntityTypesSettings settings)
Constructs an instance of SessionEntityTypesClient, using the given settings.
|
protected |
SessionEntityTypesClient(SessionEntityTypesStub stub) |
protected SessionEntityTypesClient(SessionEntityTypesSettings settings) throws IOException
IOException@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected SessionEntityTypesClient(SessionEntityTypesStub stub)
public static final SessionEntityTypesClient create() throws IOException
IOExceptionpublic static final SessionEntityTypesClient create(SessionEntityTypesSettings settings) throws IOException
IOException@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final SessionEntityTypesClient create(SessionEntityTypesStub stub)
public final SessionEntityTypesSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public SessionEntityTypesStub getStub()
public final PagedResponseWrappers.ListSessionEntityTypesPagedResponse listSessionEntityTypes(com.google.cloud.dialogflow.v2beta1.SessionName parent)
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionName parent = SessionName.of("[PROJECT]", "[SESSION]");
for (SessionEntityType element : sessionEntityTypesClient.listSessionEntityTypes(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The session to list all session entity types from. Format:
`projects/<Project ID>/agent/sessions/<Session ID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PagedResponseWrappers.ListSessionEntityTypesPagedResponse listSessionEntityTypes(com.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest request)
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionName parent = SessionName.of("[PROJECT]", "[SESSION]");
ListSessionEntityTypesRequest request = ListSessionEntityTypesRequest.newBuilder()
.setParentWithSessionName(parent)
.build();
for (SessionEntityType element : sessionEntityTypesClient.listSessionEntityTypes(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest,PagedResponseWrappers.ListSessionEntityTypesPagedResponse> listSessionEntityTypesPagedCallable()
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionName parent = SessionName.of("[PROJECT]", "[SESSION]");
ListSessionEntityTypesRequest request = ListSessionEntityTypesRequest.newBuilder()
.setParentWithSessionName(parent)
.build();
ApiFuture<ListSessionEntityTypesPagedResponse> future = sessionEntityTypesClient.listSessionEntityTypesPagedCallable().futureCall(request);
// Do something
for (SessionEntityType element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest,com.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse> listSessionEntityTypesCallable()
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionName parent = SessionName.of("[PROJECT]", "[SESSION]");
ListSessionEntityTypesRequest request = ListSessionEntityTypesRequest.newBuilder()
.setParentWithSessionName(parent)
.build();
while (true) {
ListSessionEntityTypesResponse response = sessionEntityTypesClient.listSessionEntityTypesCallable().call(request);
for (SessionEntityType element : response.getSessionEntityTypesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.cloud.dialogflow.v2beta1.SessionEntityType getSessionEntityType(com.google.cloud.dialogflow.v2beta1.SessionEntityTypeName name)
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityTypeName name = SessionEntityTypeName.of("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]");
SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(name);
}
name - Required. The name of the session entity type. Format: `projects/<Project
ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type Display Name>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest,com.google.cloud.dialogflow.v2beta1.SessionEntityType> getSessionEntityTypeCallable()
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityTypeName name = SessionEntityTypeName.of("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]");
GetSessionEntityTypeRequest request = GetSessionEntityTypeRequest.newBuilder()
.setNameWithSessionEntityTypeName(name)
.build();
ApiFuture<SessionEntityType> future = sessionEntityTypesClient.getSessionEntityTypeCallable().futureCall(request);
// Do something
SessionEntityType response = future.get();
}
public final com.google.cloud.dialogflow.v2beta1.SessionEntityType createSessionEntityType(com.google.cloud.dialogflow.v2beta1.SessionName parent, com.google.cloud.dialogflow.v2beta1.SessionEntityType sessionEntityType)
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionName parent = SessionName.of("[PROJECT]", "[SESSION]");
SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
SessionEntityType response = sessionEntityTypesClient.createSessionEntityType(parent, sessionEntityType);
}
parent - Required. The session to create a session entity type for. Format:
`projects/<Project ID>/agent/sessions/<Session ID>`.sessionEntityType - Required. The session entity type to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.SessionEntityType createSessionEntityType(com.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest request)
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionName parent = SessionName.of("[PROJECT]", "[SESSION]");
SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
CreateSessionEntityTypeRequest request = CreateSessionEntityTypeRequest.newBuilder()
.setParentWithSessionName(parent)
.setSessionEntityType(sessionEntityType)
.build();
SessionEntityType response = sessionEntityTypesClient.createSessionEntityType(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest,com.google.cloud.dialogflow.v2beta1.SessionEntityType> createSessionEntityTypeCallable()
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionName parent = SessionName.of("[PROJECT]", "[SESSION]");
SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
CreateSessionEntityTypeRequest request = CreateSessionEntityTypeRequest.newBuilder()
.setParentWithSessionName(parent)
.setSessionEntityType(sessionEntityType)
.build();
ApiFuture<SessionEntityType> future = sessionEntityTypesClient.createSessionEntityTypeCallable().futureCall(request);
// Do something
SessionEntityType response = future.get();
}
public final com.google.cloud.dialogflow.v2beta1.SessionEntityType updateSessionEntityType(com.google.cloud.dialogflow.v2beta1.SessionEntityType sessionEntityType)
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
SessionEntityType response = sessionEntityTypesClient.updateSessionEntityType(sessionEntityType);
}
sessionEntityType - Required. The entity type to update. Format: `projects/<Project
ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type Display Name>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.SessionEntityType updateSessionEntityType(com.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest request)
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
UpdateSessionEntityTypeRequest request = UpdateSessionEntityTypeRequest.newBuilder()
.setSessionEntityType(sessionEntityType)
.build();
SessionEntityType response = sessionEntityTypesClient.updateSessionEntityType(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest,com.google.cloud.dialogflow.v2beta1.SessionEntityType> updateSessionEntityTypeCallable()
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
UpdateSessionEntityTypeRequest request = UpdateSessionEntityTypeRequest.newBuilder()
.setSessionEntityType(sessionEntityType)
.build();
ApiFuture<SessionEntityType> future = sessionEntityTypesClient.updateSessionEntityTypeCallable().futureCall(request);
// Do something
SessionEntityType response = future.get();
}
public final void deleteSessionEntityType(com.google.cloud.dialogflow.v2beta1.SessionEntityTypeName name)
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityTypeName name = SessionEntityTypeName.of("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]");
sessionEntityTypesClient.deleteSessionEntityType(name);
}
name - Required. The name of the entity type to delete. Format: `projects/<Project
ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type Display Name>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest,com.google.protobuf.Empty> deleteSessionEntityTypeCallable()
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityTypeName name = SessionEntityTypeName.of("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]");
DeleteSessionEntityTypeRequest request = DeleteSessionEntityTypeRequest.newBuilder()
.setNameWithSessionEntityTypeName(name)
.build();
ApiFuture<Void> future = sessionEntityTypesClient.deleteSessionEntityTypeCallable().futureCall(request);
// Do something
future.get();
}
public final void close()
throws Exception
close in interface AutoCloseableExceptionpublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2017 Google. All rights reserved.