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