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