Reference documentation and code samples for the Google Cloud Retail V2 Client class ProductServiceClient.
Service Description: Service for ingesting Product information of the customer's website.
This class is currently experimental and may be subject to changes.
Namespace
Google \ Cloud \ Retail \ V2 \ ClientMethods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
options |
array
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
addFulfillmentPlaces
It is recommended to use the ProductService.AddLocalInventories method instead of ProductService.AddFulfillmentPlaces.
ProductService.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.
This process is asynchronous and does not require the 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 queried by ProductService.GetProduct or ProductService.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 Google\Cloud\Retail\V2\Client\BaseClient\self::addFulfillmentPlacesAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\AddFulfillmentPlacesRequest
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 |
Google\ApiCore\OperationResponse |
addLocalInventories
Updates local inventory information for a 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 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 queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be modified using this method. ProductService.CreateProduct and ProductService.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 Google\Cloud\Retail\V2\Client\BaseClient\self::addLocalInventoriesAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\AddLocalInventoriesRequest
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 |
Google\ApiCore\OperationResponse |
createProduct
Creates a Product.
The async variant is Google\Cloud\Retail\V2\Client\BaseClient\self::createProductAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\CreateProductRequest
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 |
Google\Cloud\Retail\V2\Product |
deleteProduct
Deletes a Product.
The async variant is Google\Cloud\Retail\V2\Client\BaseClient\self::deleteProductAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\DeleteProductRequest
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. |
getProduct
Gets a Product.
The async variant is Google\Cloud\Retail\V2\Client\BaseClient\self::getProductAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\GetProductRequest
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 |
Google\Cloud\Retail\V2\Product |
importProducts
Bulk import of multiple Products.
Request processing may be synchronous. Non-existing items are created.
Note that it is possible for a subset of the Products to be successfully updated.
The async variant is Google\Cloud\Retail\V2\Client\BaseClient\self::importProductsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\ImportProductsRequest
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 |
Google\ApiCore\OperationResponse |
listProducts
Gets a list of Products.
The async variant is Google\Cloud\Retail\V2\Client\BaseClient\self::listProductsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\ListProductsRequest
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 |
Google\ApiCore\PagedListResponse |
removeFulfillmentPlaces
It is recommended to use the ProductService.RemoveLocalInventories method instead of ProductService.RemoveFulfillmentPlaces.
ProductService.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.
This process is asynchronous and does not require the 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 queried by ProductService.GetProduct or ProductService.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 Google\Cloud\Retail\V2\Client\BaseClient\self::removeFulfillmentPlacesAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\RemoveFulfillmentPlacesRequest
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 |
Google\ApiCore\OperationResponse |
removeLocalInventories
Remove local inventory information for a 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 queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be removed using this method. ProductService.CreateProduct and ProductService.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 Google\Cloud\Retail\V2\Client\BaseClient\self::removeLocalInventoriesAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\RemoveLocalInventoriesRequest
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 |
Google\ApiCore\OperationResponse |
setInventory
Updates inventory information for a Product while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the 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 queried by ProductService.GetProduct or ProductService.ListProducts.
When inventory is updated with ProductService.CreateProduct and ProductService.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 or ProductService.UpdateProduct request.
If no inventory fields are set in CreateProductRequest.product, then any pre-existing inventory information for this product is used.
If no inventory fields are set in SetInventoryRequest.set_mask, then any existing inventory information is preserved.
Pre-existing inventory information can only be updated with ProductService.SetInventory, ProductService.AddFulfillmentPlaces, and ProductService.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 Google\Cloud\Retail\V2\Client\BaseClient\self::setInventoryAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\SetInventoryRequest
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 |
Google\ApiCore\OperationResponse |
updateProduct
Updates a Product.
The async variant is Google\Cloud\Retail\V2\Client\BaseClient\self::updateProductAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\UpdateProductRequest
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 |
Google\Cloud\Retail\V2\Product |
addFulfillmentPlacesAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\AddFulfillmentPlacesRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
addLocalInventoriesAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\AddLocalInventoriesRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
createProductAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\CreateProductRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
deleteProductAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\DeleteProductRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getProductAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\GetProductRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
importProductsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\ImportProductsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listProductsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\ListProductsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
removeFulfillmentPlacesAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\RemoveFulfillmentPlacesRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
removeLocalInventoriesAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\RemoveLocalInventoriesRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
setInventoryAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\SetInventoryRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
updateProductAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Retail\V2\UpdateProductRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
Returns | |
---|---|
Type | Description |
Google\ApiCore\LongRunning\OperationsClient |
resumeOperation
Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.
Parameters | |
---|---|
Name | Description |
operationName |
string
The name of the long running operation |
methodName |
string
The name of the method used to start the operation |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
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. |