Google Cloud Datalabeling V1beta1 Client - Class DataLabelingServiceClient (0.5.0)

Reference documentation and code samples for the Google Cloud Datalabeling V1beta1 Client class DataLabelingServiceClient.

Service Description: Service for the AI Platform Data Labeling API.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods.

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 \ DataLabeling \ V1beta1 \ Client

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.

createAnnotationSpecSet

Creates an annotation spec set by providing a set of labels.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::createAnnotationSpecSetAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\CreateAnnotationSpecSetRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\AnnotationSpecSet
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataLabeling\V1beta1\AnnotationSpecSet;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\CreateAnnotationSpecSetRequest;

/**
 * @param string $formattedParent AnnotationSpecSet resource parent, format:
 *                                projects/{project_id}
 *                                Please see {@see DataLabelingServiceClient::projectName()} for help formatting this field.
 */
function create_annotation_spec_set_sample(string $formattedParent): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $annotationSpecSet = new AnnotationSpecSet();
    $request = (new CreateAnnotationSpecSetRequest())
        ->setParent($formattedParent)
        ->setAnnotationSpecSet($annotationSpecSet);

    // Call the API and handle any network failures.
    try {
        /** @var AnnotationSpecSet $response */
        $response = $dataLabelingServiceClient->createAnnotationSpecSet($request);
        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 = DataLabelingServiceClient::projectName('[PROJECT]');

    create_annotation_spec_set_sample($formattedParent);
}

createDataset

Creates dataset. If success return a Dataset resource.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::createDatasetAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\CreateDatasetRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Dataset
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\CreateDatasetRequest;
use Google\Cloud\DataLabeling\V1beta1\Dataset;

/**
 * @param string $formattedParent Dataset resource parent, format:
 *                                projects/{project_id}
 *                                Please see {@see DataLabelingServiceClient::projectName()} for help formatting this field.
 */
function create_dataset_sample(string $formattedParent): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $dataset = new Dataset();
    $request = (new CreateDatasetRequest())
        ->setParent($formattedParent)
        ->setDataset($dataset);

    // Call the API and handle any network failures.
    try {
        /** @var Dataset $response */
        $response = $dataLabelingServiceClient->createDataset($request);
        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 = DataLabelingServiceClient::projectName('[PROJECT]');

    create_dataset_sample($formattedParent);
}

createEvaluationJob

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\CreateEvaluationJobRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\EvaluationJob
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\CreateEvaluationJobRequest;
use Google\Cloud\DataLabeling\V1beta1\EvaluationJob;

/**
 * @param string $formattedParent Evaluation job resource parent. Format:
 *                                "projects/<var>{project_id}</var>"
 *                                Please see {@see DataLabelingServiceClient::projectName()} for help formatting this field.
 */
function create_evaluation_job_sample(string $formattedParent): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $job = new EvaluationJob();
    $request = (new CreateEvaluationJobRequest())
        ->setParent($formattedParent)
        ->setJob($job);

    // Call the API and handle any network failures.
    try {
        /** @var EvaluationJob $response */
        $response = $dataLabelingServiceClient->createEvaluationJob($request);
        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 = DataLabelingServiceClient::projectName('[PROJECT]');

    create_evaluation_job_sample($formattedParent);
}

createInstruction

Creates an instruction for how data should be labeled.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::createInstructionAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\CreateInstructionRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\CreateInstructionRequest;
use Google\Cloud\DataLabeling\V1beta1\Instruction;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Instruction resource parent, format:
 *                                projects/{project_id}
 *                                Please see {@see DataLabelingServiceClient::projectName()} for help formatting this field.
 */
function create_instruction_sample(string $formattedParent): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $instruction = new Instruction();
    $request = (new CreateInstructionRequest())
        ->setParent($formattedParent)
        ->setInstruction($instruction);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataLabelingServiceClient->createInstruction($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instruction $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 = DataLabelingServiceClient::projectName('[PROJECT]');

    create_instruction_sample($formattedParent);
}

deleteAnnotatedDataset

Deletes an annotated dataset by resource name.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::deleteAnnotatedDatasetAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\DeleteAnnotatedDatasetRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\DeleteAnnotatedDatasetRequest;

/**
 * @param string $formattedName Name of the annotated dataset to delete, format:
 *                              projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/
 *                              {annotated_dataset_id}
 *                              Please see {@see DataLabelingServiceClient::annotatedDatasetName()} for help formatting this field.
 */
function delete_annotated_dataset_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new DeleteAnnotatedDatasetRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $dataLabelingServiceClient->deleteAnnotatedDataset($request);
        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 = DataLabelingServiceClient::annotatedDatasetName(
        '[PROJECT]',
        '[DATASET]',
        '[ANNOTATED_DATASET]'
    );

    delete_annotated_dataset_sample($formattedName);
}

deleteAnnotationSpecSet

Deletes an annotation spec set by resource name.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::deleteAnnotationSpecSetAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\DeleteAnnotationSpecSetRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\DeleteAnnotationSpecSetRequest;

/**
 * @param string $formattedName AnnotationSpec resource name, format:
 *                              `projects/{project_id}/annotationSpecSets/{annotation_spec_set_id}`. Please see
 *                              {@see DataLabelingServiceClient::annotationSpecSetName()} for help formatting this field.
 */
function delete_annotation_spec_set_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new DeleteAnnotationSpecSetRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $dataLabelingServiceClient->deleteAnnotationSpecSet($request);
        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 = DataLabelingServiceClient::annotationSpecSetName(
        '[PROJECT]',
        '[ANNOTATION_SPEC_SET]'
    );

    delete_annotation_spec_set_sample($formattedName);
}

deleteDataset

Deletes a dataset by resource name.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::deleteDatasetAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\DeleteDatasetRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\DeleteDatasetRequest;

/**
 * @param string $formattedName Dataset resource name, format:
 *                              projects/{project_id}/datasets/{dataset_id}
 *                              Please see {@see DataLabelingServiceClient::datasetName()} for help formatting this field.
 */
function delete_dataset_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new DeleteDatasetRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $dataLabelingServiceClient->deleteDataset($request);
        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 = DataLabelingServiceClient::datasetName('[PROJECT]', '[DATASET]');

    delete_dataset_sample($formattedName);
}

deleteEvaluationJob

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\DeleteEvaluationJobRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\DeleteEvaluationJobRequest;

/**
 * @param string $formattedName Name of the evaluation job that is going to be deleted. Format:
 *
 *                              "projects/<var>{project_id}</var>/evaluationJobs/<var>{evaluation_job_id}</var>"
 *                              Please see {@see DataLabelingServiceClient::evaluationJobName()} for help formatting this field.
 */
function delete_evaluation_job_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new DeleteEvaluationJobRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $dataLabelingServiceClient->deleteEvaluationJob($request);
        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 = DataLabelingServiceClient::evaluationJobName('[PROJECT]', '[EVALUATION_JOB]');

    delete_evaluation_job_sample($formattedName);
}

deleteInstruction

Deletes an instruction object by resource name.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::deleteInstructionAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\DeleteInstructionRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\DeleteInstructionRequest;

/**
 * @param string $formattedName Instruction resource name, format:
 *                              projects/{project_id}/instructions/{instruction_id}
 *                              Please see {@see DataLabelingServiceClient::instructionName()} for help formatting this field.
 */
function delete_instruction_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new DeleteInstructionRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $dataLabelingServiceClient->deleteInstruction($request);
        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 = DataLabelingServiceClient::instructionName('[PROJECT]', '[INSTRUCTION]');

    delete_instruction_sample($formattedName);
}

exportData

Exports data and annotations from dataset.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::exportDataAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ExportDataRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\ExportDataOperationResponse;
use Google\Cloud\DataLabeling\V1beta1\ExportDataRequest;
use Google\Cloud\DataLabeling\V1beta1\OutputConfig;
use Google\Rpc\Status;

/**
 * @param string $formattedName             Dataset resource name, format:
 *                                          projects/{project_id}/datasets/{dataset_id}
 *                                          Please see {@see DataLabelingServiceClient::datasetName()} for help formatting this field.
 * @param string $formattedAnnotatedDataset Annotated dataset resource name. DataItem in
 *                                          Dataset and their annotations in specified annotated dataset will be
 *                                          exported. It's in format of
 *                                          projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/
 *                                          {annotated_dataset_id}
 *                                          Please see {@see DataLabelingServiceClient::annotatedDatasetName()} for help formatting this field.
 */
function export_data_sample(string $formattedName, string $formattedAnnotatedDataset): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $outputConfig = new OutputConfig();
    $request = (new ExportDataRequest())
        ->setName($formattedName)
        ->setAnnotatedDataset($formattedAnnotatedDataset)
        ->setOutputConfig($outputConfig);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataLabelingServiceClient->exportData($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var ExportDataOperationResponse $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
{
    $formattedName = DataLabelingServiceClient::datasetName('[PROJECT]', '[DATASET]');
    $formattedAnnotatedDataset = DataLabelingServiceClient::annotatedDatasetName(
        '[PROJECT]',
        '[DATASET]',
        '[ANNOTATED_DATASET]'
    );

    export_data_sample($formattedName, $formattedAnnotatedDataset);
}

getAnnotatedDataset

Gets an annotated dataset by resource name.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::getAnnotatedDatasetAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetAnnotatedDatasetRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\AnnotatedDataset
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataLabeling\V1beta1\AnnotatedDataset;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\GetAnnotatedDatasetRequest;

/**
 * @param string $formattedName Name of the annotated dataset to get, format:
 *                              projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/
 *                              {annotated_dataset_id}
 *                              Please see {@see DataLabelingServiceClient::annotatedDatasetName()} for help formatting this field.
 */
function get_annotated_dataset_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new GetAnnotatedDatasetRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AnnotatedDataset $response */
        $response = $dataLabelingServiceClient->getAnnotatedDataset($request);
        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 = DataLabelingServiceClient::annotatedDatasetName(
        '[PROJECT]',
        '[DATASET]',
        '[ANNOTATED_DATASET]'
    );

    get_annotated_dataset_sample($formattedName);
}

getAnnotationSpecSet

Gets an annotation spec set by resource name.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::getAnnotationSpecSetAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetAnnotationSpecSetRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\AnnotationSpecSet
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataLabeling\V1beta1\AnnotationSpecSet;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\GetAnnotationSpecSetRequest;

/**
 * @param string $formattedName AnnotationSpecSet resource name, format:
 *                              projects/{project_id}/annotationSpecSets/{annotation_spec_set_id}
 *                              Please see {@see DataLabelingServiceClient::annotationSpecSetName()} for help formatting this field.
 */
function get_annotation_spec_set_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new GetAnnotationSpecSetRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AnnotationSpecSet $response */
        $response = $dataLabelingServiceClient->getAnnotationSpecSet($request);
        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 = DataLabelingServiceClient::annotationSpecSetName(
        '[PROJECT]',
        '[ANNOTATION_SPEC_SET]'
    );

    get_annotation_spec_set_sample($formattedName);
}

getDataItem

Gets a data item in a dataset by resource name. This API can be called after data are imported into dataset.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::getDataItemAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetDataItemRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\DataItem
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\DataItem;
use Google\Cloud\DataLabeling\V1beta1\GetDataItemRequest;

/**
 * @param string $formattedName The name of the data item to get, format:
 *                              projects/{project_id}/datasets/{dataset_id}/dataItems/{data_item_id}
 *                              Please see {@see DataLabelingServiceClient::dataItemName()} for help formatting this field.
 */
function get_data_item_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new GetDataItemRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var DataItem $response */
        $response = $dataLabelingServiceClient->getDataItem($request);
        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 = DataLabelingServiceClient::dataItemName('[PROJECT]', '[DATASET]', '[DATA_ITEM]');

    get_data_item_sample($formattedName);
}

getDataset

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetDatasetRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Dataset
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\Dataset;
use Google\Cloud\DataLabeling\V1beta1\GetDatasetRequest;

/**
 * @param string $formattedName Dataset resource name, format:
 *                              projects/{project_id}/datasets/{dataset_id}
 *                              Please see {@see DataLabelingServiceClient::datasetName()} for help formatting this field.
 */
function get_dataset_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new GetDatasetRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Dataset $response */
        $response = $dataLabelingServiceClient->getDataset($request);
        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 = DataLabelingServiceClient::datasetName('[PROJECT]', '[DATASET]');

    get_dataset_sample($formattedName);
}

getEvaluation

Gets an evaluation by resource name (to search, use projects.evaluations.search).

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::getEvaluationAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetEvaluationRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Evaluation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\Evaluation;
use Google\Cloud\DataLabeling\V1beta1\GetEvaluationRequest;

/**
 * @param string $formattedName Name of the evaluation. Format:
 *
 *                              "projects/<var>{project_id}</var>/datasets/<var>{dataset_id}</var>/evaluations/<var>{evaluation_id}</var>'
 *                              Please see {@see DataLabelingServiceClient::evaluationName()} for help formatting this field.
 */
function get_evaluation_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new GetEvaluationRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Evaluation $response */
        $response = $dataLabelingServiceClient->getEvaluation($request);
        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 = DataLabelingServiceClient::evaluationName(
        '[PROJECT]',
        '[DATASET]',
        '[EVALUATION]'
    );

    get_evaluation_sample($formattedName);
}

getEvaluationJob

Gets an evaluation job by resource name.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::getEvaluationJobAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetEvaluationJobRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\EvaluationJob
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\EvaluationJob;
use Google\Cloud\DataLabeling\V1beta1\GetEvaluationJobRequest;

/**
 * @param string $formattedName Name of the evaluation job. Format:
 *
 *                              "projects/<var>{project_id}</var>/evaluationJobs/<var>{evaluation_job_id}</var>"
 *                              Please see {@see DataLabelingServiceClient::evaluationJobName()} for help formatting this field.
 */
function get_evaluation_job_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new GetEvaluationJobRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var EvaluationJob $response */
        $response = $dataLabelingServiceClient->getEvaluationJob($request);
        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 = DataLabelingServiceClient::evaluationJobName('[PROJECT]', '[EVALUATION_JOB]');

    get_evaluation_job_sample($formattedName);
}

getExample

Gets an example by resource name, including both data and annotation.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::getExampleAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetExampleRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Example
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\Example;
use Google\Cloud\DataLabeling\V1beta1\GetExampleRequest;

/**
 * @param string $formattedName Name of example, format:
 *                              projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/
 *                              {annotated_dataset_id}/examples/{example_id}
 *                              Please see {@see DataLabelingServiceClient::exampleName()} for help formatting this field.
 */
function get_example_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new GetExampleRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Example $response */
        $response = $dataLabelingServiceClient->getExample($request);
        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 = DataLabelingServiceClient::exampleName(
        '[PROJECT]',
        '[DATASET]',
        '[ANNOTATED_DATASET]',
        '[EXAMPLE]'
    );

    get_example_sample($formattedName);
}

getInstruction

Gets an instruction by resource name.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::getInstructionAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetInstructionRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Instruction
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\GetInstructionRequest;
use Google\Cloud\DataLabeling\V1beta1\Instruction;

/**
 * @param string $formattedName Instruction resource name, format:
 *                              projects/{project_id}/instructions/{instruction_id}
 *                              Please see {@see DataLabelingServiceClient::instructionName()} for help formatting this field.
 */
function get_instruction_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new GetInstructionRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Instruction $response */
        $response = $dataLabelingServiceClient->getInstruction($request);
        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 = DataLabelingServiceClient::instructionName('[PROJECT]', '[INSTRUCTION]');

    get_instruction_sample($formattedName);
}

importData

Imports data into dataset based on source locations defined in request.

It can be called multiple times for the same dataset. Each dataset can only have one long running operation running on it. For example, no labeling task (also long running operation) can be started while importing is still ongoing. Vice versa.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::importDataAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ImportDataRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\ImportDataOperationResponse;
use Google\Cloud\DataLabeling\V1beta1\ImportDataRequest;
use Google\Cloud\DataLabeling\V1beta1\InputConfig;
use Google\Rpc\Status;

/**
 * @param string $formattedName Dataset resource name, format:
 *                              projects/{project_id}/datasets/{dataset_id}
 *                              Please see {@see DataLabelingServiceClient::datasetName()} for help formatting this field.
 */
function import_data_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $inputConfig = new InputConfig();
    $request = (new ImportDataRequest())
        ->setName($formattedName)
        ->setInputConfig($inputConfig);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataLabelingServiceClient->importData($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var ImportDataOperationResponse $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
{
    $formattedName = DataLabelingServiceClient::datasetName('[PROJECT]', '[DATASET]');

    import_data_sample($formattedName);
}

labelImage

Starts a labeling task for image. The type of image labeling task is configured by feature in the request.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::labelImageAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\LabelImageRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\AnnotatedDataset;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\HumanAnnotationConfig;
use Google\Cloud\DataLabeling\V1beta1\LabelImageRequest;
use Google\Cloud\DataLabeling\V1beta1\LabelImageRequest\Feature;
use Google\Rpc\Status;

/**
 * @param string $formattedParent                        Name of the dataset to request labeling task, format:
 *                                                       projects/{project_id}/datasets/{dataset_id}
 *                                                       Please see {@see DataLabelingServiceClient::datasetName()} for help formatting this field.
 * @param string $basicConfigInstruction                 Instruction resource name.
 * @param string $basicConfigAnnotatedDatasetDisplayName A human-readable name for AnnotatedDataset defined by
 *                                                       users. Maximum of 64 characters
 *                                                       .
 * @param int    $feature                                The type of image labeling task.
 */
function label_image_sample(
    string $formattedParent,
    string $basicConfigInstruction,
    string $basicConfigAnnotatedDatasetDisplayName,
    int $feature
): void {
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $basicConfig = (new HumanAnnotationConfig())
        ->setInstruction($basicConfigInstruction)
        ->setAnnotatedDatasetDisplayName($basicConfigAnnotatedDatasetDisplayName);
    $request = (new LabelImageRequest())
        ->setParent($formattedParent)
        ->setBasicConfig($basicConfig)
        ->setFeature($feature);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataLabelingServiceClient->labelImage($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var AnnotatedDataset $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 = DataLabelingServiceClient::datasetName('[PROJECT]', '[DATASET]');
    $basicConfigInstruction = '[INSTRUCTION]';
    $basicConfigAnnotatedDatasetDisplayName = '[ANNOTATED_DATASET_DISPLAY_NAME]';
    $feature = Feature::FEATURE_UNSPECIFIED;

    label_image_sample(
        $formattedParent,
        $basicConfigInstruction,
        $basicConfigAnnotatedDatasetDisplayName,
        $feature
    );
}

labelText

Starts a labeling task for text. The type of text labeling task is configured by feature in the request.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::labelTextAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\LabelTextRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\AnnotatedDataset;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\HumanAnnotationConfig;
use Google\Cloud\DataLabeling\V1beta1\LabelTextRequest;
use Google\Cloud\DataLabeling\V1beta1\LabelTextRequest\Feature;
use Google\Rpc\Status;

/**
 * @param string $formattedParent                        Name of the data set to request labeling task, format:
 *                                                       projects/{project_id}/datasets/{dataset_id}
 *                                                       Please see {@see DataLabelingServiceClient::datasetName()} for help formatting this field.
 * @param string $basicConfigInstruction                 Instruction resource name.
 * @param string $basicConfigAnnotatedDatasetDisplayName A human-readable name for AnnotatedDataset defined by
 *                                                       users. Maximum of 64 characters
 *                                                       .
 * @param int    $feature                                The type of text labeling task.
 */
function label_text_sample(
    string $formattedParent,
    string $basicConfigInstruction,
    string $basicConfigAnnotatedDatasetDisplayName,
    int $feature
): void {
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $basicConfig = (new HumanAnnotationConfig())
        ->setInstruction($basicConfigInstruction)
        ->setAnnotatedDatasetDisplayName($basicConfigAnnotatedDatasetDisplayName);
    $request = (new LabelTextRequest())
        ->setParent($formattedParent)
        ->setBasicConfig($basicConfig)
        ->setFeature($feature);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataLabelingServiceClient->labelText($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var AnnotatedDataset $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 = DataLabelingServiceClient::datasetName('[PROJECT]', '[DATASET]');
    $basicConfigInstruction = '[INSTRUCTION]';
    $basicConfigAnnotatedDatasetDisplayName = '[ANNOTATED_DATASET_DISPLAY_NAME]';
    $feature = Feature::FEATURE_UNSPECIFIED;

    label_text_sample(
        $formattedParent,
        $basicConfigInstruction,
        $basicConfigAnnotatedDatasetDisplayName,
        $feature
    );
}

labelVideo

Starts a labeling task for video. The type of video labeling task is configured by feature in the request.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::labelVideoAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\LabelVideoRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\AnnotatedDataset;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\HumanAnnotationConfig;
use Google\Cloud\DataLabeling\V1beta1\LabelVideoRequest;
use Google\Cloud\DataLabeling\V1beta1\LabelVideoRequest\Feature;
use Google\Rpc\Status;

/**
 * @param string $formattedParent                        Name of the dataset to request labeling task, format:
 *                                                       projects/{project_id}/datasets/{dataset_id}
 *                                                       Please see {@see DataLabelingServiceClient::datasetName()} for help formatting this field.
 * @param string $basicConfigInstruction                 Instruction resource name.
 * @param string $basicConfigAnnotatedDatasetDisplayName A human-readable name for AnnotatedDataset defined by
 *                                                       users. Maximum of 64 characters
 *                                                       .
 * @param int    $feature                                The type of video labeling task.
 */
function label_video_sample(
    string $formattedParent,
    string $basicConfigInstruction,
    string $basicConfigAnnotatedDatasetDisplayName,
    int $feature
): void {
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $basicConfig = (new HumanAnnotationConfig())
        ->setInstruction($basicConfigInstruction)
        ->setAnnotatedDatasetDisplayName($basicConfigAnnotatedDatasetDisplayName);
    $request = (new LabelVideoRequest())
        ->setParent($formattedParent)
        ->setBasicConfig($basicConfig)
        ->setFeature($feature);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $dataLabelingServiceClient->labelVideo($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var AnnotatedDataset $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 = DataLabelingServiceClient::datasetName('[PROJECT]', '[DATASET]');
    $basicConfigInstruction = '[INSTRUCTION]';
    $basicConfigAnnotatedDatasetDisplayName = '[ANNOTATED_DATASET_DISPLAY_NAME]';
    $feature = Feature::FEATURE_UNSPECIFIED;

    label_video_sample(
        $formattedParent,
        $basicConfigInstruction,
        $basicConfigAnnotatedDatasetDisplayName,
        $feature
    );
}

listAnnotatedDatasets

Lists annotated datasets for a dataset. Pagination is supported.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::listAnnotatedDatasetsAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListAnnotatedDatasetsRequest

A request to house fields associated with the call.

callOptions 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\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataLabeling\V1beta1\AnnotatedDataset;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\ListAnnotatedDatasetsRequest;

/**
 * @param string $formattedParent Name of the dataset to list annotated datasets, format:
 *                                projects/{project_id}/datasets/{dataset_id}
 *                                Please see {@see DataLabelingServiceClient::datasetName()} for help formatting this field.
 */
function list_annotated_datasets_sample(string $formattedParent): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new ListAnnotatedDatasetsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dataLabelingServiceClient->listAnnotatedDatasets($request);

        /** @var AnnotatedDataset $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 = DataLabelingServiceClient::datasetName('[PROJECT]', '[DATASET]');

    list_annotated_datasets_sample($formattedParent);
}

listAnnotationSpecSets

Lists annotation spec sets for a project. Pagination is supported.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::listAnnotationSpecSetsAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListAnnotationSpecSetsRequest

A request to house fields associated with the call.

callOptions 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\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataLabeling\V1beta1\AnnotationSpecSet;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\ListAnnotationSpecSetsRequest;

/**
 * @param string $formattedParent Parent of AnnotationSpecSet resource, format:
 *                                projects/{project_id}
 *                                Please see {@see DataLabelingServiceClient::projectName()} for help formatting this field.
 */
function list_annotation_spec_sets_sample(string $formattedParent): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new ListAnnotationSpecSetsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dataLabelingServiceClient->listAnnotationSpecSets($request);

        /** @var AnnotationSpecSet $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 = DataLabelingServiceClient::projectName('[PROJECT]');

    list_annotation_spec_sets_sample($formattedParent);
}

listDataItems

Lists data items in a dataset. This API can be called after data are imported into dataset. Pagination is supported.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::listDataItemsAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListDataItemsRequest

A request to house fields associated with the call.

callOptions 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\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\DataItem;
use Google\Cloud\DataLabeling\V1beta1\ListDataItemsRequest;

/**
 * @param string $formattedParent Name of the dataset to list data items, format:
 *                                projects/{project_id}/datasets/{dataset_id}
 *                                Please see {@see DataLabelingServiceClient::datasetName()} for help formatting this field.
 */
function list_data_items_sample(string $formattedParent): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new ListDataItemsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dataLabelingServiceClient->listDataItems($request);

        /** @var DataItem $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 = DataLabelingServiceClient::datasetName('[PROJECT]', '[DATASET]');

    list_data_items_sample($formattedParent);
}

listDatasets

Lists datasets under a project. Pagination is supported.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::listDatasetsAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListDatasetsRequest

A request to house fields associated with the call.

callOptions 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\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\Dataset;
use Google\Cloud\DataLabeling\V1beta1\ListDatasetsRequest;

/**
 * @param string $formattedParent Dataset resource parent, format:
 *                                projects/{project_id}
 *                                Please see {@see DataLabelingServiceClient::projectName()} for help formatting this field.
 */
function list_datasets_sample(string $formattedParent): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new ListDatasetsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dataLabelingServiceClient->listDatasets($request);

        /** @var Dataset $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 = DataLabelingServiceClient::projectName('[PROJECT]');

    list_datasets_sample($formattedParent);
}

listEvaluationJobs

Lists all evaluation jobs within a project with possible filters.

Pagination is supported.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::listEvaluationJobsAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListEvaluationJobsRequest

A request to house fields associated with the call.

callOptions 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\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\EvaluationJob;
use Google\Cloud\DataLabeling\V1beta1\ListEvaluationJobsRequest;

/**
 * @param string $formattedParent Evaluation job resource parent. Format:
 *                                "projects/<var>{project_id}</var>"
 *                                Please see {@see DataLabelingServiceClient::projectName()} for help formatting this field.
 */
function list_evaluation_jobs_sample(string $formattedParent): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new ListEvaluationJobsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dataLabelingServiceClient->listEvaluationJobs($request);

        /** @var EvaluationJob $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 = DataLabelingServiceClient::projectName('[PROJECT]');

    list_evaluation_jobs_sample($formattedParent);
}

listExamples

Lists examples in an annotated dataset. Pagination is supported.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::listExamplesAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListExamplesRequest

A request to house fields associated with the call.

callOptions 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\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\Example;
use Google\Cloud\DataLabeling\V1beta1\ListExamplesRequest;

/**
 * @param string $formattedParent Example resource parent. Please see
 *                                {@see DataLabelingServiceClient::annotatedDatasetName()} for help formatting this field.
 */
function list_examples_sample(string $formattedParent): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new ListExamplesRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dataLabelingServiceClient->listExamples($request);

        /** @var Example $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 = DataLabelingServiceClient::annotatedDatasetName(
        '[PROJECT]',
        '[DATASET]',
        '[ANNOTATED_DATASET]'
    );

    list_examples_sample($formattedParent);
}

listInstructions

Lists instructions for a project. Pagination is supported.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::listInstructionsAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListInstructionsRequest

A request to house fields associated with the call.

callOptions 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\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\Instruction;
use Google\Cloud\DataLabeling\V1beta1\ListInstructionsRequest;

/**
 * @param string $formattedParent Instruction resource parent, format:
 *                                projects/{project_id}
 *                                Please see {@see DataLabelingServiceClient::projectName()} for help formatting this field.
 */
function list_instructions_sample(string $formattedParent): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new ListInstructionsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dataLabelingServiceClient->listInstructions($request);

        /** @var Instruction $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 = DataLabelingServiceClient::projectName('[PROJECT]');

    list_instructions_sample($formattedParent);
}

pauseEvaluationJob

Pauses an evaluation job. Pausing an evaluation job that is already in a PAUSED state is a no-op.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::pauseEvaluationJobAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\PauseEvaluationJobRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\PauseEvaluationJobRequest;

/**
 * @param string $formattedName Name of the evaluation job that is going to be paused. Format:
 *
 *                              "projects/<var>{project_id}</var>/evaluationJobs/<var>{evaluation_job_id}</var>"
 *                              Please see {@see DataLabelingServiceClient::evaluationJobName()} for help formatting this field.
 */
function pause_evaluation_job_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new PauseEvaluationJobRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $dataLabelingServiceClient->pauseEvaluationJob($request);
        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 = DataLabelingServiceClient::evaluationJobName('[PROJECT]', '[EVALUATION_JOB]');

    pause_evaluation_job_sample($formattedName);
}

resumeEvaluationJob

Resumes a paused evaluation job. A deleted evaluation job can't be resumed.

Resuming a running or scheduled evaluation job is a no-op.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::resumeEvaluationJobAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ResumeEvaluationJobRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\ResumeEvaluationJobRequest;

/**
 * @param string $formattedName Name of the evaluation job that is going to be resumed. Format:
 *
 *                              "projects/<var>{project_id}</var>/evaluationJobs/<var>{evaluation_job_id}</var>"
 *                              Please see {@see DataLabelingServiceClient::evaluationJobName()} for help formatting this field.
 */
function resume_evaluation_job_sample(string $formattedName): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new ResumeEvaluationJobRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $dataLabelingServiceClient->resumeEvaluationJob($request);
        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 = DataLabelingServiceClient::evaluationJobName('[PROJECT]', '[EVALUATION_JOB]');

    resume_evaluation_job_sample($formattedName);
}

searchEvaluations

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\SearchEvaluationsRequest

A request to house fields associated with the call.

callOptions 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\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\Evaluation;
use Google\Cloud\DataLabeling\V1beta1\SearchEvaluationsRequest;

/**
 * @param string $formattedParent Evaluation search parent (project ID). Format:
 *                                "projects/<var>{project_id}</var>"
 *                                Please see {@see DataLabelingServiceClient::evaluationName()} for help formatting this field.
 */
function search_evaluations_sample(string $formattedParent): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new SearchEvaluationsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dataLabelingServiceClient->searchEvaluations($request);

        /** @var Evaluation $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 = DataLabelingServiceClient::evaluationName(
        '[PROJECT]',
        '[DATASET]',
        '[EVALUATION]'
    );

    search_evaluations_sample($formattedParent);
}

searchExampleComparisons

Searches example comparisons from an evaluation. The return format is a list of example comparisons that show ground truth and prediction(s) for a single input. Search by providing an evaluation ID.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::searchExampleComparisonsAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\SearchExampleComparisonsRequest

A request to house fields associated with the call.

callOptions 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\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\SearchExampleComparisonsRequest;
use Google\Cloud\DataLabeling\V1beta1\SearchExampleComparisonsResponse\ExampleComparison;

/**
 * @param string $formattedParent Name of the [Evaluation][google.cloud.datalabeling.v1beta1.Evaluation] resource to search for example
 *                                comparisons from. Format:
 *
 *                                "projects/<var>{project_id}</var>/datasets/<var>{dataset_id}</var>/evaluations/<var>{evaluation_id}</var>"
 *                                Please see {@see DataLabelingServiceClient::evaluationName()} for help formatting this field.
 */
function search_example_comparisons_sample(string $formattedParent): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $request = (new SearchExampleComparisonsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dataLabelingServiceClient->searchExampleComparisons($request);

        /** @var ExampleComparison $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 = DataLabelingServiceClient::evaluationName(
        '[PROJECT]',
        '[DATASET]',
        '[EVALUATION]'
    );

    search_example_comparisons_sample($formattedParent);
}

updateEvaluationJob

Updates an evaluation job. You can only update certain fields of the job's EvaluationJobConfig: humanAnnotationConfig.instruction, exampleCount, and exampleSamplePercentage.

If you want to change any other aspect of the evaluation job, you must delete the job and create a new one.

The async variant is Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient::updateEvaluationJobAsync() .

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\UpdateEvaluationJobRequest

A request to house fields associated with the call.

callOptions 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\DataLabeling\V1beta1\EvaluationJob
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient;
use Google\Cloud\DataLabeling\V1beta1\EvaluationJob;
use Google\Cloud\DataLabeling\V1beta1\UpdateEvaluationJobRequest;

/**
 * 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 update_evaluation_job_sample(): void
{
    // Create a client.
    $dataLabelingServiceClient = new DataLabelingServiceClient();

    // Prepare the request message.
    $evaluationJob = new EvaluationJob();
    $request = (new UpdateEvaluationJobRequest())
        ->setEvaluationJob($evaluationJob);

    // Call the API and handle any network failures.
    try {
        /** @var EvaluationJob $response */
        $response = $dataLabelingServiceClient->updateEvaluationJob($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

createAnnotationSpecSetAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\CreateAnnotationSpecSetRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

createDatasetAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\CreateDatasetRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

createEvaluationJobAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\CreateEvaluationJobRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

createInstructionAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\CreateInstructionRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteAnnotatedDatasetAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\DeleteAnnotatedDatasetRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteAnnotationSpecSetAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\DeleteAnnotationSpecSetRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteDatasetAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\DeleteDatasetRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteEvaluationJobAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\DeleteEvaluationJobRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteInstructionAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\DeleteInstructionRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

exportDataAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ExportDataRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getAnnotatedDatasetAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetAnnotatedDatasetRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getAnnotationSpecSetAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetAnnotationSpecSetRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getDataItemAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetDataItemRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getDatasetAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetDatasetRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getEvaluationAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetEvaluationRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getEvaluationJobAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetEvaluationJobRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getExampleAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetExampleRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getInstructionAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\GetInstructionRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

importDataAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ImportDataRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

labelImageAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\LabelImageRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

labelTextAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\LabelTextRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

labelVideoAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\LabelVideoRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listAnnotatedDatasetsAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListAnnotatedDatasetsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listAnnotationSpecSetsAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListAnnotationSpecSetsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listDataItemsAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListDataItemsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listDatasetsAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListDatasetsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listEvaluationJobsAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListEvaluationJobsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listExamplesAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListExamplesRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listInstructionsAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ListInstructionsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

pauseEvaluationJobAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\PauseEvaluationJobRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

resumeEvaluationJobAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\ResumeEvaluationJobRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

searchEvaluationsAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\SearchEvaluationsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

searchExampleComparisonsAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\SearchExampleComparisonsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

updateEvaluationJobAsync

Parameters
NameDescription
request Google\Cloud\DataLabeling\V1beta1\UpdateEvaluationJobRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

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::annotatedDatasetName

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

Parameters
NameDescription
project string
dataset string
annotatedDataset string
Returns
TypeDescription
stringThe formatted annotated_dataset resource.

static::annotationSpecSetName

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

Parameters
NameDescription
project string
annotationSpecSet string
Returns
TypeDescription
stringThe formatted annotation_spec_set resource.

static::dataItemName

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

Parameters
NameDescription
project string
dataset string
dataItem string
Returns
TypeDescription
stringThe formatted data_item resource.

static::datasetName

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

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

static::evaluationName

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

Parameters
NameDescription
project string
dataset string
evaluation string
Returns
TypeDescription
stringThe formatted evaluation resource.

static::evaluationJobName

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

Parameters
NameDescription
project string
evaluationJob string
Returns
TypeDescription
stringThe formatted evaluation_job resource.

static::exampleName

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

Parameters
NameDescription
project string
dataset string
annotatedDataset string
example string
Returns
TypeDescription
stringThe formatted example resource.

static::instructionName

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

Parameters
NameDescription
project string
instruction string
Returns
TypeDescription
stringThe formatted instruction 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::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

  • annotatedDataset: projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset}
  • annotationSpecSet: projects/{project}/annotationSpecSets/{annotation_spec_set}
  • dataItem: projects/{project}/datasets/{dataset}/dataItems/{data_item}
  • dataset: projects/{project}/datasets/{dataset}
  • evaluation: projects/{project}/datasets/{dataset}/evaluations/{evaluation}
  • evaluationJob: projects/{project}/evaluationJobs/{evaluation_job}
  • example: projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset}/examples/{example}
  • instruction: projects/{project}/instructions/{instruction}
  • project: projects/{project}

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.