@Generated(value="by gapic-generator") @BetaApi public class JobServiceClient extends Object implements BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Job job = Job.newBuilder().build();
Job response = jobServiceClient.createJob(parent, job);
}
Note: close() needs to be called on the jobServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of JobServiceSettings to create(). For example:
To customize credentials:
JobServiceSettings jobServiceSettings =
JobServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
JobServiceClient jobServiceClient =
JobServiceClient.create(jobServiceSettings);
To customize the endpoint:
JobServiceSettings jobServiceSettings =
JobServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
JobServiceClient jobServiceClient =
JobServiceClient.create(jobServiceSettings);
Modifier and Type | Class and Description |
---|---|
static class |
JobServiceClient.ListJobsFixedSizeCollection |
static class |
JobServiceClient.ListJobsPage |
static class |
JobServiceClient.ListJobsPagedResponse |
static class |
JobServiceClient.SearchJobsFixedSizeCollection |
static class |
JobServiceClient.SearchJobsForAlertFixedSizeCollection |
static class |
JobServiceClient.SearchJobsForAlertPage |
static class |
JobServiceClient.SearchJobsForAlertPagedResponse |
static class |
JobServiceClient.SearchJobsPage |
static class |
JobServiceClient.SearchJobsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
JobServiceClient(JobServiceSettings settings)
Constructs an instance of JobServiceClient, using the given settings.
|
protected |
JobServiceClient(JobServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
batchDeleteJobs(com.google.cloud.talent.v4beta1.BatchDeleteJobsRequest request)
Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by filter.
|
void |
batchDeleteJobs(String parent,
String filter)
Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by filter.
|
void |
batchDeleteJobs(com.google.cloud.talent.v4beta1.TenantOrProjectName parent,
String filter)
Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by filter.
|
UnaryCallable<com.google.cloud.talent.v4beta1.BatchDeleteJobsRequest,Empty> |
batchDeleteJobsCallable()
Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by filter.
|
void |
close() |
static JobServiceClient |
create()
Constructs an instance of JobServiceClient with default settings.
|
static JobServiceClient |
create(JobServiceSettings settings)
Constructs an instance of JobServiceClient, using the given settings.
|
static JobServiceClient |
create(JobServiceStub stub)
Constructs an instance of JobServiceClient, using the given stub for making calls.
|
com.google.cloud.talent.v4beta1.Job |
createJob(com.google.cloud.talent.v4beta1.CreateJobRequest request)
Creates a new job.
|
com.google.cloud.talent.v4beta1.Job |
createJob(String parent,
com.google.cloud.talent.v4beta1.Job job)
Creates a new job.
|
com.google.cloud.talent.v4beta1.Job |
createJob(com.google.cloud.talent.v4beta1.TenantOrProjectName parent,
com.google.cloud.talent.v4beta1.Job job)
Creates a new job.
|
UnaryCallable<com.google.cloud.talent.v4beta1.CreateJobRequest,com.google.cloud.talent.v4beta1.Job> |
createJobCallable()
Creates a new job.
|
void |
deleteJob(com.google.cloud.talent.v4beta1.DeleteJobRequest request)
Deletes the specified job.
|
void |
deleteJob(com.google.cloud.talent.v4beta1.JobName name)
Deletes the specified job.
|
void |
deleteJob(String name)
Deletes the specified job.
|
UnaryCallable<com.google.cloud.talent.v4beta1.DeleteJobRequest,Empty> |
deleteJobCallable()
Deletes the specified job.
|
com.google.cloud.talent.v4beta1.Job |
getJob(com.google.cloud.talent.v4beta1.GetJobRequest request)
Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
|
com.google.cloud.talent.v4beta1.Job |
getJob(com.google.cloud.talent.v4beta1.JobName name)
Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
|
com.google.cloud.talent.v4beta1.Job |
getJob(String name)
Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
|
UnaryCallable<com.google.cloud.talent.v4beta1.GetJobRequest,com.google.cloud.talent.v4beta1.Job> |
getJobCallable()
Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
|
JobServiceSettings |
getSettings() |
JobServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
JobServiceClient.ListJobsPagedResponse |
listJobs(com.google.cloud.talent.v4beta1.ListJobsRequest request)
Lists jobs by filter.
|
JobServiceClient.ListJobsPagedResponse |
listJobs(String parent,
String filter)
Lists jobs by filter.
|
JobServiceClient.ListJobsPagedResponse |
listJobs(com.google.cloud.talent.v4beta1.TenantOrProjectName parent,
String filter)
Lists jobs by filter.
|
UnaryCallable<com.google.cloud.talent.v4beta1.ListJobsRequest,com.google.cloud.talent.v4beta1.ListJobsResponse> |
listJobsCallable()
Lists jobs by filter.
|
UnaryCallable<com.google.cloud.talent.v4beta1.ListJobsRequest,JobServiceClient.ListJobsPagedResponse> |
listJobsPagedCallable()
Lists jobs by filter.
|
JobServiceClient.SearchJobsPagedResponse |
searchJobs(com.google.cloud.talent.v4beta1.SearchJobsRequest request)
Searches for jobs using the provided
[SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
|
UnaryCallable<com.google.cloud.talent.v4beta1.SearchJobsRequest,com.google.cloud.talent.v4beta1.SearchJobsResponse> |
searchJobsCallable()
Searches for jobs using the provided
[SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
|
JobServiceClient.SearchJobsForAlertPagedResponse |
searchJobsForAlert(com.google.cloud.talent.v4beta1.SearchJobsRequest request)
Searches for jobs using the provided
[SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
|
UnaryCallable<com.google.cloud.talent.v4beta1.SearchJobsRequest,com.google.cloud.talent.v4beta1.SearchJobsResponse> |
searchJobsForAlertCallable()
Searches for jobs using the provided
[SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
|
UnaryCallable<com.google.cloud.talent.v4beta1.SearchJobsRequest,JobServiceClient.SearchJobsForAlertPagedResponse> |
searchJobsForAlertPagedCallable()
Searches for jobs using the provided
[SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
|
UnaryCallable<com.google.cloud.talent.v4beta1.SearchJobsRequest,JobServiceClient.SearchJobsPagedResponse> |
searchJobsPagedCallable()
Searches for jobs using the provided
[SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
|
void |
shutdown() |
void |
shutdownNow() |
com.google.cloud.talent.v4beta1.Job |
updateJob(com.google.cloud.talent.v4beta1.Job job)
Updates specified job.
|
com.google.cloud.talent.v4beta1.Job |
updateJob(com.google.cloud.talent.v4beta1.UpdateJobRequest request)
Updates specified job.
|
UnaryCallable<com.google.cloud.talent.v4beta1.UpdateJobRequest,com.google.cloud.talent.v4beta1.Job> |
updateJobCallable()
Updates specified job.
|
protected JobServiceClient(JobServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected JobServiceClient(JobServiceStub stub)
public static final JobServiceClient create() throws IOException
IOException
public static final JobServiceClient create(JobServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final JobServiceClient create(JobServiceStub stub)
public final JobServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public JobServiceStub getStub()
public final com.google.cloud.talent.v4beta1.Job createJob(com.google.cloud.talent.v4beta1.TenantOrProjectName parent, com.google.cloud.talent.v4beta1.Job job)
Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Job job = Job.newBuilder().build();
Job response = jobServiceClient.createJob(parent, job);
}
parent
- Required.
The resource name of the tenant under which the job is created.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo".
Tenant id is optional and a default tenant is created if unspecified, for example, "projects/api-test-project".
job
- Required.
The Job to be created.
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Job createJob(String parent, com.google.cloud.talent.v4beta1.Job job)
Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Job job = Job.newBuilder().build();
Job response = jobServiceClient.createJob(parent.toString(), job);
}
parent
- Required.
The resource name of the tenant under which the job is created.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo".
Tenant id is optional and a default tenant is created if unspecified, for example, "projects/api-test-project".
job
- Required.
The Job to be created.
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Job createJob(com.google.cloud.talent.v4beta1.CreateJobRequest request)
Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Job job = Job.newBuilder().build();
CreateJobRequest request = CreateJobRequest.newBuilder()
.setParent(parent.toString())
.setJob(job)
.build();
Job response = jobServiceClient.createJob(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.CreateJobRequest,com.google.cloud.talent.v4beta1.Job> createJobCallable()
Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Job job = Job.newBuilder().build();
CreateJobRequest request = CreateJobRequest.newBuilder()
.setParent(parent.toString())
.setJob(job)
.build();
ApiFuture<Job> future = jobServiceClient.createJobCallable().futureCall(request);
// Do something
Job response = future.get();
}
public final com.google.cloud.talent.v4beta1.Job getJob(com.google.cloud.talent.v4beta1.JobName name)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobOldName.of("[PROJECT]", "[JOBS]");
Job response = jobServiceClient.getJob(name);
}
name
- Required.
The resource name of the job to retrieve.
The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}", for example, "projects/api-test-project/tenants/foo/jobs/1234".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project/jobs/1234".
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Job getJob(String name)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobOldName.of("[PROJECT]", "[JOBS]");
Job response = jobServiceClient.getJob(name.toString());
}
name
- Required.
The resource name of the job to retrieve.
The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}", for example, "projects/api-test-project/tenants/foo/jobs/1234".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project/jobs/1234".
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Job getJob(com.google.cloud.talent.v4beta1.GetJobRequest request)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobOldName.of("[PROJECT]", "[JOBS]");
GetJobRequest request = GetJobRequest.newBuilder()
.setName(name.toString())
.build();
Job response = jobServiceClient.getJob(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.GetJobRequest,com.google.cloud.talent.v4beta1.Job> getJobCallable()
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobOldName.of("[PROJECT]", "[JOBS]");
GetJobRequest request = GetJobRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Job> future = jobServiceClient.getJobCallable().futureCall(request);
// Do something
Job response = future.get();
}
public final com.google.cloud.talent.v4beta1.Job updateJob(com.google.cloud.talent.v4beta1.Job job)
Typically, updated contents become visible in search results within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
Job job = Job.newBuilder().build();
Job response = jobServiceClient.updateJob(job);
}
job
- Required.
The Job to be updated.
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Job updateJob(com.google.cloud.talent.v4beta1.UpdateJobRequest request)
Typically, updated contents become visible in search results within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
Job job = Job.newBuilder().build();
UpdateJobRequest request = UpdateJobRequest.newBuilder()
.setJob(job)
.build();
Job response = jobServiceClient.updateJob(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.UpdateJobRequest,com.google.cloud.talent.v4beta1.Job> updateJobCallable()
Typically, updated contents become visible in search results within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
Job job = Job.newBuilder().build();
UpdateJobRequest request = UpdateJobRequest.newBuilder()
.setJob(job)
.build();
ApiFuture<Job> future = jobServiceClient.updateJobCallable().futureCall(request);
// Do something
Job response = future.get();
}
public final void deleteJob(com.google.cloud.talent.v4beta1.JobName name)
Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobOldName.of("[PROJECT]", "[JOBS]");
jobServiceClient.deleteJob(name);
}
name
- Required.
The resource name of the job to be deleted.
The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}", for example, "projects/api-test-project/tenants/foo/jobs/1234".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project/jobs/1234".
ApiException
- if the remote call failspublic final void deleteJob(String name)
Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobOldName.of("[PROJECT]", "[JOBS]");
jobServiceClient.deleteJob(name.toString());
}
name
- Required.
The resource name of the job to be deleted.
The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}", for example, "projects/api-test-project/tenants/foo/jobs/1234".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project/jobs/1234".
ApiException
- if the remote call failspublic final void deleteJob(com.google.cloud.talent.v4beta1.DeleteJobRequest request)
Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobOldName.of("[PROJECT]", "[JOBS]");
DeleteJobRequest request = DeleteJobRequest.newBuilder()
.setName(name.toString())
.build();
jobServiceClient.deleteJob(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.DeleteJobRequest,Empty> deleteJobCallable()
Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobOldName.of("[PROJECT]", "[JOBS]");
DeleteJobRequest request = DeleteJobRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = jobServiceClient.deleteJobCallable().futureCall(request);
// Do something
future.get();
}
public final JobServiceClient.ListJobsPagedResponse listJobs(com.google.cloud.talent.v4beta1.TenantOrProjectName parent, String filter)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
for (Job element : jobServiceClient.listJobs(parent, filter).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required.
The resource name of the tenant under which the job is created.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project".
filter
- Required.
The filter string specifies the jobs to be enumerated.
Supported operator: =, AND
The fields eligible for filtering are:
* `companyName` (Required) * `requisitionId` (Optional) * `status` (Optional) Available values: OPEN, EXPIRED, ALL. Defaults to OPEN if no value is specified.
Sample Query:
* companyName = "projects/api-test-project/tenants/foo/companies/bar" * companyName = "projects/api-test-project/tenants/foo/companies/bar" AND requisitionId = "req-1" * companyName = "projects/api-test-project/tenants/foo/companies/bar" AND status = "EXPIRED"
ApiException
- if the remote call failspublic final JobServiceClient.ListJobsPagedResponse listJobs(String parent, String filter)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
for (Job element : jobServiceClient.listJobs(parent.toString(), filter).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required.
The resource name of the tenant under which the job is created.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project".
filter
- Required.
The filter string specifies the jobs to be enumerated.
Supported operator: =, AND
The fields eligible for filtering are:
* `companyName` (Required) * `requisitionId` (Optional) * `status` (Optional) Available values: OPEN, EXPIRED, ALL. Defaults to OPEN if no value is specified.
Sample Query:
* companyName = "projects/api-test-project/tenants/foo/companies/bar" * companyName = "projects/api-test-project/tenants/foo/companies/bar" AND requisitionId = "req-1" * companyName = "projects/api-test-project/tenants/foo/companies/bar" AND status = "EXPIRED"
ApiException
- if the remote call failspublic final JobServiceClient.ListJobsPagedResponse listJobs(com.google.cloud.talent.v4beta1.ListJobsRequest request)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
ListJobsRequest request = ListJobsRequest.newBuilder()
.setParent(parent.toString())
.setFilter(filter)
.build();
for (Job element : jobServiceClient.listJobs(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.ListJobsRequest,JobServiceClient.ListJobsPagedResponse> listJobsPagedCallable()
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
ListJobsRequest request = ListJobsRequest.newBuilder()
.setParent(parent.toString())
.setFilter(filter)
.build();
ApiFuture<ListJobsPagedResponse> future = jobServiceClient.listJobsPagedCallable().futureCall(request);
// Do something
for (Job element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.talent.v4beta1.ListJobsRequest,com.google.cloud.talent.v4beta1.ListJobsResponse> listJobsCallable()
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
ListJobsRequest request = ListJobsRequest.newBuilder()
.setParent(parent.toString())
.setFilter(filter)
.build();
while (true) {
ListJobsResponse response = jobServiceClient.listJobsCallable().call(request);
for (Job element : response.getJobsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void batchDeleteJobs(com.google.cloud.talent.v4beta1.TenantOrProjectName parent, String filter)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
jobServiceClient.batchDeleteJobs(parent, filter);
}
parent
- Required.
The resource name of the tenant under which the job is created.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project".
filter
- Required.
The filter string specifies the jobs to be deleted.
Supported operator: =, AND
The fields eligible for filtering are:
* `companyName` (Required) * `requisitionId` (Required)
Sample Query: companyName = "projects/api-test-project/companies/123" AND requisitionId = "req-1"
ApiException
- if the remote call failspublic final void batchDeleteJobs(String parent, String filter)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
jobServiceClient.batchDeleteJobs(parent.toString(), filter);
}
parent
- Required.
The resource name of the tenant under which the job is created.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project".
filter
- Required.
The filter string specifies the jobs to be deleted.
Supported operator: =, AND
The fields eligible for filtering are:
* `companyName` (Required) * `requisitionId` (Required)
Sample Query: companyName = "projects/api-test-project/companies/123" AND requisitionId = "req-1"
ApiException
- if the remote call failspublic final void batchDeleteJobs(com.google.cloud.talent.v4beta1.BatchDeleteJobsRequest request)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
BatchDeleteJobsRequest request = BatchDeleteJobsRequest.newBuilder()
.setParent(parent.toString())
.setFilter(filter)
.build();
jobServiceClient.batchDeleteJobs(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.BatchDeleteJobsRequest,Empty> batchDeleteJobsCallable()
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
BatchDeleteJobsRequest request = BatchDeleteJobsRequest.newBuilder()
.setParent(parent.toString())
.setFilter(filter)
.build();
ApiFuture<Void> future = jobServiceClient.batchDeleteJobsCallable().futureCall(request);
// Do something
future.get();
}
public final JobServiceClient.SearchJobsPagedResponse searchJobs(com.google.cloud.talent.v4beta1.SearchJobsRequest request)
This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs present in the database, and only returns jobs that the caller has permission to search against.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchJobsRequest request = SearchJobsRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
for (SearchJobsResponse.MatchingJob element : jobServiceClient.searchJobs(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.SearchJobsRequest,JobServiceClient.SearchJobsPagedResponse> searchJobsPagedCallable()
This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs present in the database, and only returns jobs that the caller has permission to search against.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchJobsRequest request = SearchJobsRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
ApiFuture<SearchJobsPagedResponse> future = jobServiceClient.searchJobsPagedCallable().futureCall(request);
// Do something
for (SearchJobsResponse.MatchingJob element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.talent.v4beta1.SearchJobsRequest,com.google.cloud.talent.v4beta1.SearchJobsResponse> searchJobsCallable()
This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs present in the database, and only returns jobs that the caller has permission to search against.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchJobsRequest request = SearchJobsRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
while (true) {
SearchJobsResponse response = jobServiceClient.searchJobsCallable().call(request);
for (SearchJobsResponse.MatchingJob element : response.getMatchingJobsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final JobServiceClient.SearchJobsForAlertPagedResponse searchJobsForAlert(com.google.cloud.talent.v4beta1.SearchJobsRequest request)
This API call is intended for the use case of targeting passive job seekers (for example, job seekers who have signed up to receive email alerts about potential job opportunities), and has different algorithmic adjustments that are targeted to passive job seekers.
This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs present in the database, and only returns jobs the caller has permission to search against.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchJobsRequest request = SearchJobsRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
for (SearchJobsResponse.MatchingJob element : jobServiceClient.searchJobsForAlert(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.SearchJobsRequest,JobServiceClient.SearchJobsForAlertPagedResponse> searchJobsForAlertPagedCallable()
This API call is intended for the use case of targeting passive job seekers (for example, job seekers who have signed up to receive email alerts about potential job opportunities), and has different algorithmic adjustments that are targeted to passive job seekers.
This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs present in the database, and only returns jobs the caller has permission to search against.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchJobsRequest request = SearchJobsRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
ApiFuture<SearchJobsForAlertPagedResponse> future = jobServiceClient.searchJobsForAlertPagedCallable().futureCall(request);
// Do something
for (SearchJobsResponse.MatchingJob element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.talent.v4beta1.SearchJobsRequest,com.google.cloud.talent.v4beta1.SearchJobsResponse> searchJobsForAlertCallable()
This API call is intended for the use case of targeting passive job seekers (for example, job seekers who have signed up to receive email alerts about potential job opportunities), and has different algorithmic adjustments that are targeted to passive job seekers.
This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs present in the database, and only returns jobs the caller has permission to search against.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchJobsRequest request = SearchJobsRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
while (true) {
SearchJobsResponse response = jobServiceClient.searchJobsForAlertCallable().call(request);
for (SearchJobsResponse.MatchingJob element : response.getMatchingJobsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.