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