# Google Cloud Retail V2 Client - Class ProductServiceClient (2.5.3)

2.5.3 (latest) 2.5.2 2.4.0 2.3.1 2.2.1 2.1.3 2.0.0 1.7.0 1.6.4 1.5.0 1.4.2 1.3.1 1.2.1 1.1.1 1.0.1 Reference documentation and code samples for the Google Cloud Retail V2 Client class ProductServiceClient.

Service Description: Service for ingesting [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) information
of the customer's website.

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 \\ Retail \\ V2 \\ Client

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `options` | `array|https://docs.cloud.google.com/php/docs/reference/gax/latest/Options.ClientOptions.html` 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` | `https://docs.cloud.google.com/php/docs/reference/auth/latest/FetchAuthTokenInterface.html|https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html` This option should only be used with a pre-constructed [Google\\Auth\\FetchAuthTokenInterface](https://docs.cloud.google.com/php/docs/reference/auth/latest/FetchAuthTokenInterface.html) or [Google\\ApiCore\\CredentialsWrapper](https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html) 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\Retail\V2\ProductServiceClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new ProductServiceClient(['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()](https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html#_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|https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.TransportInterface.html` 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](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.TransportInterface.html) 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()](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.GrpcTransport.html#_Google_ApiCore_Transport_GrpcTransport__build__) and [Google\\ApiCore\\Transport\\RestTransport::build()](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.RestTransport.html#_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|Psr\Log\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'. |

### addFulfillmentPlaces

We recommend that you use the
[ProductService.AddLocalInventories](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__addLocalInventories__)
method instead of the
[ProductService.AddFulfillmentPlaces](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__addFulfillmentPlaces__)
method.

[ProductService.AddLocalInventories](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__addLocalInventories__)
achieves the same results but provides more fine-grained control over
ingesting local inventory data.

Incrementally adds place IDs to
[Product.fulfillment_info.place_ids](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.FulfillmentInfo#_Google_Cloud_Retail_V2_FulfillmentInfo__getPlaceIds__).

This process is asynchronous and does not require the
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) to exist before updating
fulfillment information. If the request is valid, the update will be
enqueued and processed downstream. As a consequence, when a response is
returned, the added place IDs are not immediately manifested in the
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) queried by
[ProductService.GetProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__getProduct__)
or
[ProductService.ListProducts](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__listProducts__).

The returned Operations will be obsolete
after 1 day, and GetOperation
API will return NOT_FOUND afterwards.

If conflicting updates are issued, the
Operations associated with the stale
updates will not be marked as done
until being obsolete.

The async variant is [ProductServiceClient::addFulfillmentPlacesAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__addFulfillmentPlacesAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.AddFulfillmentPlacesRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.AddFulfillmentPlacesResponse>` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\OperationResponse;
    use Google\Cloud\Retail\V2\AddFulfillmentPlacesRequest;
    use Google\Cloud\Retail\V2\AddFulfillmentPlacesResponse;
    use Google\Cloud\Retail\V2\Client\ProductServiceClient;
    use Google\Rpc\Status;

    /**
     * @param string $formattedProduct Full resource name of [Product][google.cloud.retail.v2.Product],
     *                                 such as
     *                                 `projects/&#42;/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
     *
     *                                 If the caller does not have permission to access the
     *                                 [Product][google.cloud.retail.v2.Product], regardless of whether or not it
     *                                 exists, a PERMISSION_DENIED error is returned. Please see
     *                                 {@see ProductServiceClient::productName()} for help formatting this field.
     * @param string $type             The fulfillment type, including commonly used types (such as
     *                                 pickup in store and same day delivery), and custom types.
     *
     *                                 Supported values:
     *
     *                                 * "pickup-in-store"
     *                                 * "ship-to-store"
     *                                 * "same-day-delivery"
     *                                 * "next-day-delivery"
     *                                 * "custom-type-1"
     *                                 * "custom-type-2"
     *                                 * "custom-type-3"
     *                                 * "custom-type-4"
     *                                 * "custom-type-5"
     *
     *                                 If this field is set to an invalid value other than these, an
     *                                 INVALID_ARGUMENT error is returned.
     *
     *                                 This field directly corresponds to
     *                                 [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
     * @param string $placeIdsElement  The IDs for this
     *                                 [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type], such as
     *                                 the store IDs for "pickup-in-store" or the region IDs for
     *                                 "same-day-delivery" to be added for this
     *                                 [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]. Duplicate
     *                                 IDs will be automatically ignored.
     *
     *                                 At least 1 value is required, and a maximum of 2000 values are allowed.
     *                                 Each value must be a string with a length limit of 10 characters, matching
     *                                 the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
     *                                 INVALID_ARGUMENT error is returned.
     *
     *                                 If the total number of place IDs exceeds 2000 for this
     *                                 [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type] after
     *                                 adding, then the update will be rejected.
     */
    function add_fulfillment_places_sample(
        string $formattedProduct,
        string $type,
        string $placeIdsElement
    ): void {
        // Create a client.
        $productServiceClient = new ProductServiceClient();

        // Prepare the request message.
        $placeIds = [$placeIdsElement,];
        $request = (new AddFulfillmentPlacesRequest())
            ->setProduct($formattedProduct)
            ->setType($type)
            ->setPlaceIds($placeIds);

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

            if ($response->operationSucceeded()) {
                /** @var AddFulfillmentPlacesResponse $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
    {
        $formattedProduct = ProductServiceClient::productName(
            '[PROJECT]',
            '[LOCATION]',
            '[CATALOG]',
            '[BRANCH]',
            '[PRODUCT]'
        );
        $type = '[TYPE]';
        $placeIdsElement = '[PLACE_IDS]';

        add_fulfillment_places_sample($formattedProduct, $type, $placeIdsElement);
    }

### addLocalInventories

Updates local inventory information for a
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) at a list of places, while
respecting the last update timestamps of each inventory field.

This process is asynchronous and does not require the
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) to exist before updating
inventory information. If the request is valid, the update will be enqueued
and processed downstream. As a consequence, when a response is returned,
updates are not immediately manifested in the
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) queried by
[ProductService.GetProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__getProduct__)
or
[ProductService.ListProducts](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__listProducts__).

Local inventory information can only be modified using this method.
[ProductService.CreateProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__createProduct__)
and
[ProductService.UpdateProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__updateProduct__)
has no effect on local inventories.

The returned Operations will be obsolete
after 1 day, and GetOperation
API will return NOT_FOUND afterwards.

If conflicting updates are issued, the
Operations associated with the stale
updates will not be marked as done
until being obsolete.

The async variant is [ProductServiceClient::addLocalInventoriesAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__addLocalInventoriesAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.AddLocalInventoriesRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.AddLocalInventoriesResponse>` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\OperationResponse;
    use Google\Cloud\Retail\V2\AddLocalInventoriesRequest;
    use Google\Cloud\Retail\V2\AddLocalInventoriesResponse;
    use Google\Cloud\Retail\V2\Client\ProductServiceClient;
    use Google\Cloud\Retail\V2\LocalInventory;
    use Google\Rpc\Status;

    /**
     * @param string $formattedProduct Full resource name of [Product][google.cloud.retail.v2.Product],
     *                                 such as
     *                                 `projects/&#42;/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
     *
     *                                 If the caller does not have permission to access the
     *                                 [Product][google.cloud.retail.v2.Product], regardless of whether or not it
     *                                 exists, a PERMISSION_DENIED error is returned. Please see
     *                                 {@see ProductServiceClient::productName()} for help formatting this field.
     */
    function add_local_inventories_sample(string $formattedProduct): void
    {
        // Create a client.
        $productServiceClient = new ProductServiceClient();

        // Prepare the request message.
        $localInventories = [new LocalInventory()];
        $request = (new AddLocalInventoriesRequest())
            ->setProduct($formattedProduct)
            ->setLocalInventories($localInventories);

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

            if ($response->operationSucceeded()) {
                /** @var AddLocalInventoriesResponse $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
    {
        $formattedProduct = ProductServiceClient::productName(
            '[PROJECT]',
            '[LOCATION]',
            '[CATALOG]',
            '[BRANCH]',
            '[PRODUCT]'
        );

        add_local_inventories_sample($formattedProduct);
    }

### createProduct

Creates a [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product).

The async variant is [ProductServiceClient::createProductAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__createProductAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.CreateProductRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\Retail\V2\Client\ProductServiceClient;
    use Google\Cloud\Retail\V2\CreateProductRequest;
    use Google\Cloud\Retail\V2\Product;

    /**
     * @param string $formattedParent The parent catalog resource name, such as
     *                                `projects/&#42;/locations/global/catalogs/default_catalog/branches/default_branch`. Please see
     *                                {@see ProductServiceClient::branchName()} for help formatting this field.
     * @param string $productTitle    Product title.
     *
     *                                This field must be a UTF-8 encoded string with a length limit of 1,000
     *                                characters. Otherwise, an INVALID_ARGUMENT error is returned.
     *
     *                                Corresponding properties: Google Merchant Center property
     *                                [title](https://support.google.com/merchants/answer/6324415). Schema.org
     *                                property [Product.name](https://schema.org/name).
     * @param string $productId       The ID to use for the [Product][google.cloud.retail.v2.Product],
     *                                which will become the final component of the
     *                                [Product.name][google.cloud.retail.v2.Product.name].
     *
     *                                If the caller does not have permission to create the
     *                                [Product][google.cloud.retail.v2.Product], regardless of whether or not it
     *                                exists, a PERMISSION_DENIED error is returned.
     *
     *                                This field must be unique among all
     *                                [Product][google.cloud.retail.v2.Product]s with the same
     *                                [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
     *                                ALREADY_EXISTS error is returned.
     *
     *                                This field must be a UTF-8 encoded string with a length limit of 128
     *                                characters. Otherwise, an INVALID_ARGUMENT error is returned.
     */
    function create_product_sample(
        string $formattedParent,
        string $productTitle,
        string $productId
    ): void {
        // Create a client.
        $productServiceClient = new ProductServiceClient();

        // Prepare the request message.
        $product = (new Product())
            ->setTitle($productTitle);
        $request = (new CreateProductRequest())
            ->setParent($formattedParent)
            ->setProduct($product)
            ->setProductId($productId);

        // Call the API and handle any network failures.
        try {
            /** @var Product $response */
            $response = $productServiceClient->createProduct($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 = ProductServiceClient::branchName(
            '[PROJECT]',
            '[LOCATION]',
            '[CATALOG]',
            '[BRANCH]'
        );
        $productTitle = '[TITLE]';
        $productId = '[PRODUCT_ID]';

        create_product_sample($formattedParent, $productTitle, $productId);
    }

### deleteProduct

Deletes a [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product).

The async variant is [ProductServiceClient::deleteProductAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__deleteProductAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.DeleteProductRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\Retail\V2\Client\ProductServiceClient;
    use Google\Cloud\Retail\V2\DeleteProductRequest;

    /**
     * @param string $formattedName Full resource name of [Product][google.cloud.retail.v2.Product],
     *                              such as
     *                              `projects/&#42;/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
     *
     *                              If the caller does not have permission to delete the
     *                              [Product][google.cloud.retail.v2.Product], regardless of whether or not it
     *                              exists, a PERMISSION_DENIED error is returned.
     *
     *                              If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
     *                              a NOT_FOUND error is returned.
     *
     *                              The [Product][google.cloud.retail.v2.Product] to delete can neither be a
     *                              [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
     *                              [Product][google.cloud.retail.v2.Product] member nor a
     *                              [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
     *                              [Product][google.cloud.retail.v2.Product] with more than one
     *                              [variants][google.cloud.retail.v2.Product.Type.VARIANT]. Otherwise, an
     *                              INVALID_ARGUMENT error is returned.
     *
     *                              All inventory information for the named
     *                              [Product][google.cloud.retail.v2.Product] will be deleted. Please see
     *                              {@see ProductServiceClient::productName()} for help formatting this field.
     */
    function delete_product_sample(string $formattedName): void
    {
        // Create a client.
        $productServiceClient = new ProductServiceClient();

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

        // Call the API and handle any network failures.
        try {
            $productServiceClient->deleteProduct($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 = ProductServiceClient::productName(
            '[PROJECT]',
            '[LOCATION]',
            '[CATALOG]',
            '[BRANCH]',
            '[PRODUCT]'
        );

        delete_product_sample($formattedName);
    }

### getProduct

Gets a [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product).

The async variant is [ProductServiceClient::getProductAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__getProductAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.GetProductRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\Retail\V2\Client\ProductServiceClient;
    use Google\Cloud\Retail\V2\GetProductRequest;
    use Google\Cloud\Retail\V2\Product;

    /**
     * @param string $formattedName Full resource name of [Product][google.cloud.retail.v2.Product],
     *                              such as
     *                              `projects/&#42;/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
     *
     *                              If the caller does not have permission to access the
     *                              [Product][google.cloud.retail.v2.Product], regardless of whether or not it
     *                              exists, a PERMISSION_DENIED error is returned.
     *
     *                              If the requested [Product][google.cloud.retail.v2.Product] does not exist,
     *                              a NOT_FOUND error is returned. Please see
     *                              {@see ProductServiceClient::productName()} for help formatting this field.
     */
    function get_product_sample(string $formattedName): void
    {
        // Create a client.
        $productServiceClient = new ProductServiceClient();

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

        // Call the API and handle any network failures.
        try {
            /** @var Product $response */
            $response = $productServiceClient->getProduct($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 = ProductServiceClient::productName(
            '[PROJECT]',
            '[LOCATION]',
            '[CATALOG]',
            '[BRANCH]',
            '[PRODUCT]'
        );

        get_product_sample($formattedName);
    }

### importProducts

Bulk import of multiple [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s.

Request processing may be synchronous.
Non-existing items are created.

Note that it is possible for a subset of the
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s to be successfully updated.

The async variant is [ProductServiceClient::importProductsAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__importProductsAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ImportProductsRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ImportProductsResponse>` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\OperationResponse;
    use Google\Cloud\Retail\V2\Client\ProductServiceClient;
    use Google\Cloud\Retail\V2\ImportProductsRequest;
    use Google\Cloud\Retail\V2\ImportProductsResponse;
    use Google\Cloud\Retail\V2\ProductInputConfig;
    use Google\Rpc\Status;

    /**
     * @param string $formattedParent Required.
     *                                `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch`
     *
     *                                If no updateMask is specified, requires products.create permission.
     *                                If updateMask is specified, requires products.update permission. Please see
     *                                {@see ProductServiceClient::branchName()} for help formatting this field.
     */
    function import_products_sample(string $formattedParent): void
    {
        // Create a client.
        $productServiceClient = new ProductServiceClient();

        // Prepare the request message.
        $inputConfig = new ProductInputConfig();
        $request = (new ImportProductsRequest())
            ->setParent($formattedParent)
            ->setInputConfig($inputConfig);

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

            if ($response->operationSucceeded()) {
                /** @var ImportProductsResponse $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 = ProductServiceClient::branchName(
            '[PROJECT]',
            '[LOCATION]',
            '[CATALOG]',
            '[BRANCH]'
        );

        import_products_sample($formattedParent);
    }

### listProducts

Gets a list of [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s.

The async variant is [ProductServiceClient::listProductsAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__listProductsAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ListProductsRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\PagedListResponse;
    use Google\Cloud\Retail\V2\Client\ProductServiceClient;
    use Google\Cloud\Retail\V2\ListProductsRequest;
    use Google\Cloud\Retail\V2\Product;

    /**
     * @param string $formattedParent The parent branch resource name, such as
     *                                `projects/&#42;/locations/global/catalogs/default_catalog/branches/0`. Use
     *                                `default_branch` as the branch ID, to list products under the default
     *                                branch.
     *
     *                                If the caller does not have permission to list
     *                                [Product][google.cloud.retail.v2.Product]s under this branch, regardless of
     *                                whether or not this branch exists, a PERMISSION_DENIED error is returned. Please see
     *                                {@see ProductServiceClient::branchName()} for help formatting this field.
     */
    function list_products_sample(string $formattedParent): void
    {
        // Create a client.
        $productServiceClient = new ProductServiceClient();

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

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

            /** @var Product $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 = ProductServiceClient::branchName(
            '[PROJECT]',
            '[LOCATION]',
            '[CATALOG]',
            '[BRANCH]'
        );

        list_products_sample($formattedParent);
    }

### purgeProducts

Permanently deletes all selected [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s
under a branch.

This process is asynchronous. If the request is valid, the removal will be
enqueued and processed offline. Depending on the number of
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s, this operation could take hours
to complete. Before the operation completes, some
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s may still be returned by
[ProductService.GetProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__getProduct__)
or
[ProductService.ListProducts](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__listProducts__).

Depending on the number of [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s, this
operation could take hours to complete. To get a sample of
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product)s that would be deleted, set
[PurgeProductsRequest.force](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PurgeProductsRequest#_Google_Cloud_Retail_V2_PurgeProductsRequest__getForce__)
to false.

The async variant is [ProductServiceClient::purgeProductsAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__purgeProductsAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PurgeProductsRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PurgeProductsResponse>` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\OperationResponse;
    use Google\Cloud\Retail\V2\Client\ProductServiceClient;
    use Google\Cloud\Retail\V2\PurgeProductsRequest;
    use Google\Cloud\Retail\V2\PurgeProductsResponse;
    use Google\Rpc\Status;

    /**
     * @param string $formattedParent The resource name of the branch under which the products are
     *                                created. The format is
     *                                `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}`
     *                                Please see {@see ProductServiceClient::branchName()} for help formatting this field.
     * @param string $filter          The filter string to specify the products to be deleted with a
     *                                length limit of 5,000 characters.
     *
     *                                Empty string filter is not allowed. "*" implies delete all items in a
     *                                branch.
     *
     *                                The eligible fields for filtering are:
     *
     *                                * `availability`: Double quoted
     *                                [Product.availability][google.cloud.retail.v2.Product.availability] string.
     *                                * `create_time` : in ISO 8601 "zulu" format.
     *
     *                                Supported syntax:
     *
     *                                * Comparators (">", "<", ">=", "<=", "=").
     *                                Examples:
     *                                * create_time <= "2015-02-13T17:05:46Z"
     *                                * availability = "IN_STOCK"
     *
     *                                * Conjunctions ("AND")
     *                                Examples:
     *                                * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER"
     *
     *                                * Disjunctions ("OR")
     *                                Examples:
     *                                * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK"
     *
     *                                * Can support nested queries.
     *                                Examples:
     *                                * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER")
     *                                OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK")
     *
     *                                * Filter Limits:
     *                                * Filter should not contain more than 6 conditions.
     *                                * Max nesting depth should not exceed 2 levels.
     *
     *                                Examples queries:
     *                                * Delete back order products created before a timestamp.
     *                                create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER"
     */
    function purge_products_sample(string $formattedParent, string $filter): void
    {
        // Create a client.
        $productServiceClient = new ProductServiceClient();

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

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

            if ($response->operationSucceeded()) {
                /** @var PurgeProductsResponse $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 = ProductServiceClient::branchName(
            '[PROJECT]',
            '[LOCATION]',
            '[CATALOG]',
            '[BRANCH]'
        );
        $filter = '[FILTER]';

        purge_products_sample($formattedParent, $filter);
    }

### removeFulfillmentPlaces

We recommend that you use the
[ProductService.RemoveLocalInventories](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__removeLocalInventories__)
method instead of the
[ProductService.RemoveFulfillmentPlaces](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__removeFulfillmentPlaces__)
method.

[ProductService.RemoveLocalInventories](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__removeLocalInventories__)
achieves the same results but provides more fine-grained control over
ingesting local inventory data.

Incrementally removes place IDs from a
[Product.fulfillment_info.place_ids](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.FulfillmentInfo#_Google_Cloud_Retail_V2_FulfillmentInfo__getPlaceIds__).

This process is asynchronous and does not require the
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) to exist before updating
fulfillment information. If the request is valid, the update will be
enqueued and processed downstream. As a consequence, when a response is
returned, the removed place IDs are not immediately manifested in the
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) queried by
[ProductService.GetProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__getProduct__)
or
[ProductService.ListProducts](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__listProducts__).

The returned Operations will be obsolete
after 1 day, and GetOperation
API will return NOT_FOUND afterwards.

If conflicting updates are issued, the
Operations associated with the stale
updates will not be marked as done
until being obsolete.

The async variant is [ProductServiceClient::removeFulfillmentPlacesAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__removeFulfillmentPlacesAsync__)
.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.RemoveFulfillmentPlacesRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.RemoveFulfillmentPlacesResponse>` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\OperationResponse;
    use Google\Cloud\Retail\V2\Client\ProductServiceClient;
    use Google\Cloud\Retail\V2\RemoveFulfillmentPlacesRequest;
    use Google\Cloud\Retail\V2\RemoveFulfillmentPlacesResponse;
    use Google\Rpc\Status;

    /**
     * @param string $formattedProduct Full resource name of [Product][google.cloud.retail.v2.Product],
     *                                 such as
     *                                 `projects/&#42;/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
     *
     *                                 If the caller does not have permission to access the
     *                                 [Product][google.cloud.retail.v2.Product], regardless of whether or not it
     *                                 exists, a PERMISSION_DENIED error is returned. Please see
     *                                 {@see ProductServiceClient::productName()} for help formatting this field.
     * @param string $type             The fulfillment type, including commonly used types (such as
     *                                 pickup in store and same day delivery), and custom types.
     *
     *                                 Supported values:
     *
     *                                 * "pickup-in-store"
     *                                 * "ship-to-store"
     *                                 * "same-day-delivery"
     *                                 * "next-day-delivery"
     *                                 * "custom-type-1"
     *                                 * "custom-type-2"
     *                                 * "custom-type-3"
     *                                 * "custom-type-4"
     *                                 * "custom-type-5"
     *
     *                                 If this field is set to an invalid value other than these, an
     *                                 INVALID_ARGUMENT error is returned.
     *
     *                                 This field directly corresponds to
     *                                 [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
     * @param string $placeIdsElement  The IDs for this
     *                                 [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type], such as
     *                                 the store IDs for "pickup-in-store" or the region IDs for
     *                                 "same-day-delivery", to be removed for this
     *                                 [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type].
     *
     *                                 At least 1 value is required, and a maximum of 2000 values are allowed.
     *                                 Each value must be a string with a length limit of 10 characters, matching
     *                                 the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
     *                                 INVALID_ARGUMENT error is returned.
     */
    function remove_fulfillment_places_sample(
        string $formattedProduct,
        string $type,
        string $placeIdsElement
    ): void {
        // Create a client.
        $productServiceClient = new ProductServiceClient();

        // Prepare the request message.
        $placeIds = [$placeIdsElement,];
        $request = (new RemoveFulfillmentPlacesRequest())
            ->setProduct($formattedProduct)
            ->setType($type)
            ->setPlaceIds($placeIds);

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

            if ($response->operationSucceeded()) {
                /** @var RemoveFulfillmentPlacesResponse $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
    {
        $formattedProduct = ProductServiceClient::productName(
            '[PROJECT]',
            '[LOCATION]',
            '[CATALOG]',
            '[BRANCH]',
            '[PRODUCT]'
        );
        $type = '[TYPE]';
        $placeIdsElement = '[PLACE_IDS]';

        remove_fulfillment_places_sample($formattedProduct, $type, $placeIdsElement);
    }

### removeLocalInventories

Remove local inventory information for a
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) at a list of places at a removal
timestamp.

This process is asynchronous. If the request is valid, the removal will be
enqueued and processed downstream. As a consequence, when a response is
returned, removals are not immediately manifested in the
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) queried by
[ProductService.GetProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__getProduct__)
or
[ProductService.ListProducts](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__listProducts__).

Local inventory information can only be removed using this method.
[ProductService.CreateProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__createProduct__)
and
[ProductService.UpdateProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__updateProduct__)
has no effect on local inventories.

The returned Operations will be obsolete
after 1 day, and GetOperation
API will return NOT_FOUND afterwards.

If conflicting updates are issued, the
Operations associated with the stale
updates will not be marked as done
until being obsolete.

The async variant is [ProductServiceClient::removeLocalInventoriesAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__removeLocalInventoriesAsync__)
.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.RemoveLocalInventoriesRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.RemoveLocalInventoriesResponse>` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\OperationResponse;
    use Google\Cloud\Retail\V2\Client\ProductServiceClient;
    use Google\Cloud\Retail\V2\RemoveLocalInventoriesRequest;
    use Google\Cloud\Retail\V2\RemoveLocalInventoriesResponse;
    use Google\Rpc\Status;

    /**
     * @param string $formattedProduct Full resource name of [Product][google.cloud.retail.v2.Product],
     *                                 such as
     *                                 `projects/&#42;/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
     *
     *                                 If the caller does not have permission to access the
     *                                 [Product][google.cloud.retail.v2.Product], regardless of whether or not it
     *                                 exists, a PERMISSION_DENIED error is returned. Please see
     *                                 {@see ProductServiceClient::productName()} for help formatting this field.
     * @param string $placeIdsElement  A list of place IDs to have their inventory deleted.
     *                                 At most 3000 place IDs are allowed per request.
     */
    function remove_local_inventories_sample(string $formattedProduct, string $placeIdsElement): void
    {
        // Create a client.
        $productServiceClient = new ProductServiceClient();

        // Prepare the request message.
        $placeIds = [$placeIdsElement,];
        $request = (new RemoveLocalInventoriesRequest())
            ->setProduct($formattedProduct)
            ->setPlaceIds($placeIds);

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

            if ($response->operationSucceeded()) {
                /** @var RemoveLocalInventoriesResponse $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
    {
        $formattedProduct = ProductServiceClient::productName(
            '[PROJECT]',
            '[LOCATION]',
            '[CATALOG]',
            '[BRANCH]',
            '[PRODUCT]'
        );
        $placeIdsElement = '[PLACE_IDS]';

        remove_local_inventories_sample($formattedProduct, $placeIdsElement);
    }

### setInventory

Updates inventory information for a
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) while respecting the last update
timestamps of each inventory field.

This process is asynchronous and does not require the
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) to exist before updating
fulfillment information. If the request is valid, the update is enqueued
and processed downstream. As a consequence, when a response is returned,
updates are not immediately manifested in the
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) queried by
[ProductService.GetProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__getProduct__)
or
[ProductService.ListProducts](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__listProducts__).

When inventory is updated with
[ProductService.CreateProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__createProduct__)
and
[ProductService.UpdateProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__updateProduct__),
the specified inventory field value(s) overwrite any existing value(s)
while ignoring the last update time for this field. Furthermore, the last
update times for the specified inventory fields are overwritten by the
times of the
[ProductService.CreateProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__createProduct__)
or
[ProductService.UpdateProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__updateProduct__)
request.

If no inventory fields are set in
[CreateProductRequest.product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.CreateProductRequest#_Google_Cloud_Retail_V2_CreateProductRequest__getProduct__),
then any pre-existing inventory information for this product is used.

If no inventory fields are set in
[SetInventoryRequest.set_mask](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SetInventoryRequest#_Google_Cloud_Retail_V2_SetInventoryRequest__getSetMask__),
then any existing inventory information is preserved.

Pre-existing inventory information can only be updated with
[ProductService.SetInventory](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__setInventory__),
[ProductService.AddFulfillmentPlaces](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__addFulfillmentPlaces__),
and
[ProductService.RemoveFulfillmentPlaces](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__removeFulfillmentPlaces__).

The returned Operations is obsolete after
one day, and the GetOperation
API returns `NOT_FOUND` afterwards.

If conflicting updates are issued, the
Operations associated with the stale
updates are not marked as done until
they are obsolete.

The async variant is [ProductServiceClient::setInventoryAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__setInventoryAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SetInventoryRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SetInventoryResponse>` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\OperationResponse;
    use Google\Cloud\Retail\V2\Client\ProductServiceClient;
    use Google\Cloud\Retail\V2\Product;
    use Google\Cloud\Retail\V2\SetInventoryRequest;
    use Google\Cloud\Retail\V2\SetInventoryResponse;
    use Google\Rpc\Status;

    /**
     * @param string $inventoryTitle Product title.
     *
     *                               This field must be a UTF-8 encoded string with a length limit of 1,000
     *                               characters. Otherwise, an INVALID_ARGUMENT error is returned.
     *
     *                               Corresponding properties: Google Merchant Center property
     *                               [title](https://support.google.com/merchants/answer/6324415). Schema.org
     *                               property [Product.name](https://schema.org/name).
     */
    function set_inventory_sample(string $inventoryTitle): void
    {
        // Create a client.
        $productServiceClient = new ProductServiceClient();

        // Prepare the request message.
        $inventory = (new Product())
            ->setTitle($inventoryTitle);
        $request = (new SetInventoryRequest())
            ->setInventory($inventory);

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

            if ($response->operationSucceeded()) {
                /** @var SetInventoryResponse $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
    {
        $inventoryTitle = '[TITLE]';

        set_inventory_sample($inventoryTitle);
    }

### updateProduct

Updates a [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product).

The async variant is [ProductServiceClient::updateProductAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__updateProductAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UpdateProductRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\Retail\V2\Client\ProductServiceClient;
    use Google\Cloud\Retail\V2\Product;
    use Google\Cloud\Retail\V2\UpdateProductRequest;

    /**
     * @param string $productTitle Product title.
     *
     *                             This field must be a UTF-8 encoded string with a length limit of 1,000
     *                             characters. Otherwise, an INVALID_ARGUMENT error is returned.
     *
     *                             Corresponding properties: Google Merchant Center property
     *                             [title](https://support.google.com/merchants/answer/6324415). Schema.org
     *                             property [Product.name](https://schema.org/name).
     */
    function update_product_sample(string $productTitle): void
    {
        // Create a client.
        $productServiceClient = new ProductServiceClient();

        // Prepare the request message.
        $product = (new Product())
            ->setTitle($productTitle);
        $request = (new UpdateProductRequest())
            ->setProduct($product);

        // Call the API and handle any network failures.
        try {
            /** @var Product $response */
            $response = $productServiceClient->updateProduct($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
    {
        $productTitle = '[TITLE]';

        update_product_sample($productTitle);
    }

### addFulfillmentPlacesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.AddFulfillmentPlacesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### addLocalInventoriesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.AddLocalInventoriesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### createProductAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.CreateProductRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product>` |   |

### deleteProductAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.DeleteProductRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<void>` |   |

### getProductAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.GetProductRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product>` |   |

### importProductsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ImportProductsRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### listProductsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ListProductsRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html>` |   |

### purgeProductsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PurgeProductsRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### removeFulfillmentPlacesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.RemoveFulfillmentPlacesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### removeLocalInventoriesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.RemoveLocalInventoriesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### setInventoryAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SetInventoryRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### updateProductAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UpdateProductRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product>` |   |

### 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** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html` |   |

### static::branchName

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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `catalog` | `string` |
| `branch` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted branch resource. |

### static::productName

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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `catalog` | `string` |
| `branch` | `string` |
| `product` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted product 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

- branch: projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}
- product: projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}

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