Google Cloud Vision Ai V1 Client - Class WarehouseClient (0.3.0)

Reference documentation and code samples for the Google Cloud Vision Ai V1 Client class WarehouseClient.

Service Description: Service that manages media content + metadata for streaming.

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 \ VisionAI \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name
Description
options
array| Google\ApiCore\Options\ClientOptions

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
FetchAuthTokenInterface|CredentialsWrapper

This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Cloud\VisionAI\V1\WarehouseClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new WarehouseClient(['credentials' => $creds]); https://cloud.google.com/docs/authentication/external/externally-sourced-credentials

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

↳ logger
false|LoggerInterface

A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag

↳ universeDomain
string

The service domain for the client. Defaults to 'googleapis.com'.

addCollectionItem

Adds an item into a Collection.

The async variant is WarehouseClient::addCollectionItemAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\AddCollectionItemRequest

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\VisionAI\V1\AddCollectionItemRequest;
use Google\Cloud\VisionAI\V1\AddCollectionItemResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\CollectionItem;
use Google\Cloud\VisionAI\V1\CollectionItem\Type;

/**
 * @param string $formattedItemCollection The collection name that this item belongs to. Format:
 *                                        `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}`
 *                                        Please see {@see WarehouseClient::collectionName()} for help formatting this field.
 * @param int    $itemType                The type of item.
 * @param string $itemItemResource        The name of the CollectionItem. Its format depends on the `type`
 *                                        above. For ASSET:
 *                                        `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}`
 */
function add_collection_item_sample(
    string $formattedItemCollection,
    int $itemType,
    string $itemItemResource
): void {
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $item = (new CollectionItem())
        ->setCollection($formattedItemCollection)
        ->setType($itemType)
        ->setItemResource($itemItemResource);
    $request = (new AddCollectionItemRequest())
        ->setItem($item);

    // Call the API and handle any network failures.
    try {
        /** @var AddCollectionItemResponse $response */
        $response = $warehouseClient->addCollectionItem($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
{
    $formattedItemCollection = WarehouseClient::collectionName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[COLLECTION]'
    );
    $itemType = Type::TYPE_UNSPECIFIED;
    $itemItemResource = '[ITEM_RESOURCE]';

    add_collection_item_sample($formattedItemCollection, $itemType, $itemItemResource);
} 

analyzeAsset

Analyze asset to power search capability.

The async variant is WarehouseClient::analyzeAssetAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\AnalyzeAssetRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\AnalyzeAssetRequest;
use Google\Cloud\VisionAI\V1\AnalyzeAssetResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName The resource name of the asset to analyze.
 *                              Format:
 *                              `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}`
 *                              Please see {@see WarehouseClient::assetName()} for help formatting this field.
 */
function analyze_asset_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var AnalyzeAssetResponse $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 = WarehouseClient::assetName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[ASSET]'
    );

    analyze_asset_sample($formattedName);
} 

analyzeCorpus

Analyzes a corpus.

The async variant is WarehouseClient::analyzeCorpusAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\AnalyzeCorpusRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\AnalyzeCorpusRequest;
use Google\Cloud\VisionAI\V1\AnalyzeCorpusResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName The parent corpus resource where the assets will be analyzed.
 *                              Format:
 *                              `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}`
 *                              Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function analyze_corpus_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var AnalyzeCorpusResponse $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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    analyze_corpus_sample($formattedName);
} 

clipAsset

Supported by STREAM_VIDEO corpus type.

Generates clips for downloading. The api takes in a time range, and generates a clip of the first content available after start_time and before end_time, which may overflow beyond these bounds. Returned clips are truncated if the total size of the clips are larger than 100MB.

The async variant is WarehouseClient::clipAssetAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ClipAssetRequest

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\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\ClipAssetRequest;
use Google\Cloud\VisionAI\V1\ClipAssetResponse;
use Google\Cloud\VisionAI\V1\Partition\TemporalPartition;

/**
 * @param string $formattedName The resource name of the asset to request clips for.
 *                              Format:
 *                              `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}`
 *                              Please see {@see WarehouseClient::assetName()} for help formatting this field.
 */
function clip_asset_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $temporalPartition = new TemporalPartition();
    $request = (new ClipAssetRequest())
        ->setName($formattedName)
        ->setTemporalPartition($temporalPartition);

    // Call the API and handle any network failures.
    try {
        /** @var ClipAssetResponse $response */
        $response = $warehouseClient->clipAsset($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 = WarehouseClient::assetName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[ASSET]'
    );

    clip_asset_sample($formattedName);
} 

createAnnotation

Creates annotation inside asset.

The async variant is WarehouseClient::createAnnotationAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\CreateAnnotationRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Annotation;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\CreateAnnotationRequest;

/**
 * @param string $formattedParent The parent resource where this annotation will be created.
 *                                Format:
 *                                `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}`
 *                                Please see {@see WarehouseClient::assetName()} for help formatting this field.
 */
function create_annotation_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $annotation = new Annotation();
    $request = (new CreateAnnotationRequest())
        ->setParent($formattedParent)
        ->setAnnotation($annotation);

    // Call the API and handle any network failures.
    try {
        /** @var Annotation $response */
        $response = $warehouseClient->createAnnotation($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 = WarehouseClient::assetName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[ASSET]'
    );

    create_annotation_sample($formattedParent);
} 

createAsset

Creates an asset inside corpus.

The async variant is WarehouseClient::createAssetAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\CreateAssetRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Asset;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\CreateAssetRequest;

/**
 * @param string $formattedParent The parent resource where this asset will be created.
 *                                Format:
 *                                `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}`
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function create_asset_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $asset = new Asset();
    $request = (new CreateAssetRequest())
        ->setParent($formattedParent)
        ->setAsset($asset);

    // Call the API and handle any network failures.
    try {
        /** @var Asset $response */
        $response = $warehouseClient->createAsset($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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    create_asset_sample($formattedParent);
} 

createCollection

Creates a collection.

The async variant is WarehouseClient::createCollectionAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\CreateCollectionRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\Collection;
use Google\Cloud\VisionAI\V1\CreateCollectionRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The parent resource where this collection will be created.
 *                                Format: `projects/{project_number}/locations/{location}/corpora/{corpus}`
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function create_collection_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $collection = new Collection();
    $request = (new CreateCollectionRequest())
        ->setParent($formattedParent)
        ->setCollection($collection);

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

        if ($response->operationSucceeded()) {
            /** @var Collection $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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    create_collection_sample($formattedParent);
} 

createCorpus

Creates a corpus inside a project.

The async variant is WarehouseClient::createCorpusAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\CreateCorpusRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\Corpus;
use Google\Cloud\VisionAI\V1\CreateCorpusRequest;
use Google\Rpc\Status;

/**
 * @param string $parent            Form: `projects/{project_number}/locations/{location_id}`
 * @param string $corpusDisplayName The corpus name to shown in the UI. The name can be up to 32
 *                                  characters long.
 */
function create_corpus_sample(string $parent, string $corpusDisplayName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $corpus = (new Corpus())
        ->setDisplayName($corpusDisplayName);
    $request = (new CreateCorpusRequest())
        ->setParent($parent)
        ->setCorpus($corpus);

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

        if ($response->operationSucceeded()) {
            /** @var Corpus $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
{
    $parent = '[PARENT]';
    $corpusDisplayName = '[DISPLAY_NAME]';

    create_corpus_sample($parent, $corpusDisplayName);
} 

createDataSchema

Creates data schema inside corpus.

The async variant is WarehouseClient::createDataSchemaAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\CreateDataSchemaRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\CreateDataSchemaRequest;
use Google\Cloud\VisionAI\V1\DataSchema;

/**
 * @param string $formattedParent The parent resource where this data schema will be created.
 *                                Format:
 *                                `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}`
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 * @param string $dataSchemaKey   The key of this data schema. This key should be matching the key
 *                                of user specified annotation and unique inside corpus. This value can be up
 *                                to 63 characters, and valid characters are /[a-z][0-9]-/. The first
 *                                character must be a letter, the last could be a letter or a number.
 */
function create_data_schema_sample(string $formattedParent, string $dataSchemaKey): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $dataSchema = (new DataSchema())
        ->setKey($dataSchemaKey);
    $request = (new CreateDataSchemaRequest())
        ->setParent($formattedParent)
        ->setDataSchema($dataSchema);

    // Call the API and handle any network failures.
    try {
        /** @var DataSchema $response */
        $response = $warehouseClient->createDataSchema($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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');
    $dataSchemaKey = '[KEY]';

    create_data_schema_sample($formattedParent, $dataSchemaKey);
} 

createIndex

Creates an Index under the corpus.

The async variant is WarehouseClient::createIndexAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\CreateIndexRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\CreateIndexRequest;
use Google\Cloud\VisionAI\V1\Index;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Value for the parent. The resource name of the Corpus under which
 *                                this index is created. Format:
 *                                `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}`
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function create_index_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $index = new Index();
    $request = (new CreateIndexRequest())
        ->setParent($formattedParent)
        ->setIndex($index);

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

        if ($response->operationSucceeded()) {
            /** @var Index $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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    create_index_sample($formattedParent);
} 

createIndexEndpoint

Creates an IndexEndpoint.

The async variant is WarehouseClient::createIndexEndpointAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\CreateIndexEndpointRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\CreateIndexEndpointRequest;
use Google\Cloud\VisionAI\V1\IndexEndpoint;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Format: `projects/{project}/locations/{location}`
 *                                Please see {@see WarehouseClient::locationName()} for help formatting this field.
 */
function create_index_endpoint_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $indexEndpoint = new IndexEndpoint();
    $request = (new CreateIndexEndpointRequest())
        ->setParent($formattedParent)
        ->setIndexEndpoint($indexEndpoint);

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

        if ($response->operationSucceeded()) {
            /** @var IndexEndpoint $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 = WarehouseClient::locationName('[PROJECT]', '[LOCATION]');

    create_index_endpoint_sample($formattedParent);
} 

createSearchConfig

Creates a search configuration inside a corpus.

Please follow the rules below to create a valid CreateSearchConfigRequest. --- General Rules ---

  1. Request.search_config_id must not be associated with an existing SearchConfig.
  2. Request must contain at least one non-empty search_criteria_property or facet_property.
  3. mapped_fields must not be empty, and must map to existing UGA keys.
  4. All mapped_fields must be of the same type.
  5. All mapped_fields must share the same granularity.
  6. All mapped_fields must share the same semantic SearchConfig match options. For property-specific rules, please reference the comments for FacetProperty and SearchCriteriaProperty.

The async variant is WarehouseClient::createSearchConfigAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\CreateSearchConfigRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\CreateSearchConfigRequest;
use Google\Cloud\VisionAI\V1\SearchConfig;

/**
 * @param string $formattedParent The parent resource where this search configuration will be
 *                                created. Format:
 *                                `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}`
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 * @param string $searchConfigId  ID to use for the new search config. Will become the final
 *                                component of the SearchConfig's resource name. This value should be up to
 *                                63 characters, and valid characters are /[a-z][0-9]-_/. The first character
 *                                must be a letter, the last could be a letter or a number.
 */
function create_search_config_sample(string $formattedParent, string $searchConfigId): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $searchConfig = new SearchConfig();
    $request = (new CreateSearchConfigRequest())
        ->setParent($formattedParent)
        ->setSearchConfig($searchConfig)
        ->setSearchConfigId($searchConfigId);

    // Call the API and handle any network failures.
    try {
        /** @var SearchConfig $response */
        $response = $warehouseClient->createSearchConfig($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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');
    $searchConfigId = '[SEARCH_CONFIG_ID]';

    create_search_config_sample($formattedParent, $searchConfigId);
} 

createSearchHypernym

Creates a SearchHypernym inside a corpus.

The async variant is WarehouseClient::createSearchHypernymAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\CreateSearchHypernymRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\CreateSearchHypernymRequest;
use Google\Cloud\VisionAI\V1\SearchHypernym;

/**
 * @param string $formattedParent The parent resource where this SearchHypernym will be created.
 *                                Format: `projects/{project_number}/locations/{location}/corpora/{corpus}`
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function create_search_hypernym_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $searchHypernym = new SearchHypernym();
    $request = (new CreateSearchHypernymRequest())
        ->setParent($formattedParent)
        ->setSearchHypernym($searchHypernym);

    // Call the API and handle any network failures.
    try {
        /** @var SearchHypernym $response */
        $response = $warehouseClient->createSearchHypernym($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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    create_search_hypernym_sample($formattedParent);
} 

deleteAnnotation

Deletes annotation inside asset.

The async variant is WarehouseClient::deleteAnnotationAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeleteAnnotationRequest

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\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\DeleteAnnotationRequest;

/**
 * @param string $formattedName The name of the annotation to delete.
 *                              Format:
 *                              `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}`
 *                              Please see {@see WarehouseClient::annotationName()} for help formatting this field.
 */
function delete_annotation_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        $warehouseClient->deleteAnnotation($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 = WarehouseClient::annotationName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[ASSET]',
        '[ANNOTATION]'
    );

    delete_annotation_sample($formattedName);
} 

deleteAsset

Deletes asset inside corpus.

The async variant is WarehouseClient::deleteAssetAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeleteAssetRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\DeleteAssetRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the asset to delete.
 *                              Format:
 *                              `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}`
 *                              Please see {@see WarehouseClient::assetName()} for help formatting this field.
 */
function delete_asset_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } 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 = WarehouseClient::assetName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[ASSET]'
    );

    delete_asset_sample($formattedName);
} 

deleteCollection

Deletes a collection.

The async variant is WarehouseClient::deleteCollectionAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeleteCollectionRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\DeleteCollectionRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the collection to delete. Format:
 *                              `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}`
 *                              Please see {@see WarehouseClient::collectionName()} for help formatting this field.
 */
function delete_collection_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } 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 = WarehouseClient::collectionName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[COLLECTION]'
    );

    delete_collection_sample($formattedName);
} 

deleteCorpus

Deletes a corpus only if its empty.

Returns empty response.

The async variant is WarehouseClient::deleteCorpusAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeleteCorpusRequest

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\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\DeleteCorpusRequest;

/**
 * @param string $formattedName The resource name of the corpus to delete. Please see
 *                              {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function delete_corpus_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        $warehouseClient->deleteCorpus($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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    delete_corpus_sample($formattedName);
} 

deleteDataSchema

Deletes data schema inside corpus.

The async variant is WarehouseClient::deleteDataSchemaAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeleteDataSchemaRequest

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\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\DeleteDataSchemaRequest;

/**
 * @param string $formattedName The name of the data schema to delete.
 *                              Format:
 *                              `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}`
 *                              Please see {@see WarehouseClient::dataSchemaName()} for help formatting this field.
 */
function delete_data_schema_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        $warehouseClient->deleteDataSchema($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 = WarehouseClient::dataSchemaName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[DATA_SCHEMA]'
    );

    delete_data_schema_sample($formattedName);
} 

deleteIndex

Delete a single Index. In order to delete an index, the caller must make sure that it is not deployed to any index endpoint.

The async variant is WarehouseClient::deleteIndexAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeleteIndexRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\DeleteIndexRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the index to delete.
 *                              Format:
 *                              `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}`
 *                              Please see {@see WarehouseClient::indexName()} for help formatting this field.
 */
function delete_index_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } 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 = WarehouseClient::indexName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[INDEX]'
    );

    delete_index_sample($formattedName);
} 

deleteIndexEndpoint

Deletes an IndexEndpoint.

The async variant is WarehouseClient::deleteIndexEndpointAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeleteIndexEndpointRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\DeleteIndexEndpointRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Name of the resource. Please see
 *                              {@see WarehouseClient::indexEndpointName()} for help formatting this field.
 */
function delete_index_endpoint_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } 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 = WarehouseClient::indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]');

    delete_index_endpoint_sample($formattedName);
} 

deleteSearchConfig

Deletes a search configuration inside a corpus.

For a DeleteSearchConfigRequest to be valid, Request.search_configuration.name must already exist.

The async variant is WarehouseClient::deleteSearchConfigAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeleteSearchConfigRequest

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\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\DeleteSearchConfigRequest;

/**
 * @param string $formattedName The name of the search configuration to delete.
 *                              Format:
 *                              `projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}`
 *                              Please see {@see WarehouseClient::searchConfigName()} for help formatting this field.
 */
function delete_search_config_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        $warehouseClient->deleteSearchConfig($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 = WarehouseClient::searchConfigName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[SEARCH_CONFIG]'
    );

    delete_search_config_sample($formattedName);
} 

deleteSearchHypernym

Deletes a SearchHypernym inside a corpus.

The async variant is WarehouseClient::deleteSearchHypernymAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeleteSearchHypernymRequest

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\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\DeleteSearchHypernymRequest;

/**
 * @param string $formattedName The name of the SearchHypernym to delete.
 *                              Format:
 *                              `projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}`
 *                              Please see {@see WarehouseClient::searchHypernymName()} for help formatting this field.
 */
function delete_search_hypernym_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        $warehouseClient->deleteSearchHypernym($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 = WarehouseClient::searchHypernymName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[SEARCH_HYPERNYM]'
    );

    delete_search_hypernym_sample($formattedName);
} 

deployIndex

Deploys an Index to IndexEndpoint.

The async variant is WarehouseClient::deployIndexAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeployIndexRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\DeployIndexRequest;
use Google\Cloud\VisionAI\V1\DeployIndexResponse;
use Google\Cloud\VisionAI\V1\DeployedIndex;
use Google\Rpc\Status;

/**
 * @param string $formattedIndexEndpoint      IndexEndpoint the index is deployed to.
 *                                            Format:
 *                                            `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}`
 *                                            Please see {@see WarehouseClient::indexEndpointName()} for help formatting this field.
 * @param string $formattedDeployedIndexIndex Name of the deployed Index.
 *                                            Format:
 *                                            `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/indexes/{index_id}`
 *                                            Please see {@see WarehouseClient::indexName()} for help formatting this field.
 */
function deploy_index_sample(
    string $formattedIndexEndpoint,
    string $formattedDeployedIndexIndex
): void {
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $deployedIndex = (new DeployedIndex())
        ->setIndex($formattedDeployedIndexIndex);
    $request = (new DeployIndexRequest())
        ->setIndexEndpoint($formattedIndexEndpoint)
        ->setDeployedIndex($deployedIndex);

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

        if ($response->operationSucceeded()) {
            /** @var DeployIndexResponse $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
{
    $formattedIndexEndpoint = WarehouseClient::indexEndpointName(
        '[PROJECT]',
        '[LOCATION]',
        '[INDEX_ENDPOINT]'
    );
    $formattedDeployedIndexIndex = WarehouseClient::indexName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[INDEX]'
    );

    deploy_index_sample($formattedIndexEndpoint, $formattedDeployedIndexIndex);
} 

generateHlsUri

Generates a uri for an HLS manifest. The api takes in a collection of time ranges, and generates a URI for an HLS manifest that covers all the requested time ranges.

The async variant is WarehouseClient::generateHlsUriAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GenerateHlsUriRequest

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\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\GenerateHlsUriRequest;
use Google\Cloud\VisionAI\V1\GenerateHlsUriResponse;

/**
 * @param string $formattedName The resource name of the asset to request clips for.
 *                              Format:
 *                              `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}`
 *                              Please see {@see WarehouseClient::assetName()} for help formatting this field.
 */
function generate_hls_uri_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var GenerateHlsUriResponse $response */
        $response = $warehouseClient->generateHlsUri($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 = WarehouseClient::assetName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[ASSET]'
    );

    generate_hls_uri_sample($formattedName);
} 

generateRetrievalUrl

Generates a signed url for downloading the asset.

For video warehouse, please see comment of UploadAsset about how to allow retrieval of cloud storage files in a different project.

The async variant is WarehouseClient::generateRetrievalUrlAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GenerateRetrievalUrlRequest

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\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\GenerateRetrievalUrlRequest;
use Google\Cloud\VisionAI\V1\GenerateRetrievalUrlResponse;

/**
 * @param string $formattedName The resource name of the asset to request signed url for.
 *                              Format:
 *                              `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}`
 *                              Please see {@see WarehouseClient::assetName()} for help formatting this field.
 */
function generate_retrieval_url_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var GenerateRetrievalUrlResponse $response */
        $response = $warehouseClient->generateRetrievalUrl($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 = WarehouseClient::assetName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[ASSET]'
    );

    generate_retrieval_url_sample($formattedName);
} 

getAnnotation

Reads annotation inside asset.

The async variant is WarehouseClient::getAnnotationAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GetAnnotationRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Annotation;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\GetAnnotationRequest;

/**
 * @param string $formattedName The name of the annotation to retrieve.
 *                              Format:
 *                              `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}`
 *                              Please see {@see WarehouseClient::annotationName()} for help formatting this field.
 */
function get_annotation_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Annotation $response */
        $response = $warehouseClient->getAnnotation($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 = WarehouseClient::annotationName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[ASSET]',
        '[ANNOTATION]'
    );

    get_annotation_sample($formattedName);
} 

getAsset

Reads an asset inside corpus.

The async variant is WarehouseClient::getAssetAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GetAssetRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Asset;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\GetAssetRequest;

/**
 * @param string $formattedName The name of the asset to retrieve.
 *                              Format:
 *                              projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}
 *                              Please see {@see WarehouseClient::assetName()} for help formatting this field.
 */
function get_asset_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Asset $response */
        $response = $warehouseClient->getAsset($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 = WarehouseClient::assetName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[ASSET]'
    );

    get_asset_sample($formattedName);
} 

getCollection

Gets a collection.

The async variant is WarehouseClient::getCollectionAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GetCollectionRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\Collection;
use Google\Cloud\VisionAI\V1\GetCollectionRequest;

/**
 * @param string $formattedName The name of the collection to retrieve. Format:
 *                              `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}`
 *                              Please see {@see WarehouseClient::collectionName()} for help formatting this field.
 */
function get_collection_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Collection $response */
        $response = $warehouseClient->getCollection($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 = WarehouseClient::collectionName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[COLLECTION]'
    );

    get_collection_sample($formattedName);
} 

getCorpus

Gets corpus details inside a project.

The async variant is WarehouseClient::getCorpusAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GetCorpusRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\Corpus;
use Google\Cloud\VisionAI\V1\GetCorpusRequest;

/**
 * @param string $formattedName The resource name of the corpus to retrieve. Please see
 *                              {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function get_corpus_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Corpus $response */
        $response = $warehouseClient->getCorpus($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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    get_corpus_sample($formattedName);
} 

getDataSchema

Gets data schema inside corpus.

The async variant is WarehouseClient::getDataSchemaAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GetDataSchemaRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\DataSchema;
use Google\Cloud\VisionAI\V1\GetDataSchemaRequest;

/**
 * @param string $formattedName The name of the data schema to retrieve.
 *                              Format:
 *                              `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}`
 *                              Please see {@see WarehouseClient::dataSchemaName()} for help formatting this field.
 */
function get_data_schema_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var DataSchema $response */
        $response = $warehouseClient->getDataSchema($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 = WarehouseClient::dataSchemaName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[DATA_SCHEMA]'
    );

    get_data_schema_sample($formattedName);
} 

getIndex

Gets the details of a single Index under a Corpus.

The async variant is WarehouseClient::getIndexAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GetIndexRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\GetIndexRequest;
use Google\Cloud\VisionAI\V1\Index;

/**
 * @param string $formattedName Name of the Index resource.
 *                              Format:
 *                              `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}`
 *                              Please see {@see WarehouseClient::indexName()} for help formatting this field.
 */
function get_index_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Index $response */
        $response = $warehouseClient->getIndex($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 = WarehouseClient::indexName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[INDEX]'
    );

    get_index_sample($formattedName);
} 

getIndexEndpoint

Gets an IndexEndpoint.

The async variant is WarehouseClient::getIndexEndpointAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GetIndexEndpointRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\GetIndexEndpointRequest;
use Google\Cloud\VisionAI\V1\IndexEndpoint;

/**
 * @param string $formattedName Name of the IndexEndpoint resource. Please see
 *                              {@see WarehouseClient::indexEndpointName()} for help formatting this field.
 */
function get_index_endpoint_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var IndexEndpoint $response */
        $response = $warehouseClient->getIndexEndpoint($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 = WarehouseClient::indexEndpointName('[PROJECT]', '[LOCATION]', '[INDEX_ENDPOINT]');

    get_index_endpoint_sample($formattedName);
} 

getSearchConfig

Gets a search configuration inside a corpus.

The async variant is WarehouseClient::getSearchConfigAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GetSearchConfigRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\GetSearchConfigRequest;
use Google\Cloud\VisionAI\V1\SearchConfig;

/**
 * @param string $formattedName The name of the search configuration to retrieve.
 *                              Format:
 *                              `projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}`
 *                              Please see {@see WarehouseClient::searchConfigName()} for help formatting this field.
 */
function get_search_config_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var SearchConfig $response */
        $response = $warehouseClient->getSearchConfig($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 = WarehouseClient::searchConfigName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[SEARCH_CONFIG]'
    );

    get_search_config_sample($formattedName);
} 

getSearchHypernym

Gets a SearchHypernym inside a corpus.

The async variant is WarehouseClient::getSearchHypernymAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GetSearchHypernymRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\GetSearchHypernymRequest;
use Google\Cloud\VisionAI\V1\SearchHypernym;

/**
 * @param string $formattedName The name of the SearchHypernym to retrieve.
 *                              Format:
 *                              `projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}`
 *                              Please see {@see WarehouseClient::searchHypernymName()} for help formatting this field.
 */
function get_search_hypernym_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var SearchHypernym $response */
        $response = $warehouseClient->getSearchHypernym($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 = WarehouseClient::searchHypernymName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[SEARCH_HYPERNYM]'
    );

    get_search_hypernym_sample($formattedName);
} 

importAssets

Imports assets (images plus annotations) from a meta file on cloud storage.

Each row in the meta file is corresponding to an image (specified by a cloud storage uri) and its annotations.

The async variant is WarehouseClient::importAssetsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ImportAssetsRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\ImportAssetsRequest;
use Google\Cloud\VisionAI\V1\ImportAssetsResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The parent corpus resource where the assets will be imported.
 *                                Format:
 *                                `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}`
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function import_assets_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var ImportAssetsResponse $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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    import_assets_sample($formattedParent);
} 

indexAsset

Index one asset for search.

Supported corpus type: Corpus.Type.VIDEO_ON_DEMAND

The async variant is WarehouseClient::indexAssetAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\IndexAssetRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\IndexAssetRequest;
use Google\Cloud\VisionAI\V1\IndexAssetResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedName The resource name of the asset to index.
 *                              Format:
 *                              `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}`
 *                              Please see {@see WarehouseClient::assetName()} for help formatting this field.
 */
function index_asset_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var IndexAssetResponse $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 = WarehouseClient::assetName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[ASSET]'
    );

    index_asset_sample($formattedName);
} 

ingestAsset

Ingests data for the asset. It is not allowed to ingest a data chunk which is already expired according to TTL.

This method is only available via the gRPC API (not HTTP since bi-directional streaming is not supported via HTTP).

Parameters
Name
Description
callOptions
array

Optional.

↳ timeoutMillis
int

Timeout to use for this call.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\BidiStream;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\IngestAssetRequest;
use Google\Cloud\VisionAI\V1\IngestAssetResponse;

/**
 * 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 ingest_asset_sample(): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $request = new IngestAssetRequest();

    // Call the API and handle any network failures.
    try {
        /** @var BidiStream $stream */
        $stream = $warehouseClient->ingestAsset();
        $stream->writeAll([$request,]);

        /** @var IngestAssetResponse $element */
        foreach ($stream->closeWriteAndReadAll() as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
} 

listAnnotations

Lists a list of annotations inside asset.

The async variant is WarehouseClient::listAnnotationsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListAnnotationsRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Annotation;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\ListAnnotationsRequest;

/**
 * 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 list_annotations_sample(): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $request = new ListAnnotationsRequest();

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

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

listAssets

Lists an list of assets inside corpus.

The async variant is WarehouseClient::listAssetsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListAssetsRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Asset;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\ListAssetsRequest;

/**
 * @param string $formattedParent The parent, which owns this collection of assets.
 *                                Format:
 *                                `projects/{project_number}/locations/{location}/corpora/{corpus}`
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function list_assets_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        /** @var Asset $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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    list_assets_sample($formattedParent);
} 

listCollections

Lists collections inside a corpus.

The async variant is WarehouseClient::listCollectionsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListCollectionsRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\Collection;
use Google\Cloud\VisionAI\V1\ListCollectionsRequest;

/**
 * @param string $formattedParent The parent corpus. Format:
 *                                `projects/{project_number}/locations/{location}/corpora/{corpus}`
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function list_collections_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        /** @var Collection $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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    list_collections_sample($formattedParent);
} 

listCorpora

Lists all corpora in a project.

The async variant is WarehouseClient::listCorporaAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListCorporaRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\Corpus;
use Google\Cloud\VisionAI\V1\ListCorporaRequest;

/**
 * @param string $parent The resource name of the project from which to list corpora.
 */
function list_corpora_sample(string $parent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $request = (new ListCorporaRequest())
        ->setParent($parent);

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

        /** @var Corpus $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
{
    $parent = '[PARENT]';

    list_corpora_sample($parent);
} 

listDataSchemas

Lists a list of data schemas inside corpus.

The async variant is WarehouseClient::listDataSchemasAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListDataSchemasRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\DataSchema;
use Google\Cloud\VisionAI\V1\ListDataSchemasRequest;

/**
 * @param string $formattedParent The parent, which owns this collection of data schemas.
 *                                Format:
 *                                `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}`
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function list_data_schemas_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        /** @var DataSchema $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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    list_data_schemas_sample($formattedParent);
} 

listIndexEndpoints

Lists all IndexEndpoints in a project.

The async variant is WarehouseClient::listIndexEndpointsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListIndexEndpointsRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\IndexEndpoint;
use Google\Cloud\VisionAI\V1\ListIndexEndpointsRequest;

/**
 * @param string $formattedParent Format: `projects/{project}/locations/{location}`
 *                                Please see {@see WarehouseClient::locationName()} for help formatting this field.
 */
function list_index_endpoints_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        /** @var IndexEndpoint $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 = WarehouseClient::locationName('[PROJECT]', '[LOCATION]');

    list_index_endpoints_sample($formattedParent);
} 

listIndexes

List all Indexes in a given Corpus.

The async variant is WarehouseClient::listIndexesAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListIndexesRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\Index;
use Google\Cloud\VisionAI\V1\ListIndexesRequest;

/**
 * @param string $formattedParent The parent corpus that owns this collection of indexes.
 *                                Format:
 *                                `projects/{project_number}/locations/{location}/corpora/{corpus}`
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function list_indexes_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        /** @var Index $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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    list_indexes_sample($formattedParent);
} 

listSearchConfigs

Lists all search configurations inside a corpus.

The async variant is WarehouseClient::listSearchConfigsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListSearchConfigsRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\ListSearchConfigsRequest;
use Google\Cloud\VisionAI\V1\SearchConfig;

/**
 * @param string $formattedParent The parent, which owns this collection of search configurations.
 *                                Format:
 *                                `projects/{project_number}/locations/{location}/corpora/{corpus}`
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function list_search_configs_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        /** @var SearchConfig $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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    list_search_configs_sample($formattedParent);
} 

listSearchHypernyms

Lists SearchHypernyms inside a corpus.

The async variant is WarehouseClient::listSearchHypernymsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListSearchHypernymsRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\ListSearchHypernymsRequest;
use Google\Cloud\VisionAI\V1\SearchHypernym;

/**
 * @param string $formattedParent The parent, which owns this collection of SearchHypernyms.
 *                                Format:
 *                                `projects/{project_number}/locations/{location}/corpora/{corpus}`
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function list_search_hypernyms_sample(string $formattedParent): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        /** @var SearchHypernym $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 = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    list_search_hypernyms_sample($formattedParent);
} 

removeCollectionItem

Removes an item from a collection.

The async variant is WarehouseClient::removeCollectionItemAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\RemoveCollectionItemRequest

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\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\CollectionItem;
use Google\Cloud\VisionAI\V1\CollectionItem\Type;
use Google\Cloud\VisionAI\V1\RemoveCollectionItemRequest;
use Google\Cloud\VisionAI\V1\RemoveCollectionItemResponse;

/**
 * @param string $formattedItemCollection The collection name that this item belongs to. Format:
 *                                        `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}`
 *                                        Please see {@see WarehouseClient::collectionName()} for help formatting this field.
 * @param int    $itemType                The type of item.
 * @param string $itemItemResource        The name of the CollectionItem. Its format depends on the `type`
 *                                        above. For ASSET:
 *                                        `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}`
 */
function remove_collection_item_sample(
    string $formattedItemCollection,
    int $itemType,
    string $itemItemResource
): void {
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $item = (new CollectionItem())
        ->setCollection($formattedItemCollection)
        ->setType($itemType)
        ->setItemResource($itemItemResource);
    $request = (new RemoveCollectionItemRequest())
        ->setItem($item);

    // Call the API and handle any network failures.
    try {
        /** @var RemoveCollectionItemResponse $response */
        $response = $warehouseClient->removeCollectionItem($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
{
    $formattedItemCollection = WarehouseClient::collectionName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[COLLECTION]'
    );
    $itemType = Type::TYPE_UNSPECIFIED;
    $itemItemResource = '[ITEM_RESOURCE]';

    remove_collection_item_sample($formattedItemCollection, $itemType, $itemItemResource);
} 

removeIndexAsset

Remove one asset's index data for search.

Supported corpus type: Corpus.Type.VIDEO_ON_DEMAND

The async variant is WarehouseClient::removeIndexAssetAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\RemoveIndexAssetRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\RemoveIndexAssetRequest;
use Google\Cloud\VisionAI\V1\RemoveIndexAssetResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedName The resource name of the asset to index.
 *                              Format:
 *                              `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}`
 *                              Please see {@see WarehouseClient::assetName()} for help formatting this field.
 */
function remove_index_asset_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var RemoveIndexAssetResponse $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 = WarehouseClient::assetName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[ASSET]'
    );

    remove_index_asset_sample($formattedName);
} 

searchAssets

Search media asset.

The async variant is WarehouseClient::searchAssetsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\SearchAssetsRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\SearchAssetsRequest;
use Google\Cloud\VisionAI\V1\SearchResultItem;

/**
 * @param string $formattedCorpus The parent corpus to search.
 *                                Format: `projects/{project_id}/locations/{location_id}/corpora/{corpus_id}'
 *                                Please see {@see WarehouseClient::corpusName()} for help formatting this field.
 */
function search_assets_sample(string $formattedCorpus): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $request = (new SearchAssetsRequest())
        ->setCorpus($formattedCorpus);

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

        /** @var SearchResultItem $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
{
    $formattedCorpus = WarehouseClient::corpusName('[PROJECT_NUMBER]', '[LOCATION]', '[CORPUS]');

    search_assets_sample($formattedCorpus);
} 

searchIndexEndpoint

Search a deployed index endpoint (IMAGE corpus type only).

The async variant is WarehouseClient::searchIndexEndpointAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\SearchIndexEndpointRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\SearchIndexEndpointRequest;
use Google\Cloud\VisionAI\V1\SearchResultItem;

/**
 * @param string $formattedIndexEndpoint The index endpoint to search.
 *                                       Format:
 *                                       `projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}'
 *                                       Please see {@see WarehouseClient::indexEndpointName()} for help formatting this field.
 */
function search_index_endpoint_sample(string $formattedIndexEndpoint): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $request = (new SearchIndexEndpointRequest())
        ->setIndexEndpoint($formattedIndexEndpoint);

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

        /** @var SearchResultItem $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
{
    $formattedIndexEndpoint = WarehouseClient::indexEndpointName(
        '[PROJECT]',
        '[LOCATION]',
        '[INDEX_ENDPOINT]'
    );

    search_index_endpoint_sample($formattedIndexEndpoint);
} 

undeployIndex

Undeploys an Index from IndexEndpoint.

The async variant is WarehouseClient::undeployIndexAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UndeployIndexRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\UndeployIndexRequest;
use Google\Cloud\VisionAI\V1\UndeployIndexResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedIndexEndpoint Resource name of the IndexEndpoint resource on which the
 *                                       undeployment will act. Format:
 *                                       `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}`
 *                                       Please see {@see WarehouseClient::indexEndpointName()} for help formatting this field.
 */
function undeploy_index_sample(string $formattedIndexEndpoint): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $request = (new UndeployIndexRequest())
        ->setIndexEndpoint($formattedIndexEndpoint);

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

        if ($response->operationSucceeded()) {
            /** @var UndeployIndexResponse $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
{
    $formattedIndexEndpoint = WarehouseClient::indexEndpointName(
        '[PROJECT]',
        '[LOCATION]',
        '[INDEX_ENDPOINT]'
    );

    undeploy_index_sample($formattedIndexEndpoint);
} 

updateAnnotation

Updates annotation inside asset.

The async variant is WarehouseClient::updateAnnotationAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateAnnotationRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Annotation;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\UpdateAnnotationRequest;

/**
 * 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_annotation_sample(): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $annotation = new Annotation();
    $request = (new UpdateAnnotationRequest())
        ->setAnnotation($annotation);

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

updateAsset

Updates an asset inside corpus.

The async variant is WarehouseClient::updateAssetAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateAssetRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Asset;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\UpdateAssetRequest;

/**
 * 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_asset_sample(): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $asset = new Asset();
    $request = (new UpdateAssetRequest())
        ->setAsset($asset);

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

updateCollection

Updates a collection.

The async variant is WarehouseClient::updateCollectionAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateCollectionRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\Collection;
use Google\Cloud\VisionAI\V1\UpdateCollectionRequest;

/**
 * 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_collection_sample(): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $collection = new Collection();
    $request = (new UpdateCollectionRequest())
        ->setCollection($collection);

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

updateCorpus

Updates a corpus in a project.

The async variant is WarehouseClient::updateCorpusAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateCorpusRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\Corpus;
use Google\Cloud\VisionAI\V1\UpdateCorpusRequest;

/**
 * @param string $corpusDisplayName The corpus name to shown in the UI. The name can be up to 32
 *                                  characters long.
 */
function update_corpus_sample(string $corpusDisplayName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $corpus = (new Corpus())
        ->setDisplayName($corpusDisplayName);
    $request = (new UpdateCorpusRequest())
        ->setCorpus($corpus);

    // Call the API and handle any network failures.
    try {
        /** @var Corpus $response */
        $response = $warehouseClient->updateCorpus($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
{
    $corpusDisplayName = '[DISPLAY_NAME]';

    update_corpus_sample($corpusDisplayName);
} 

updateDataSchema

Updates data schema inside corpus.

The async variant is WarehouseClient::updateDataSchemaAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateDataSchemaRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\DataSchema;
use Google\Cloud\VisionAI\V1\UpdateDataSchemaRequest;

/**
 * @param string $dataSchemaKey The key of this data schema. This key should be matching the key
 *                              of user specified annotation and unique inside corpus. This value can be up
 *                              to 63 characters, and valid characters are /[a-z][0-9]-/. The first
 *                              character must be a letter, the last could be a letter or a number.
 */
function update_data_schema_sample(string $dataSchemaKey): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $dataSchema = (new DataSchema())
        ->setKey($dataSchemaKey);
    $request = (new UpdateDataSchemaRequest())
        ->setDataSchema($dataSchema);

    // Call the API and handle any network failures.
    try {
        /** @var DataSchema $response */
        $response = $warehouseClient->updateDataSchema($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
{
    $dataSchemaKey = '[KEY]';

    update_data_schema_sample($dataSchemaKey);
} 

updateIndex

Updates an Index under the corpus.

Users can perform a metadata-only update or trigger a full index rebuild with different update_mask values.

The async variant is WarehouseClient::updateIndexAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateIndexRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\Index;
use Google\Cloud\VisionAI\V1\UpdateIndexRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * 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_index_sample(): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $index = new Index();
    $updateMask = new FieldMask();
    $request = (new UpdateIndexRequest())
        ->setIndex($index)
        ->setUpdateMask($updateMask);

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

        if ($response->operationSucceeded()) {
            /** @var Index $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());
    }
} 

updateIndexEndpoint

Updates an IndexEndpoint.

The async variant is WarehouseClient::updateIndexEndpointAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateIndexEndpointRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\IndexEndpoint;
use Google\Cloud\VisionAI\V1\UpdateIndexEndpointRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * 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_index_endpoint_sample(): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $indexEndpoint = new IndexEndpoint();
    $updateMask = new FieldMask();
    $request = (new UpdateIndexEndpointRequest())
        ->setIndexEndpoint($indexEndpoint)
        ->setUpdateMask($updateMask);

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

        if ($response->operationSucceeded()) {
            /** @var IndexEndpoint $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());
    }
} 

updateSearchConfig

Updates a search configuration inside a corpus.

Please follow the rules below to create a valid UpdateSearchConfigRequest. --- General Rules ---

  1. Request.search_configuration.name must already exist.
  2. Request must contain at least one non-empty search_criteria_property or facet_property.
  3. mapped_fields must not be empty, and must map to existing UGA keys.
  4. All mapped_fields must be of the same type.
  5. All mapped_fields must share the same granularity.
  6. All mapped_fields must share the same semantic SearchConfig match options. For property-specific rules, please reference the comments for FacetProperty and SearchCriteriaProperty.

The async variant is WarehouseClient::updateSearchConfigAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateSearchConfigRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\SearchConfig;
use Google\Cloud\VisionAI\V1\UpdateSearchConfigRequest;

/**
 * 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_search_config_sample(): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $searchConfig = new SearchConfig();
    $request = (new UpdateSearchConfigRequest())
        ->setSearchConfig($searchConfig);

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

updateSearchHypernym

Updates a SearchHypernym inside a corpus.

The async variant is WarehouseClient::updateSearchHypernymAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateSearchHypernymRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\SearchHypernym;
use Google\Cloud\VisionAI\V1\UpdateSearchHypernymRequest;

/**
 * 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_search_hypernym_sample(): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $searchHypernym = new SearchHypernym();
    $request = (new UpdateSearchHypernymRequest())
        ->setSearchHypernym($searchHypernym);

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

uploadAsset

Upload asset by specifing the asset Cloud Storage uri.

For video warehouse, it requires users who call this API have read access to the cloud storage file. Once it is uploaded, it can be retrieved by GenerateRetrievalUrl API which by default, only can retrieve cloud storage files from the same project of the warehouse. To allow retrieval cloud storage files that are in a separate project, it requires to find the vision ai service account (Go to IAM, check checkbox to show "Include Google-provided role grants", search for "Cloud Vision AI Service Agent") and grant the read access of the cloud storage files to that service account.

The async variant is WarehouseClient::uploadAssetAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UploadAssetRequest

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\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\UploadAssetRequest;
use Google\Cloud\VisionAI\V1\UploadAssetResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedName The resource name of the asset to upload.
 *                              Format:
 *                              `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}`
 *                              Please see {@see WarehouseClient::assetName()} for help formatting this field.
 */
function upload_asset_sample(string $formattedName): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var UploadAssetResponse $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 = WarehouseClient::assetName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[ASSET]'
    );

    upload_asset_sample($formattedName);
} 

viewCollectionItems

View items inside a collection.

The async variant is WarehouseClient::viewCollectionItemsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ViewCollectionItemsRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\CollectionItem;
use Google\Cloud\VisionAI\V1\ViewCollectionItemsRequest;

/**
 * @param string $formattedCollection The collection to view. Format:
 *                                    `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}`
 *                                    Please see {@see WarehouseClient::collectionName()} for help formatting this field.
 */
function view_collection_items_sample(string $formattedCollection): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $request = (new ViewCollectionItemsRequest())
        ->setCollection($formattedCollection);

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

        /** @var CollectionItem $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
{
    $formattedCollection = WarehouseClient::collectionName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[COLLECTION]'
    );

    view_collection_items_sample($formattedCollection);
} 

viewIndexedAssets

Lists assets inside an index.

The async variant is WarehouseClient::viewIndexedAssetsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ViewIndexedAssetsRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;
use Google\Cloud\VisionAI\V1\IndexedAsset;
use Google\Cloud\VisionAI\V1\ViewIndexedAssetsRequest;

/**
 * @param string $formattedIndex The index that owns this collection of assets.
 *                               Format:
 *                               `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}`
 *                               Please see {@see WarehouseClient::indexName()} for help formatting this field.
 */
function view_indexed_assets_sample(string $formattedIndex): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $request = (new ViewIndexedAssetsRequest())
        ->setIndex($formattedIndex);

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

        /** @var IndexedAsset $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
{
    $formattedIndex = WarehouseClient::indexName(
        '[PROJECT_NUMBER]',
        '[LOCATION]',
        '[CORPUS]',
        '[INDEX]'
    );

    view_indexed_assets_sample($formattedIndex);
} 

getLocation

Gets information about a location.

The async variant is WarehouseClient::getLocationAsync() .

Parameters
Name
Description
request
Google\Cloud\Location\GetLocationRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;

/**
 * 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 get_location_sample(): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $request = new GetLocationRequest();

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

listLocations

Lists information about the supported locations for this service.

The async variant is WarehouseClient::listLocationsAsync() .

Parameters
Name
Description
request
Google\Cloud\Location\ListLocationsRequest

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
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\VisionAI\V1\Client\WarehouseClient;

/**
 * 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 list_locations_sample(): void
{
    // Create a client.
    $warehouseClient = new WarehouseClient();

    // Prepare the request message.
    $request = new ListLocationsRequest();

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

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

addCollectionItemAsync

Parameters
Name
Description
optionalArgs
array

analyzeAssetAsync

Parameters
Name
Description
optionalArgs
array

analyzeCorpusAsync

Parameters
Name
Description
optionalArgs
array

clipAssetAsync

Parameters
Name
Description
optionalArgs
array

createAnnotationAsync

Parameters
Name
Description
optionalArgs
array

createAssetAsync

Parameters
Name
Description
optionalArgs
array

createCollectionAsync

Parameters
Name
Description
optionalArgs
array

createCorpusAsync

Parameters
Name
Description
optionalArgs
array

createDataSchemaAsync

Parameters
Name
Description
optionalArgs
array

createIndexAsync

Parameters
Name
Description
optionalArgs
array

createIndexEndpointAsync

Parameters
Name
Description
optionalArgs
array

createSearchConfigAsync

Parameters
Name
Description
optionalArgs
array

createSearchHypernymAsync

Parameters
Name
Description
optionalArgs
array

deleteAnnotationAsync

Parameters
Name
Description
optionalArgs
array
Returns
Type
Description

deleteAssetAsync

Parameters
Name
Description
optionalArgs
array

deleteCollectionAsync

Parameters
Name
Description
optionalArgs
array

deleteCorpusAsync

Parameters
Name
Description
optionalArgs
array
Returns
Type
Description

deleteDataSchemaAsync

Parameters
Name
Description
optionalArgs
array
Returns
Type
Description

deleteIndexAsync

Parameters
Name
Description
optionalArgs
array

deleteIndexEndpointAsync

Parameters
Name
Description
optionalArgs
array

deleteSearchConfigAsync

Parameters
Name
Description
optionalArgs
array
Returns
Type
Description

deleteSearchHypernymAsync

Parameters
Name
Description
optionalArgs
array
Returns
Type
Description

deployIndexAsync

Parameters
Name
Description
optionalArgs
array

generateHlsUriAsync

Parameters
Name
Description
optionalArgs
array

generateRetrievalUrlAsync

Parameters
Name
Description
optionalArgs
array

getAnnotationAsync

Parameters
Name
Description
optionalArgs
array

getAssetAsync

Parameters
Name
Description
optionalArgs
array

getCollectionAsync

Parameters
Name
Description
optionalArgs
array

getCorpusAsync

Parameters
Name
Description
optionalArgs
array

getDataSchemaAsync

Parameters
Name
Description
optionalArgs
array

getIndexAsync

Parameters
Name
Description
optionalArgs
array

getIndexEndpointAsync

Parameters
Name
Description
optionalArgs
array

getSearchConfigAsync

Parameters
Name
Description
optionalArgs
array

getSearchHypernymAsync

Parameters
Name
Description
optionalArgs
array

importAssetsAsync

Parameters
Name
Description
optionalArgs
array

indexAssetAsync

Parameters
Name
Description
optionalArgs
array

listAnnotationsAsync

Parameters
Name
Description
optionalArgs
array

listAssetsAsync

Parameters
Name
Description
optionalArgs
array

listCollectionsAsync

Parameters
Name
Description
optionalArgs
array

listCorporaAsync

Parameters
Name
Description
optionalArgs
array

listDataSchemasAsync

Parameters
Name
Description
optionalArgs
array

listIndexEndpointsAsync

Parameters
Name
Description
optionalArgs
array

listIndexesAsync

Parameters
Name
Description
optionalArgs
array

listSearchConfigsAsync

Parameters
Name
Description
optionalArgs
array

listSearchHypernymsAsync

Parameters
Name
Description
optionalArgs
array

removeCollectionItemAsync

Parameters
Name
Description
optionalArgs
array

removeIndexAssetAsync

Parameters
Name
Description
optionalArgs
array

searchAssetsAsync

Parameters
Name
Description
optionalArgs
array

searchIndexEndpointAsync

Parameters
Name
Description
optionalArgs
array

undeployIndexAsync

Parameters
Name
Description
optionalArgs
array

updateAnnotationAsync

Parameters
Name
Description
optionalArgs
array

updateAssetAsync

Parameters
Name
Description
optionalArgs
array

updateCollectionAsync

Parameters
Name
Description
optionalArgs
array

updateCorpusAsync

Parameters
Name
Description
optionalArgs
array

updateDataSchemaAsync

Parameters
Name
Description
optionalArgs
array

updateIndexAsync

Parameters
Name
Description
optionalArgs
array

updateIndexEndpointAsync

Parameters
Name
Description
optionalArgs
array

updateSearchConfigAsync

Parameters
Name
Description
optionalArgs
array

updateSearchHypernymAsync

Parameters
Name
Description
optionalArgs
array

uploadAssetAsync

Parameters
Name
Description
optionalArgs
array

viewCollectionItemsAsync

Parameters
Name
Description
optionalArgs
array

viewIndexedAssetsAsync

Parameters
Name
Description
optionalArgs
array

getLocationAsync

Parameters
Name
Description
optionalArgs
array

listLocationsAsync

Parameters
Name
Description
optionalArgs
array

getOperationsClient

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

Returns
Type
Description
Google\LongRunning\Client\OperationsClient

resumeOperation

Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.

Parameters
Name
Description
operationName
string

The name of the long running operation

methodName
string

The name of the method used to start the operation

Returns
Type
Description

static::annotationName

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

Parameters
Name
Description
projectNumber
string
location
string
corpus
string
asset
string
annotation
string
Returns
Type
Description
string
The formatted annotation resource.

static::assetName

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

Parameters
Name
Description
projectNumber
string
location
string
corpus
string
asset
string
Returns
Type
Description
string
The formatted asset resource.

static::collectionName

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

Parameters
Name
Description
projectNumber
string
location
string
corpus
string
collection
string
Returns
Type
Description
string
The formatted collection resource.

static::corpusName

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

Parameters
Name
Description
projectNumber
string
location
string
corpus
string
Returns
Type
Description
string
The formatted corpus resource.

static::dataSchemaName

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

Parameters
Name
Description
projectNumber
string
location
string
corpus
string
dataSchema
string
Returns
Type
Description
string
The formatted data_schema resource.

static::indexName

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

Parameters
Name
Description
projectNumber
string
location
string
corpus
string
index
string
Returns
Type
Description
string
The formatted index resource.

static::indexEndpointName

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

Parameters
Name
Description
project
string
location
string
indexEndpoint
string
Returns
Type
Description
string
The formatted index_endpoint resource.

static::locationName

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

Parameters
Name
Description
project
string
location
string
Returns
Type
Description
string
The formatted location resource.

static::searchConfigName

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

Parameters
Name
Description
projectNumber
string
location
string
corpus
string
searchConfig
string
Returns
Type
Description
string
The formatted search_config resource.

static::searchHypernymName

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

Parameters
Name
Description
projectNumber
string
location
string
corpus
string
searchHypernym
string
Returns
Type
Description
string
The formatted search_hypernym 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

  • annotation: projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}
  • asset: projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}
  • collection: projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}
  • corpus: projects/{project_number}/locations/{location}/corpora/{corpus}
  • dataSchema: projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}
  • index: projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}
  • indexEndpoint: projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}
  • location: projects/{project}/locations/{location}
  • searchConfig: projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}
  • searchHypernym: projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
Name
Description
formattedName
string

The formatted name string

template
?string

Optional name of template to match

Returns
Type
Description
array
An associative array from name component IDs to component values.
Create a Mobile Website
View Site in Mobile | Classic
Share by: