Google Cloud Talent Solution V4beta1 Client - Class JobServiceClient (1.1.1)

Reference documentation and code samples for the Google Cloud Talent Solution V4beta1 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->projectName('[PROJECT]');
    $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.

Namespace

Google \ Cloud \ Talent \ V4beta1

Methods

__construct

Constructor.

Parameters
NameDescription
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 false.

↳ 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 rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ 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
NameDescription
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/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".

jobs array<Google\Cloud\Talent\V4beta1\Job>

Required. The jobs 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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Talent\V4beta1\Job;
use Google\Cloud\Talent\V4beta1\JobOperationResult;
use Google\Cloud\Talent\V4beta1\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/tenant/bar". If tenant id is unspecified, a default tenant
 *                                     is created. For example, "projects/foo". Please see
 *                                     {@see JobServiceClient::projectName()} 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".
 *
 *                                     If tenant id is unspecified, the default tenant is used. For
 *                                     example, "projects/foo/companies/bar". 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.v4beta1.Job.name],
 *                                     [language_code][google.cloud.talent.v4beta1.Job.language_code] and
 *                                     [requisition_id][google.cloud.talent.v4beta1.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.v4beta1.Job.responsibilities],
 *                                     [qualifications][google.cloud.talent.v4beta1.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 JobOperationResult $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());
    }
}

/**
 * Helper to execute the sample.
 *
 * 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::projectName('[PROJECT]');
    $formattedJobsCompany = JobServiceClient::companyName('[PROJECT]', '[TENANT]', '[COMPANY]');
    $jobsRequisitionId = '[REQUISITION_ID]';
    $jobsTitle = '[TITLE]';
    $jobsDescription = '[DESCRIPTION]';

    batch_create_jobs_sample(
        $formattedParent,
        $formattedJobsCompany,
        $jobsRequisitionId,
        $jobsTitle,
        $jobsDescription
    );
}

batchDeleteJobs

Deletes a list of Jobs by filter.

Parameters
NameDescription
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/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".

filter string

Required. The filter string specifies the jobs to be deleted.

Supported operator: =, AND

The fields eligible for filtering are:

  • companyName (Required)
  • requisitionId (Required)

Sample Query: companyName = "projects/foo/companies/bar" AND requisitionId = "req-1"

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.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Talent\V4beta1\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/tenant/bar". If tenant id is unspecified, a default tenant
 *                                is created. For example, "projects/foo". Please see
 *                                {@see JobServiceClient::projectName()} for help formatting this field.
 * @param string $filter          The filter string specifies the jobs to be deleted.
 *
 *                                Supported operator: =, AND
 *
 *                                The fields eligible for filtering are:
 *
 *                                * `companyName` (Required)
 *                                * `requisitionId` (Required)
 *
 *                                Sample Query: companyName = "projects/foo/companies/bar" AND
 *                                requisitionId = "req-1"
 */
function batch_delete_jobs_sample(string $formattedParent, string $filter): void
{
    // Create a client.
    $jobServiceClient = new JobServiceClient();

    // Call the API and handle any network failures.
    try {
        $jobServiceClient->batchDeleteJobs($formattedParent, $filter);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * 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::projectName('[PROJECT]');
    $filter = '[FILTER]';

    batch_delete_jobs_sample($formattedParent, $filter);
}

batchUpdateJobs

Begins executing a batch update jobs operation.

Parameters
NameDescription
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/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".

jobs array<Google\Cloud\Talent\V4beta1\Job>

Required. The jobs to be updated.

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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Talent\V4beta1\Job;
use Google\Cloud\Talent\V4beta1\JobOperationResult;
use Google\Cloud\Talent\V4beta1\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/tenant/bar". If tenant id is unspecified, a default tenant
 *                                     is created. For example, "projects/foo". Please see
 *                                     {@see JobServiceClient::projectName()} 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".
 *
 *                                     If tenant id is unspecified, the default tenant is used. For
 *                                     example, "projects/foo/companies/bar". 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.v4beta1.Job.name],
 *                                     [language_code][google.cloud.talent.v4beta1.Job.language_code] and
 *                                     [requisition_id][google.cloud.talent.v4beta1.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.v4beta1.Job.responsibilities],
 *                                     [qualifications][google.cloud.talent.v4beta1.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 JobOperationResult $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());
    }
}

/**
 * Helper to execute the sample.
 *
 * 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::projectName('[PROJECT]');
    $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
NameDescription
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/tenant/bar". If tenant id is unspecified a default tenant is created. For example, "projects/foo".

job Google\Cloud\Talent\V4beta1\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
TypeDescription
Google\Cloud\Talent\V4beta1\Job
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Talent\V4beta1\Job;
use Google\Cloud\Talent\V4beta1\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/tenant/bar". If tenant id is unspecified a default tenant
 *                                    is created. For example, "projects/foo". Please see
 *                                    {@see JobServiceClient::projectName()} 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".
 *
 *                                    If tenant id is unspecified, the default tenant is used. For
 *                                    example, "projects/foo/companies/bar". 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.v4beta1.Job.name],
 *                                    [language_code][google.cloud.talent.v4beta1.Job.language_code] and
 *                                    [requisition_id][google.cloud.talent.v4beta1.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.v4beta1.Job.responsibilities],
 *                                    [qualifications][google.cloud.talent.v4beta1.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());
    }
}

/**
 * Helper to execute the sample.
 *
 * 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::projectName('[PROJECT]');
    $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
NameDescription
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".

If tenant id is unspecified, the default tenant is used. For example, "projects/foo/jobs/bar".

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.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Talent\V4beta1\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".
 *
 *                              If tenant id is unspecified, the default tenant is used. For
 *                              example, "projects/foo/jobs/bar". 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());
    }
}

/**
 * Helper to execute the sample.
 *
 * 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
NameDescription
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".

If tenant id is unspecified, the default tenant is used. For example, "projects/foo/jobs/bar".

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
TypeDescription
Google\Cloud\Talent\V4beta1\Job
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Talent\V4beta1\Job;
use Google\Cloud\Talent\V4beta1\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".
 *
 *                              If tenant id is unspecified, the default tenant is used. For
 *                              example, "projects/foo/jobs/bar". 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());
    }
}

/**
 * Helper to execute the sample.
 *
 * 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
NameDescription
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/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".

filter string

Required. 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"
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\V4beta1\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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Talent\V4beta1\Job;
use Google\Cloud\Talent\V4beta1\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/tenant/bar". If tenant id is unspecified, a default tenant
 *                                is created. For example, "projects/foo". Please see
 *                                {@see JobServiceClient::projectName()} 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());
    }
}

/**
 * Helper to execute the sample.
 *
 * 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::projectName('[PROJECT]');
    $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
NameDescription
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/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".

requestMetadata Google\Cloud\Talent\V4beta1\RequestMetadata

Required. The meta information collected about the job searcher, used to improve the search quality of the service. The identifiers (such as user_id) are provided by users, and must be unique and consistent.

optionalArgs array

Optional.

↳ searchMode int

Mode of a search. Defaults to SearchMode.JOB_SEARCH. For allowed values, use constants defined on Google\Cloud\Talent\V4beta1\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.

↳ requirePreciseResultSize bool

This field is deprecated.

↳ 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: * count(string_histogram_facet): Count the number of matching entities, for each distinct attribute value. * count(numeric_histogram_facet, list of buckets): Count the number of matching entities within each bucket. A maximum of 200 histogram buckets are supported. Data types: * Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9_]+. * String: string like "any string with backslash escape for quote(")." * Number: whole number and floating point number like 10, -1 and -0.01. * List: list of elements with comma(,) separator surrounded by square brackets, for example, [1, 2, 3] and ["one", "two", "three"]. Built-in constants: * MIN (minimum number similar to java Double.MIN_VALUE) * MAX (maximum number similar to java Double.MAX_VALUE) Built-in functions: * bucket(start, end[, label]): bucket built-in function creates a bucket with range of start, end). Note that the end is exclusive, for example, bucket(1, MAX, "positive number") or bucket(1, 10). Job histogram facets: * company_display_name: histogram by [Job.company_display_name. * employment_type: histogram by Job.employment_types, for example, "FULL_TIME", "PART_TIME". * company_size (DEPRECATED): histogram by CompanySize, for example, "SMALL", "MEDIUM", "BIG". * publish_time_in_day: histogram by the Job.posting_publish_time in days. Must specify list of numeric buckets in spec. * publish_time_in_month: histogram by the Job.posting_publish_time in months. Must specify list of numeric buckets in spec. * publish_time_in_year: histogram by the Job.posting_publish_time in years. Must specify list of numeric buckets in spec. * degree_types: histogram by the Job.degree_types, for example, "Bachelors", "Masters". * job_level: histogram by the Job.job_level, for example, "Entry Level". * country: histogram by the country code of jobs, for example, "US", "FR". * admin1: histogram by the admin1 code of jobs, which is a global placeholder referring to the state, province, or the particular term a country uses to define the geographic structure below the country level, for example, "CA", "IL". * city: histogram by a combination of the "city name, admin1 code". For example, "Mountain View, CA", "New York, NY". * admin1_country: histogram by a combination of the "admin1 code, country", for example, "CA, US", "IL, US". * city_coordinate: histogram by the city center's GPS coordinates (latitude and longitude), for example, 37.4038522,-122.0987765. Since the coordinates of a city center can change, customers may need to refresh them periodically. * locale: histogram by the Job.language_code, for example, "en-US", "fr-FR". * language: histogram by the language subtag of the Job.language_code, for example, "en", "fr". * category: histogram by the JobCategory, for example, "COMPUTER_AND_IT", "HEALTHCARE". * base_compensation_unit: histogram by the CompensationInfo.CompensationUnit of base salary, for example, "WEEKLY", "MONTHLY". * base_compensation: histogram by the base salary. Must specify list of numeric buckets to group results by. * annualized_base_compensation: histogram by the base annualized salary. Must specify list of numeric buckets to group results by. * annualized_total_compensation: histogram by the total annualized salary. Must specify list of numeric buckets to group results by. * string_custom_attribute: histogram by string Job.custom_attributes. Values can be accessed via square bracket notations like string_custom_attribute["key1"]. * numeric_custom_attribute: histogram by numeric Job.custom_attributes. Values can be accessed via square bracket notations like numeric_custom_attribute["key1"]. Must specify list of numeric buckets to group results by. Example expressions: * count(admin1) * count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), bucket(100000, MAX)]) * count(string_custom_attribute["some-string-custom-attribute"]) * count(numeric_custom_attribute["some-numeric-custom-attribute"], [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative")])

↳ 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\V4beta1\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).

↳ 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.

↳ 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.

↳ orderBy string

The criteria determining how search results are sorted. Default is "relevance desc". Supported options are: * "relevance desc": By relevance descending, as determined by the API algorithms. Relevance thresholding of query results is only available with this ordering. * "posting_publish_time desc": By Job.posting_publish_time descending. * "posting_update_time desc": By Job.posting_update_time descending. * "title": By Job.title ascending. * "title desc": By Job.title descending. * "annualized_base_compensation": By job's CompensationInfo.annualized_base_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results. * "annualized_base_compensation desc": By job's CompensationInfo.annualized_base_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results. * "annualized_total_compensation": By job's CompensationInfo.annualized_total_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results. * "annualized_total_compensation desc": By job's CompensationInfo.annualized_total_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results. * "custom_ranking desc": By the relevance score adjusted to the SearchJobsRequest.CustomRankingInfo.ranking_expression with weight factor assigned by SearchJobsRequest.CustomRankingInfo.importance_level in descending order. * Location sorting: Use the special syntax to order jobs by distance:
"distance_from('Hawaii')": Order by distance from Hawaii.
"distance_from(19.89, 155.5)": Order by distance from a coordinate.
"distance_from('Hawaii'), distance_from('Puerto Rico')": Order by multiple locations. See details below.
"distance_from('Hawaii'), distance_from(19.89, 155.5)": Order by multiple locations. See details below.
The string can have a maximum of 256 characters. When multiple distance centers are provided, a job that is close to any of the distance centers would have a high rank. When a job has multiple locations, the job location closest to one of the distance centers will be used. Jobs that don't have locations will be ranked at the bottom. Distance is calculated with a precision of 11.3 meters (37.4 feet). Diversification strategy is still applied unless explicitly disabled in diversification_level.

↳ 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\V4beta1\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. Defaults to KeywordMatchMode.KEYWORD_MATCH_ALL if no value is specified. For allowed values, use constants defined on Google\Cloud\Talent\V4beta1\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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Talent\V4beta1\JobServiceClient;
use Google\Cloud\Talent\V4beta1\RequestMetadata;
use Google\Cloud\Talent\V4beta1\SearchJobsResponse\MatchingJob;

/**
 * @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/tenant/bar". If tenant id is unspecified, a default tenant
 *                                is created. For example, "projects/foo". Please see
 *                                {@see JobServiceClient::projectName()} 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 PagedListResponse $response */
        $response = $jobServiceClient->searchJobs($formattedParent, $requestMetadata);

        /** @var MatchingJob $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());
    }
}

/**
 * Helper to execute the sample.
 *
 * 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::projectName('[PROJECT]');

    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), and has different algorithmic adjustments that are targeted to 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
NameDescription
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/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".

requestMetadata Google\Cloud\Talent\V4beta1\RequestMetadata

Required. The meta information collected about the job searcher, used to improve the search quality of the service. The identifiers (such as user_id) are provided by users, and must be unique and consistent.

optionalArgs array

Optional.

↳ searchMode int

Mode of a search. Defaults to SearchMode.JOB_SEARCH. For allowed values, use constants defined on Google\Cloud\Talent\V4beta1\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.

↳ requirePreciseResultSize bool

This field is deprecated.

↳ 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: * count(string_histogram_facet): Count the number of matching entities, for each distinct attribute value. * count(numeric_histogram_facet, list of buckets): Count the number of matching entities within each bucket. A maximum of 200 histogram buckets are supported. Data types: * Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9_]+. * String: string like "any string with backslash escape for quote(")." * Number: whole number and floating point number like 10, -1 and -0.01. * List: list of elements with comma(,) separator surrounded by square brackets, for example, [1, 2, 3] and ["one", "two", "three"]. Built-in constants: * MIN (minimum number similar to java Double.MIN_VALUE) * MAX (maximum number similar to java Double.MAX_VALUE) Built-in functions: * bucket(start, end[, label]): bucket built-in function creates a bucket with range of start, end). Note that the end is exclusive, for example, bucket(1, MAX, "positive number") or bucket(1, 10). Job histogram facets: * company_display_name: histogram by [Job.company_display_name. * employment_type: histogram by Job.employment_types, for example, "FULL_TIME", "PART_TIME". * company_size (DEPRECATED): histogram by CompanySize, for example, "SMALL", "MEDIUM", "BIG". * publish_time_in_day: histogram by the Job.posting_publish_time in days. Must specify list of numeric buckets in spec. * publish_time_in_month: histogram by the Job.posting_publish_time in months. Must specify list of numeric buckets in spec. * publish_time_in_year: histogram by the Job.posting_publish_time in years. Must specify list of numeric buckets in spec. * degree_types: histogram by the Job.degree_types, for example, "Bachelors", "Masters". * job_level: histogram by the Job.job_level, for example, "Entry Level". * country: histogram by the country code of jobs, for example, "US", "FR". * admin1: histogram by the admin1 code of jobs, which is a global placeholder referring to the state, province, or the particular term a country uses to define the geographic structure below the country level, for example, "CA", "IL". * city: histogram by a combination of the "city name, admin1 code". For example, "Mountain View, CA", "New York, NY". * admin1_country: histogram by a combination of the "admin1 code, country", for example, "CA, US", "IL, US". * city_coordinate: histogram by the city center's GPS coordinates (latitude and longitude), for example, 37.4038522,-122.0987765. Since the coordinates of a city center can change, customers may need to refresh them periodically. * locale: histogram by the Job.language_code, for example, "en-US", "fr-FR". * language: histogram by the language subtag of the Job.language_code, for example, "en", "fr". * category: histogram by the JobCategory, for example, "COMPUTER_AND_IT", "HEALTHCARE". * base_compensation_unit: histogram by the CompensationInfo.CompensationUnit of base salary, for example, "WEEKLY", "MONTHLY". * base_compensation: histogram by the base salary. Must specify list of numeric buckets to group results by. * annualized_base_compensation: histogram by the base annualized salary. Must specify list of numeric buckets to group results by. * annualized_total_compensation: histogram by the total annualized salary. Must specify list of numeric buckets to group results by. * string_custom_attribute: histogram by string Job.custom_attributes. Values can be accessed via square bracket notations like string_custom_attribute["key1"]. * numeric_custom_attribute: histogram by numeric Job.custom_attributes. Values can be accessed via square bracket notations like numeric_custom_attribute["key1"]. Must specify list of numeric buckets to group results by. Example expressions: * count(admin1) * count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), bucket(100000, MAX)]) * count(string_custom_attribute["some-string-custom-attribute"]) * count(numeric_custom_attribute["some-numeric-custom-attribute"], [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative")])

↳ 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\V4beta1\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).

↳ 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.

↳ 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.

↳ orderBy string

The criteria determining how search results are sorted. Default is "relevance desc". Supported options are: * "relevance desc": By relevance descending, as determined by the API algorithms. Relevance thresholding of query results is only available with this ordering. * "posting_publish_time desc": By Job.posting_publish_time descending. * "posting_update_time desc": By Job.posting_update_time descending. * "title": By Job.title ascending. * "title desc": By Job.title descending. * "annualized_base_compensation": By job's CompensationInfo.annualized_base_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results. * "annualized_base_compensation desc": By job's CompensationInfo.annualized_base_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results. * "annualized_total_compensation": By job's CompensationInfo.annualized_total_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results. * "annualized_total_compensation desc": By job's CompensationInfo.annualized_total_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results. * "custom_ranking desc": By the relevance score adjusted to the SearchJobsRequest.CustomRankingInfo.ranking_expression with weight factor assigned by SearchJobsRequest.CustomRankingInfo.importance_level in descending order. * Location sorting: Use the special syntax to order jobs by distance:
"distance_from('Hawaii')": Order by distance from Hawaii.
"distance_from(19.89, 155.5)": Order by distance from a coordinate.
"distance_from('Hawaii'), distance_from('Puerto Rico')": Order by multiple locations. See details below.
"distance_from('Hawaii'), distance_from(19.89, 155.5)": Order by multiple locations. See details below.
The string can have a maximum of 256 characters. When multiple distance centers are provided, a job that is close to any of the distance centers would have a high rank. When a job has multiple locations, the job location closest to one of the distance centers will be used. Jobs that don't have locations will be ranked at the bottom. Distance is calculated with a precision of 11.3 meters (37.4 feet). Diversification strategy is still applied unless explicitly disabled in diversification_level.

↳ 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\V4beta1\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. Defaults to KeywordMatchMode.KEYWORD_MATCH_ALL if no value is specified. For allowed values, use constants defined on Google\Cloud\Talent\V4beta1\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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Talent\V4beta1\JobServiceClient;
use Google\Cloud\Talent\V4beta1\RequestMetadata;
use Google\Cloud\Talent\V4beta1\SearchJobsResponse\MatchingJob;

/**
 * @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/tenant/bar". If tenant id is unspecified, a default tenant
 *                                is created. For example, "projects/foo". Please see
 *                                {@see JobServiceClient::projectName()} 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 PagedListResponse $response */
        $response = $jobServiceClient->searchJobsForAlert($formattedParent, $requestMetadata);

        /** @var MatchingJob $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());
    }
}

/**
 * Helper to execute the sample.
 *
 * 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::projectName('[PROJECT]');

    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
NameDescription
job Google\Cloud\Talent\V4beta1\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
TypeDescription
Google\Cloud\Talent\V4beta1\Job
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Talent\V4beta1\Job;
use Google\Cloud\Talent\V4beta1\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".
 *
 *                                    If tenant id is unspecified, the default tenant is used. For
 *                                    example, "projects/foo/companies/bar". 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.v4beta1.Job.name],
 *                                    [language_code][google.cloud.talent.v4beta1.Job.language_code] and
 *                                    [requisition_id][google.cloud.talent.v4beta1.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.v4beta1.Job.responsibilities],
 *                                    [qualifications][google.cloud.talent.v4beta1.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());
    }
}

/**
 * Helper to execute the sample.
 *
 * 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);
}

getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

Returns
TypeDescription
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
NameDescription
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
TypeDescription
Google\ApiCore\OperationResponse

static::companyName

Formats a string containing the fully-qualified path to represent a company resource.

Parameters
NameDescription
project string
tenant string
company string
Returns
TypeDescription
stringThe formatted company resource.

static::jobName

Formats a string containing the fully-qualified path to represent a job resource.

Parameters
NameDescription
project string
tenant string
job string
Returns
TypeDescription
stringThe formatted job resource.

static::projectName

Formats a string containing the fully-qualified path to represent a project resource.

Parameter
NameDescription
project string
Returns
TypeDescription
stringThe formatted project resource.

static::projectCompanyName

Formats a string containing the fully-qualified path to represent a project_company resource.

Parameters
NameDescription
project string
company string
Returns
TypeDescription
stringThe formatted project_company resource.

static::projectJobName

Formats a string containing the fully-qualified path to represent a project_job resource.

Parameters
NameDescription
project string
job string
Returns
TypeDescription
stringThe formatted project_job resource.

static::projectTenantCompanyName

Formats a string containing the fully-qualified path to represent a project_tenant_company resource.

Parameters
NameDescription
project string
tenant string
company string
Returns
TypeDescription
stringThe formatted project_tenant_company resource.

static::projectTenantJobName

Formats a string containing the fully-qualified path to represent a project_tenant_job resource.

Parameters
NameDescription
project string
tenant string
job string
Returns
TypeDescription
stringThe formatted project_tenant_job resource.

static::tenantName

Formats a string containing the fully-qualified path to represent a tenant resource.

Parameters
NameDescription
project string
tenant string
Returns
TypeDescription
stringThe formatted tenant resource.

static::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}
  • project: projects/{project}
  • projectCompany: projects/{project}/companies/{company}
  • projectJob: projects/{project}/jobs/{job}
  • projectTenantCompany: projects/{project}/tenants/{tenant}/companies/{company}
  • projectTenantJob: 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
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.

Constants

SERVICE_NAME

Value: 'google.cloud.talent.v4beta1.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.