• 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.gax.core.BackgroundResource;
22 import com.google.api.gax.paging.AbstractFixedSizeCollection;
23 import com.google.api.gax.paging.AbstractPage;
24 import com.google.api.gax.paging.AbstractPagedListResponse;
25 import com.google.api.gax.rpc.PageContext;
26 import com.google.api.gax.rpc.UnaryCallable;
27 import com.google.cloud.dialogflow.cx.v3.stub.ExperimentsStub;
28 import com.google.cloud.dialogflow.cx.v3.stub.ExperimentsStubSettings;
29 import com.google.cloud.location.GetLocationRequest;
30 import com.google.cloud.location.ListLocationsRequest;
31 import com.google.cloud.location.ListLocationsResponse;
32 import com.google.cloud.location.Location;
33 import com.google.common.util.concurrent.MoreExecutors;
34 import com.google.protobuf.Empty;
35 import com.google.protobuf.FieldMask;
36 import java.io.IOException;
37 import java.util.List;
38 import java.util.concurrent.TimeUnit;
39 import javax.annotation.Generated;
40 
41 // AUTO-GENERATED DOCUMENTATION AND CLASS.
42 /**
43  * Service Description: Service for managing
44  * [Experiments][google.cloud.dialogflow.cx.v3.Experiment].
45  *
46  * <p>This class provides the ability to make remote calls to the backing service through method
47  * calls that map to API methods. Sample code to get started:
48  *
49  * <pre>{@code
50  * // This snippet has been automatically generated and should be regarded as a code template only.
51  * // It will require modifications to work:
52  * // - It may require correct/in-range values for request initialization.
53  * // - It may require specifying regional endpoints when creating the service client as shown in
54  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
55  * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
56  *   ExperimentName name =
57  *       ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]");
58  *   Experiment response = experimentsClient.getExperiment(name);
59  * }
60  * }</pre>
61  *
62  * <p>Note: close() needs to be called on the ExperimentsClient object to clean up resources such as
63  * threads. In the example above, try-with-resources is used, which automatically calls close().
64  *
65  * <p>The surface of this class includes several types of Java methods for each of the API's
66  * methods:
67  *
68  * <ol>
69  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
70  *       converted into function parameters. It may be the case that not all fields are available as
71  *       parameters, and not every API method will have a flattened method entry point.
72  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
73  *       which must be constructed before the call. Not every API method will have a request object
74  *       method.
75  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
76  *       callable object, which can be used to initiate calls to the service.
77  * </ol>
78  *
79  * <p>See the individual methods for example code.
80  *
81  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
82  * these names, this class includes a format method for each type of name, and additionally a parse
83  * method to extract the individual identifiers contained within names that are returned.
84  *
85  * <p>This class can be customized by passing in a custom instance of ExperimentsSettings to
86  * create(). For example:
87  *
88  * <p>To customize credentials:
89  *
90  * <pre>{@code
91  * // This snippet has been automatically generated and should be regarded as a code template only.
92  * // It will require modifications to work:
93  * // - It may require correct/in-range values for request initialization.
94  * // - It may require specifying regional endpoints when creating the service client as shown in
95  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
96  * ExperimentsSettings experimentsSettings =
97  *     ExperimentsSettings.newBuilder()
98  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
99  *         .build();
100  * ExperimentsClient experimentsClient = ExperimentsClient.create(experimentsSettings);
101  * }</pre>
102  *
103  * <p>To customize the endpoint:
104  *
105  * <pre>{@code
106  * // This snippet has been automatically generated and should be regarded as a code template only.
107  * // It will require modifications to work:
108  * // - It may require correct/in-range values for request initialization.
109  * // - It may require specifying regional endpoints when creating the service client as shown in
110  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
111  * ExperimentsSettings experimentsSettings =
112  *     ExperimentsSettings.newBuilder().setEndpoint(myEndpoint).build();
113  * ExperimentsClient experimentsClient = ExperimentsClient.create(experimentsSettings);
114  * }</pre>
115  *
116  * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
117  * the wire:
118  *
119  * <pre>{@code
120  * // This snippet has been automatically generated and should be regarded as a code template only.
121  * // It will require modifications to work:
122  * // - It may require correct/in-range values for request initialization.
123  * // - It may require specifying regional endpoints when creating the service client as shown in
124  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
125  * ExperimentsSettings experimentsSettings = ExperimentsSettings.newHttpJsonBuilder().build();
126  * ExperimentsClient experimentsClient = ExperimentsClient.create(experimentsSettings);
127  * }</pre>
128  *
129  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
130  */
131 @Generated("by gapic-generator-java")
132 public class ExperimentsClient implements BackgroundResource {
133   private final ExperimentsSettings settings;
134   private final ExperimentsStub stub;
135 
136   /** Constructs an instance of ExperimentsClient with default settings. */
create()137   public static final ExperimentsClient create() throws IOException {
138     return create(ExperimentsSettings.newBuilder().build());
139   }
140 
141   /**
142    * Constructs an instance of ExperimentsClient, using the given settings. The channels are created
143    * based on the settings passed in, or defaults for any settings that are not set.
144    */
create(ExperimentsSettings settings)145   public static final ExperimentsClient create(ExperimentsSettings settings) throws IOException {
146     return new ExperimentsClient(settings);
147   }
148 
149   /**
150    * Constructs an instance of ExperimentsClient, using the given stub for making calls. This is for
151    * advanced usage - prefer using create(ExperimentsSettings).
152    */
create(ExperimentsStub stub)153   public static final ExperimentsClient create(ExperimentsStub stub) {
154     return new ExperimentsClient(stub);
155   }
156 
157   /**
158    * Constructs an instance of ExperimentsClient, using the given settings. This is protected so
159    * that it is easy to make a subclass, but otherwise, the static factory methods should be
160    * preferred.
161    */
ExperimentsClient(ExperimentsSettings settings)162   protected ExperimentsClient(ExperimentsSettings settings) throws IOException {
163     this.settings = settings;
164     this.stub = ((ExperimentsStubSettings) settings.getStubSettings()).createStub();
165   }
166 
ExperimentsClient(ExperimentsStub stub)167   protected ExperimentsClient(ExperimentsStub stub) {
168     this.settings = null;
169     this.stub = stub;
170   }
171 
getSettings()172   public final ExperimentsSettings getSettings() {
173     return settings;
174   }
175 
getStub()176   public ExperimentsStub getStub() {
177     return stub;
178   }
179 
180   // AUTO-GENERATED DOCUMENTATION AND METHOD.
181   /**
182    * Returns the list of all experiments in the specified
183    * [Environment][google.cloud.dialogflow.cx.v3.Environment].
184    *
185    * <p>Sample code:
186    *
187    * <pre>{@code
188    * // This snippet has been automatically generated and should be regarded as a code template only.
189    * // It will require modifications to work:
190    * // - It may require correct/in-range values for request initialization.
191    * // - It may require specifying regional endpoints when creating the service client as shown in
192    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
193    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
194    *   EnvironmentName parent =
195    *       EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
196    *   for (Experiment element : experimentsClient.listExperiments(parent).iterateAll()) {
197    *     // doThingsWith(element);
198    *   }
199    * }
200    * }</pre>
201    *
202    * @param parent Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to list
203    *     all environments for. Format: `projects/&lt;Project ID&gt;/locations/&lt;Location
204    *     ID&gt;/agents/&lt;Agent ID&gt;/environments/&lt;Environment ID&gt;`.
205    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
206    */
listExperiments(EnvironmentName parent)207   public final ListExperimentsPagedResponse listExperiments(EnvironmentName parent) {
208     ListExperimentsRequest request =
209         ListExperimentsRequest.newBuilder()
210             .setParent(parent == null ? null : parent.toString())
211             .build();
212     return listExperiments(request);
213   }
214 
215   // AUTO-GENERATED DOCUMENTATION AND METHOD.
216   /**
217    * Returns the list of all experiments in the specified
218    * [Environment][google.cloud.dialogflow.cx.v3.Environment].
219    *
220    * <p>Sample code:
221    *
222    * <pre>{@code
223    * // This snippet has been automatically generated and should be regarded as a code template only.
224    * // It will require modifications to work:
225    * // - It may require correct/in-range values for request initialization.
226    * // - It may require specifying regional endpoints when creating the service client as shown in
227    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
228    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
229    *   String parent =
230    *       EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]").toString();
231    *   for (Experiment element : experimentsClient.listExperiments(parent).iterateAll()) {
232    *     // doThingsWith(element);
233    *   }
234    * }
235    * }</pre>
236    *
237    * @param parent Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to list
238    *     all environments for. Format: `projects/&lt;Project ID&gt;/locations/&lt;Location
239    *     ID&gt;/agents/&lt;Agent ID&gt;/environments/&lt;Environment ID&gt;`.
240    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
241    */
listExperiments(String parent)242   public final ListExperimentsPagedResponse listExperiments(String parent) {
243     ListExperimentsRequest request = ListExperimentsRequest.newBuilder().setParent(parent).build();
244     return listExperiments(request);
245   }
246 
247   // AUTO-GENERATED DOCUMENTATION AND METHOD.
248   /**
249    * Returns the list of all experiments in the specified
250    * [Environment][google.cloud.dialogflow.cx.v3.Environment].
251    *
252    * <p>Sample code:
253    *
254    * <pre>{@code
255    * // This snippet has been automatically generated and should be regarded as a code template only.
256    * // It will require modifications to work:
257    * // - It may require correct/in-range values for request initialization.
258    * // - It may require specifying regional endpoints when creating the service client as shown in
259    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
260    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
261    *   ListExperimentsRequest request =
262    *       ListExperimentsRequest.newBuilder()
263    *           .setParent(
264    *               EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
265    *                   .toString())
266    *           .setPageSize(883849137)
267    *           .setPageToken("pageToken873572522")
268    *           .build();
269    *   for (Experiment element : experimentsClient.listExperiments(request).iterateAll()) {
270    *     // doThingsWith(element);
271    *   }
272    * }
273    * }</pre>
274    *
275    * @param request The request object containing all of the parameters for the API call.
276    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
277    */
listExperiments(ListExperimentsRequest request)278   public final ListExperimentsPagedResponse listExperiments(ListExperimentsRequest request) {
279     return listExperimentsPagedCallable().call(request);
280   }
281 
282   // AUTO-GENERATED DOCUMENTATION AND METHOD.
283   /**
284    * Returns the list of all experiments in the specified
285    * [Environment][google.cloud.dialogflow.cx.v3.Environment].
286    *
287    * <p>Sample code:
288    *
289    * <pre>{@code
290    * // This snippet has been automatically generated and should be regarded as a code template only.
291    * // It will require modifications to work:
292    * // - It may require correct/in-range values for request initialization.
293    * // - It may require specifying regional endpoints when creating the service client as shown in
294    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
295    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
296    *   ListExperimentsRequest request =
297    *       ListExperimentsRequest.newBuilder()
298    *           .setParent(
299    *               EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
300    *                   .toString())
301    *           .setPageSize(883849137)
302    *           .setPageToken("pageToken873572522")
303    *           .build();
304    *   ApiFuture<Experiment> future =
305    *       experimentsClient.listExperimentsPagedCallable().futureCall(request);
306    *   // Do something.
307    *   for (Experiment element : future.get().iterateAll()) {
308    *     // doThingsWith(element);
309    *   }
310    * }
311    * }</pre>
312    */
313   public final UnaryCallable<ListExperimentsRequest, ListExperimentsPagedResponse>
listExperimentsPagedCallable()314       listExperimentsPagedCallable() {
315     return stub.listExperimentsPagedCallable();
316   }
317 
318   // AUTO-GENERATED DOCUMENTATION AND METHOD.
319   /**
320    * Returns the list of all experiments in the specified
321    * [Environment][google.cloud.dialogflow.cx.v3.Environment].
322    *
323    * <p>Sample code:
324    *
325    * <pre>{@code
326    * // This snippet has been automatically generated and should be regarded as a code template only.
327    * // It will require modifications to work:
328    * // - It may require correct/in-range values for request initialization.
329    * // - It may require specifying regional endpoints when creating the service client as shown in
330    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
331    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
332    *   ListExperimentsRequest request =
333    *       ListExperimentsRequest.newBuilder()
334    *           .setParent(
335    *               EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
336    *                   .toString())
337    *           .setPageSize(883849137)
338    *           .setPageToken("pageToken873572522")
339    *           .build();
340    *   while (true) {
341    *     ListExperimentsResponse response =
342    *         experimentsClient.listExperimentsCallable().call(request);
343    *     for (Experiment element : response.getExperimentsList()) {
344    *       // doThingsWith(element);
345    *     }
346    *     String nextPageToken = response.getNextPageToken();
347    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
348    *       request = request.toBuilder().setPageToken(nextPageToken).build();
349    *     } else {
350    *       break;
351    *     }
352    *   }
353    * }
354    * }</pre>
355    */
356   public final UnaryCallable<ListExperimentsRequest, ListExperimentsResponse>
listExperimentsCallable()357       listExperimentsCallable() {
358     return stub.listExperimentsCallable();
359   }
360 
361   // AUTO-GENERATED DOCUMENTATION AND METHOD.
362   /**
363    * Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
364    *
365    * <p>Sample code:
366    *
367    * <pre>{@code
368    * // This snippet has been automatically generated and should be regarded as a code template only.
369    * // It will require modifications to work:
370    * // - It may require correct/in-range values for request initialization.
371    * // - It may require specifying regional endpoints when creating the service client as shown in
372    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
373    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
374    *   ExperimentName name =
375    *       ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]");
376    *   Experiment response = experimentsClient.getExperiment(name);
377    * }
378    * }</pre>
379    *
380    * @param name Required. The name of the [Environment][google.cloud.dialogflow.cx.v3.Environment].
381    *     Format: `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent
382    *     ID&gt;/environments/&lt;Environment ID&gt;/experiments/&lt;Experiment ID&gt;`.
383    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
384    */
getExperiment(ExperimentName name)385   public final Experiment getExperiment(ExperimentName name) {
386     GetExperimentRequest request =
387         GetExperimentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
388     return getExperiment(request);
389   }
390 
391   // AUTO-GENERATED DOCUMENTATION AND METHOD.
392   /**
393    * Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
394    *
395    * <p>Sample code:
396    *
397    * <pre>{@code
398    * // This snippet has been automatically generated and should be regarded as a code template only.
399    * // It will require modifications to work:
400    * // - It may require correct/in-range values for request initialization.
401    * // - It may require specifying regional endpoints when creating the service client as shown in
402    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
403    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
404    *   String name =
405    *       ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
406    *           .toString();
407    *   Experiment response = experimentsClient.getExperiment(name);
408    * }
409    * }</pre>
410    *
411    * @param name Required. The name of the [Environment][google.cloud.dialogflow.cx.v3.Environment].
412    *     Format: `projects/&lt;Project ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent
413    *     ID&gt;/environments/&lt;Environment ID&gt;/experiments/&lt;Experiment ID&gt;`.
414    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
415    */
getExperiment(String name)416   public final Experiment getExperiment(String name) {
417     GetExperimentRequest request = GetExperimentRequest.newBuilder().setName(name).build();
418     return getExperiment(request);
419   }
420 
421   // AUTO-GENERATED DOCUMENTATION AND METHOD.
422   /**
423    * Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
424    *
425    * <p>Sample code:
426    *
427    * <pre>{@code
428    * // This snippet has been automatically generated and should be regarded as a code template only.
429    * // It will require modifications to work:
430    * // - It may require correct/in-range values for request initialization.
431    * // - It may require specifying regional endpoints when creating the service client as shown in
432    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
433    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
434    *   GetExperimentRequest request =
435    *       GetExperimentRequest.newBuilder()
436    *           .setName(
437    *               ExperimentName.of(
438    *                       "[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
439    *                   .toString())
440    *           .build();
441    *   Experiment response = experimentsClient.getExperiment(request);
442    * }
443    * }</pre>
444    *
445    * @param request The request object containing all of the parameters for the API call.
446    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
447    */
getExperiment(GetExperimentRequest request)448   public final Experiment getExperiment(GetExperimentRequest request) {
449     return getExperimentCallable().call(request);
450   }
451 
452   // AUTO-GENERATED DOCUMENTATION AND METHOD.
453   /**
454    * Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
455    *
456    * <p>Sample code:
457    *
458    * <pre>{@code
459    * // This snippet has been automatically generated and should be regarded as a code template only.
460    * // It will require modifications to work:
461    * // - It may require correct/in-range values for request initialization.
462    * // - It may require specifying regional endpoints when creating the service client as shown in
463    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
464    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
465    *   GetExperimentRequest request =
466    *       GetExperimentRequest.newBuilder()
467    *           .setName(
468    *               ExperimentName.of(
469    *                       "[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
470    *                   .toString())
471    *           .build();
472    *   ApiFuture<Experiment> future = experimentsClient.getExperimentCallable().futureCall(request);
473    *   // Do something.
474    *   Experiment response = future.get();
475    * }
476    * }</pre>
477    */
getExperimentCallable()478   public final UnaryCallable<GetExperimentRequest, Experiment> getExperimentCallable() {
479     return stub.getExperimentCallable();
480   }
481 
482   // AUTO-GENERATED DOCUMENTATION AND METHOD.
483   /**
484    * Creates an [Experiment][google.cloud.dialogflow.cx.v3.Experiment] in the specified
485    * [Environment][google.cloud.dialogflow.cx.v3.Environment].
486    *
487    * <p>Sample code:
488    *
489    * <pre>{@code
490    * // This snippet has been automatically generated and should be regarded as a code template only.
491    * // It will require modifications to work:
492    * // - It may require correct/in-range values for request initialization.
493    * // - It may require specifying regional endpoints when creating the service client as shown in
494    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
495    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
496    *   EnvironmentName parent =
497    *       EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
498    *   Experiment experiment = Experiment.newBuilder().build();
499    *   Experiment response = experimentsClient.createExperiment(parent, experiment);
500    * }
501    * }</pre>
502    *
503    * @param parent Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an
504    *     [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: `projects/&lt;Project
505    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/environments/&lt;Environment
506    *     ID&gt;`.
507    * @param experiment Required. The experiment to create.
508    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
509    */
createExperiment(EnvironmentName parent, Experiment experiment)510   public final Experiment createExperiment(EnvironmentName parent, Experiment experiment) {
511     CreateExperimentRequest request =
512         CreateExperimentRequest.newBuilder()
513             .setParent(parent == null ? null : parent.toString())
514             .setExperiment(experiment)
515             .build();
516     return createExperiment(request);
517   }
518 
519   // AUTO-GENERATED DOCUMENTATION AND METHOD.
520   /**
521    * Creates an [Experiment][google.cloud.dialogflow.cx.v3.Experiment] in the specified
522    * [Environment][google.cloud.dialogflow.cx.v3.Environment].
523    *
524    * <p>Sample code:
525    *
526    * <pre>{@code
527    * // This snippet has been automatically generated and should be regarded as a code template only.
528    * // It will require modifications to work:
529    * // - It may require correct/in-range values for request initialization.
530    * // - It may require specifying regional endpoints when creating the service client as shown in
531    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
532    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
533    *   String parent =
534    *       EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]").toString();
535    *   Experiment experiment = Experiment.newBuilder().build();
536    *   Experiment response = experimentsClient.createExperiment(parent, experiment);
537    * }
538    * }</pre>
539    *
540    * @param parent Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an
541    *     [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: `projects/&lt;Project
542    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/environments/&lt;Environment
543    *     ID&gt;`.
544    * @param experiment Required. The experiment to create.
545    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
546    */
createExperiment(String parent, Experiment experiment)547   public final Experiment createExperiment(String parent, Experiment experiment) {
548     CreateExperimentRequest request =
549         CreateExperimentRequest.newBuilder().setParent(parent).setExperiment(experiment).build();
550     return createExperiment(request);
551   }
552 
553   // AUTO-GENERATED DOCUMENTATION AND METHOD.
554   /**
555    * Creates an [Experiment][google.cloud.dialogflow.cx.v3.Experiment] in the specified
556    * [Environment][google.cloud.dialogflow.cx.v3.Environment].
557    *
558    * <p>Sample code:
559    *
560    * <pre>{@code
561    * // This snippet has been automatically generated and should be regarded as a code template only.
562    * // It will require modifications to work:
563    * // - It may require correct/in-range values for request initialization.
564    * // - It may require specifying regional endpoints when creating the service client as shown in
565    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
566    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
567    *   CreateExperimentRequest request =
568    *       CreateExperimentRequest.newBuilder()
569    *           .setParent(
570    *               EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
571    *                   .toString())
572    *           .setExperiment(Experiment.newBuilder().build())
573    *           .build();
574    *   Experiment response = experimentsClient.createExperiment(request);
575    * }
576    * }</pre>
577    *
578    * @param request The request object containing all of the parameters for the API call.
579    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
580    */
createExperiment(CreateExperimentRequest request)581   public final Experiment createExperiment(CreateExperimentRequest request) {
582     return createExperimentCallable().call(request);
583   }
584 
585   // AUTO-GENERATED DOCUMENTATION AND METHOD.
586   /**
587    * Creates an [Experiment][google.cloud.dialogflow.cx.v3.Experiment] in the specified
588    * [Environment][google.cloud.dialogflow.cx.v3.Environment].
589    *
590    * <p>Sample code:
591    *
592    * <pre>{@code
593    * // This snippet has been automatically generated and should be regarded as a code template only.
594    * // It will require modifications to work:
595    * // - It may require correct/in-range values for request initialization.
596    * // - It may require specifying regional endpoints when creating the service client as shown in
597    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
598    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
599    *   CreateExperimentRequest request =
600    *       CreateExperimentRequest.newBuilder()
601    *           .setParent(
602    *               EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
603    *                   .toString())
604    *           .setExperiment(Experiment.newBuilder().build())
605    *           .build();
606    *   ApiFuture<Experiment> future =
607    *       experimentsClient.createExperimentCallable().futureCall(request);
608    *   // Do something.
609    *   Experiment response = future.get();
610    * }
611    * }</pre>
612    */
createExperimentCallable()613   public final UnaryCallable<CreateExperimentRequest, Experiment> createExperimentCallable() {
614     return stub.createExperimentCallable();
615   }
616 
617   // AUTO-GENERATED DOCUMENTATION AND METHOD.
618   /**
619    * Updates the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
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 (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
630    *   Experiment experiment = Experiment.newBuilder().build();
631    *   FieldMask updateMask = FieldMask.newBuilder().build();
632    *   Experiment response = experimentsClient.updateExperiment(experiment, updateMask);
633    * }
634    * }</pre>
635    *
636    * @param experiment Required. The experiment to update.
637    * @param updateMask Required. The mask to control which fields get updated.
638    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
639    */
updateExperiment(Experiment experiment, FieldMask updateMask)640   public final Experiment updateExperiment(Experiment experiment, FieldMask updateMask) {
641     UpdateExperimentRequest request =
642         UpdateExperimentRequest.newBuilder()
643             .setExperiment(experiment)
644             .setUpdateMask(updateMask)
645             .build();
646     return updateExperiment(request);
647   }
648 
649   // AUTO-GENERATED DOCUMENTATION AND METHOD.
650   /**
651    * Updates the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
652    *
653    * <p>Sample code:
654    *
655    * <pre>{@code
656    * // This snippet has been automatically generated and should be regarded as a code template only.
657    * // It will require modifications to work:
658    * // - It may require correct/in-range values for request initialization.
659    * // - It may require specifying regional endpoints when creating the service client as shown in
660    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
661    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
662    *   UpdateExperimentRequest request =
663    *       UpdateExperimentRequest.newBuilder()
664    *           .setExperiment(Experiment.newBuilder().build())
665    *           .setUpdateMask(FieldMask.newBuilder().build())
666    *           .build();
667    *   Experiment response = experimentsClient.updateExperiment(request);
668    * }
669    * }</pre>
670    *
671    * @param request The request object containing all of the parameters for the API call.
672    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
673    */
updateExperiment(UpdateExperimentRequest request)674   public final Experiment updateExperiment(UpdateExperimentRequest request) {
675     return updateExperimentCallable().call(request);
676   }
677 
678   // AUTO-GENERATED DOCUMENTATION AND METHOD.
679   /**
680    * Updates the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
681    *
682    * <p>Sample code:
683    *
684    * <pre>{@code
685    * // This snippet has been automatically generated and should be regarded as a code template only.
686    * // It will require modifications to work:
687    * // - It may require correct/in-range values for request initialization.
688    * // - It may require specifying regional endpoints when creating the service client as shown in
689    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
690    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
691    *   UpdateExperimentRequest request =
692    *       UpdateExperimentRequest.newBuilder()
693    *           .setExperiment(Experiment.newBuilder().build())
694    *           .setUpdateMask(FieldMask.newBuilder().build())
695    *           .build();
696    *   ApiFuture<Experiment> future =
697    *       experimentsClient.updateExperimentCallable().futureCall(request);
698    *   // Do something.
699    *   Experiment response = future.get();
700    * }
701    * }</pre>
702    */
updateExperimentCallable()703   public final UnaryCallable<UpdateExperimentRequest, Experiment> updateExperimentCallable() {
704     return stub.updateExperimentCallable();
705   }
706 
707   // AUTO-GENERATED DOCUMENTATION AND METHOD.
708   /**
709    * Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
710    *
711    * <p>Sample code:
712    *
713    * <pre>{@code
714    * // This snippet has been automatically generated and should be regarded as a code template only.
715    * // It will require modifications to work:
716    * // - It may require correct/in-range values for request initialization.
717    * // - It may require specifying regional endpoints when creating the service client as shown in
718    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
719    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
720    *   ExperimentName name =
721    *       ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]");
722    *   experimentsClient.deleteExperiment(name);
723    * }
724    * }</pre>
725    *
726    * @param name Required. The name of the [Environment][google.cloud.dialogflow.cx.v3.Environment]
727    *     to delete. Format: `projects/&lt;Project ID&gt;/locations/&lt;Location
728    *     ID&gt;/agents/&lt;Agent ID&gt;/environments/&lt;Environment
729    *     ID&gt;/experiments/&lt;Experiment ID&gt;`.
730    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
731    */
deleteExperiment(ExperimentName name)732   public final void deleteExperiment(ExperimentName name) {
733     DeleteExperimentRequest request =
734         DeleteExperimentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
735     deleteExperiment(request);
736   }
737 
738   // AUTO-GENERATED DOCUMENTATION AND METHOD.
739   /**
740    * Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
741    *
742    * <p>Sample code:
743    *
744    * <pre>{@code
745    * // This snippet has been automatically generated and should be regarded as a code template only.
746    * // It will require modifications to work:
747    * // - It may require correct/in-range values for request initialization.
748    * // - It may require specifying regional endpoints when creating the service client as shown in
749    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
750    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
751    *   String name =
752    *       ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
753    *           .toString();
754    *   experimentsClient.deleteExperiment(name);
755    * }
756    * }</pre>
757    *
758    * @param name Required. The name of the [Environment][google.cloud.dialogflow.cx.v3.Environment]
759    *     to delete. Format: `projects/&lt;Project ID&gt;/locations/&lt;Location
760    *     ID&gt;/agents/&lt;Agent ID&gt;/environments/&lt;Environment
761    *     ID&gt;/experiments/&lt;Experiment ID&gt;`.
762    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
763    */
deleteExperiment(String name)764   public final void deleteExperiment(String name) {
765     DeleteExperimentRequest request = DeleteExperimentRequest.newBuilder().setName(name).build();
766     deleteExperiment(request);
767   }
768 
769   // AUTO-GENERATED DOCUMENTATION AND METHOD.
770   /**
771    * Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
772    *
773    * <p>Sample code:
774    *
775    * <pre>{@code
776    * // This snippet has been automatically generated and should be regarded as a code template only.
777    * // It will require modifications to work:
778    * // - It may require correct/in-range values for request initialization.
779    * // - It may require specifying regional endpoints when creating the service client as shown in
780    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
781    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
782    *   DeleteExperimentRequest request =
783    *       DeleteExperimentRequest.newBuilder()
784    *           .setName(
785    *               ExperimentName.of(
786    *                       "[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
787    *                   .toString())
788    *           .build();
789    *   experimentsClient.deleteExperiment(request);
790    * }
791    * }</pre>
792    *
793    * @param request The request object containing all of the parameters for the API call.
794    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
795    */
deleteExperiment(DeleteExperimentRequest request)796   public final void deleteExperiment(DeleteExperimentRequest request) {
797     deleteExperimentCallable().call(request);
798   }
799 
800   // AUTO-GENERATED DOCUMENTATION AND METHOD.
801   /**
802    * Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
803    *
804    * <p>Sample code:
805    *
806    * <pre>{@code
807    * // This snippet has been automatically generated and should be regarded as a code template only.
808    * // It will require modifications to work:
809    * // - It may require correct/in-range values for request initialization.
810    * // - It may require specifying regional endpoints when creating the service client as shown in
811    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
812    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
813    *   DeleteExperimentRequest request =
814    *       DeleteExperimentRequest.newBuilder()
815    *           .setName(
816    *               ExperimentName.of(
817    *                       "[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
818    *                   .toString())
819    *           .build();
820    *   ApiFuture<Empty> future = experimentsClient.deleteExperimentCallable().futureCall(request);
821    *   // Do something.
822    *   future.get();
823    * }
824    * }</pre>
825    */
deleteExperimentCallable()826   public final UnaryCallable<DeleteExperimentRequest, Empty> deleteExperimentCallable() {
827     return stub.deleteExperimentCallable();
828   }
829 
830   // AUTO-GENERATED DOCUMENTATION AND METHOD.
831   /**
832    * Starts the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only
833    * changes the state of experiment from PENDING to RUNNING.
834    *
835    * <p>Sample code:
836    *
837    * <pre>{@code
838    * // This snippet has been automatically generated and should be regarded as a code template only.
839    * // It will require modifications to work:
840    * // - It may require correct/in-range values for request initialization.
841    * // - It may require specifying regional endpoints when creating the service client as shown in
842    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
843    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
844    *   ExperimentName name =
845    *       ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]");
846    *   Experiment response = experimentsClient.startExperiment(name);
847    * }
848    * }</pre>
849    *
850    * @param name Required. Resource name of the experiment to start. Format: `projects/&lt;Project
851    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/environments/&lt;Environment
852    *     ID&gt;/experiments/&lt;Experiment ID&gt;`.
853    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
854    */
startExperiment(ExperimentName name)855   public final Experiment startExperiment(ExperimentName name) {
856     StartExperimentRequest request =
857         StartExperimentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
858     return startExperiment(request);
859   }
860 
861   // AUTO-GENERATED DOCUMENTATION AND METHOD.
862   /**
863    * Starts the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only
864    * changes the state of experiment from PENDING to RUNNING.
865    *
866    * <p>Sample code:
867    *
868    * <pre>{@code
869    * // This snippet has been automatically generated and should be regarded as a code template only.
870    * // It will require modifications to work:
871    * // - It may require correct/in-range values for request initialization.
872    * // - It may require specifying regional endpoints when creating the service client as shown in
873    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
874    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
875    *   String name =
876    *       ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
877    *           .toString();
878    *   Experiment response = experimentsClient.startExperiment(name);
879    * }
880    * }</pre>
881    *
882    * @param name Required. Resource name of the experiment to start. Format: `projects/&lt;Project
883    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/environments/&lt;Environment
884    *     ID&gt;/experiments/&lt;Experiment ID&gt;`.
885    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
886    */
startExperiment(String name)887   public final Experiment startExperiment(String name) {
888     StartExperimentRequest request = StartExperimentRequest.newBuilder().setName(name).build();
889     return startExperiment(request);
890   }
891 
892   // AUTO-GENERATED DOCUMENTATION AND METHOD.
893   /**
894    * Starts the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only
895    * changes the state of experiment from PENDING to RUNNING.
896    *
897    * <p>Sample code:
898    *
899    * <pre>{@code
900    * // This snippet has been automatically generated and should be regarded as a code template only.
901    * // It will require modifications to work:
902    * // - It may require correct/in-range values for request initialization.
903    * // - It may require specifying regional endpoints when creating the service client as shown in
904    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
905    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
906    *   StartExperimentRequest request =
907    *       StartExperimentRequest.newBuilder()
908    *           .setName(
909    *               ExperimentName.of(
910    *                       "[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
911    *                   .toString())
912    *           .build();
913    *   Experiment response = experimentsClient.startExperiment(request);
914    * }
915    * }</pre>
916    *
917    * @param request The request object containing all of the parameters for the API call.
918    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
919    */
startExperiment(StartExperimentRequest request)920   public final Experiment startExperiment(StartExperimentRequest request) {
921     return startExperimentCallable().call(request);
922   }
923 
924   // AUTO-GENERATED DOCUMENTATION AND METHOD.
925   /**
926    * Starts the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only
927    * changes the state of experiment from PENDING to RUNNING.
928    *
929    * <p>Sample code:
930    *
931    * <pre>{@code
932    * // This snippet has been automatically generated and should be regarded as a code template only.
933    * // It will require modifications to work:
934    * // - It may require correct/in-range values for request initialization.
935    * // - It may require specifying regional endpoints when creating the service client as shown in
936    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
937    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
938    *   StartExperimentRequest request =
939    *       StartExperimentRequest.newBuilder()
940    *           .setName(
941    *               ExperimentName.of(
942    *                       "[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
943    *                   .toString())
944    *           .build();
945    *   ApiFuture<Experiment> future =
946    *       experimentsClient.startExperimentCallable().futureCall(request);
947    *   // Do something.
948    *   Experiment response = future.get();
949    * }
950    * }</pre>
951    */
startExperimentCallable()952   public final UnaryCallable<StartExperimentRequest, Experiment> startExperimentCallable() {
953     return stub.startExperimentCallable();
954   }
955 
956   // AUTO-GENERATED DOCUMENTATION AND METHOD.
957   /**
958    * Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only
959    * changes the state of experiment from RUNNING to DONE.
960    *
961    * <p>Sample code:
962    *
963    * <pre>{@code
964    * // This snippet has been automatically generated and should be regarded as a code template only.
965    * // It will require modifications to work:
966    * // - It may require correct/in-range values for request initialization.
967    * // - It may require specifying regional endpoints when creating the service client as shown in
968    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
969    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
970    *   ExperimentName name =
971    *       ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]");
972    *   Experiment response = experimentsClient.stopExperiment(name);
973    * }
974    * }</pre>
975    *
976    * @param name Required. Resource name of the experiment to stop. Format: `projects/&lt;Project
977    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/environments/&lt;Environment
978    *     ID&gt;/experiments/&lt;Experiment ID&gt;`.
979    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
980    */
stopExperiment(ExperimentName name)981   public final Experiment stopExperiment(ExperimentName name) {
982     StopExperimentRequest request =
983         StopExperimentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
984     return stopExperiment(request);
985   }
986 
987   // AUTO-GENERATED DOCUMENTATION AND METHOD.
988   /**
989    * Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only
990    * changes the state of experiment from RUNNING to DONE.
991    *
992    * <p>Sample code:
993    *
994    * <pre>{@code
995    * // This snippet has been automatically generated and should be regarded as a code template only.
996    * // It will require modifications to work:
997    * // - It may require correct/in-range values for request initialization.
998    * // - It may require specifying regional endpoints when creating the service client as shown in
999    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1000    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
1001    *   String name =
1002    *       ExperimentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
1003    *           .toString();
1004    *   Experiment response = experimentsClient.stopExperiment(name);
1005    * }
1006    * }</pre>
1007    *
1008    * @param name Required. Resource name of the experiment to stop. Format: `projects/&lt;Project
1009    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/environments/&lt;Environment
1010    *     ID&gt;/experiments/&lt;Experiment ID&gt;`.
1011    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1012    */
stopExperiment(String name)1013   public final Experiment stopExperiment(String name) {
1014     StopExperimentRequest request = StopExperimentRequest.newBuilder().setName(name).build();
1015     return stopExperiment(request);
1016   }
1017 
1018   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1019   /**
1020    * Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only
1021    * changes the state of experiment from RUNNING to DONE.
1022    *
1023    * <p>Sample code:
1024    *
1025    * <pre>{@code
1026    * // This snippet has been automatically generated and should be regarded as a code template only.
1027    * // It will require modifications to work:
1028    * // - It may require correct/in-range values for request initialization.
1029    * // - It may require specifying regional endpoints when creating the service client as shown in
1030    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1031    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
1032    *   StopExperimentRequest request =
1033    *       StopExperimentRequest.newBuilder()
1034    *           .setName(
1035    *               ExperimentName.of(
1036    *                       "[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
1037    *                   .toString())
1038    *           .build();
1039    *   Experiment response = experimentsClient.stopExperiment(request);
1040    * }
1041    * }</pre>
1042    *
1043    * @param request The request object containing all of the parameters for the API call.
1044    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1045    */
stopExperiment(StopExperimentRequest request)1046   public final Experiment stopExperiment(StopExperimentRequest request) {
1047     return stopExperimentCallable().call(request);
1048   }
1049 
1050   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1051   /**
1052    * Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only
1053    * changes the state of experiment from RUNNING to DONE.
1054    *
1055    * <p>Sample code:
1056    *
1057    * <pre>{@code
1058    * // This snippet has been automatically generated and should be regarded as a code template only.
1059    * // It will require modifications to work:
1060    * // - It may require correct/in-range values for request initialization.
1061    * // - It may require specifying regional endpoints when creating the service client as shown in
1062    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1063    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
1064    *   StopExperimentRequest request =
1065    *       StopExperimentRequest.newBuilder()
1066    *           .setName(
1067    *               ExperimentName.of(
1068    *                       "[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]")
1069    *                   .toString())
1070    *           .build();
1071    *   ApiFuture<Experiment> future = experimentsClient.stopExperimentCallable().futureCall(request);
1072    *   // Do something.
1073    *   Experiment response = future.get();
1074    * }
1075    * }</pre>
1076    */
stopExperimentCallable()1077   public final UnaryCallable<StopExperimentRequest, Experiment> stopExperimentCallable() {
1078     return stub.stopExperimentCallable();
1079   }
1080 
1081   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1082   /**
1083    * Lists information about the supported locations for this service.
1084    *
1085    * <p>Sample code:
1086    *
1087    * <pre>{@code
1088    * // This snippet has been automatically generated and should be regarded as a code template only.
1089    * // It will require modifications to work:
1090    * // - It may require correct/in-range values for request initialization.
1091    * // - It may require specifying regional endpoints when creating the service client as shown in
1092    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1093    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
1094    *   ListLocationsRequest request =
1095    *       ListLocationsRequest.newBuilder()
1096    *           .setName("name3373707")
1097    *           .setFilter("filter-1274492040")
1098    *           .setPageSize(883849137)
1099    *           .setPageToken("pageToken873572522")
1100    *           .build();
1101    *   for (Location element : experimentsClient.listLocations(request).iterateAll()) {
1102    *     // doThingsWith(element);
1103    *   }
1104    * }
1105    * }</pre>
1106    *
1107    * @param request The request object containing all of the parameters for the API call.
1108    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1109    */
listLocations(ListLocationsRequest request)1110   public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
1111     return listLocationsPagedCallable().call(request);
1112   }
1113 
1114   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1115   /**
1116    * Lists information about the supported locations for this service.
1117    *
1118    * <p>Sample code:
1119    *
1120    * <pre>{@code
1121    * // This snippet has been automatically generated and should be regarded as a code template only.
1122    * // It will require modifications to work:
1123    * // - It may require correct/in-range values for request initialization.
1124    * // - It may require specifying regional endpoints when creating the service client as shown in
1125    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1126    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
1127    *   ListLocationsRequest request =
1128    *       ListLocationsRequest.newBuilder()
1129    *           .setName("name3373707")
1130    *           .setFilter("filter-1274492040")
1131    *           .setPageSize(883849137)
1132    *           .setPageToken("pageToken873572522")
1133    *           .build();
1134    *   ApiFuture<Location> future =
1135    *       experimentsClient.listLocationsPagedCallable().futureCall(request);
1136    *   // Do something.
1137    *   for (Location element : future.get().iterateAll()) {
1138    *     // doThingsWith(element);
1139    *   }
1140    * }
1141    * }</pre>
1142    */
1143   public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable()1144       listLocationsPagedCallable() {
1145     return stub.listLocationsPagedCallable();
1146   }
1147 
1148   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1149   /**
1150    * Lists information about the supported locations for this service.
1151    *
1152    * <p>Sample code:
1153    *
1154    * <pre>{@code
1155    * // This snippet has been automatically generated and should be regarded as a code template only.
1156    * // It will require modifications to work:
1157    * // - It may require correct/in-range values for request initialization.
1158    * // - It may require specifying regional endpoints when creating the service client as shown in
1159    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1160    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
1161    *   ListLocationsRequest request =
1162    *       ListLocationsRequest.newBuilder()
1163    *           .setName("name3373707")
1164    *           .setFilter("filter-1274492040")
1165    *           .setPageSize(883849137)
1166    *           .setPageToken("pageToken873572522")
1167    *           .build();
1168    *   while (true) {
1169    *     ListLocationsResponse response = experimentsClient.listLocationsCallable().call(request);
1170    *     for (Location element : response.getLocationsList()) {
1171    *       // doThingsWith(element);
1172    *     }
1173    *     String nextPageToken = response.getNextPageToken();
1174    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
1175    *       request = request.toBuilder().setPageToken(nextPageToken).build();
1176    *     } else {
1177    *       break;
1178    *     }
1179    *   }
1180    * }
1181    * }</pre>
1182    */
listLocationsCallable()1183   public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
1184     return stub.listLocationsCallable();
1185   }
1186 
1187   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1188   /**
1189    * Gets information about a location.
1190    *
1191    * <p>Sample code:
1192    *
1193    * <pre>{@code
1194    * // This snippet has been automatically generated and should be regarded as a code template only.
1195    * // It will require modifications to work:
1196    * // - It may require correct/in-range values for request initialization.
1197    * // - It may require specifying regional endpoints when creating the service client as shown in
1198    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1199    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
1200    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
1201    *   Location response = experimentsClient.getLocation(request);
1202    * }
1203    * }</pre>
1204    *
1205    * @param request The request object containing all of the parameters for the API call.
1206    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1207    */
getLocation(GetLocationRequest request)1208   public final Location getLocation(GetLocationRequest request) {
1209     return getLocationCallable().call(request);
1210   }
1211 
1212   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1213   /**
1214    * Gets information about a location.
1215    *
1216    * <p>Sample code:
1217    *
1218    * <pre>{@code
1219    * // This snippet has been automatically generated and should be regarded as a code template only.
1220    * // It will require modifications to work:
1221    * // - It may require correct/in-range values for request initialization.
1222    * // - It may require specifying regional endpoints when creating the service client as shown in
1223    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1224    * try (ExperimentsClient experimentsClient = ExperimentsClient.create()) {
1225    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
1226    *   ApiFuture<Location> future = experimentsClient.getLocationCallable().futureCall(request);
1227    *   // Do something.
1228    *   Location response = future.get();
1229    * }
1230    * }</pre>
1231    */
getLocationCallable()1232   public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
1233     return stub.getLocationCallable();
1234   }
1235 
1236   @Override
close()1237   public final void close() {
1238     stub.close();
1239   }
1240 
1241   @Override
shutdown()1242   public void shutdown() {
1243     stub.shutdown();
1244   }
1245 
1246   @Override
isShutdown()1247   public boolean isShutdown() {
1248     return stub.isShutdown();
1249   }
1250 
1251   @Override
isTerminated()1252   public boolean isTerminated() {
1253     return stub.isTerminated();
1254   }
1255 
1256   @Override
shutdownNow()1257   public void shutdownNow() {
1258     stub.shutdownNow();
1259   }
1260 
1261   @Override
awaitTermination(long duration, TimeUnit unit)1262   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
1263     return stub.awaitTermination(duration, unit);
1264   }
1265 
1266   public static class ListExperimentsPagedResponse
1267       extends AbstractPagedListResponse<
1268           ListExperimentsRequest,
1269           ListExperimentsResponse,
1270           Experiment,
1271           ListExperimentsPage,
1272           ListExperimentsFixedSizeCollection> {
1273 
createAsync( PageContext<ListExperimentsRequest, ListExperimentsResponse, Experiment> context, ApiFuture<ListExperimentsResponse> futureResponse)1274     public static ApiFuture<ListExperimentsPagedResponse> createAsync(
1275         PageContext<ListExperimentsRequest, ListExperimentsResponse, Experiment> context,
1276         ApiFuture<ListExperimentsResponse> futureResponse) {
1277       ApiFuture<ListExperimentsPage> futurePage =
1278           ListExperimentsPage.createEmptyPage().createPageAsync(context, futureResponse);
1279       return ApiFutures.transform(
1280           futurePage,
1281           input -> new ListExperimentsPagedResponse(input),
1282           MoreExecutors.directExecutor());
1283     }
1284 
ListExperimentsPagedResponse(ListExperimentsPage page)1285     private ListExperimentsPagedResponse(ListExperimentsPage page) {
1286       super(page, ListExperimentsFixedSizeCollection.createEmptyCollection());
1287     }
1288   }
1289 
1290   public static class ListExperimentsPage
1291       extends AbstractPage<
1292           ListExperimentsRequest, ListExperimentsResponse, Experiment, ListExperimentsPage> {
1293 
ListExperimentsPage( PageContext<ListExperimentsRequest, ListExperimentsResponse, Experiment> context, ListExperimentsResponse response)1294     private ListExperimentsPage(
1295         PageContext<ListExperimentsRequest, ListExperimentsResponse, Experiment> context,
1296         ListExperimentsResponse response) {
1297       super(context, response);
1298     }
1299 
createEmptyPage()1300     private static ListExperimentsPage createEmptyPage() {
1301       return new ListExperimentsPage(null, null);
1302     }
1303 
1304     @Override
createPage( PageContext<ListExperimentsRequest, ListExperimentsResponse, Experiment> context, ListExperimentsResponse response)1305     protected ListExperimentsPage createPage(
1306         PageContext<ListExperimentsRequest, ListExperimentsResponse, Experiment> context,
1307         ListExperimentsResponse response) {
1308       return new ListExperimentsPage(context, response);
1309     }
1310 
1311     @Override
createPageAsync( PageContext<ListExperimentsRequest, ListExperimentsResponse, Experiment> context, ApiFuture<ListExperimentsResponse> futureResponse)1312     public ApiFuture<ListExperimentsPage> createPageAsync(
1313         PageContext<ListExperimentsRequest, ListExperimentsResponse, Experiment> context,
1314         ApiFuture<ListExperimentsResponse> futureResponse) {
1315       return super.createPageAsync(context, futureResponse);
1316     }
1317   }
1318 
1319   public static class ListExperimentsFixedSizeCollection
1320       extends AbstractFixedSizeCollection<
1321           ListExperimentsRequest,
1322           ListExperimentsResponse,
1323           Experiment,
1324           ListExperimentsPage,
1325           ListExperimentsFixedSizeCollection> {
1326 
ListExperimentsFixedSizeCollection( List<ListExperimentsPage> pages, int collectionSize)1327     private ListExperimentsFixedSizeCollection(
1328         List<ListExperimentsPage> pages, int collectionSize) {
1329       super(pages, collectionSize);
1330     }
1331 
createEmptyCollection()1332     private static ListExperimentsFixedSizeCollection createEmptyCollection() {
1333       return new ListExperimentsFixedSizeCollection(null, 0);
1334     }
1335 
1336     @Override
createCollection( List<ListExperimentsPage> pages, int collectionSize)1337     protected ListExperimentsFixedSizeCollection createCollection(
1338         List<ListExperimentsPage> pages, int collectionSize) {
1339       return new ListExperimentsFixedSizeCollection(pages, collectionSize);
1340     }
1341   }
1342 
1343   public static class ListLocationsPagedResponse
1344       extends AbstractPagedListResponse<
1345           ListLocationsRequest,
1346           ListLocationsResponse,
1347           Location,
1348           ListLocationsPage,
1349           ListLocationsFixedSizeCollection> {
1350 
createAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1351     public static ApiFuture<ListLocationsPagedResponse> createAsync(
1352         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1353         ApiFuture<ListLocationsResponse> futureResponse) {
1354       ApiFuture<ListLocationsPage> futurePage =
1355           ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
1356       return ApiFutures.transform(
1357           futurePage,
1358           input -> new ListLocationsPagedResponse(input),
1359           MoreExecutors.directExecutor());
1360     }
1361 
ListLocationsPagedResponse(ListLocationsPage page)1362     private ListLocationsPagedResponse(ListLocationsPage page) {
1363       super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
1364     }
1365   }
1366 
1367   public static class ListLocationsPage
1368       extends AbstractPage<
1369           ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
1370 
ListLocationsPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1371     private ListLocationsPage(
1372         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1373         ListLocationsResponse response) {
1374       super(context, response);
1375     }
1376 
createEmptyPage()1377     private static ListLocationsPage createEmptyPage() {
1378       return new ListLocationsPage(null, null);
1379     }
1380 
1381     @Override
createPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1382     protected ListLocationsPage createPage(
1383         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1384         ListLocationsResponse response) {
1385       return new ListLocationsPage(context, response);
1386     }
1387 
1388     @Override
createPageAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1389     public ApiFuture<ListLocationsPage> createPageAsync(
1390         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1391         ApiFuture<ListLocationsResponse> futureResponse) {
1392       return super.createPageAsync(context, futureResponse);
1393     }
1394   }
1395 
1396   public static class ListLocationsFixedSizeCollection
1397       extends AbstractFixedSizeCollection<
1398           ListLocationsRequest,
1399           ListLocationsResponse,
1400           Location,
1401           ListLocationsPage,
1402           ListLocationsFixedSizeCollection> {
1403 
ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize)1404     private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) {
1405       super(pages, collectionSize);
1406     }
1407 
createEmptyCollection()1408     private static ListLocationsFixedSizeCollection createEmptyCollection() {
1409       return new ListLocationsFixedSizeCollection(null, 0);
1410     }
1411 
1412     @Override
createCollection( List<ListLocationsPage> pages, int collectionSize)1413     protected ListLocationsFixedSizeCollection createCollection(
1414         List<ListLocationsPage> pages, int collectionSize) {
1415       return new ListLocationsFixedSizeCollection(pages, collectionSize);
1416     }
1417   }
1418 }
1419