Search in sources :

Example 11 with JobServiceClient

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

the class JobSearchGetJob method getJob.

// Get Job.
public static void getJob(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);
        GetJobRequest request = GetJobRequest.newBuilder().setName(name.toString()).build();
        Job response = jobServiceClient.getJob(request);
        System.out.format("Job name: %s%n", response.getName());
        System.out.format("Requisition ID: %s%n", response.getRequisitionId());
        System.out.format("Title: %s%n", response.getTitle());
        System.out.format("Description: %s%n", response.getDescription());
        System.out.format("Posting language: %s%n", response.getLanguageCode());
        for (String address : response.getAddressesList()) {
            System.out.format("Address: %s%n", address);
        }
        for (String email : response.getApplicationInfo().getEmailsList()) {
            System.out.format("Email: %s%n", email);
        }
        for (String websiteUri : response.getApplicationInfo().getUrisList()) {
            System.out.format("Website: %s%n", websiteUri);
        }
    }
}
Also used : GetJobRequest(com.google.cloud.talent.v4.GetJobRequest) JobName(com.google.cloud.talent.v4.JobName) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient) Job(com.google.cloud.talent.v4.Job)

Example 12 with JobServiceClient

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

the class JobSearchListJobs method listJobs.

// Search Jobs with histogram queries.
public static void listJobs(String projectId, String tenantId, String filter) 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);
        ListJobsRequest request = ListJobsRequest.newBuilder().setParent(parent.toString()).setFilter(filter).build();
        for (Job responseItem : jobServiceClient.listJobs(request).iterateAll()) {
            System.out.format("Job name: %s%n", responseItem.getName());
            System.out.format("Job requisition ID: %s%n", responseItem.getRequisitionId());
            System.out.format("Job title: %s%n", responseItem.getTitle());
            System.out.format("Job description: %s%n", responseItem.getDescription());
        }
    }
}
Also used : ListJobsRequest(com.google.cloud.talent.v4.ListJobsRequest) TenantName(com.google.cloud.talent.v4.TenantName) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient) Job(com.google.cloud.talent.v4.Job)

Example 13 with JobServiceClient

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

the class JobSearchCreateJobCustomAttributes method sampleCreateJob.

/**
 * Create Job with Custom Attributes
 *
 * @param projectId Your Google Cloud Project ID
 * @param tenantId Identifier of the Tenantd
 */
public static void sampleCreateJob(String projectId, String tenantId, String companyName, String requisitionId, String languageCode) {
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        TenantOrProjectName parent = TenantName.of(projectId, tenantId);
        Job job = Job.newBuilder().setCompany(companyName).setRequisitionId(requisitionId).setLanguageCode(languageCode).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());
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient) TenantOrProjectName(com.google.cloud.talent.v4beta1.TenantOrProjectName) Job(com.google.cloud.talent.v4beta1.Job) CreateJobRequest(com.google.cloud.talent.v4beta1.CreateJobRequest)

Example 14 with JobServiceClient

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

the class JobSearchDeleteJob method sampleDeleteJob.

/**
 * Delete Job
 */
public static void sampleDeleteJob(String projectId, String tenantId, String jobId) {
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        JobName name = JobWithTenantName.of(projectId, tenantId, jobId);
        DeleteJobRequest request = DeleteJobRequest.newBuilder().setName(name.toString()).build();
        jobServiceClient.deleteJob(request);
        System.out.println("Deleted job.");
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : DeleteJobRequest(com.google.cloud.talent.v4beta1.DeleteJobRequest) JobName(com.google.cloud.talent.v4beta1.JobName) JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient)

Example 15 with JobServiceClient

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

the class JobSearchGetJob method sampleGetJob.

/**
 * Get Job
 */
public static void sampleGetJob(String projectId, String tenantId, String jobId) {
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        JobName name = JobWithTenantName.of(projectId, tenantId, jobId);
        GetJobRequest request = GetJobRequest.newBuilder().setName(name.toString()).build();
        Job response = jobServiceClient.getJob(request);
        System.out.printf("Job name: %s\n", response.getName());
        System.out.printf("Requisition ID: %s\n", response.getRequisitionId());
        System.out.printf("Title: %s\n", response.getTitle());
        System.out.printf("Description: %s\n", response.getDescription());
        System.out.printf("Posting language: %s\n", response.getLanguageCode());
        for (String address : response.getAddressesList()) {
            System.out.printf("Address: %s\n", address);
        }
        for (String email : response.getApplicationInfo().getEmailsList()) {
            System.out.printf("Email: %s\n", email);
        }
        for (String websiteUri : response.getApplicationInfo().getUrisList()) {
            System.out.printf("Website: %s\n", websiteUri);
        }
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : GetJobRequest(com.google.cloud.talent.v4beta1.GetJobRequest) JobName(com.google.cloud.talent.v4beta1.JobName) JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient) Job(com.google.cloud.talent.v4beta1.Job)

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