• 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.VersionsStub;
32 import com.google.cloud.dialogflow.cx.v3beta1.stub.VersionsStubSettings;
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 [Versions][google.cloud.dialogflow.cx.v3beta1.Version].
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 (VersionsClient versionsClient = VersionsClient.create()) {
61  *   VersionName name =
62  *       VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
63  *   Version response = versionsClient.getVersion(name);
64  * }
65  * }</pre>
66  *
67  * <p>Note: close() needs to be called on the VersionsClient 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 VersionsSettings to create().
91  * For 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  * VersionsSettings versionsSettings =
102  *     VersionsSettings.newBuilder()
103  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
104  *         .build();
105  * VersionsClient versionsClient = VersionsClient.create(versionsSettings);
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  * VersionsSettings versionsSettings =
117  *     VersionsSettings.newBuilder().setEndpoint(myEndpoint).build();
118  * VersionsClient versionsClient = VersionsClient.create(versionsSettings);
119  * }</pre>
120  *
121  * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
122  * the wire:
123  *
124  * <pre>{@code
125  * // This snippet has been automatically generated and should be regarded as a code template only.
126  * // It will require modifications to work:
127  * // - It may require correct/in-range values for request initialization.
128  * // - It may require specifying regional endpoints when creating the service client as shown in
129  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
130  * VersionsSettings versionsSettings = VersionsSettings.newHttpJsonBuilder().build();
131  * VersionsClient versionsClient = VersionsClient.create(versionsSettings);
132  * }</pre>
133  *
134  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
135  */
136 @BetaApi
137 @Generated("by gapic-generator-java")
138 public class VersionsClient implements BackgroundResource {
139   private final VersionsSettings settings;
140   private final VersionsStub stub;
141   private final OperationsClient httpJsonOperationsClient;
142   private final com.google.longrunning.OperationsClient operationsClient;
143 
144   /** Constructs an instance of VersionsClient with default settings. */
create()145   public static final VersionsClient create() throws IOException {
146     return create(VersionsSettings.newBuilder().build());
147   }
148 
149   /**
150    * Constructs an instance of VersionsClient, using the given settings. The channels are created
151    * based on the settings passed in, or defaults for any settings that are not set.
152    */
create(VersionsSettings settings)153   public static final VersionsClient create(VersionsSettings settings) throws IOException {
154     return new VersionsClient(settings);
155   }
156 
157   /**
158    * Constructs an instance of VersionsClient, using the given stub for making calls. This is for
159    * advanced usage - prefer using create(VersionsSettings).
160    */
create(VersionsStub stub)161   public static final VersionsClient create(VersionsStub stub) {
162     return new VersionsClient(stub);
163   }
164 
165   /**
166    * Constructs an instance of VersionsClient, using the given settings. This is protected so that
167    * it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
168    */
VersionsClient(VersionsSettings settings)169   protected VersionsClient(VersionsSettings settings) throws IOException {
170     this.settings = settings;
171     this.stub = ((VersionsStubSettings) settings.getStubSettings()).createStub();
172     this.operationsClient =
173         com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
174     this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
175   }
176 
VersionsClient(VersionsStub stub)177   protected VersionsClient(VersionsStub stub) {
178     this.settings = null;
179     this.stub = stub;
180     this.operationsClient =
181         com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
182     this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
183   }
184 
getSettings()185   public final VersionsSettings getSettings() {
186     return settings;
187   }
188 
getStub()189   public VersionsStub getStub() {
190     return stub;
191   }
192 
193   /**
194    * Returns the OperationsClient that can be used to query the status of a long-running operation
195    * returned by another API method call.
196    */
getOperationsClient()197   public final com.google.longrunning.OperationsClient getOperationsClient() {
198     return operationsClient;
199   }
200 
201   /**
202    * Returns the OperationsClient that can be used to query the status of a long-running operation
203    * returned by another API method call.
204    */
205   @BetaApi
getHttpJsonOperationsClient()206   public final OperationsClient getHttpJsonOperationsClient() {
207     return httpJsonOperationsClient;
208   }
209 
210   // AUTO-GENERATED DOCUMENTATION AND METHOD.
211   /**
212    * Returns the list of all versions in the specified
213    * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow].
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 (VersionsClient versionsClient = VersionsClient.create()) {
224    *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
225    *   for (Version element : versionsClient.listVersions(parent).iterateAll()) {
226    *     // doThingsWith(element);
227    *   }
228    * }
229    * }</pre>
230    *
231    * @param parent Required. The [Flow][google.cloud.dialogflow.cx.v3beta1.Flow] to list all
232    *     versions for. Format: `projects/&lt;Project ID&gt;/locations/&lt;Location
233    *     ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow ID&gt;`.
234    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
235    */
listVersions(FlowName parent)236   public final ListVersionsPagedResponse listVersions(FlowName parent) {
237     ListVersionsRequest request =
238         ListVersionsRequest.newBuilder()
239             .setParent(parent == null ? null : parent.toString())
240             .build();
241     return listVersions(request);
242   }
243 
244   // AUTO-GENERATED DOCUMENTATION AND METHOD.
245   /**
246    * Returns the list of all versions in the specified
247    * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow].
248    *
249    * <p>Sample code:
250    *
251    * <pre>{@code
252    * // This snippet has been automatically generated and should be regarded as a code template only.
253    * // It will require modifications to work:
254    * // - It may require correct/in-range values for request initialization.
255    * // - It may require specifying regional endpoints when creating the service client as shown in
256    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
257    * try (VersionsClient versionsClient = VersionsClient.create()) {
258    *   String parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
259    *   for (Version element : versionsClient.listVersions(parent).iterateAll()) {
260    *     // doThingsWith(element);
261    *   }
262    * }
263    * }</pre>
264    *
265    * @param parent Required. The [Flow][google.cloud.dialogflow.cx.v3beta1.Flow] to list all
266    *     versions for. Format: `projects/&lt;Project ID&gt;/locations/&lt;Location
267    *     ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow ID&gt;`.
268    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
269    */
listVersions(String parent)270   public final ListVersionsPagedResponse listVersions(String parent) {
271     ListVersionsRequest request = ListVersionsRequest.newBuilder().setParent(parent).build();
272     return listVersions(request);
273   }
274 
275   // AUTO-GENERATED DOCUMENTATION AND METHOD.
276   /**
277    * Returns the list of all versions in the specified
278    * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow].
279    *
280    * <p>Sample code:
281    *
282    * <pre>{@code
283    * // This snippet has been automatically generated and should be regarded as a code template only.
284    * // It will require modifications to work:
285    * // - It may require correct/in-range values for request initialization.
286    * // - It may require specifying regional endpoints when creating the service client as shown in
287    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
288    * try (VersionsClient versionsClient = VersionsClient.create()) {
289    *   ListVersionsRequest request =
290    *       ListVersionsRequest.newBuilder()
291    *           .setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
292    *           .setPageSize(883849137)
293    *           .setPageToken("pageToken873572522")
294    *           .build();
295    *   for (Version element : versionsClient.listVersions(request).iterateAll()) {
296    *     // doThingsWith(element);
297    *   }
298    * }
299    * }</pre>
300    *
301    * @param request The request object containing all of the parameters for the API call.
302    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
303    */
listVersions(ListVersionsRequest request)304   public final ListVersionsPagedResponse listVersions(ListVersionsRequest request) {
305     return listVersionsPagedCallable().call(request);
306   }
307 
308   // AUTO-GENERATED DOCUMENTATION AND METHOD.
309   /**
310    * Returns the list of all versions in the specified
311    * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow].
312    *
313    * <p>Sample code:
314    *
315    * <pre>{@code
316    * // This snippet has been automatically generated and should be regarded as a code template only.
317    * // It will require modifications to work:
318    * // - It may require correct/in-range values for request initialization.
319    * // - It may require specifying regional endpoints when creating the service client as shown in
320    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
321    * try (VersionsClient versionsClient = VersionsClient.create()) {
322    *   ListVersionsRequest request =
323    *       ListVersionsRequest.newBuilder()
324    *           .setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
325    *           .setPageSize(883849137)
326    *           .setPageToken("pageToken873572522")
327    *           .build();
328    *   ApiFuture<Version> future = versionsClient.listVersionsPagedCallable().futureCall(request);
329    *   // Do something.
330    *   for (Version element : future.get().iterateAll()) {
331    *     // doThingsWith(element);
332    *   }
333    * }
334    * }</pre>
335    */
336   public final UnaryCallable<ListVersionsRequest, ListVersionsPagedResponse>
listVersionsPagedCallable()337       listVersionsPagedCallable() {
338     return stub.listVersionsPagedCallable();
339   }
340 
341   // AUTO-GENERATED DOCUMENTATION AND METHOD.
342   /**
343    * Returns the list of all versions in the specified
344    * [Flow][google.cloud.dialogflow.cx.v3beta1.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 (VersionsClient versionsClient = VersionsClient.create()) {
355    *   ListVersionsRequest request =
356    *       ListVersionsRequest.newBuilder()
357    *           .setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
358    *           .setPageSize(883849137)
359    *           .setPageToken("pageToken873572522")
360    *           .build();
361    *   while (true) {
362    *     ListVersionsResponse response = versionsClient.listVersionsCallable().call(request);
363    *     for (Version element : response.getVersionsList()) {
364    *       // doThingsWith(element);
365    *     }
366    *     String nextPageToken = response.getNextPageToken();
367    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
368    *       request = request.toBuilder().setPageToken(nextPageToken).build();
369    *     } else {
370    *       break;
371    *     }
372    *   }
373    * }
374    * }</pre>
375    */
listVersionsCallable()376   public final UnaryCallable<ListVersionsRequest, ListVersionsResponse> listVersionsCallable() {
377     return stub.listVersionsCallable();
378   }
379 
380   // AUTO-GENERATED DOCUMENTATION AND METHOD.
381   /**
382    * Retrieves the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version].
383    *
384    * <p>Sample code:
385    *
386    * <pre>{@code
387    * // This snippet has been automatically generated and should be regarded as a code template only.
388    * // It will require modifications to work:
389    * // - It may require correct/in-range values for request initialization.
390    * // - It may require specifying regional endpoints when creating the service client as shown in
391    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
392    * try (VersionsClient versionsClient = VersionsClient.create()) {
393    *   VersionName name =
394    *       VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
395    *   Version response = versionsClient.getVersion(name);
396    * }
397    * }</pre>
398    *
399    * @param name Required. The name of the [Version][google.cloud.dialogflow.cx.v3beta1.Version].
400    *     Format: `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent
401    *     ID&gt;/flows/&lt;Flow ID&gt;/versions/&lt;Version ID&gt;`.
402    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
403    */
getVersion(VersionName name)404   public final Version getVersion(VersionName name) {
405     GetVersionRequest request =
406         GetVersionRequest.newBuilder().setName(name == null ? null : name.toString()).build();
407     return getVersion(request);
408   }
409 
410   // AUTO-GENERATED DOCUMENTATION AND METHOD.
411   /**
412    * Retrieves the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version].
413    *
414    * <p>Sample code:
415    *
416    * <pre>{@code
417    * // This snippet has been automatically generated and should be regarded as a code template only.
418    * // It will require modifications to work:
419    * // - It may require correct/in-range values for request initialization.
420    * // - It may require specifying regional endpoints when creating the service client as shown in
421    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
422    * try (VersionsClient versionsClient = VersionsClient.create()) {
423    *   String name =
424    *       VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]").toString();
425    *   Version response = versionsClient.getVersion(name);
426    * }
427    * }</pre>
428    *
429    * @param name Required. The name of the [Version][google.cloud.dialogflow.cx.v3beta1.Version].
430    *     Format: `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent
431    *     ID&gt;/flows/&lt;Flow ID&gt;/versions/&lt;Version ID&gt;`.
432    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
433    */
getVersion(String name)434   public final Version getVersion(String name) {
435     GetVersionRequest request = GetVersionRequest.newBuilder().setName(name).build();
436     return getVersion(request);
437   }
438 
439   // AUTO-GENERATED DOCUMENTATION AND METHOD.
440   /**
441    * Retrieves the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version].
442    *
443    * <p>Sample code:
444    *
445    * <pre>{@code
446    * // This snippet has been automatically generated and should be regarded as a code template only.
447    * // It will require modifications to work:
448    * // - It may require correct/in-range values for request initialization.
449    * // - It may require specifying regional endpoints when creating the service client as shown in
450    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
451    * try (VersionsClient versionsClient = VersionsClient.create()) {
452    *   GetVersionRequest request =
453    *       GetVersionRequest.newBuilder()
454    *           .setName(
455    *               VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]")
456    *                   .toString())
457    *           .build();
458    *   Version response = versionsClient.getVersion(request);
459    * }
460    * }</pre>
461    *
462    * @param request The request object containing all of the parameters for the API call.
463    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
464    */
getVersion(GetVersionRequest request)465   public final Version getVersion(GetVersionRequest request) {
466     return getVersionCallable().call(request);
467   }
468 
469   // AUTO-GENERATED DOCUMENTATION AND METHOD.
470   /**
471    * Retrieves the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version].
472    *
473    * <p>Sample code:
474    *
475    * <pre>{@code
476    * // This snippet has been automatically generated and should be regarded as a code template only.
477    * // It will require modifications to work:
478    * // - It may require correct/in-range values for request initialization.
479    * // - It may require specifying regional endpoints when creating the service client as shown in
480    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
481    * try (VersionsClient versionsClient = VersionsClient.create()) {
482    *   GetVersionRequest request =
483    *       GetVersionRequest.newBuilder()
484    *           .setName(
485    *               VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]")
486    *                   .toString())
487    *           .build();
488    *   ApiFuture<Version> future = versionsClient.getVersionCallable().futureCall(request);
489    *   // Do something.
490    *   Version response = future.get();
491    * }
492    * }</pre>
493    */
getVersionCallable()494   public final UnaryCallable<GetVersionRequest, Version> getVersionCallable() {
495     return stub.getVersionCallable();
496   }
497 
498   // AUTO-GENERATED DOCUMENTATION AND METHOD.
499   /**
500    * Creates a [Version][google.cloud.dialogflow.cx.v3beta1.Version] in the specified
501    * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow].
502    *
503    * <p>This method is a [long-running
504    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
505    * returned `Operation` type has the following method-specific fields:
506    *
507    * <p>- `metadata`:
508    * [CreateVersionOperationMetadata][google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata]
509    * - `response`: [Version][google.cloud.dialogflow.cx.v3beta1.Version]
510    *
511    * <p>Sample code:
512    *
513    * <pre>{@code
514    * // This snippet has been automatically generated and should be regarded as a code template only.
515    * // It will require modifications to work:
516    * // - It may require correct/in-range values for request initialization.
517    * // - It may require specifying regional endpoints when creating the service client as shown in
518    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
519    * try (VersionsClient versionsClient = VersionsClient.create()) {
520    *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
521    *   Version version = Version.newBuilder().build();
522    *   Version response = versionsClient.createVersionAsync(parent, version).get();
523    * }
524    * }</pre>
525    *
526    * @param parent Required. The [Flow][google.cloud.dialogflow.cx.v3beta1.Flow] to create an
527    *     [Version][google.cloud.dialogflow.cx.v3beta1.Version] for. Format: `projects/&lt;Project
528    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow ID&gt;`.
529    * @param version Required. The version to create.
530    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
531    */
createVersionAsync( FlowName parent, Version version)532   public final OperationFuture<Version, CreateVersionOperationMetadata> createVersionAsync(
533       FlowName parent, Version version) {
534     CreateVersionRequest request =
535         CreateVersionRequest.newBuilder()
536             .setParent(parent == null ? null : parent.toString())
537             .setVersion(version)
538             .build();
539     return createVersionAsync(request);
540   }
541 
542   // AUTO-GENERATED DOCUMENTATION AND METHOD.
543   /**
544    * Creates a [Version][google.cloud.dialogflow.cx.v3beta1.Version] in the specified
545    * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow].
546    *
547    * <p>This method is a [long-running
548    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
549    * returned `Operation` type has the following method-specific fields:
550    *
551    * <p>- `metadata`:
552    * [CreateVersionOperationMetadata][google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata]
553    * - `response`: [Version][google.cloud.dialogflow.cx.v3beta1.Version]
554    *
555    * <p>Sample code:
556    *
557    * <pre>{@code
558    * // This snippet has been automatically generated and should be regarded as a code template only.
559    * // It will require modifications to work:
560    * // - It may require correct/in-range values for request initialization.
561    * // - It may require specifying regional endpoints when creating the service client as shown in
562    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
563    * try (VersionsClient versionsClient = VersionsClient.create()) {
564    *   String parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
565    *   Version version = Version.newBuilder().build();
566    *   Version response = versionsClient.createVersionAsync(parent, version).get();
567    * }
568    * }</pre>
569    *
570    * @param parent Required. The [Flow][google.cloud.dialogflow.cx.v3beta1.Flow] to create an
571    *     [Version][google.cloud.dialogflow.cx.v3beta1.Version] for. Format: `projects/&lt;Project
572    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow ID&gt;`.
573    * @param version Required. The version to create.
574    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
575    */
createVersionAsync( String parent, Version version)576   public final OperationFuture<Version, CreateVersionOperationMetadata> createVersionAsync(
577       String parent, Version version) {
578     CreateVersionRequest request =
579         CreateVersionRequest.newBuilder().setParent(parent).setVersion(version).build();
580     return createVersionAsync(request);
581   }
582 
583   // AUTO-GENERATED DOCUMENTATION AND METHOD.
584   /**
585    * Creates a [Version][google.cloud.dialogflow.cx.v3beta1.Version] in the specified
586    * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow].
587    *
588    * <p>This method is a [long-running
589    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
590    * returned `Operation` type has the following method-specific fields:
591    *
592    * <p>- `metadata`:
593    * [CreateVersionOperationMetadata][google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata]
594    * - `response`: [Version][google.cloud.dialogflow.cx.v3beta1.Version]
595    *
596    * <p>Sample code:
597    *
598    * <pre>{@code
599    * // This snippet has been automatically generated and should be regarded as a code template only.
600    * // It will require modifications to work:
601    * // - It may require correct/in-range values for request initialization.
602    * // - It may require specifying regional endpoints when creating the service client as shown in
603    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
604    * try (VersionsClient versionsClient = VersionsClient.create()) {
605    *   CreateVersionRequest request =
606    *       CreateVersionRequest.newBuilder()
607    *           .setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
608    *           .setVersion(Version.newBuilder().build())
609    *           .build();
610    *   Version response = versionsClient.createVersionAsync(request).get();
611    * }
612    * }</pre>
613    *
614    * @param request The request object containing all of the parameters for the API call.
615    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
616    */
createVersionAsync( CreateVersionRequest request)617   public final OperationFuture<Version, CreateVersionOperationMetadata> createVersionAsync(
618       CreateVersionRequest request) {
619     return createVersionOperationCallable().futureCall(request);
620   }
621 
622   // AUTO-GENERATED DOCUMENTATION AND METHOD.
623   /**
624    * Creates a [Version][google.cloud.dialogflow.cx.v3beta1.Version] in the specified
625    * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow].
626    *
627    * <p>This method is a [long-running
628    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
629    * returned `Operation` type has the following method-specific fields:
630    *
631    * <p>- `metadata`:
632    * [CreateVersionOperationMetadata][google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata]
633    * - `response`: [Version][google.cloud.dialogflow.cx.v3beta1.Version]
634    *
635    * <p>Sample code:
636    *
637    * <pre>{@code
638    * // This snippet has been automatically generated and should be regarded as a code template only.
639    * // It will require modifications to work:
640    * // - It may require correct/in-range values for request initialization.
641    * // - It may require specifying regional endpoints when creating the service client as shown in
642    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
643    * try (VersionsClient versionsClient = VersionsClient.create()) {
644    *   CreateVersionRequest request =
645    *       CreateVersionRequest.newBuilder()
646    *           .setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
647    *           .setVersion(Version.newBuilder().build())
648    *           .build();
649    *   OperationFuture<Version, CreateVersionOperationMetadata> future =
650    *       versionsClient.createVersionOperationCallable().futureCall(request);
651    *   // Do something.
652    *   Version response = future.get();
653    * }
654    * }</pre>
655    */
656   public final OperationCallable<CreateVersionRequest, Version, CreateVersionOperationMetadata>
createVersionOperationCallable()657       createVersionOperationCallable() {
658     return stub.createVersionOperationCallable();
659   }
660 
661   // AUTO-GENERATED DOCUMENTATION AND METHOD.
662   /**
663    * Creates a [Version][google.cloud.dialogflow.cx.v3beta1.Version] in the specified
664    * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow].
665    *
666    * <p>This method is a [long-running
667    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
668    * returned `Operation` type has the following method-specific fields:
669    *
670    * <p>- `metadata`:
671    * [CreateVersionOperationMetadata][google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata]
672    * - `response`: [Version][google.cloud.dialogflow.cx.v3beta1.Version]
673    *
674    * <p>Sample code:
675    *
676    * <pre>{@code
677    * // This snippet has been automatically generated and should be regarded as a code template only.
678    * // It will require modifications to work:
679    * // - It may require correct/in-range values for request initialization.
680    * // - It may require specifying regional endpoints when creating the service client as shown in
681    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
682    * try (VersionsClient versionsClient = VersionsClient.create()) {
683    *   CreateVersionRequest request =
684    *       CreateVersionRequest.newBuilder()
685    *           .setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
686    *           .setVersion(Version.newBuilder().build())
687    *           .build();
688    *   ApiFuture<Operation> future = versionsClient.createVersionCallable().futureCall(request);
689    *   // Do something.
690    *   Operation response = future.get();
691    * }
692    * }</pre>
693    */
createVersionCallable()694   public final UnaryCallable<CreateVersionRequest, Operation> createVersionCallable() {
695     return stub.createVersionCallable();
696   }
697 
698   // AUTO-GENERATED DOCUMENTATION AND METHOD.
699   /**
700    * Updates the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version].
701    *
702    * <p>Sample code:
703    *
704    * <pre>{@code
705    * // This snippet has been automatically generated and should be regarded as a code template only.
706    * // It will require modifications to work:
707    * // - It may require correct/in-range values for request initialization.
708    * // - It may require specifying regional endpoints when creating the service client as shown in
709    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
710    * try (VersionsClient versionsClient = VersionsClient.create()) {
711    *   Version version = Version.newBuilder().build();
712    *   FieldMask updateMask = FieldMask.newBuilder().build();
713    *   Version response = versionsClient.updateVersion(version, updateMask);
714    * }
715    * }</pre>
716    *
717    * @param version Required. The version to update.
718    * @param updateMask Required. The mask to control which fields get updated. Currently only
719    *     `description` and `display_name` can be updated.
720    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
721    */
updateVersion(Version version, FieldMask updateMask)722   public final Version updateVersion(Version version, FieldMask updateMask) {
723     UpdateVersionRequest request =
724         UpdateVersionRequest.newBuilder().setVersion(version).setUpdateMask(updateMask).build();
725     return updateVersion(request);
726   }
727 
728   // AUTO-GENERATED DOCUMENTATION AND METHOD.
729   /**
730    * Updates the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version].
731    *
732    * <p>Sample code:
733    *
734    * <pre>{@code
735    * // This snippet has been automatically generated and should be regarded as a code template only.
736    * // It will require modifications to work:
737    * // - It may require correct/in-range values for request initialization.
738    * // - It may require specifying regional endpoints when creating the service client as shown in
739    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
740    * try (VersionsClient versionsClient = VersionsClient.create()) {
741    *   UpdateVersionRequest request =
742    *       UpdateVersionRequest.newBuilder()
743    *           .setVersion(Version.newBuilder().build())
744    *           .setUpdateMask(FieldMask.newBuilder().build())
745    *           .build();
746    *   Version response = versionsClient.updateVersion(request);
747    * }
748    * }</pre>
749    *
750    * @param request The request object containing all of the parameters for the API call.
751    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
752    */
updateVersion(UpdateVersionRequest request)753   public final Version updateVersion(UpdateVersionRequest request) {
754     return updateVersionCallable().call(request);
755   }
756 
757   // AUTO-GENERATED DOCUMENTATION AND METHOD.
758   /**
759    * Updates the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version].
760    *
761    * <p>Sample code:
762    *
763    * <pre>{@code
764    * // This snippet has been automatically generated and should be regarded as a code template only.
765    * // It will require modifications to work:
766    * // - It may require correct/in-range values for request initialization.
767    * // - It may require specifying regional endpoints when creating the service client as shown in
768    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
769    * try (VersionsClient versionsClient = VersionsClient.create()) {
770    *   UpdateVersionRequest request =
771    *       UpdateVersionRequest.newBuilder()
772    *           .setVersion(Version.newBuilder().build())
773    *           .setUpdateMask(FieldMask.newBuilder().build())
774    *           .build();
775    *   ApiFuture<Version> future = versionsClient.updateVersionCallable().futureCall(request);
776    *   // Do something.
777    *   Version response = future.get();
778    * }
779    * }</pre>
780    */
updateVersionCallable()781   public final UnaryCallable<UpdateVersionRequest, Version> updateVersionCallable() {
782     return stub.updateVersionCallable();
783   }
784 
785   // AUTO-GENERATED DOCUMENTATION AND METHOD.
786   /**
787    * Deletes the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version].
788    *
789    * <p>Sample code:
790    *
791    * <pre>{@code
792    * // This snippet has been automatically generated and should be regarded as a code template only.
793    * // It will require modifications to work:
794    * // - It may require correct/in-range values for request initialization.
795    * // - It may require specifying regional endpoints when creating the service client as shown in
796    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
797    * try (VersionsClient versionsClient = VersionsClient.create()) {
798    *   VersionName name =
799    *       VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
800    *   versionsClient.deleteVersion(name);
801    * }
802    * }</pre>
803    *
804    * @param name Required. The name of the [Version][google.cloud.dialogflow.cx.v3beta1.Version] to
805    *     delete. Format: `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent
806    *     ID&gt;/flows/&lt;Flow ID&gt;/versions/&lt;Version ID&gt;`.
807    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
808    */
deleteVersion(VersionName name)809   public final void deleteVersion(VersionName name) {
810     DeleteVersionRequest request =
811         DeleteVersionRequest.newBuilder().setName(name == null ? null : name.toString()).build();
812     deleteVersion(request);
813   }
814 
815   // AUTO-GENERATED DOCUMENTATION AND METHOD.
816   /**
817    * Deletes the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version].
818    *
819    * <p>Sample code:
820    *
821    * <pre>{@code
822    * // This snippet has been automatically generated and should be regarded as a code template only.
823    * // It will require modifications to work:
824    * // - It may require correct/in-range values for request initialization.
825    * // - It may require specifying regional endpoints when creating the service client as shown in
826    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
827    * try (VersionsClient versionsClient = VersionsClient.create()) {
828    *   String name =
829    *       VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]").toString();
830    *   versionsClient.deleteVersion(name);
831    * }
832    * }</pre>
833    *
834    * @param name Required. The name of the [Version][google.cloud.dialogflow.cx.v3beta1.Version] to
835    *     delete. Format: `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent
836    *     ID&gt;/flows/&lt;Flow ID&gt;/versions/&lt;Version ID&gt;`.
837    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
838    */
deleteVersion(String name)839   public final void deleteVersion(String name) {
840     DeleteVersionRequest request = DeleteVersionRequest.newBuilder().setName(name).build();
841     deleteVersion(request);
842   }
843 
844   // AUTO-GENERATED DOCUMENTATION AND METHOD.
845   /**
846    * Deletes the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version].
847    *
848    * <p>Sample code:
849    *
850    * <pre>{@code
851    * // This snippet has been automatically generated and should be regarded as a code template only.
852    * // It will require modifications to work:
853    * // - It may require correct/in-range values for request initialization.
854    * // - It may require specifying regional endpoints when creating the service client as shown in
855    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
856    * try (VersionsClient versionsClient = VersionsClient.create()) {
857    *   DeleteVersionRequest request =
858    *       DeleteVersionRequest.newBuilder()
859    *           .setName(
860    *               VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]")
861    *                   .toString())
862    *           .build();
863    *   versionsClient.deleteVersion(request);
864    * }
865    * }</pre>
866    *
867    * @param request The request object containing all of the parameters for the API call.
868    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
869    */
deleteVersion(DeleteVersionRequest request)870   public final void deleteVersion(DeleteVersionRequest request) {
871     deleteVersionCallable().call(request);
872   }
873 
874   // AUTO-GENERATED DOCUMENTATION AND METHOD.
875   /**
876    * Deletes the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version].
877    *
878    * <p>Sample code:
879    *
880    * <pre>{@code
881    * // This snippet has been automatically generated and should be regarded as a code template only.
882    * // It will require modifications to work:
883    * // - It may require correct/in-range values for request initialization.
884    * // - It may require specifying regional endpoints when creating the service client as shown in
885    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
886    * try (VersionsClient versionsClient = VersionsClient.create()) {
887    *   DeleteVersionRequest request =
888    *       DeleteVersionRequest.newBuilder()
889    *           .setName(
890    *               VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]")
891    *                   .toString())
892    *           .build();
893    *   ApiFuture<Empty> future = versionsClient.deleteVersionCallable().futureCall(request);
894    *   // Do something.
895    *   future.get();
896    * }
897    * }</pre>
898    */
deleteVersionCallable()899   public final UnaryCallable<DeleteVersionRequest, Empty> deleteVersionCallable() {
900     return stub.deleteVersionCallable();
901   }
902 
903   // AUTO-GENERATED DOCUMENTATION AND METHOD.
904   /**
905    * Loads resources in the specified version to the draft flow.
906    *
907    * <p>This method is a [long-running
908    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
909    * returned `Operation` type has the following method-specific fields:
910    *
911    * <p>- `metadata`: An empty [Struct
912    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
913    * - `response`: An [Empty
914    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
915    *
916    * <p>Sample code:
917    *
918    * <pre>{@code
919    * // This snippet has been automatically generated and should be regarded as a code template only.
920    * // It will require modifications to work:
921    * // - It may require correct/in-range values for request initialization.
922    * // - It may require specifying regional endpoints when creating the service client as shown in
923    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
924    * try (VersionsClient versionsClient = VersionsClient.create()) {
925    *   VersionName name =
926    *       VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
927    *   versionsClient.loadVersionAsync(name).get();
928    * }
929    * }</pre>
930    *
931    * @param name Required. The [Version][google.cloud.dialogflow.cx.v3beta1.Version] to be loaded to
932    *     draft flow. Format: `projects/&lt;Project ID&gt;/locations/&lt;Location
933    *     ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow ID&gt;/versions/&lt;Version ID&gt;`.
934    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
935    */
loadVersionAsync(VersionName name)936   public final OperationFuture<Empty, Struct> loadVersionAsync(VersionName name) {
937     LoadVersionRequest request =
938         LoadVersionRequest.newBuilder().setName(name == null ? null : name.toString()).build();
939     return loadVersionAsync(request);
940   }
941 
942   // AUTO-GENERATED DOCUMENTATION AND METHOD.
943   /**
944    * Loads resources in the specified version to the draft flow.
945    *
946    * <p>This method is a [long-running
947    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
948    * returned `Operation` type has the following method-specific fields:
949    *
950    * <p>- `metadata`: An empty [Struct
951    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
952    * - `response`: An [Empty
953    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
954    *
955    * <p>Sample code:
956    *
957    * <pre>{@code
958    * // This snippet has been automatically generated and should be regarded as a code template only.
959    * // It will require modifications to work:
960    * // - It may require correct/in-range values for request initialization.
961    * // - It may require specifying regional endpoints when creating the service client as shown in
962    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
963    * try (VersionsClient versionsClient = VersionsClient.create()) {
964    *   String name =
965    *       VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]").toString();
966    *   versionsClient.loadVersionAsync(name).get();
967    * }
968    * }</pre>
969    *
970    * @param name Required. The [Version][google.cloud.dialogflow.cx.v3beta1.Version] to be loaded to
971    *     draft flow. Format: `projects/&lt;Project ID&gt;/locations/&lt;Location
972    *     ID&gt;/agents/&lt;Agent ID&gt;/flows/&lt;Flow ID&gt;/versions/&lt;Version ID&gt;`.
973    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
974    */
loadVersionAsync(String name)975   public final OperationFuture<Empty, Struct> loadVersionAsync(String name) {
976     LoadVersionRequest request = LoadVersionRequest.newBuilder().setName(name).build();
977     return loadVersionAsync(request);
978   }
979 
980   // AUTO-GENERATED DOCUMENTATION AND METHOD.
981   /**
982    * Loads resources in the specified version to the draft flow.
983    *
984    * <p>This method is a [long-running
985    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
986    * returned `Operation` type has the following method-specific fields:
987    *
988    * <p>- `metadata`: An empty [Struct
989    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
990    * - `response`: An [Empty
991    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
992    *
993    * <p>Sample code:
994    *
995    * <pre>{@code
996    * // This snippet has been automatically generated and should be regarded as a code template only.
997    * // It will require modifications to work:
998    * // - It may require correct/in-range values for request initialization.
999    * // - It may require specifying regional endpoints when creating the service client as shown in
1000    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1001    * try (VersionsClient versionsClient = VersionsClient.create()) {
1002    *   LoadVersionRequest request =
1003    *       LoadVersionRequest.newBuilder()
1004    *           .setName(
1005    *               VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]")
1006    *                   .toString())
1007    *           .setAllowOverrideAgentResources(true)
1008    *           .build();
1009    *   versionsClient.loadVersionAsync(request).get();
1010    * }
1011    * }</pre>
1012    *
1013    * @param request The request object containing all of the parameters for the API call.
1014    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1015    */
loadVersionAsync(LoadVersionRequest request)1016   public final OperationFuture<Empty, Struct> loadVersionAsync(LoadVersionRequest request) {
1017     return loadVersionOperationCallable().futureCall(request);
1018   }
1019 
1020   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1021   /**
1022    * Loads resources in the specified version to the draft flow.
1023    *
1024    * <p>This method is a [long-running
1025    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
1026    * returned `Operation` type has the following method-specific fields:
1027    *
1028    * <p>- `metadata`: An empty [Struct
1029    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
1030    * - `response`: An [Empty
1031    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
1032    *
1033    * <p>Sample code:
1034    *
1035    * <pre>{@code
1036    * // This snippet has been automatically generated and should be regarded as a code template only.
1037    * // It will require modifications to work:
1038    * // - It may require correct/in-range values for request initialization.
1039    * // - It may require specifying regional endpoints when creating the service client as shown in
1040    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1041    * try (VersionsClient versionsClient = VersionsClient.create()) {
1042    *   LoadVersionRequest request =
1043    *       LoadVersionRequest.newBuilder()
1044    *           .setName(
1045    *               VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]")
1046    *                   .toString())
1047    *           .setAllowOverrideAgentResources(true)
1048    *           .build();
1049    *   OperationFuture<Empty, Struct> future =
1050    *       versionsClient.loadVersionOperationCallable().futureCall(request);
1051    *   // Do something.
1052    *   future.get();
1053    * }
1054    * }</pre>
1055    */
loadVersionOperationCallable()1056   public final OperationCallable<LoadVersionRequest, Empty, Struct> loadVersionOperationCallable() {
1057     return stub.loadVersionOperationCallable();
1058   }
1059 
1060   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1061   /**
1062    * Loads resources in the specified version to the draft flow.
1063    *
1064    * <p>This method is a [long-running
1065    * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
1066    * returned `Operation` type has the following method-specific fields:
1067    *
1068    * <p>- `metadata`: An empty [Struct
1069    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
1070    * - `response`: An [Empty
1071    * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
1072    *
1073    * <p>Sample code:
1074    *
1075    * <pre>{@code
1076    * // This snippet has been automatically generated and should be regarded as a code template only.
1077    * // It will require modifications to work:
1078    * // - It may require correct/in-range values for request initialization.
1079    * // - It may require specifying regional endpoints when creating the service client as shown in
1080    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1081    * try (VersionsClient versionsClient = VersionsClient.create()) {
1082    *   LoadVersionRequest request =
1083    *       LoadVersionRequest.newBuilder()
1084    *           .setName(
1085    *               VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]")
1086    *                   .toString())
1087    *           .setAllowOverrideAgentResources(true)
1088    *           .build();
1089    *   ApiFuture<Operation> future = versionsClient.loadVersionCallable().futureCall(request);
1090    *   // Do something.
1091    *   future.get();
1092    * }
1093    * }</pre>
1094    */
loadVersionCallable()1095   public final UnaryCallable<LoadVersionRequest, Operation> loadVersionCallable() {
1096     return stub.loadVersionCallable();
1097   }
1098 
1099   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1100   /**
1101    * Compares the specified base version with target version.
1102    *
1103    * <p>Sample code:
1104    *
1105    * <pre>{@code
1106    * // This snippet has been automatically generated and should be regarded as a code template only.
1107    * // It will require modifications to work:
1108    * // - It may require correct/in-range values for request initialization.
1109    * // - It may require specifying regional endpoints when creating the service client as shown in
1110    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1111    * try (VersionsClient versionsClient = VersionsClient.create()) {
1112    *   VersionName baseVersion =
1113    *       VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
1114    *   CompareVersionsResponse response = versionsClient.compareVersions(baseVersion);
1115    * }
1116    * }</pre>
1117    *
1118    * @param baseVersion Required. Name of the base flow version to compare with the target version.
1119    *     Use version ID `0` to indicate the draft version of the specified flow.
1120    *     <p>Format: `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/agents/ &lt;Agent
1121    *     ID&gt;/flows/&lt;Flow ID&gt;/versions/&lt;Version ID&gt;`.
1122    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1123    */
compareVersions(VersionName baseVersion)1124   public final CompareVersionsResponse compareVersions(VersionName baseVersion) {
1125     CompareVersionsRequest request =
1126         CompareVersionsRequest.newBuilder()
1127             .setBaseVersion(baseVersion == null ? null : baseVersion.toString())
1128             .build();
1129     return compareVersions(request);
1130   }
1131 
1132   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1133   /**
1134    * Compares the specified base version with target version.
1135    *
1136    * <p>Sample code:
1137    *
1138    * <pre>{@code
1139    * // This snippet has been automatically generated and should be regarded as a code template only.
1140    * // It will require modifications to work:
1141    * // - It may require correct/in-range values for request initialization.
1142    * // - It may require specifying regional endpoints when creating the service client as shown in
1143    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1144    * try (VersionsClient versionsClient = VersionsClient.create()) {
1145    *   String baseVersion =
1146    *       VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]").toString();
1147    *   CompareVersionsResponse response = versionsClient.compareVersions(baseVersion);
1148    * }
1149    * }</pre>
1150    *
1151    * @param baseVersion Required. Name of the base flow version to compare with the target version.
1152    *     Use version ID `0` to indicate the draft version of the specified flow.
1153    *     <p>Format: `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/agents/ &lt;Agent
1154    *     ID&gt;/flows/&lt;Flow ID&gt;/versions/&lt;Version ID&gt;`.
1155    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1156    */
compareVersions(String baseVersion)1157   public final CompareVersionsResponse compareVersions(String baseVersion) {
1158     CompareVersionsRequest request =
1159         CompareVersionsRequest.newBuilder().setBaseVersion(baseVersion).build();
1160     return compareVersions(request);
1161   }
1162 
1163   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1164   /**
1165    * Compares the specified base version with target version.
1166    *
1167    * <p>Sample code:
1168    *
1169    * <pre>{@code
1170    * // This snippet has been automatically generated and should be regarded as a code template only.
1171    * // It will require modifications to work:
1172    * // - It may require correct/in-range values for request initialization.
1173    * // - It may require specifying regional endpoints when creating the service client as shown in
1174    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1175    * try (VersionsClient versionsClient = VersionsClient.create()) {
1176    *   CompareVersionsRequest request =
1177    *       CompareVersionsRequest.newBuilder()
1178    *           .setBaseVersion(
1179    *               VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]")
1180    *                   .toString())
1181    *           .setTargetVersion(
1182    *               VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]")
1183    *                   .toString())
1184    *           .setLanguageCode("languageCode-2092349083")
1185    *           .build();
1186    *   CompareVersionsResponse response = versionsClient.compareVersions(request);
1187    * }
1188    * }</pre>
1189    *
1190    * @param request The request object containing all of the parameters for the API call.
1191    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1192    */
compareVersions(CompareVersionsRequest request)1193   public final CompareVersionsResponse compareVersions(CompareVersionsRequest request) {
1194     return compareVersionsCallable().call(request);
1195   }
1196 
1197   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1198   /**
1199    * Compares the specified base version with target version.
1200    *
1201    * <p>Sample code:
1202    *
1203    * <pre>{@code
1204    * // This snippet has been automatically generated and should be regarded as a code template only.
1205    * // It will require modifications to work:
1206    * // - It may require correct/in-range values for request initialization.
1207    * // - It may require specifying regional endpoints when creating the service client as shown in
1208    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1209    * try (VersionsClient versionsClient = VersionsClient.create()) {
1210    *   CompareVersionsRequest request =
1211    *       CompareVersionsRequest.newBuilder()
1212    *           .setBaseVersion(
1213    *               VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]")
1214    *                   .toString())
1215    *           .setTargetVersion(
1216    *               VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]")
1217    *                   .toString())
1218    *           .setLanguageCode("languageCode-2092349083")
1219    *           .build();
1220    *   ApiFuture<CompareVersionsResponse> future =
1221    *       versionsClient.compareVersionsCallable().futureCall(request);
1222    *   // Do something.
1223    *   CompareVersionsResponse response = future.get();
1224    * }
1225    * }</pre>
1226    */
1227   public final UnaryCallable<CompareVersionsRequest, CompareVersionsResponse>
compareVersionsCallable()1228       compareVersionsCallable() {
1229     return stub.compareVersionsCallable();
1230   }
1231 
1232   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1233   /**
1234    * Lists information about the supported locations for this service.
1235    *
1236    * <p>Sample code:
1237    *
1238    * <pre>{@code
1239    * // This snippet has been automatically generated and should be regarded as a code template only.
1240    * // It will require modifications to work:
1241    * // - It may require correct/in-range values for request initialization.
1242    * // - It may require specifying regional endpoints when creating the service client as shown in
1243    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1244    * try (VersionsClient versionsClient = VersionsClient.create()) {
1245    *   ListLocationsRequest request =
1246    *       ListLocationsRequest.newBuilder()
1247    *           .setName("name3373707")
1248    *           .setFilter("filter-1274492040")
1249    *           .setPageSize(883849137)
1250    *           .setPageToken("pageToken873572522")
1251    *           .build();
1252    *   for (Location element : versionsClient.listLocations(request).iterateAll()) {
1253    *     // doThingsWith(element);
1254    *   }
1255    * }
1256    * }</pre>
1257    *
1258    * @param request The request object containing all of the parameters for the API call.
1259    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1260    */
listLocations(ListLocationsRequest request)1261   public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
1262     return listLocationsPagedCallable().call(request);
1263   }
1264 
1265   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1266   /**
1267    * Lists information about the supported locations for this service.
1268    *
1269    * <p>Sample code:
1270    *
1271    * <pre>{@code
1272    * // This snippet has been automatically generated and should be regarded as a code template only.
1273    * // It will require modifications to work:
1274    * // - It may require correct/in-range values for request initialization.
1275    * // - It may require specifying regional endpoints when creating the service client as shown in
1276    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1277    * try (VersionsClient versionsClient = VersionsClient.create()) {
1278    *   ListLocationsRequest request =
1279    *       ListLocationsRequest.newBuilder()
1280    *           .setName("name3373707")
1281    *           .setFilter("filter-1274492040")
1282    *           .setPageSize(883849137)
1283    *           .setPageToken("pageToken873572522")
1284    *           .build();
1285    *   ApiFuture<Location> future = versionsClient.listLocationsPagedCallable().futureCall(request);
1286    *   // Do something.
1287    *   for (Location element : future.get().iterateAll()) {
1288    *     // doThingsWith(element);
1289    *   }
1290    * }
1291    * }</pre>
1292    */
1293   public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable()1294       listLocationsPagedCallable() {
1295     return stub.listLocationsPagedCallable();
1296   }
1297 
1298   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1299   /**
1300    * Lists information about the supported locations for this service.
1301    *
1302    * <p>Sample code:
1303    *
1304    * <pre>{@code
1305    * // This snippet has been automatically generated and should be regarded as a code template only.
1306    * // It will require modifications to work:
1307    * // - It may require correct/in-range values for request initialization.
1308    * // - It may require specifying regional endpoints when creating the service client as shown in
1309    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1310    * try (VersionsClient versionsClient = VersionsClient.create()) {
1311    *   ListLocationsRequest request =
1312    *       ListLocationsRequest.newBuilder()
1313    *           .setName("name3373707")
1314    *           .setFilter("filter-1274492040")
1315    *           .setPageSize(883849137)
1316    *           .setPageToken("pageToken873572522")
1317    *           .build();
1318    *   while (true) {
1319    *     ListLocationsResponse response = versionsClient.listLocationsCallable().call(request);
1320    *     for (Location element : response.getLocationsList()) {
1321    *       // doThingsWith(element);
1322    *     }
1323    *     String nextPageToken = response.getNextPageToken();
1324    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
1325    *       request = request.toBuilder().setPageToken(nextPageToken).build();
1326    *     } else {
1327    *       break;
1328    *     }
1329    *   }
1330    * }
1331    * }</pre>
1332    */
listLocationsCallable()1333   public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
1334     return stub.listLocationsCallable();
1335   }
1336 
1337   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1338   /**
1339    * Gets information about a location.
1340    *
1341    * <p>Sample code:
1342    *
1343    * <pre>{@code
1344    * // This snippet has been automatically generated and should be regarded as a code template only.
1345    * // It will require modifications to work:
1346    * // - It may require correct/in-range values for request initialization.
1347    * // - It may require specifying regional endpoints when creating the service client as shown in
1348    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1349    * try (VersionsClient versionsClient = VersionsClient.create()) {
1350    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
1351    *   Location response = versionsClient.getLocation(request);
1352    * }
1353    * }</pre>
1354    *
1355    * @param request The request object containing all of the parameters for the API call.
1356    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1357    */
getLocation(GetLocationRequest request)1358   public final Location getLocation(GetLocationRequest request) {
1359     return getLocationCallable().call(request);
1360   }
1361 
1362   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1363   /**
1364    * Gets information about a location.
1365    *
1366    * <p>Sample code:
1367    *
1368    * <pre>{@code
1369    * // This snippet has been automatically generated and should be regarded as a code template only.
1370    * // It will require modifications to work:
1371    * // - It may require correct/in-range values for request initialization.
1372    * // - It may require specifying regional endpoints when creating the service client as shown in
1373    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1374    * try (VersionsClient versionsClient = VersionsClient.create()) {
1375    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
1376    *   ApiFuture<Location> future = versionsClient.getLocationCallable().futureCall(request);
1377    *   // Do something.
1378    *   Location response = future.get();
1379    * }
1380    * }</pre>
1381    */
getLocationCallable()1382   public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
1383     return stub.getLocationCallable();
1384   }
1385 
1386   @Override
close()1387   public final void close() {
1388     stub.close();
1389   }
1390 
1391   @Override
shutdown()1392   public void shutdown() {
1393     stub.shutdown();
1394   }
1395 
1396   @Override
isShutdown()1397   public boolean isShutdown() {
1398     return stub.isShutdown();
1399   }
1400 
1401   @Override
isTerminated()1402   public boolean isTerminated() {
1403     return stub.isTerminated();
1404   }
1405 
1406   @Override
shutdownNow()1407   public void shutdownNow() {
1408     stub.shutdownNow();
1409   }
1410 
1411   @Override
awaitTermination(long duration, TimeUnit unit)1412   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
1413     return stub.awaitTermination(duration, unit);
1414   }
1415 
1416   public static class ListVersionsPagedResponse
1417       extends AbstractPagedListResponse<
1418           ListVersionsRequest,
1419           ListVersionsResponse,
1420           Version,
1421           ListVersionsPage,
1422           ListVersionsFixedSizeCollection> {
1423 
createAsync( PageContext<ListVersionsRequest, ListVersionsResponse, Version> context, ApiFuture<ListVersionsResponse> futureResponse)1424     public static ApiFuture<ListVersionsPagedResponse> createAsync(
1425         PageContext<ListVersionsRequest, ListVersionsResponse, Version> context,
1426         ApiFuture<ListVersionsResponse> futureResponse) {
1427       ApiFuture<ListVersionsPage> futurePage =
1428           ListVersionsPage.createEmptyPage().createPageAsync(context, futureResponse);
1429       return ApiFutures.transform(
1430           futurePage,
1431           input -> new ListVersionsPagedResponse(input),
1432           MoreExecutors.directExecutor());
1433     }
1434 
ListVersionsPagedResponse(ListVersionsPage page)1435     private ListVersionsPagedResponse(ListVersionsPage page) {
1436       super(page, ListVersionsFixedSizeCollection.createEmptyCollection());
1437     }
1438   }
1439 
1440   public static class ListVersionsPage
1441       extends AbstractPage<ListVersionsRequest, ListVersionsResponse, Version, ListVersionsPage> {
1442 
ListVersionsPage( PageContext<ListVersionsRequest, ListVersionsResponse, Version> context, ListVersionsResponse response)1443     private ListVersionsPage(
1444         PageContext<ListVersionsRequest, ListVersionsResponse, Version> context,
1445         ListVersionsResponse response) {
1446       super(context, response);
1447     }
1448 
createEmptyPage()1449     private static ListVersionsPage createEmptyPage() {
1450       return new ListVersionsPage(null, null);
1451     }
1452 
1453     @Override
createPage( PageContext<ListVersionsRequest, ListVersionsResponse, Version> context, ListVersionsResponse response)1454     protected ListVersionsPage createPage(
1455         PageContext<ListVersionsRequest, ListVersionsResponse, Version> context,
1456         ListVersionsResponse response) {
1457       return new ListVersionsPage(context, response);
1458     }
1459 
1460     @Override
createPageAsync( PageContext<ListVersionsRequest, ListVersionsResponse, Version> context, ApiFuture<ListVersionsResponse> futureResponse)1461     public ApiFuture<ListVersionsPage> createPageAsync(
1462         PageContext<ListVersionsRequest, ListVersionsResponse, Version> context,
1463         ApiFuture<ListVersionsResponse> futureResponse) {
1464       return super.createPageAsync(context, futureResponse);
1465     }
1466   }
1467 
1468   public static class ListVersionsFixedSizeCollection
1469       extends AbstractFixedSizeCollection<
1470           ListVersionsRequest,
1471           ListVersionsResponse,
1472           Version,
1473           ListVersionsPage,
1474           ListVersionsFixedSizeCollection> {
1475 
ListVersionsFixedSizeCollection(List<ListVersionsPage> pages, int collectionSize)1476     private ListVersionsFixedSizeCollection(List<ListVersionsPage> pages, int collectionSize) {
1477       super(pages, collectionSize);
1478     }
1479 
createEmptyCollection()1480     private static ListVersionsFixedSizeCollection createEmptyCollection() {
1481       return new ListVersionsFixedSizeCollection(null, 0);
1482     }
1483 
1484     @Override
createCollection( List<ListVersionsPage> pages, int collectionSize)1485     protected ListVersionsFixedSizeCollection createCollection(
1486         List<ListVersionsPage> pages, int collectionSize) {
1487       return new ListVersionsFixedSizeCollection(pages, collectionSize);
1488     }
1489   }
1490 
1491   public static class ListLocationsPagedResponse
1492       extends AbstractPagedListResponse<
1493           ListLocationsRequest,
1494           ListLocationsResponse,
1495           Location,
1496           ListLocationsPage,
1497           ListLocationsFixedSizeCollection> {
1498 
createAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1499     public static ApiFuture<ListLocationsPagedResponse> createAsync(
1500         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1501         ApiFuture<ListLocationsResponse> futureResponse) {
1502       ApiFuture<ListLocationsPage> futurePage =
1503           ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
1504       return ApiFutures.transform(
1505           futurePage,
1506           input -> new ListLocationsPagedResponse(input),
1507           MoreExecutors.directExecutor());
1508     }
1509 
ListLocationsPagedResponse(ListLocationsPage page)1510     private ListLocationsPagedResponse(ListLocationsPage page) {
1511       super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
1512     }
1513   }
1514 
1515   public static class ListLocationsPage
1516       extends AbstractPage<
1517           ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
1518 
ListLocationsPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1519     private ListLocationsPage(
1520         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1521         ListLocationsResponse response) {
1522       super(context, response);
1523     }
1524 
createEmptyPage()1525     private static ListLocationsPage createEmptyPage() {
1526       return new ListLocationsPage(null, null);
1527     }
1528 
1529     @Override
createPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1530     protected ListLocationsPage createPage(
1531         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1532         ListLocationsResponse response) {
1533       return new ListLocationsPage(context, response);
1534     }
1535 
1536     @Override
createPageAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1537     public ApiFuture<ListLocationsPage> createPageAsync(
1538         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1539         ApiFuture<ListLocationsResponse> futureResponse) {
1540       return super.createPageAsync(context, futureResponse);
1541     }
1542   }
1543 
1544   public static class ListLocationsFixedSizeCollection
1545       extends AbstractFixedSizeCollection<
1546           ListLocationsRequest,
1547           ListLocationsResponse,
1548           Location,
1549           ListLocationsPage,
1550           ListLocationsFixedSizeCollection> {
1551 
ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize)1552     private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) {
1553       super(pages, collectionSize);
1554     }
1555 
createEmptyCollection()1556     private static ListLocationsFixedSizeCollection createEmptyCollection() {
1557       return new ListLocationsFixedSizeCollection(null, 0);
1558     }
1559 
1560     @Override
createCollection( List<ListLocationsPage> pages, int collectionSize)1561     protected ListLocationsFixedSizeCollection createCollection(
1562         List<ListLocationsPage> pages, int collectionSize) {
1563       return new ListLocationsFixedSizeCollection(pages, collectionSize);
1564     }
1565   }
1566 }
1567