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