• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.cloud.dialogflow.cx.v3beta1;
18 
19 import com.google.api.core.ApiFuture;
20 import com.google.api.core.ApiFutures;
21 import com.google.api.core.BetaApi;
22 import com.google.api.gax.core.BackgroundResource;
23 import com.google.api.gax.httpjson.longrunning.OperationsClient;
24 import com.google.api.gax.longrunning.OperationFuture;
25 import com.google.api.gax.paging.AbstractFixedSizeCollection;
26 import com.google.api.gax.paging.AbstractPage;
27 import com.google.api.gax.paging.AbstractPagedListResponse;
28 import com.google.api.gax.rpc.OperationCallable;
29 import com.google.api.gax.rpc.PageContext;
30 import com.google.api.gax.rpc.UnaryCallable;
31 import com.google.cloud.dialogflow.cx.v3beta1.stub.FlowsStub;
32 import com.google.cloud.dialogflow.cx.v3beta1.stub.FlowsStubSettings;
33 import com.google.cloud.location.GetLocationRequest;
34 import com.google.cloud.location.ListLocationsRequest;
35 import com.google.cloud.location.ListLocationsResponse;
36 import com.google.cloud.location.Location;
37 import com.google.common.util.concurrent.MoreExecutors;
38 import com.google.longrunning.Operation;
39 import com.google.protobuf.Empty;
40 import com.google.protobuf.FieldMask;
41 import com.google.protobuf.Struct;
42 import java.io.IOException;
43 import java.util.List;
44 import java.util.concurrent.TimeUnit;
45 import javax.annotation.Generated;
46 
47 // AUTO-GENERATED DOCUMENTATION AND CLASS.
48 /**
49  * Service Description: Service for managing [Flows][google.cloud.dialogflow.cx.v3beta1.Flow].
50  *
51  * <p>This class provides the ability to make remote calls to the backing service through method
52  * calls that map to API methods. Sample code to get started:
53  *
54  * <pre>{@code
55  * // This snippet has been automatically generated and should be regarded as a code template only.
56  * // It will require modifications to work:
57  * // - It may require correct/in-range values for request initialization.
58  * // - It may require specifying regional endpoints when creating the service client as shown in
59  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
60  * try (FlowsClient flowsClient = FlowsClient.create()) {
61  *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
62  *   Flow flow = Flow.newBuilder().build();
63  *   Flow response = flowsClient.createFlow(parent, flow);
64  * }
65  * }</pre>
66  *
67  * <p>Note: close() needs to be called on the FlowsClient object to clean up resources such as
68  * threads. In the example above, try-with-resources is used, which automatically calls close().
69  *
70  * <p>The surface of this class includes several types of Java methods for each of the API's
71  * methods:
72  *
73  * <ol>
74  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
75  *       converted into function parameters. It may be the case that not all fields are available as
76  *       parameters, and not every API method will have a flattened method entry point.
77  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
78  *       which must be constructed before the call. Not every API method will have a request object
79  *       method.
80  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
81  *       callable object, which can be used to initiate calls to the service.
82  * </ol>
83  *
84  * <p>See the individual methods for example code.
85  *
86  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
87  * these names, this class includes a format method for each type of name, and additionally a parse
88  * method to extract the individual identifiers contained within names that are returned.
89  *
90  * <p>This class can be customized by passing in a custom instance of FlowsSettings to create(). For
91  * example:
92  *
93  * <p>To customize credentials:
94  *
95  * <pre>{@code
96  * // This snippet has been automatically generated and should be regarded as a code template only.
97  * // It will require modifications to work:
98  * // - It may require correct/in-range values for request initialization.
99  * // - It may require specifying regional endpoints when creating the service client as shown in
100  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
101  * FlowsSettings flowsSettings =
102  *     FlowsSettings.newBuilder()
103  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
104  *         .build();
105  * FlowsClient flowsClient = FlowsClient.create(flowsSettings);
106  * }</pre>
107  *
108  * <p>To customize the endpoint:
109  *
110  * <pre>{@code
111  * // This snippet has been automatically generated and should be regarded as a code template only.
112  * // It will require modifications to work:
113  * // - It may require correct/in-range values for request initialization.
114  * // - It may require specifying regional endpoints when creating the service client as shown in
115  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
116  * FlowsSettings flowsSettings = FlowsSettings.newBuilder().setEndpoint(myEndpoint).build();
117  * FlowsClient flowsClient = FlowsClient.create(flowsSettings);
118  * }</pre>
119  *
120  * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
121  * the wire:
122  *
123  * <pre>{@code
124  * // This snippet has been automatically generated and should be regarded as a code template only.
125  * // It will require modifications to work:
126  * // - It may require correct/in-range values for request initialization.
127  * // - It may require specifying regional endpoints when creating the service client as shown in
128  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
129  * FlowsSettings flowsSettings = FlowsSettings.newHttpJsonBuilder().build();
130  * FlowsClient flowsClient = FlowsClient.create(flowsSettings);
131  * }</pre>
132  *
133  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
134  */
135 @BetaApi
136 @Generated("by gapic-generator-java")
137 public class FlowsClient implements BackgroundResource {
138   private final FlowsSettings settings;
139   private final FlowsStub stub;
140   private final OperationsClient httpJsonOperationsClient;
141   private final com.google.longrunning.OperationsClient operationsClient;
142 
143   /** Constructs an instance of FlowsClient with default settings. */
create()144   public static final FlowsClient create() throws IOException {
145     return create(FlowsSettings.newBuilder().build());
146   }
147 
148   /**
149    * Constructs an instance of FlowsClient, using the given settings. The channels are created based
150    * on the settings passed in, or defaults for any settings that are not set.
151    */
create(FlowsSettings settings)152   public static final FlowsClient create(FlowsSettings settings) throws IOException {
153     return new FlowsClient(settings);
154   }
155 
156   /**
157    * Constructs an instance of FlowsClient, using the given stub for making calls. This is for
158    * advanced usage - prefer using create(FlowsSettings).
159    */
create(FlowsStub stub)160   public static final FlowsClient create(FlowsStub stub) {
161     return new FlowsClient(stub);
162   }
163 
164   /**
165    * Constructs an instance of FlowsClient, using the given settings. This is protected so that it
166    * is easy to make a subclass, but otherwise, the static factory methods should be preferred.
167    */
FlowsClient(FlowsSettings settings)168   protected FlowsClient(FlowsSettings settings) throws IOException {
169     this.settings = settings;
170     this.stub = ((FlowsStubSettings) settings.getStubSettings()).createStub();
171     this.operationsClient =
172         com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
173     this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
174   }
175 
FlowsClient(FlowsStub stub)176   protected FlowsClient(FlowsStub stub) {
177     this.settings = null;
178     this.stub = stub;
179     this.operationsClient =
180         com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
181     this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
182   }
183 
getSettings()184   public final FlowsSettings getSettings() {
185     return settings;
186   }
187 
getStub()188   public FlowsStub getStub() {
189     return stub;
190   }
191 
192   /**
193    * Returns the OperationsClient that can be used to query the status of a long-running operation
194    * returned by another API method call.
195    */
getOperationsClient()196   public final com.google.longrunning.OperationsClient getOperationsClient() {
197     return operationsClient;
198   }
199 
200   /**
201    * Returns the OperationsClient that can be used to query the status of a long-running operation
202    * returned by another API method call.
203    */
204   @BetaApi
getHttpJsonOperationsClient()205   public final OperationsClient getHttpJsonOperationsClient() {
206     return httpJsonOperationsClient;
207   }
208 
209   // AUTO-GENERATED DOCUMENTATION AND METHOD.
210   /**
211    * Creates a flow in the specified agent.
212    *
213    * <p>Note: You should always train a flow prior to sending it queries. See the [training
214    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
215    *
216    * <p>Sample code:
217    *
218    * <pre>{@code
219    * // This snippet has been automatically generated and should be regarded as a code template only.
220    * // It will require modifications to work:
221    * // - It may require correct/in-range values for request initialization.
222    * // - It may require specifying regional endpoints when creating the service client as shown in
223    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
224    * try (FlowsClient flowsClient = FlowsClient.create()) {
225    *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
226    *   Flow flow = Flow.newBuilder().build();
227    *   Flow response = flowsClient.createFlow(parent, flow);
228    * }
229    * }</pre>
230    *
231    * @param parent Required. The agent to create a flow for. Format: `projects/&lt;Project
232    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;`.
233    * @param flow Required. The flow to create.
234    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
235    */
createFlow(AgentName parent, Flow flow)236   public final Flow createFlow(AgentName parent, Flow flow) {
237     CreateFlowRequest request =
238         CreateFlowRequest.newBuilder()
239             .setParent(parent == null ? null : parent.toString())
240             .setFlow(flow)
241             .build();
242     return createFlow(request);
243   }
244 
245   // AUTO-GENERATED DOCUMENTATION AND METHOD.
246   /**
247    * Creates a flow in the specified agent.
248    *
249    * <p>Note: You should always train a flow prior to sending it queries. See the [training
250    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
251    *
252    * <p>Sample code:
253    *
254    * <pre>{@code
255    * // This snippet has been automatically generated and should be regarded as a code template only.
256    * // It will require modifications to work:
257    * // - It may require correct/in-range values for request initialization.
258    * // - It may require specifying regional endpoints when creating the service client as shown in
259    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
260    * try (FlowsClient flowsClient = FlowsClient.create()) {
261    *   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
262    *   Flow flow = Flow.newBuilder().build();
263    *   Flow response = flowsClient.createFlow(parent, flow);
264    * }
265    * }</pre>
266    *
267    * @param parent Required. The agent to create a flow for. Format: `projects/&lt;Project
268    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;`.
269    * @param flow Required. The flow to create.
270    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
271    */
createFlow(String parent, Flow flow)272   public final Flow createFlow(String parent, Flow flow) {
273     CreateFlowRequest request =
274         CreateFlowRequest.newBuilder().setParent(parent).setFlow(flow).build();
275     return createFlow(request);
276   }
277 
278   // AUTO-GENERATED DOCUMENTATION AND METHOD.
279   /**
280    * Creates a flow in the specified agent.
281    *
282    * <p>Note: You should always train a flow prior to sending it queries. See the [training
283    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
284    *
285    * <p>Sample code:
286    *
287    * <pre>{@code
288    * // This snippet has been automatically generated and should be regarded as a code template only.
289    * // It will require modifications to work:
290    * // - It may require correct/in-range values for request initialization.
291    * // - It may require specifying regional endpoints when creating the service client as shown in
292    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
293    * try (FlowsClient flowsClient = FlowsClient.create()) {
294    *   CreateFlowRequest request =
295    *       CreateFlowRequest.newBuilder()
296    *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
297    *           .setFlow(Flow.newBuilder().build())
298    *           .setLanguageCode("languageCode-2092349083")
299    *           .build();
300    *   Flow response = flowsClient.createFlow(request);
301    * }
302    * }</pre>
303    *
304    * @param request The request object containing all of the parameters for the API call.
305    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
306    */
createFlow(CreateFlowRequest request)307   public final Flow createFlow(CreateFlowRequest request) {
308     return createFlowCallable().call(request);
309   }
310 
311   // AUTO-GENERATED DOCUMENTATION AND METHOD.
312   /**
313    * Creates a flow in the specified agent.
314    *
315    * <p>Note: You should always train a flow prior to sending it queries. See the [training
316    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
317    *
318    * <p>Sample code:
319    *
320    * <pre>{@code
321    * // This snippet has been automatically generated and should be regarded as a code template only.
322    * // It will require modifications to work:
323    * // - It may require correct/in-range values for request initialization.
324    * // - It may require specifying regional endpoints when creating the service client as shown in
325    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
326    * try (FlowsClient flowsClient = FlowsClient.create()) {
327    *   CreateFlowRequest request =
328    *       CreateFlowRequest.newBuilder()
329    *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
330    *           .setFlow(Flow.newBuilder().build())
331    *           .setLanguageCode("languageCode-2092349083")
332    *           .build();
333    *   ApiFuture<Flow> future = flowsClient.createFlowCallable().futureCall(request);
334    *   // Do something.
335    *   Flow response = future.get();
336    * }
337    * }</pre>
338    */
createFlowCallable()339   public final UnaryCallable<CreateFlowRequest, Flow> createFlowCallable() {
340     return stub.createFlowCallable();
341   }
342 
343   // AUTO-GENERATED DOCUMENTATION AND METHOD.
344   /**
345    * Deletes a specified flow.
346    *
347    * <p>Sample code:
348    *
349    * <pre>{@code
350    * // This snippet has been automatically generated and should be regarded as a code template only.
351    * // It will require modifications to work:
352    * // - It may require correct/in-range values for request initialization.
353    * // - It may require specifying regional endpoints when creating the service client as shown in
354    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
355    * try (FlowsClient flowsClient = FlowsClient.create()) {
356    *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
357    *   flowsClient.deleteFlow(name);
358    * }
359    * }</pre>
360    *
361    * @param name Required. The name of the flow to delete. Format: `projects/&lt;Project
362    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow ID&gt;`.
363    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
364    */
deleteFlow(FlowName name)365   public final void deleteFlow(FlowName name) {
366     DeleteFlowRequest request =
367         DeleteFlowRequest.newBuilder().setName(name == null ? null : name.toString()).build();
368     deleteFlow(request);
369   }
370 
371   // AUTO-GENERATED DOCUMENTATION AND METHOD.
372   /**
373    * Deletes a specified flow.
374    *
375    * <p>Sample code:
376    *
377    * <pre>{@code
378    * // This snippet has been automatically generated and should be regarded as a code template only.
379    * // It will require modifications to work:
380    * // - It may require correct/in-range values for request initialization.
381    * // - It may require specifying regional endpoints when creating the service client as shown in
382    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
383    * try (FlowsClient flowsClient = FlowsClient.create()) {
384    *   String name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
385    *   flowsClient.deleteFlow(name);
386    * }
387    * }</pre>
388    *
389    * @param name Required. The name of the flow to delete. Format: `projects/&lt;Project
390    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow ID&gt;`.
391    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
392    */
deleteFlow(String name)393   public final void deleteFlow(String name) {
394     DeleteFlowRequest request = DeleteFlowRequest.newBuilder().setName(name).build();
395     deleteFlow(request);
396   }
397 
398   // AUTO-GENERATED DOCUMENTATION AND METHOD.
399   /**
400    * Deletes a specified flow.
401    *
402    * <p>Sample code:
403    *
404    * <pre>{@code
405    * // This snippet has been automatically generated and should be regarded as a code template only.
406    * // It will require modifications to work:
407    * // - It may require correct/in-range values for request initialization.
408    * // - It may require specifying regional endpoints when creating the service client as shown in
409    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
410    * try (FlowsClient flowsClient = FlowsClient.create()) {
411    *   DeleteFlowRequest request =
412    *       DeleteFlowRequest.newBuilder()
413    *           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
414    *           .setForce(true)
415    *           .build();
416    *   flowsClient.deleteFlow(request);
417    * }
418    * }</pre>
419    *
420    * @param request The request object containing all of the parameters for the API call.
421    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
422    */
deleteFlow(DeleteFlowRequest request)423   public final void deleteFlow(DeleteFlowRequest request) {
424     deleteFlowCallable().call(request);
425   }
426 
427   // AUTO-GENERATED DOCUMENTATION AND METHOD.
428   /**
429    * Deletes a specified flow.
430    *
431    * <p>Sample code:
432    *
433    * <pre>{@code
434    * // This snippet has been automatically generated and should be regarded as a code template only.
435    * // It will require modifications to work:
436    * // - It may require correct/in-range values for request initialization.
437    * // - It may require specifying regional endpoints when creating the service client as shown in
438    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
439    * try (FlowsClient flowsClient = FlowsClient.create()) {
440    *   DeleteFlowRequest request =
441    *       DeleteFlowRequest.newBuilder()
442    *           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
443    *           .setForce(true)
444    *           .build();
445    *   ApiFuture<Empty> future = flowsClient.deleteFlowCallable().futureCall(request);
446    *   // Do something.
447    *   future.get();
448    * }
449    * }</pre>
450    */
deleteFlowCallable()451   public final UnaryCallable<DeleteFlowRequest, Empty> deleteFlowCallable() {
452     return stub.deleteFlowCallable();
453   }
454 
455   // AUTO-GENERATED DOCUMENTATION AND METHOD.
456   /**
457    * Returns the list of all flows in the specified agent.
458    *
459    * <p>Sample code:
460    *
461    * <pre>{@code
462    * // This snippet has been automatically generated and should be regarded as a code template only.
463    * // It will require modifications to work:
464    * // - It may require correct/in-range values for request initialization.
465    * // - It may require specifying regional endpoints when creating the service client as shown in
466    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
467    * try (FlowsClient flowsClient = FlowsClient.create()) {
468    *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
469    *   for (Flow element : flowsClient.listFlows(parent).iterateAll()) {
470    *     // doThingsWith(element);
471    *   }
472    * }
473    * }</pre>
474    *
475    * @param parent Required. The agent containing the flows. Format: `projects/&lt;Project
476    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;`.
477    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
478    */
listFlows(AgentName parent)479   public final ListFlowsPagedResponse listFlows(AgentName parent) {
480     ListFlowsRequest request =
481         ListFlowsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
482     return listFlows(request);
483   }
484 
485   // AUTO-GENERATED DOCUMENTATION AND METHOD.
486   /**
487    * Returns the list of all flows in the specified agent.
488    *
489    * <p>Sample code:
490    *
491    * <pre>{@code
492    * // This snippet has been automatically generated and should be regarded as a code template only.
493    * // It will require modifications to work:
494    * // - It may require correct/in-range values for request initialization.
495    * // - It may require specifying regional endpoints when creating the service client as shown in
496    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
497    * try (FlowsClient flowsClient = FlowsClient.create()) {
498    *   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
499    *   for (Flow element : flowsClient.listFlows(parent).iterateAll()) {
500    *     // doThingsWith(element);
501    *   }
502    * }
503    * }</pre>
504    *
505    * @param parent Required. The agent containing the flows. Format: `projects/&lt;Project
506    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;`.
507    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
508    */
listFlows(String parent)509   public final ListFlowsPagedResponse listFlows(String parent) {
510     ListFlowsRequest request = ListFlowsRequest.newBuilder().setParent(parent).build();
511     return listFlows(request);
512   }
513 
514   // AUTO-GENERATED DOCUMENTATION AND METHOD.
515   /**
516    * Returns the list of all flows in the specified agent.
517    *
518    * <p>Sample code:
519    *
520    * <pre>{@code
521    * // This snippet has been automatically generated and should be regarded as a code template only.
522    * // It will require modifications to work:
523    * // - It may require correct/in-range values for request initialization.
524    * // - It may require specifying regional endpoints when creating the service client as shown in
525    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
526    * try (FlowsClient flowsClient = FlowsClient.create()) {
527    *   ListFlowsRequest request =
528    *       ListFlowsRequest.newBuilder()
529    *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
530    *           .setPageSize(883849137)
531    *           .setPageToken("pageToken873572522")
532    *           .setLanguageCode("languageCode-2092349083")
533    *           .build();
534    *   for (Flow element : flowsClient.listFlows(request).iterateAll()) {
535    *     // doThingsWith(element);
536    *   }
537    * }
538    * }</pre>
539    *
540    * @param request The request object containing all of the parameters for the API call.
541    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
542    */
listFlows(ListFlowsRequest request)543   public final ListFlowsPagedResponse listFlows(ListFlowsRequest request) {
544     return listFlowsPagedCallable().call(request);
545   }
546 
547   // AUTO-GENERATED DOCUMENTATION AND METHOD.
548   /**
549    * Returns the list of all flows in the specified agent.
550    *
551    * <p>Sample code:
552    *
553    * <pre>{@code
554    * // This snippet has been automatically generated and should be regarded as a code template only.
555    * // It will require modifications to work:
556    * // - It may require correct/in-range values for request initialization.
557    * // - It may require specifying regional endpoints when creating the service client as shown in
558    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
559    * try (FlowsClient flowsClient = FlowsClient.create()) {
560    *   ListFlowsRequest request =
561    *       ListFlowsRequest.newBuilder()
562    *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
563    *           .setPageSize(883849137)
564    *           .setPageToken("pageToken873572522")
565    *           .setLanguageCode("languageCode-2092349083")
566    *           .build();
567    *   ApiFuture<Flow> future = flowsClient.listFlowsPagedCallable().futureCall(request);
568    *   // Do something.
569    *   for (Flow element : future.get().iterateAll()) {
570    *     // doThingsWith(element);
571    *   }
572    * }
573    * }</pre>
574    */
listFlowsPagedCallable()575   public final UnaryCallable<ListFlowsRequest, ListFlowsPagedResponse> listFlowsPagedCallable() {
576     return stub.listFlowsPagedCallable();
577   }
578 
579   // AUTO-GENERATED DOCUMENTATION AND METHOD.
580   /**
581    * Returns the list of all flows in the specified agent.
582    *
583    * <p>Sample code:
584    *
585    * <pre>{@code
586    * // This snippet has been automatically generated and should be regarded as a code template only.
587    * // It will require modifications to work:
588    * // - It may require correct/in-range values for request initialization.
589    * // - It may require specifying regional endpoints when creating the service client as shown in
590    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
591    * try (FlowsClient flowsClient = FlowsClient.create()) {
592    *   ListFlowsRequest request =
593    *       ListFlowsRequest.newBuilder()
594    *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
595    *           .setPageSize(883849137)
596    *           .setPageToken("pageToken873572522")
597    *           .setLanguageCode("languageCode-2092349083")
598    *           .build();
599    *   while (true) {
600    *     ListFlowsResponse response = flowsClient.listFlowsCallable().call(request);
601    *     for (Flow element : response.getFlowsList()) {
602    *       // doThingsWith(element);
603    *     }
604    *     String nextPageToken = response.getNextPageToken();
605    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
606    *       request = request.toBuilder().setPageToken(nextPageToken).build();
607    *     } else {
608    *       break;
609    *     }
610    *   }
611    * }
612    * }</pre>
613    */
listFlowsCallable()614   public final UnaryCallable<ListFlowsRequest, ListFlowsResponse> listFlowsCallable() {
615     return stub.listFlowsCallable();
616   }
617 
618   // AUTO-GENERATED DOCUMENTATION AND METHOD.
619   /**
620    * Retrieves the specified flow.
621    *
622    * <p>Sample code:
623    *
624    * <pre>{@code
625    * // This snippet has been automatically generated and should be regarded as a code template only.
626    * // It will require modifications to work:
627    * // - It may require correct/in-range values for request initialization.
628    * // - It may require specifying regional endpoints when creating the service client as shown in
629    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
630    * try (FlowsClient flowsClient = FlowsClient.create()) {
631    *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
632    *   Flow response = flowsClient.getFlow(name);
633    * }
634    * }</pre>
635    *
636    * @param name Required. The name of the flow to get. Format: `projects/&lt;Project
637    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow ID&gt;`.
638    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
639    */
getFlow(FlowName name)640   public final Flow getFlow(FlowName name) {
641     GetFlowRequest request =
642         GetFlowRequest.newBuilder().setName(name == null ? null : name.toString()).build();
643     return getFlow(request);
644   }
645 
646   // AUTO-GENERATED DOCUMENTATION AND METHOD.
647   /**
648    * Retrieves the specified flow.
649    *
650    * <p>Sample code:
651    *
652    * <pre>{@code
653    * // This snippet has been automatically generated and should be regarded as a code template only.
654    * // It will require modifications to work:
655    * // - It may require correct/in-range values for request initialization.
656    * // - It may require specifying regional endpoints when creating the service client as shown in
657    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
658    * try (FlowsClient flowsClient = FlowsClient.create()) {
659    *   String name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
660    *   Flow response = flowsClient.getFlow(name);
661    * }
662    * }</pre>
663    *
664    * @param name Required. The name of the flow to get. Format: `projects/&lt;Project
665    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow ID&gt;`.
666    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
667    */
getFlow(String name)668   public final Flow getFlow(String name) {
669     GetFlowRequest request = GetFlowRequest.newBuilder().setName(name).build();
670     return getFlow(request);
671   }
672 
673   // AUTO-GENERATED DOCUMENTATION AND METHOD.
674   /**
675    * Retrieves the specified flow.
676    *
677    * <p>Sample code:
678    *
679    * <pre>{@code
680    * // This snippet has been automatically generated and should be regarded as a code template only.
681    * // It will require modifications to work:
682    * // - It may require correct/in-range values for request initialization.
683    * // - It may require specifying regional endpoints when creating the service client as shown in
684    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
685    * try (FlowsClient flowsClient = FlowsClient.create()) {
686    *   GetFlowRequest request =
687    *       GetFlowRequest.newBuilder()
688    *           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
689    *           .setLanguageCode("languageCode-2092349083")
690    *           .build();
691    *   Flow response = flowsClient.getFlow(request);
692    * }
693    * }</pre>
694    *
695    * @param request The request object containing all of the parameters for the API call.
696    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
697    */
getFlow(GetFlowRequest request)698   public final Flow getFlow(GetFlowRequest request) {
699     return getFlowCallable().call(request);
700   }
701 
702   // AUTO-GENERATED DOCUMENTATION AND METHOD.
703   /**
704    * Retrieves the specified flow.
705    *
706    * <p>Sample code:
707    *
708    * <pre>{@code
709    * // This snippet has been automatically generated and should be regarded as a code template only.
710    * // It will require modifications to work:
711    * // - It may require correct/in-range values for request initialization.
712    * // - It may require specifying regional endpoints when creating the service client as shown in
713    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
714    * try (FlowsClient flowsClient = FlowsClient.create()) {
715    *   GetFlowRequest request =
716    *       GetFlowRequest.newBuilder()
717    *           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
718    *           .setLanguageCode("languageCode-2092349083")
719    *           .build();
720    *   ApiFuture<Flow> future = flowsClient.getFlowCallable().futureCall(request);
721    *   // Do something.
722    *   Flow response = future.get();
723    * }
724    * }</pre>
725    */
getFlowCallable()726   public final UnaryCallable<GetFlowRequest, Flow> getFlowCallable() {
727     return stub.getFlowCallable();
728   }
729 
730   // AUTO-GENERATED DOCUMENTATION AND METHOD.
731   /**
732    * Updates the specified flow.
733    *
734    * <p>Note: You should always train a flow prior to sending it queries. See the [training
735    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
736    *
737    * <p>Sample code:
738    *
739    * <pre>{@code
740    * // This snippet has been automatically generated and should be regarded as a code template only.
741    * // It will require modifications to work:
742    * // - It may require correct/in-range values for request initialization.
743    * // - It may require specifying regional endpoints when creating the service client as shown in
744    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
745    * try (FlowsClient flowsClient = FlowsClient.create()) {
746    *   Flow flow = Flow.newBuilder().build();
747    *   FieldMask updateMask = FieldMask.newBuilder().build();
748    *   Flow response = flowsClient.updateFlow(flow, updateMask);
749    * }
750    * }</pre>
751    *
752    * @param flow Required. The flow to update.
753    * @param updateMask The mask to control which fields get updated. If the mask is not present, all
754    *     fields will be updated.
755    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
756    */
updateFlow(Flow flow, FieldMask updateMask)757   public final Flow updateFlow(Flow flow, FieldMask updateMask) {
758     UpdateFlowRequest request =
759         UpdateFlowRequest.newBuilder().setFlow(flow).setUpdateMask(updateMask).build();
760     return updateFlow(request);
761   }
762 
763   // AUTO-GENERATED DOCUMENTATION AND METHOD.
764   /**
765    * Updates the specified flow.
766    *
767    * <p>Note: You should always train a flow prior to sending it queries. See the [training
768    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
769    *
770    * <p>Sample code:
771    *
772    * <pre>{@code
773    * // This snippet has been automatically generated and should be regarded as a code template only.
774    * // It will require modifications to work:
775    * // - It may require correct/in-range values for request initialization.
776    * // - It may require specifying regional endpoints when creating the service client as shown in
777    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
778    * try (FlowsClient flowsClient = FlowsClient.create()) {
779    *   UpdateFlowRequest request =
780    *       UpdateFlowRequest.newBuilder()
781    *           .setFlow(Flow.newBuilder().build())
782    *           .setUpdateMask(FieldMask.newBuilder().build())
783    *           .setLanguageCode("languageCode-2092349083")
784    *           .build();
785    *   Flow response = flowsClient.updateFlow(request);
786    * }
787    * }</pre>
788    *
789    * @param request The request object containing all of the parameters for the API call.
790    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
791    */
updateFlow(UpdateFlowRequest request)792   public final Flow updateFlow(UpdateFlowRequest request) {
793     return updateFlowCallable().call(request);
794   }
795 
796   // AUTO-GENERATED DOCUMENTATION AND METHOD.
797   /**
798    * Updates the specified flow.
799    *
800    * <p>Note: You should always train a flow prior to sending it queries. See the [training
801    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
802    *
803    * <p>Sample code:
804    *
805    * <pre>{@code
806    * // This snippet has been automatically generated and should be regarded as a code template only.
807    * // It will require modifications to work:
808    * // - It may require correct/in-range values for request initialization.
809    * // - It may require specifying regional endpoints when creating the service client as shown in
810    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
811    * try (FlowsClient flowsClient = FlowsClient.create()) {
812    *   UpdateFlowRequest request =
813    *       UpdateFlowRequest.newBuilder()
814    *           .setFlow(Flow.newBuilder().build())
815    *           .setUpdateMask(FieldMask.newBuilder().build())
816    *           .setLanguageCode("languageCode-2092349083")
817    *           .build();
818    *   ApiFuture<Flow> future = flowsClient.updateFlowCallable().futureCall(request);
819    *   // Do something.
820    *   Flow response = future.get();
821    * }
822    * }</pre>
823    */
updateFlowCallable()824   public final UnaryCallable<UpdateFlowRequest, Flow> updateFlowCallable() {
825     return stub.updateFlowCallable();
826   }
827 
828   // AUTO-GENERATED DOCUMENTATION AND METHOD.
829   /**
830    * Trains the specified flow. Note that only the flow in 'draft' environment is trained.
831    *
832    * <p>This method is a [long-running
833    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
834    * returned `Operation` type has the following method-specific fields:
835    *
836    * <p>- `metadata`: An empty [Struct
837    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
838    * - `response`: An [Empty
839    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
840    *
841    * <p>Note: You should always train a flow prior to sending it queries. See the [training
842    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
843    *
844    * <p>Sample code:
845    *
846    * <pre>{@code
847    * // This snippet has been automatically generated and should be regarded as a code template only.
848    * // It will require modifications to work:
849    * // - It may require correct/in-range values for request initialization.
850    * // - It may require specifying regional endpoints when creating the service client as shown in
851    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
852    * try (FlowsClient flowsClient = FlowsClient.create()) {
853    *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
854    *   flowsClient.trainFlowAsync(name).get();
855    * }
856    * }</pre>
857    *
858    * @param name Required. The flow to train. Format: `projects/&lt;Project
859    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow ID&gt;`.
860    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
861    */
trainFlowAsync(FlowName name)862   public final OperationFuture<Empty, Struct> trainFlowAsync(FlowName name) {
863     TrainFlowRequest request =
864         TrainFlowRequest.newBuilder().setName(name == null ? null : name.toString()).build();
865     return trainFlowAsync(request);
866   }
867 
868   // AUTO-GENERATED DOCUMENTATION AND METHOD.
869   /**
870    * Trains the specified flow. Note that only the flow in 'draft' environment is trained.
871    *
872    * <p>This method is a [long-running
873    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
874    * returned `Operation` type has the following method-specific fields:
875    *
876    * <p>- `metadata`: An empty [Struct
877    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
878    * - `response`: An [Empty
879    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
880    *
881    * <p>Note: You should always train a flow prior to sending it queries. See the [training
882    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
883    *
884    * <p>Sample code:
885    *
886    * <pre>{@code
887    * // This snippet has been automatically generated and should be regarded as a code template only.
888    * // It will require modifications to work:
889    * // - It may require correct/in-range values for request initialization.
890    * // - It may require specifying regional endpoints when creating the service client as shown in
891    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
892    * try (FlowsClient flowsClient = FlowsClient.create()) {
893    *   String name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
894    *   flowsClient.trainFlowAsync(name).get();
895    * }
896    * }</pre>
897    *
898    * @param name Required. The flow to train. Format: `projects/&lt;Project
899    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow ID&gt;`.
900    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
901    */
trainFlowAsync(String name)902   public final OperationFuture<Empty, Struct> trainFlowAsync(String name) {
903     TrainFlowRequest request = TrainFlowRequest.newBuilder().setName(name).build();
904     return trainFlowAsync(request);
905   }
906 
907   // AUTO-GENERATED DOCUMENTATION AND METHOD.
908   /**
909    * Trains the specified flow. Note that only the flow in 'draft' environment is trained.
910    *
911    * <p>This method is a [long-running
912    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
913    * returned `Operation` type has the following method-specific fields:
914    *
915    * <p>- `metadata`: An empty [Struct
916    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
917    * - `response`: An [Empty
918    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
919    *
920    * <p>Note: You should always train a flow prior to sending it queries. See the [training
921    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
922    *
923    * <p>Sample code:
924    *
925    * <pre>{@code
926    * // This snippet has been automatically generated and should be regarded as a code template only.
927    * // It will require modifications to work:
928    * // - It may require correct/in-range values for request initialization.
929    * // - It may require specifying regional endpoints when creating the service client as shown in
930    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
931    * try (FlowsClient flowsClient = FlowsClient.create()) {
932    *   TrainFlowRequest request =
933    *       TrainFlowRequest.newBuilder()
934    *           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
935    *           .build();
936    *   flowsClient.trainFlowAsync(request).get();
937    * }
938    * }</pre>
939    *
940    * @param request The request object containing all of the parameters for the API call.
941    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
942    */
trainFlowAsync(TrainFlowRequest request)943   public final OperationFuture<Empty, Struct> trainFlowAsync(TrainFlowRequest request) {
944     return trainFlowOperationCallable().futureCall(request);
945   }
946 
947   // AUTO-GENERATED DOCUMENTATION AND METHOD.
948   /**
949    * Trains the specified flow. Note that only the flow in 'draft' environment is trained.
950    *
951    * <p>This method is a [long-running
952    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
953    * returned `Operation` type has the following method-specific fields:
954    *
955    * <p>- `metadata`: An empty [Struct
956    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
957    * - `response`: An [Empty
958    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
959    *
960    * <p>Note: You should always train a flow prior to sending it queries. See the [training
961    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
962    *
963    * <p>Sample code:
964    *
965    * <pre>{@code
966    * // This snippet has been automatically generated and should be regarded as a code template only.
967    * // It will require modifications to work:
968    * // - It may require correct/in-range values for request initialization.
969    * // - It may require specifying regional endpoints when creating the service client as shown in
970    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
971    * try (FlowsClient flowsClient = FlowsClient.create()) {
972    *   TrainFlowRequest request =
973    *       TrainFlowRequest.newBuilder()
974    *           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
975    *           .build();
976    *   OperationFuture<Empty, Struct> future =
977    *       flowsClient.trainFlowOperationCallable().futureCall(request);
978    *   // Do something.
979    *   future.get();
980    * }
981    * }</pre>
982    */
trainFlowOperationCallable()983   public final OperationCallable<TrainFlowRequest, Empty, Struct> trainFlowOperationCallable() {
984     return stub.trainFlowOperationCallable();
985   }
986 
987   // AUTO-GENERATED DOCUMENTATION AND METHOD.
988   /**
989    * Trains the specified flow. Note that only the flow in 'draft' environment is trained.
990    *
991    * <p>This method is a [long-running
992    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
993    * returned `Operation` type has the following method-specific fields:
994    *
995    * <p>- `metadata`: An empty [Struct
996    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
997    * - `response`: An [Empty
998    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
999    *
1000    * <p>Note: You should always train a flow prior to sending it queries. See the [training
1001    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
1002    *
1003    * <p>Sample code:
1004    *
1005    * <pre>{@code
1006    * // This snippet has been automatically generated and should be regarded as a code template only.
1007    * // It will require modifications to work:
1008    * // - It may require correct/in-range values for request initialization.
1009    * // - It may require specifying regional endpoints when creating the service client as shown in
1010    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1011    * try (FlowsClient flowsClient = FlowsClient.create()) {
1012    *   TrainFlowRequest request =
1013    *       TrainFlowRequest.newBuilder()
1014    *           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
1015    *           .build();
1016    *   ApiFuture<Operation> future = flowsClient.trainFlowCallable().futureCall(request);
1017    *   // Do something.
1018    *   future.get();
1019    * }
1020    * }</pre>
1021    */
trainFlowCallable()1022   public final UnaryCallable<TrainFlowRequest, Operation> trainFlowCallable() {
1023     return stub.trainFlowCallable();
1024   }
1025 
1026   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1027   /**
1028    * Validates the specified flow and creates or updates validation results. Please call this API
1029    * after the training is completed to get the complete validation results.
1030    *
1031    * <p>Sample code:
1032    *
1033    * <pre>{@code
1034    * // This snippet has been automatically generated and should be regarded as a code template only.
1035    * // It will require modifications to work:
1036    * // - It may require correct/in-range values for request initialization.
1037    * // - It may require specifying regional endpoints when creating the service client as shown in
1038    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1039    * try (FlowsClient flowsClient = FlowsClient.create()) {
1040    *   ValidateFlowRequest request =
1041    *       ValidateFlowRequest.newBuilder()
1042    *           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
1043    *           .setLanguageCode("languageCode-2092349083")
1044    *           .build();
1045    *   FlowValidationResult response = flowsClient.validateFlow(request);
1046    * }
1047    * }</pre>
1048    *
1049    * @param request The request object containing all of the parameters for the API call.
1050    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1051    */
validateFlow(ValidateFlowRequest request)1052   public final FlowValidationResult validateFlow(ValidateFlowRequest request) {
1053     return validateFlowCallable().call(request);
1054   }
1055 
1056   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1057   /**
1058    * Validates the specified flow and creates or updates validation results. Please call this API
1059    * after the training is completed to get the complete validation results.
1060    *
1061    * <p>Sample code:
1062    *
1063    * <pre>{@code
1064    * // This snippet has been automatically generated and should be regarded as a code template only.
1065    * // It will require modifications to work:
1066    * // - It may require correct/in-range values for request initialization.
1067    * // - It may require specifying regional endpoints when creating the service client as shown in
1068    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1069    * try (FlowsClient flowsClient = FlowsClient.create()) {
1070    *   ValidateFlowRequest request =
1071    *       ValidateFlowRequest.newBuilder()
1072    *           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
1073    *           .setLanguageCode("languageCode-2092349083")
1074    *           .build();
1075    *   ApiFuture<FlowValidationResult> future =
1076    *       flowsClient.validateFlowCallable().futureCall(request);
1077    *   // Do something.
1078    *   FlowValidationResult response = future.get();
1079    * }
1080    * }</pre>
1081    */
validateFlowCallable()1082   public final UnaryCallable<ValidateFlowRequest, FlowValidationResult> validateFlowCallable() {
1083     return stub.validateFlowCallable();
1084   }
1085 
1086   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1087   /**
1088    * Gets the latest flow validation result. Flow validation is performed when ValidateFlow is
1089    * called.
1090    *
1091    * <p>Sample code:
1092    *
1093    * <pre>{@code
1094    * // This snippet has been automatically generated and should be regarded as a code template only.
1095    * // It will require modifications to work:
1096    * // - It may require correct/in-range values for request initialization.
1097    * // - It may require specifying regional endpoints when creating the service client as shown in
1098    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1099    * try (FlowsClient flowsClient = FlowsClient.create()) {
1100    *   FlowValidationResultName name =
1101    *       FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
1102    *   FlowValidationResult response = flowsClient.getFlowValidationResult(name);
1103    * }
1104    * }</pre>
1105    *
1106    * @param name Required. The flow name. Format: `projects/&lt;Project
1107    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow
1108    *     ID&gt;/validationResult`.
1109    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1110    */
getFlowValidationResult(FlowValidationResultName name)1111   public final FlowValidationResult getFlowValidationResult(FlowValidationResultName name) {
1112     GetFlowValidationResultRequest request =
1113         GetFlowValidationResultRequest.newBuilder()
1114             .setName(name == null ? null : name.toString())
1115             .build();
1116     return getFlowValidationResult(request);
1117   }
1118 
1119   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1120   /**
1121    * Gets the latest flow validation result. Flow validation is performed when ValidateFlow is
1122    * called.
1123    *
1124    * <p>Sample code:
1125    *
1126    * <pre>{@code
1127    * // This snippet has been automatically generated and should be regarded as a code template only.
1128    * // It will require modifications to work:
1129    * // - It may require correct/in-range values for request initialization.
1130    * // - It may require specifying regional endpoints when creating the service client as shown in
1131    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1132    * try (FlowsClient flowsClient = FlowsClient.create()) {
1133    *   String name =
1134    *       FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
1135    *   FlowValidationResult response = flowsClient.getFlowValidationResult(name);
1136    * }
1137    * }</pre>
1138    *
1139    * @param name Required. The flow name. Format: `projects/&lt;Project
1140    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow
1141    *     ID&gt;/validationResult`.
1142    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1143    */
getFlowValidationResult(String name)1144   public final FlowValidationResult getFlowValidationResult(String name) {
1145     GetFlowValidationResultRequest request =
1146         GetFlowValidationResultRequest.newBuilder().setName(name).build();
1147     return getFlowValidationResult(request);
1148   }
1149 
1150   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1151   /**
1152    * Gets the latest flow validation result. Flow validation is performed when ValidateFlow is
1153    * called.
1154    *
1155    * <p>Sample code:
1156    *
1157    * <pre>{@code
1158    * // This snippet has been automatically generated and should be regarded as a code template only.
1159    * // It will require modifications to work:
1160    * // - It may require correct/in-range values for request initialization.
1161    * // - It may require specifying regional endpoints when creating the service client as shown in
1162    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1163    * try (FlowsClient flowsClient = FlowsClient.create()) {
1164    *   GetFlowValidationResultRequest request =
1165    *       GetFlowValidationResultRequest.newBuilder()
1166    *           .setName(
1167    *               FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]")
1168    *                   .toString())
1169    *           .setLanguageCode("languageCode-2092349083")
1170    *           .build();
1171    *   FlowValidationResult response = flowsClient.getFlowValidationResult(request);
1172    * }
1173    * }</pre>
1174    *
1175    * @param request The request object containing all of the parameters for the API call.
1176    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1177    */
getFlowValidationResult( GetFlowValidationResultRequest request)1178   public final FlowValidationResult getFlowValidationResult(
1179       GetFlowValidationResultRequest request) {
1180     return getFlowValidationResultCallable().call(request);
1181   }
1182 
1183   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1184   /**
1185    * Gets the latest flow validation result. Flow validation is performed when ValidateFlow is
1186    * called.
1187    *
1188    * <p>Sample code:
1189    *
1190    * <pre>{@code
1191    * // This snippet has been automatically generated and should be regarded as a code template only.
1192    * // It will require modifications to work:
1193    * // - It may require correct/in-range values for request initialization.
1194    * // - It may require specifying regional endpoints when creating the service client as shown in
1195    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1196    * try (FlowsClient flowsClient = FlowsClient.create()) {
1197    *   GetFlowValidationResultRequest request =
1198    *       GetFlowValidationResultRequest.newBuilder()
1199    *           .setName(
1200    *               FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]")
1201    *                   .toString())
1202    *           .setLanguageCode("languageCode-2092349083")
1203    *           .build();
1204    *   ApiFuture<FlowValidationResult> future =
1205    *       flowsClient.getFlowValidationResultCallable().futureCall(request);
1206    *   // Do something.
1207    *   FlowValidationResult response = future.get();
1208    * }
1209    * }</pre>
1210    */
1211   public final UnaryCallable<GetFlowValidationResultRequest, FlowValidationResult>
getFlowValidationResultCallable()1212       getFlowValidationResultCallable() {
1213     return stub.getFlowValidationResultCallable();
1214   }
1215 
1216   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1217   /**
1218    * Imports the specified flow to the specified agent from a binary file.
1219    *
1220    * <p>This method is a [long-running
1221    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
1222    * returned `Operation` type has the following method-specific fields:
1223    *
1224    * <p>- `metadata`: An empty [Struct
1225    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
1226    * - `response`: [ImportFlowResponse][google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse]
1227    *
1228    * <p>Note: You should always train a flow prior to sending it queries. See the [training
1229    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
1230    *
1231    * <p>Sample code:
1232    *
1233    * <pre>{@code
1234    * // This snippet has been automatically generated and should be regarded as a code template only.
1235    * // It will require modifications to work:
1236    * // - It may require correct/in-range values for request initialization.
1237    * // - It may require specifying regional endpoints when creating the service client as shown in
1238    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1239    * try (FlowsClient flowsClient = FlowsClient.create()) {
1240    *   ImportFlowRequest request =
1241    *       ImportFlowRequest.newBuilder()
1242    *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
1243    *           .build();
1244    *   ImportFlowResponse response = flowsClient.importFlowAsync(request).get();
1245    * }
1246    * }</pre>
1247    *
1248    * @param request The request object containing all of the parameters for the API call.
1249    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1250    */
importFlowAsync( ImportFlowRequest request)1251   public final OperationFuture<ImportFlowResponse, Struct> importFlowAsync(
1252       ImportFlowRequest request) {
1253     return importFlowOperationCallable().futureCall(request);
1254   }
1255 
1256   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1257   /**
1258    * Imports the specified flow to the specified agent from a binary file.
1259    *
1260    * <p>This method is a [long-running
1261    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
1262    * returned `Operation` type has the following method-specific fields:
1263    *
1264    * <p>- `metadata`: An empty [Struct
1265    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
1266    * - `response`: [ImportFlowResponse][google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse]
1267    *
1268    * <p>Note: You should always train a flow prior to sending it queries. See the [training
1269    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
1270    *
1271    * <p>Sample code:
1272    *
1273    * <pre>{@code
1274    * // This snippet has been automatically generated and should be regarded as a code template only.
1275    * // It will require modifications to work:
1276    * // - It may require correct/in-range values for request initialization.
1277    * // - It may require specifying regional endpoints when creating the service client as shown in
1278    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1279    * try (FlowsClient flowsClient = FlowsClient.create()) {
1280    *   ImportFlowRequest request =
1281    *       ImportFlowRequest.newBuilder()
1282    *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
1283    *           .build();
1284    *   OperationFuture<ImportFlowResponse, Struct> future =
1285    *       flowsClient.importFlowOperationCallable().futureCall(request);
1286    *   // Do something.
1287    *   ImportFlowResponse response = future.get();
1288    * }
1289    * }</pre>
1290    */
1291   public final OperationCallable<ImportFlowRequest, ImportFlowResponse, Struct>
importFlowOperationCallable()1292       importFlowOperationCallable() {
1293     return stub.importFlowOperationCallable();
1294   }
1295 
1296   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1297   /**
1298    * Imports the specified flow to the specified agent from a binary file.
1299    *
1300    * <p>This method is a [long-running
1301    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
1302    * returned `Operation` type has the following method-specific fields:
1303    *
1304    * <p>- `metadata`: An empty [Struct
1305    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
1306    * - `response`: [ImportFlowResponse][google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse]
1307    *
1308    * <p>Note: You should always train a flow prior to sending it queries. See the [training
1309    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
1310    *
1311    * <p>Sample code:
1312    *
1313    * <pre>{@code
1314    * // This snippet has been automatically generated and should be regarded as a code template only.
1315    * // It will require modifications to work:
1316    * // - It may require correct/in-range values for request initialization.
1317    * // - It may require specifying regional endpoints when creating the service client as shown in
1318    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1319    * try (FlowsClient flowsClient = FlowsClient.create()) {
1320    *   ImportFlowRequest request =
1321    *       ImportFlowRequest.newBuilder()
1322    *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
1323    *           .build();
1324    *   ApiFuture<Operation> future = flowsClient.importFlowCallable().futureCall(request);
1325    *   // Do something.
1326    *   Operation response = future.get();
1327    * }
1328    * }</pre>
1329    */
importFlowCallable()1330   public final UnaryCallable<ImportFlowRequest, Operation> importFlowCallable() {
1331     return stub.importFlowCallable();
1332   }
1333 
1334   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1335   /**
1336    * Exports the specified flow to a binary file.
1337    *
1338    * <p>This method is a [long-running
1339    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
1340    * returned `Operation` type has the following method-specific fields:
1341    *
1342    * <p>- `metadata`: An empty [Struct
1343    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
1344    * - `response`: [ExportFlowResponse][google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse]
1345    *
1346    * <p>Note that resources (e.g. intents, entities, webhooks) that the flow references will also be
1347    * exported.
1348    *
1349    * <p>Sample code:
1350    *
1351    * <pre>{@code
1352    * // This snippet has been automatically generated and should be regarded as a code template only.
1353    * // It will require modifications to work:
1354    * // - It may require correct/in-range values for request initialization.
1355    * // - It may require specifying regional endpoints when creating the service client as shown in
1356    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1357    * try (FlowsClient flowsClient = FlowsClient.create()) {
1358    *   ExportFlowRequest request =
1359    *       ExportFlowRequest.newBuilder()
1360    *           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
1361    *           .setFlowUri("flowUri-765815458")
1362    *           .setIncludeReferencedFlows(true)
1363    *           .build();
1364    *   ExportFlowResponse response = flowsClient.exportFlowAsync(request).get();
1365    * }
1366    * }</pre>
1367    *
1368    * @param request The request object containing all of the parameters for the API call.
1369    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1370    */
exportFlowAsync( ExportFlowRequest request)1371   public final OperationFuture<ExportFlowResponse, Struct> exportFlowAsync(
1372       ExportFlowRequest request) {
1373     return exportFlowOperationCallable().futureCall(request);
1374   }
1375 
1376   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1377   /**
1378    * Exports the specified flow to a binary file.
1379    *
1380    * <p>This method is a [long-running
1381    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
1382    * returned `Operation` type has the following method-specific fields:
1383    *
1384    * <p>- `metadata`: An empty [Struct
1385    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
1386    * - `response`: [ExportFlowResponse][google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse]
1387    *
1388    * <p>Note that resources (e.g. intents, entities, webhooks) that the flow references will also be
1389    * exported.
1390    *
1391    * <p>Sample code:
1392    *
1393    * <pre>{@code
1394    * // This snippet has been automatically generated and should be regarded as a code template only.
1395    * // It will require modifications to work:
1396    * // - It may require correct/in-range values for request initialization.
1397    * // - It may require specifying regional endpoints when creating the service client as shown in
1398    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1399    * try (FlowsClient flowsClient = FlowsClient.create()) {
1400    *   ExportFlowRequest request =
1401    *       ExportFlowRequest.newBuilder()
1402    *           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
1403    *           .setFlowUri("flowUri-765815458")
1404    *           .setIncludeReferencedFlows(true)
1405    *           .build();
1406    *   OperationFuture<ExportFlowResponse, Struct> future =
1407    *       flowsClient.exportFlowOperationCallable().futureCall(request);
1408    *   // Do something.
1409    *   ExportFlowResponse response = future.get();
1410    * }
1411    * }</pre>
1412    */
1413   public final OperationCallable<ExportFlowRequest, ExportFlowResponse, Struct>
exportFlowOperationCallable()1414       exportFlowOperationCallable() {
1415     return stub.exportFlowOperationCallable();
1416   }
1417 
1418   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1419   /**
1420    * Exports the specified flow to a binary file.
1421    *
1422    * <p>This method is a [long-running
1423    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
1424    * returned `Operation` type has the following method-specific fields:
1425    *
1426    * <p>- `metadata`: An empty [Struct
1427    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
1428    * - `response`: [ExportFlowResponse][google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse]
1429    *
1430    * <p>Note that resources (e.g. intents, entities, webhooks) that the flow references will also be
1431    * exported.
1432    *
1433    * <p>Sample code:
1434    *
1435    * <pre>{@code
1436    * // This snippet has been automatically generated and should be regarded as a code template only.
1437    * // It will require modifications to work:
1438    * // - It may require correct/in-range values for request initialization.
1439    * // - It may require specifying regional endpoints when creating the service client as shown in
1440    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1441    * try (FlowsClient flowsClient = FlowsClient.create()) {
1442    *   ExportFlowRequest request =
1443    *       ExportFlowRequest.newBuilder()
1444    *           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
1445    *           .setFlowUri("flowUri-765815458")
1446    *           .setIncludeReferencedFlows(true)
1447    *           .build();
1448    *   ApiFuture<Operation> future = flowsClient.exportFlowCallable().futureCall(request);
1449    *   // Do something.
1450    *   Operation response = future.get();
1451    * }
1452    * }</pre>
1453    */
exportFlowCallable()1454   public final UnaryCallable<ExportFlowRequest, Operation> exportFlowCallable() {
1455     return stub.exportFlowCallable();
1456   }
1457 
1458   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1459   /**
1460    * Lists information about the supported locations for this service.
1461    *
1462    * <p>Sample code:
1463    *
1464    * <pre>{@code
1465    * // This snippet has been automatically generated and should be regarded as a code template only.
1466    * // It will require modifications to work:
1467    * // - It may require correct/in-range values for request initialization.
1468    * // - It may require specifying regional endpoints when creating the service client as shown in
1469    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1470    * try (FlowsClient flowsClient = FlowsClient.create()) {
1471    *   ListLocationsRequest request =
1472    *       ListLocationsRequest.newBuilder()
1473    *           .setName("name3373707")
1474    *           .setFilter("filter-1274492040")
1475    *           .setPageSize(883849137)
1476    *           .setPageToken("pageToken873572522")
1477    *           .build();
1478    *   for (Location element : flowsClient.listLocations(request).iterateAll()) {
1479    *     // doThingsWith(element);
1480    *   }
1481    * }
1482    * }</pre>
1483    *
1484    * @param request The request object containing all of the parameters for the API call.
1485    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1486    */
listLocations(ListLocationsRequest request)1487   public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
1488     return listLocationsPagedCallable().call(request);
1489   }
1490 
1491   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1492   /**
1493    * Lists information about the supported locations for this service.
1494    *
1495    * <p>Sample code:
1496    *
1497    * <pre>{@code
1498    * // This snippet has been automatically generated and should be regarded as a code template only.
1499    * // It will require modifications to work:
1500    * // - It may require correct/in-range values for request initialization.
1501    * // - It may require specifying regional endpoints when creating the service client as shown in
1502    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1503    * try (FlowsClient flowsClient = FlowsClient.create()) {
1504    *   ListLocationsRequest request =
1505    *       ListLocationsRequest.newBuilder()
1506    *           .setName("name3373707")
1507    *           .setFilter("filter-1274492040")
1508    *           .setPageSize(883849137)
1509    *           .setPageToken("pageToken873572522")
1510    *           .build();
1511    *   ApiFuture<Location> future = flowsClient.listLocationsPagedCallable().futureCall(request);
1512    *   // Do something.
1513    *   for (Location element : future.get().iterateAll()) {
1514    *     // doThingsWith(element);
1515    *   }
1516    * }
1517    * }</pre>
1518    */
1519   public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable()1520       listLocationsPagedCallable() {
1521     return stub.listLocationsPagedCallable();
1522   }
1523 
1524   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1525   /**
1526    * Lists information about the supported locations for this service.
1527    *
1528    * <p>Sample code:
1529    *
1530    * <pre>{@code
1531    * // This snippet has been automatically generated and should be regarded as a code template only.
1532    * // It will require modifications to work:
1533    * // - It may require correct/in-range values for request initialization.
1534    * // - It may require specifying regional endpoints when creating the service client as shown in
1535    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1536    * try (FlowsClient flowsClient = FlowsClient.create()) {
1537    *   ListLocationsRequest request =
1538    *       ListLocationsRequest.newBuilder()
1539    *           .setName("name3373707")
1540    *           .setFilter("filter-1274492040")
1541    *           .setPageSize(883849137)
1542    *           .setPageToken("pageToken873572522")
1543    *           .build();
1544    *   while (true) {
1545    *     ListLocationsResponse response = flowsClient.listLocationsCallable().call(request);
1546    *     for (Location element : response.getLocationsList()) {
1547    *       // doThingsWith(element);
1548    *     }
1549    *     String nextPageToken = response.getNextPageToken();
1550    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
1551    *       request = request.toBuilder().setPageToken(nextPageToken).build();
1552    *     } else {
1553    *       break;
1554    *     }
1555    *   }
1556    * }
1557    * }</pre>
1558    */
listLocationsCallable()1559   public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
1560     return stub.listLocationsCallable();
1561   }
1562 
1563   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1564   /**
1565    * Gets information about a location.
1566    *
1567    * <p>Sample code:
1568    *
1569    * <pre>{@code
1570    * // This snippet has been automatically generated and should be regarded as a code template only.
1571    * // It will require modifications to work:
1572    * // - It may require correct/in-range values for request initialization.
1573    * // - It may require specifying regional endpoints when creating the service client as shown in
1574    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1575    * try (FlowsClient flowsClient = FlowsClient.create()) {
1576    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
1577    *   Location response = flowsClient.getLocation(request);
1578    * }
1579    * }</pre>
1580    *
1581    * @param request The request object containing all of the parameters for the API call.
1582    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1583    */
getLocation(GetLocationRequest request)1584   public final Location getLocation(GetLocationRequest request) {
1585     return getLocationCallable().call(request);
1586   }
1587 
1588   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1589   /**
1590    * Gets information about a location.
1591    *
1592    * <p>Sample code:
1593    *
1594    * <pre>{@code
1595    * // This snippet has been automatically generated and should be regarded as a code template only.
1596    * // It will require modifications to work:
1597    * // - It may require correct/in-range values for request initialization.
1598    * // - It may require specifying regional endpoints when creating the service client as shown in
1599    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1600    * try (FlowsClient flowsClient = FlowsClient.create()) {
1601    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
1602    *   ApiFuture<Location> future = flowsClient.getLocationCallable().futureCall(request);
1603    *   // Do something.
1604    *   Location response = future.get();
1605    * }
1606    * }</pre>
1607    */
getLocationCallable()1608   public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
1609     return stub.getLocationCallable();
1610   }
1611 
1612   @Override
close()1613   public final void close() {
1614     stub.close();
1615   }
1616 
1617   @Override
shutdown()1618   public void shutdown() {
1619     stub.shutdown();
1620   }
1621 
1622   @Override
isShutdown()1623   public boolean isShutdown() {
1624     return stub.isShutdown();
1625   }
1626 
1627   @Override
isTerminated()1628   public boolean isTerminated() {
1629     return stub.isTerminated();
1630   }
1631 
1632   @Override
shutdownNow()1633   public void shutdownNow() {
1634     stub.shutdownNow();
1635   }
1636 
1637   @Override
awaitTermination(long duration, TimeUnit unit)1638   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
1639     return stub.awaitTermination(duration, unit);
1640   }
1641 
1642   public static class ListFlowsPagedResponse
1643       extends AbstractPagedListResponse<
1644           ListFlowsRequest, ListFlowsResponse, Flow, ListFlowsPage, ListFlowsFixedSizeCollection> {
1645 
createAsync( PageContext<ListFlowsRequest, ListFlowsResponse, Flow> context, ApiFuture<ListFlowsResponse> futureResponse)1646     public static ApiFuture<ListFlowsPagedResponse> createAsync(
1647         PageContext<ListFlowsRequest, ListFlowsResponse, Flow> context,
1648         ApiFuture<ListFlowsResponse> futureResponse) {
1649       ApiFuture<ListFlowsPage> futurePage =
1650           ListFlowsPage.createEmptyPage().createPageAsync(context, futureResponse);
1651       return ApiFutures.transform(
1652           futurePage, input -> new ListFlowsPagedResponse(input), MoreExecutors.directExecutor());
1653     }
1654 
ListFlowsPagedResponse(ListFlowsPage page)1655     private ListFlowsPagedResponse(ListFlowsPage page) {
1656       super(page, ListFlowsFixedSizeCollection.createEmptyCollection());
1657     }
1658   }
1659 
1660   public static class ListFlowsPage
1661       extends AbstractPage<ListFlowsRequest, ListFlowsResponse, Flow, ListFlowsPage> {
1662 
ListFlowsPage( PageContext<ListFlowsRequest, ListFlowsResponse, Flow> context, ListFlowsResponse response)1663     private ListFlowsPage(
1664         PageContext<ListFlowsRequest, ListFlowsResponse, Flow> context,
1665         ListFlowsResponse response) {
1666       super(context, response);
1667     }
1668 
createEmptyPage()1669     private static ListFlowsPage createEmptyPage() {
1670       return new ListFlowsPage(null, null);
1671     }
1672 
1673     @Override
createPage( PageContext<ListFlowsRequest, ListFlowsResponse, Flow> context, ListFlowsResponse response)1674     protected ListFlowsPage createPage(
1675         PageContext<ListFlowsRequest, ListFlowsResponse, Flow> context,
1676         ListFlowsResponse response) {
1677       return new ListFlowsPage(context, response);
1678     }
1679 
1680     @Override
createPageAsync( PageContext<ListFlowsRequest, ListFlowsResponse, Flow> context, ApiFuture<ListFlowsResponse> futureResponse)1681     public ApiFuture<ListFlowsPage> createPageAsync(
1682         PageContext<ListFlowsRequest, ListFlowsResponse, Flow> context,
1683         ApiFuture<ListFlowsResponse> futureResponse) {
1684       return super.createPageAsync(context, futureResponse);
1685     }
1686   }
1687 
1688   public static class ListFlowsFixedSizeCollection
1689       extends AbstractFixedSizeCollection<
1690           ListFlowsRequest, ListFlowsResponse, Flow, ListFlowsPage, ListFlowsFixedSizeCollection> {
1691 
ListFlowsFixedSizeCollection(List<ListFlowsPage> pages, int collectionSize)1692     private ListFlowsFixedSizeCollection(List<ListFlowsPage> pages, int collectionSize) {
1693       super(pages, collectionSize);
1694     }
1695 
createEmptyCollection()1696     private static ListFlowsFixedSizeCollection createEmptyCollection() {
1697       return new ListFlowsFixedSizeCollection(null, 0);
1698     }
1699 
1700     @Override
createCollection( List<ListFlowsPage> pages, int collectionSize)1701     protected ListFlowsFixedSizeCollection createCollection(
1702         List<ListFlowsPage> pages, int collectionSize) {
1703       return new ListFlowsFixedSizeCollection(pages, collectionSize);
1704     }
1705   }
1706 
1707   public static class ListLocationsPagedResponse
1708       extends AbstractPagedListResponse<
1709           ListLocationsRequest,
1710           ListLocationsResponse,
1711           Location,
1712           ListLocationsPage,
1713           ListLocationsFixedSizeCollection> {
1714 
createAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1715     public static ApiFuture<ListLocationsPagedResponse> createAsync(
1716         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1717         ApiFuture<ListLocationsResponse> futureResponse) {
1718       ApiFuture<ListLocationsPage> futurePage =
1719           ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
1720       return ApiFutures.transform(
1721           futurePage,
1722           input -> new ListLocationsPagedResponse(input),
1723           MoreExecutors.directExecutor());
1724     }
1725 
ListLocationsPagedResponse(ListLocationsPage page)1726     private ListLocationsPagedResponse(ListLocationsPage page) {
1727       super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
1728     }
1729   }
1730 
1731   public static class ListLocationsPage
1732       extends AbstractPage<
1733           ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
1734 
ListLocationsPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1735     private ListLocationsPage(
1736         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1737         ListLocationsResponse response) {
1738       super(context, response);
1739     }
1740 
createEmptyPage()1741     private static ListLocationsPage createEmptyPage() {
1742       return new ListLocationsPage(null, null);
1743     }
1744 
1745     @Override
createPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1746     protected ListLocationsPage createPage(
1747         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1748         ListLocationsResponse response) {
1749       return new ListLocationsPage(context, response);
1750     }
1751 
1752     @Override
createPageAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1753     public ApiFuture<ListLocationsPage> createPageAsync(
1754         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1755         ApiFuture<ListLocationsResponse> futureResponse) {
1756       return super.createPageAsync(context, futureResponse);
1757     }
1758   }
1759 
1760   public static class ListLocationsFixedSizeCollection
1761       extends AbstractFixedSizeCollection<
1762           ListLocationsRequest,
1763           ListLocationsResponse,
1764           Location,
1765           ListLocationsPage,
1766           ListLocationsFixedSizeCollection> {
1767 
ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize)1768     private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) {
1769       super(pages, collectionSize);
1770     }
1771 
createEmptyCollection()1772     private static ListLocationsFixedSizeCollection createEmptyCollection() {
1773       return new ListLocationsFixedSizeCollection(null, 0);
1774     }
1775 
1776     @Override
createCollection( List<ListLocationsPage> pages, int collectionSize)1777     protected ListLocationsFixedSizeCollection createCollection(
1778         List<ListLocationsPage> pages, int collectionSize) {
1779       return new ListLocationsFixedSizeCollection(pages, collectionSize);
1780     }
1781   }
1782 }
1783