- 0.64.0 (latest)
- 0.63.0
- 0.62.0
- 0.60.0
- 0.59.0
- 0.58.0
- 0.57.0
- 0.56.0
- 0.55.0
- 0.54.0
- 0.53.0
- 0.52.0
- 0.51.0
- 0.50.0
- 0.48.0
- 0.47.0
- 0.46.0
- 0.45.0
- 0.44.0
- 0.43.0
- 0.42.0
- 0.41.0
- 0.40.0
- 0.39.0
- 0.38.0
- 0.35.0
- 0.34.0
- 0.33.0
- 0.32.0
- 0.31.0
- 0.30.0
- 0.29.0
- 0.28.0
- 0.27.0
- 0.26.0
- 0.25.0
- 0.24.0
- 0.23.0
- 0.22.0
- 0.20.0
- 0.19.0
- 0.18.0
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.7
- 0.13.1
- 0.12.1
- 0.11.5
public class FlowsClient implements BackgroundResource
Service Description: Service for managing Flows.
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 (FlowsClient flowsClient = FlowsClient.create()) {
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
Flow flow = Flow.newBuilder().build();
Flow response = flowsClient.createFlow(parent, flow);
}
Note: close() needs to be called on the FlowsClient 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:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
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 FlowsSettings to create(). For example:
To customize credentials:
FlowsSettings flowsSettings =
FlowsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
FlowsClient flowsClient = FlowsClient.create(flowsSettings);
To customize the endpoint:
FlowsSettings flowsSettings = FlowsSettings.newBuilder().setEndpoint(myEndpoint).build();
FlowsClient flowsClient = FlowsClient.create(flowsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final FlowsClient create()
Constructs an instance of FlowsClient with default settings.
Type | Description |
FlowsClient |
Type | Description |
IOException |
create(FlowsSettings settings)
public static final FlowsClient create(FlowsSettings settings)
Constructs an instance of FlowsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings | FlowsSettings |
Type | Description |
FlowsClient |
Type | Description |
IOException |
create(FlowsStub stub)
public static final FlowsClient create(FlowsStub stub)
Constructs an instance of FlowsClient, using the given stub for making calls. This is for advanced usage - prefer using create(FlowsSettings).
Name | Description |
stub | FlowsStub |
Type | Description |
FlowsClient |
Constructors
FlowsClient(FlowsSettings settings)
protected FlowsClient(FlowsSettings settings)
Constructs an instance of FlowsClient, 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.
Name | Description |
settings | FlowsSettings |
FlowsClient(FlowsStub stub)
protected FlowsClient(FlowsStub stub)
Name | Description |
stub | FlowsStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
createFlow(AgentName parent, Flow flow)
public final Flow createFlow(AgentName parent, Flow flow)
Creates a flow in the specified agent.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
Flow flow = Flow.newBuilder().build();
Flow response = flowsClient.createFlow(parent, flow);
}
Name | Description |
parent | AgentName Required. The agent to create a flow for. Format: |
flow | Flow Required. The flow to create. |
Type | Description |
Flow |
createFlow(CreateFlowRequest request)
public final Flow createFlow(CreateFlowRequest request)
Creates a flow in the specified agent.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
CreateFlowRequest request =
CreateFlowRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setFlow(Flow.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.build();
Flow response = flowsClient.createFlow(request);
}
Name | Description |
request | CreateFlowRequest The request object containing all of the parameters for the API call. |
Type | Description |
Flow |
createFlow(String parent, Flow flow)
public final Flow createFlow(String parent, Flow flow)
Creates a flow in the specified agent.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
Flow flow = Flow.newBuilder().build();
Flow response = flowsClient.createFlow(parent, flow);
}
Name | Description |
parent | String Required. The agent to create a flow for. Format: |
flow | Flow Required. The flow to create. |
Type | Description |
Flow |
createFlowCallable()
public final UnaryCallable<CreateFlowRequest,Flow> createFlowCallable()
Creates a flow in the specified agent.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
CreateFlowRequest request =
CreateFlowRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setFlow(Flow.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture<Flow> future = flowsClient.createFlowCallable().futureCall(request);
// Do something.
Flow response = future.get();
}
Type | Description |
UnaryCallable<CreateFlowRequest,Flow> |
deleteFlow(DeleteFlowRequest request)
public final void deleteFlow(DeleteFlowRequest request)
Deletes a specified flow.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
DeleteFlowRequest request =
DeleteFlowRequest.newBuilder()
.setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setForce(true)
.build();
flowsClient.deleteFlow(request);
}
Name | Description |
request | DeleteFlowRequest The request object containing all of the parameters for the API call. |
deleteFlow(FlowName name)
public final void deleteFlow(FlowName name)
Deletes a specified flow.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
flowsClient.deleteFlow(name);
}
Name | Description |
name | FlowName Required. The name of the flow to delete. Format: |
deleteFlow(String name)
public final void deleteFlow(String name)
Deletes a specified flow.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
String name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
flowsClient.deleteFlow(name);
}
Name | Description |
name | String Required. The name of the flow to delete. Format: |
deleteFlowCallable()
public final UnaryCallable<DeleteFlowRequest,Empty> deleteFlowCallable()
Deletes a specified flow.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
DeleteFlowRequest request =
DeleteFlowRequest.newBuilder()
.setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setForce(true)
.build();
ApiFuture<Empty> future = flowsClient.deleteFlowCallable().futureCall(request);
// Do something.
future.get();
}
Type | Description |
UnaryCallable<DeleteFlowRequest,Empty> |
exportFlowAsync(ExportFlowRequest request)
public final OperationFuture<ExportFlowResponse,Struct> exportFlowAsync(ExportFlowRequest request)
Exports the specified flow to a binary file.
This method is a long-running
operation. The
returned Operation
type has the following method-specific fields:
- metadata
: An empty Struct
message
response
: ExportFlowResponseNote that resources (e.g. intents, entities, webhooks) that the flow references will also be exported.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) { ExportFlowRequest request = ExportFlowRequest.newBuilder() .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) .setFlowUri("flowUri-765815458") .setIncludeReferencedFlows(true) .build(); ExportFlowResponse response = flowsClient.exportFlowAsync(request).get(); }
Name | Description |
request | ExportFlowRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<ExportFlowResponse,Struct> |
exportFlowCallable()
public final UnaryCallable<ExportFlowRequest,Operation> exportFlowCallable()
Exports the specified flow to a binary file.
This method is a long-running
operation. The
returned Operation
type has the following method-specific fields:
- metadata
: An empty Struct
message
response
: ExportFlowResponseNote that resources (e.g. intents, entities, webhooks) that the flow references will also be exported.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) { ExportFlowRequest request = ExportFlowRequest.newBuilder() .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) .setFlowUri("flowUri-765815458") .setIncludeReferencedFlows(true) .build(); ApiFuture<Operation> future = flowsClient.exportFlowCallable().futureCall(request); // Do something. Operation response = future.get(); }
Type | Description |
UnaryCallable<ExportFlowRequest,Operation> |
exportFlowOperationCallable()
public final OperationCallable<ExportFlowRequest,ExportFlowResponse,Struct> exportFlowOperationCallable()
Exports the specified flow to a binary file.
This method is a long-running
operation. The
returned Operation
type has the following method-specific fields:
- metadata
: An empty Struct
message
response
: ExportFlowResponseNote that resources (e.g. intents, entities, webhooks) that the flow references will also be exported.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) { ExportFlowRequest request = ExportFlowRequest.newBuilder() .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) .setFlowUri("flowUri-765815458") .setIncludeReferencedFlows(true) .build(); OperationFuture
Type | Description |
OperationCallable<ExportFlowRequest,ExportFlowResponse,Struct> |
getFlow(FlowName name)
public final Flow getFlow(FlowName name)
Retrieves the specified flow.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
Flow response = flowsClient.getFlow(name);
}
Name | Description |
name | FlowName Required. The name of the flow to get. Format: |
Type | Description |
Flow |
getFlow(GetFlowRequest request)
public final Flow getFlow(GetFlowRequest request)
Retrieves the specified flow.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
GetFlowRequest request =
GetFlowRequest.newBuilder()
.setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setLanguageCode("languageCode-2092349083")
.build();
Flow response = flowsClient.getFlow(request);
}
Name | Description |
request | GetFlowRequest The request object containing all of the parameters for the API call. |
Type | Description |
Flow |
getFlow(String name)
public final Flow getFlow(String name)
Retrieves the specified flow.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
String name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
Flow response = flowsClient.getFlow(name);
}
Name | Description |
name | String Required. The name of the flow to get. Format: |
Type | Description |
Flow |
getFlowCallable()
public final UnaryCallable<GetFlowRequest,Flow> getFlowCallable()
Retrieves the specified flow.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
GetFlowRequest request =
GetFlowRequest.newBuilder()
.setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture<Flow> future = flowsClient.getFlowCallable().futureCall(request);
// Do something.
Flow response = future.get();
}
Type | Description |
UnaryCallable<GetFlowRequest,Flow> |
getFlowValidationResult(FlowValidationResultName name)
public final FlowValidationResult getFlowValidationResult(FlowValidationResultName name)
Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
FlowValidationResultName name =
FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
FlowValidationResult response = flowsClient.getFlowValidationResult(name);
}
Name | Description |
name | FlowValidationResultName Required. The flow name. Format: |
Type | Description |
FlowValidationResult |
getFlowValidationResult(GetFlowValidationResultRequest request)
public final FlowValidationResult getFlowValidationResult(GetFlowValidationResultRequest request)
Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
GetFlowValidationResultRequest request =
GetFlowValidationResultRequest.newBuilder()
.setName(
FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]")
.toString())
.setLanguageCode("languageCode-2092349083")
.build();
FlowValidationResult response = flowsClient.getFlowValidationResult(request);
}
Name | Description |
request | GetFlowValidationResultRequest The request object containing all of the parameters for the API call. |
Type | Description |
FlowValidationResult |
getFlowValidationResult(String name)
public final FlowValidationResult getFlowValidationResult(String name)
Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
String name =
FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
FlowValidationResult response = flowsClient.getFlowValidationResult(name);
}
Name | Description |
name | String Required. The flow name. Format: |
Type | Description |
FlowValidationResult |
getFlowValidationResultCallable()
public final UnaryCallable<GetFlowValidationResultRequest,FlowValidationResult> getFlowValidationResultCallable()
Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
GetFlowValidationResultRequest request =
GetFlowValidationResultRequest.newBuilder()
.setName(
FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]")
.toString())
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture
Type | Description |
UnaryCallable<GetFlowValidationResultRequest,FlowValidationResult> |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Type | Description |
OperationsClient |
getSettings()
public final FlowsSettings getSettings()
Type | Description |
FlowsSettings |
getStub()
public FlowsStub getStub()
Type | Description |
FlowsStub |
importFlowAsync(ImportFlowRequest request)
public final OperationFuture<ImportFlowResponse,Struct> importFlowAsync(ImportFlowRequest request)
Imports the specified flow to the specified agent from a binary file.
This method is a long-running
operation. The
returned Operation
type has the following method-specific fields:
- metadata
: An empty Struct
message
response
: ImportFlowResponseNote: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) { ImportFlowRequest request = ImportFlowRequest.newBuilder() .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) .build(); ImportFlowResponse response = flowsClient.importFlowAsync(request).get(); }
Name | Description |
request | ImportFlowRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<ImportFlowResponse,Struct> |
importFlowCallable()
public final UnaryCallable<ImportFlowRequest,Operation> importFlowCallable()
Imports the specified flow to the specified agent from a binary file.
This method is a long-running
operation. The
returned Operation
type has the following method-specific fields:
- metadata
: An empty Struct
message
response
: ImportFlowResponseNote: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) { ImportFlowRequest request = ImportFlowRequest.newBuilder() .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) .build(); ApiFuture<Operation> future = flowsClient.importFlowCallable().futureCall(request); // Do something. Operation response = future.get(); }
Type | Description |
UnaryCallable<ImportFlowRequest,Operation> |
importFlowOperationCallable()
public final OperationCallable<ImportFlowRequest,ImportFlowResponse,Struct> importFlowOperationCallable()
Imports the specified flow to the specified agent from a binary file.
This method is a long-running
operation. The
returned Operation
type has the following method-specific fields:
- metadata
: An empty Struct
message
response
: ImportFlowResponseNote: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) { ImportFlowRequest request = ImportFlowRequest.newBuilder() .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) .build(); OperationFuture
Type | Description |
OperationCallable<ImportFlowRequest,ImportFlowResponse,Struct> |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listFlows(AgentName parent)
public final FlowsClient.ListFlowsPagedResponse listFlows(AgentName parent)
Returns the list of all flows in the specified agent.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
for (Flow element : flowsClient.listFlows(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | AgentName Required. The agent containing the flows. Format: |
Type | Description |
FlowsClient.ListFlowsPagedResponse |
listFlows(ListFlowsRequest request)
public final FlowsClient.ListFlowsPagedResponse listFlows(ListFlowsRequest request)
Returns the list of all flows in the specified agent.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
ListFlowsRequest request =
ListFlowsRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setLanguageCode("languageCode-2092349083")
.build();
for (Flow element : flowsClient.listFlows(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListFlowsRequest The request object containing all of the parameters for the API call. |
Type | Description |
FlowsClient.ListFlowsPagedResponse |
listFlows(String parent)
public final FlowsClient.ListFlowsPagedResponse listFlows(String parent)
Returns the list of all flows in the specified agent.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
for (Flow element : flowsClient.listFlows(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The agent containing the flows. Format: |
Type | Description |
FlowsClient.ListFlowsPagedResponse |
listFlowsCallable()
public final UnaryCallable<ListFlowsRequest,ListFlowsResponse> listFlowsCallable()
Returns the list of all flows in the specified agent.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
ListFlowsRequest request =
ListFlowsRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setLanguageCode("languageCode-2092349083")
.build();
while (true) {
ListFlowsResponse response = flowsClient.listFlowsCallable().call(request);
for (Flow element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListFlowsRequest,ListFlowsResponse> |
listFlowsPagedCallable()
public final UnaryCallable<ListFlowsRequest,FlowsClient.ListFlowsPagedResponse> listFlowsPagedCallable()
Returns the list of all flows in the specified agent.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
ListFlowsRequest request =
ListFlowsRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture<Flow> future = flowsClient.listFlowsPagedCallable().futureCall(request);
// Do something.
for (Flow element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListFlowsRequest,ListFlowsPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
trainFlowAsync(FlowName name)
public final OperationFuture<Empty,Struct> trainFlowAsync(FlowName name)
Trains the specified flow. Note that only the flow in 'draft' environment is trained.
This method is a long-running
operation. The
returned Operation
type has the following method-specific fields:
- metadata
: An empty Struct
message
response
: An Empty messageNote: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) { FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); flowsClient.trainFlowAsync(name).get(); }
Name | Description |
name | FlowName Required. The flow to train. Format: |
Type | Description |
OperationFuture<Empty,Struct> |
trainFlowAsync(TrainFlowRequest request)
public final OperationFuture<Empty,Struct> trainFlowAsync(TrainFlowRequest request)
Trains the specified flow. Note that only the flow in 'draft' environment is trained.
This method is a long-running
operation. The
returned Operation
type has the following method-specific fields:
- metadata
: An empty Struct
message
response
: An Empty messageNote: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) { TrainFlowRequest request = TrainFlowRequest.newBuilder() .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) .build(); flowsClient.trainFlowAsync(request).get(); }
Name | Description |
request | TrainFlowRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Empty,Struct> |
trainFlowAsync(String name)
public final OperationFuture<Empty,Struct> trainFlowAsync(String name)
Trains the specified flow. Note that only the flow in 'draft' environment is trained.
This method is a long-running
operation. The
returned Operation
type has the following method-specific fields:
- metadata
: An empty Struct
message
response
: An Empty messageNote: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) { String name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString(); flowsClient.trainFlowAsync(name).get(); }
Name | Description |
name | String Required. The flow to train. Format: |
Type | Description |
OperationFuture<Empty,Struct> |
trainFlowCallable()
public final UnaryCallable<TrainFlowRequest,Operation> trainFlowCallable()
Trains the specified flow. Note that only the flow in 'draft' environment is trained.
This method is a long-running
operation. The
returned Operation
type has the following method-specific fields:
- metadata
: An empty Struct
message
response
: An Empty messageNote: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) { TrainFlowRequest request = TrainFlowRequest.newBuilder() .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) .build(); ApiFuture<Operation> future = flowsClient.trainFlowCallable().futureCall(request); // Do something. future.get(); }
Type | Description |
UnaryCallable<TrainFlowRequest,Operation> |
trainFlowOperationCallable()
public final OperationCallable<TrainFlowRequest,Empty,Struct> trainFlowOperationCallable()
Trains the specified flow. Note that only the flow in 'draft' environment is trained.
This method is a long-running
operation. The
returned Operation
type has the following method-specific fields:
- metadata
: An empty Struct
message
response
: An Empty messageNote: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) { TrainFlowRequest request = TrainFlowRequest.newBuilder() .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) .build(); OperationFuture
Type | Description |
OperationCallable<TrainFlowRequest,Empty,Struct> |
updateFlow(Flow flow, FieldMask updateMask)
public final Flow updateFlow(Flow flow, FieldMask updateMask)
Updates the specified flow.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
Flow flow = Flow.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Flow response = flowsClient.updateFlow(flow, updateMask);
}
Name | Description |
flow | Flow Required. The flow to update. |
updateMask | FieldMask The mask to control which fields get updated. If the mask is not present, all fields will be updated. |
Type | Description |
Flow |
updateFlow(UpdateFlowRequest request)
public final Flow updateFlow(UpdateFlowRequest request)
Updates the specified flow.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
UpdateFlowRequest request =
UpdateFlowRequest.newBuilder()
.setFlow(Flow.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.build();
Flow response = flowsClient.updateFlow(request);
}
Name | Description |
request | UpdateFlowRequest The request object containing all of the parameters for the API call. |
Type | Description |
Flow |
updateFlowCallable()
public final UnaryCallable<UpdateFlowRequest,Flow> updateFlowCallable()
Updates the specified flow.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
UpdateFlowRequest request =
UpdateFlowRequest.newBuilder()
.setFlow(Flow.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture<Flow> future = flowsClient.updateFlowCallable().futureCall(request);
// Do something.
Flow response = future.get();
}
Type | Description |
UnaryCallable<UpdateFlowRequest,Flow> |
validateFlow(ValidateFlowRequest request)
public final FlowValidationResult validateFlow(ValidateFlowRequest request)
Validates the specified flow and creates or updates validation results. Please call this API after the training is completed to get the complete validation results.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
ValidateFlowRequest request =
ValidateFlowRequest.newBuilder()
.setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setLanguageCode("languageCode-2092349083")
.build();
FlowValidationResult response = flowsClient.validateFlow(request);
}
Name | Description |
request | ValidateFlowRequest The request object containing all of the parameters for the API call. |
Type | Description |
FlowValidationResult |
validateFlowCallable()
public final UnaryCallable<ValidateFlowRequest,FlowValidationResult> validateFlowCallable()
Validates the specified flow and creates or updates validation results. Please call this API after the training is completed to get the complete validation results.
Sample code:
try (FlowsClient flowsClient = FlowsClient.create()) {
ValidateFlowRequest request =
ValidateFlowRequest.newBuilder()
.setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture
Type | Description |
UnaryCallable<ValidateFlowRequest,FlowValidationResult> |