@Generated(value="by gapic-generator") @BetaApi public class CompanyServiceClient extends Object implements BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Company company = Company.newBuilder().build();
Company response = companyServiceClient.createCompany(parent, company);
}
Note: close() needs to be called on the companyServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of CompanyServiceSettings to create(). For example:
To customize credentials:
CompanyServiceSettings companyServiceSettings =
CompanyServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
CompanyServiceClient companyServiceClient =
CompanyServiceClient.create(companyServiceSettings);
To customize the endpoint:
CompanyServiceSettings companyServiceSettings =
CompanyServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
CompanyServiceClient companyServiceClient =
CompanyServiceClient.create(companyServiceSettings);
Modifier and Type | Class and Description |
---|---|
static class |
CompanyServiceClient.ListCompaniesFixedSizeCollection |
static class |
CompanyServiceClient.ListCompaniesPage |
static class |
CompanyServiceClient.ListCompaniesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
CompanyServiceClient(CompanyServiceSettings settings)
Constructs an instance of CompanyServiceClient, using the given settings.
|
protected |
CompanyServiceClient(CompanyServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static CompanyServiceClient |
create()
Constructs an instance of CompanyServiceClient with default settings.
|
static CompanyServiceClient |
create(CompanyServiceSettings settings)
Constructs an instance of CompanyServiceClient, using the given settings.
|
static CompanyServiceClient |
create(CompanyServiceStub stub)
Constructs an instance of CompanyServiceClient, using the given stub for making calls.
|
com.google.cloud.talent.v4beta1.Company |
createCompany(com.google.cloud.talent.v4beta1.CreateCompanyRequest request)
Creates a new company entity.
|
com.google.cloud.talent.v4beta1.Company |
createCompany(String parent,
com.google.cloud.talent.v4beta1.Company company)
Creates a new company entity.
|
com.google.cloud.talent.v4beta1.Company |
createCompany(com.google.cloud.talent.v4beta1.TenantOrProjectName parent,
com.google.cloud.talent.v4beta1.Company company)
Creates a new company entity.
|
UnaryCallable<com.google.cloud.talent.v4beta1.CreateCompanyRequest,com.google.cloud.talent.v4beta1.Company> |
createCompanyCallable()
Creates a new company entity.
|
void |
deleteCompany(com.google.cloud.talent.v4beta1.CompanyName name)
Deletes specified company.
|
void |
deleteCompany(com.google.cloud.talent.v4beta1.DeleteCompanyRequest request)
Deletes specified company.
|
void |
deleteCompany(String name)
Deletes specified company.
|
UnaryCallable<com.google.cloud.talent.v4beta1.DeleteCompanyRequest,Empty> |
deleteCompanyCallable()
Deletes specified company.
|
com.google.cloud.talent.v4beta1.Company |
getCompany(com.google.cloud.talent.v4beta1.CompanyName name)
Retrieves specified company.
|
com.google.cloud.talent.v4beta1.Company |
getCompany(com.google.cloud.talent.v4beta1.GetCompanyRequest request)
Retrieves specified company.
|
com.google.cloud.talent.v4beta1.Company |
getCompany(String name)
Retrieves specified company.
|
UnaryCallable<com.google.cloud.talent.v4beta1.GetCompanyRequest,com.google.cloud.talent.v4beta1.Company> |
getCompanyCallable()
Retrieves specified company.
|
CompanyServiceSettings |
getSettings() |
CompanyServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
CompanyServiceClient.ListCompaniesPagedResponse |
listCompanies(com.google.cloud.talent.v4beta1.ListCompaniesRequest request)
Lists all companies associated with the project.
|
CompanyServiceClient.ListCompaniesPagedResponse |
listCompanies(String parent)
Lists all companies associated with the project.
|
CompanyServiceClient.ListCompaniesPagedResponse |
listCompanies(com.google.cloud.talent.v4beta1.TenantOrProjectName parent)
Lists all companies associated with the project.
|
UnaryCallable<com.google.cloud.talent.v4beta1.ListCompaniesRequest,com.google.cloud.talent.v4beta1.ListCompaniesResponse> |
listCompaniesCallable()
Lists all companies associated with the project.
|
UnaryCallable<com.google.cloud.talent.v4beta1.ListCompaniesRequest,CompanyServiceClient.ListCompaniesPagedResponse> |
listCompaniesPagedCallable()
Lists all companies associated with the project.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.cloud.talent.v4beta1.Company |
updateCompany(com.google.cloud.talent.v4beta1.Company company)
Updates specified company.
|
com.google.cloud.talent.v4beta1.Company |
updateCompany(com.google.cloud.talent.v4beta1.UpdateCompanyRequest request)
Updates specified company.
|
UnaryCallable<com.google.cloud.talent.v4beta1.UpdateCompanyRequest,com.google.cloud.talent.v4beta1.Company> |
updateCompanyCallable()
Updates specified company.
|
protected CompanyServiceClient(CompanyServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected CompanyServiceClient(CompanyServiceStub stub)
public static final CompanyServiceClient create() throws IOException
IOException
public static final CompanyServiceClient create(CompanyServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final CompanyServiceClient create(CompanyServiceStub stub)
public final CompanyServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public CompanyServiceStub getStub()
public final com.google.cloud.talent.v4beta1.Company createCompany(com.google.cloud.talent.v4beta1.TenantOrProjectName parent, com.google.cloud.talent.v4beta1.Company company)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Company company = Company.newBuilder().build();
Company response = companyServiceClient.createCompany(parent, company);
}
parent
- Required.
Resource name of the tenant under which the company is created.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo".
Tenant id is optional and a default tenant is created if unspecified, for example, "projects/api-test-project".
company
- Required.
The company to be created.
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Company createCompany(String parent, com.google.cloud.talent.v4beta1.Company company)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Company company = Company.newBuilder().build();
Company response = companyServiceClient.createCompany(parent.toString(), company);
}
parent
- Required.
Resource name of the tenant under which the company is created.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo".
Tenant id is optional and a default tenant is created if unspecified, for example, "projects/api-test-project".
company
- Required.
The company to be created.
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Company createCompany(com.google.cloud.talent.v4beta1.CreateCompanyRequest request)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Company company = Company.newBuilder().build();
CreateCompanyRequest request = CreateCompanyRequest.newBuilder()
.setParent(parent.toString())
.setCompany(company)
.build();
Company response = companyServiceClient.createCompany(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.CreateCompanyRequest,com.google.cloud.talent.v4beta1.Company> createCompanyCallable()
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Company company = Company.newBuilder().build();
CreateCompanyRequest request = CreateCompanyRequest.newBuilder()
.setParent(parent.toString())
.setCompany(company)
.build();
ApiFuture<Company> future = companyServiceClient.createCompanyCallable().futureCall(request);
// Do something
Company response = future.get();
}
public final com.google.cloud.talent.v4beta1.Company getCompany(com.google.cloud.talent.v4beta1.CompanyName name)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
CompanyName name = CompanyOldName.of("[PROJECT]", "[COMPANY]");
Company response = companyServiceClient.getCompany(name);
}
name
- Required.
The resource name of the company to be retrieved.
The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/api-test-project/tenants/foo/companies/bar".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project/companies/bar".
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Company getCompany(String name)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
CompanyName name = CompanyOldName.of("[PROJECT]", "[COMPANY]");
Company response = companyServiceClient.getCompany(name.toString());
}
name
- Required.
The resource name of the company to be retrieved.
The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/api-test-project/tenants/foo/companies/bar".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project/companies/bar".
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Company getCompany(com.google.cloud.talent.v4beta1.GetCompanyRequest request)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
CompanyName name = CompanyOldName.of("[PROJECT]", "[COMPANY]");
GetCompanyRequest request = GetCompanyRequest.newBuilder()
.setName(name.toString())
.build();
Company response = companyServiceClient.getCompany(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.GetCompanyRequest,com.google.cloud.talent.v4beta1.Company> getCompanyCallable()
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
CompanyName name = CompanyOldName.of("[PROJECT]", "[COMPANY]");
GetCompanyRequest request = GetCompanyRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Company> future = companyServiceClient.getCompanyCallable().futureCall(request);
// Do something
Company response = future.get();
}
public final com.google.cloud.talent.v4beta1.Company updateCompany(com.google.cloud.talent.v4beta1.Company company)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
Company company = Company.newBuilder().build();
Company response = companyServiceClient.updateCompany(company);
}
company
- Required.
The company resource to replace the current resource in the system.
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Company updateCompany(com.google.cloud.talent.v4beta1.UpdateCompanyRequest request)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
Company company = Company.newBuilder().build();
UpdateCompanyRequest request = UpdateCompanyRequest.newBuilder()
.setCompany(company)
.build();
Company response = companyServiceClient.updateCompany(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.UpdateCompanyRequest,com.google.cloud.talent.v4beta1.Company> updateCompanyCallable()
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
Company company = Company.newBuilder().build();
UpdateCompanyRequest request = UpdateCompanyRequest.newBuilder()
.setCompany(company)
.build();
ApiFuture<Company> future = companyServiceClient.updateCompanyCallable().futureCall(request);
// Do something
Company response = future.get();
}
public final void deleteCompany(com.google.cloud.talent.v4beta1.CompanyName name)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
CompanyName name = CompanyOldName.of("[PROJECT]", "[COMPANY]");
companyServiceClient.deleteCompany(name);
}
name
- Required.
The resource name of the company to be deleted.
The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/api-test-project/tenants/foo/companies/bar".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project/companies/bar".
ApiException
- if the remote call failspublic final void deleteCompany(String name)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
CompanyName name = CompanyOldName.of("[PROJECT]", "[COMPANY]");
companyServiceClient.deleteCompany(name.toString());
}
name
- Required.
The resource name of the company to be deleted.
The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/api-test-project/tenants/foo/companies/bar".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project/companies/bar".
ApiException
- if the remote call failspublic final void deleteCompany(com.google.cloud.talent.v4beta1.DeleteCompanyRequest request)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
CompanyName name = CompanyOldName.of("[PROJECT]", "[COMPANY]");
DeleteCompanyRequest request = DeleteCompanyRequest.newBuilder()
.setName(name.toString())
.build();
companyServiceClient.deleteCompany(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.DeleteCompanyRequest,Empty> deleteCompanyCallable()
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
CompanyName name = CompanyOldName.of("[PROJECT]", "[COMPANY]");
DeleteCompanyRequest request = DeleteCompanyRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = companyServiceClient.deleteCompanyCallable().futureCall(request);
// Do something
future.get();
}
public final CompanyServiceClient.ListCompaniesPagedResponse listCompanies(com.google.cloud.talent.v4beta1.TenantOrProjectName parent)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
for (Company element : companyServiceClient.listCompanies(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required.
Resource name of the tenant under which the company is created.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project".
ApiException
- if the remote call failspublic final CompanyServiceClient.ListCompaniesPagedResponse listCompanies(String parent)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
for (Company element : companyServiceClient.listCompanies(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required.
Resource name of the tenant under which the company is created.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo".
Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project".
ApiException
- if the remote call failspublic final CompanyServiceClient.ListCompaniesPagedResponse listCompanies(com.google.cloud.talent.v4beta1.ListCompaniesRequest request)
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
ListCompaniesRequest request = ListCompaniesRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Company element : companyServiceClient.listCompanies(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.ListCompaniesRequest,CompanyServiceClient.ListCompaniesPagedResponse> listCompaniesPagedCallable()
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
ListCompaniesRequest request = ListCompaniesRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListCompaniesPagedResponse> future = companyServiceClient.listCompaniesPagedCallable().futureCall(request);
// Do something
for (Company element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.talent.v4beta1.ListCompaniesRequest,com.google.cloud.talent.v4beta1.ListCompaniesResponse> listCompaniesCallable()
Sample code:
try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
ListCompaniesRequest request = ListCompaniesRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
ListCompaniesResponse response = companyServiceClient.listCompaniesCallable().call(request);
for (Company element : response.getCompaniesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.