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.talent.v4; 18 19 import com.google.api.core.ApiFuture; 20 import com.google.api.core.ApiFutures; 21 import com.google.api.core.BetaApi; 22 import com.google.api.gax.core.BackgroundResource; 23 import com.google.api.gax.httpjson.longrunning.OperationsClient; 24 import com.google.api.gax.longrunning.OperationFuture; 25 import com.google.api.gax.paging.AbstractFixedSizeCollection; 26 import com.google.api.gax.paging.AbstractPage; 27 import com.google.api.gax.paging.AbstractPagedListResponse; 28 import com.google.api.gax.rpc.OperationCallable; 29 import com.google.api.gax.rpc.PageContext; 30 import com.google.api.gax.rpc.UnaryCallable; 31 import com.google.cloud.talent.v4.stub.JobServiceStub; 32 import com.google.cloud.talent.v4.stub.JobServiceStubSettings; 33 import com.google.common.util.concurrent.MoreExecutors; 34 import com.google.longrunning.Operation; 35 import com.google.protobuf.Empty; 36 import com.google.protobuf.FieldMask; 37 import java.io.IOException; 38 import java.util.List; 39 import java.util.concurrent.TimeUnit; 40 import javax.annotation.Generated; 41 42 // AUTO-GENERATED DOCUMENTATION AND CLASS. 43 /** 44 * Service Description: A service handles job management, including job CRUD, enumeration and 45 * search. 46 * 47 * <p>This class provides the ability to make remote calls to the backing service through method 48 * calls that map to API methods. Sample code to get started: 49 * 50 * <pre>{@code 51 * // This snippet has been automatically generated and should be regarded as a code template only. 52 * // It will require modifications to work: 53 * // - It may require correct/in-range values for request initialization. 54 * // - It may require specifying regional endpoints when creating the service client as shown in 55 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 56 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 57 * TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); 58 * Job job = Job.newBuilder().build(); 59 * Job response = jobServiceClient.createJob(parent, job); 60 * } 61 * }</pre> 62 * 63 * <p>Note: close() needs to be called on the JobServiceClient object to clean up resources such as 64 * threads. In the example above, try-with-resources is used, which automatically calls close(). 65 * 66 * <p>The surface of this class includes several types of Java methods for each of the API's 67 * methods: 68 * 69 * <ol> 70 * <li>A "flattened" method. With this type of method, the fields of the request type have been 71 * converted into function parameters. It may be the case that not all fields are available as 72 * parameters, and not every API method will have a flattened method entry point. 73 * <li>A "request object" method. This type of method only takes one parameter, a request object, 74 * which must be constructed before the call. Not every API method will have a request object 75 * method. 76 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 77 * callable object, which can be used to initiate calls to the service. 78 * </ol> 79 * 80 * <p>See the individual methods for example code. 81 * 82 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 83 * these names, this class includes a format method for each type of name, and additionally a parse 84 * method to extract the individual identifiers contained within names that are returned. 85 * 86 * <p>This class can be customized by passing in a custom instance of JobServiceSettings to 87 * create(). For example: 88 * 89 * <p>To customize credentials: 90 * 91 * <pre>{@code 92 * // This snippet has been automatically generated and should be regarded as a code template only. 93 * // It will require modifications to work: 94 * // - It may require correct/in-range values for request initialization. 95 * // - It may require specifying regional endpoints when creating the service client as shown in 96 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 97 * JobServiceSettings jobServiceSettings = 98 * JobServiceSettings.newBuilder() 99 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 100 * .build(); 101 * JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings); 102 * }</pre> 103 * 104 * <p>To customize the endpoint: 105 * 106 * <pre>{@code 107 * // This snippet has been automatically generated and should be regarded as a code template only. 108 * // It will require modifications to work: 109 * // - It may require correct/in-range values for request initialization. 110 * // - It may require specifying regional endpoints when creating the service client as shown in 111 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 112 * JobServiceSettings jobServiceSettings = 113 * JobServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); 114 * JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings); 115 * }</pre> 116 * 117 * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over 118 * the wire: 119 * 120 * <pre>{@code 121 * // This snippet has been automatically generated and should be regarded as a code template only. 122 * // It will require modifications to work: 123 * // - It may require correct/in-range values for request initialization. 124 * // - It may require specifying regional endpoints when creating the service client as shown in 125 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 126 * JobServiceSettings jobServiceSettings = JobServiceSettings.newHttpJsonBuilder().build(); 127 * JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings); 128 * }</pre> 129 * 130 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 131 */ 132 @Generated("by gapic-generator-java") 133 public class JobServiceClient implements BackgroundResource { 134 private final JobServiceSettings settings; 135 private final JobServiceStub stub; 136 private final OperationsClient httpJsonOperationsClient; 137 private final com.google.longrunning.OperationsClient operationsClient; 138 139 /** Constructs an instance of JobServiceClient with default settings. */ create()140 public static final JobServiceClient create() throws IOException { 141 return create(JobServiceSettings.newBuilder().build()); 142 } 143 144 /** 145 * Constructs an instance of JobServiceClient, using the given settings. The channels are created 146 * based on the settings passed in, or defaults for any settings that are not set. 147 */ create(JobServiceSettings settings)148 public static final JobServiceClient create(JobServiceSettings settings) throws IOException { 149 return new JobServiceClient(settings); 150 } 151 152 /** 153 * Constructs an instance of JobServiceClient, using the given stub for making calls. This is for 154 * advanced usage - prefer using create(JobServiceSettings). 155 */ create(JobServiceStub stub)156 public static final JobServiceClient create(JobServiceStub stub) { 157 return new JobServiceClient(stub); 158 } 159 160 /** 161 * Constructs an instance of JobServiceClient, using the given settings. This is protected so that 162 * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. 163 */ JobServiceClient(JobServiceSettings settings)164 protected JobServiceClient(JobServiceSettings settings) throws IOException { 165 this.settings = settings; 166 this.stub = ((JobServiceStubSettings) settings.getStubSettings()).createStub(); 167 this.operationsClient = 168 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 169 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 170 } 171 JobServiceClient(JobServiceStub stub)172 protected JobServiceClient(JobServiceStub stub) { 173 this.settings = null; 174 this.stub = stub; 175 this.operationsClient = 176 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 177 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 178 } 179 getSettings()180 public final JobServiceSettings getSettings() { 181 return settings; 182 } 183 getStub()184 public JobServiceStub getStub() { 185 return stub; 186 } 187 188 /** 189 * Returns the OperationsClient that can be used to query the status of a long-running operation 190 * returned by another API method call. 191 */ getOperationsClient()192 public final com.google.longrunning.OperationsClient getOperationsClient() { 193 return operationsClient; 194 } 195 196 /** 197 * Returns the OperationsClient that can be used to query the status of a long-running operation 198 * returned by another API method call. 199 */ 200 @BetaApi getHttpJsonOperationsClient()201 public final OperationsClient getHttpJsonOperationsClient() { 202 return httpJsonOperationsClient; 203 } 204 205 // AUTO-GENERATED DOCUMENTATION AND METHOD. 206 /** 207 * Creates a new job. 208 * 209 * <p>Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes. 210 * 211 * <p>Sample code: 212 * 213 * <pre>{@code 214 * // This snippet has been automatically generated and should be regarded as a code template only. 215 * // It will require modifications to work: 216 * // - It may require correct/in-range values for request initialization. 217 * // - It may require specifying regional endpoints when creating the service client as shown in 218 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 219 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 220 * TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); 221 * Job job = Job.newBuilder().build(); 222 * Job response = jobServiceClient.createJob(parent, job); 223 * } 224 * }</pre> 225 * 226 * @param parent Required. The resource name of the tenant under which the job is created. 227 * <p>The format is "projects/{project_id}/tenants/{tenant_id}". For example, 228 * "projects/foo/tenants/bar". 229 * @param job Required. The Job to be created. 230 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 231 */ createJob(TenantName parent, Job job)232 public final Job createJob(TenantName parent, Job job) { 233 CreateJobRequest request = 234 CreateJobRequest.newBuilder() 235 .setParent(parent == null ? null : parent.toString()) 236 .setJob(job) 237 .build(); 238 return createJob(request); 239 } 240 241 // AUTO-GENERATED DOCUMENTATION AND METHOD. 242 /** 243 * Creates a new job. 244 * 245 * <p>Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes. 246 * 247 * <p>Sample code: 248 * 249 * <pre>{@code 250 * // This snippet has been automatically generated and should be regarded as a code template only. 251 * // It will require modifications to work: 252 * // - It may require correct/in-range values for request initialization. 253 * // - It may require specifying regional endpoints when creating the service client as shown in 254 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 255 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 256 * String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); 257 * Job job = Job.newBuilder().build(); 258 * Job response = jobServiceClient.createJob(parent, job); 259 * } 260 * }</pre> 261 * 262 * @param parent Required. The resource name of the tenant under which the job is created. 263 * <p>The format is "projects/{project_id}/tenants/{tenant_id}". For example, 264 * "projects/foo/tenants/bar". 265 * @param job Required. The Job to be created. 266 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 267 */ createJob(String parent, Job job)268 public final Job createJob(String parent, Job job) { 269 CreateJobRequest request = CreateJobRequest.newBuilder().setParent(parent).setJob(job).build(); 270 return createJob(request); 271 } 272 273 // AUTO-GENERATED DOCUMENTATION AND METHOD. 274 /** 275 * Creates a new job. 276 * 277 * <p>Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes. 278 * 279 * <p>Sample code: 280 * 281 * <pre>{@code 282 * // This snippet has been automatically generated and should be regarded as a code template only. 283 * // It will require modifications to work: 284 * // - It may require correct/in-range values for request initialization. 285 * // - It may require specifying regional endpoints when creating the service client as shown in 286 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 287 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 288 * CreateJobRequest request = 289 * CreateJobRequest.newBuilder() 290 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 291 * .setJob(Job.newBuilder().build()) 292 * .build(); 293 * Job response = jobServiceClient.createJob(request); 294 * } 295 * }</pre> 296 * 297 * @param request The request object containing all of the parameters for the API call. 298 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 299 */ createJob(CreateJobRequest request)300 public final Job createJob(CreateJobRequest request) { 301 return createJobCallable().call(request); 302 } 303 304 // AUTO-GENERATED DOCUMENTATION AND METHOD. 305 /** 306 * Creates a new job. 307 * 308 * <p>Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes. 309 * 310 * <p>Sample code: 311 * 312 * <pre>{@code 313 * // This snippet has been automatically generated and should be regarded as a code template only. 314 * // It will require modifications to work: 315 * // - It may require correct/in-range values for request initialization. 316 * // - It may require specifying regional endpoints when creating the service client as shown in 317 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 318 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 319 * CreateJobRequest request = 320 * CreateJobRequest.newBuilder() 321 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 322 * .setJob(Job.newBuilder().build()) 323 * .build(); 324 * ApiFuture<Job> future = jobServiceClient.createJobCallable().futureCall(request); 325 * // Do something. 326 * Job response = future.get(); 327 * } 328 * }</pre> 329 */ createJobCallable()330 public final UnaryCallable<CreateJobRequest, Job> createJobCallable() { 331 return stub.createJobCallable(); 332 } 333 334 // AUTO-GENERATED DOCUMENTATION AND METHOD. 335 /** 336 * Begins executing a batch create jobs operation. 337 * 338 * <p>Sample code: 339 * 340 * <pre>{@code 341 * // This snippet has been automatically generated and should be regarded as a code template only. 342 * // It will require modifications to work: 343 * // - It may require correct/in-range values for request initialization. 344 * // - It may require specifying regional endpoints when creating the service client as shown in 345 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 346 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 347 * TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); 348 * List<Job> jobs = new ArrayList<>(); 349 * BatchCreateJobsResponse response = jobServiceClient.batchCreateJobsAsync(parent, jobs).get(); 350 * } 351 * }</pre> 352 * 353 * @param parent Required. The resource name of the tenant under which the job is created. 354 * <p>The format is "projects/{project_id}/tenants/{tenant_id}". For example, 355 * "projects/foo/tenants/bar". 356 * @param jobs Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. 357 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 358 */ 359 public final OperationFuture<BatchCreateJobsResponse, BatchOperationMetadata> batchCreateJobsAsync(TenantName parent, List<Job> jobs)360 batchCreateJobsAsync(TenantName parent, List<Job> jobs) { 361 BatchCreateJobsRequest request = 362 BatchCreateJobsRequest.newBuilder() 363 .setParent(parent == null ? null : parent.toString()) 364 .addAllJobs(jobs) 365 .build(); 366 return batchCreateJobsAsync(request); 367 } 368 369 // AUTO-GENERATED DOCUMENTATION AND METHOD. 370 /** 371 * Begins executing a batch create jobs operation. 372 * 373 * <p>Sample code: 374 * 375 * <pre>{@code 376 * // This snippet has been automatically generated and should be regarded as a code template only. 377 * // It will require modifications to work: 378 * // - It may require correct/in-range values for request initialization. 379 * // - It may require specifying regional endpoints when creating the service client as shown in 380 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 381 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 382 * String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); 383 * List<Job> jobs = new ArrayList<>(); 384 * BatchCreateJobsResponse response = jobServiceClient.batchCreateJobsAsync(parent, jobs).get(); 385 * } 386 * }</pre> 387 * 388 * @param parent Required. The resource name of the tenant under which the job is created. 389 * <p>The format is "projects/{project_id}/tenants/{tenant_id}". For example, 390 * "projects/foo/tenants/bar". 391 * @param jobs Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. 392 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 393 */ 394 public final OperationFuture<BatchCreateJobsResponse, BatchOperationMetadata> batchCreateJobsAsync(String parent, List<Job> jobs)395 batchCreateJobsAsync(String parent, List<Job> jobs) { 396 BatchCreateJobsRequest request = 397 BatchCreateJobsRequest.newBuilder().setParent(parent).addAllJobs(jobs).build(); 398 return batchCreateJobsAsync(request); 399 } 400 401 // AUTO-GENERATED DOCUMENTATION AND METHOD. 402 /** 403 * Begins executing a batch create jobs operation. 404 * 405 * <p>Sample code: 406 * 407 * <pre>{@code 408 * // This snippet has been automatically generated and should be regarded as a code template only. 409 * // It will require modifications to work: 410 * // - It may require correct/in-range values for request initialization. 411 * // - It may require specifying regional endpoints when creating the service client as shown in 412 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 413 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 414 * BatchCreateJobsRequest request = 415 * BatchCreateJobsRequest.newBuilder() 416 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 417 * .addAllJobs(new ArrayList<Job>()) 418 * .build(); 419 * BatchCreateJobsResponse response = jobServiceClient.batchCreateJobsAsync(request).get(); 420 * } 421 * }</pre> 422 * 423 * @param request The request object containing all of the parameters for the API call. 424 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 425 */ 426 public final OperationFuture<BatchCreateJobsResponse, BatchOperationMetadata> batchCreateJobsAsync(BatchCreateJobsRequest request)427 batchCreateJobsAsync(BatchCreateJobsRequest request) { 428 return batchCreateJobsOperationCallable().futureCall(request); 429 } 430 431 // AUTO-GENERATED DOCUMENTATION AND METHOD. 432 /** 433 * Begins executing a batch create jobs operation. 434 * 435 * <p>Sample code: 436 * 437 * <pre>{@code 438 * // This snippet has been automatically generated and should be regarded as a code template only. 439 * // It will require modifications to work: 440 * // - It may require correct/in-range values for request initialization. 441 * // - It may require specifying regional endpoints when creating the service client as shown in 442 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 443 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 444 * BatchCreateJobsRequest request = 445 * BatchCreateJobsRequest.newBuilder() 446 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 447 * .addAllJobs(new ArrayList<Job>()) 448 * .build(); 449 * OperationFuture<BatchCreateJobsResponse, BatchOperationMetadata> future = 450 * jobServiceClient.batchCreateJobsOperationCallable().futureCall(request); 451 * // Do something. 452 * BatchCreateJobsResponse response = future.get(); 453 * } 454 * }</pre> 455 */ 456 public final OperationCallable< 457 BatchCreateJobsRequest, BatchCreateJobsResponse, BatchOperationMetadata> batchCreateJobsOperationCallable()458 batchCreateJobsOperationCallable() { 459 return stub.batchCreateJobsOperationCallable(); 460 } 461 462 // AUTO-GENERATED DOCUMENTATION AND METHOD. 463 /** 464 * Begins executing a batch create jobs operation. 465 * 466 * <p>Sample code: 467 * 468 * <pre>{@code 469 * // This snippet has been automatically generated and should be regarded as a code template only. 470 * // It will require modifications to work: 471 * // - It may require correct/in-range values for request initialization. 472 * // - It may require specifying regional endpoints when creating the service client as shown in 473 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 474 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 475 * BatchCreateJobsRequest request = 476 * BatchCreateJobsRequest.newBuilder() 477 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 478 * .addAllJobs(new ArrayList<Job>()) 479 * .build(); 480 * ApiFuture<Operation> future = jobServiceClient.batchCreateJobsCallable().futureCall(request); 481 * // Do something. 482 * Operation response = future.get(); 483 * } 484 * }</pre> 485 */ batchCreateJobsCallable()486 public final UnaryCallable<BatchCreateJobsRequest, Operation> batchCreateJobsCallable() { 487 return stub.batchCreateJobsCallable(); 488 } 489 490 // AUTO-GENERATED DOCUMENTATION AND METHOD. 491 /** 492 * Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days. 493 * 494 * <p>Sample code: 495 * 496 * <pre>{@code 497 * // This snippet has been automatically generated and should be regarded as a code template only. 498 * // It will require modifications to work: 499 * // - It may require correct/in-range values for request initialization. 500 * // - It may require specifying regional endpoints when creating the service client as shown in 501 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 502 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 503 * JobName name = JobName.of("[PROJECT]", "[TENANT]", "[JOB]"); 504 * Job response = jobServiceClient.getJob(name); 505 * } 506 * }</pre> 507 * 508 * @param name Required. The resource name of the job to retrieve. 509 * <p>The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, 510 * "projects/foo/tenants/bar/jobs/baz". 511 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 512 */ getJob(JobName name)513 public final Job getJob(JobName name) { 514 GetJobRequest request = 515 GetJobRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 516 return getJob(request); 517 } 518 519 // AUTO-GENERATED DOCUMENTATION AND METHOD. 520 /** 521 * Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days. 522 * 523 * <p>Sample code: 524 * 525 * <pre>{@code 526 * // This snippet has been automatically generated and should be regarded as a code template only. 527 * // It will require modifications to work: 528 * // - It may require correct/in-range values for request initialization. 529 * // - It may require specifying regional endpoints when creating the service client as shown in 530 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 531 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 532 * String name = JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString(); 533 * Job response = jobServiceClient.getJob(name); 534 * } 535 * }</pre> 536 * 537 * @param name Required. The resource name of the job to retrieve. 538 * <p>The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, 539 * "projects/foo/tenants/bar/jobs/baz". 540 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 541 */ getJob(String name)542 public final Job getJob(String name) { 543 GetJobRequest request = GetJobRequest.newBuilder().setName(name).build(); 544 return getJob(request); 545 } 546 547 // AUTO-GENERATED DOCUMENTATION AND METHOD. 548 /** 549 * Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days. 550 * 551 * <p>Sample code: 552 * 553 * <pre>{@code 554 * // This snippet has been automatically generated and should be regarded as a code template only. 555 * // It will require modifications to work: 556 * // - It may require correct/in-range values for request initialization. 557 * // - It may require specifying regional endpoints when creating the service client as shown in 558 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 559 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 560 * GetJobRequest request = 561 * GetJobRequest.newBuilder() 562 * .setName(JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString()) 563 * .build(); 564 * Job response = jobServiceClient.getJob(request); 565 * } 566 * }</pre> 567 * 568 * @param request The request object containing all of the parameters for the API call. 569 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 570 */ getJob(GetJobRequest request)571 public final Job getJob(GetJobRequest request) { 572 return getJobCallable().call(request); 573 } 574 575 // AUTO-GENERATED DOCUMENTATION AND METHOD. 576 /** 577 * Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days. 578 * 579 * <p>Sample code: 580 * 581 * <pre>{@code 582 * // This snippet has been automatically generated and should be regarded as a code template only. 583 * // It will require modifications to work: 584 * // - It may require correct/in-range values for request initialization. 585 * // - It may require specifying regional endpoints when creating the service client as shown in 586 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 587 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 588 * GetJobRequest request = 589 * GetJobRequest.newBuilder() 590 * .setName(JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString()) 591 * .build(); 592 * ApiFuture<Job> future = jobServiceClient.getJobCallable().futureCall(request); 593 * // Do something. 594 * Job response = future.get(); 595 * } 596 * }</pre> 597 */ getJobCallable()598 public final UnaryCallable<GetJobRequest, Job> getJobCallable() { 599 return stub.getJobCallable(); 600 } 601 602 // AUTO-GENERATED DOCUMENTATION AND METHOD. 603 /** 604 * Updates specified job. 605 * 606 * <p>Typically, updated contents become visible in search results within 10 seconds, but it may 607 * take up to 5 minutes. 608 * 609 * <p>Sample code: 610 * 611 * <pre>{@code 612 * // This snippet has been automatically generated and should be regarded as a code template only. 613 * // It will require modifications to work: 614 * // - It may require correct/in-range values for request initialization. 615 * // - It may require specifying regional endpoints when creating the service client as shown in 616 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 617 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 618 * Job job = Job.newBuilder().build(); 619 * FieldMask updateMask = FieldMask.newBuilder().build(); 620 * Job response = jobServiceClient.updateJob(job, updateMask); 621 * } 622 * }</pre> 623 * 624 * @param job Required. The Job to be updated. 625 * @param updateMask Strongly recommended for the best service experience. 626 * <p>If [update_mask][google.cloud.talent.v4.UpdateJobRequest.update_mask] is provided, only 627 * the specified fields in [job][google.cloud.talent.v4.UpdateJobRequest.job] are updated. 628 * Otherwise all the fields are updated. 629 * <p>A field mask to restrict the fields that are updated. Only top level fields of 630 * [Job][google.cloud.talent.v4.Job] are supported. 631 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 632 */ updateJob(Job job, FieldMask updateMask)633 public final Job updateJob(Job job, FieldMask updateMask) { 634 UpdateJobRequest request = 635 UpdateJobRequest.newBuilder().setJob(job).setUpdateMask(updateMask).build(); 636 return updateJob(request); 637 } 638 639 // AUTO-GENERATED DOCUMENTATION AND METHOD. 640 /** 641 * Updates specified job. 642 * 643 * <p>Typically, updated contents become visible in search results within 10 seconds, but it may 644 * take up to 5 minutes. 645 * 646 * <p>Sample code: 647 * 648 * <pre>{@code 649 * // This snippet has been automatically generated and should be regarded as a code template only. 650 * // It will require modifications to work: 651 * // - It may require correct/in-range values for request initialization. 652 * // - It may require specifying regional endpoints when creating the service client as shown in 653 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 654 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 655 * UpdateJobRequest request = 656 * UpdateJobRequest.newBuilder() 657 * .setJob(Job.newBuilder().build()) 658 * .setUpdateMask(FieldMask.newBuilder().build()) 659 * .build(); 660 * Job response = jobServiceClient.updateJob(request); 661 * } 662 * }</pre> 663 * 664 * @param request The request object containing all of the parameters for the API call. 665 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 666 */ updateJob(UpdateJobRequest request)667 public final Job updateJob(UpdateJobRequest request) { 668 return updateJobCallable().call(request); 669 } 670 671 // AUTO-GENERATED DOCUMENTATION AND METHOD. 672 /** 673 * Updates specified job. 674 * 675 * <p>Typically, updated contents become visible in search results within 10 seconds, but it may 676 * take up to 5 minutes. 677 * 678 * <p>Sample code: 679 * 680 * <pre>{@code 681 * // This snippet has been automatically generated and should be regarded as a code template only. 682 * // It will require modifications to work: 683 * // - It may require correct/in-range values for request initialization. 684 * // - It may require specifying regional endpoints when creating the service client as shown in 685 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 686 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 687 * UpdateJobRequest request = 688 * UpdateJobRequest.newBuilder() 689 * .setJob(Job.newBuilder().build()) 690 * .setUpdateMask(FieldMask.newBuilder().build()) 691 * .build(); 692 * ApiFuture<Job> future = jobServiceClient.updateJobCallable().futureCall(request); 693 * // Do something. 694 * Job response = future.get(); 695 * } 696 * }</pre> 697 */ updateJobCallable()698 public final UnaryCallable<UpdateJobRequest, Job> updateJobCallable() { 699 return stub.updateJobCallable(); 700 } 701 702 // AUTO-GENERATED DOCUMENTATION AND METHOD. 703 /** 704 * Begins executing a batch update jobs operation. 705 * 706 * <p>Sample code: 707 * 708 * <pre>{@code 709 * // This snippet has been automatically generated and should be regarded as a code template only. 710 * // It will require modifications to work: 711 * // - It may require correct/in-range values for request initialization. 712 * // - It may require specifying regional endpoints when creating the service client as shown in 713 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 714 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 715 * TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); 716 * List<Job> jobs = new ArrayList<>(); 717 * BatchUpdateJobsResponse response = jobServiceClient.batchUpdateJobsAsync(parent, jobs).get(); 718 * } 719 * }</pre> 720 * 721 * @param parent Required. The resource name of the tenant under which the job is created. 722 * <p>The format is "projects/{project_id}/tenants/{tenant_id}". For example, 723 * "projects/foo/tenants/bar". 724 * @param jobs Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. 725 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 726 */ 727 public final OperationFuture<BatchUpdateJobsResponse, BatchOperationMetadata> batchUpdateJobsAsync(TenantName parent, List<Job> jobs)728 batchUpdateJobsAsync(TenantName parent, List<Job> jobs) { 729 BatchUpdateJobsRequest request = 730 BatchUpdateJobsRequest.newBuilder() 731 .setParent(parent == null ? null : parent.toString()) 732 .addAllJobs(jobs) 733 .build(); 734 return batchUpdateJobsAsync(request); 735 } 736 737 // AUTO-GENERATED DOCUMENTATION AND METHOD. 738 /** 739 * Begins executing a batch update jobs operation. 740 * 741 * <p>Sample code: 742 * 743 * <pre>{@code 744 * // This snippet has been automatically generated and should be regarded as a code template only. 745 * // It will require modifications to work: 746 * // - It may require correct/in-range values for request initialization. 747 * // - It may require specifying regional endpoints when creating the service client as shown in 748 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 749 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 750 * String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); 751 * List<Job> jobs = new ArrayList<>(); 752 * BatchUpdateJobsResponse response = jobServiceClient.batchUpdateJobsAsync(parent, jobs).get(); 753 * } 754 * }</pre> 755 * 756 * @param parent Required. The resource name of the tenant under which the job is created. 757 * <p>The format is "projects/{project_id}/tenants/{tenant_id}". For example, 758 * "projects/foo/tenants/bar". 759 * @param jobs Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. 760 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 761 */ 762 public final OperationFuture<BatchUpdateJobsResponse, BatchOperationMetadata> batchUpdateJobsAsync(String parent, List<Job> jobs)763 batchUpdateJobsAsync(String parent, List<Job> jobs) { 764 BatchUpdateJobsRequest request = 765 BatchUpdateJobsRequest.newBuilder().setParent(parent).addAllJobs(jobs).build(); 766 return batchUpdateJobsAsync(request); 767 } 768 769 // AUTO-GENERATED DOCUMENTATION AND METHOD. 770 /** 771 * Begins executing a batch update jobs operation. 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 (JobServiceClient jobServiceClient = JobServiceClient.create()) { 782 * BatchUpdateJobsRequest request = 783 * BatchUpdateJobsRequest.newBuilder() 784 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 785 * .addAllJobs(new ArrayList<Job>()) 786 * .setUpdateMask(FieldMask.newBuilder().build()) 787 * .build(); 788 * BatchUpdateJobsResponse response = jobServiceClient.batchUpdateJobsAsync(request).get(); 789 * } 790 * }</pre> 791 * 792 * @param request The request object containing all of the parameters for the API call. 793 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 794 */ 795 public final OperationFuture<BatchUpdateJobsResponse, BatchOperationMetadata> batchUpdateJobsAsync(BatchUpdateJobsRequest request)796 batchUpdateJobsAsync(BatchUpdateJobsRequest request) { 797 return batchUpdateJobsOperationCallable().futureCall(request); 798 } 799 800 // AUTO-GENERATED DOCUMENTATION AND METHOD. 801 /** 802 * Begins executing a batch update jobs operation. 803 * 804 * <p>Sample code: 805 * 806 * <pre>{@code 807 * // This snippet has been automatically generated and should be regarded as a code template only. 808 * // It will require modifications to work: 809 * // - It may require correct/in-range values for request initialization. 810 * // - It may require specifying regional endpoints when creating the service client as shown in 811 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 812 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 813 * BatchUpdateJobsRequest request = 814 * BatchUpdateJobsRequest.newBuilder() 815 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 816 * .addAllJobs(new ArrayList<Job>()) 817 * .setUpdateMask(FieldMask.newBuilder().build()) 818 * .build(); 819 * OperationFuture<BatchUpdateJobsResponse, BatchOperationMetadata> future = 820 * jobServiceClient.batchUpdateJobsOperationCallable().futureCall(request); 821 * // Do something. 822 * BatchUpdateJobsResponse response = future.get(); 823 * } 824 * }</pre> 825 */ 826 public final OperationCallable< 827 BatchUpdateJobsRequest, BatchUpdateJobsResponse, BatchOperationMetadata> batchUpdateJobsOperationCallable()828 batchUpdateJobsOperationCallable() { 829 return stub.batchUpdateJobsOperationCallable(); 830 } 831 832 // AUTO-GENERATED DOCUMENTATION AND METHOD. 833 /** 834 * Begins executing a batch update jobs operation. 835 * 836 * <p>Sample code: 837 * 838 * <pre>{@code 839 * // This snippet has been automatically generated and should be regarded as a code template only. 840 * // It will require modifications to work: 841 * // - It may require correct/in-range values for request initialization. 842 * // - It may require specifying regional endpoints when creating the service client as shown in 843 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 844 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 845 * BatchUpdateJobsRequest request = 846 * BatchUpdateJobsRequest.newBuilder() 847 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 848 * .addAllJobs(new ArrayList<Job>()) 849 * .setUpdateMask(FieldMask.newBuilder().build()) 850 * .build(); 851 * ApiFuture<Operation> future = jobServiceClient.batchUpdateJobsCallable().futureCall(request); 852 * // Do something. 853 * Operation response = future.get(); 854 * } 855 * }</pre> 856 */ batchUpdateJobsCallable()857 public final UnaryCallable<BatchUpdateJobsRequest, Operation> batchUpdateJobsCallable() { 858 return stub.batchUpdateJobsCallable(); 859 } 860 861 // AUTO-GENERATED DOCUMENTATION AND METHOD. 862 /** 863 * Deletes the specified job. 864 * 865 * <p>Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes. 866 * 867 * <p>Sample code: 868 * 869 * <pre>{@code 870 * // This snippet has been automatically generated and should be regarded as a code template only. 871 * // It will require modifications to work: 872 * // - It may require correct/in-range values for request initialization. 873 * // - It may require specifying regional endpoints when creating the service client as shown in 874 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 875 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 876 * JobName name = JobName.of("[PROJECT]", "[TENANT]", "[JOB]"); 877 * jobServiceClient.deleteJob(name); 878 * } 879 * }</pre> 880 * 881 * @param name Required. The resource name of the job to be deleted. 882 * <p>The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, 883 * "projects/foo/tenants/bar/jobs/baz". 884 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 885 */ deleteJob(JobName name)886 public final void deleteJob(JobName name) { 887 DeleteJobRequest request = 888 DeleteJobRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 889 deleteJob(request); 890 } 891 892 // AUTO-GENERATED DOCUMENTATION AND METHOD. 893 /** 894 * Deletes the specified job. 895 * 896 * <p>Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes. 897 * 898 * <p>Sample code: 899 * 900 * <pre>{@code 901 * // This snippet has been automatically generated and should be regarded as a code template only. 902 * // It will require modifications to work: 903 * // - It may require correct/in-range values for request initialization. 904 * // - It may require specifying regional endpoints when creating the service client as shown in 905 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 906 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 907 * String name = JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString(); 908 * jobServiceClient.deleteJob(name); 909 * } 910 * }</pre> 911 * 912 * @param name Required. The resource name of the job to be deleted. 913 * <p>The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, 914 * "projects/foo/tenants/bar/jobs/baz". 915 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 916 */ deleteJob(String name)917 public final void deleteJob(String name) { 918 DeleteJobRequest request = DeleteJobRequest.newBuilder().setName(name).build(); 919 deleteJob(request); 920 } 921 922 // AUTO-GENERATED DOCUMENTATION AND METHOD. 923 /** 924 * Deletes the specified job. 925 * 926 * <p>Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes. 927 * 928 * <p>Sample code: 929 * 930 * <pre>{@code 931 * // This snippet has been automatically generated and should be regarded as a code template only. 932 * // It will require modifications to work: 933 * // - It may require correct/in-range values for request initialization. 934 * // - It may require specifying regional endpoints when creating the service client as shown in 935 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 936 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 937 * DeleteJobRequest request = 938 * DeleteJobRequest.newBuilder() 939 * .setName(JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString()) 940 * .build(); 941 * jobServiceClient.deleteJob(request); 942 * } 943 * }</pre> 944 * 945 * @param request The request object containing all of the parameters for the API call. 946 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 947 */ deleteJob(DeleteJobRequest request)948 public final void deleteJob(DeleteJobRequest request) { 949 deleteJobCallable().call(request); 950 } 951 952 // AUTO-GENERATED DOCUMENTATION AND METHOD. 953 /** 954 * Deletes the specified job. 955 * 956 * <p>Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes. 957 * 958 * <p>Sample code: 959 * 960 * <pre>{@code 961 * // This snippet has been automatically generated and should be regarded as a code template only. 962 * // It will require modifications to work: 963 * // - It may require correct/in-range values for request initialization. 964 * // - It may require specifying regional endpoints when creating the service client as shown in 965 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 966 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 967 * DeleteJobRequest request = 968 * DeleteJobRequest.newBuilder() 969 * .setName(JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString()) 970 * .build(); 971 * ApiFuture<Empty> future = jobServiceClient.deleteJobCallable().futureCall(request); 972 * // Do something. 973 * future.get(); 974 * } 975 * }</pre> 976 */ deleteJobCallable()977 public final UnaryCallable<DeleteJobRequest, Empty> deleteJobCallable() { 978 return stub.deleteJobCallable(); 979 } 980 981 // AUTO-GENERATED DOCUMENTATION AND METHOD. 982 /** 983 * Begins executing a batch delete jobs operation. 984 * 985 * <p>Sample code: 986 * 987 * <pre>{@code 988 * // This snippet has been automatically generated and should be regarded as a code template only. 989 * // It will require modifications to work: 990 * // - It may require correct/in-range values for request initialization. 991 * // - It may require specifying regional endpoints when creating the service client as shown in 992 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 993 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 994 * TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); 995 * List<String> names = new ArrayList<>(); 996 * BatchDeleteJobsResponse response = jobServiceClient.batchDeleteJobsAsync(parent, names).get(); 997 * } 998 * }</pre> 999 * 1000 * @param parent Required. The resource name of the tenant under which the job is created. 1001 * <p>The format is "projects/{project_id}/tenants/{tenant_id}". For example, 1002 * "projects/foo/tenants/bar". 1003 * <p>The parent of all of the jobs specified in `names` must match this field. 1004 * @param names The names of the jobs to delete. 1005 * <p>The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, 1006 * "projects/foo/tenants/bar/jobs/baz". 1007 * <p>A maximum of 200 jobs can be deleted in a batch. 1008 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1009 */ 1010 public final OperationFuture<BatchDeleteJobsResponse, BatchOperationMetadata> batchDeleteJobsAsync(TenantName parent, List<String> names)1011 batchDeleteJobsAsync(TenantName parent, List<String> names) { 1012 BatchDeleteJobsRequest request = 1013 BatchDeleteJobsRequest.newBuilder() 1014 .setParent(parent == null ? null : parent.toString()) 1015 .addAllNames(names) 1016 .build(); 1017 return batchDeleteJobsAsync(request); 1018 } 1019 1020 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1021 /** 1022 * Begins executing a batch delete jobs operation. 1023 * 1024 * <p>Sample code: 1025 * 1026 * <pre>{@code 1027 * // This snippet has been automatically generated and should be regarded as a code template only. 1028 * // It will require modifications to work: 1029 * // - It may require correct/in-range values for request initialization. 1030 * // - It may require specifying regional endpoints when creating the service client as shown in 1031 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1032 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 1033 * String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); 1034 * List<String> names = new ArrayList<>(); 1035 * BatchDeleteJobsResponse response = jobServiceClient.batchDeleteJobsAsync(parent, names).get(); 1036 * } 1037 * }</pre> 1038 * 1039 * @param parent Required. The resource name of the tenant under which the job is created. 1040 * <p>The format is "projects/{project_id}/tenants/{tenant_id}". For example, 1041 * "projects/foo/tenants/bar". 1042 * <p>The parent of all of the jobs specified in `names` must match this field. 1043 * @param names The names of the jobs to delete. 1044 * <p>The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, 1045 * "projects/foo/tenants/bar/jobs/baz". 1046 * <p>A maximum of 200 jobs can be deleted in a batch. 1047 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1048 */ 1049 public final OperationFuture<BatchDeleteJobsResponse, BatchOperationMetadata> batchDeleteJobsAsync(String parent, List<String> names)1050 batchDeleteJobsAsync(String parent, List<String> names) { 1051 BatchDeleteJobsRequest request = 1052 BatchDeleteJobsRequest.newBuilder().setParent(parent).addAllNames(names).build(); 1053 return batchDeleteJobsAsync(request); 1054 } 1055 1056 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1057 /** 1058 * Begins executing a batch delete jobs operation. 1059 * 1060 * <p>Sample code: 1061 * 1062 * <pre>{@code 1063 * // This snippet has been automatically generated and should be regarded as a code template only. 1064 * // It will require modifications to work: 1065 * // - It may require correct/in-range values for request initialization. 1066 * // - It may require specifying regional endpoints when creating the service client as shown in 1067 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1068 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 1069 * BatchDeleteJobsRequest request = 1070 * BatchDeleteJobsRequest.newBuilder() 1071 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 1072 * .addAllNames(new ArrayList<String>()) 1073 * .build(); 1074 * BatchDeleteJobsResponse response = jobServiceClient.batchDeleteJobsAsync(request).get(); 1075 * } 1076 * }</pre> 1077 * 1078 * @param request The request object containing all of the parameters for the API call. 1079 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1080 */ 1081 public final OperationFuture<BatchDeleteJobsResponse, BatchOperationMetadata> batchDeleteJobsAsync(BatchDeleteJobsRequest request)1082 batchDeleteJobsAsync(BatchDeleteJobsRequest request) { 1083 return batchDeleteJobsOperationCallable().futureCall(request); 1084 } 1085 1086 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1087 /** 1088 * Begins executing a batch delete jobs operation. 1089 * 1090 * <p>Sample code: 1091 * 1092 * <pre>{@code 1093 * // This snippet has been automatically generated and should be regarded as a code template only. 1094 * // It will require modifications to work: 1095 * // - It may require correct/in-range values for request initialization. 1096 * // - It may require specifying regional endpoints when creating the service client as shown in 1097 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1098 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 1099 * BatchDeleteJobsRequest request = 1100 * BatchDeleteJobsRequest.newBuilder() 1101 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 1102 * .addAllNames(new ArrayList<String>()) 1103 * .build(); 1104 * OperationFuture<BatchDeleteJobsResponse, BatchOperationMetadata> future = 1105 * jobServiceClient.batchDeleteJobsOperationCallable().futureCall(request); 1106 * // Do something. 1107 * BatchDeleteJobsResponse response = future.get(); 1108 * } 1109 * }</pre> 1110 */ 1111 public final OperationCallable< 1112 BatchDeleteJobsRequest, BatchDeleteJobsResponse, BatchOperationMetadata> batchDeleteJobsOperationCallable()1113 batchDeleteJobsOperationCallable() { 1114 return stub.batchDeleteJobsOperationCallable(); 1115 } 1116 1117 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1118 /** 1119 * Begins executing a batch delete jobs operation. 1120 * 1121 * <p>Sample code: 1122 * 1123 * <pre>{@code 1124 * // This snippet has been automatically generated and should be regarded as a code template only. 1125 * // It will require modifications to work: 1126 * // - It may require correct/in-range values for request initialization. 1127 * // - It may require specifying regional endpoints when creating the service client as shown in 1128 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1129 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 1130 * BatchDeleteJobsRequest request = 1131 * BatchDeleteJobsRequest.newBuilder() 1132 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 1133 * .addAllNames(new ArrayList<String>()) 1134 * .build(); 1135 * ApiFuture<Operation> future = jobServiceClient.batchDeleteJobsCallable().futureCall(request); 1136 * // Do something. 1137 * Operation response = future.get(); 1138 * } 1139 * }</pre> 1140 */ batchDeleteJobsCallable()1141 public final UnaryCallable<BatchDeleteJobsRequest, Operation> batchDeleteJobsCallable() { 1142 return stub.batchDeleteJobsCallable(); 1143 } 1144 1145 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1146 /** 1147 * Lists jobs by filter. 1148 * 1149 * <p>Sample code: 1150 * 1151 * <pre>{@code 1152 * // This snippet has been automatically generated and should be regarded as a code template only. 1153 * // It will require modifications to work: 1154 * // - It may require correct/in-range values for request initialization. 1155 * // - It may require specifying regional endpoints when creating the service client as shown in 1156 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1157 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 1158 * TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); 1159 * String filter = "filter-1274492040"; 1160 * for (Job element : jobServiceClient.listJobs(parent, filter).iterateAll()) { 1161 * // doThingsWith(element); 1162 * } 1163 * } 1164 * }</pre> 1165 * 1166 * @param parent Required. The resource name of the tenant under which the job is created. 1167 * <p>The format is "projects/{project_id}/tenants/{tenant_id}". For example, 1168 * "projects/foo/tenants/bar". 1169 * @param filter Required. The filter string specifies the jobs to be enumerated. 1170 * <p>Supported operator: =, AND 1171 * <p>The fields eligible for filtering are: 1172 * <ul> 1173 * <li>`companyName` 1174 * <li>`requisitionId` 1175 * <li>`status` Available values: OPEN, EXPIRED, ALL. Defaults to OPEN if no value is 1176 * specified. 1177 * </ul> 1178 * <p>At least one of `companyName` and `requisitionId` must present or an INVALID_ARGUMENT 1179 * error is thrown. 1180 * <p>Sample Query: 1181 * <ul> 1182 * <li>companyName = "projects/foo/tenants/bar/companies/baz" 1183 * <li>companyName = "projects/foo/tenants/bar/companies/baz" AND requisitionId = "req-1" 1184 * <li>companyName = "projects/foo/tenants/bar/companies/baz" AND status = "EXPIRED" 1185 * <li>requisitionId = "req-1" 1186 * <li>requisitionId = "req-1" AND status = "EXPIRED" 1187 * </ul> 1188 * 1189 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1190 */ listJobs(TenantName parent, String filter)1191 public final ListJobsPagedResponse listJobs(TenantName parent, String filter) { 1192 ListJobsRequest request = 1193 ListJobsRequest.newBuilder() 1194 .setParent(parent == null ? null : parent.toString()) 1195 .setFilter(filter) 1196 .build(); 1197 return listJobs(request); 1198 } 1199 1200 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1201 /** 1202 * Lists jobs by filter. 1203 * 1204 * <p>Sample code: 1205 * 1206 * <pre>{@code 1207 * // This snippet has been automatically generated and should be regarded as a code template only. 1208 * // It will require modifications to work: 1209 * // - It may require correct/in-range values for request initialization. 1210 * // - It may require specifying regional endpoints when creating the service client as shown in 1211 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1212 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 1213 * String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); 1214 * String filter = "filter-1274492040"; 1215 * for (Job element : jobServiceClient.listJobs(parent, filter).iterateAll()) { 1216 * // doThingsWith(element); 1217 * } 1218 * } 1219 * }</pre> 1220 * 1221 * @param parent Required. The resource name of the tenant under which the job is created. 1222 * <p>The format is "projects/{project_id}/tenants/{tenant_id}". For example, 1223 * "projects/foo/tenants/bar". 1224 * @param filter Required. The filter string specifies the jobs to be enumerated. 1225 * <p>Supported operator: =, AND 1226 * <p>The fields eligible for filtering are: 1227 * <ul> 1228 * <li>`companyName` 1229 * <li>`requisitionId` 1230 * <li>`status` Available values: OPEN, EXPIRED, ALL. Defaults to OPEN if no value is 1231 * specified. 1232 * </ul> 1233 * <p>At least one of `companyName` and `requisitionId` must present or an INVALID_ARGUMENT 1234 * error is thrown. 1235 * <p>Sample Query: 1236 * <ul> 1237 * <li>companyName = "projects/foo/tenants/bar/companies/baz" 1238 * <li>companyName = "projects/foo/tenants/bar/companies/baz" AND requisitionId = "req-1" 1239 * <li>companyName = "projects/foo/tenants/bar/companies/baz" AND status = "EXPIRED" 1240 * <li>requisitionId = "req-1" 1241 * <li>requisitionId = "req-1" AND status = "EXPIRED" 1242 * </ul> 1243 * 1244 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1245 */ listJobs(String parent, String filter)1246 public final ListJobsPagedResponse listJobs(String parent, String filter) { 1247 ListJobsRequest request = 1248 ListJobsRequest.newBuilder().setParent(parent).setFilter(filter).build(); 1249 return listJobs(request); 1250 } 1251 1252 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1253 /** 1254 * Lists jobs by filter. 1255 * 1256 * <p>Sample code: 1257 * 1258 * <pre>{@code 1259 * // This snippet has been automatically generated and should be regarded as a code template only. 1260 * // It will require modifications to work: 1261 * // - It may require correct/in-range values for request initialization. 1262 * // - It may require specifying regional endpoints when creating the service client as shown in 1263 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1264 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 1265 * ListJobsRequest request = 1266 * ListJobsRequest.newBuilder() 1267 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 1268 * .setFilter("filter-1274492040") 1269 * .setPageToken("pageToken873572522") 1270 * .setPageSize(883849137) 1271 * .setJobView(JobView.forNumber(0)) 1272 * .build(); 1273 * for (Job element : jobServiceClient.listJobs(request).iterateAll()) { 1274 * // doThingsWith(element); 1275 * } 1276 * } 1277 * }</pre> 1278 * 1279 * @param request The request object containing all of the parameters for the API call. 1280 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1281 */ listJobs(ListJobsRequest request)1282 public final ListJobsPagedResponse listJobs(ListJobsRequest request) { 1283 return listJobsPagedCallable().call(request); 1284 } 1285 1286 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1287 /** 1288 * Lists jobs by filter. 1289 * 1290 * <p>Sample code: 1291 * 1292 * <pre>{@code 1293 * // This snippet has been automatically generated and should be regarded as a code template only. 1294 * // It will require modifications to work: 1295 * // - It may require correct/in-range values for request initialization. 1296 * // - It may require specifying regional endpoints when creating the service client as shown in 1297 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1298 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 1299 * ListJobsRequest request = 1300 * ListJobsRequest.newBuilder() 1301 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 1302 * .setFilter("filter-1274492040") 1303 * .setPageToken("pageToken873572522") 1304 * .setPageSize(883849137) 1305 * .setJobView(JobView.forNumber(0)) 1306 * .build(); 1307 * ApiFuture<Job> future = jobServiceClient.listJobsPagedCallable().futureCall(request); 1308 * // Do something. 1309 * for (Job element : future.get().iterateAll()) { 1310 * // doThingsWith(element); 1311 * } 1312 * } 1313 * }</pre> 1314 */ listJobsPagedCallable()1315 public final UnaryCallable<ListJobsRequest, ListJobsPagedResponse> listJobsPagedCallable() { 1316 return stub.listJobsPagedCallable(); 1317 } 1318 1319 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1320 /** 1321 * Lists jobs by filter. 1322 * 1323 * <p>Sample code: 1324 * 1325 * <pre>{@code 1326 * // This snippet has been automatically generated and should be regarded as a code template only. 1327 * // It will require modifications to work: 1328 * // - It may require correct/in-range values for request initialization. 1329 * // - It may require specifying regional endpoints when creating the service client as shown in 1330 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1331 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 1332 * ListJobsRequest request = 1333 * ListJobsRequest.newBuilder() 1334 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 1335 * .setFilter("filter-1274492040") 1336 * .setPageToken("pageToken873572522") 1337 * .setPageSize(883849137) 1338 * .setJobView(JobView.forNumber(0)) 1339 * .build(); 1340 * while (true) { 1341 * ListJobsResponse response = jobServiceClient.listJobsCallable().call(request); 1342 * for (Job element : response.getJobsList()) { 1343 * // doThingsWith(element); 1344 * } 1345 * String nextPageToken = response.getNextPageToken(); 1346 * if (!Strings.isNullOrEmpty(nextPageToken)) { 1347 * request = request.toBuilder().setPageToken(nextPageToken).build(); 1348 * } else { 1349 * break; 1350 * } 1351 * } 1352 * } 1353 * }</pre> 1354 */ listJobsCallable()1355 public final UnaryCallable<ListJobsRequest, ListJobsResponse> listJobsCallable() { 1356 return stub.listJobsCallable(); 1357 } 1358 1359 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1360 /** 1361 * Searches for jobs using the provided 1362 * [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. 1363 * 1364 * <p>This call constrains the [visibility][google.cloud.talent.v4.Job.visibility] of jobs present 1365 * in the database, and only returns jobs that the caller has permission to search against. 1366 * 1367 * <p>Sample code: 1368 * 1369 * <pre>{@code 1370 * // This snippet has been automatically generated and should be regarded as a code template only. 1371 * // It will require modifications to work: 1372 * // - It may require correct/in-range values for request initialization. 1373 * // - It may require specifying regional endpoints when creating the service client as shown in 1374 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1375 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 1376 * SearchJobsRequest request = 1377 * SearchJobsRequest.newBuilder() 1378 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 1379 * .setRequestMetadata(RequestMetadata.newBuilder().build()) 1380 * .setJobQuery(JobQuery.newBuilder().build()) 1381 * .setEnableBroadening(true) 1382 * .addAllHistogramQueries(new ArrayList<HistogramQuery>()) 1383 * .setJobView(JobView.forNumber(0)) 1384 * .setOffset(-1019779949) 1385 * .setMaxPageSize(524069526) 1386 * .setPageToken("pageToken873572522") 1387 * .setOrderBy("orderBy-1207110587") 1388 * .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) 1389 * .setDisableKeywordMatch(true) 1390 * .build(); 1391 * SearchJobsResponse response = jobServiceClient.searchJobs(request); 1392 * } 1393 * }</pre> 1394 * 1395 * @param request The request object containing all of the parameters for the API call. 1396 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1397 */ searchJobs(SearchJobsRequest request)1398 public final SearchJobsResponse searchJobs(SearchJobsRequest request) { 1399 return searchJobsCallable().call(request); 1400 } 1401 1402 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1403 /** 1404 * Searches for jobs using the provided 1405 * [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. 1406 * 1407 * <p>This call constrains the [visibility][google.cloud.talent.v4.Job.visibility] of jobs present 1408 * in the database, and only returns jobs that the caller has permission to search against. 1409 * 1410 * <p>Sample code: 1411 * 1412 * <pre>{@code 1413 * // This snippet has been automatically generated and should be regarded as a code template only. 1414 * // It will require modifications to work: 1415 * // - It may require correct/in-range values for request initialization. 1416 * // - It may require specifying regional endpoints when creating the service client as shown in 1417 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1418 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 1419 * SearchJobsRequest request = 1420 * SearchJobsRequest.newBuilder() 1421 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 1422 * .setRequestMetadata(RequestMetadata.newBuilder().build()) 1423 * .setJobQuery(JobQuery.newBuilder().build()) 1424 * .setEnableBroadening(true) 1425 * .addAllHistogramQueries(new ArrayList<HistogramQuery>()) 1426 * .setJobView(JobView.forNumber(0)) 1427 * .setOffset(-1019779949) 1428 * .setMaxPageSize(524069526) 1429 * .setPageToken("pageToken873572522") 1430 * .setOrderBy("orderBy-1207110587") 1431 * .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) 1432 * .setDisableKeywordMatch(true) 1433 * .build(); 1434 * ApiFuture<SearchJobsResponse> future = 1435 * jobServiceClient.searchJobsCallable().futureCall(request); 1436 * // Do something. 1437 * SearchJobsResponse response = future.get(); 1438 * } 1439 * }</pre> 1440 */ searchJobsCallable()1441 public final UnaryCallable<SearchJobsRequest, SearchJobsResponse> searchJobsCallable() { 1442 return stub.searchJobsCallable(); 1443 } 1444 1445 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1446 /** 1447 * Searches for jobs using the provided 1448 * [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. 1449 * 1450 * <p>This API call is intended for the use case of targeting passive job seekers (for example, 1451 * job seekers who have signed up to receive email alerts about potential job opportunities), it 1452 * has different algorithmic adjustments that are designed to specifically target passive job 1453 * seekers. 1454 * 1455 * <p>This call constrains the [visibility][google.cloud.talent.v4.Job.visibility] of jobs present 1456 * in the database, and only returns jobs the caller has permission to search against. 1457 * 1458 * <p>Sample code: 1459 * 1460 * <pre>{@code 1461 * // This snippet has been automatically generated and should be regarded as a code template only. 1462 * // It will require modifications to work: 1463 * // - It may require correct/in-range values for request initialization. 1464 * // - It may require specifying regional endpoints when creating the service client as shown in 1465 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1466 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 1467 * SearchJobsRequest request = 1468 * SearchJobsRequest.newBuilder() 1469 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 1470 * .setRequestMetadata(RequestMetadata.newBuilder().build()) 1471 * .setJobQuery(JobQuery.newBuilder().build()) 1472 * .setEnableBroadening(true) 1473 * .addAllHistogramQueries(new ArrayList<HistogramQuery>()) 1474 * .setJobView(JobView.forNumber(0)) 1475 * .setOffset(-1019779949) 1476 * .setMaxPageSize(524069526) 1477 * .setPageToken("pageToken873572522") 1478 * .setOrderBy("orderBy-1207110587") 1479 * .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) 1480 * .setDisableKeywordMatch(true) 1481 * .build(); 1482 * SearchJobsResponse response = jobServiceClient.searchJobsForAlert(request); 1483 * } 1484 * }</pre> 1485 * 1486 * @param request The request object containing all of the parameters for the API call. 1487 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1488 */ searchJobsForAlert(SearchJobsRequest request)1489 public final SearchJobsResponse searchJobsForAlert(SearchJobsRequest request) { 1490 return searchJobsForAlertCallable().call(request); 1491 } 1492 1493 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1494 /** 1495 * Searches for jobs using the provided 1496 * [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. 1497 * 1498 * <p>This API call is intended for the use case of targeting passive job seekers (for example, 1499 * job seekers who have signed up to receive email alerts about potential job opportunities), it 1500 * has different algorithmic adjustments that are designed to specifically target passive job 1501 * seekers. 1502 * 1503 * <p>This call constrains the [visibility][google.cloud.talent.v4.Job.visibility] of jobs present 1504 * in the database, and only returns jobs the caller has permission to search against. 1505 * 1506 * <p>Sample code: 1507 * 1508 * <pre>{@code 1509 * // This snippet has been automatically generated and should be regarded as a code template only. 1510 * // It will require modifications to work: 1511 * // - It may require correct/in-range values for request initialization. 1512 * // - It may require specifying regional endpoints when creating the service client as shown in 1513 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1514 * try (JobServiceClient jobServiceClient = JobServiceClient.create()) { 1515 * SearchJobsRequest request = 1516 * SearchJobsRequest.newBuilder() 1517 * .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) 1518 * .setRequestMetadata(RequestMetadata.newBuilder().build()) 1519 * .setJobQuery(JobQuery.newBuilder().build()) 1520 * .setEnableBroadening(true) 1521 * .addAllHistogramQueries(new ArrayList<HistogramQuery>()) 1522 * .setJobView(JobView.forNumber(0)) 1523 * .setOffset(-1019779949) 1524 * .setMaxPageSize(524069526) 1525 * .setPageToken("pageToken873572522") 1526 * .setOrderBy("orderBy-1207110587") 1527 * .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) 1528 * .setDisableKeywordMatch(true) 1529 * .build(); 1530 * ApiFuture<SearchJobsResponse> future = 1531 * jobServiceClient.searchJobsForAlertCallable().futureCall(request); 1532 * // Do something. 1533 * SearchJobsResponse response = future.get(); 1534 * } 1535 * }</pre> 1536 */ searchJobsForAlertCallable()1537 public final UnaryCallable<SearchJobsRequest, SearchJobsResponse> searchJobsForAlertCallable() { 1538 return stub.searchJobsForAlertCallable(); 1539 } 1540 1541 @Override close()1542 public final void close() { 1543 stub.close(); 1544 } 1545 1546 @Override shutdown()1547 public void shutdown() { 1548 stub.shutdown(); 1549 } 1550 1551 @Override isShutdown()1552 public boolean isShutdown() { 1553 return stub.isShutdown(); 1554 } 1555 1556 @Override isTerminated()1557 public boolean isTerminated() { 1558 return stub.isTerminated(); 1559 } 1560 1561 @Override shutdownNow()1562 public void shutdownNow() { 1563 stub.shutdownNow(); 1564 } 1565 1566 @Override awaitTermination(long duration, TimeUnit unit)1567 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 1568 return stub.awaitTermination(duration, unit); 1569 } 1570 1571 public static class ListJobsPagedResponse 1572 extends AbstractPagedListResponse< 1573 ListJobsRequest, ListJobsResponse, Job, ListJobsPage, ListJobsFixedSizeCollection> { 1574 createAsync( PageContext<ListJobsRequest, ListJobsResponse, Job> context, ApiFuture<ListJobsResponse> futureResponse)1575 public static ApiFuture<ListJobsPagedResponse> createAsync( 1576 PageContext<ListJobsRequest, ListJobsResponse, Job> context, 1577 ApiFuture<ListJobsResponse> futureResponse) { 1578 ApiFuture<ListJobsPage> futurePage = 1579 ListJobsPage.createEmptyPage().createPageAsync(context, futureResponse); 1580 return ApiFutures.transform( 1581 futurePage, input -> new ListJobsPagedResponse(input), MoreExecutors.directExecutor()); 1582 } 1583 ListJobsPagedResponse(ListJobsPage page)1584 private ListJobsPagedResponse(ListJobsPage page) { 1585 super(page, ListJobsFixedSizeCollection.createEmptyCollection()); 1586 } 1587 } 1588 1589 public static class ListJobsPage 1590 extends AbstractPage<ListJobsRequest, ListJobsResponse, Job, ListJobsPage> { 1591 ListJobsPage( PageContext<ListJobsRequest, ListJobsResponse, Job> context, ListJobsResponse response)1592 private ListJobsPage( 1593 PageContext<ListJobsRequest, ListJobsResponse, Job> context, ListJobsResponse response) { 1594 super(context, response); 1595 } 1596 createEmptyPage()1597 private static ListJobsPage createEmptyPage() { 1598 return new ListJobsPage(null, null); 1599 } 1600 1601 @Override createPage( PageContext<ListJobsRequest, ListJobsResponse, Job> context, ListJobsResponse response)1602 protected ListJobsPage createPage( 1603 PageContext<ListJobsRequest, ListJobsResponse, Job> context, ListJobsResponse response) { 1604 return new ListJobsPage(context, response); 1605 } 1606 1607 @Override createPageAsync( PageContext<ListJobsRequest, ListJobsResponse, Job> context, ApiFuture<ListJobsResponse> futureResponse)1608 public ApiFuture<ListJobsPage> createPageAsync( 1609 PageContext<ListJobsRequest, ListJobsResponse, Job> context, 1610 ApiFuture<ListJobsResponse> futureResponse) { 1611 return super.createPageAsync(context, futureResponse); 1612 } 1613 } 1614 1615 public static class ListJobsFixedSizeCollection 1616 extends AbstractFixedSizeCollection< 1617 ListJobsRequest, ListJobsResponse, Job, ListJobsPage, ListJobsFixedSizeCollection> { 1618 ListJobsFixedSizeCollection(List<ListJobsPage> pages, int collectionSize)1619 private ListJobsFixedSizeCollection(List<ListJobsPage> pages, int collectionSize) { 1620 super(pages, collectionSize); 1621 } 1622 createEmptyCollection()1623 private static ListJobsFixedSizeCollection createEmptyCollection() { 1624 return new ListJobsFixedSizeCollection(null, 0); 1625 } 1626 1627 @Override createCollection( List<ListJobsPage> pages, int collectionSize)1628 protected ListJobsFixedSizeCollection createCollection( 1629 List<ListJobsPage> pages, int collectionSize) { 1630 return new ListJobsFixedSizeCollection(pages, collectionSize); 1631 } 1632 } 1633 } 1634