Search in sources :

Example 26 with JobServiceClient

use of com.google.cloud.talent.v4.JobServiceClient in project java-talent by googleapis.

the class JobSearchCreateJobCustomAttributes method createJob.

// Create Job with Custom Attributes.
public static void createJob(String projectId, String tenantId, String companyId, String requisitionId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        TenantName parent = TenantName.of(projectId, tenantId);
        // Custom attribute can be string or numeric value, and can be filtered in search queries.
        // https://cloud.google.com/talent-solution/job-search/docs/custom-attributes
        CustomAttribute customAttribute = CustomAttribute.newBuilder().addStringValues("Internship").addStringValues("Apprenticeship").setFilterable(true).build();
        Job job = Job.newBuilder().setCompany(companyId).setTitle("Software Developer I").setDescription("This is a description of this <i>wonderful</i> job!").putCustomAttributes("FOR_STUDENTS", customAttribute).setRequisitionId(requisitionId).setLanguageCode("en-US").build();
        CreateJobRequest request = CreateJobRequest.newBuilder().setParent(parent.toString()).setJob(job).build();
        Job response = jobServiceClient.createJob(request);
        System.out.printf("Created job: %s\n", response.getName());
    }
}
Also used : TenantName(com.google.cloud.talent.v4.TenantName) CustomAttribute(com.google.cloud.talent.v4.CustomAttribute) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient) Job(com.google.cloud.talent.v4.Job) CreateJobRequest(com.google.cloud.talent.v4.CreateJobRequest)

Example 27 with JobServiceClient

use of com.google.cloud.talent.v4.JobServiceClient in project java-talent by googleapis.

the class JobSearchDeleteJob method deleteJob.

// Delete Job.
public static void deleteJob(String projectId, String tenantId, String jobId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        JobName name = JobName.of(projectId, tenantId, jobId);
        DeleteJobRequest request = DeleteJobRequest.newBuilder().setName(name.toString()).build();
        jobServiceClient.deleteJob(request);
        System.out.println("Deleted job.");
    }
}
Also used : DeleteJobRequest(com.google.cloud.talent.v4.DeleteJobRequest) JobName(com.google.cloud.talent.v4.JobName) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient)

Aggregations

JobServiceClient (com.google.cloud.talent.v4beta1.JobServiceClient)19 Job (com.google.cloud.talent.v4beta1.Job)16 JobServiceClient (com.google.cloud.talent.v4.JobServiceClient)8 Job (com.google.cloud.talent.v4.Job)7 TenantOrProjectName (com.google.cloud.talent.v4beta1.TenantOrProjectName)7 TenantName (com.google.cloud.talent.v4.TenantName)6 RequestMetadata (com.google.cloud.talent.v4beta1.RequestMetadata)6 SearchJobsRequest (com.google.cloud.talent.v4beta1.SearchJobsRequest)6 TenantName (com.google.cloud.talent.v4beta1.TenantName)6 CreateJobRequest (com.google.cloud.talent.v4beta1.CreateJobRequest)4 JobName (com.google.cloud.talent.v4beta1.JobName)4 RequestMetadata (com.google.cloud.talent.v4.RequestMetadata)3 SearchJobsRequest (com.google.cloud.talent.v4.SearchJobsRequest)3 SearchJobsResponse (com.google.cloud.talent.v4.SearchJobsResponse)3 SearchJobsResponse (com.google.cloud.talent.v4beta1.SearchJobsResponse)3 Duration (com.google.protobuf.Duration)3 LatLng (com.google.type.LatLng)3 CreateJobRequest (com.google.cloud.talent.v4.CreateJobRequest)2 JobName (com.google.cloud.talent.v4.JobName)2 BatchOperationMetadata (com.google.cloud.talent.v4beta1.BatchOperationMetadata)2