Class FlowsClient
- java.lang.Object
-
- com.google.cloud.dialogflow.cx.v3beta1.FlowsClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@BetaApi @Generated("by gapic-generator-java") public class FlowsClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: Service for managing [Flows][google.cloud.dialogflow.cx.v3beta1.Flow].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 (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:
// 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 FlowsSettings flowsSettings = FlowsSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .build(); FlowsClient flowsClient = FlowsClient.create(flowsSettings);
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 FlowsSettings flowsSettings = FlowsSettings.newBuilder().setEndpoint(myEndpoint).build(); FlowsClient flowsClient = FlowsClient.create(flowsSettings);
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 FlowsSettings flowsSettings = FlowsSettings.newHttpJsonBuilder().build(); FlowsClient flowsClient = FlowsClient.create(flowsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FlowsClient.ListFlowsFixedSizeCollection
static class
FlowsClient.ListFlowsPage
static class
FlowsClient.ListFlowsPagedResponse
static class
FlowsClient.ListLocationsFixedSizeCollection
static class
FlowsClient.ListLocationsPage
static class
FlowsClient.ListLocationsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
FlowsClient(FlowsSettings settings)
Constructs an instance of FlowsClient, using the given settings.protected
FlowsClient(FlowsStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static FlowsClient
create()
Constructs an instance of FlowsClient with default settings.static FlowsClient
create(FlowsSettings settings)
Constructs an instance of FlowsClient, using the given settings.static FlowsClient
create(FlowsStub stub)
Constructs an instance of FlowsClient, using the given stub for making calls.Flow
createFlow(AgentName parent, Flow flow)
Creates a flow in the specified agent.Flow
createFlow(CreateFlowRequest request)
Creates a flow in the specified agent.Flow
createFlow(String parent, Flow flow)
Creates a flow in the specified agent.com.google.api.gax.rpc.UnaryCallable<CreateFlowRequest,Flow>
createFlowCallable()
Creates a flow in the specified agent.void
deleteFlow(DeleteFlowRequest request)
Deletes a specified flow.void
deleteFlow(FlowName name)
Deletes a specified flow.void
deleteFlow(String name)
Deletes a specified flow.com.google.api.gax.rpc.UnaryCallable<DeleteFlowRequest,com.google.protobuf.Empty>
deleteFlowCallable()
Deletes a specified flow.com.google.api.gax.longrunning.OperationFuture<ExportFlowResponse,com.google.protobuf.Struct>
exportFlowAsync(ExportFlowRequest request)
Exports the specified flow to a binary file.com.google.api.gax.rpc.UnaryCallable<ExportFlowRequest,com.google.longrunning.Operation>
exportFlowCallable()
Exports the specified flow to a binary file.com.google.api.gax.rpc.OperationCallable<ExportFlowRequest,ExportFlowResponse,com.google.protobuf.Struct>
exportFlowOperationCallable()
Exports the specified flow to a binary file.Flow
getFlow(FlowName name)
Retrieves the specified flow.Flow
getFlow(GetFlowRequest request)
Retrieves the specified flow.Flow
getFlow(String name)
Retrieves the specified flow.com.google.api.gax.rpc.UnaryCallable<GetFlowRequest,Flow>
getFlowCallable()
Retrieves the specified flow.FlowValidationResult
getFlowValidationResult(FlowValidationResultName name)
Gets the latest flow validation result.FlowValidationResult
getFlowValidationResult(GetFlowValidationResultRequest request)
Gets the latest flow validation result.FlowValidationResult
getFlowValidationResult(String name)
Gets the latest flow validation result.com.google.api.gax.rpc.UnaryCallable<GetFlowValidationResultRequest,FlowValidationResult>
getFlowValidationResultCallable()
Gets the latest flow validation result.com.google.api.gax.httpjson.longrunning.OperationsClient
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.com.google.cloud.location.Location
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>
getLocationCallable()
Gets information about a location.com.google.longrunning.OperationsClient
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.FlowsSettings
getSettings()
FlowsStub
getStub()
com.google.api.gax.longrunning.OperationFuture<ImportFlowResponse,com.google.protobuf.Struct>
importFlowAsync(ImportFlowRequest request)
Imports the specified flow to the specified agent from a binary file.com.google.api.gax.rpc.UnaryCallable<ImportFlowRequest,com.google.longrunning.Operation>
importFlowCallable()
Imports the specified flow to the specified agent from a binary file.com.google.api.gax.rpc.OperationCallable<ImportFlowRequest,ImportFlowResponse,com.google.protobuf.Struct>
importFlowOperationCallable()
Imports the specified flow to the specified agent from a binary file.boolean
isShutdown()
boolean
isTerminated()
FlowsClient.ListFlowsPagedResponse
listFlows(AgentName parent)
Returns the list of all flows in the specified agent.FlowsClient.ListFlowsPagedResponse
listFlows(ListFlowsRequest request)
Returns the list of all flows in the specified agent.FlowsClient.ListFlowsPagedResponse
listFlows(String parent)
Returns the list of all flows in the specified agent.com.google.api.gax.rpc.UnaryCallable<ListFlowsRequest,ListFlowsResponse>
listFlowsCallable()
Returns the list of all flows in the specified agent.com.google.api.gax.rpc.UnaryCallable<ListFlowsRequest,FlowsClient.ListFlowsPagedResponse>
listFlowsPagedCallable()
Returns the list of all flows in the specified agent.FlowsClient.ListLocationsPagedResponse
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>
listLocationsCallable()
Lists information about the supported locations for this service.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,FlowsClient.ListLocationsPagedResponse>
listLocationsPagedCallable()
Lists information about the supported locations for this service.void
shutdown()
void
shutdownNow()
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Struct>
trainFlowAsync(FlowName name)
Trains the specified flow.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Struct>
trainFlowAsync(TrainFlowRequest request)
Trains the specified flow.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Struct>
trainFlowAsync(String name)
Trains the specified flow.com.google.api.gax.rpc.UnaryCallable<TrainFlowRequest,com.google.longrunning.Operation>
trainFlowCallable()
Trains the specified flow.com.google.api.gax.rpc.OperationCallable<TrainFlowRequest,com.google.protobuf.Empty,com.google.protobuf.Struct>
trainFlowOperationCallable()
Trains the specified flow.Flow
updateFlow(Flow flow, com.google.protobuf.FieldMask updateMask)
Updates the specified flow.Flow
updateFlow(UpdateFlowRequest request)
Updates the specified flow.com.google.api.gax.rpc.UnaryCallable<UpdateFlowRequest,Flow>
updateFlowCallable()
Updates the specified flow.FlowValidationResult
validateFlow(ValidateFlowRequest request)
Validates the specified flow and creates or updates validation results.com.google.api.gax.rpc.UnaryCallable<ValidateFlowRequest,FlowValidationResult>
validateFlowCallable()
Validates the specified flow and creates or updates validation results.
-
-
-
Constructor Detail
-
FlowsClient
protected FlowsClient(FlowsSettings settings) throws IOException
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.- Throws:
IOException
-
FlowsClient
protected FlowsClient(FlowsStub stub)
-
-
Method Detail
-
create
public static final FlowsClient create() throws IOException
Constructs an instance of FlowsClient with default settings.- Throws:
IOException
-
create
public static final FlowsClient create(FlowsSettings settings) throws IOException
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.- Throws:
IOException
-
create
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).
-
getSettings
public final FlowsSettings getSettings()
-
getStub
public FlowsStub getStub()
-
getOperationsClient
public final com.google.longrunning.OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
-
getHttpJsonOperationsClient
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
-
createFlow
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](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (FlowsClient flowsClient = FlowsClient.create()) { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); Flow flow = Flow.newBuilder().build(); Flow response = flowsClient.createFlow(parent, flow); }
- Parameters:
parent
- Required. The agent to create a flow for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.flow
- Required. The flow to create.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createFlow
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](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (FlowsClient flowsClient = FlowsClient.create()) { String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString(); Flow flow = Flow.newBuilder().build(); Flow response = flowsClient.createFlow(parent, flow); }
- Parameters:
parent
- Required. The agent to create a flow for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.flow
- Required. The flow to create.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createFlow
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](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createFlowCallable
public final com.google.api.gax.rpc.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](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (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(); }
-
deleteFlow
public final void deleteFlow(FlowName name)
Deletes a specified flow.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 (FlowsClient flowsClient = FlowsClient.create()) { FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); flowsClient.deleteFlow(name); }
- Parameters:
name
- Required. The name of the flow to delete. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteFlow
public final void deleteFlow(String name)
Deletes a specified flow.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 (FlowsClient flowsClient = FlowsClient.create()) { String name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString(); flowsClient.deleteFlow(name); }
- Parameters:
name
- Required. The name of the flow to delete. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteFlow
public final void deleteFlow(DeleteFlowRequest request)
Deletes a specified flow.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 (FlowsClient flowsClient = FlowsClient.create()) { DeleteFlowRequest request = DeleteFlowRequest.newBuilder() .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) .setForce(true) .build(); flowsClient.deleteFlow(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteFlowCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteFlowRequest,com.google.protobuf.Empty> deleteFlowCallable()
Deletes a specified flow.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 (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(); }
-
listFlows
public final FlowsClient.ListFlowsPagedResponse listFlows(AgentName parent)
Returns the list of all flows in the specified agent.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 (FlowsClient flowsClient = FlowsClient.create()) { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); for (Flow element : flowsClient.listFlows(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The agent containing the flows. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listFlows
public final FlowsClient.ListFlowsPagedResponse listFlows(String parent)
Returns the list of all flows in the specified agent.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 (FlowsClient flowsClient = FlowsClient.create()) { String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString(); for (Flow element : flowsClient.listFlows(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The agent containing the flows. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listFlows
public final FlowsClient.ListFlowsPagedResponse listFlows(ListFlowsRequest request)
Returns the list of all flows in the specified agent.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 (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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listFlowsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListFlowsRequest,FlowsClient.ListFlowsPagedResponse> listFlowsPagedCallable()
Returns the list of all flows in the specified agent.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 (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); } }
-
listFlowsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListFlowsRequest,ListFlowsResponse> listFlowsCallable()
Returns the list of all flows in the specified agent.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 (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.getFlowsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
getFlow
public final Flow getFlow(FlowName name)
Retrieves the specified flow.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 (FlowsClient flowsClient = FlowsClient.create()) { FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); Flow response = flowsClient.getFlow(name); }
- Parameters:
name
- Required. The name of the flow to get. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getFlow
public final Flow getFlow(String name)
Retrieves the specified flow.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 (FlowsClient flowsClient = FlowsClient.create()) { String name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString(); Flow response = flowsClient.getFlow(name); }
- Parameters:
name
- Required. The name of the flow to get. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getFlow
public final Flow getFlow(GetFlowRequest request)
Retrieves the specified flow.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 (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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getFlowCallable
public final com.google.api.gax.rpc.UnaryCallable<GetFlowRequest,Flow> getFlowCallable()
Retrieves the specified flow.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 (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(); }
-
updateFlow
public final Flow updateFlow(Flow flow, com.google.protobuf.FieldMask updateMask)
Updates the specified flow.Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (FlowsClient flowsClient = FlowsClient.create()) { Flow flow = Flow.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Flow response = flowsClient.updateFlow(flow, updateMask); }
- Parameters:
flow
- Required. The flow to update.updateMask
- The mask to control which fields get updated. If the mask is not present, all fields will be updated.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateFlow
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](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateFlowCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateFlowRequest,Flow> updateFlowCallable()
Updates the specified flow.Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (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(); }
-
trainFlowAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.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](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (FlowsClient flowsClient = FlowsClient.create()) { FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); flowsClient.trainFlowAsync(name).get(); }
- Parameters:
name
- Required. The flow to train. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
trainFlowAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.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](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (FlowsClient flowsClient = FlowsClient.create()) { String name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString(); flowsClient.trainFlowAsync(name).get(); }
- Parameters:
name
- Required. The flow to train. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
trainFlowAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.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](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (FlowsClient flowsClient = FlowsClient.create()) { TrainFlowRequest request = TrainFlowRequest.newBuilder() .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) .build(); flowsClient.trainFlowAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
trainFlowOperationCallable
public final com.google.api.gax.rpc.OperationCallable<TrainFlowRequest,com.google.protobuf.Empty,com.google.protobuf.Struct> trainFlowOperationCallable()
Trains the specified flow. Note that only the flow in 'draft' environment is trained.This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (FlowsClient flowsClient = FlowsClient.create()) { TrainFlowRequest request = TrainFlowRequest.newBuilder() .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) .build(); OperationFuture<Empty, Struct> future = flowsClient.trainFlowOperationCallable().futureCall(request); // Do something. future.get(); }
-
trainFlowCallable
public final com.google.api.gax.rpc.UnaryCallable<TrainFlowRequest,com.google.longrunning.Operation> trainFlowCallable()
Trains the specified flow. Note that only the flow in 'draft' environment is trained.This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (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(); }
-
validateFlow
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:
// 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 (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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
validateFlowCallable
public final com.google.api.gax.rpc.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:
// 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 (FlowsClient flowsClient = FlowsClient.create()) { ValidateFlowRequest request = ValidateFlowRequest.newBuilder() .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) .setLanguageCode("languageCode-2092349083") .build(); ApiFuture<FlowValidationResult> future = flowsClient.validateFlowCallable().futureCall(request); // Do something. FlowValidationResult response = future.get(); }
-
getFlowValidationResult
public final FlowValidationResult getFlowValidationResult(FlowValidationResultName name)
Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.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 (FlowsClient flowsClient = FlowsClient.create()) { FlowValidationResultName name = FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); FlowValidationResult response = flowsClient.getFlowValidationResult(name); }
- Parameters:
name
- Required. The flow name. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/validationResult`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getFlowValidationResult
public final FlowValidationResult getFlowValidationResult(String name)
Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.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 (FlowsClient flowsClient = FlowsClient.create()) { String name = FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString(); FlowValidationResult response = flowsClient.getFlowValidationResult(name); }
- Parameters:
name
- Required. The flow name. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/validationResult`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getFlowValidationResult
public final FlowValidationResult getFlowValidationResult(GetFlowValidationResultRequest request)
Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.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 (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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getFlowValidationResultCallable
public final com.google.api.gax.rpc.UnaryCallable<GetFlowValidationResultRequest,FlowValidationResult> getFlowValidationResultCallable()
Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.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 (FlowsClient flowsClient = FlowsClient.create()) { GetFlowValidationResultRequest request = GetFlowValidationResultRequest.newBuilder() .setName( FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]") .toString()) .setLanguageCode("languageCode-2092349083") .build(); ApiFuture<FlowValidationResult> future = flowsClient.getFlowValidationResultCallable().futureCall(request); // Do something. FlowValidationResult response = future.get(); }
-
importFlowAsync
public final com.google.api.gax.longrunning.OperationFuture<ImportFlowResponse,com.google.protobuf.Struct> importFlowAsync(ImportFlowRequest request)
Imports the specified flow to the specified agent from a binary file.This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ImportFlowResponse][google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse]
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (FlowsClient flowsClient = FlowsClient.create()) { ImportFlowRequest request = ImportFlowRequest.newBuilder() .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) .setFlowImportStrategy(FlowImportStrategy.newBuilder().build()) .build(); ImportFlowResponse response = flowsClient.importFlowAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
importFlowOperationCallable
public final com.google.api.gax.rpc.OperationCallable<ImportFlowRequest,ImportFlowResponse,com.google.protobuf.Struct> importFlowOperationCallable()
Imports the specified flow to the specified agent from a binary file.This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ImportFlowResponse][google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse]
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (FlowsClient flowsClient = FlowsClient.create()) { ImportFlowRequest request = ImportFlowRequest.newBuilder() .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) .setFlowImportStrategy(FlowImportStrategy.newBuilder().build()) .build(); OperationFuture<ImportFlowResponse, Struct> future = flowsClient.importFlowOperationCallable().futureCall(request); // Do something. ImportFlowResponse response = future.get(); }
-
importFlowCallable
public final com.google.api.gax.rpc.UnaryCallable<ImportFlowRequest,com.google.longrunning.Operation> importFlowCallable()
Imports the specified flow to the specified agent from a binary file.This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ImportFlowResponse][google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse]
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
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 (FlowsClient flowsClient = FlowsClient.create()) { ImportFlowRequest request = ImportFlowRequest.newBuilder() .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) .setFlowImportStrategy(FlowImportStrategy.newBuilder().build()) .build(); ApiFuture<Operation> future = flowsClient.importFlowCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
exportFlowAsync
public final com.google.api.gax.longrunning.OperationFuture<ExportFlowResponse,com.google.protobuf.Struct> exportFlowAsync(ExportFlowRequest request)
Exports the specified flow to a binary file.This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportFlowResponse][google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse]
Note that resources (e.g. intents, entities, webhooks) that the flow references will also be exported.
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 (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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
exportFlowOperationCallable
public final com.google.api.gax.rpc.OperationCallable<ExportFlowRequest,ExportFlowResponse,com.google.protobuf.Struct> exportFlowOperationCallable()
Exports the specified flow to a binary file.This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportFlowResponse][google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse]
Note that resources (e.g. intents, entities, webhooks) that the flow references will also be exported.
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 (FlowsClient flowsClient = FlowsClient.create()) { ExportFlowRequest request = ExportFlowRequest.newBuilder() .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) .setFlowUri("flowUri-765815458") .setIncludeReferencedFlows(true) .build(); OperationFuture<ExportFlowResponse, Struct> future = flowsClient.exportFlowOperationCallable().futureCall(request); // Do something. ExportFlowResponse response = future.get(); }
-
exportFlowCallable
public final com.google.api.gax.rpc.UnaryCallable<ExportFlowRequest,com.google.longrunning.Operation> exportFlowCallable()
Exports the specified flow to a binary file.This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportFlowResponse][google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse]
Note that resources (e.g. intents, entities, webhooks) that the flow references will also be exported.
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 (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(); }
-
listLocations
public final FlowsClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.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 (FlowsClient flowsClient = FlowsClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Location element : flowsClient.listLocations(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listLocationsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,FlowsClient.ListLocationsPagedResponse> listLocationsPagedCallable()
Lists information about the supported locations for this service.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 (FlowsClient flowsClient = FlowsClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Location> future = flowsClient.listLocationsPagedCallable().futureCall(request); // Do something. for (Location element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listLocationsCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
Lists information about the supported locations for this service.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 (FlowsClient flowsClient = FlowsClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListLocationsResponse response = flowsClient.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; } } }
-
getLocation
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.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 (FlowsClient flowsClient = FlowsClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location response = flowsClient.getLocation(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getLocationCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
Gets information about a location.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 (FlowsClient flowsClient = FlowsClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); ApiFuture<Location> future = flowsClient.getLocationCallable().futureCall(request); // Do something. Location response = future.get(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-