use of com.google.cloud.talent.v4beta1.CompanyServiceClient in project java-docs-samples by GoogleCloudPlatform.
the class JobSearchDeleteCompany method deleteCompany.
// Delete Company.
public static void deleteCompany(String projectId, String tenantId, String companyId) throws IOException {
// the "close" method on the client to safely clean up any remaining background resources.
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
CompanyName name = CompanyName.ofProjectTenantCompanyName(projectId, tenantId, companyId);
DeleteCompanyRequest request = DeleteCompanyRequest.newBuilder().setName(name.toString()).build();
companyServiceClient.deleteCompany(request);
System.out.println("Deleted company");
}
}
use of com.google.cloud.talent.v4beta1.CompanyServiceClient in project java-docs-samples by GoogleCloudPlatform.
the class JobSearchListCompanies method listCompanies.
// List Companies.
public static void listCompanies(String projectId, String tenantId) 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);
ListCompaniesRequest request = ListCompaniesRequest.newBuilder().setParent(parent.toString()).build();
for (Company responseItem : companyServiceClient.listCompanies(request).iterateAll()) {
System.out.format("Company Name: %s%n", responseItem.getName());
System.out.format("Display Name: %s%n", responseItem.getDisplayName());
System.out.format("External ID: %s%n", responseItem.getExternalId());
}
}
}
use of com.google.cloud.talent.v4beta1.CompanyServiceClient in project java-docs-samples by GoogleCloudPlatform.
the class JobSearchGetCompany method getCompany.
// Get Company.
public static void getCompany(String projectId, String tenantId, String companyId) throws IOException {
// the "close" method on the client to safely clean up any remaining background resources.
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
CompanyName name = CompanyName.ofProjectTenantCompanyName(projectId, tenantId, companyId);
GetCompanyRequest request = GetCompanyRequest.newBuilder().setName(name.toString()).build();
Company response = companyServiceClient.getCompany(request);
System.out.format("Company name: %s%n", response.getName());
System.out.format("Display name: %s%n", response.getDisplayName());
}
}
use of com.google.cloud.talent.v4beta1.CompanyServiceClient 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());
}
}
Aggregations