Search in sources :

Example 11 with TenantOrProjectName

use of com.google.cloud.talent.v4beta1.TenantOrProjectName in project java-talent by googleapis.

the class JobSearchCreateJob method sampleCreateJob.

/**
 * Create Job
 *
 * @param projectId Your Google Cloud Project ID
 * @param tenantId Identifier of the Tenant
 */
public static void sampleCreateJob(String projectId, String tenantId, String companyName, String requisitionId, String title, String description, String jobApplicationUrl, String addressOne, String addressTwo, String languageCode) {
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        TenantOrProjectName parent = TenantName.of(projectId, tenantId);
        List<String> uris = Arrays.asList(jobApplicationUrl);
        Job.ApplicationInfo applicationInfo = Job.ApplicationInfo.newBuilder().addAllUris(uris).build();
        List<String> addresses = Arrays.asList(addressOne, addressTwo);
        Job job = Job.newBuilder().setCompany(companyName).setRequisitionId(requisitionId).setTitle(title).setDescription(description).setApplicationInfo(applicationInfo).addAllAddresses(addresses).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)

Aggregations

TenantOrProjectName (com.google.cloud.talent.v4beta1.TenantOrProjectName)11 JobServiceClient (com.google.cloud.talent.v4beta1.JobServiceClient)7 Job (com.google.cloud.talent.v4beta1.Job)6 RequestMetadata (com.google.cloud.talent.v4beta1.RequestMetadata)3 SearchJobsRequest (com.google.cloud.talent.v4beta1.SearchJobsRequest)3 Company (com.google.cloud.talent.v4beta1.Company)2 CompanyServiceClient (com.google.cloud.talent.v4beta1.CompanyServiceClient)2 CreateJobRequest (com.google.cloud.talent.v4beta1.CreateJobRequest)2 BatchDeleteJobsRequest (com.google.cloud.talent.v4beta1.BatchDeleteJobsRequest)1 ClientEvent (com.google.cloud.talent.v4beta1.ClientEvent)1 CommuteFilter (com.google.cloud.talent.v4beta1.CommuteFilter)1 CommuteMethod (com.google.cloud.talent.v4beta1.CommuteMethod)1 CompleteQueryRequest (com.google.cloud.talent.v4beta1.CompleteQueryRequest)1 CompleteQueryResponse (com.google.cloud.talent.v4beta1.CompleteQueryResponse)1 CompletionClient (com.google.cloud.talent.v4beta1.CompletionClient)1 CreateClientEventRequest (com.google.cloud.talent.v4beta1.CreateClientEventRequest)1 CreateCompanyRequest (com.google.cloud.talent.v4beta1.CreateCompanyRequest)1 EventServiceClient (com.google.cloud.talent.v4beta1.EventServiceClient)1 HistogramQuery (com.google.cloud.talent.v4beta1.HistogramQuery)1 JobEvent (com.google.cloud.talent.v4beta1.JobEvent)1