• 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.IntentsStub;
28 import com.google.cloud.dialogflow.cx.v3.stub.IntentsStubSettings;
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 [Intents][google.cloud.dialogflow.cx.v3.Intent].
44  *
45  * <p>This class provides the ability to make remote calls to the backing service through method
46  * calls that map to API methods. Sample code to get started:
47  *
48  * <pre>{@code
49  * // This snippet has been automatically generated and should be regarded as a code template only.
50  * // It will require modifications to work:
51  * // - It may require correct/in-range values for request initialization.
52  * // - It may require specifying regional endpoints when creating the service client as shown in
53  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
54  * try (IntentsClient intentsClient = IntentsClient.create()) {
55  *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
56  *   Intent response = intentsClient.getIntent(name);
57  * }
58  * }</pre>
59  *
60  * <p>Note: close() needs to be called on the IntentsClient object to clean up resources such as
61  * threads. In the example above, try-with-resources is used, which automatically calls close().
62  *
63  * <p>The surface of this class includes several types of Java methods for each of the API's
64  * methods:
65  *
66  * <ol>
67  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
68  *       converted into function parameters. It may be the case that not all fields are available as
69  *       parameters, and not every API method will have a flattened method entry point.
70  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
71  *       which must be constructed before the call. Not every API method will have a request object
72  *       method.
73  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
74  *       callable object, which can be used to initiate calls to the service.
75  * </ol>
76  *
77  * <p>See the individual methods for example code.
78  *
79  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
80  * these names, this class includes a format method for each type of name, and additionally a parse
81  * method to extract the individual identifiers contained within names that are returned.
82  *
83  * <p>This class can be customized by passing in a custom instance of IntentsSettings to create().
84  * For example:
85  *
86  * <p>To customize credentials:
87  *
88  * <pre>{@code
89  * // This snippet has been automatically generated and should be regarded as a code template only.
90  * // It will require modifications to work:
91  * // - It may require correct/in-range values for request initialization.
92  * // - It may require specifying regional endpoints when creating the service client as shown in
93  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
94  * IntentsSettings intentsSettings =
95  *     IntentsSettings.newBuilder()
96  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
97  *         .build();
98  * IntentsClient intentsClient = IntentsClient.create(intentsSettings);
99  * }</pre>
100  *
101  * <p>To customize the endpoint:
102  *
103  * <pre>{@code
104  * // This snippet has been automatically generated and should be regarded as a code template only.
105  * // It will require modifications to work:
106  * // - It may require correct/in-range values for request initialization.
107  * // - It may require specifying regional endpoints when creating the service client as shown in
108  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
109  * IntentsSettings intentsSettings = IntentsSettings.newBuilder().setEndpoint(myEndpoint).build();
110  * IntentsClient intentsClient = IntentsClient.create(intentsSettings);
111  * }</pre>
112  *
113  * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
114  * the wire:
115  *
116  * <pre>{@code
117  * // This snippet has been automatically generated and should be regarded as a code template only.
118  * // It will require modifications to work:
119  * // - It may require correct/in-range values for request initialization.
120  * // - It may require specifying regional endpoints when creating the service client as shown in
121  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
122  * IntentsSettings intentsSettings = IntentsSettings.newHttpJsonBuilder().build();
123  * IntentsClient intentsClient = IntentsClient.create(intentsSettings);
124  * }</pre>
125  *
126  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
127  */
128 @Generated("by gapic-generator-java")
129 public class IntentsClient implements BackgroundResource {
130   private final IntentsSettings settings;
131   private final IntentsStub stub;
132 
133   /** Constructs an instance of IntentsClient with default settings. */
create()134   public static final IntentsClient create() throws IOException {
135     return create(IntentsSettings.newBuilder().build());
136   }
137 
138   /**
139    * Constructs an instance of IntentsClient, using the given settings. The channels are created
140    * based on the settings passed in, or defaults for any settings that are not set.
141    */
create(IntentsSettings settings)142   public static final IntentsClient create(IntentsSettings settings) throws IOException {
143     return new IntentsClient(settings);
144   }
145 
146   /**
147    * Constructs an instance of IntentsClient, using the given stub for making calls. This is for
148    * advanced usage - prefer using create(IntentsSettings).
149    */
create(IntentsStub stub)150   public static final IntentsClient create(IntentsStub stub) {
151     return new IntentsClient(stub);
152   }
153 
154   /**
155    * Constructs an instance of IntentsClient, using the given settings. This is protected so that it
156    * is easy to make a subclass, but otherwise, the static factory methods should be preferred.
157    */
IntentsClient(IntentsSettings settings)158   protected IntentsClient(IntentsSettings settings) throws IOException {
159     this.settings = settings;
160     this.stub = ((IntentsStubSettings) settings.getStubSettings()).createStub();
161   }
162 
IntentsClient(IntentsStub stub)163   protected IntentsClient(IntentsStub stub) {
164     this.settings = null;
165     this.stub = stub;
166   }
167 
getSettings()168   public final IntentsSettings getSettings() {
169     return settings;
170   }
171 
getStub()172   public IntentsStub getStub() {
173     return stub;
174   }
175 
176   // AUTO-GENERATED DOCUMENTATION AND METHOD.
177   /**
178    * Returns the list of all intents in the specified agent.
179    *
180    * <p>Sample code:
181    *
182    * <pre>{@code
183    * // This snippet has been automatically generated and should be regarded as a code template only.
184    * // It will require modifications to work:
185    * // - It may require correct/in-range values for request initialization.
186    * // - It may require specifying regional endpoints when creating the service client as shown in
187    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
188    * try (IntentsClient intentsClient = IntentsClient.create()) {
189    *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
190    *   for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
191    *     // doThingsWith(element);
192    *   }
193    * }
194    * }</pre>
195    *
196    * @param parent Required. The agent to list all intents for. Format: `projects/&lt;Project
197    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;`.
198    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
199    */
listIntents(AgentName parent)200   public final ListIntentsPagedResponse listIntents(AgentName parent) {
201     ListIntentsRequest request =
202         ListIntentsRequest.newBuilder()
203             .setParent(parent == null ? null : parent.toString())
204             .build();
205     return listIntents(request);
206   }
207 
208   // AUTO-GENERATED DOCUMENTATION AND METHOD.
209   /**
210    * Returns the list of all intents in the specified agent.
211    *
212    * <p>Sample code:
213    *
214    * <pre>{@code
215    * // This snippet has been automatically generated and should be regarded as a code template only.
216    * // It will require modifications to work:
217    * // - It may require correct/in-range values for request initialization.
218    * // - It may require specifying regional endpoints when creating the service client as shown in
219    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
220    * try (IntentsClient intentsClient = IntentsClient.create()) {
221    *   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
222    *   for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
223    *     // doThingsWith(element);
224    *   }
225    * }
226    * }</pre>
227    *
228    * @param parent Required. The agent to list all intents for. Format: `projects/&lt;Project
229    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;`.
230    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
231    */
listIntents(String parent)232   public final ListIntentsPagedResponse listIntents(String parent) {
233     ListIntentsRequest request = ListIntentsRequest.newBuilder().setParent(parent).build();
234     return listIntents(request);
235   }
236 
237   // AUTO-GENERATED DOCUMENTATION AND METHOD.
238   /**
239    * Returns the list of all intents in the specified agent.
240    *
241    * <p>Sample code:
242    *
243    * <pre>{@code
244    * // This snippet has been automatically generated and should be regarded as a code template only.
245    * // It will require modifications to work:
246    * // - It may require correct/in-range values for request initialization.
247    * // - It may require specifying regional endpoints when creating the service client as shown in
248    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
249    * try (IntentsClient intentsClient = IntentsClient.create()) {
250    *   ListIntentsRequest request =
251    *       ListIntentsRequest.newBuilder()
252    *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
253    *           .setLanguageCode("languageCode-2092349083")
254    *           .setIntentView(IntentView.forNumber(0))
255    *           .setPageSize(883849137)
256    *           .setPageToken("pageToken873572522")
257    *           .build();
258    *   for (Intent element : intentsClient.listIntents(request).iterateAll()) {
259    *     // doThingsWith(element);
260    *   }
261    * }
262    * }</pre>
263    *
264    * @param request The request object containing all of the parameters for the API call.
265    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
266    */
listIntents(ListIntentsRequest request)267   public final ListIntentsPagedResponse listIntents(ListIntentsRequest request) {
268     return listIntentsPagedCallable().call(request);
269   }
270 
271   // AUTO-GENERATED DOCUMENTATION AND METHOD.
272   /**
273    * Returns the list of all intents in the specified agent.
274    *
275    * <p>Sample code:
276    *
277    * <pre>{@code
278    * // This snippet has been automatically generated and should be regarded as a code template only.
279    * // It will require modifications to work:
280    * // - It may require correct/in-range values for request initialization.
281    * // - It may require specifying regional endpoints when creating the service client as shown in
282    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
283    * try (IntentsClient intentsClient = IntentsClient.create()) {
284    *   ListIntentsRequest request =
285    *       ListIntentsRequest.newBuilder()
286    *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
287    *           .setLanguageCode("languageCode-2092349083")
288    *           .setIntentView(IntentView.forNumber(0))
289    *           .setPageSize(883849137)
290    *           .setPageToken("pageToken873572522")
291    *           .build();
292    *   ApiFuture<Intent> future = intentsClient.listIntentsPagedCallable().futureCall(request);
293    *   // Do something.
294    *   for (Intent element : future.get().iterateAll()) {
295    *     // doThingsWith(element);
296    *   }
297    * }
298    * }</pre>
299    */
300   public final UnaryCallable<ListIntentsRequest, ListIntentsPagedResponse>
listIntentsPagedCallable()301       listIntentsPagedCallable() {
302     return stub.listIntentsPagedCallable();
303   }
304 
305   // AUTO-GENERATED DOCUMENTATION AND METHOD.
306   /**
307    * Returns the list of all intents in the specified agent.
308    *
309    * <p>Sample code:
310    *
311    * <pre>{@code
312    * // This snippet has been automatically generated and should be regarded as a code template only.
313    * // It will require modifications to work:
314    * // - It may require correct/in-range values for request initialization.
315    * // - It may require specifying regional endpoints when creating the service client as shown in
316    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
317    * try (IntentsClient intentsClient = IntentsClient.create()) {
318    *   ListIntentsRequest request =
319    *       ListIntentsRequest.newBuilder()
320    *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
321    *           .setLanguageCode("languageCode-2092349083")
322    *           .setIntentView(IntentView.forNumber(0))
323    *           .setPageSize(883849137)
324    *           .setPageToken("pageToken873572522")
325    *           .build();
326    *   while (true) {
327    *     ListIntentsResponse response = intentsClient.listIntentsCallable().call(request);
328    *     for (Intent element : response.getIntentsList()) {
329    *       // doThingsWith(element);
330    *     }
331    *     String nextPageToken = response.getNextPageToken();
332    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
333    *       request = request.toBuilder().setPageToken(nextPageToken).build();
334    *     } else {
335    *       break;
336    *     }
337    *   }
338    * }
339    * }</pre>
340    */
listIntentsCallable()341   public final UnaryCallable<ListIntentsRequest, ListIntentsResponse> listIntentsCallable() {
342     return stub.listIntentsCallable();
343   }
344 
345   // AUTO-GENERATED DOCUMENTATION AND METHOD.
346   /**
347    * Retrieves the specified intent.
348    *
349    * <p>Sample code:
350    *
351    * <pre>{@code
352    * // This snippet has been automatically generated and should be regarded as a code template only.
353    * // It will require modifications to work:
354    * // - It may require correct/in-range values for request initialization.
355    * // - It may require specifying regional endpoints when creating the service client as shown in
356    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
357    * try (IntentsClient intentsClient = IntentsClient.create()) {
358    *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
359    *   Intent response = intentsClient.getIntent(name);
360    * }
361    * }</pre>
362    *
363    * @param name Required. The name of the intent. Format: `projects/&lt;Project
364    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/intents/&lt;Intent ID&gt;`.
365    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
366    */
getIntent(IntentName name)367   public final Intent getIntent(IntentName name) {
368     GetIntentRequest request =
369         GetIntentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
370     return getIntent(request);
371   }
372 
373   // AUTO-GENERATED DOCUMENTATION AND METHOD.
374   /**
375    * Retrieves the specified intent.
376    *
377    * <p>Sample code:
378    *
379    * <pre>{@code
380    * // This snippet has been automatically generated and should be regarded as a code template only.
381    * // It will require modifications to work:
382    * // - It may require correct/in-range values for request initialization.
383    * // - It may require specifying regional endpoints when creating the service client as shown in
384    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
385    * try (IntentsClient intentsClient = IntentsClient.create()) {
386    *   String name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString();
387    *   Intent response = intentsClient.getIntent(name);
388    * }
389    * }</pre>
390    *
391    * @param name Required. The name of the intent. Format: `projects/&lt;Project
392    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/intents/&lt;Intent ID&gt;`.
393    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
394    */
getIntent(String name)395   public final Intent getIntent(String name) {
396     GetIntentRequest request = GetIntentRequest.newBuilder().setName(name).build();
397     return getIntent(request);
398   }
399 
400   // AUTO-GENERATED DOCUMENTATION AND METHOD.
401   /**
402    * Retrieves the specified intent.
403    *
404    * <p>Sample code:
405    *
406    * <pre>{@code
407    * // This snippet has been automatically generated and should be regarded as a code template only.
408    * // It will require modifications to work:
409    * // - It may require correct/in-range values for request initialization.
410    * // - It may require specifying regional endpoints when creating the service client as shown in
411    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
412    * try (IntentsClient intentsClient = IntentsClient.create()) {
413    *   GetIntentRequest request =
414    *       GetIntentRequest.newBuilder()
415    *           .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString())
416    *           .setLanguageCode("languageCode-2092349083")
417    *           .build();
418    *   Intent response = intentsClient.getIntent(request);
419    * }
420    * }</pre>
421    *
422    * @param request The request object containing all of the parameters for the API call.
423    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
424    */
getIntent(GetIntentRequest request)425   public final Intent getIntent(GetIntentRequest request) {
426     return getIntentCallable().call(request);
427   }
428 
429   // AUTO-GENERATED DOCUMENTATION AND METHOD.
430   /**
431    * Retrieves the specified intent.
432    *
433    * <p>Sample code:
434    *
435    * <pre>{@code
436    * // This snippet has been automatically generated and should be regarded as a code template only.
437    * // It will require modifications to work:
438    * // - It may require correct/in-range values for request initialization.
439    * // - It may require specifying regional endpoints when creating the service client as shown in
440    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
441    * try (IntentsClient intentsClient = IntentsClient.create()) {
442    *   GetIntentRequest request =
443    *       GetIntentRequest.newBuilder()
444    *           .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString())
445    *           .setLanguageCode("languageCode-2092349083")
446    *           .build();
447    *   ApiFuture<Intent> future = intentsClient.getIntentCallable().futureCall(request);
448    *   // Do something.
449    *   Intent response = future.get();
450    * }
451    * }</pre>
452    */
getIntentCallable()453   public final UnaryCallable<GetIntentRequest, Intent> getIntentCallable() {
454     return stub.getIntentCallable();
455   }
456 
457   // AUTO-GENERATED DOCUMENTATION AND METHOD.
458   /**
459    * Creates an intent in the specified agent.
460    *
461    * <p>Note: You should always train a flow prior to sending it queries. See the [training
462    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
463    *
464    * <p>Sample code:
465    *
466    * <pre>{@code
467    * // This snippet has been automatically generated and should be regarded as a code template only.
468    * // It will require modifications to work:
469    * // - It may require correct/in-range values for request initialization.
470    * // - It may require specifying regional endpoints when creating the service client as shown in
471    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
472    * try (IntentsClient intentsClient = IntentsClient.create()) {
473    *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
474    *   Intent intent = Intent.newBuilder().build();
475    *   Intent response = intentsClient.createIntent(parent, intent);
476    * }
477    * }</pre>
478    *
479    * @param parent Required. The agent to create an intent for. Format: `projects/&lt;Project
480    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;`.
481    * @param intent Required. The intent to create.
482    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
483    */
createIntent(AgentName parent, Intent intent)484   public final Intent createIntent(AgentName parent, Intent intent) {
485     CreateIntentRequest request =
486         CreateIntentRequest.newBuilder()
487             .setParent(parent == null ? null : parent.toString())
488             .setIntent(intent)
489             .build();
490     return createIntent(request);
491   }
492 
493   // AUTO-GENERATED DOCUMENTATION AND METHOD.
494   /**
495    * Creates an intent in the specified agent.
496    *
497    * <p>Note: You should always train a flow prior to sending it queries. See the [training
498    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
499    *
500    * <p>Sample code:
501    *
502    * <pre>{@code
503    * // This snippet has been automatically generated and should be regarded as a code template only.
504    * // It will require modifications to work:
505    * // - It may require correct/in-range values for request initialization.
506    * // - It may require specifying regional endpoints when creating the service client as shown in
507    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
508    * try (IntentsClient intentsClient = IntentsClient.create()) {
509    *   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
510    *   Intent intent = Intent.newBuilder().build();
511    *   Intent response = intentsClient.createIntent(parent, intent);
512    * }
513    * }</pre>
514    *
515    * @param parent Required. The agent to create an intent for. Format: `projects/&lt;Project
516    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;`.
517    * @param intent Required. The intent to create.
518    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
519    */
createIntent(String parent, Intent intent)520   public final Intent createIntent(String parent, Intent intent) {
521     CreateIntentRequest request =
522         CreateIntentRequest.newBuilder().setParent(parent).setIntent(intent).build();
523     return createIntent(request);
524   }
525 
526   // AUTO-GENERATED DOCUMENTATION AND METHOD.
527   /**
528    * Creates an intent in the specified agent.
529    *
530    * <p>Note: You should always train a flow prior to sending it queries. See the [training
531    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
532    *
533    * <p>Sample code:
534    *
535    * <pre>{@code
536    * // This snippet has been automatically generated and should be regarded as a code template only.
537    * // It will require modifications to work:
538    * // - It may require correct/in-range values for request initialization.
539    * // - It may require specifying regional endpoints when creating the service client as shown in
540    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
541    * try (IntentsClient intentsClient = IntentsClient.create()) {
542    *   CreateIntentRequest request =
543    *       CreateIntentRequest.newBuilder()
544    *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
545    *           .setIntent(Intent.newBuilder().build())
546    *           .setLanguageCode("languageCode-2092349083")
547    *           .build();
548    *   Intent response = intentsClient.createIntent(request);
549    * }
550    * }</pre>
551    *
552    * @param request The request object containing all of the parameters for the API call.
553    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
554    */
createIntent(CreateIntentRequest request)555   public final Intent createIntent(CreateIntentRequest request) {
556     return createIntentCallable().call(request);
557   }
558 
559   // AUTO-GENERATED DOCUMENTATION AND METHOD.
560   /**
561    * Creates an intent in the specified agent.
562    *
563    * <p>Note: You should always train a flow prior to sending it queries. See the [training
564    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
565    *
566    * <p>Sample code:
567    *
568    * <pre>{@code
569    * // This snippet has been automatically generated and should be regarded as a code template only.
570    * // It will require modifications to work:
571    * // - It may require correct/in-range values for request initialization.
572    * // - It may require specifying regional endpoints when creating the service client as shown in
573    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
574    * try (IntentsClient intentsClient = IntentsClient.create()) {
575    *   CreateIntentRequest request =
576    *       CreateIntentRequest.newBuilder()
577    *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
578    *           .setIntent(Intent.newBuilder().build())
579    *           .setLanguageCode("languageCode-2092349083")
580    *           .build();
581    *   ApiFuture<Intent> future = intentsClient.createIntentCallable().futureCall(request);
582    *   // Do something.
583    *   Intent response = future.get();
584    * }
585    * }</pre>
586    */
createIntentCallable()587   public final UnaryCallable<CreateIntentRequest, Intent> createIntentCallable() {
588     return stub.createIntentCallable();
589   }
590 
591   // AUTO-GENERATED DOCUMENTATION AND METHOD.
592   /**
593    * Updates the specified intent.
594    *
595    * <p>Note: You should always train a flow prior to sending it queries. See the [training
596    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
597    *
598    * <p>Sample code:
599    *
600    * <pre>{@code
601    * // This snippet has been automatically generated and should be regarded as a code template only.
602    * // It will require modifications to work:
603    * // - It may require correct/in-range values for request initialization.
604    * // - It may require specifying regional endpoints when creating the service client as shown in
605    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
606    * try (IntentsClient intentsClient = IntentsClient.create()) {
607    *   Intent intent = Intent.newBuilder().build();
608    *   FieldMask updateMask = FieldMask.newBuilder().build();
609    *   Intent response = intentsClient.updateIntent(intent, updateMask);
610    * }
611    * }</pre>
612    *
613    * @param intent Required. The intent to update.
614    * @param updateMask The mask to control which fields get updated. If the mask is not present, all
615    *     fields will be updated.
616    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
617    */
updateIntent(Intent intent, FieldMask updateMask)618   public final Intent updateIntent(Intent intent, FieldMask updateMask) {
619     UpdateIntentRequest request =
620         UpdateIntentRequest.newBuilder().setIntent(intent).setUpdateMask(updateMask).build();
621     return updateIntent(request);
622   }
623 
624   // AUTO-GENERATED DOCUMENTATION AND METHOD.
625   /**
626    * Updates the specified intent.
627    *
628    * <p>Note: You should always train a flow prior to sending it queries. See the [training
629    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
630    *
631    * <p>Sample code:
632    *
633    * <pre>{@code
634    * // This snippet has been automatically generated and should be regarded as a code template only.
635    * // It will require modifications to work:
636    * // - It may require correct/in-range values for request initialization.
637    * // - It may require specifying regional endpoints when creating the service client as shown in
638    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
639    * try (IntentsClient intentsClient = IntentsClient.create()) {
640    *   UpdateIntentRequest request =
641    *       UpdateIntentRequest.newBuilder()
642    *           .setIntent(Intent.newBuilder().build())
643    *           .setLanguageCode("languageCode-2092349083")
644    *           .setUpdateMask(FieldMask.newBuilder().build())
645    *           .build();
646    *   Intent response = intentsClient.updateIntent(request);
647    * }
648    * }</pre>
649    *
650    * @param request The request object containing all of the parameters for the API call.
651    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
652    */
updateIntent(UpdateIntentRequest request)653   public final Intent updateIntent(UpdateIntentRequest request) {
654     return updateIntentCallable().call(request);
655   }
656 
657   // AUTO-GENERATED DOCUMENTATION AND METHOD.
658   /**
659    * Updates the specified intent.
660    *
661    * <p>Note: You should always train a flow prior to sending it queries. See the [training
662    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
663    *
664    * <p>Sample code:
665    *
666    * <pre>{@code
667    * // This snippet has been automatically generated and should be regarded as a code template only.
668    * // It will require modifications to work:
669    * // - It may require correct/in-range values for request initialization.
670    * // - It may require specifying regional endpoints when creating the service client as shown in
671    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
672    * try (IntentsClient intentsClient = IntentsClient.create()) {
673    *   UpdateIntentRequest request =
674    *       UpdateIntentRequest.newBuilder()
675    *           .setIntent(Intent.newBuilder().build())
676    *           .setLanguageCode("languageCode-2092349083")
677    *           .setUpdateMask(FieldMask.newBuilder().build())
678    *           .build();
679    *   ApiFuture<Intent> future = intentsClient.updateIntentCallable().futureCall(request);
680    *   // Do something.
681    *   Intent response = future.get();
682    * }
683    * }</pre>
684    */
updateIntentCallable()685   public final UnaryCallable<UpdateIntentRequest, Intent> updateIntentCallable() {
686     return stub.updateIntentCallable();
687   }
688 
689   // AUTO-GENERATED DOCUMENTATION AND METHOD.
690   /**
691    * Deletes the specified intent.
692    *
693    * <p>Note: You should always train a flow prior to sending it queries. See the [training
694    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
695    *
696    * <p>Sample code:
697    *
698    * <pre>{@code
699    * // This snippet has been automatically generated and should be regarded as a code template only.
700    * // It will require modifications to work:
701    * // - It may require correct/in-range values for request initialization.
702    * // - It may require specifying regional endpoints when creating the service client as shown in
703    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
704    * try (IntentsClient intentsClient = IntentsClient.create()) {
705    *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
706    *   intentsClient.deleteIntent(name);
707    * }
708    * }</pre>
709    *
710    * @param name Required. The name of the intent to delete. Format: `projects/&lt;Project
711    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/intents/&lt;Intent ID&gt;`.
712    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
713    */
deleteIntent(IntentName name)714   public final void deleteIntent(IntentName name) {
715     DeleteIntentRequest request =
716         DeleteIntentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
717     deleteIntent(request);
718   }
719 
720   // AUTO-GENERATED DOCUMENTATION AND METHOD.
721   /**
722    * Deletes the specified intent.
723    *
724    * <p>Note: You should always train a flow prior to sending it queries. See the [training
725    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
726    *
727    * <p>Sample code:
728    *
729    * <pre>{@code
730    * // This snippet has been automatically generated and should be regarded as a code template only.
731    * // It will require modifications to work:
732    * // - It may require correct/in-range values for request initialization.
733    * // - It may require specifying regional endpoints when creating the service client as shown in
734    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
735    * try (IntentsClient intentsClient = IntentsClient.create()) {
736    *   String name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString();
737    *   intentsClient.deleteIntent(name);
738    * }
739    * }</pre>
740    *
741    * @param name Required. The name of the intent to delete. Format: `projects/&lt;Project
742    *     ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/intents/&lt;Intent ID&gt;`.
743    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
744    */
deleteIntent(String name)745   public final void deleteIntent(String name) {
746     DeleteIntentRequest request = DeleteIntentRequest.newBuilder().setName(name).build();
747     deleteIntent(request);
748   }
749 
750   // AUTO-GENERATED DOCUMENTATION AND METHOD.
751   /**
752    * Deletes the specified intent.
753    *
754    * <p>Note: You should always train a flow prior to sending it queries. See the [training
755    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
756    *
757    * <p>Sample code:
758    *
759    * <pre>{@code
760    * // This snippet has been automatically generated and should be regarded as a code template only.
761    * // It will require modifications to work:
762    * // - It may require correct/in-range values for request initialization.
763    * // - It may require specifying regional endpoints when creating the service client as shown in
764    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
765    * try (IntentsClient intentsClient = IntentsClient.create()) {
766    *   DeleteIntentRequest request =
767    *       DeleteIntentRequest.newBuilder()
768    *           .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString())
769    *           .build();
770    *   intentsClient.deleteIntent(request);
771    * }
772    * }</pre>
773    *
774    * @param request The request object containing all of the parameters for the API call.
775    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
776    */
deleteIntent(DeleteIntentRequest request)777   public final void deleteIntent(DeleteIntentRequest request) {
778     deleteIntentCallable().call(request);
779   }
780 
781   // AUTO-GENERATED DOCUMENTATION AND METHOD.
782   /**
783    * Deletes the specified intent.
784    *
785    * <p>Note: You should always train a flow prior to sending it queries. See the [training
786    * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
787    *
788    * <p>Sample code:
789    *
790    * <pre>{@code
791    * // This snippet has been automatically generated and should be regarded as a code template only.
792    * // It will require modifications to work:
793    * // - It may require correct/in-range values for request initialization.
794    * // - It may require specifying regional endpoints when creating the service client as shown in
795    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
796    * try (IntentsClient intentsClient = IntentsClient.create()) {
797    *   DeleteIntentRequest request =
798    *       DeleteIntentRequest.newBuilder()
799    *           .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString())
800    *           .build();
801    *   ApiFuture<Empty> future = intentsClient.deleteIntentCallable().futureCall(request);
802    *   // Do something.
803    *   future.get();
804    * }
805    * }</pre>
806    */
deleteIntentCallable()807   public final UnaryCallable<DeleteIntentRequest, Empty> deleteIntentCallable() {
808     return stub.deleteIntentCallable();
809   }
810 
811   // AUTO-GENERATED DOCUMENTATION AND METHOD.
812   /**
813    * Lists information about the supported locations for this service.
814    *
815    * <p>Sample code:
816    *
817    * <pre>{@code
818    * // This snippet has been automatically generated and should be regarded as a code template only.
819    * // It will require modifications to work:
820    * // - It may require correct/in-range values for request initialization.
821    * // - It may require specifying regional endpoints when creating the service client as shown in
822    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
823    * try (IntentsClient intentsClient = IntentsClient.create()) {
824    *   ListLocationsRequest request =
825    *       ListLocationsRequest.newBuilder()
826    *           .setName("name3373707")
827    *           .setFilter("filter-1274492040")
828    *           .setPageSize(883849137)
829    *           .setPageToken("pageToken873572522")
830    *           .build();
831    *   for (Location element : intentsClient.listLocations(request).iterateAll()) {
832    *     // doThingsWith(element);
833    *   }
834    * }
835    * }</pre>
836    *
837    * @param request The request object containing all of the parameters for the API call.
838    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
839    */
listLocations(ListLocationsRequest request)840   public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
841     return listLocationsPagedCallable().call(request);
842   }
843 
844   // AUTO-GENERATED DOCUMENTATION AND METHOD.
845   /**
846    * Lists information about the supported locations for this service.
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 (IntentsClient intentsClient = IntentsClient.create()) {
857    *   ListLocationsRequest request =
858    *       ListLocationsRequest.newBuilder()
859    *           .setName("name3373707")
860    *           .setFilter("filter-1274492040")
861    *           .setPageSize(883849137)
862    *           .setPageToken("pageToken873572522")
863    *           .build();
864    *   ApiFuture<Location> future = intentsClient.listLocationsPagedCallable().futureCall(request);
865    *   // Do something.
866    *   for (Location element : future.get().iterateAll()) {
867    *     // doThingsWith(element);
868    *   }
869    * }
870    * }</pre>
871    */
872   public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable()873       listLocationsPagedCallable() {
874     return stub.listLocationsPagedCallable();
875   }
876 
877   // AUTO-GENERATED DOCUMENTATION AND METHOD.
878   /**
879    * Lists information about the supported locations for this service.
880    *
881    * <p>Sample code:
882    *
883    * <pre>{@code
884    * // This snippet has been automatically generated and should be regarded as a code template only.
885    * // It will require modifications to work:
886    * // - It may require correct/in-range values for request initialization.
887    * // - It may require specifying regional endpoints when creating the service client as shown in
888    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
889    * try (IntentsClient intentsClient = IntentsClient.create()) {
890    *   ListLocationsRequest request =
891    *       ListLocationsRequest.newBuilder()
892    *           .setName("name3373707")
893    *           .setFilter("filter-1274492040")
894    *           .setPageSize(883849137)
895    *           .setPageToken("pageToken873572522")
896    *           .build();
897    *   while (true) {
898    *     ListLocationsResponse response = intentsClient.listLocationsCallable().call(request);
899    *     for (Location element : response.getLocationsList()) {
900    *       // doThingsWith(element);
901    *     }
902    *     String nextPageToken = response.getNextPageToken();
903    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
904    *       request = request.toBuilder().setPageToken(nextPageToken).build();
905    *     } else {
906    *       break;
907    *     }
908    *   }
909    * }
910    * }</pre>
911    */
listLocationsCallable()912   public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
913     return stub.listLocationsCallable();
914   }
915 
916   // AUTO-GENERATED DOCUMENTATION AND METHOD.
917   /**
918    * Gets information about a location.
919    *
920    * <p>Sample code:
921    *
922    * <pre>{@code
923    * // This snippet has been automatically generated and should be regarded as a code template only.
924    * // It will require modifications to work:
925    * // - It may require correct/in-range values for request initialization.
926    * // - It may require specifying regional endpoints when creating the service client as shown in
927    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
928    * try (IntentsClient intentsClient = IntentsClient.create()) {
929    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
930    *   Location response = intentsClient.getLocation(request);
931    * }
932    * }</pre>
933    *
934    * @param request The request object containing all of the parameters for the API call.
935    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
936    */
getLocation(GetLocationRequest request)937   public final Location getLocation(GetLocationRequest request) {
938     return getLocationCallable().call(request);
939   }
940 
941   // AUTO-GENERATED DOCUMENTATION AND METHOD.
942   /**
943    * Gets information about a location.
944    *
945    * <p>Sample code:
946    *
947    * <pre>{@code
948    * // This snippet has been automatically generated and should be regarded as a code template only.
949    * // It will require modifications to work:
950    * // - It may require correct/in-range values for request initialization.
951    * // - It may require specifying regional endpoints when creating the service client as shown in
952    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
953    * try (IntentsClient intentsClient = IntentsClient.create()) {
954    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
955    *   ApiFuture<Location> future = intentsClient.getLocationCallable().futureCall(request);
956    *   // Do something.
957    *   Location response = future.get();
958    * }
959    * }</pre>
960    */
getLocationCallable()961   public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
962     return stub.getLocationCallable();
963   }
964 
965   @Override
close()966   public final void close() {
967     stub.close();
968   }
969 
970   @Override
shutdown()971   public void shutdown() {
972     stub.shutdown();
973   }
974 
975   @Override
isShutdown()976   public boolean isShutdown() {
977     return stub.isShutdown();
978   }
979 
980   @Override
isTerminated()981   public boolean isTerminated() {
982     return stub.isTerminated();
983   }
984 
985   @Override
shutdownNow()986   public void shutdownNow() {
987     stub.shutdownNow();
988   }
989 
990   @Override
awaitTermination(long duration, TimeUnit unit)991   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
992     return stub.awaitTermination(duration, unit);
993   }
994 
995   public static class ListIntentsPagedResponse
996       extends AbstractPagedListResponse<
997           ListIntentsRequest,
998           ListIntentsResponse,
999           Intent,
1000           ListIntentsPage,
1001           ListIntentsFixedSizeCollection> {
1002 
createAsync( PageContext<ListIntentsRequest, ListIntentsResponse, Intent> context, ApiFuture<ListIntentsResponse> futureResponse)1003     public static ApiFuture<ListIntentsPagedResponse> createAsync(
1004         PageContext<ListIntentsRequest, ListIntentsResponse, Intent> context,
1005         ApiFuture<ListIntentsResponse> futureResponse) {
1006       ApiFuture<ListIntentsPage> futurePage =
1007           ListIntentsPage.createEmptyPage().createPageAsync(context, futureResponse);
1008       return ApiFutures.transform(
1009           futurePage, input -> new ListIntentsPagedResponse(input), MoreExecutors.directExecutor());
1010     }
1011 
ListIntentsPagedResponse(ListIntentsPage page)1012     private ListIntentsPagedResponse(ListIntentsPage page) {
1013       super(page, ListIntentsFixedSizeCollection.createEmptyCollection());
1014     }
1015   }
1016 
1017   public static class ListIntentsPage
1018       extends AbstractPage<ListIntentsRequest, ListIntentsResponse, Intent, ListIntentsPage> {
1019 
ListIntentsPage( PageContext<ListIntentsRequest, ListIntentsResponse, Intent> context, ListIntentsResponse response)1020     private ListIntentsPage(
1021         PageContext<ListIntentsRequest, ListIntentsResponse, Intent> context,
1022         ListIntentsResponse response) {
1023       super(context, response);
1024     }
1025 
createEmptyPage()1026     private static ListIntentsPage createEmptyPage() {
1027       return new ListIntentsPage(null, null);
1028     }
1029 
1030     @Override
createPage( PageContext<ListIntentsRequest, ListIntentsResponse, Intent> context, ListIntentsResponse response)1031     protected ListIntentsPage createPage(
1032         PageContext<ListIntentsRequest, ListIntentsResponse, Intent> context,
1033         ListIntentsResponse response) {
1034       return new ListIntentsPage(context, response);
1035     }
1036 
1037     @Override
createPageAsync( PageContext<ListIntentsRequest, ListIntentsResponse, Intent> context, ApiFuture<ListIntentsResponse> futureResponse)1038     public ApiFuture<ListIntentsPage> createPageAsync(
1039         PageContext<ListIntentsRequest, ListIntentsResponse, Intent> context,
1040         ApiFuture<ListIntentsResponse> futureResponse) {
1041       return super.createPageAsync(context, futureResponse);
1042     }
1043   }
1044 
1045   public static class ListIntentsFixedSizeCollection
1046       extends AbstractFixedSizeCollection<
1047           ListIntentsRequest,
1048           ListIntentsResponse,
1049           Intent,
1050           ListIntentsPage,
1051           ListIntentsFixedSizeCollection> {
1052 
ListIntentsFixedSizeCollection(List<ListIntentsPage> pages, int collectionSize)1053     private ListIntentsFixedSizeCollection(List<ListIntentsPage> pages, int collectionSize) {
1054       super(pages, collectionSize);
1055     }
1056 
createEmptyCollection()1057     private static ListIntentsFixedSizeCollection createEmptyCollection() {
1058       return new ListIntentsFixedSizeCollection(null, 0);
1059     }
1060 
1061     @Override
createCollection( List<ListIntentsPage> pages, int collectionSize)1062     protected ListIntentsFixedSizeCollection createCollection(
1063         List<ListIntentsPage> pages, int collectionSize) {
1064       return new ListIntentsFixedSizeCollection(pages, collectionSize);
1065     }
1066   }
1067 
1068   public static class ListLocationsPagedResponse
1069       extends AbstractPagedListResponse<
1070           ListLocationsRequest,
1071           ListLocationsResponse,
1072           Location,
1073           ListLocationsPage,
1074           ListLocationsFixedSizeCollection> {
1075 
createAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1076     public static ApiFuture<ListLocationsPagedResponse> createAsync(
1077         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1078         ApiFuture<ListLocationsResponse> futureResponse) {
1079       ApiFuture<ListLocationsPage> futurePage =
1080           ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
1081       return ApiFutures.transform(
1082           futurePage,
1083           input -> new ListLocationsPagedResponse(input),
1084           MoreExecutors.directExecutor());
1085     }
1086 
ListLocationsPagedResponse(ListLocationsPage page)1087     private ListLocationsPagedResponse(ListLocationsPage page) {
1088       super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
1089     }
1090   }
1091 
1092   public static class ListLocationsPage
1093       extends AbstractPage<
1094           ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
1095 
ListLocationsPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1096     private ListLocationsPage(
1097         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1098         ListLocationsResponse response) {
1099       super(context, response);
1100     }
1101 
createEmptyPage()1102     private static ListLocationsPage createEmptyPage() {
1103       return new ListLocationsPage(null, null);
1104     }
1105 
1106     @Override
createPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1107     protected ListLocationsPage createPage(
1108         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1109         ListLocationsResponse response) {
1110       return new ListLocationsPage(context, response);
1111     }
1112 
1113     @Override
createPageAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1114     public ApiFuture<ListLocationsPage> createPageAsync(
1115         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1116         ApiFuture<ListLocationsResponse> futureResponse) {
1117       return super.createPageAsync(context, futureResponse);
1118     }
1119   }
1120 
1121   public static class ListLocationsFixedSizeCollection
1122       extends AbstractFixedSizeCollection<
1123           ListLocationsRequest,
1124           ListLocationsResponse,
1125           Location,
1126           ListLocationsPage,
1127           ListLocationsFixedSizeCollection> {
1128 
ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize)1129     private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) {
1130       super(pages, collectionSize);
1131     }
1132 
createEmptyCollection()1133     private static ListLocationsFixedSizeCollection createEmptyCollection() {
1134       return new ListLocationsFixedSizeCollection(null, 0);
1135     }
1136 
1137     @Override
createCollection( List<ListLocationsPage> pages, int collectionSize)1138     protected ListLocationsFixedSizeCollection createCollection(
1139         List<ListLocationsPage> pages, int collectionSize) {
1140       return new ListLocationsFixedSizeCollection(pages, collectionSize);
1141     }
1142   }
1143 }
1144