Reference documentation and code samples for the Google Cloud Talent Solution V4 Client class JobServiceClient.
Service Description: A service handles job management, including job CRUD, enumeration and search.
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:
$jobServiceClient = new JobServiceClient();
try {
$formattedParent = $jobServiceClient->tenantName('[PROJECT]', '[TENANT]');
$jobs = [];
$operationResponse = $jobServiceClient->batchCreateJobs($formattedParent, $jobs);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $jobServiceClient->batchCreateJobs($formattedParent, $jobs);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $jobServiceClient->resumeOperation($operationName, 'batchCreateJobs');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$jobServiceClient->close();
}
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 parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
Methods
companyName
Formats a string containing the fully-qualified path to represent a company resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
tenant |
string
|
company |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted company resource. |
jobName
Formats a string containing the fully-qualified path to represent a job resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
tenant |
string
|
job |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted job resource. |
tenantName
Formats a string containing the fully-qualified path to represent a tenant resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
tenant |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted tenant resource. |
parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- company: projects/{project}/tenants/{tenant}/companies/{company}
- job: projects/{project}/tenants/{tenant}/jobs/{job}
- tenant: projects/{project}/tenants/{tenant}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
Parameters | |
---|---|
Name | Description |
formattedName |
string
The formatted name string |
template |
string
Optional name of template to match |
Returns | |
---|---|
Type | Description |
array | An associative array from name component IDs to component values. |
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
Returns | |
---|---|
Type | Description |
Google\ApiCore\LongRunning\OperationsClient |
resumeOperation
Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.
Parameters | |
---|---|
Name | Description |
operationName |
string
The name of the long running operation |
methodName |
string
The name of the method used to start the operation |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
options |
array
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
batchCreateJobs
Begins executing a batch create jobs operation.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
jobs |
array<Google\Cloud\Talent\V4\Job>
Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Talent\V4\BatchCreateJobsResponse;
use Google\Cloud\Talent\V4\Job;
use Google\Cloud\Talent\V4\JobServiceClient;
use Google\Rpc\Status;
/**
* @param string $formattedParent The resource name of the tenant under which the job is created.
*
* The format is "projects/{project_id}/tenants/{tenant_id}". For example,
* "projects/foo/tenants/bar". Please see
* {@see JobServiceClient::tenantName()} for help formatting this field.
* @param string $formattedJobsCompany The resource name of the company listing the job.
*
* The format is
* "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For
* example, "projects/foo/tenants/bar/companies/baz". Please see
* {@see JobServiceClient::companyName()} for help formatting this field.
* @param string $jobsRequisitionId The requisition ID, also referred to as the posting ID, is
* assigned by the client to identify a job. This field is intended to be used
* by clients for client identification and tracking of postings. A job isn't
* allowed to be created if there is another job with the same
* [company][google.cloud.talent.v4.Job.name],
* [language_code][google.cloud.talent.v4.Job.language_code] and
* [requisition_id][google.cloud.talent.v4.Job.requisition_id].
*
* The maximum number of allowed characters is 255.
* @param string $jobsTitle The title of the job, such as "Software Engineer"
*
* The maximum number of allowed characters is 500.
* @param string $jobsDescription The description of the job, which typically includes a
* multi-paragraph description of the company and related information.
* Separate fields are provided on the job object for
* [responsibilities][google.cloud.talent.v4.Job.responsibilities],
* [qualifications][google.cloud.talent.v4.Job.qualifications], and other job
* characteristics. Use of these separate job fields is recommended.
*
* This field accepts and sanitizes HTML input, and also accepts
* bold, italic, ordered list, and unordered list markup tags.
*
* The maximum number of allowed characters is 100,000.
*/
function batch_create_jobs_sample(
string $formattedParent,
string $formattedJobsCompany,
string $jobsRequisitionId,
string $jobsTitle,
string $jobsDescription
): void {
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare any non-scalar elements to be passed along with the request.
$job = (new Job())
->setCompany($formattedJobsCompany)
->setRequisitionId($jobsRequisitionId)
->setTitle($jobsTitle)
->setDescription($jobsDescription);
$jobs = [$job,];
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $jobServiceClient->batchCreateJobs($formattedParent, $jobs);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var BatchCreateJobsResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::tenantName('[PROJECT]', '[TENANT]');
$formattedJobsCompany = JobServiceClient::companyName('[PROJECT]', '[TENANT]', '[COMPANY]');
$jobsRequisitionId = '[REQUISITION_ID]';
$jobsTitle = '[TITLE]';
$jobsDescription = '[DESCRIPTION]';
batch_create_jobs_sample(
$formattedParent,
$formattedJobsCompany,
$jobsRequisitionId,
$jobsTitle,
$jobsDescription
);
}
batchDeleteJobs
Begins executing a batch delete jobs operation.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". The parent of all of the jobs specified in |
optionalArgs |
array
Optional. |
↳ names |
string[]
The names of the jobs to delete. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". A maximum of 200 jobs can be deleted in a batch. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Talent\V4\BatchDeleteJobsResponse;
use Google\Cloud\Talent\V4\JobServiceClient;
use Google\Rpc\Status;
/**
* @param string $formattedParent The resource name of the tenant under which the job is created.
*
* The format is "projects/{project_id}/tenants/{tenant_id}". For example,
* "projects/foo/tenants/bar".
*
* The parent of all of the jobs specified in `names` must match this field. Please see
* {@see JobServiceClient::tenantName()} for help formatting this field.
*/
function batch_delete_jobs_sample(string $formattedParent): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $jobServiceClient->batchDeleteJobs($formattedParent);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var BatchDeleteJobsResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::tenantName('[PROJECT]', '[TENANT]');
batch_delete_jobs_sample($formattedParent);
}
batchUpdateJobs
Begins executing a batch update jobs operation.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
jobs |
array<Google\Cloud\Talent\V4\Job>
Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Strongly recommended for the best service experience. Be aware that it will also increase latency when checking the status of a batch operation. If update_mask is provided, only the specified fields in Job are updated. Otherwise all the fields are updated. A field mask to restrict the fields that are updated. Only top level fields of Job are supported. If update_mask is provided, The Job inside JobResult will only contains fields that is updated, plus the Id of the Job. Otherwise, Job will include all fields, which can yield a very large response. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Talent\V4\BatchUpdateJobsResponse;
use Google\Cloud\Talent\V4\Job;
use Google\Cloud\Talent\V4\JobServiceClient;
use Google\Rpc\Status;
/**
* @param string $formattedParent The resource name of the tenant under which the job is created.
*
* The format is "projects/{project_id}/tenants/{tenant_id}". For example,
* "projects/foo/tenants/bar". Please see
* {@see JobServiceClient::tenantName()} for help formatting this field.
* @param string $formattedJobsCompany The resource name of the company listing the job.
*
* The format is
* "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For
* example, "projects/foo/tenants/bar/companies/baz". Please see
* {@see JobServiceClient::companyName()} for help formatting this field.
* @param string $jobsRequisitionId The requisition ID, also referred to as the posting ID, is
* assigned by the client to identify a job. This field is intended to be used
* by clients for client identification and tracking of postings. A job isn't
* allowed to be created if there is another job with the same
* [company][google.cloud.talent.v4.Job.name],
* [language_code][google.cloud.talent.v4.Job.language_code] and
* [requisition_id][google.cloud.talent.v4.Job.requisition_id].
*
* The maximum number of allowed characters is 255.
* @param string $jobsTitle The title of the job, such as "Software Engineer"
*
* The maximum number of allowed characters is 500.
* @param string $jobsDescription The description of the job, which typically includes a
* multi-paragraph description of the company and related information.
* Separate fields are provided on the job object for
* [responsibilities][google.cloud.talent.v4.Job.responsibilities],
* [qualifications][google.cloud.talent.v4.Job.qualifications], and other job
* characteristics. Use of these separate job fields is recommended.
*
* This field accepts and sanitizes HTML input, and also accepts
* bold, italic, ordered list, and unordered list markup tags.
*
* The maximum number of allowed characters is 100,000.
*/
function batch_update_jobs_sample(
string $formattedParent,
string $formattedJobsCompany,
string $jobsRequisitionId,
string $jobsTitle,
string $jobsDescription
): void {
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare any non-scalar elements to be passed along with the request.
$job = (new Job())
->setCompany($formattedJobsCompany)
->setRequisitionId($jobsRequisitionId)
->setTitle($jobsTitle)
->setDescription($jobsDescription);
$jobs = [$job,];
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $jobServiceClient->batchUpdateJobs($formattedParent, $jobs);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var BatchUpdateJobsResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::tenantName('[PROJECT]', '[TENANT]');
$formattedJobsCompany = JobServiceClient::companyName('[PROJECT]', '[TENANT]', '[COMPANY]');
$jobsRequisitionId = '[REQUISITION_ID]';
$jobsTitle = '[TITLE]';
$jobsDescription = '[DESCRIPTION]';
batch_update_jobs_sample(
$formattedParent,
$formattedJobsCompany,
$jobsRequisitionId,
$jobsTitle,
$jobsDescription
);
}
createJob
Creates a new job.
Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
job |
Google\Cloud\Talent\V4\Job
Required. The Job to be created. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Talent\V4\Job |
use Google\ApiCore\ApiException;
use Google\Cloud\Talent\V4\Job;
use Google\Cloud\Talent\V4\JobServiceClient;
/**
* @param string $formattedParent The resource name of the tenant under which the job is created.
*
* The format is "projects/{project_id}/tenants/{tenant_id}". For example,
* "projects/foo/tenants/bar". Please see
* {@see JobServiceClient::tenantName()} for help formatting this field.
* @param string $formattedJobCompany The resource name of the company listing the job.
*
* The format is
* "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For
* example, "projects/foo/tenants/bar/companies/baz". Please see
* {@see JobServiceClient::companyName()} for help formatting this field.
* @param string $jobRequisitionId The requisition ID, also referred to as the posting ID, is
* assigned by the client to identify a job. This field is intended to be used
* by clients for client identification and tracking of postings. A job isn't
* allowed to be created if there is another job with the same
* [company][google.cloud.talent.v4.Job.name],
* [language_code][google.cloud.talent.v4.Job.language_code] and
* [requisition_id][google.cloud.talent.v4.Job.requisition_id].
*
* The maximum number of allowed characters is 255.
* @param string $jobTitle The title of the job, such as "Software Engineer"
*
* The maximum number of allowed characters is 500.
* @param string $jobDescription The description of the job, which typically includes a
* multi-paragraph description of the company and related information.
* Separate fields are provided on the job object for
* [responsibilities][google.cloud.talent.v4.Job.responsibilities],
* [qualifications][google.cloud.talent.v4.Job.qualifications], and other job
* characteristics. Use of these separate job fields is recommended.
*
* This field accepts and sanitizes HTML input, and also accepts
* bold, italic, ordered list, and unordered list markup tags.
*
* The maximum number of allowed characters is 100,000.
*/
function create_job_sample(
string $formattedParent,
string $formattedJobCompany,
string $jobRequisitionId,
string $jobTitle,
string $jobDescription
): void {
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare any non-scalar elements to be passed along with the request.
$job = (new Job())
->setCompany($formattedJobCompany)
->setRequisitionId($jobRequisitionId)
->setTitle($jobTitle)
->setDescription($jobDescription);
// Call the API and handle any network failures.
try {
/** @var Job $response */
$response = $jobServiceClient->createJob($formattedParent, $job);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::tenantName('[PROJECT]', '[TENANT]');
$formattedJobCompany = JobServiceClient::companyName('[PROJECT]', '[TENANT]', '[COMPANY]');
$jobRequisitionId = '[REQUISITION_ID]';
$jobTitle = '[TITLE]';
$jobDescription = '[DESCRIPTION]';
create_job_sample(
$formattedParent,
$formattedJobCompany,
$jobRequisitionId,
$jobTitle,
$jobDescription
);
}
deleteJob
Deletes the specified job.
Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The resource name of the job to be deleted. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\Talent\V4\JobServiceClient;
/**
* @param string $formattedName The resource name of the job to be deleted.
*
* The format is
* "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For
* example, "projects/foo/tenants/bar/jobs/baz". Please see
* {@see JobServiceClient::jobName()} for help formatting this field.
*/
function delete_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Call the API and handle any network failures.
try {
$jobServiceClient->deleteJob($formattedName);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::jobName('[PROJECT]', '[TENANT]', '[JOB]');
delete_job_sample($formattedName);
}
getJob
Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The resource name of the job to retrieve. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Talent\V4\Job |
use Google\ApiCore\ApiException;
use Google\Cloud\Talent\V4\Job;
use Google\Cloud\Talent\V4\JobServiceClient;
/**
* @param string $formattedName The resource name of the job to retrieve.
*
* The format is
* "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For
* example, "projects/foo/tenants/bar/jobs/baz". Please see
* {@see JobServiceClient::jobName()} for help formatting this field.
*/
function get_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Call the API and handle any network failures.
try {
/** @var Job $response */
$response = $jobServiceClient->getJob($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::jobName('[PROJECT]', '[TENANT]', '[JOB]');
get_job_sample($formattedName);
}
listJobs
Lists jobs by filter.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
filter |
string
Required. The filter string specifies the jobs to be enumerated. Supported operator: =, AND The fields eligible for filtering are:
At least one of Sample Query:
|
optionalArgs |
array
Optional. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ jobView |
int
The desired job attributes returned for jobs in the search response. Defaults to JobView.JOB_VIEW_FULL if no value is specified. For allowed values, use constants defined on Google\Cloud\Talent\V4\JobView |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Talent\V4\Job;
use Google\Cloud\Talent\V4\JobServiceClient;
/**
* @param string $formattedParent The resource name of the tenant under which the job is created.
*
* The format is "projects/{project_id}/tenants/{tenant_id}". For example,
* "projects/foo/tenants/bar". Please see
* {@see JobServiceClient::tenantName()} for help formatting this field.
* @param string $filter The filter string specifies the jobs to be enumerated.
*
* Supported operator: =, AND
*
* The fields eligible for filtering are:
*
* * `companyName`
* * `requisitionId`
* * `status` Available values: OPEN, EXPIRED, ALL. Defaults to
* OPEN if no value is specified.
*
* At least one of `companyName` and `requisitionId` must present or an
* INVALID_ARGUMENT error is thrown.
*
* Sample Query:
*
* * companyName = "projects/foo/tenants/bar/companies/baz"
* * companyName = "projects/foo/tenants/bar/companies/baz" AND
* requisitionId = "req-1"
* * companyName = "projects/foo/tenants/bar/companies/baz" AND
* status = "EXPIRED"
* * requisitionId = "req-1"
* * requisitionId = "req-1" AND status = "EXPIRED"
*/
function list_jobs_sample(string $formattedParent, string $filter): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $jobServiceClient->listJobs($formattedParent, $filter);
/** @var Job $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::tenantName('[PROJECT]', '[TENANT]');
$filter = '[FILTER]';
list_jobs_sample($formattedParent, $filter);
}
searchJobs
Searches for jobs using the provided SearchJobsRequest.
This call constrains the visibility of jobs present in the database, and only returns jobs that the caller has permission to search against.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the tenant to search within. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
requestMetadata |
Google\Cloud\Talent\V4\RequestMetadata
Required. The meta information collected about the job searcher, used to
improve the search quality of the service. The identifiers (such as
|
optionalArgs |
array
Optional. |
↳ searchMode |
int
Mode of a search. Defaults to SearchMode.JOB_SEARCH. For allowed values, use constants defined on Google\Cloud\Talent\V4\SearchJobsRequest\SearchMode |
↳ jobQuery |
JobQuery
Query used to search against jobs, such as keyword, location filters, etc. |
↳ enableBroadening |
bool
Controls whether to broaden the search when it produces sparse results. Broadened queries append results to the end of the matching results list. Defaults to false. |
↳ histogramQueries |
HistogramQuery[]
An expression specifies a histogram request against matching jobs. Expression syntax is an aggregation function call with histogram facets and other options. Available aggregation function calls are: * |
↳ jobView |
int
The desired job attributes returned for jobs in the search response. Defaults to JobView.JOB_VIEW_SMALL if no value is specified. For allowed values, use constants defined on Google\Cloud\Talent\V4\JobView |
↳ offset |
int
An integer that specifies the current offset (that is, starting result location, amongst the jobs deemed by the API as relevant) in search results. This field is only considered if page_token is unset. The maximum allowed value is 5000. Otherwise an error is thrown. For example, 0 means to return results starting from the first matching job, and 10 means to return from the 11th job. This can be used for pagination, (for example, pageSize = 10 and offset = 10 means to return from the second page). |
↳ maxPageSize |
int
A limit on the number of jobs returned in the search results. Increasing this value above the default value of 10 can increase search response time. The value can be between 1 and 100. |
↳ pageToken |
string
The token specifying the current offset within search results. See SearchJobsResponse.next_page_token for an explanation of how to obtain the next set of query results. |
↳ orderBy |
string
The criteria determining how search results are sorted. Default is |
↳ diversificationLevel |
int
Controls whether highly similar jobs are returned next to each other in the search results. Jobs are identified as highly similar based on their titles, job categories, and locations. Highly similar results are clustered so that only one representative job of the cluster is displayed to the job seeker higher up in the results, with the other jobs being displayed lower down in the results. Defaults to DiversificationLevel.SIMPLE if no value is specified. For allowed values, use constants defined on Google\Cloud\Talent\V4\SearchJobsRequest\DiversificationLevel |
↳ customRankingInfo |
CustomRankingInfo
Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm). |
↳ disableKeywordMatch |
bool
This field is deprecated. Please use SearchJobsRequest.keyword_match_mode going forward. To migrate, disable_keyword_match set to false maps to KeywordMatchMode.KEYWORD_MATCH_ALL, and disable_keyword_match set to true maps to KeywordMatchMode.KEYWORD_MATCH_DISABLED. If SearchJobsRequest.keyword_match_mode is set, this field is ignored. Controls whether to disable exact keyword match on Job.title, Job.description, Job.company_display_name, Job.addresses, Job.qualifications. When disable keyword match is turned off, a keyword match returns jobs that do not match given category filters when there are matching keywords. For example, for the query "program manager," a result is returned even if the job posting has the title "software developer," which doesn't fall into "program manager" ontology, but does have "program manager" appearing in its description. For queries like "cloud" that don't contain title or location specific ontology, jobs with "cloud" keyword matches are returned regardless of this flag's value. Use Company.keyword_searchable_job_custom_attributes if company-specific globally matched custom field/attribute string values are needed. Enabling keyword match improves recall of subsequent search requests. Defaults to false. |
↳ keywordMatchMode |
int
Controls what keyword match options to use. If both keyword_match_mode and disable_keyword_match are set, keyword_match_mode will take precedence. Defaults to KeywordMatchMode.KEYWORD_MATCH_ALL if no value is specified. For allowed values, use constants defined on Google\Cloud\Talent\V4\SearchJobsRequest\KeywordMatchMode |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Talent\V4\SearchJobsResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Talent\V4\JobServiceClient;
use Google\Cloud\Talent\V4\RequestMetadata;
use Google\Cloud\Talent\V4\SearchJobsResponse;
/**
* @param string $formattedParent The resource name of the tenant to search within.
*
* The format is "projects/{project_id}/tenants/{tenant_id}". For example,
* "projects/foo/tenants/bar". Please see
* {@see JobServiceClient::tenantName()} for help formatting this field.
*/
function search_jobs_sample(string $formattedParent): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare any non-scalar elements to be passed along with the request.
$requestMetadata = new RequestMetadata();
// Call the API and handle any network failures.
try {
/** @var SearchJobsResponse $response */
$response = $jobServiceClient->searchJobs($formattedParent, $requestMetadata);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::tenantName('[PROJECT]', '[TENANT]');
search_jobs_sample($formattedParent);
}
searchJobsForAlert
Searches for jobs using the provided SearchJobsRequest.
This API call is intended for the use case of targeting passive job seekers (for example, job seekers who have signed up to receive email alerts about potential job opportunities), it has different algorithmic adjustments that are designed to specifically target passive job seekers.
This call constrains the visibility of jobs present in the database, and only returns jobs the caller has permission to search against.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the tenant to search within. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
requestMetadata |
Google\Cloud\Talent\V4\RequestMetadata
Required. The meta information collected about the job searcher, used to
improve the search quality of the service. The identifiers (such as
|
optionalArgs |
array
Optional. |
↳ searchMode |
int
Mode of a search. Defaults to SearchMode.JOB_SEARCH. For allowed values, use constants defined on Google\Cloud\Talent\V4\SearchJobsRequest\SearchMode |
↳ jobQuery |
JobQuery
Query used to search against jobs, such as keyword, location filters, etc. |
↳ enableBroadening |
bool
Controls whether to broaden the search when it produces sparse results. Broadened queries append results to the end of the matching results list. Defaults to false. |
↳ histogramQueries |
HistogramQuery[]
An expression specifies a histogram request against matching jobs. Expression syntax is an aggregation function call with histogram facets and other options. Available aggregation function calls are: * |
↳ jobView |
int
The desired job attributes returned for jobs in the search response. Defaults to JobView.JOB_VIEW_SMALL if no value is specified. For allowed values, use constants defined on Google\Cloud\Talent\V4\JobView |
↳ offset |
int
An integer that specifies the current offset (that is, starting result location, amongst the jobs deemed by the API as relevant) in search results. This field is only considered if page_token is unset. The maximum allowed value is 5000. Otherwise an error is thrown. For example, 0 means to return results starting from the first matching job, and 10 means to return from the 11th job. This can be used for pagination, (for example, pageSize = 10 and offset = 10 means to return from the second page). |
↳ maxPageSize |
int
A limit on the number of jobs returned in the search results. Increasing this value above the default value of 10 can increase search response time. The value can be between 1 and 100. |
↳ pageToken |
string
The token specifying the current offset within search results. See SearchJobsResponse.next_page_token for an explanation of how to obtain the next set of query results. |
↳ orderBy |
string
The criteria determining how search results are sorted. Default is |
↳ diversificationLevel |
int
Controls whether highly similar jobs are returned next to each other in the search results. Jobs are identified as highly similar based on their titles, job categories, and locations. Highly similar results are clustered so that only one representative job of the cluster is displayed to the job seeker higher up in the results, with the other jobs being displayed lower down in the results. Defaults to DiversificationLevel.SIMPLE if no value is specified. For allowed values, use constants defined on Google\Cloud\Talent\V4\SearchJobsRequest\DiversificationLevel |
↳ customRankingInfo |
CustomRankingInfo
Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm). |
↳ disableKeywordMatch |
bool
This field is deprecated. Please use SearchJobsRequest.keyword_match_mode going forward. To migrate, disable_keyword_match set to false maps to KeywordMatchMode.KEYWORD_MATCH_ALL, and disable_keyword_match set to true maps to KeywordMatchMode.KEYWORD_MATCH_DISABLED. If SearchJobsRequest.keyword_match_mode is set, this field is ignored. Controls whether to disable exact keyword match on Job.title, Job.description, Job.company_display_name, Job.addresses, Job.qualifications. When disable keyword match is turned off, a keyword match returns jobs that do not match given category filters when there are matching keywords. For example, for the query "program manager," a result is returned even if the job posting has the title "software developer," which doesn't fall into "program manager" ontology, but does have "program manager" appearing in its description. For queries like "cloud" that don't contain title or location specific ontology, jobs with "cloud" keyword matches are returned regardless of this flag's value. Use Company.keyword_searchable_job_custom_attributes if company-specific globally matched custom field/attribute string values are needed. Enabling keyword match improves recall of subsequent search requests. Defaults to false. |
↳ keywordMatchMode |
int
Controls what keyword match options to use. If both keyword_match_mode and disable_keyword_match are set, keyword_match_mode will take precedence. Defaults to KeywordMatchMode.KEYWORD_MATCH_ALL if no value is specified. For allowed values, use constants defined on Google\Cloud\Talent\V4\SearchJobsRequest\KeywordMatchMode |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Talent\V4\SearchJobsResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Talent\V4\JobServiceClient;
use Google\Cloud\Talent\V4\RequestMetadata;
use Google\Cloud\Talent\V4\SearchJobsResponse;
/**
* @param string $formattedParent The resource name of the tenant to search within.
*
* The format is "projects/{project_id}/tenants/{tenant_id}". For example,
* "projects/foo/tenants/bar". Please see
* {@see JobServiceClient::tenantName()} for help formatting this field.
*/
function search_jobs_for_alert_sample(string $formattedParent): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare any non-scalar elements to be passed along with the request.
$requestMetadata = new RequestMetadata();
// Call the API and handle any network failures.
try {
/** @var SearchJobsResponse $response */
$response = $jobServiceClient->searchJobsForAlert($formattedParent, $requestMetadata);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::tenantName('[PROJECT]', '[TENANT]');
search_jobs_for_alert_sample($formattedParent);
}
updateJob
Updates specified job.
Typically, updated contents become visible in search results within 10 seconds, but it may take up to 5 minutes.
Parameters | |
---|---|
Name | Description |
job |
Google\Cloud\Talent\V4\Job
Required. The Job to be updated. |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Strongly recommended for the best service experience. If update_mask is provided, only the specified fields in job are updated. Otherwise all the fields are updated. A field mask to restrict the fields that are updated. Only top level fields of Job are supported. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Talent\V4\Job |
use Google\ApiCore\ApiException;
use Google\Cloud\Talent\V4\Job;
use Google\Cloud\Talent\V4\JobServiceClient;
/**
* @param string $formattedJobCompany The resource name of the company listing the job.
*
* The format is
* "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For
* example, "projects/foo/tenants/bar/companies/baz". Please see
* {@see JobServiceClient::companyName()} for help formatting this field.
* @param string $jobRequisitionId The requisition ID, also referred to as the posting ID, is
* assigned by the client to identify a job. This field is intended to be used
* by clients for client identification and tracking of postings. A job isn't
* allowed to be created if there is another job with the same
* [company][google.cloud.talent.v4.Job.name],
* [language_code][google.cloud.talent.v4.Job.language_code] and
* [requisition_id][google.cloud.talent.v4.Job.requisition_id].
*
* The maximum number of allowed characters is 255.
* @param string $jobTitle The title of the job, such as "Software Engineer"
*
* The maximum number of allowed characters is 500.
* @param string $jobDescription The description of the job, which typically includes a
* multi-paragraph description of the company and related information.
* Separate fields are provided on the job object for
* [responsibilities][google.cloud.talent.v4.Job.responsibilities],
* [qualifications][google.cloud.talent.v4.Job.qualifications], and other job
* characteristics. Use of these separate job fields is recommended.
*
* This field accepts and sanitizes HTML input, and also accepts
* bold, italic, ordered list, and unordered list markup tags.
*
* The maximum number of allowed characters is 100,000.
*/
function update_job_sample(
string $formattedJobCompany,
string $jobRequisitionId,
string $jobTitle,
string $jobDescription
): void {
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare any non-scalar elements to be passed along with the request.
$job = (new Job())
->setCompany($formattedJobCompany)
->setRequisitionId($jobRequisitionId)
->setTitle($jobTitle)
->setDescription($jobDescription);
// Call the API and handle any network failures.
try {
/** @var Job $response */
$response = $jobServiceClient->updateJob($job);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedJobCompany = JobServiceClient::companyName('[PROJECT]', '[TENANT]', '[COMPANY]');
$jobRequisitionId = '[REQUISITION_ID]';
$jobTitle = '[TITLE]';
$jobDescription = '[DESCRIPTION]';
update_job_sample($formattedJobCompany, $jobRequisitionId, $jobTitle, $jobDescription);
}
Constants
SERVICE_NAME
Value: 'google.cloud.talent.v4.JobService'
The name of the service.
SERVICE_ADDRESS
Value: 'jobs.googleapis.com'
The default address of the service.
DEFAULT_SERVICE_PORT
Value: 443
The default port of the service.
CODEGEN_NAME
Value: 'gapic'
The name of the code generator, to be included in the agent header.