Search in sources :

Example 1 with CreateCompanyRequest

use of com.google.cloud.talent.v4beta1.CreateCompanyRequest in project java-docs-samples by GoogleCloudPlatform.

the class JobSearchCreateCompany method createCompany.

// Create a company.
public static void createCompany(String projectId, String tenantId, String displayName, String externalId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
        TenantName parent = TenantName.of(projectId, tenantId);
        Company company = Company.newBuilder().setDisplayName(displayName).setExternalId(externalId).build();
        CreateCompanyRequest request = CreateCompanyRequest.newBuilder().setParent(parent.toString()).setCompany(company).build();
        Company response = companyServiceClient.createCompany(request);
        System.out.println("Created Company");
        System.out.format("Name: %s%n", response.getName());
        System.out.format("Display Name: %s%n", response.getDisplayName());
        System.out.format("External ID: %s%n", response.getExternalId());
    }
}
Also used : CompanyServiceClient(com.google.cloud.talent.v4beta1.CompanyServiceClient) Company(com.google.cloud.talent.v4beta1.Company) CreateCompanyRequest(com.google.cloud.talent.v4beta1.CreateCompanyRequest) TenantName(com.google.cloud.talent.v4beta1.TenantName)

Aggregations

Company (com.google.cloud.talent.v4beta1.Company)1 CompanyServiceClient (com.google.cloud.talent.v4beta1.CompanyServiceClient)1 CreateCompanyRequest (com.google.cloud.talent.v4beta1.CreateCompanyRequest)1 TenantName (com.google.cloud.talent.v4beta1.TenantName)1