@Generated(value="by gapic-generator-java") public class SessionEntityTypesClient 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:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityTypeName name =
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[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);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Modifier and Type | Class and Description |
---|---|
static class |
SessionEntityTypesClient.ListSessionEntityTypesFixedSizeCollection |
static class |
SessionEntityTypesClient.ListSessionEntityTypesPage |
static class |
SessionEntityTypesClient.ListSessionEntityTypesPagedResponse |
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
IOException
public 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 SessionEntityTypesClient.ListSessionEntityTypesPagedResponse listSessionEntityTypes(SessionName parent)
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionName parent = SessionName.ofProjectSessionName("[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>` or `projects/<Project
ID>/agent/environments/<Environment ID>/users/<User ID>/
sessions/<Session ID>`. If `Environment ID` is not specified, we assume default
'draft' environment. If `User ID` is not specified, we assume default '-' user.ApiException
- if the remote call failspublic final SessionEntityTypesClient.ListSessionEntityTypesPagedResponse listSessionEntityTypes(String parent)
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
String parent =
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
.toString();
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>` or `projects/<Project
ID>/agent/environments/<Environment ID>/users/<User ID>/
sessions/<Session ID>`. If `Environment ID` is not specified, we assume default
'draft' environment. If `User ID` is not specified, we assume default '-' user.ApiException
- if the remote call failspublic final SessionEntityTypesClient.ListSessionEntityTypesPagedResponse listSessionEntityTypes(ListSessionEntityTypesRequest request)
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
ListSessionEntityTypesRequest request =
ListSessionEntityTypesRequest.newBuilder()
.setParent(
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (SessionEntityType element :
sessionEntityTypesClient.listSessionEntityTypes(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<ListSessionEntityTypesRequest,SessionEntityTypesClient.ListSessionEntityTypesPagedResponse> listSessionEntityTypesPagedCallable()
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
ListSessionEntityTypesRequest request =
ListSessionEntityTypesRequest.newBuilder()
.setParent(
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<SessionEntityType> future =
sessionEntityTypesClient.listSessionEntityTypesPagedCallable().futureCall(request);
// Do something.
for (SessionEntityType element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListSessionEntityTypesRequest,ListSessionEntityTypesResponse> listSessionEntityTypesCallable()
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
ListSessionEntityTypesRequest request =
ListSessionEntityTypesRequest.newBuilder()
.setParent(
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListSessionEntityTypesResponse response =
sessionEntityTypesClient.listSessionEntityTypesCallable().call(request);
for (SessionEntityType element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final SessionEntityType getSessionEntityType(SessionEntityTypeName name)
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityTypeName name =
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[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>` or
`projects/<Project ID>/agent/environments/<Environment ID>/users/<User
ID>/sessions/<Session ID>/entityTypes/<Entity Type Display Name>`. If
`Environment ID` is not specified, we assume default 'draft' environment. If `User ID` is
not specified, we assume default '-' user.ApiException
- if the remote call failspublic final SessionEntityType getSessionEntityType(String name)
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
String name =
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
.toString();
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>` or
`projects/<Project ID>/agent/environments/<Environment ID>/users/<User
ID>/sessions/<Session ID>/entityTypes/<Entity Type Display Name>`. If
`Environment ID` is not specified, we assume default 'draft' environment. If `User ID` is
not specified, we assume default '-' user.ApiException
- if the remote call failspublic final SessionEntityType getSessionEntityType(GetSessionEntityTypeRequest request)
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
GetSessionEntityTypeRequest request =
GetSessionEntityTypeRequest.newBuilder()
.setName(
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
.toString())
.build();
SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<GetSessionEntityTypeRequest,SessionEntityType> getSessionEntityTypeCallable()
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
GetSessionEntityTypeRequest request =
GetSessionEntityTypeRequest.newBuilder()
.setName(
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
.toString())
.build();
ApiFuture<SessionEntityType> future =
sessionEntityTypesClient.getSessionEntityTypeCallable().futureCall(request);
// Do something.
SessionEntityType response = future.get();
}
public final SessionEntityType createSessionEntityType(SessionName parent, SessionEntityType sessionEntityType)
If the specified session entity type already exists, overrides the session entity type.
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionName parent = SessionName.ofProjectSessionName("[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>` or `projects/<Project
ID>/agent/environments/<Environment ID>/users/<User ID>/
sessions/<Session ID>`. If `Environment ID` is not specified, we assume default
'draft' environment. If `User ID` is not specified, we assume default '-' user.sessionEntityType
- Required. The session entity type to create.ApiException
- if the remote call failspublic final SessionEntityType createSessionEntityType(String parent, SessionEntityType sessionEntityType)
If the specified session entity type already exists, overrides the session entity type.
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
String parent =
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
.toString();
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>` or `projects/<Project
ID>/agent/environments/<Environment ID>/users/<User ID>/
sessions/<Session ID>`. If `Environment ID` is not specified, we assume default
'draft' environment. If `User ID` is not specified, we assume default '-' user.sessionEntityType
- Required. The session entity type to create.ApiException
- if the remote call failspublic final SessionEntityType createSessionEntityType(CreateSessionEntityTypeRequest request)
If the specified session entity type already exists, overrides the session entity type.
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
CreateSessionEntityTypeRequest request =
CreateSessionEntityTypeRequest.newBuilder()
.setParent(
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
.toString())
.setSessionEntityType(SessionEntityType.newBuilder().build())
.build();
SessionEntityType response = sessionEntityTypesClient.createSessionEntityType(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<CreateSessionEntityTypeRequest,SessionEntityType> createSessionEntityTypeCallable()
If the specified session entity type already exists, overrides the session entity type.
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
CreateSessionEntityTypeRequest request =
CreateSessionEntityTypeRequest.newBuilder()
.setParent(
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
.toString())
.setSessionEntityType(SessionEntityType.newBuilder().build())
.build();
ApiFuture<SessionEntityType> future =
sessionEntityTypesClient.createSessionEntityTypeCallable().futureCall(request);
// Do something.
SessionEntityType response = future.get();
}
public final SessionEntityType updateSessionEntityType(SessionEntityType sessionEntityType)
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
SessionEntityType response =
sessionEntityTypesClient.updateSessionEntityType(sessionEntityType);
}
sessionEntityType
- Required. The session entity type to update.ApiException
- if the remote call failspublic final SessionEntityType updateSessionEntityType(SessionEntityType sessionEntityType, FieldMask updateMask)
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
SessionEntityType response =
sessionEntityTypesClient.updateSessionEntityType(sessionEntityType, updateMask);
}
sessionEntityType
- Required. The session entity type to update.updateMask
- Optional. The mask to control which fields get updated.ApiException
- if the remote call failspublic final SessionEntityType updateSessionEntityType(UpdateSessionEntityTypeRequest request)
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
UpdateSessionEntityTypeRequest request =
UpdateSessionEntityTypeRequest.newBuilder()
.setSessionEntityType(SessionEntityType.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
SessionEntityType response = sessionEntityTypesClient.updateSessionEntityType(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<UpdateSessionEntityTypeRequest,SessionEntityType> updateSessionEntityTypeCallable()
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
UpdateSessionEntityTypeRequest request =
UpdateSessionEntityTypeRequest.newBuilder()
.setSessionEntityType(SessionEntityType.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<SessionEntityType> future =
sessionEntityTypesClient.updateSessionEntityTypeCallable().futureCall(request);
// Do something.
SessionEntityType response = future.get();
}
public final void deleteSessionEntityType(SessionEntityTypeName name)
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
SessionEntityTypeName name =
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[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>` or
`projects/<Project ID>/agent/environments/<Environment ID>/users/<User
ID>/sessions/<Session ID>/entityTypes/<Entity Type Display Name>`. If
`Environment ID` is not specified, we assume default 'draft' environment. If `User ID` is
not specified, we assume default '-' user.ApiException
- if the remote call failspublic final void deleteSessionEntityType(String name)
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
String name =
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
.toString();
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>` or
`projects/<Project ID>/agent/environments/<Environment ID>/users/<User
ID>/sessions/<Session ID>/entityTypes/<Entity Type Display Name>`. If
`Environment ID` is not specified, we assume default 'draft' environment. If `User ID` is
not specified, we assume default '-' user.ApiException
- if the remote call failspublic final void deleteSessionEntityType(DeleteSessionEntityTypeRequest request)
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
DeleteSessionEntityTypeRequest request =
DeleteSessionEntityTypeRequest.newBuilder()
.setName(
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
.toString())
.build();
sessionEntityTypesClient.deleteSessionEntityType(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<DeleteSessionEntityTypeRequest,Empty> deleteSessionEntityTypeCallable()
This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Sample code:
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
DeleteSessionEntityTypeRequest request =
DeleteSessionEntityTypeRequest.newBuilder()
.setName(
SessionEntityTypeName.ofProjectSessionEntityTypeName(
"[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
.toString())
.build();
ApiFuture<Empty> future =
sessionEntityTypesClient.deleteSessionEntityTypeCallable().futureCall(request);
// Do something.
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 © 2021 Google LLC. All rights reserved.