diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json
index 47293b0e4b2a..740ff8d79c9d 100644
--- a/.repo-metadata-full.json
+++ b/.repo-metadata-full.json
@@ -1121,7 +1121,7 @@
"RecommendationEngine": {
"language": "php",
"distribution_name": "google/cloud-recommendations-ai",
- "release_level": "preview",
+ "release_level": "stable",
"client_documentation": "https://cloud.google.com/php/docs/reference/cloud-recommendations-ai/latest",
"library_type": "GAPIC_AUTO",
"api_shortname": "recommendationengine"
@@ -1599,4 +1599,4 @@
"library_type": "GAPIC_AUTO",
"api_shortname": "workflows"
}
-}
+}
\ No newline at end of file
diff --git a/RecommendationEngine/owlbot.py b/RecommendationEngine/owlbot.py
index d50424242ad4..bc996cfef599 100644
--- a/RecommendationEngine/owlbot.py
+++ b/RecommendationEngine/owlbot.py
@@ -1,4 +1,4 @@
-# Copyright 2020 Google LLC
+# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -30,13 +30,7 @@
# Added so that we can pass copy_excludes in the owlbot_main() call
_tracked_paths.add(src)
-php.owlbot_main(
- src=src,
- dest=dest,
- copy_excludes=[
- src / "**/[A-Z]*_*.php"
- ]
-)
+php.owlbot_main(src=src, dest=dest)
# remove class_alias code
s.replace(
@@ -47,28 +41,16 @@
+ "\n",
'')
-### [START] protoc backwards compatibility fixes
-
-# roll back to private properties.
-s.replace(
- "src/**/V*/**/*.php",
- r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$",
- r"""Generated from protobuf field \1
- */
- private $""")
-
-# Replace "Unwrapped" with "Value" for method names.
-s.replace(
- "src/**/V*/**/*.php",
- r"public function ([s|g]\w{3,})Unwrapped",
- r"public function \1Value"
-)
-
-### [END] protoc backwards compatibility fixes
-
-# fix relative cloud.google.com links
-s.replace(
- "src/**/V*/**/*.php",
- r"(.{0,})\]\((/.{0,})\)",
- r"\1](https://cloud.google.com\2)"
-)
+# format generated clients
+subprocess.run([
+ 'npm',
+ 'exec',
+ '--yes',
+ '--package=@prettier/plugin-php@^0.16',
+ '--',
+ 'prettier',
+ '**/Client/*',
+ '--write',
+ '--parser=php',
+ '--single-quote',
+ '--print-width=120'])
diff --git a/RecommendationEngine/src/V1beta1/CatalogItem.php b/RecommendationEngine/src/V1beta1/CatalogItem.php
index 632606949f6b..6e86c77983ac 100644
--- a/RecommendationEngine/src/V1beta1/CatalogItem.php
+++ b/RecommendationEngine/src/V1beta1/CatalogItem.php
@@ -24,7 +24,7 @@ class CatalogItem extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string id = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $id = '';
+ protected $id = '';
/**
* Required. Catalog item categories. This field is repeated for supporting
* one catalog item belonging to several parallel category hierarchies.
@@ -46,14 +46,14 @@ class CatalogItem extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string title = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $title = '';
+ protected $title = '';
/**
* Optional. Catalog item description. UTF-8 encoded string with a length
* limit of 5 KiB.
*
* Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $description = '';
+ protected $description = '';
/**
* Optional. Highly encouraged. Extra catalog item attributes to be
* included in the recommendation model. For example, for retail products,
@@ -63,7 +63,7 @@ class CatalogItem extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 5 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $item_attributes = null;
+ protected $item_attributes = null;
/**
* Optional. Language of the title/description/item_attributes. Use language
* tags defined by BCP 47. https://www.rfc-editor.org/rfc/bcp/bcp47.txt. Our
@@ -73,7 +73,7 @@ class CatalogItem extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string language_code = 6 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $language_code = '';
+ protected $language_code = '';
/**
* Optional. Filtering tags associated with the catalog item. Each tag should
* be a UTF-8 encoded string with a length limit of 1 KiB.
@@ -87,11 +87,11 @@ class CatalogItem extends \Google\Protobuf\Internal\Message
* Optional. Variant group identifier for prediction results. UTF-8 encoded
* string with a length limit of 128 bytes.
* This field must be enabled before it can be used. [Learn
- * more](https://cloud.google.com/recommendations-ai/docs/catalog#item-group-id).
+ * more](/recommendations-ai/docs/catalog#item-group-id).
*
* Generated from protobuf field string item_group_id = 9 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $item_group_id = '';
+ protected $item_group_id = '';
protected $recommendation_type;
/**
@@ -144,7 +144,7 @@ class CatalogItem extends \Google\Protobuf\Internal\Message
* Optional. Variant group identifier for prediction results. UTF-8 encoded
* string with a length limit of 128 bytes.
* This field must be enabled before it can be used. [Learn
- * more](https://cloud.google.com/recommendations-ai/docs/catalog#item-group-id).
+ * more](/recommendations-ai/docs/catalog#item-group-id).
* @type \Google\Cloud\RecommendationEngine\V1beta1\ProductCatalogItem $product_metadata
* Optional. Metadata specific to retail products.
* }
@@ -402,7 +402,7 @@ public function setTags($var)
* Optional. Variant group identifier for prediction results. UTF-8 encoded
* string with a length limit of 128 bytes.
* This field must be enabled before it can be used. [Learn
- * more](https://cloud.google.com/recommendations-ai/docs/catalog#item-group-id).
+ * more](/recommendations-ai/docs/catalog#item-group-id).
*
* Generated from protobuf field string item_group_id = 9 [(.google.api.field_behavior) = OPTIONAL];
* @return string
@@ -416,7 +416,7 @@ public function getItemGroupId()
* Optional. Variant group identifier for prediction results. UTF-8 encoded
* string with a length limit of 128 bytes.
* This field must be enabled before it can be used. [Learn
- * more](https://cloud.google.com/recommendations-ai/docs/catalog#item-group-id).
+ * more](/recommendations-ai/docs/catalog#item-group-id).
*
* Generated from protobuf field string item_group_id = 9 [(.google.api.field_behavior) = OPTIONAL];
* @param string $var
diff --git a/RecommendationEngine/src/V1beta1/CatalogServiceClient.php b/RecommendationEngine/src/V1beta1/CatalogServiceClient.php
deleted file mode 100644
index d7da7cb3b227..000000000000
--- a/RecommendationEngine/src/V1beta1/CatalogServiceClient.php
+++ /dev/null
@@ -1,36 +0,0 @@
-_simpleRequest('/google.cloud.recommendationengine.v1beta1.CatalogService/CreateCatalogItem',
- $argument,
- ['\Google\Cloud\RecommendationEngine\V1beta1\CatalogItem', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Gets a specific catalog item.
- * @param \Google\Cloud\RecommendationEngine\V1beta1\GetCatalogItemRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function GetCatalogItem(\Google\Cloud\RecommendationEngine\V1beta1\GetCatalogItemRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.cloud.recommendationengine.v1beta1.CatalogService/GetCatalogItem',
- $argument,
- ['\Google\Cloud\RecommendationEngine\V1beta1\CatalogItem', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Gets a list of catalog items.
- * @param \Google\Cloud\RecommendationEngine\V1beta1\ListCatalogItemsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ListCatalogItems(\Google\Cloud\RecommendationEngine\V1beta1\ListCatalogItemsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.cloud.recommendationengine.v1beta1.CatalogService/ListCatalogItems',
- $argument,
- ['\Google\Cloud\RecommendationEngine\V1beta1\ListCatalogItemsResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Updates a catalog item. Partial updating is supported. Non-existing
- * items will be created.
- * @param \Google\Cloud\RecommendationEngine\V1beta1\UpdateCatalogItemRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function UpdateCatalogItem(\Google\Cloud\RecommendationEngine\V1beta1\UpdateCatalogItemRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.cloud.recommendationengine.v1beta1.CatalogService/UpdateCatalogItem',
- $argument,
- ['\Google\Cloud\RecommendationEngine\V1beta1\CatalogItem', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Deletes a catalog item.
- * @param \Google\Cloud\RecommendationEngine\V1beta1\DeleteCatalogItemRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function DeleteCatalogItem(\Google\Cloud\RecommendationEngine\V1beta1\DeleteCatalogItemRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.cloud.recommendationengine.v1beta1.CatalogService/DeleteCatalogItem',
- $argument,
- ['\Google\Protobuf\GPBEmpty', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Bulk import of multiple catalog items. Request processing may be
- * synchronous. No partial updating supported. Non-existing items will be
- * created.
- *
- * Operation.response is of type ImportResponse. Note that it is
- * possible for a subset of the items to be successfully updated.
- * @param \Google\Cloud\RecommendationEngine\V1beta1\ImportCatalogItemsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ImportCatalogItems(\Google\Cloud\RecommendationEngine\V1beta1\ImportCatalogItemsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.cloud.recommendationengine.v1beta1.CatalogService/ImportCatalogItems',
- $argument,
- ['\Google\LongRunning\Operation', 'decode'],
- $metadata, $options);
- }
-
-}
diff --git a/RecommendationEngine/src/V1beta1/Client/CatalogServiceClient.php b/RecommendationEngine/src/V1beta1/Client/CatalogServiceClient.php
index 04109e0c4fb9..7b4ec2f8dd9c 100644
--- a/RecommendationEngine/src/V1beta1/Client/CatalogServiceClient.php
+++ b/RecommendationEngine/src/V1beta1/Client/CatalogServiceClient.php
@@ -1,6 +1,6 @@
descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : [];
+ $options = isset($this->descriptors[$methodName]['longRunning'])
+ ? $this->descriptors[$methodName]['longRunning']
+ : [];
$operation = new OperationResponse($operationName, $this->getOperationsClient(), $options);
$operation->reload();
return $operation;
}
+ /**
+ * Create the default operation client for the service.
+ *
+ * @param array $options ClientOptions for the client.
+ *
+ * @return OperationsClient
+ */
+ private function createOperationsClient(array $options)
+ {
+ // Unset client-specific configuration options
+ unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']);
+
+ if (isset($options['operationsClient'])) {
+ return $options['operationsClient'];
+ }
+
+ return new OperationsClient($options);
+ }
+
/**
* Formats a string containing the fully-qualified path to represent a catalog
* resource.
@@ -185,8 +203,12 @@ public static function catalogName(string $project, string $location, string $ca
*
* @experimental
*/
- public static function catalogItemPathName(string $project, string $location, string $catalog, string $catalogItemPath): string
- {
+ public static function catalogItemPathName(
+ string $project,
+ string $location,
+ string $catalog,
+ string $catalogItemPath
+ ): string {
return self::getPathTemplate('catalogItemPath')->render([
'project' => $project,
'location' => $location,
@@ -208,8 +230,8 @@ public static function catalogItemPathName(string $project, string $location, st
* listed, then parseName will check each of the supported templates, and return
* the first match.
*
- * @param string $formattedName The formatted name string
- * @param ?string $template Optional name of template to match
+ * @param string $formattedName The formatted name string
+ * @param string $template Optional name of template to match
*
* @return array An associative array from name component IDs to component values.
*
@@ -217,7 +239,7 @@ public static function catalogItemPathName(string $project, string $location, st
*
* @experimental
*/
- public static function parseName(string $formattedName, ?string $template = null): array
+ public static function parseName(string $formattedName, string $template = null): array
{
return self::parseFormattedName($formattedName, $template);
}
@@ -272,9 +294,6 @@ public static function parseName(string $formattedName, ?string $template = null
* @type callable $clientCertSource
* 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.
- * @type false|LoggerInterface $logger
- * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
- * 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
diff --git a/RecommendationEngine/src/V1beta1/Client/PredictionApiKeyRegistryClient.php b/RecommendationEngine/src/V1beta1/Client/PredictionApiKeyRegistryClient.php
index 6a7bc60177e2..98dba713a163 100644
--- a/RecommendationEngine/src/V1beta1/Client/PredictionApiKeyRegistryClient.php
+++ b/RecommendationEngine/src/V1beta1/Client/PredictionApiKeyRegistryClient.php
@@ -1,6 +1,6 @@
[
'rest' => [
- 'restClientConfigPath' => __DIR__ . '/../resources/prediction_api_key_registry_rest_client_config.php',
+ 'restClientConfigPath' =>
+ __DIR__ . '/../resources/prediction_api_key_registry_rest_client_config.php',
],
],
];
@@ -124,8 +122,12 @@ private static function getClientDefaults()
*
* @experimental
*/
- public static function eventStoreName(string $project, string $location, string $catalog, string $eventStore): string
- {
+ public static function eventStoreName(
+ string $project,
+ string $location,
+ string $catalog,
+ string $eventStore
+ ): string {
return self::getPathTemplate('eventStore')->render([
'project' => $project,
'location' => $location,
@@ -148,8 +150,13 @@ public static function eventStoreName(string $project, string $location, string
*
* @experimental
*/
- public static function predictionApiKeyRegistrationName(string $project, string $location, string $catalog, string $eventStore, string $predictionApiKeyRegistration): string
- {
+ public static function predictionApiKeyRegistrationName(
+ string $project,
+ string $location,
+ string $catalog,
+ string $eventStore,
+ string $predictionApiKeyRegistration
+ ): string {
return self::getPathTemplate('predictionApiKeyRegistration')->render([
'project' => $project,
'location' => $location,
@@ -172,8 +179,8 @@ public static function predictionApiKeyRegistrationName(string $project, string
* listed, then parseName will check each of the supported templates, and return
* the first match.
*
- * @param string $formattedName The formatted name string
- * @param ?string $template Optional name of template to match
+ * @param string $formattedName The formatted name string
+ * @param string $template Optional name of template to match
*
* @return array An associative array from name component IDs to component values.
*
@@ -181,7 +188,7 @@ public static function predictionApiKeyRegistrationName(string $project, string
*
* @experimental
*/
- public static function parseName(string $formattedName, ?string $template = null): array
+ public static function parseName(string $formattedName, string $template = null): array
{
return self::parseFormattedName($formattedName, $template);
}
@@ -236,9 +243,6 @@ public static function parseName(string $formattedName, ?string $template = null
* @type callable $clientCertSource
* 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.
- * @type false|LoggerInterface $logger
- * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
- * 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
@@ -287,8 +291,10 @@ public function __call($method, $args)
*
* @experimental
*/
- public function createPredictionApiKeyRegistration(CreatePredictionApiKeyRegistrationRequest $request, array $callOptions = []): PredictionApiKeyRegistration
- {
+ public function createPredictionApiKeyRegistration(
+ CreatePredictionApiKeyRegistrationRequest $request,
+ array $callOptions = []
+ ): PredictionApiKeyRegistration {
return $this->startApiCall('CreatePredictionApiKeyRegistration', $request, $callOptions)->wait();
}
@@ -315,8 +321,10 @@ public function createPredictionApiKeyRegistration(CreatePredictionApiKeyRegistr
*
* @experimental
*/
- public function deletePredictionApiKeyRegistration(DeletePredictionApiKeyRegistrationRequest $request, array $callOptions = []): void
- {
+ public function deletePredictionApiKeyRegistration(
+ DeletePredictionApiKeyRegistrationRequest $request,
+ array $callOptions = []
+ ): void {
$this->startApiCall('DeletePredictionApiKeyRegistration', $request, $callOptions)->wait();
}
@@ -345,8 +353,10 @@ public function deletePredictionApiKeyRegistration(DeletePredictionApiKeyRegistr
*
* @experimental
*/
- public function listPredictionApiKeyRegistrations(ListPredictionApiKeyRegistrationsRequest $request, array $callOptions = []): PagedListResponse
- {
+ public function listPredictionApiKeyRegistrations(
+ ListPredictionApiKeyRegistrationsRequest $request,
+ array $callOptions = []
+ ): PagedListResponse {
return $this->startApiCall('ListPredictionApiKeyRegistrations', $request, $callOptions);
}
}
diff --git a/RecommendationEngine/src/V1beta1/Client/PredictionServiceClient.php b/RecommendationEngine/src/V1beta1/Client/PredictionServiceClient.php
index 91ac8c7e63d8..6e56057cdbd6 100644
--- a/RecommendationEngine/src/V1beta1/Client/PredictionServiceClient.php
+++ b/RecommendationEngine/src/V1beta1/Client/PredictionServiceClient.php
@@ -1,6 +1,6 @@
render([
'project' => $project,
'location' => $location,
@@ -139,8 +141,8 @@ public static function placementName(string $project, string $location, string $
* listed, then parseName will check each of the supported templates, and return
* the first match.
*
- * @param string $formattedName The formatted name string
- * @param ?string $template Optional name of template to match
+ * @param string $formattedName The formatted name string
+ * @param string $template Optional name of template to match
*
* @return array An associative array from name component IDs to component values.
*
@@ -148,7 +150,7 @@ public static function placementName(string $project, string $location, string $
*
* @experimental
*/
- public static function parseName(string $formattedName, ?string $template = null): array
+ public static function parseName(string $formattedName, string $template = null): array
{
return self::parseFormattedName($formattedName, $template);
}
@@ -203,9 +205,6 @@ public static function parseName(string $formattedName, ?string $template = null
* @type callable $clientCertSource
* 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.
- * @type false|LoggerInterface $logger
- * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
- * 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
@@ -233,7 +232,7 @@ public function __call($method, $args)
* Makes a recommendation prediction. If using API Key based authentication,
* the API Key must be registered using the
* [PredictionApiKeyRegistry][google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry]
- * service. [Learn more](https://cloud.google.com/recommendations-ai/docs/setting-up#register-key).
+ * service. [Learn more](/recommendations-ai/docs/setting-up#register-key).
*
* The async variant is {@see PredictionServiceClient::predictAsync()} .
*
diff --git a/RecommendationEngine/src/V1beta1/Client/UserEventServiceClient.php b/RecommendationEngine/src/V1beta1/Client/UserEventServiceClient.php
index 8db5105e009c..ec8443584da1 100644
--- a/RecommendationEngine/src/V1beta1/Client/UserEventServiceClient.php
+++ b/RecommendationEngine/src/V1beta1/Client/UserEventServiceClient.php
@@ -1,6 +1,6 @@
descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : [];
+ $options = isset($this->descriptors[$methodName]['longRunning'])
+ ? $this->descriptors[$methodName]['longRunning']
+ : [];
$operation = new OperationResponse($operationName, $this->getOperationsClient(), $options);
$operation->reload();
return $operation;
}
+ /**
+ * Create the default operation client for the service.
+ *
+ * @param array $options ClientOptions for the client.
+ *
+ * @return OperationsClient
+ */
+ private function createOperationsClient(array $options)
+ {
+ // Unset client-specific configuration options
+ unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']);
+
+ if (isset($options['operationsClient'])) {
+ return $options['operationsClient'];
+ }
+
+ return new OperationsClient($options);
+ }
+
/**
* Formats a string containing the fully-qualified path to represent a event_store
* resource.
@@ -164,8 +182,12 @@ public function resumeOperation($operationName, $methodName = null)
*
* @experimental
*/
- public static function eventStoreName(string $project, string $location, string $catalog, string $eventStore): string
- {
+ public static function eventStoreName(
+ string $project,
+ string $location,
+ string $catalog,
+ string $eventStore
+ ): string {
return self::getPathTemplate('eventStore')->render([
'project' => $project,
'location' => $location,
@@ -186,8 +208,8 @@ public static function eventStoreName(string $project, string $location, string
* listed, then parseName will check each of the supported templates, and return
* the first match.
*
- * @param string $formattedName The formatted name string
- * @param ?string $template Optional name of template to match
+ * @param string $formattedName The formatted name string
+ * @param string $template Optional name of template to match
*
* @return array An associative array from name component IDs to component values.
*
@@ -195,7 +217,7 @@ public static function eventStoreName(string $project, string $location, string
*
* @experimental
*/
- public static function parseName(string $formattedName, ?string $template = null): array
+ public static function parseName(string $formattedName, string $template = null): array
{
return self::parseFormattedName($formattedName, $template);
}
@@ -250,9 +272,6 @@ public static function parseName(string $formattedName, ?string $template = null
* @type callable $clientCertSource
* 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.
- * @type false|LoggerInterface $logger
- * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
- * 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
diff --git a/RecommendationEngine/src/V1beta1/CollectUserEventRequest.php b/RecommendationEngine/src/V1beta1/CollectUserEventRequest.php
index 273a49dbf829..7572405559bd 100644
--- a/RecommendationEngine/src/V1beta1/CollectUserEventRequest.php
+++ b/RecommendationEngine/src/V1beta1/CollectUserEventRequest.php
@@ -21,13 +21,13 @@ class CollectUserEventRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Required. URL encoded UserEvent proto.
*
* Generated from protobuf field string user_event = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $user_event = '';
+ protected $user_event = '';
/**
* Optional. The url including cgi-parameters but excluding the hash fragment.
* The URL must be truncated to 1.5K bytes to conservatively be under the 2K
@@ -36,7 +36,7 @@ class CollectUserEventRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string uri = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $uri = '';
+ protected $uri = '';
/**
* Optional. The event timestamp in milliseconds. This prevents browser
* caching of otherwise identical get requests. The name is abbreviated to
@@ -44,7 +44,7 @@ class CollectUserEventRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int64 ets = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $ets = 0;
+ protected $ets = 0;
/**
* @param string $parent Required. The parent eventStore name, such as
diff --git a/RecommendationEngine/src/V1beta1/CreateCatalogItemRequest.php b/RecommendationEngine/src/V1beta1/CreateCatalogItemRequest.php
index 8375c0957290..2f0d616da1a5 100644
--- a/RecommendationEngine/src/V1beta1/CreateCatalogItemRequest.php
+++ b/RecommendationEngine/src/V1beta1/CreateCatalogItemRequest.php
@@ -21,13 +21,13 @@ class CreateCatalogItemRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Required. The catalog item to create.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.CatalogItem catalog_item = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $catalog_item = null;
+ protected $catalog_item = null;
/**
* @param string $parent Required. The parent catalog resource name, such as
diff --git a/RecommendationEngine/src/V1beta1/CreatePredictionApiKeyRegistrationRequest.php b/RecommendationEngine/src/V1beta1/CreatePredictionApiKeyRegistrationRequest.php
index f60e2e8c292f..9371234e85e5 100644
--- a/RecommendationEngine/src/V1beta1/CreatePredictionApiKeyRegistrationRequest.php
+++ b/RecommendationEngine/src/V1beta1/CreatePredictionApiKeyRegistrationRequest.php
@@ -21,13 +21,13 @@ class CreatePredictionApiKeyRegistrationRequest extends \Google\Protobuf\Interna
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Required. The prediction API key registration.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistration prediction_api_key_registration = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $prediction_api_key_registration = null;
+ protected $prediction_api_key_registration = null;
/**
* @param string $parent Required. The parent resource path.
diff --git a/RecommendationEngine/src/V1beta1/DeleteCatalogItemRequest.php b/RecommendationEngine/src/V1beta1/DeleteCatalogItemRequest.php
index 0caa4c72fc39..76f872cb0598 100644
--- a/RecommendationEngine/src/V1beta1/DeleteCatalogItemRequest.php
+++ b/RecommendationEngine/src/V1beta1/DeleteCatalogItemRequest.php
@@ -21,7 +21,7 @@ class DeleteCatalogItemRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* @param string $name Required. Full resource name of catalog item, such as
diff --git a/RecommendationEngine/src/V1beta1/DeletePredictionApiKeyRegistrationRequest.php b/RecommendationEngine/src/V1beta1/DeletePredictionApiKeyRegistrationRequest.php
index ddbdd6225073..ff36aef3416a 100644
--- a/RecommendationEngine/src/V1beta1/DeletePredictionApiKeyRegistrationRequest.php
+++ b/RecommendationEngine/src/V1beta1/DeletePredictionApiKeyRegistrationRequest.php
@@ -21,7 +21,7 @@ class DeletePredictionApiKeyRegistrationRequest extends \Google\Protobuf\Interna
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* @param string $name Required. The API key to unregister including full resource path.
diff --git a/RecommendationEngine/src/V1beta1/EventDetail.php b/RecommendationEngine/src/V1beta1/EventDetail.php
index 171139a5e26a..25740f69bf0a 100644
--- a/RecommendationEngine/src/V1beta1/EventDetail.php
+++ b/RecommendationEngine/src/V1beta1/EventDetail.php
@@ -22,14 +22,14 @@ class EventDetail extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $uri = '';
+ protected $uri = '';
/**
* Optional. The referrer url of the current page. When using
* the JavaScript pixel, this value is filled in automatically.
*
* Generated from protobuf field string referrer_uri = 6 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $referrer_uri = '';
+ protected $referrer_uri = '';
/**
* Optional. A unique id of a web page view.
* This should be kept the same for all user events triggered from the same
@@ -41,7 +41,7 @@ class EventDetail extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string page_view_id = 2 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $page_view_id = '';
+ protected $page_view_id = '';
/**
* Optional. A list of identifiers for the independent experiment groups
* this user event belongs to. This is used to distinguish between user events
@@ -67,7 +67,7 @@ class EventDetail extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string recommendation_token = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $recommendation_token = '';
+ protected $recommendation_token = '';
/**
* Optional. Extra user event features to include in the recommendation
* model.
@@ -78,7 +78,7 @@ class EventDetail extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.FeatureMap event_attributes = 5 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $event_attributes = null;
+ protected $event_attributes = null;
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/Gapic/CatalogServiceGapicClient.php b/RecommendationEngine/src/V1beta1/Gapic/CatalogServiceGapicClient.php
deleted file mode 100644
index 174e845b23bc..000000000000
--- a/RecommendationEngine/src/V1beta1/Gapic/CatalogServiceGapicClient.php
+++ /dev/null
@@ -1,695 +0,0 @@
-catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
- * $catalogItem = new CatalogItem();
- * $response = $catalogServiceClient->createCatalogItem($formattedParent, $catalogItem);
- * } finally {
- * $catalogServiceClient->close();
- * }
- * ```
- *
- * Many parameters require resource names to be formatted in a particular way. To
- * assist with these names, this class includes a format method for each type of
- * name, and additionally a parseName method to extract the individual identifiers
- * contained within formatted names that are returned by the API.
- *
- * @experimental
- *
- * @deprecated Please use the new service client {@see \Google\Cloud\RecommendationEngine\V1beta1\Client\CatalogServiceClient}.
- */
-class CatalogServiceGapicClient
-{
- use GapicClientTrait;
-
- /** The name of the service. */
- const SERVICE_NAME = 'google.cloud.recommendationengine.v1beta1.CatalogService';
-
- /**
- * The default address of the service.
- *
- * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead.
- */
- const SERVICE_ADDRESS = 'recommendationengine.googleapis.com';
-
- /** The address template of the service. */
- private const SERVICE_ADDRESS_TEMPLATE = 'recommendationengine.UNIVERSE_DOMAIN';
-
- /** The default port of the service. */
- const DEFAULT_SERVICE_PORT = 443;
-
- /** The name of the code generator, to be included in the agent header. */
- const CODEGEN_NAME = 'gapic';
-
- /** The default scopes required by the service. */
- public static $serviceScopes = [
- 'https://www.googleapis.com/auth/cloud-platform',
- ];
-
- private static $catalogNameTemplate;
-
- private static $catalogItemPathNameTemplate;
-
- private static $pathTemplateMap;
-
- private $operationsClient;
-
- private static function getClientDefaults()
- {
- return [
- 'serviceName' => self::SERVICE_NAME,
- 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT,
- 'clientConfig' => __DIR__ . '/../resources/catalog_service_client_config.json',
- 'descriptorsConfigPath' => __DIR__ . '/../resources/catalog_service_descriptor_config.php',
- 'gcpApiConfigPath' => __DIR__ . '/../resources/catalog_service_grpc_config.json',
- 'credentialsConfig' => [
- 'defaultScopes' => self::$serviceScopes,
- ],
- 'transportConfig' => [
- 'rest' => [
- 'restClientConfigPath' => __DIR__ . '/../resources/catalog_service_rest_client_config.php',
- ],
- ],
- ];
- }
-
- private static function getCatalogNameTemplate()
- {
- if (self::$catalogNameTemplate == null) {
- self::$catalogNameTemplate = new PathTemplate('projects/{project}/locations/{location}/catalogs/{catalog}');
- }
-
- return self::$catalogNameTemplate;
- }
-
- private static function getCatalogItemPathNameTemplate()
- {
- if (self::$catalogItemPathNameTemplate == null) {
- self::$catalogItemPathNameTemplate = new PathTemplate('projects/{project}/locations/{location}/catalogs/{catalog}/catalogItems/{catalog_item_path}');
- }
-
- return self::$catalogItemPathNameTemplate;
- }
-
- private static function getPathTemplateMap()
- {
- if (self::$pathTemplateMap == null) {
- self::$pathTemplateMap = [
- 'catalog' => self::getCatalogNameTemplate(),
- 'catalogItemPath' => self::getCatalogItemPathNameTemplate(),
- ];
- }
-
- return self::$pathTemplateMap;
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a catalog
- * resource.
- *
- * @param string $project
- * @param string $location
- * @param string $catalog
- *
- * @return string The formatted catalog resource.
- *
- * @experimental
- */
- public static function catalogName($project, $location, $catalog)
- {
- return self::getCatalogNameTemplate()->render([
- 'project' => $project,
- 'location' => $location,
- 'catalog' => $catalog,
- ]);
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a
- * catalog_item_path resource.
- *
- * @param string $project
- * @param string $location
- * @param string $catalog
- * @param string $catalogItemPath
- *
- * @return string The formatted catalog_item_path resource.
- *
- * @experimental
- */
- public static function catalogItemPathName($project, $location, $catalog, $catalogItemPath)
- {
- return self::getCatalogItemPathNameTemplate()->render([
- 'project' => $project,
- 'location' => $location,
- 'catalog' => $catalog,
- 'catalog_item_path' => $catalogItemPath,
- ]);
- }
-
- /**
- * Parses a formatted name string and returns an associative array of the components in the name.
- * The following name formats are supported:
- * Template: Pattern
- * - catalog: projects/{project}/locations/{location}/catalogs/{catalog}
- * - catalogItemPath: projects/{project}/locations/{location}/catalogs/{catalog}/catalogItems/{catalog_item_path}
- *
- * 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.
- *
- * @param string $formattedName The formatted name string
- * @param string $template Optional name of template to match
- *
- * @return array An associative array from name component IDs to component values.
- *
- * @throws ValidationException If $formattedName could not be matched.
- *
- * @experimental
- */
- public static function parseName($formattedName, $template = null)
- {
- $templateMap = self::getPathTemplateMap();
- if ($template) {
- if (!isset($templateMap[$template])) {
- throw new ValidationException("Template name $template does not exist");
- }
-
- return $templateMap[$template]->match($formattedName);
- }
-
- foreach ($templateMap as $templateName => $pathTemplate) {
- try {
- return $pathTemplate->match($formattedName);
- } catch (ValidationException $ex) {
- // Swallow the exception to continue trying other path templates
- }
- }
-
- throw new ValidationException("Input did not match any known format. Input: $formattedName");
- }
-
- /**
- * Return an OperationsClient object with the same endpoint as $this.
- *
- * @return OperationsClient
- *
- * @experimental
- */
- public function getOperationsClient()
- {
- return $this->operationsClient;
- }
-
- /**
- * 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.
- *
- * @param string $operationName The name of the long running operation
- * @param string $methodName The name of the method used to start the operation
- *
- * @return OperationResponse
- *
- * @experimental
- */
- public function resumeOperation($operationName, $methodName = null)
- {
- $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : [];
- $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options);
- $operation->reload();
- return $operation;
- }
-
- /**
- * Constructor.
- *
- * @param array $options {
- * Optional. Options for configuring the service API wrapper.
- *
- * @type string $apiEndpoint
- * The address of the API remote host. May optionally include the port, formatted
- * as ":". Default 'recommendationengine.googleapis.com:443'.
- * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
- * 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
- * {@see \Google\Auth\FetchAuthTokenInterface} object or
- * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
- * objects are provided, any settings in $credentialsConfig will be ignored.
- * @type array $credentialsConfig
- * Options used to configure credentials, including auth token caching, for the
- * client. For a full list of supporting configuration options, see
- * {@see \Google\ApiCore\CredentialsWrapper::build()} .
- * @type bool $disableRetries
- * Determines whether or not retries defined by the client configuration should be
- * disabled. Defaults to `false`.
- * @type string|array $clientConfig
- * 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.
- * @type string|TransportInterface $transport
- * 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 {@see \Google\ApiCore\Transport\TransportInterface} object. Note
- * that when this object is provided, any settings in $transportConfig, and any
- * $apiEndpoint setting, will be ignored.
- * @type array $transportConfig
- * 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 {@see \Google\ApiCore\Transport\GrpcTransport::build()} and
- * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the
- * supported options.
- * @type callable $clientCertSource
- * 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.
- * }
- *
- * @throws ValidationException
- *
- * @experimental
- */
- public function __construct(array $options = [])
- {
- $clientOptions = $this->buildClientOptions($options);
- $this->setClientOptions($clientOptions);
- $this->operationsClient = $this->createOperationsClient($clientOptions);
- }
-
- /**
- * Creates a catalog item.
- *
- * Sample code:
- * ```
- * $catalogServiceClient = new CatalogServiceClient();
- * try {
- * $formattedParent = $catalogServiceClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
- * $catalogItem = new CatalogItem();
- * $response = $catalogServiceClient->createCatalogItem($formattedParent, $catalogItem);
- * } finally {
- * $catalogServiceClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The parent catalog resource name, such as
- * `projects/*/locations/global/catalogs/default_catalog`.
- * @param CatalogItem $catalogItem Required. The catalog item to create.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\RecommendationEngine\V1beta1\CatalogItem
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function createCatalogItem($parent, $catalogItem, array $optionalArgs = [])
- {
- $request = new CreateCatalogItemRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setCatalogItem($catalogItem);
- $requestParamHeaders['parent'] = $parent;
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->startCall('CreateCatalogItem', CatalogItem::class, $optionalArgs, $request)->wait();
- }
-
- /**
- * Deletes a catalog item.
- *
- * Sample code:
- * ```
- * $catalogServiceClient = new CatalogServiceClient();
- * try {
- * $formattedName = $catalogServiceClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
- * $catalogServiceClient->deleteCatalogItem($formattedName);
- * } finally {
- * $catalogServiceClient->close();
- * }
- * ```
- *
- * @param string $name Required. Full resource name of catalog item, such as
- * `projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function deleteCatalogItem($name, array $optionalArgs = [])
- {
- $request = new DeleteCatalogItemRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->startCall('DeleteCatalogItem', GPBEmpty::class, $optionalArgs, $request)->wait();
- }
-
- /**
- * Gets a specific catalog item.
- *
- * Sample code:
- * ```
- * $catalogServiceClient = new CatalogServiceClient();
- * try {
- * $formattedName = $catalogServiceClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
- * $response = $catalogServiceClient->getCatalogItem($formattedName);
- * } finally {
- * $catalogServiceClient->close();
- * }
- * ```
- *
- * @param string $name Required. Full resource name of catalog item, such as
- * `projects/*/locations/global/catalogs/default_catalog/catalogitems/some_catalog_item_id`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\RecommendationEngine\V1beta1\CatalogItem
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function getCatalogItem($name, array $optionalArgs = [])
- {
- $request = new GetCatalogItemRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->startCall('GetCatalogItem', CatalogItem::class, $optionalArgs, $request)->wait();
- }
-
- /**
- * Bulk import of multiple catalog items. Request processing may be
- * synchronous. No partial updating supported. Non-existing items will be
- * created.
- *
- * Operation.response is of type ImportResponse. Note that it is
- * possible for a subset of the items to be successfully updated.
- *
- * Sample code:
- * ```
- * $catalogServiceClient = new CatalogServiceClient();
- * try {
- * $formattedParent = $catalogServiceClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
- * $inputConfig = new InputConfig();
- * $operationResponse = $catalogServiceClient->importCatalogItems($formattedParent, $inputConfig);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $catalogServiceClient->importCatalogItems($formattedParent, $inputConfig);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $catalogServiceClient->resumeOperation($operationName, 'importCatalogItems');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $catalogServiceClient->close();
- * }
- * ```
- *
- * @param string $parent Required. `projects/1234/locations/global/catalogs/default_catalog`
- * @param InputConfig $inputConfig Required. The desired input location of the data.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string $requestId
- * Optional. Unique identifier provided by client, within the ancestor
- * dataset scope. Ensures idempotency and used for request deduplication.
- * Server-generated if unspecified. Up to 128 characters long. This is
- * returned as google.longrunning.Operation.name in the response.
- * @type ImportErrorsConfig $errorsConfig
- * Optional. The desired location of errors incurred during the Import.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function importCatalogItems($parent, $inputConfig, array $optionalArgs = [])
- {
- $request = new ImportCatalogItemsRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setInputConfig($inputConfig);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['requestId'])) {
- $request->setRequestId($optionalArgs['requestId']);
- }
-
- if (isset($optionalArgs['errorsConfig'])) {
- $request->setErrorsConfig($optionalArgs['errorsConfig']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->startOperationsCall('ImportCatalogItems', $optionalArgs, $request, $this->getOperationsClient())->wait();
- }
-
- /**
- * Gets a list of catalog items.
- *
- * Sample code:
- * ```
- * $catalogServiceClient = new CatalogServiceClient();
- * try {
- * $formattedParent = $catalogServiceClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
- * // Iterate over pages of elements
- * $pagedResponse = $catalogServiceClient->listCatalogItems($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $catalogServiceClient->listCatalogItems($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $catalogServiceClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The parent catalog resource name, such as
- * `projects/*/locations/global/catalogs/default_catalog`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type string $filter
- * Optional. A filter to apply on the list results.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function listCatalogItems($parent, array $optionalArgs = [])
- {
- $request = new ListCatalogItemsRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- if (isset($optionalArgs['filter'])) {
- $request->setFilter($optionalArgs['filter']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->getPagedListResponse('ListCatalogItems', $optionalArgs, ListCatalogItemsResponse::class, $request);
- }
-
- /**
- * Updates a catalog item. Partial updating is supported. Non-existing
- * items will be created.
- *
- * Sample code:
- * ```
- * $catalogServiceClient = new CatalogServiceClient();
- * try {
- * $formattedName = $catalogServiceClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
- * $catalogItem = new CatalogItem();
- * $response = $catalogServiceClient->updateCatalogItem($formattedName, $catalogItem);
- * } finally {
- * $catalogServiceClient->close();
- * }
- * ```
- *
- * @param string $name Required. Full resource name of catalog item, such as
- * `projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id`.
- * @param CatalogItem $catalogItem Required. The catalog item to update/create. The 'catalog_item_id' field
- * has to match that in the 'name'.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type FieldMask $updateMask
- * Optional. Indicates which fields in the provided 'item' to update. If not
- * set, will by default update all fields.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\RecommendationEngine\V1beta1\CatalogItem
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function updateCatalogItem($name, $catalogItem, array $optionalArgs = [])
- {
- $request = new UpdateCatalogItemRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $request->setCatalogItem($catalogItem);
- $requestParamHeaders['name'] = $name;
- if (isset($optionalArgs['updateMask'])) {
- $request->setUpdateMask($optionalArgs['updateMask']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->startCall('UpdateCatalogItem', CatalogItem::class, $optionalArgs, $request)->wait();
- }
-}
diff --git a/RecommendationEngine/src/V1beta1/Gapic/PredictionApiKeyRegistryGapicClient.php b/RecommendationEngine/src/V1beta1/Gapic/PredictionApiKeyRegistryGapicClient.php
deleted file mode 100644
index af3209fc0229..000000000000
--- a/RecommendationEngine/src/V1beta1/Gapic/PredictionApiKeyRegistryGapicClient.php
+++ /dev/null
@@ -1,467 +0,0 @@
-eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- * $predictionApiKeyRegistration = new PredictionApiKeyRegistration();
- * $response = $predictionApiKeyRegistryClient->createPredictionApiKeyRegistration($formattedParent, $predictionApiKeyRegistration);
- * } finally {
- * $predictionApiKeyRegistryClient->close();
- * }
- * ```
- *
- * Many parameters require resource names to be formatted in a particular way. To
- * assist with these names, this class includes a format method for each type of
- * name, and additionally a parseName method to extract the individual identifiers
- * contained within formatted names that are returned by the API.
- *
- * @experimental
- *
- * @deprecated Please use the new service client {@see \Google\Cloud\RecommendationEngine\V1beta1\Client\PredictionApiKeyRegistryClient}.
- */
-class PredictionApiKeyRegistryGapicClient
-{
- use GapicClientTrait;
-
- /** The name of the service. */
- const SERVICE_NAME = 'google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry';
-
- /**
- * The default address of the service.
- *
- * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead.
- */
- const SERVICE_ADDRESS = 'recommendationengine.googleapis.com';
-
- /** The address template of the service. */
- private const SERVICE_ADDRESS_TEMPLATE = 'recommendationengine.UNIVERSE_DOMAIN';
-
- /** The default port of the service. */
- const DEFAULT_SERVICE_PORT = 443;
-
- /** The name of the code generator, to be included in the agent header. */
- const CODEGEN_NAME = 'gapic';
-
- /** The default scopes required by the service. */
- public static $serviceScopes = [
- 'https://www.googleapis.com/auth/cloud-platform',
- ];
-
- private static $eventStoreNameTemplate;
-
- private static $predictionApiKeyRegistrationNameTemplate;
-
- private static $pathTemplateMap;
-
- private static function getClientDefaults()
- {
- return [
- 'serviceName' => self::SERVICE_NAME,
- 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT,
- 'clientConfig' => __DIR__ . '/../resources/prediction_api_key_registry_client_config.json',
- 'descriptorsConfigPath' => __DIR__ . '/../resources/prediction_api_key_registry_descriptor_config.php',
- 'gcpApiConfigPath' => __DIR__ . '/../resources/prediction_api_key_registry_grpc_config.json',
- 'credentialsConfig' => [
- 'defaultScopes' => self::$serviceScopes,
- ],
- 'transportConfig' => [
- 'rest' => [
- 'restClientConfigPath' => __DIR__ . '/../resources/prediction_api_key_registry_rest_client_config.php',
- ],
- ],
- ];
- }
-
- private static function getEventStoreNameTemplate()
- {
- if (self::$eventStoreNameTemplate == null) {
- self::$eventStoreNameTemplate = new PathTemplate('projects/{project}/locations/{location}/catalogs/{catalog}/eventStores/{event_store}');
- }
-
- return self::$eventStoreNameTemplate;
- }
-
- private static function getPredictionApiKeyRegistrationNameTemplate()
- {
- if (self::$predictionApiKeyRegistrationNameTemplate == null) {
- self::$predictionApiKeyRegistrationNameTemplate = new PathTemplate('projects/{project}/locations/{location}/catalogs/{catalog}/eventStores/{event_store}/predictionApiKeyRegistrations/{prediction_api_key_registration}');
- }
-
- return self::$predictionApiKeyRegistrationNameTemplate;
- }
-
- private static function getPathTemplateMap()
- {
- if (self::$pathTemplateMap == null) {
- self::$pathTemplateMap = [
- 'eventStore' => self::getEventStoreNameTemplate(),
- 'predictionApiKeyRegistration' => self::getPredictionApiKeyRegistrationNameTemplate(),
- ];
- }
-
- return self::$pathTemplateMap;
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a event_store
- * resource.
- *
- * @param string $project
- * @param string $location
- * @param string $catalog
- * @param string $eventStore
- *
- * @return string The formatted event_store resource.
- *
- * @experimental
- */
- public static function eventStoreName($project, $location, $catalog, $eventStore)
- {
- return self::getEventStoreNameTemplate()->render([
- 'project' => $project,
- 'location' => $location,
- 'catalog' => $catalog,
- 'event_store' => $eventStore,
- ]);
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a
- * prediction_api_key_registration resource.
- *
- * @param string $project
- * @param string $location
- * @param string $catalog
- * @param string $eventStore
- * @param string $predictionApiKeyRegistration
- *
- * @return string The formatted prediction_api_key_registration resource.
- *
- * @experimental
- */
- public static function predictionApiKeyRegistrationName($project, $location, $catalog, $eventStore, $predictionApiKeyRegistration)
- {
- return self::getPredictionApiKeyRegistrationNameTemplate()->render([
- 'project' => $project,
- 'location' => $location,
- 'catalog' => $catalog,
- 'event_store' => $eventStore,
- 'prediction_api_key_registration' => $predictionApiKeyRegistration,
- ]);
- }
-
- /**
- * Parses a formatted name string and returns an associative array of the components in the name.
- * The following name formats are supported:
- * Template: Pattern
- * - eventStore: projects/{project}/locations/{location}/catalogs/{catalog}/eventStores/{event_store}
- * - predictionApiKeyRegistration: projects/{project}/locations/{location}/catalogs/{catalog}/eventStores/{event_store}/predictionApiKeyRegistrations/{prediction_api_key_registration}
- *
- * 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.
- *
- * @param string $formattedName The formatted name string
- * @param string $template Optional name of template to match
- *
- * @return array An associative array from name component IDs to component values.
- *
- * @throws ValidationException If $formattedName could not be matched.
- *
- * @experimental
- */
- public static function parseName($formattedName, $template = null)
- {
- $templateMap = self::getPathTemplateMap();
- if ($template) {
- if (!isset($templateMap[$template])) {
- throw new ValidationException("Template name $template does not exist");
- }
-
- return $templateMap[$template]->match($formattedName);
- }
-
- foreach ($templateMap as $templateName => $pathTemplate) {
- try {
- return $pathTemplate->match($formattedName);
- } catch (ValidationException $ex) {
- // Swallow the exception to continue trying other path templates
- }
- }
-
- throw new ValidationException("Input did not match any known format. Input: $formattedName");
- }
-
- /**
- * Constructor.
- *
- * @param array $options {
- * Optional. Options for configuring the service API wrapper.
- *
- * @type string $apiEndpoint
- * The address of the API remote host. May optionally include the port, formatted
- * as ":". Default 'recommendationengine.googleapis.com:443'.
- * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
- * 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
- * {@see \Google\Auth\FetchAuthTokenInterface} object or
- * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
- * objects are provided, any settings in $credentialsConfig will be ignored.
- * @type array $credentialsConfig
- * Options used to configure credentials, including auth token caching, for the
- * client. For a full list of supporting configuration options, see
- * {@see \Google\ApiCore\CredentialsWrapper::build()} .
- * @type bool $disableRetries
- * Determines whether or not retries defined by the client configuration should be
- * disabled. Defaults to `false`.
- * @type string|array $clientConfig
- * 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.
- * @type string|TransportInterface $transport
- * 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 {@see \Google\ApiCore\Transport\TransportInterface} object. Note
- * that when this object is provided, any settings in $transportConfig, and any
- * $apiEndpoint setting, will be ignored.
- * @type array $transportConfig
- * 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 {@see \Google\ApiCore\Transport\GrpcTransport::build()} and
- * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the
- * supported options.
- * @type callable $clientCertSource
- * 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.
- * }
- *
- * @throws ValidationException
- *
- * @experimental
- */
- public function __construct(array $options = [])
- {
- $clientOptions = $this->buildClientOptions($options);
- $this->setClientOptions($clientOptions);
- }
-
- /**
- * Register an API key for use with predict method.
- *
- * Sample code:
- * ```
- * $predictionApiKeyRegistryClient = new PredictionApiKeyRegistryClient();
- * try {
- * $formattedParent = $predictionApiKeyRegistryClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- * $predictionApiKeyRegistration = new PredictionApiKeyRegistration();
- * $response = $predictionApiKeyRegistryClient->createPredictionApiKeyRegistration($formattedParent, $predictionApiKeyRegistration);
- * } finally {
- * $predictionApiKeyRegistryClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The parent resource path.
- * `projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store`.
- * @param PredictionApiKeyRegistration $predictionApiKeyRegistration Required. The prediction API key registration.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\RecommendationEngine\V1beta1\PredictionApiKeyRegistration
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function createPredictionApiKeyRegistration($parent, $predictionApiKeyRegistration, array $optionalArgs = [])
- {
- $request = new CreatePredictionApiKeyRegistrationRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setPredictionApiKeyRegistration($predictionApiKeyRegistration);
- $requestParamHeaders['parent'] = $parent;
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->startCall('CreatePredictionApiKeyRegistration', PredictionApiKeyRegistration::class, $optionalArgs, $request)->wait();
- }
-
- /**
- * Unregister an apiKey from using for predict method.
- *
- * Sample code:
- * ```
- * $predictionApiKeyRegistryClient = new PredictionApiKeyRegistryClient();
- * try {
- * $formattedName = $predictionApiKeyRegistryClient->predictionApiKeyRegistrationName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]', '[PREDICTION_API_KEY_REGISTRATION]');
- * $predictionApiKeyRegistryClient->deletePredictionApiKeyRegistration($formattedName);
- * } finally {
- * $predictionApiKeyRegistryClient->close();
- * }
- * ```
- *
- * @param string $name Required. The API key to unregister including full resource path.
- * `projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/predictionApiKeyRegistrations/`
- * @param array $optionalArgs {
- * Optional.
- *
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function deletePredictionApiKeyRegistration($name, array $optionalArgs = [])
- {
- $request = new DeletePredictionApiKeyRegistrationRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->startCall('DeletePredictionApiKeyRegistration', GPBEmpty::class, $optionalArgs, $request)->wait();
- }
-
- /**
- * List the registered apiKeys for use with predict method.
- *
- * Sample code:
- * ```
- * $predictionApiKeyRegistryClient = new PredictionApiKeyRegistryClient();
- * try {
- * $formattedParent = $predictionApiKeyRegistryClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- * // Iterate over pages of elements
- * $pagedResponse = $predictionApiKeyRegistryClient->listPredictionApiKeyRegistrations($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $predictionApiKeyRegistryClient->listPredictionApiKeyRegistrations($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $predictionApiKeyRegistryClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The parent placement resource name such as
- * `projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store`
- * @param array $optionalArgs {
- * Optional.
- *
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function listPredictionApiKeyRegistrations($parent, array $optionalArgs = [])
- {
- $request = new ListPredictionApiKeyRegistrationsRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->getPagedListResponse('ListPredictionApiKeyRegistrations', $optionalArgs, ListPredictionApiKeyRegistrationsResponse::class, $request);
- }
-}
diff --git a/RecommendationEngine/src/V1beta1/Gapic/PredictionServiceGapicClient.php b/RecommendationEngine/src/V1beta1/Gapic/PredictionServiceGapicClient.php
deleted file mode 100644
index b2adeff517be..000000000000
--- a/RecommendationEngine/src/V1beta1/Gapic/PredictionServiceGapicClient.php
+++ /dev/null
@@ -1,451 +0,0 @@
-placementName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]', '[PLACEMENT]');
- * $userEvent = new UserEvent();
- * // Iterate over pages of elements
- * $pagedResponse = $predictionServiceClient->predict($formattedName, $userEvent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $predictionServiceClient->predict($formattedName, $userEvent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $predictionServiceClient->close();
- * }
- * ```
- *
- * Many parameters require resource names to be formatted in a particular way. To
- * assist with these names, this class includes a format method for each type of
- * name, and additionally a parseName method to extract the individual identifiers
- * contained within formatted names that are returned by the API.
- *
- * @experimental
- *
- * @deprecated Please use the new service client {@see \Google\Cloud\RecommendationEngine\V1beta1\Client\PredictionServiceClient}.
- */
-class PredictionServiceGapicClient
-{
- use GapicClientTrait;
-
- /** The name of the service. */
- const SERVICE_NAME = 'google.cloud.recommendationengine.v1beta1.PredictionService';
-
- /**
- * The default address of the service.
- *
- * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead.
- */
- const SERVICE_ADDRESS = 'recommendationengine.googleapis.com';
-
- /** The address template of the service. */
- private const SERVICE_ADDRESS_TEMPLATE = 'recommendationengine.UNIVERSE_DOMAIN';
-
- /** The default port of the service. */
- const DEFAULT_SERVICE_PORT = 443;
-
- /** The name of the code generator, to be included in the agent header. */
- const CODEGEN_NAME = 'gapic';
-
- /** The default scopes required by the service. */
- public static $serviceScopes = [
- 'https://www.googleapis.com/auth/cloud-platform',
- ];
-
- private static $placementNameTemplate;
-
- private static $pathTemplateMap;
-
- private static function getClientDefaults()
- {
- return [
- 'serviceName' => self::SERVICE_NAME,
- 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT,
- 'clientConfig' => __DIR__ . '/../resources/prediction_service_client_config.json',
- 'descriptorsConfigPath' => __DIR__ . '/../resources/prediction_service_descriptor_config.php',
- 'gcpApiConfigPath' => __DIR__ . '/../resources/prediction_service_grpc_config.json',
- 'credentialsConfig' => [
- 'defaultScopes' => self::$serviceScopes,
- ],
- 'transportConfig' => [
- 'rest' => [
- 'restClientConfigPath' => __DIR__ . '/../resources/prediction_service_rest_client_config.php',
- ],
- ],
- ];
- }
-
- private static function getPlacementNameTemplate()
- {
- if (self::$placementNameTemplate == null) {
- self::$placementNameTemplate = new PathTemplate('projects/{project}/locations/{location}/catalogs/{catalog}/eventStores/{event_store}/placements/{placement}');
- }
-
- return self::$placementNameTemplate;
- }
-
- private static function getPathTemplateMap()
- {
- if (self::$pathTemplateMap == null) {
- self::$pathTemplateMap = [
- 'placement' => self::getPlacementNameTemplate(),
- ];
- }
-
- return self::$pathTemplateMap;
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a placement
- * resource.
- *
- * @param string $project
- * @param string $location
- * @param string $catalog
- * @param string $eventStore
- * @param string $placement
- *
- * @return string The formatted placement resource.
- *
- * @experimental
- */
- public static function placementName($project, $location, $catalog, $eventStore, $placement)
- {
- return self::getPlacementNameTemplate()->render([
- 'project' => $project,
- 'location' => $location,
- 'catalog' => $catalog,
- 'event_store' => $eventStore,
- 'placement' => $placement,
- ]);
- }
-
- /**
- * Parses a formatted name string and returns an associative array of the components in the name.
- * The following name formats are supported:
- * Template: Pattern
- * - placement: projects/{project}/locations/{location}/catalogs/{catalog}/eventStores/{event_store}/placements/{placement}
- *
- * 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.
- *
- * @param string $formattedName The formatted name string
- * @param string $template Optional name of template to match
- *
- * @return array An associative array from name component IDs to component values.
- *
- * @throws ValidationException If $formattedName could not be matched.
- *
- * @experimental
- */
- public static function parseName($formattedName, $template = null)
- {
- $templateMap = self::getPathTemplateMap();
- if ($template) {
- if (!isset($templateMap[$template])) {
- throw new ValidationException("Template name $template does not exist");
- }
-
- return $templateMap[$template]->match($formattedName);
- }
-
- foreach ($templateMap as $templateName => $pathTemplate) {
- try {
- return $pathTemplate->match($formattedName);
- } catch (ValidationException $ex) {
- // Swallow the exception to continue trying other path templates
- }
- }
-
- throw new ValidationException("Input did not match any known format. Input: $formattedName");
- }
-
- /**
- * Constructor.
- *
- * @param array $options {
- * Optional. Options for configuring the service API wrapper.
- *
- * @type string $apiEndpoint
- * The address of the API remote host. May optionally include the port, formatted
- * as ":". Default 'recommendationengine.googleapis.com:443'.
- * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
- * 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
- * {@see \Google\Auth\FetchAuthTokenInterface} object or
- * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
- * objects are provided, any settings in $credentialsConfig will be ignored.
- * @type array $credentialsConfig
- * Options used to configure credentials, including auth token caching, for the
- * client. For a full list of supporting configuration options, see
- * {@see \Google\ApiCore\CredentialsWrapper::build()} .
- * @type bool $disableRetries
- * Determines whether or not retries defined by the client configuration should be
- * disabled. Defaults to `false`.
- * @type string|array $clientConfig
- * 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.
- * @type string|TransportInterface $transport
- * 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 {@see \Google\ApiCore\Transport\TransportInterface} object. Note
- * that when this object is provided, any settings in $transportConfig, and any
- * $apiEndpoint setting, will be ignored.
- * @type array $transportConfig
- * 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 {@see \Google\ApiCore\Transport\GrpcTransport::build()} and
- * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the
- * supported options.
- * @type callable $clientCertSource
- * 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.
- * }
- *
- * @throws ValidationException
- *
- * @experimental
- */
- public function __construct(array $options = [])
- {
- $clientOptions = $this->buildClientOptions($options);
- $this->setClientOptions($clientOptions);
- }
-
- /**
- * Makes a recommendation prediction. If using API Key based authentication,
- * the API Key must be registered using the
- * [PredictionApiKeyRegistry][google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry]
- * service. [Learn more](https://cloud.google.com/recommendations-ai/docs/setting-up#register-key).
- *
- * Sample code:
- * ```
- * $predictionServiceClient = new PredictionServiceClient();
- * try {
- * $formattedName = $predictionServiceClient->placementName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]', '[PLACEMENT]');
- * $userEvent = new UserEvent();
- * // Iterate over pages of elements
- * $pagedResponse = $predictionServiceClient->predict($formattedName, $userEvent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $predictionServiceClient->predict($formattedName, $userEvent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $predictionServiceClient->close();
- * }
- * ```
- *
- * @param string $name Required. Full resource name of the format:
- * `{name=projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/placements/*}`
- * The id of the recommendation engine placement. This id is used to identify
- * the set of models that will be used to make the prediction.
- *
- * We currently support three placements with the following IDs by default:
- *
- * * `shopping_cart`: Predicts items frequently bought together with one or
- * more catalog items in the same shopping session. Commonly displayed after
- * `add-to-cart` events, on product detail pages, or on the shopping cart
- * page.
- *
- * * `home_page`: Predicts the next product that a user will most likely
- * engage with or purchase based on the shopping or viewing history of the
- * specified `userId` or `visitorId`. For example - Recommendations for you.
- *
- * * `product_detail`: Predicts the next product that a user will most likely
- * engage with or purchase. The prediction is based on the shopping or
- * viewing history of the specified `userId` or `visitorId` and its
- * relevance to a specified `CatalogItem`. Typically used on product detail
- * pages. For example - More items like this.
- *
- * * `recently_viewed_default`: Returns up to 75 items recently viewed by the
- * specified `userId` or `visitorId`, most recent ones first. Returns
- * nothing if neither of them has viewed any items yet. For example -
- * Recently viewed.
- *
- * The full list of available placements can be seen at
- * https://console.cloud.google.com/recommendation/datafeeds/default_catalog/dashboard
- * @param UserEvent $userEvent Required. Context about the user, what they are looking at and what action
- * they took to trigger the predict request. Note that this user event detail
- * won't be ingested to userEvent logs. Thus, a separate userEvent write
- * request is required for event logging.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type string $filter
- * Optional. Filter for restricting prediction results. Accepts values for
- * tags and the `filterOutOfStockItems` flag.
- *
- * * Tag expressions. Restricts predictions to items that match all of the
- * specified tags. Boolean operators `OR` and `NOT` are supported if the
- * expression is enclosed in parentheses, and must be separated from the
- * tag values by a space. `-"tagA"` is also supported and is equivalent to
- * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
- * with a size limit of 1 KiB.
- *
- * * filterOutOfStockItems. Restricts predictions to items that do not have a
- * stockState value of OUT_OF_STOCK.
- *
- * Examples:
- *
- * * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
- * * filterOutOfStockItems tag=(-"promotional")
- * * filterOutOfStockItems
- * @type bool $dryRun
- * Optional. Use dryRun mode for this prediction query. If set to true, a
- * dummy model will be used that returns arbitrary catalog items.
- * Note that the dryRun mode should only be used for testing the API, or if
- * the model is not ready.
- * @type array $params
- * Optional. Additional domain specific parameters for the predictions.
- *
- * Allowed values:
- *
- * * `returnCatalogItem`: Boolean. If set to true, the associated catalogItem
- * object will be returned in the
- * `PredictResponse.PredictionResult.itemMetadata` object in the method
- * response.
- * * `returnItemScore`: Boolean. If set to true, the prediction 'score'
- * corresponding to each returned item will be set in the `metadata`
- * field in the prediction response. The given 'score' indicates the
- * probability of an item being clicked/purchased given the user's context
- * and history.
- * @type array $labels
- * Optional. The labels for the predict request.
- *
- * * Label keys can contain lowercase letters, digits and hyphens, must start
- * with a letter, and must end with a letter or digit.
- * * Non-zero label values can contain lowercase letters, digits and hyphens,
- * must start with a letter, and must end with a letter or digit.
- * * No more than 64 labels can be associated with a given request.
- *
- * See https://goo.gl/xmQnxf for more information on and examples of labels.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function predict($name, $userEvent, array $optionalArgs = [])
- {
- $request = new PredictRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $request->setUserEvent($userEvent);
- $requestParamHeaders['name'] = $name;
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- if (isset($optionalArgs['filter'])) {
- $request->setFilter($optionalArgs['filter']);
- }
-
- if (isset($optionalArgs['dryRun'])) {
- $request->setDryRun($optionalArgs['dryRun']);
- }
-
- if (isset($optionalArgs['params'])) {
- $request->setParams($optionalArgs['params']);
- }
-
- if (isset($optionalArgs['labels'])) {
- $request->setLabels($optionalArgs['labels']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->getPagedListResponse('Predict', $optionalArgs, PredictResponse::class, $request);
- }
-}
diff --git a/RecommendationEngine/src/V1beta1/Gapic/UserEventServiceGapicClient.php b/RecommendationEngine/src/V1beta1/Gapic/UserEventServiceGapicClient.php
deleted file mode 100644
index 0fcdb79cea8a..000000000000
--- a/RecommendationEngine/src/V1beta1/Gapic/UserEventServiceGapicClient.php
+++ /dev/null
@@ -1,724 +0,0 @@
-eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- * $userEvent = 'user_event';
- * $response = $userEventServiceClient->collectUserEvent($formattedParent, $userEvent);
- * } finally {
- * $userEventServiceClient->close();
- * }
- * ```
- *
- * Many parameters require resource names to be formatted in a particular way. To
- * assist with these names, this class includes a format method for each type of
- * name, and additionally a parseName method to extract the individual identifiers
- * contained within formatted names that are returned by the API.
- *
- * @experimental
- *
- * @deprecated Please use the new service client {@see \Google\Cloud\RecommendationEngine\V1beta1\Client\UserEventServiceClient}.
- */
-class UserEventServiceGapicClient
-{
- use GapicClientTrait;
-
- /** The name of the service. */
- const SERVICE_NAME = 'google.cloud.recommendationengine.v1beta1.UserEventService';
-
- /**
- * The default address of the service.
- *
- * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead.
- */
- const SERVICE_ADDRESS = 'recommendationengine.googleapis.com';
-
- /** The address template of the service. */
- private const SERVICE_ADDRESS_TEMPLATE = 'recommendationengine.UNIVERSE_DOMAIN';
-
- /** The default port of the service. */
- const DEFAULT_SERVICE_PORT = 443;
-
- /** The name of the code generator, to be included in the agent header. */
- const CODEGEN_NAME = 'gapic';
-
- /** The default scopes required by the service. */
- public static $serviceScopes = [
- 'https://www.googleapis.com/auth/cloud-platform',
- ];
-
- private static $eventStoreNameTemplate;
-
- private static $pathTemplateMap;
-
- private $operationsClient;
-
- private static function getClientDefaults()
- {
- return [
- 'serviceName' => self::SERVICE_NAME,
- 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT,
- 'clientConfig' => __DIR__ . '/../resources/user_event_service_client_config.json',
- 'descriptorsConfigPath' => __DIR__ . '/../resources/user_event_service_descriptor_config.php',
- 'gcpApiConfigPath' => __DIR__ . '/../resources/user_event_service_grpc_config.json',
- 'credentialsConfig' => [
- 'defaultScopes' => self::$serviceScopes,
- ],
- 'transportConfig' => [
- 'rest' => [
- 'restClientConfigPath' => __DIR__ . '/../resources/user_event_service_rest_client_config.php',
- ],
- ],
- ];
- }
-
- private static function getEventStoreNameTemplate()
- {
- if (self::$eventStoreNameTemplate == null) {
- self::$eventStoreNameTemplate = new PathTemplate('projects/{project}/locations/{location}/catalogs/{catalog}/eventStores/{event_store}');
- }
-
- return self::$eventStoreNameTemplate;
- }
-
- private static function getPathTemplateMap()
- {
- if (self::$pathTemplateMap == null) {
- self::$pathTemplateMap = [
- 'eventStore' => self::getEventStoreNameTemplate(),
- ];
- }
-
- return self::$pathTemplateMap;
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a event_store
- * resource.
- *
- * @param string $project
- * @param string $location
- * @param string $catalog
- * @param string $eventStore
- *
- * @return string The formatted event_store resource.
- *
- * @experimental
- */
- public static function eventStoreName($project, $location, $catalog, $eventStore)
- {
- return self::getEventStoreNameTemplate()->render([
- 'project' => $project,
- 'location' => $location,
- 'catalog' => $catalog,
- 'event_store' => $eventStore,
- ]);
- }
-
- /**
- * Parses a formatted name string and returns an associative array of the components in the name.
- * The following name formats are supported:
- * Template: Pattern
- * - eventStore: projects/{project}/locations/{location}/catalogs/{catalog}/eventStores/{event_store}
- *
- * 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.
- *
- * @param string $formattedName The formatted name string
- * @param string $template Optional name of template to match
- *
- * @return array An associative array from name component IDs to component values.
- *
- * @throws ValidationException If $formattedName could not be matched.
- *
- * @experimental
- */
- public static function parseName($formattedName, $template = null)
- {
- $templateMap = self::getPathTemplateMap();
- if ($template) {
- if (!isset($templateMap[$template])) {
- throw new ValidationException("Template name $template does not exist");
- }
-
- return $templateMap[$template]->match($formattedName);
- }
-
- foreach ($templateMap as $templateName => $pathTemplate) {
- try {
- return $pathTemplate->match($formattedName);
- } catch (ValidationException $ex) {
- // Swallow the exception to continue trying other path templates
- }
- }
-
- throw new ValidationException("Input did not match any known format. Input: $formattedName");
- }
-
- /**
- * Return an OperationsClient object with the same endpoint as $this.
- *
- * @return OperationsClient
- *
- * @experimental
- */
- public function getOperationsClient()
- {
- return $this->operationsClient;
- }
-
- /**
- * 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.
- *
- * @param string $operationName The name of the long running operation
- * @param string $methodName The name of the method used to start the operation
- *
- * @return OperationResponse
- *
- * @experimental
- */
- public function resumeOperation($operationName, $methodName = null)
- {
- $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : [];
- $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options);
- $operation->reload();
- return $operation;
- }
-
- /**
- * Constructor.
- *
- * @param array $options {
- * Optional. Options for configuring the service API wrapper.
- *
- * @type string $apiEndpoint
- * The address of the API remote host. May optionally include the port, formatted
- * as ":". Default 'recommendationengine.googleapis.com:443'.
- * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
- * 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
- * {@see \Google\Auth\FetchAuthTokenInterface} object or
- * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
- * objects are provided, any settings in $credentialsConfig will be ignored.
- * @type array $credentialsConfig
- * Options used to configure credentials, including auth token caching, for the
- * client. For a full list of supporting configuration options, see
- * {@see \Google\ApiCore\CredentialsWrapper::build()} .
- * @type bool $disableRetries
- * Determines whether or not retries defined by the client configuration should be
- * disabled. Defaults to `false`.
- * @type string|array $clientConfig
- * 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.
- * @type string|TransportInterface $transport
- * 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 {@see \Google\ApiCore\Transport\TransportInterface} object. Note
- * that when this object is provided, any settings in $transportConfig, and any
- * $apiEndpoint setting, will be ignored.
- * @type array $transportConfig
- * 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 {@see \Google\ApiCore\Transport\GrpcTransport::build()} and
- * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the
- * supported options.
- * @type callable $clientCertSource
- * 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.
- * }
- *
- * @throws ValidationException
- *
- * @experimental
- */
- public function __construct(array $options = [])
- {
- $clientOptions = $this->buildClientOptions($options);
- $this->setClientOptions($clientOptions);
- $this->operationsClient = $this->createOperationsClient($clientOptions);
- }
-
- /**
- * Writes a single user event from the browser. This uses a GET request to
- * due to browser restriction of POST-ing to a 3rd party domain.
- *
- * This method is used only by the Recommendations AI JavaScript pixel.
- * Users should not call this method directly.
- *
- * Sample code:
- * ```
- * $userEventServiceClient = new UserEventServiceClient();
- * try {
- * $formattedParent = $userEventServiceClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- * $userEvent = 'user_event';
- * $response = $userEventServiceClient->collectUserEvent($formattedParent, $userEvent);
- * } finally {
- * $userEventServiceClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The parent eventStore name, such as
- * `projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store`.
- * @param string $userEvent Required. URL encoded UserEvent proto.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string $uri
- * Optional. The url including cgi-parameters but excluding the hash fragment.
- * The URL must be truncated to 1.5K bytes to conservatively be under the 2K
- * bytes. This is often more useful than the referer url, because many
- * browsers only send the domain for 3rd party requests.
- * @type int $ets
- * Optional. The event timestamp in milliseconds. This prevents browser
- * caching of otherwise identical get requests. The name is abbreviated to
- * reduce the payload bytes.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Api\HttpBody
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function collectUserEvent($parent, $userEvent, array $optionalArgs = [])
- {
- $request = new CollectUserEventRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setUserEvent($userEvent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['uri'])) {
- $request->setUri($optionalArgs['uri']);
- }
-
- if (isset($optionalArgs['ets'])) {
- $request->setEts($optionalArgs['ets']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->startCall('CollectUserEvent', HttpBody::class, $optionalArgs, $request)->wait();
- }
-
- /**
- * Bulk import of User events. Request processing might be
- * synchronous. Events that already exist are skipped.
- * Use this method for backfilling historical user events.
- *
- * Operation.response is of type ImportResponse. Note that it is
- * possible for a subset of the items to be successfully inserted.
- * Operation.metadata is of type ImportMetadata.
- *
- * Sample code:
- * ```
- * $userEventServiceClient = new UserEventServiceClient();
- * try {
- * $formattedParent = $userEventServiceClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- * $inputConfig = new InputConfig();
- * $operationResponse = $userEventServiceClient->importUserEvents($formattedParent, $inputConfig);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $userEventServiceClient->importUserEvents($formattedParent, $inputConfig);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $userEventServiceClient->resumeOperation($operationName, 'importUserEvents');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $userEventServiceClient->close();
- * }
- * ```
- *
- * @param string $parent Required.
- * `projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store`
- * @param InputConfig $inputConfig Required. The desired input location of the data.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string $requestId
- * Optional. Unique identifier provided by client, within the ancestor
- * dataset scope. Ensures idempotency for expensive long running operations.
- * Server-generated if unspecified. Up to 128 characters long. This is
- * returned as google.longrunning.Operation.name in the response. Note that
- * this field must not be set if the desired input config is
- * catalog_inline_source.
- * @type ImportErrorsConfig $errorsConfig
- * Optional. The desired location of errors incurred during the Import.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function importUserEvents($parent, $inputConfig, array $optionalArgs = [])
- {
- $request = new ImportUserEventsRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setInputConfig($inputConfig);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['requestId'])) {
- $request->setRequestId($optionalArgs['requestId']);
- }
-
- if (isset($optionalArgs['errorsConfig'])) {
- $request->setErrorsConfig($optionalArgs['errorsConfig']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->startOperationsCall('ImportUserEvents', $optionalArgs, $request, $this->getOperationsClient())->wait();
- }
-
- /**
- * Gets a list of user events within a time range, with potential filtering.
- *
- * Sample code:
- * ```
- * $userEventServiceClient = new UserEventServiceClient();
- * try {
- * $formattedParent = $userEventServiceClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- * // Iterate over pages of elements
- * $pagedResponse = $userEventServiceClient->listUserEvents($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $userEventServiceClient->listUserEvents($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $userEventServiceClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The parent eventStore resource name, such as
- * `projects/*/locations/*/catalogs/default_catalog/eventStores/default_event_store`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type string $filter
- * Optional. Filtering expression to specify restrictions over
- * returned events. This is a sequence of terms, where each term applies some
- * kind of a restriction to the returned user events. Use this expression to
- * restrict results to a specific time range, or filter events by eventType.
- * eg: eventTime > "2012-04-23T18:25:43.511Z" eventsMissingCatalogItems
- * eventTime<"2012-04-23T18:25:43.511Z" eventType=search
- *
- * We expect only 3 types of fields:
- *
- * * eventTime: this can be specified a maximum of 2 times, once with a
- * less than operator and once with a greater than operator. The
- * eventTime restrict should result in one contiguous valid eventTime
- * range.
- *
- * * eventType: only 1 eventType restriction can be specified.
- *
- * * eventsMissingCatalogItems: specififying this will restrict results
- * to events for which catalog items were not found in the catalog. The
- * default behavior is to return only those events for which catalog
- * items were found.
- *
- * Some examples of valid filters expressions:
- *
- * * Example 1: eventTime > "2012-04-23T18:25:43.511Z"
- * eventTime < "2012-04-23T18:30:43.511Z"
- * * Example 2: eventTime > "2012-04-23T18:25:43.511Z"
- * eventType = detail-page-view
- * * Example 3: eventsMissingCatalogItems
- * eventType = search eventTime < "2018-04-23T18:30:43.511Z"
- * * Example 4: eventTime > "2012-04-23T18:25:43.511Z"
- * * Example 5: eventType = search
- * * Example 6: eventsMissingCatalogItems
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function listUserEvents($parent, array $optionalArgs = [])
- {
- $request = new ListUserEventsRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- if (isset($optionalArgs['filter'])) {
- $request->setFilter($optionalArgs['filter']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->getPagedListResponse('ListUserEvents', $optionalArgs, ListUserEventsResponse::class, $request);
- }
-
- /**
- * Deletes permanently all user events specified by the filter provided.
- * Depending on the number of events specified by the filter, this operation
- * could take hours or days to complete. To test a filter, use the list
- * command first.
- *
- * Sample code:
- * ```
- * $userEventServiceClient = new UserEventServiceClient();
- * try {
- * $formattedParent = $userEventServiceClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- * $filter = 'filter';
- * $operationResponse = $userEventServiceClient->purgeUserEvents($formattedParent, $filter);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $userEventServiceClient->purgeUserEvents($formattedParent, $filter);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $userEventServiceClient->resumeOperation($operationName, 'purgeUserEvents');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $userEventServiceClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The resource name of the event_store under which the events are
- * created. The format is
- * `projects/${projectId}/locations/global/catalogs/${catalogId}/eventStores/${eventStoreId}`
- * @param string $filter Required. The filter string to specify the events to be deleted. Empty
- * string filter is not allowed. This filter can also be used with
- * ListUserEvents API to list events that will be deleted. The eligible fields
- * for filtering are:
- * * eventType - UserEvent.eventType field of type string.
- * * eventTime - in ISO 8601 "zulu" format.
- * * visitorId - field of type string. Specifying this will delete all events
- * associated with a visitor.
- * * userId - field of type string. Specifying this will delete all events
- * associated with a user.
- * Example 1: Deleting all events in a time range.
- * `eventTime > "2012-04-23T18:25:43.511Z" eventTime <
- * "2012-04-23T18:30:43.511Z"`
- * Example 2: Deleting specific eventType in time range.
- * `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
- * Example 3: Deleting all events for a specific visitor
- * `visitorId = visitor1024`
- * The filtering fields are assumed to have an implicit AND.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type bool $force
- * Optional. The default value is false. Override this flag to true to
- * actually perform the purge. If the field is not set to true, a sampling of
- * events to be deleted will be returned.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function purgeUserEvents($parent, $filter, array $optionalArgs = [])
- {
- $request = new PurgeUserEventsRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setFilter($filter);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['force'])) {
- $request->setForce($optionalArgs['force']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->startOperationsCall('PurgeUserEvents', $optionalArgs, $request, $this->getOperationsClient())->wait();
- }
-
- /**
- * Writes a single user event.
- *
- * Sample code:
- * ```
- * $userEventServiceClient = new UserEventServiceClient();
- * try {
- * $formattedParent = $userEventServiceClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- * $userEvent = new UserEvent();
- * $response = $userEventServiceClient->writeUserEvent($formattedParent, $userEvent);
- * } finally {
- * $userEventServiceClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The parent eventStore resource name, such as
- * `projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store`.
- * @param UserEvent $userEvent Required. User event to write.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\RecommendationEngine\V1beta1\UserEvent
- *
- * @throws ApiException if the remote call fails
- *
- * @experimental
- */
- public function writeUserEvent($parent, $userEvent, array $optionalArgs = [])
- {
- $request = new WriteUserEventRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setUserEvent($userEvent);
- $requestParamHeaders['parent'] = $parent;
- $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
- $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
- return $this->startCall('WriteUserEvent', UserEvent::class, $optionalArgs, $request)->wait();
- }
-}
diff --git a/RecommendationEngine/src/V1beta1/GcsSource.php b/RecommendationEngine/src/V1beta1/GcsSource.php
index 8f835af6a6d8..ad47f31a44f8 100644
--- a/RecommendationEngine/src/V1beta1/GcsSource.php
+++ b/RecommendationEngine/src/V1beta1/GcsSource.php
@@ -22,7 +22,7 @@ class GcsSource extends \Google\Protobuf\Internal\Message
* `gs://bucket/directory/object.json`) or a pattern matching one or more
* files, such as `gs://bucket/directory/*.json`. A request can
* contain at most 100 files, and each file can be up to 2 GB. See
- * [Importing catalog information](https://cloud.google.com/recommendations-ai/docs/upload-catalog)
+ * [Importing catalog information](/recommendations-ai/docs/upload-catalog)
* for the expected file format and setup instructions.
*
* Generated from protobuf field repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED];
@@ -41,7 +41,7 @@ class GcsSource extends \Google\Protobuf\Internal\Message
* `gs://bucket/directory/object.json`) or a pattern matching one or more
* files, such as `gs://bucket/directory/*.json`. A request can
* contain at most 100 files, and each file can be up to 2 GB. See
- * [Importing catalog information](https://cloud.google.com/recommendations-ai/docs/upload-catalog)
+ * [Importing catalog information](/recommendations-ai/docs/upload-catalog)
* for the expected file format and setup instructions.
* }
*/
@@ -56,7 +56,7 @@ public function __construct($data = NULL) {
* `gs://bucket/directory/object.json`) or a pattern matching one or more
* files, such as `gs://bucket/directory/*.json`. A request can
* contain at most 100 files, and each file can be up to 2 GB. See
- * [Importing catalog information](https://cloud.google.com/recommendations-ai/docs/upload-catalog)
+ * [Importing catalog information](/recommendations-ai/docs/upload-catalog)
* for the expected file format and setup instructions.
*
* Generated from protobuf field repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED];
@@ -73,7 +73,7 @@ public function getInputUris()
* `gs://bucket/directory/object.json`) or a pattern matching one or more
* files, such as `gs://bucket/directory/*.json`. A request can
* contain at most 100 files, and each file can be up to 2 GB. See
- * [Importing catalog information](https://cloud.google.com/recommendations-ai/docs/upload-catalog)
+ * [Importing catalog information](/recommendations-ai/docs/upload-catalog)
* for the expected file format and setup instructions.
*
* Generated from protobuf field repeated string input_uris = 1 [(.google.api.field_behavior) = REQUIRED];
diff --git a/RecommendationEngine/src/V1beta1/GetCatalogItemRequest.php b/RecommendationEngine/src/V1beta1/GetCatalogItemRequest.php
index 98cefb396ca7..91e51e1c64ab 100644
--- a/RecommendationEngine/src/V1beta1/GetCatalogItemRequest.php
+++ b/RecommendationEngine/src/V1beta1/GetCatalogItemRequest.php
@@ -21,7 +21,7 @@ class GetCatalogItemRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* @param string $name Required. Full resource name of catalog item, such as
diff --git a/RecommendationEngine/src/V1beta1/Image.php b/RecommendationEngine/src/V1beta1/Image.php
index 4f04fb9ab1ec..5790795608f8 100644
--- a/RecommendationEngine/src/V1beta1/Image.php
+++ b/RecommendationEngine/src/V1beta1/Image.php
@@ -20,19 +20,19 @@ class Image extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $uri = '';
+ protected $uri = '';
/**
* Optional. Height of the image in number of pixels.
*
* Generated from protobuf field int32 height = 2 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $height = 0;
+ protected $height = 0;
/**
* Optional. Width of the image in number of pixels.
*
* Generated from protobuf field int32 width = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $width = 0;
+ protected $width = 0;
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/ImportCatalogItemsRequest.php b/RecommendationEngine/src/V1beta1/ImportCatalogItemsRequest.php
index ce88ed0bd288..9f1a9b4a42cd 100644
--- a/RecommendationEngine/src/V1beta1/ImportCatalogItemsRequest.php
+++ b/RecommendationEngine/src/V1beta1/ImportCatalogItemsRequest.php
@@ -20,7 +20,7 @@ class ImportCatalogItemsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Optional. Unique identifier provided by client, within the ancestor
* dataset scope. Ensures idempotency and used for request deduplication.
@@ -29,19 +29,19 @@ class ImportCatalogItemsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $request_id = '';
+ protected $request_id = '';
/**
* Required. The desired input location of the data.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.InputConfig input_config = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $input_config = null;
+ protected $input_config = null;
/**
* Optional. The desired location of errors incurred during the Import.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.ImportErrorsConfig errors_config = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $errors_config = null;
+ protected $errors_config = null;
/**
* @param string $parent Required. `projects/1234/locations/global/catalogs/default_catalog`
diff --git a/RecommendationEngine/src/V1beta1/ImportCatalogItemsResponse.php b/RecommendationEngine/src/V1beta1/ImportCatalogItemsResponse.php
index 9bdc9376491b..f1d250f54aed 100644
--- a/RecommendationEngine/src/V1beta1/ImportCatalogItemsResponse.php
+++ b/RecommendationEngine/src/V1beta1/ImportCatalogItemsResponse.php
@@ -28,7 +28,7 @@ class ImportCatalogItemsResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.ImportErrorsConfig errors_config = 2;
*/
- private $errors_config = null;
+ protected $errors_config = null;
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/ImportMetadata.php b/RecommendationEngine/src/V1beta1/ImportMetadata.php
index 9c4b09d68441..df36e57fb55e 100644
--- a/RecommendationEngine/src/V1beta1/ImportMetadata.php
+++ b/RecommendationEngine/src/V1beta1/ImportMetadata.php
@@ -21,39 +21,39 @@ class ImportMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string operation_name = 5;
*/
- private $operation_name = '';
+ protected $operation_name = '';
/**
* Id of the request / operation. This is parroting back the requestId that
* was passed in the request.
*
* Generated from protobuf field string request_id = 3;
*/
- private $request_id = '';
+ protected $request_id = '';
/**
* Operation create time.
*
* Generated from protobuf field .google.protobuf.Timestamp create_time = 4;
*/
- private $create_time = null;
+ protected $create_time = null;
/**
* Count of entries that were processed successfully.
*
* Generated from protobuf field int64 success_count = 1;
*/
- private $success_count = 0;
+ protected $success_count = 0;
/**
* Count of entries that encountered errors while processing.
*
* Generated from protobuf field int64 failure_count = 2;
*/
- private $failure_count = 0;
+ protected $failure_count = 0;
/**
* Operation last update time. If the operation is done, this is also the
* finish time.
*
* Generated from protobuf field .google.protobuf.Timestamp update_time = 6;
*/
- private $update_time = null;
+ protected $update_time = null;
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/ImportUserEventsRequest.php b/RecommendationEngine/src/V1beta1/ImportUserEventsRequest.php
index 0b7923123d92..d50c931107f6 100644
--- a/RecommendationEngine/src/V1beta1/ImportUserEventsRequest.php
+++ b/RecommendationEngine/src/V1beta1/ImportUserEventsRequest.php
@@ -21,7 +21,7 @@ class ImportUserEventsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Optional. Unique identifier provided by client, within the ancestor
* dataset scope. Ensures idempotency for expensive long running operations.
@@ -32,19 +32,19 @@ class ImportUserEventsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $request_id = '';
+ protected $request_id = '';
/**
* Required. The desired input location of the data.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.InputConfig input_config = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $input_config = null;
+ protected $input_config = null;
/**
* Optional. The desired location of errors incurred during the Import.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.ImportErrorsConfig errors_config = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $errors_config = null;
+ protected $errors_config = null;
/**
* @param string $parent Required.
diff --git a/RecommendationEngine/src/V1beta1/ImportUserEventsResponse.php b/RecommendationEngine/src/V1beta1/ImportUserEventsResponse.php
index 4684dc4875ce..a2c46b8b0d7d 100644
--- a/RecommendationEngine/src/V1beta1/ImportUserEventsResponse.php
+++ b/RecommendationEngine/src/V1beta1/ImportUserEventsResponse.php
@@ -29,13 +29,13 @@ class ImportUserEventsResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.ImportErrorsConfig errors_config = 2;
*/
- private $errors_config = null;
+ protected $errors_config = null;
/**
* Aggregated statistics of user event import status.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.UserEventImportSummary import_summary = 3;
*/
- private $import_summary = null;
+ protected $import_summary = null;
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/ListCatalogItemsRequest.php b/RecommendationEngine/src/V1beta1/ListCatalogItemsRequest.php
index 316dc961bd33..782b7c3cc7b4 100644
--- a/RecommendationEngine/src/V1beta1/ListCatalogItemsRequest.php
+++ b/RecommendationEngine/src/V1beta1/ListCatalogItemsRequest.php
@@ -21,26 +21,26 @@ class ListCatalogItemsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Optional. Maximum number of results to return per page. If zero, the
* service will choose a reasonable default.
*
* Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* Optional. The previous ListCatalogItemsResponse.next_page_token.
*
* Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* Optional. A filter to apply on the list results.
*
* Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $filter = '';
+ protected $filter = '';
/**
* @param string $parent Required. The parent catalog resource name, such as
diff --git a/RecommendationEngine/src/V1beta1/ListCatalogItemsResponse.php b/RecommendationEngine/src/V1beta1/ListCatalogItemsResponse.php
index 5f3f965bfcf9..5e6fc92950bf 100644
--- a/RecommendationEngine/src/V1beta1/ListCatalogItemsResponse.php
+++ b/RecommendationEngine/src/V1beta1/ListCatalogItemsResponse.php
@@ -27,7 +27,7 @@ class ListCatalogItemsResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/ListPredictionApiKeyRegistrationsRequest.php b/RecommendationEngine/src/V1beta1/ListPredictionApiKeyRegistrationsRequest.php
index d3ac5e2c6180..fb2ef75e9a9c 100644
--- a/RecommendationEngine/src/V1beta1/ListPredictionApiKeyRegistrationsRequest.php
+++ b/RecommendationEngine/src/V1beta1/ListPredictionApiKeyRegistrationsRequest.php
@@ -21,20 +21,20 @@ class ListPredictionApiKeyRegistrationsRequest extends \Google\Protobuf\Internal
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Optional. Maximum number of results to return per page. If unset, the
* service will choose a reasonable default.
*
* Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* Optional. The previous `ListPredictionApiKeyRegistration.nextPageToken`.
*
* Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* @param string $parent Required. The parent placement resource name such as
diff --git a/RecommendationEngine/src/V1beta1/ListPredictionApiKeyRegistrationsResponse.php b/RecommendationEngine/src/V1beta1/ListPredictionApiKeyRegistrationsResponse.php
index 2b15b50f1c44..10f6cde3a76e 100644
--- a/RecommendationEngine/src/V1beta1/ListPredictionApiKeyRegistrationsResponse.php
+++ b/RecommendationEngine/src/V1beta1/ListPredictionApiKeyRegistrationsResponse.php
@@ -27,7 +27,7 @@ class ListPredictionApiKeyRegistrationsResponse extends \Google\Protobuf\Interna
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/ListUserEventsRequest.php b/RecommendationEngine/src/V1beta1/ListUserEventsRequest.php
index 0c29ab12d3f4..1d959b454f64 100644
--- a/RecommendationEngine/src/V1beta1/ListUserEventsRequest.php
+++ b/RecommendationEngine/src/V1beta1/ListUserEventsRequest.php
@@ -21,20 +21,20 @@ class ListUserEventsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Optional. Maximum number of results to return per page. If zero, the
* service will choose a reasonable default.
*
* Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* Optional. The previous ListUserEventsResponse.next_page_token.
*
* Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* Optional. Filtering expression to specify restrictions over
* returned events. This is a sequence of terms, where each term applies some
@@ -65,7 +65,7 @@ class ListUserEventsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $filter = '';
+ protected $filter = '';
/**
* @param string $parent Required. The parent eventStore resource name, such as
diff --git a/RecommendationEngine/src/V1beta1/ListUserEventsResponse.php b/RecommendationEngine/src/V1beta1/ListUserEventsResponse.php
index 6849f9e4e20a..dd173c6ca7ae 100644
--- a/RecommendationEngine/src/V1beta1/ListUserEventsResponse.php
+++ b/RecommendationEngine/src/V1beta1/ListUserEventsResponse.php
@@ -27,7 +27,7 @@ class ListUserEventsResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/PredictRequest.php b/RecommendationEngine/src/V1beta1/PredictRequest.php
index ba05301e5c05..b437e2ee5472 100644
--- a/RecommendationEngine/src/V1beta1/PredictRequest.php
+++ b/RecommendationEngine/src/V1beta1/PredictRequest.php
@@ -42,7 +42,7 @@ class PredictRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* Required. Context about the user, what they are looking at and what action
* they took to trigger the predict request. Note that this user event detail
@@ -51,7 +51,7 @@ class PredictRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $user_event = null;
+ protected $user_event = null;
/**
* Optional. Maximum number of results to return per page. Set this property
* to the number of prediction results required. If zero, the service will
@@ -59,13 +59,13 @@ class PredictRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int32 page_size = 7 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* Optional. The previous PredictResponse.next_page_token.
*
* Generated from protobuf field string page_token = 8 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* Optional. Filter for restricting prediction results. Accepts values for
* tags and the `filterOutOfStockItems` flag.
@@ -84,7 +84,7 @@ class PredictRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string filter = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $filter = '';
+ protected $filter = '';
/**
* Optional. Use dryRun mode for this prediction query. If set to true, a
* dummy model will be used that returns arbitrary catalog items.
@@ -93,7 +93,7 @@ class PredictRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool dry_run = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $dry_run = false;
+ protected $dry_run = false;
/**
* Optional. Additional domain specific parameters for the predictions.
* Allowed values:
diff --git a/RecommendationEngine/src/V1beta1/PredictResponse.php b/RecommendationEngine/src/V1beta1/PredictResponse.php
index d942ea99cd7e..dd9123fe4fff 100644
--- a/RecommendationEngine/src/V1beta1/PredictResponse.php
+++ b/RecommendationEngine/src/V1beta1/PredictResponse.php
@@ -29,7 +29,7 @@ class PredictResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string recommendation_token = 2;
*/
- private $recommendation_token = '';
+ protected $recommendation_token = '';
/**
* IDs of items in the request that were missing from the catalog.
*
@@ -41,7 +41,7 @@ class PredictResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool dry_run = 4;
*/
- private $dry_run = false;
+ protected $dry_run = false;
/**
* Additional domain specific prediction response metadata.
*
@@ -54,7 +54,7 @@ class PredictResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string next_page_token = 6;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/PredictResponse/PredictionResult.php b/RecommendationEngine/src/V1beta1/PredictResponse/PredictionResult.php
index defabde711a8..b82a783ef439 100644
--- a/RecommendationEngine/src/V1beta1/PredictResponse/PredictionResult.php
+++ b/RecommendationEngine/src/V1beta1/PredictResponse/PredictionResult.php
@@ -20,7 +20,7 @@ class PredictionResult extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string id = 1;
*/
- private $id = '';
+ protected $id = '';
/**
* Additional item metadata / annotations.
* Possible values:
diff --git a/RecommendationEngine/src/V1beta1/PredictionApiKeyRegistration.php b/RecommendationEngine/src/V1beta1/PredictionApiKeyRegistration.php
index b336c4708870..07d4b018b1ae 100644
--- a/RecommendationEngine/src/V1beta1/PredictionApiKeyRegistration.php
+++ b/RecommendationEngine/src/V1beta1/PredictionApiKeyRegistration.php
@@ -20,7 +20,7 @@ class PredictionApiKeyRegistration extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string api_key = 1;
*/
- private $api_key = '';
+ protected $api_key = '';
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/PredictionApiKeyRegistryClient.php b/RecommendationEngine/src/V1beta1/PredictionApiKeyRegistryClient.php
deleted file mode 100644
index 62f83566db29..000000000000
--- a/RecommendationEngine/src/V1beta1/PredictionApiKeyRegistryClient.php
+++ /dev/null
@@ -1,36 +0,0 @@
-_simpleRequest('/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/CreatePredictionApiKeyRegistration',
- $argument,
- ['\Google\Cloud\RecommendationEngine\V1beta1\PredictionApiKeyRegistration', 'decode'],
- $metadata, $options);
- }
-
- /**
- * List the registered apiKeys for use with predict method.
- * @param \Google\Cloud\RecommendationEngine\V1beta1\ListPredictionApiKeyRegistrationsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ListPredictionApiKeyRegistrations(\Google\Cloud\RecommendationEngine\V1beta1\ListPredictionApiKeyRegistrationsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/ListPredictionApiKeyRegistrations',
- $argument,
- ['\Google\Cloud\RecommendationEngine\V1beta1\ListPredictionApiKeyRegistrationsResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Unregister an apiKey from using for predict method.
- * @param \Google\Cloud\RecommendationEngine\V1beta1\DeletePredictionApiKeyRegistrationRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function DeletePredictionApiKeyRegistration(\Google\Cloud\RecommendationEngine\V1beta1\DeletePredictionApiKeyRegistrationRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/DeletePredictionApiKeyRegistration',
- $argument,
- ['\Google\Protobuf\GPBEmpty', 'decode'],
- $metadata, $options);
- }
-
-}
diff --git a/RecommendationEngine/src/V1beta1/PredictionServiceClient.php b/RecommendationEngine/src/V1beta1/PredictionServiceClient.php
deleted file mode 100644
index c568fce30cdc..000000000000
--- a/RecommendationEngine/src/V1beta1/PredictionServiceClient.php
+++ /dev/null
@@ -1,36 +0,0 @@
-_simpleRequest('/google.cloud.recommendationengine.v1beta1.PredictionService/Predict',
- $argument,
- ['\Google\Cloud\RecommendationEngine\V1beta1\PredictResponse', 'decode'],
- $metadata, $options);
- }
-
-}
diff --git a/RecommendationEngine/src/V1beta1/ProductCatalogItem.php b/RecommendationEngine/src/V1beta1/ProductCatalogItem.php
index bd0d6c1e8a56..adca031c6cea 100644
--- a/RecommendationEngine/src/V1beta1/ProductCatalogItem.php
+++ b/RecommendationEngine/src/V1beta1/ProductCatalogItem.php
@@ -32,26 +32,26 @@ class ProductCatalogItem extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string currency_code = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $currency_code = '';
+ protected $currency_code = '';
/**
* Optional. Online stock state of the catalog item. Default is `IN_STOCK`.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState stock_state = 5 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $stock_state = 0;
+ protected $stock_state = 0;
/**
* Optional. The available quantity of the item.
*
* Generated from protobuf field int64 available_quantity = 6 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $available_quantity = 0;
+ protected $available_quantity = 0;
/**
* Optional. Canonical URL directly linking to the item detail page with a
* length limit of 5 KiB..
*
* Generated from protobuf field string canonical_product_uri = 7 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $canonical_product_uri = '';
+ protected $canonical_product_uri = '';
/**
* Optional. Product images for the catalog item.
*
diff --git a/RecommendationEngine/src/V1beta1/ProductCatalogItem/ExactPrice.php b/RecommendationEngine/src/V1beta1/ProductCatalogItem/ExactPrice.php
index 5e0d22caa461..bacda46b39c1 100644
--- a/RecommendationEngine/src/V1beta1/ProductCatalogItem/ExactPrice.php
+++ b/RecommendationEngine/src/V1beta1/ProductCatalogItem/ExactPrice.php
@@ -20,14 +20,14 @@ class ExactPrice extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field float display_price = 1 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $display_price = 0.0;
+ protected $display_price = 0.0;
/**
* Optional. Price of the product without any discount. If zero, by default
* set to be the 'displayPrice'.
*
* Generated from protobuf field float original_price = 2 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $original_price = 0.0;
+ protected $original_price = 0.0;
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/ProductCatalogItem/PriceRange.php b/RecommendationEngine/src/V1beta1/ProductCatalogItem/PriceRange.php
index 1b288d156cb3..45d8eae3ac87 100644
--- a/RecommendationEngine/src/V1beta1/ProductCatalogItem/PriceRange.php
+++ b/RecommendationEngine/src/V1beta1/ProductCatalogItem/PriceRange.php
@@ -21,13 +21,13 @@ class PriceRange extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field float min = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $min = 0.0;
+ protected $min = 0.0;
/**
* Required. The maximum product price.
*
* Generated from protobuf field float max = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $max = 0.0;
+ protected $max = 0.0;
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/ProductDetail.php b/RecommendationEngine/src/V1beta1/ProductDetail.php
index f0df7e856afd..4b3b83b30c85 100644
--- a/RecommendationEngine/src/V1beta1/ProductDetail.php
+++ b/RecommendationEngine/src/V1beta1/ProductDetail.php
@@ -21,35 +21,35 @@ class ProductDetail extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string id = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $id = '';
+ protected $id = '';
/**
* Optional. Currency code for price/costs. Use three-character ISO-4217
* code. Required only if originalPrice or displayPrice is set.
*
* Generated from protobuf field string currency_code = 2 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $currency_code = '';
+ protected $currency_code = '';
/**
* Optional. Original price of the product. If provided, this will override
* the original price in Catalog for this product.
*
* Generated from protobuf field float original_price = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $original_price = 0.0;
+ protected $original_price = 0.0;
/**
* Optional. Display price of the product (e.g. discounted price). If
* provided, this will override the display price in Catalog for this product.
*
* Generated from protobuf field float display_price = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $display_price = 0.0;
+ protected $display_price = 0.0;
/**
* Optional. Item stock state. If provided, this overrides the stock state
* in Catalog for items in this event.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState stock_state = 5 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $stock_state = 0;
+ protected $stock_state = 0;
/**
* Optional. Quantity of the product associated with the user event. For
* example, this field will be 2 if two products are added to the shopping
@@ -59,7 +59,7 @@ class ProductDetail extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int32 quantity = 6 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $quantity = 0;
+ protected $quantity = 0;
/**
* Optional. Quantity of the products in stock when a user event happens.
* Optional. If provided, this overrides the available quantity in Catalog for
@@ -70,13 +70,13 @@ class ProductDetail extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int32 available_quantity = 7 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $available_quantity = 0;
+ protected $available_quantity = 0;
/**
* Optional. Extra features associated with a product in the user event.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 8 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $item_attributes = null;
+ protected $item_attributes = null;
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/ProductEventDetail.php b/RecommendationEngine/src/V1beta1/ProductEventDetail.php
index 93022843a95c..d65f1cc9d8d6 100644
--- a/RecommendationEngine/src/V1beta1/ProductEventDetail.php
+++ b/RecommendationEngine/src/V1beta1/ProductEventDetail.php
@@ -22,7 +22,7 @@ class ProductEventDetail extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string search_query = 1;
*/
- private $search_query = '';
+ protected $search_query = '';
/**
* Required for `category-page-view` events. Other event types should not set
* this field.
@@ -64,7 +64,7 @@ class ProductEventDetail extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string list_id = 4;
*/
- private $list_id = '';
+ protected $list_id = '';
/**
* Optional. The id or name of the associated shopping cart. This id is used
* to associate multiple items added or present in the cart before purchase.
@@ -73,7 +73,7 @@ class ProductEventDetail extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string cart_id = 5 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $cart_id = '';
+ protected $cart_id = '';
/**
* Optional. A transaction represents the entire purchase transaction.
* Required for `purchase-complete` events. Optional for `checkout-start`
@@ -81,7 +81,7 @@ class ProductEventDetail extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.PurchaseTransaction purchase_transaction = 6 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $purchase_transaction = null;
+ protected $purchase_transaction = null;
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/PurchaseTransaction.php b/RecommendationEngine/src/V1beta1/PurchaseTransaction.php
index 3350bbb9adab..871a95215d5d 100644
--- a/RecommendationEngine/src/V1beta1/PurchaseTransaction.php
+++ b/RecommendationEngine/src/V1beta1/PurchaseTransaction.php
@@ -20,7 +20,7 @@ class PurchaseTransaction extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string id = 1 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $id = '';
+ protected $id = '';
/**
* Required. Total revenue or grand total associated with the transaction.
* This value include shipping, tax, or other adjustments to total revenue
@@ -29,7 +29,7 @@ class PurchaseTransaction extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field float revenue = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $revenue = 0.0;
+ protected $revenue = 0.0;
/**
* Optional. All the taxes associated with the transaction.
*
@@ -56,7 +56,7 @@ class PurchaseTransaction extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string currency_code = 6 [(.google.api.field_behavior) = REQUIRED];
*/
- private $currency_code = '';
+ protected $currency_code = '';
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/PurgeUserEventsMetadata.php b/RecommendationEngine/src/V1beta1/PurgeUserEventsMetadata.php
index dac98ee34c46..8dbccb355655 100644
--- a/RecommendationEngine/src/V1beta1/PurgeUserEventsMetadata.php
+++ b/RecommendationEngine/src/V1beta1/PurgeUserEventsMetadata.php
@@ -21,13 +21,13 @@ class PurgeUserEventsMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string operation_name = 1;
*/
- private $operation_name = '';
+ protected $operation_name = '';
/**
* Operation create time.
*
* Generated from protobuf field .google.protobuf.Timestamp create_time = 2;
*/
- private $create_time = null;
+ protected $create_time = null;
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/PurgeUserEventsRequest.php b/RecommendationEngine/src/V1beta1/PurgeUserEventsRequest.php
index 544385253229..46a4a5f8e8b0 100644
--- a/RecommendationEngine/src/V1beta1/PurgeUserEventsRequest.php
+++ b/RecommendationEngine/src/V1beta1/PurgeUserEventsRequest.php
@@ -22,7 +22,7 @@ class PurgeUserEventsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Required. The filter string to specify the events to be deleted. Empty
* string filter is not allowed. This filter can also be used with
@@ -45,7 +45,7 @@ class PurgeUserEventsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $filter = '';
+ protected $filter = '';
/**
* Optional. The default value is false. Override this flag to true to
* actually perform the purge. If the field is not set to true, a sampling of
@@ -53,7 +53,7 @@ class PurgeUserEventsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool force = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $force = false;
+ protected $force = false;
/**
* @param string $parent Required. The resource name of the event_store under which the events are
diff --git a/RecommendationEngine/src/V1beta1/PurgeUserEventsResponse.php b/RecommendationEngine/src/V1beta1/PurgeUserEventsResponse.php
index 8978d308df75..2ebd0d0f92e4 100644
--- a/RecommendationEngine/src/V1beta1/PurgeUserEventsResponse.php
+++ b/RecommendationEngine/src/V1beta1/PurgeUserEventsResponse.php
@@ -22,7 +22,7 @@ class PurgeUserEventsResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int64 purged_events_count = 1;
*/
- private $purged_events_count = 0;
+ protected $purged_events_count = 0;
/**
* A sampling of events deleted (or will be deleted) depending on the `force`
* property in the request. Max of 500 items will be returned.
diff --git a/RecommendationEngine/src/V1beta1/UpdateCatalogItemRequest.php b/RecommendationEngine/src/V1beta1/UpdateCatalogItemRequest.php
index e82360c0369f..67d1426dd8b5 100644
--- a/RecommendationEngine/src/V1beta1/UpdateCatalogItemRequest.php
+++ b/RecommendationEngine/src/V1beta1/UpdateCatalogItemRequest.php
@@ -21,21 +21,21 @@ class UpdateCatalogItemRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* Required. The catalog item to update/create. The 'catalog_item_id' field
* has to match that in the 'name'.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.CatalogItem catalog_item = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $catalog_item = null;
+ protected $catalog_item = null;
/**
* Optional. Indicates which fields in the provided 'item' to update. If not
* set, will by default update all fields.
*
* Generated from protobuf field .google.protobuf.FieldMask update_mask = 3;
*/
- private $update_mask = null;
+ protected $update_mask = null;
/**
* @param string $name Required. Full resource name of catalog item, such as
diff --git a/RecommendationEngine/src/V1beta1/UserEvent.php b/RecommendationEngine/src/V1beta1/UserEvent.php
index 19395906322a..1d27319722d5 100644
--- a/RecommendationEngine/src/V1beta1/UserEvent.php
+++ b/RecommendationEngine/src/V1beta1/UserEvent.php
@@ -37,20 +37,20 @@ class UserEvent extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string event_type = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $event_type = '';
+ protected $event_type = '';
/**
* Required. User information.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.UserInfo user_info = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $user_info = null;
+ protected $user_info = null;
/**
* Optional. User event detailed information common across different
* recommendation types.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.EventDetail event_detail = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $event_detail = null;
+ protected $event_detail = null;
/**
* Optional. Retail product specific user event metadata.
* This field is required for the following event types:
@@ -73,21 +73,21 @@ class UserEvent extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.ProductEventDetail product_event_detail = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $product_event_detail = null;
+ protected $product_event_detail = null;
/**
* Optional. Only required for ImportUserEvents method. Timestamp of user
* event created.
*
* Generated from protobuf field .google.protobuf.Timestamp event_time = 5 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $event_time = null;
+ protected $event_time = null;
/**
* Optional. This field should *not* be set when using JavaScript pixel
* or the Recommendations AI Tag. Defaults to `EVENT_SOURCE_UNSPECIFIED`.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.UserEvent.EventSource event_source = 6 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $event_source = 0;
+ protected $event_source = 0;
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/UserEventImportSummary.php b/RecommendationEngine/src/V1beta1/UserEventImportSummary.php
index 239ff238fa4a..5d66aa96e6e4 100644
--- a/RecommendationEngine/src/V1beta1/UserEventImportSummary.php
+++ b/RecommendationEngine/src/V1beta1/UserEventImportSummary.php
@@ -21,14 +21,14 @@ class UserEventImportSummary extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int64 joined_events_count = 1;
*/
- private $joined_events_count = 0;
+ protected $joined_events_count = 0;
/**
* Count of user events imported, but with catalog information not found
* in the imported catalog.
*
* Generated from protobuf field int64 unjoined_events_count = 2;
*/
- private $unjoined_events_count = 0;
+ protected $unjoined_events_count = 0;
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/UserEventServiceClient.php b/RecommendationEngine/src/V1beta1/UserEventServiceClient.php
deleted file mode 100644
index 3aac9cb5c133..000000000000
--- a/RecommendationEngine/src/V1beta1/UserEventServiceClient.php
+++ /dev/null
@@ -1,36 +0,0 @@
-_simpleRequest('/google.cloud.recommendationengine.v1beta1.UserEventService/WriteUserEvent',
- $argument,
- ['\Google\Cloud\RecommendationEngine\V1beta1\UserEvent', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Writes a single user event from the browser. This uses a GET request to
- * due to browser restriction of POST-ing to a 3rd party domain.
- *
- * This method is used only by the Recommendations AI JavaScript pixel.
- * Users should not call this method directly.
- * @param \Google\Cloud\RecommendationEngine\V1beta1\CollectUserEventRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function CollectUserEvent(\Google\Cloud\RecommendationEngine\V1beta1\CollectUserEventRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.cloud.recommendationengine.v1beta1.UserEventService/CollectUserEvent',
- $argument,
- ['\Google\Api\HttpBody', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Gets a list of user events within a time range, with potential filtering.
- * @param \Google\Cloud\RecommendationEngine\V1beta1\ListUserEventsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ListUserEvents(\Google\Cloud\RecommendationEngine\V1beta1\ListUserEventsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.cloud.recommendationengine.v1beta1.UserEventService/ListUserEvents',
- $argument,
- ['\Google\Cloud\RecommendationEngine\V1beta1\ListUserEventsResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Deletes permanently all user events specified by the filter provided.
- * Depending on the number of events specified by the filter, this operation
- * could take hours or days to complete. To test a filter, use the list
- * command first.
- * @param \Google\Cloud\RecommendationEngine\V1beta1\PurgeUserEventsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function PurgeUserEvents(\Google\Cloud\RecommendationEngine\V1beta1\PurgeUserEventsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.cloud.recommendationengine.v1beta1.UserEventService/PurgeUserEvents',
- $argument,
- ['\Google\LongRunning\Operation', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Bulk import of User events. Request processing might be
- * synchronous. Events that already exist are skipped.
- * Use this method for backfilling historical user events.
- *
- * Operation.response is of type ImportResponse. Note that it is
- * possible for a subset of the items to be successfully inserted.
- * Operation.metadata is of type ImportMetadata.
- * @param \Google\Cloud\RecommendationEngine\V1beta1\ImportUserEventsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ImportUserEvents(\Google\Cloud\RecommendationEngine\V1beta1\ImportUserEventsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.cloud.recommendationengine.v1beta1.UserEventService/ImportUserEvents',
- $argument,
- ['\Google\LongRunning\Operation', 'decode'],
- $metadata, $options);
- }
-
-}
diff --git a/RecommendationEngine/src/V1beta1/UserInfo.php b/RecommendationEngine/src/V1beta1/UserInfo.php
index 3d6858bd922f..caedbf80f655 100644
--- a/RecommendationEngine/src/V1beta1/UserInfo.php
+++ b/RecommendationEngine/src/V1beta1/UserInfo.php
@@ -25,14 +25,14 @@ class UserInfo extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string visitor_id = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $visitor_id = '';
+ protected $visitor_id = '';
/**
* Optional. Unique identifier for logged-in user with a length limit of 128
* bytes. Required only for logged-in users.
*
* Generated from protobuf field string user_id = 2 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $user_id = '';
+ protected $user_id = '';
/**
* Optional. IP address of the user. This could be either IPv4 (e.g. 104.133.9.80) or
* IPv6 (e.g. 2001:0db8:85a3:0000:0000:8a2e:0370:7334). This should *not* be
@@ -41,7 +41,7 @@ class UserInfo extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string ip_address = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $ip_address = '';
+ protected $ip_address = '';
/**
* Optional. User agent as included in the HTTP header. UTF-8 encoded string
* with a length limit of 1 KiB.
@@ -50,7 +50,7 @@ class UserInfo extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string user_agent = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $user_agent = '';
+ protected $user_agent = '';
/**
* Optional. Indicates if the request is made directly from the end user
* in which case the user_agent and ip_address fields can be populated
@@ -61,7 +61,7 @@ class UserInfo extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool direct_user_request = 5 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $direct_user_request = false;
+ protected $direct_user_request = false;
/**
* Constructor.
diff --git a/RecommendationEngine/src/V1beta1/WriteUserEventRequest.php b/RecommendationEngine/src/V1beta1/WriteUserEventRequest.php
index 59707d0853b3..0f7163b77d25 100644
--- a/RecommendationEngine/src/V1beta1/WriteUserEventRequest.php
+++ b/RecommendationEngine/src/V1beta1/WriteUserEventRequest.php
@@ -21,13 +21,13 @@ class WriteUserEventRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Required. User event to write.
*
* Generated from protobuf field .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $user_event = null;
+ protected $user_event = null;
/**
* @param string $parent Required. The parent eventStore resource name, such as
diff --git a/RecommendationEngine/tests/Unit/V1beta1/CatalogServiceClientTest.php b/RecommendationEngine/tests/Unit/V1beta1/CatalogServiceClientTest.php
deleted file mode 100644
index 9d4f0b7e0eed..000000000000
--- a/RecommendationEngine/tests/Unit/V1beta1/CatalogServiceClientTest.php
+++ /dev/null
@@ -1,551 +0,0 @@
-getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock();
- }
-
- /** @return CatalogServiceClient */
- private function createClient(array $options = [])
- {
- $options += [
- 'credentials' => $this->createCredentials(),
- ];
- return new CatalogServiceClient($options);
- }
-
- /** @test */
- public function createCatalogItemTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- // Mock response
- $id = 'id3355';
- $title = 'title110371416';
- $description = 'description-1724546052';
- $languageCode = 'languageCode-412800396';
- $itemGroupId = 'itemGroupId894431879';
- $expectedResponse = new CatalogItem();
- $expectedResponse->setId($id);
- $expectedResponse->setTitle($title);
- $expectedResponse->setDescription($description);
- $expectedResponse->setLanguageCode($languageCode);
- $expectedResponse->setItemGroupId($itemGroupId);
- $transport->addResponse($expectedResponse);
- // Mock request
- $formattedParent = $gapicClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
- $catalogItem = new CatalogItem();
- $catalogItemId = 'catalogItemId-1850269433';
- $catalogItem->setId($catalogItemId);
- $catalogItemCategoryHierarchies = [];
- $catalogItem->setCategoryHierarchies($catalogItemCategoryHierarchies);
- $catalogItemTitle = 'catalogItemTitle244020972';
- $catalogItem->setTitle($catalogItemTitle);
- $response = $gapicClient->createCatalogItem($formattedParent, $catalogItem);
- $this->assertEquals($expectedResponse, $response);
- $actualRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($actualRequests));
- $actualFuncCall = $actualRequests[0]->getFuncCall();
- $actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.CatalogService/CreateCatalogItem', $actualFuncCall);
- $actualValue = $actualRequestObject->getParent();
- $this->assertProtobufEquals($formattedParent, $actualValue);
- $actualValue = $actualRequestObject->getCatalogItem();
- $this->assertProtobufEquals($catalogItem, $actualValue);
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function createCatalogItemExceptionTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $transport->addResponse(null, $status);
- // Mock request
- $formattedParent = $gapicClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
- $catalogItem = new CatalogItem();
- $catalogItemId = 'catalogItemId-1850269433';
- $catalogItem->setId($catalogItemId);
- $catalogItemCategoryHierarchies = [];
- $catalogItem->setCategoryHierarchies($catalogItemCategoryHierarchies);
- $catalogItemTitle = 'catalogItemTitle244020972';
- $catalogItem->setTitle($catalogItemTitle);
- try {
- $gapicClient->createCatalogItem($formattedParent, $catalogItem);
- // If the $gapicClient method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stub is exhausted
- $transport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function deleteCatalogItemTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- // Mock response
- $expectedResponse = new GPBEmpty();
- $transport->addResponse($expectedResponse);
- // Mock request
- $formattedName = $gapicClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
- $gapicClient->deleteCatalogItem($formattedName);
- $actualRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($actualRequests));
- $actualFuncCall = $actualRequests[0]->getFuncCall();
- $actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.CatalogService/DeleteCatalogItem', $actualFuncCall);
- $actualValue = $actualRequestObject->getName();
- $this->assertProtobufEquals($formattedName, $actualValue);
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function deleteCatalogItemExceptionTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $transport->addResponse(null, $status);
- // Mock request
- $formattedName = $gapicClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
- try {
- $gapicClient->deleteCatalogItem($formattedName);
- // If the $gapicClient method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stub is exhausted
- $transport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function getCatalogItemTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- // Mock response
- $id = 'id3355';
- $title = 'title110371416';
- $description = 'description-1724546052';
- $languageCode = 'languageCode-412800396';
- $itemGroupId = 'itemGroupId894431879';
- $expectedResponse = new CatalogItem();
- $expectedResponse->setId($id);
- $expectedResponse->setTitle($title);
- $expectedResponse->setDescription($description);
- $expectedResponse->setLanguageCode($languageCode);
- $expectedResponse->setItemGroupId($itemGroupId);
- $transport->addResponse($expectedResponse);
- // Mock request
- $formattedName = $gapicClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
- $response = $gapicClient->getCatalogItem($formattedName);
- $this->assertEquals($expectedResponse, $response);
- $actualRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($actualRequests));
- $actualFuncCall = $actualRequests[0]->getFuncCall();
- $actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.CatalogService/GetCatalogItem', $actualFuncCall);
- $actualValue = $actualRequestObject->getName();
- $this->assertProtobufEquals($formattedName, $actualValue);
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function getCatalogItemExceptionTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $transport->addResponse(null, $status);
- // Mock request
- $formattedName = $gapicClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
- try {
- $gapicClient->getCatalogItem($formattedName);
- // If the $gapicClient method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stub is exhausted
- $transport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function importCatalogItemsTest()
- {
- $operationsTransport = $this->createTransport();
- $operationsClient = new OperationsClient([
- 'apiEndpoint' => '',
- 'transport' => $operationsTransport,
- 'credentials' => $this->createCredentials(),
- ]);
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- 'operationsClient' => $operationsClient,
- ]);
- $this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
- // Mock response
- $incompleteOperation = new Operation();
- $incompleteOperation->setName('operations/importCatalogItemsTest');
- $incompleteOperation->setDone(false);
- $transport->addResponse($incompleteOperation);
- $expectedResponse = new ImportCatalogItemsResponse();
- $anyResponse = new Any();
- $anyResponse->setValue($expectedResponse->serializeToString());
- $completeOperation = new Operation();
- $completeOperation->setName('operations/importCatalogItemsTest');
- $completeOperation->setDone(true);
- $completeOperation->setResponse($anyResponse);
- $operationsTransport->addResponse($completeOperation);
- // Mock request
- $formattedParent = $gapicClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
- $inputConfig = new InputConfig();
- $response = $gapicClient->importCatalogItems($formattedParent, $inputConfig);
- $this->assertFalse($response->isDone());
- $this->assertNull($response->getResult());
- $apiRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($apiRequests));
- $operationsRequestsEmpty = $operationsTransport->popReceivedCalls();
- $this->assertSame(0, count($operationsRequestsEmpty));
- $actualApiFuncCall = $apiRequests[0]->getFuncCall();
- $actualApiRequestObject = $apiRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.CatalogService/ImportCatalogItems', $actualApiFuncCall);
- $actualValue = $actualApiRequestObject->getParent();
- $this->assertProtobufEquals($formattedParent, $actualValue);
- $actualValue = $actualApiRequestObject->getInputConfig();
- $this->assertProtobufEquals($inputConfig, $actualValue);
- $expectedOperationsRequestObject = new GetOperationRequest();
- $expectedOperationsRequestObject->setName('operations/importCatalogItemsTest');
- $response->pollUntilComplete([
- 'initialPollDelayMillis' => 1,
- ]);
- $this->assertTrue($response->isDone());
- $this->assertEquals($expectedResponse, $response->getResult());
- $apiRequestsEmpty = $transport->popReceivedCalls();
- $this->assertSame(0, count($apiRequestsEmpty));
- $operationsRequests = $operationsTransport->popReceivedCalls();
- $this->assertSame(1, count($operationsRequests));
- $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall();
- $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject();
- $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall);
- $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject);
- $this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
- }
-
- /** @test */
- public function importCatalogItemsExceptionTest()
- {
- $operationsTransport = $this->createTransport();
- $operationsClient = new OperationsClient([
- 'apiEndpoint' => '',
- 'transport' => $operationsTransport,
- 'credentials' => $this->createCredentials(),
- ]);
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- 'operationsClient' => $operationsClient,
- ]);
- $this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
- // Mock response
- $incompleteOperation = new Operation();
- $incompleteOperation->setName('operations/importCatalogItemsTest');
- $incompleteOperation->setDone(false);
- $transport->addResponse($incompleteOperation);
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $operationsTransport->addResponse(null, $status);
- // Mock request
- $formattedParent = $gapicClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
- $inputConfig = new InputConfig();
- $response = $gapicClient->importCatalogItems($formattedParent, $inputConfig);
- $this->assertFalse($response->isDone());
- $this->assertNull($response->getResult());
- $expectedOperationsRequestObject = new GetOperationRequest();
- $expectedOperationsRequestObject->setName('operations/importCatalogItemsTest');
- try {
- $response->pollUntilComplete([
- 'initialPollDelayMillis' => 1,
- ]);
- // If the pollUntilComplete() method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stubs are exhausted
- $transport->popReceivedCalls();
- $operationsTransport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
- }
-
- /** @test */
- public function listCatalogItemsTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- // Mock response
- $nextPageToken = '';
- $catalogItemsElement = new CatalogItem();
- $catalogItems = [
- $catalogItemsElement,
- ];
- $expectedResponse = new ListCatalogItemsResponse();
- $expectedResponse->setNextPageToken($nextPageToken);
- $expectedResponse->setCatalogItems($catalogItems);
- $transport->addResponse($expectedResponse);
- // Mock request
- $formattedParent = $gapicClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
- $response = $gapicClient->listCatalogItems($formattedParent);
- $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
- $resources = iterator_to_array($response->iterateAllElements());
- $this->assertSame(1, count($resources));
- $this->assertEquals($expectedResponse->getCatalogItems()[0], $resources[0]);
- $actualRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($actualRequests));
- $actualFuncCall = $actualRequests[0]->getFuncCall();
- $actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.CatalogService/ListCatalogItems', $actualFuncCall);
- $actualValue = $actualRequestObject->getParent();
- $this->assertProtobufEquals($formattedParent, $actualValue);
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function listCatalogItemsExceptionTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $transport->addResponse(null, $status);
- // Mock request
- $formattedParent = $gapicClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
- try {
- $gapicClient->listCatalogItems($formattedParent);
- // If the $gapicClient method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stub is exhausted
- $transport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function updateCatalogItemTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- // Mock response
- $id = 'id3355';
- $title = 'title110371416';
- $description = 'description-1724546052';
- $languageCode = 'languageCode-412800396';
- $itemGroupId = 'itemGroupId894431879';
- $expectedResponse = new CatalogItem();
- $expectedResponse->setId($id);
- $expectedResponse->setTitle($title);
- $expectedResponse->setDescription($description);
- $expectedResponse->setLanguageCode($languageCode);
- $expectedResponse->setItemGroupId($itemGroupId);
- $transport->addResponse($expectedResponse);
- // Mock request
- $formattedName = $gapicClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
- $catalogItem = new CatalogItem();
- $catalogItemId = 'catalogItemId-1850269433';
- $catalogItem->setId($catalogItemId);
- $catalogItemCategoryHierarchies = [];
- $catalogItem->setCategoryHierarchies($catalogItemCategoryHierarchies);
- $catalogItemTitle = 'catalogItemTitle244020972';
- $catalogItem->setTitle($catalogItemTitle);
- $response = $gapicClient->updateCatalogItem($formattedName, $catalogItem);
- $this->assertEquals($expectedResponse, $response);
- $actualRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($actualRequests));
- $actualFuncCall = $actualRequests[0]->getFuncCall();
- $actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.CatalogService/UpdateCatalogItem', $actualFuncCall);
- $actualValue = $actualRequestObject->getName();
- $this->assertProtobufEquals($formattedName, $actualValue);
- $actualValue = $actualRequestObject->getCatalogItem();
- $this->assertProtobufEquals($catalogItem, $actualValue);
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function updateCatalogItemExceptionTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $transport->addResponse(null, $status);
- // Mock request
- $formattedName = $gapicClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
- $catalogItem = new CatalogItem();
- $catalogItemId = 'catalogItemId-1850269433';
- $catalogItem->setId($catalogItemId);
- $catalogItemCategoryHierarchies = [];
- $catalogItem->setCategoryHierarchies($catalogItemCategoryHierarchies);
- $catalogItemTitle = 'catalogItemTitle244020972';
- $catalogItem->setTitle($catalogItemTitle);
- try {
- $gapicClient->updateCatalogItem($formattedName, $catalogItem);
- // If the $gapicClient method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stub is exhausted
- $transport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- }
-}
diff --git a/RecommendationEngine/tests/Unit/V1beta1/Client/CatalogServiceClientTest.php b/RecommendationEngine/tests/Unit/V1beta1/Client/CatalogServiceClientTest.php
index 8b08c930b337..3b4993e7e9ef 100644
--- a/RecommendationEngine/tests/Unit/V1beta1/Client/CatalogServiceClientTest.php
+++ b/RecommendationEngine/tests/Unit/V1beta1/Client/CatalogServiceClientTest.php
@@ -1,6 +1,6 @@
getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock();
+ return $this->getMockBuilder(CredentialsWrapper::class)
+ ->disableOriginalConstructor()
+ ->getMock();
}
/** @return CatalogServiceClient */
@@ -103,16 +105,17 @@ public function createCatalogItemTest()
$catalogItem->setCategoryHierarchies($catalogItemCategoryHierarchies);
$catalogItemTitle = 'catalogItemTitle244020972';
$catalogItem->setTitle($catalogItemTitle);
- $request = (new CreateCatalogItemRequest())
- ->setParent($formattedParent)
- ->setCatalogItem($catalogItem);
+ $request = (new CreateCatalogItemRequest())->setParent($formattedParent)->setCatalogItem($catalogItem);
$response = $gapicClient->createCatalogItem($request);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.CatalogService/CreateCatalogItem', $actualFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.CatalogService/CreateCatalogItem',
+ $actualFuncCall
+ );
$actualValue = $actualRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$actualValue = $actualRequestObject->getCatalogItem();
@@ -131,12 +134,15 @@ public function createCatalogItemExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$transport->addResponse(null, $status);
// Mock request
$formattedParent = $gapicClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
@@ -147,9 +153,7 @@ public function createCatalogItemExceptionTest()
$catalogItem->setCategoryHierarchies($catalogItemCategoryHierarchies);
$catalogItemTitle = 'catalogItemTitle244020972';
$catalogItem->setTitle($catalogItemTitle);
- $request = (new CreateCatalogItemRequest())
- ->setParent($formattedParent)
- ->setCatalogItem($catalogItem);
+ $request = (new CreateCatalogItemRequest())->setParent($formattedParent)->setCatalogItem($catalogItem);
try {
$gapicClient->createCatalogItem($request);
// If the $gapicClient method call did not throw, fail the test
@@ -175,15 +179,22 @@ public function deleteCatalogItemTest()
$expectedResponse = new GPBEmpty();
$transport->addResponse($expectedResponse);
// Mock request
- $formattedName = $gapicClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
- $request = (new DeleteCatalogItemRequest())
- ->setName($formattedName);
+ $formattedName = $gapicClient->catalogItemPathName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[CATALOG]',
+ '[CATALOG_ITEM_PATH]'
+ );
+ $request = (new DeleteCatalogItemRequest())->setName($formattedName);
$gapicClient->deleteCatalogItem($request);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.CatalogService/DeleteCatalogItem', $actualFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.CatalogService/DeleteCatalogItem',
+ $actualFuncCall
+ );
$actualValue = $actualRequestObject->getName();
$this->assertProtobufEquals($formattedName, $actualValue);
$this->assertTrue($transport->isExhausted());
@@ -200,17 +211,24 @@ public function deleteCatalogItemExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$transport->addResponse(null, $status);
// Mock request
- $formattedName = $gapicClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
- $request = (new DeleteCatalogItemRequest())
- ->setName($formattedName);
+ $formattedName = $gapicClient->catalogItemPathName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[CATALOG]',
+ '[CATALOG_ITEM_PATH]'
+ );
+ $request = (new DeleteCatalogItemRequest())->setName($formattedName);
try {
$gapicClient->deleteCatalogItem($request);
// If the $gapicClient method call did not throw, fail the test
@@ -246,9 +264,13 @@ public function getCatalogItemTest()
$expectedResponse->setItemGroupId($itemGroupId);
$transport->addResponse($expectedResponse);
// Mock request
- $formattedName = $gapicClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
- $request = (new GetCatalogItemRequest())
- ->setName($formattedName);
+ $formattedName = $gapicClient->catalogItemPathName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[CATALOG]',
+ '[CATALOG_ITEM_PATH]'
+ );
+ $request = (new GetCatalogItemRequest())->setName($formattedName);
$response = $gapicClient->getCatalogItem($request);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
@@ -272,17 +294,24 @@ public function getCatalogItemExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$transport->addResponse(null, $status);
// Mock request
- $formattedName = $gapicClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
- $request = (new GetCatalogItemRequest())
- ->setName($formattedName);
+ $formattedName = $gapicClient->catalogItemPathName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[CATALOG]',
+ '[CATALOG_ITEM_PATH]'
+ );
+ $request = (new GetCatalogItemRequest())->setName($formattedName);
try {
$gapicClient->getCatalogItem($request);
// If the $gapicClient method call did not throw, fail the test
@@ -328,9 +357,7 @@ public function importCatalogItemsTest()
// Mock request
$formattedParent = $gapicClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
$inputConfig = new InputConfig();
- $request = (new ImportCatalogItemsRequest())
- ->setParent($formattedParent)
- ->setInputConfig($inputConfig);
+ $request = (new ImportCatalogItemsRequest())->setParent($formattedParent)->setInputConfig($inputConfig);
$response = $gapicClient->importCatalogItems($request);
$this->assertFalse($response->isDone());
$this->assertNull($response->getResult());
@@ -340,7 +367,10 @@ public function importCatalogItemsTest()
$this->assertSame(0, count($operationsRequestsEmpty));
$actualApiFuncCall = $apiRequests[0]->getFuncCall();
$actualApiRequestObject = $apiRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.CatalogService/ImportCatalogItems', $actualApiFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.CatalogService/ImportCatalogItems',
+ $actualApiFuncCall
+ );
$actualValue = $actualApiRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$actualValue = $actualApiRequestObject->getInputConfig();
@@ -388,19 +418,20 @@ public function importCatalogItemsExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$operationsTransport->addResponse(null, $status);
// Mock request
$formattedParent = $gapicClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
$inputConfig = new InputConfig();
- $request = (new ImportCatalogItemsRequest())
- ->setParent($formattedParent)
- ->setInputConfig($inputConfig);
+ $request = (new ImportCatalogItemsRequest())->setParent($formattedParent)->setInputConfig($inputConfig);
$response = $gapicClient->importCatalogItems($request);
$this->assertFalse($response->isDone());
$this->assertNull($response->getResult());
@@ -434,17 +465,14 @@ public function listCatalogItemsTest()
// Mock response
$nextPageToken = '';
$catalogItemsElement = new CatalogItem();
- $catalogItems = [
- $catalogItemsElement,
- ];
+ $catalogItems = [$catalogItemsElement];
$expectedResponse = new ListCatalogItemsResponse();
$expectedResponse->setNextPageToken($nextPageToken);
$expectedResponse->setCatalogItems($catalogItems);
$transport->addResponse($expectedResponse);
// Mock request
$formattedParent = $gapicClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
- $request = (new ListCatalogItemsRequest())
- ->setParent($formattedParent);
+ $request = (new ListCatalogItemsRequest())->setParent($formattedParent);
$response = $gapicClient->listCatalogItems($request);
$this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
$resources = iterator_to_array($response->iterateAllElements());
@@ -454,7 +482,10 @@ public function listCatalogItemsTest()
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.CatalogService/ListCatalogItems', $actualFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.CatalogService/ListCatalogItems',
+ $actualFuncCall
+ );
$actualValue = $actualRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$this->assertTrue($transport->isExhausted());
@@ -471,17 +502,19 @@ public function listCatalogItemsExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$transport->addResponse(null, $status);
// Mock request
$formattedParent = $gapicClient->catalogName('[PROJECT]', '[LOCATION]', '[CATALOG]');
- $request = (new ListCatalogItemsRequest())
- ->setParent($formattedParent);
+ $request = (new ListCatalogItemsRequest())->setParent($formattedParent);
try {
$gapicClient->listCatalogItems($request);
// If the $gapicClient method call did not throw, fail the test
@@ -517,7 +550,12 @@ public function updateCatalogItemTest()
$expectedResponse->setItemGroupId($itemGroupId);
$transport->addResponse($expectedResponse);
// Mock request
- $formattedName = $gapicClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
+ $formattedName = $gapicClient->catalogItemPathName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[CATALOG]',
+ '[CATALOG_ITEM_PATH]'
+ );
$catalogItem = new CatalogItem();
$catalogItemId = 'catalogItemId-1850269433';
$catalogItem->setId($catalogItemId);
@@ -525,16 +563,17 @@ public function updateCatalogItemTest()
$catalogItem->setCategoryHierarchies($catalogItemCategoryHierarchies);
$catalogItemTitle = 'catalogItemTitle244020972';
$catalogItem->setTitle($catalogItemTitle);
- $request = (new UpdateCatalogItemRequest())
- ->setName($formattedName)
- ->setCatalogItem($catalogItem);
+ $request = (new UpdateCatalogItemRequest())->setName($formattedName)->setCatalogItem($catalogItem);
$response = $gapicClient->updateCatalogItem($request);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.CatalogService/UpdateCatalogItem', $actualFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.CatalogService/UpdateCatalogItem',
+ $actualFuncCall
+ );
$actualValue = $actualRequestObject->getName();
$this->assertProtobufEquals($formattedName, $actualValue);
$actualValue = $actualRequestObject->getCatalogItem();
@@ -553,15 +592,23 @@ public function updateCatalogItemExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$transport->addResponse(null, $status);
// Mock request
- $formattedName = $gapicClient->catalogItemPathName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[CATALOG_ITEM_PATH]');
+ $formattedName = $gapicClient->catalogItemPathName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[CATALOG]',
+ '[CATALOG_ITEM_PATH]'
+ );
$catalogItem = new CatalogItem();
$catalogItemId = 'catalogItemId-1850269433';
$catalogItem->setId($catalogItemId);
@@ -569,9 +616,7 @@ public function updateCatalogItemExceptionTest()
$catalogItem->setCategoryHierarchies($catalogItemCategoryHierarchies);
$catalogItemTitle = 'catalogItemTitle244020972';
$catalogItem->setTitle($catalogItemTitle);
- $request = (new UpdateCatalogItemRequest())
- ->setName($formattedName)
- ->setCatalogItem($catalogItem);
+ $request = (new UpdateCatalogItemRequest())->setName($formattedName)->setCatalogItem($catalogItem);
try {
$gapicClient->updateCatalogItem($request);
// If the $gapicClient method call did not throw, fail the test
@@ -615,16 +660,17 @@ public function createCatalogItemAsyncTest()
$catalogItem->setCategoryHierarchies($catalogItemCategoryHierarchies);
$catalogItemTitle = 'catalogItemTitle244020972';
$catalogItem->setTitle($catalogItemTitle);
- $request = (new CreateCatalogItemRequest())
- ->setParent($formattedParent)
- ->setCatalogItem($catalogItem);
+ $request = (new CreateCatalogItemRequest())->setParent($formattedParent)->setCatalogItem($catalogItem);
$response = $gapicClient->createCatalogItemAsync($request)->wait();
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.CatalogService/CreateCatalogItem', $actualFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.CatalogService/CreateCatalogItem',
+ $actualFuncCall
+ );
$actualValue = $actualRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$actualValue = $actualRequestObject->getCatalogItem();
diff --git a/RecommendationEngine/tests/Unit/V1beta1/Client/PredictionApiKeyRegistryClientTest.php b/RecommendationEngine/tests/Unit/V1beta1/Client/PredictionApiKeyRegistryClientTest.php
index 9a37a160408b..ca662dbee0c8 100644
--- a/RecommendationEngine/tests/Unit/V1beta1/Client/PredictionApiKeyRegistryClientTest.php
+++ b/RecommendationEngine/tests/Unit/V1beta1/Client/PredictionApiKeyRegistryClientTest.php
@@ -1,6 +1,6 @@
getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock();
+ return $this->getMockBuilder(CredentialsWrapper::class)
+ ->disableOriginalConstructor()
+ ->getMock();
}
/** @return PredictionApiKeyRegistryClient */
@@ -89,7 +91,10 @@ public function createPredictionApiKeyRegistrationTest()
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/CreatePredictionApiKeyRegistration', $actualFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/CreatePredictionApiKeyRegistration',
+ $actualFuncCall
+ );
$actualValue = $actualRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$actualValue = $actualRequestObject->getPredictionApiKeyRegistration();
@@ -108,12 +113,15 @@ public function createPredictionApiKeyRegistrationExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$transport->addResponse(null, $status);
// Mock request
$formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
@@ -146,15 +154,23 @@ public function deletePredictionApiKeyRegistrationTest()
$expectedResponse = new GPBEmpty();
$transport->addResponse($expectedResponse);
// Mock request
- $formattedName = $gapicClient->predictionApiKeyRegistrationName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]', '[PREDICTION_API_KEY_REGISTRATION]');
- $request = (new DeletePredictionApiKeyRegistrationRequest())
- ->setName($formattedName);
+ $formattedName = $gapicClient->predictionApiKeyRegistrationName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[CATALOG]',
+ '[EVENT_STORE]',
+ '[PREDICTION_API_KEY_REGISTRATION]'
+ );
+ $request = (new DeletePredictionApiKeyRegistrationRequest())->setName($formattedName);
$gapicClient->deletePredictionApiKeyRegistration($request);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/DeletePredictionApiKeyRegistration', $actualFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/DeletePredictionApiKeyRegistration',
+ $actualFuncCall
+ );
$actualValue = $actualRequestObject->getName();
$this->assertProtobufEquals($formattedName, $actualValue);
$this->assertTrue($transport->isExhausted());
@@ -171,17 +187,25 @@ public function deletePredictionApiKeyRegistrationExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$transport->addResponse(null, $status);
// Mock request
- $formattedName = $gapicClient->predictionApiKeyRegistrationName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]', '[PREDICTION_API_KEY_REGISTRATION]');
- $request = (new DeletePredictionApiKeyRegistrationRequest())
- ->setName($formattedName);
+ $formattedName = $gapicClient->predictionApiKeyRegistrationName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[CATALOG]',
+ '[EVENT_STORE]',
+ '[PREDICTION_API_KEY_REGISTRATION]'
+ );
+ $request = (new DeletePredictionApiKeyRegistrationRequest())->setName($formattedName);
try {
$gapicClient->deletePredictionApiKeyRegistration($request);
// If the $gapicClient method call did not throw, fail the test
@@ -206,17 +230,14 @@ public function listPredictionApiKeyRegistrationsTest()
// Mock response
$nextPageToken = '';
$predictionApiKeyRegistrationsElement = new PredictionApiKeyRegistration();
- $predictionApiKeyRegistrations = [
- $predictionApiKeyRegistrationsElement,
- ];
+ $predictionApiKeyRegistrations = [$predictionApiKeyRegistrationsElement];
$expectedResponse = new ListPredictionApiKeyRegistrationsResponse();
$expectedResponse->setNextPageToken($nextPageToken);
$expectedResponse->setPredictionApiKeyRegistrations($predictionApiKeyRegistrations);
$transport->addResponse($expectedResponse);
// Mock request
$formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $request = (new ListPredictionApiKeyRegistrationsRequest())
- ->setParent($formattedParent);
+ $request = (new ListPredictionApiKeyRegistrationsRequest())->setParent($formattedParent);
$response = $gapicClient->listPredictionApiKeyRegistrations($request);
$this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
$resources = iterator_to_array($response->iterateAllElements());
@@ -226,7 +247,10 @@ public function listPredictionApiKeyRegistrationsTest()
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/ListPredictionApiKeyRegistrations', $actualFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/ListPredictionApiKeyRegistrations',
+ $actualFuncCall
+ );
$actualValue = $actualRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$this->assertTrue($transport->isExhausted());
@@ -243,17 +267,19 @@ public function listPredictionApiKeyRegistrationsExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$transport->addResponse(null, $status);
// Mock request
$formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $request = (new ListPredictionApiKeyRegistrationsRequest())
- ->setParent($formattedParent);
+ $request = (new ListPredictionApiKeyRegistrationsRequest())->setParent($formattedParent);
try {
$gapicClient->listPredictionApiKeyRegistrations($request);
// If the $gapicClient method call did not throw, fail the test
@@ -292,7 +318,10 @@ public function createPredictionApiKeyRegistrationAsyncTest()
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/CreatePredictionApiKeyRegistration', $actualFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/CreatePredictionApiKeyRegistration',
+ $actualFuncCall
+ );
$actualValue = $actualRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$actualValue = $actualRequestObject->getPredictionApiKeyRegistration();
diff --git a/RecommendationEngine/tests/Unit/V1beta1/Client/PredictionServiceClientTest.php b/RecommendationEngine/tests/Unit/V1beta1/Client/PredictionServiceClientTest.php
index 74db58507a65..0e8b11c5544f 100644
--- a/RecommendationEngine/tests/Unit/V1beta1/Client/PredictionServiceClientTest.php
+++ b/RecommendationEngine/tests/Unit/V1beta1/Client/PredictionServiceClientTest.php
@@ -1,6 +1,6 @@
getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock();
+ return $this->getMockBuilder(CredentialsWrapper::class)
+ ->disableOriginalConstructor()
+ ->getMock();
}
/** @return PredictionServiceClient */
@@ -76,9 +78,7 @@ public function predictTest()
$dryRun2 = true;
$nextPageToken = '';
$resultsElement = new PredictionResult();
- $results = [
- $resultsElement,
- ];
+ $results = [$resultsElement];
$expectedResponse = new PredictResponse();
$expectedResponse->setRecommendationToken($recommendationToken);
$expectedResponse->setDryRun($dryRun2);
@@ -86,7 +86,13 @@ public function predictTest()
$expectedResponse->setResults($results);
$transport->addResponse($expectedResponse);
// Mock request
- $formattedName = $gapicClient->placementName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]', '[PLACEMENT]');
+ $formattedName = $gapicClient->placementName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[CATALOG]',
+ '[EVENT_STORE]',
+ '[PLACEMENT]'
+ );
$userEvent = new UserEvent();
$userEventEventType = 'userEventEventType341658661';
$userEvent->setEventType($userEventEventType);
@@ -94,9 +100,7 @@ public function predictTest()
$userInfoVisitorId = 'userInfoVisitorId-1297088752';
$userEventUserInfo->setVisitorId($userInfoVisitorId);
$userEvent->setUserInfo($userEventUserInfo);
- $request = (new PredictRequest())
- ->setName($formattedName)
- ->setUserEvent($userEvent);
+ $request = (new PredictRequest())->setName($formattedName)->setUserEvent($userEvent);
$response = $gapicClient->predict($request);
$this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
$resources = iterator_to_array($response->iterateAllElements());
@@ -125,15 +129,24 @@ public function predictExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$transport->addResponse(null, $status);
// Mock request
- $formattedName = $gapicClient->placementName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]', '[PLACEMENT]');
+ $formattedName = $gapicClient->placementName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[CATALOG]',
+ '[EVENT_STORE]',
+ '[PLACEMENT]'
+ );
$userEvent = new UserEvent();
$userEventEventType = 'userEventEventType341658661';
$userEvent->setEventType($userEventEventType);
@@ -141,9 +154,7 @@ public function predictExceptionTest()
$userInfoVisitorId = 'userInfoVisitorId-1297088752';
$userEventUserInfo->setVisitorId($userInfoVisitorId);
$userEvent->setUserInfo($userEventUserInfo);
- $request = (new PredictRequest())
- ->setName($formattedName)
- ->setUserEvent($userEvent);
+ $request = (new PredictRequest())->setName($formattedName)->setUserEvent($userEvent);
try {
$gapicClient->predict($request);
// If the $gapicClient method call did not throw, fail the test
@@ -170,9 +181,7 @@ public function predictAsyncTest()
$dryRun2 = true;
$nextPageToken = '';
$resultsElement = new PredictionResult();
- $results = [
- $resultsElement,
- ];
+ $results = [$resultsElement];
$expectedResponse = new PredictResponse();
$expectedResponse->setRecommendationToken($recommendationToken);
$expectedResponse->setDryRun($dryRun2);
@@ -180,7 +189,13 @@ public function predictAsyncTest()
$expectedResponse->setResults($results);
$transport->addResponse($expectedResponse);
// Mock request
- $formattedName = $gapicClient->placementName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]', '[PLACEMENT]');
+ $formattedName = $gapicClient->placementName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[CATALOG]',
+ '[EVENT_STORE]',
+ '[PLACEMENT]'
+ );
$userEvent = new UserEvent();
$userEventEventType = 'userEventEventType341658661';
$userEvent->setEventType($userEventEventType);
@@ -188,9 +203,7 @@ public function predictAsyncTest()
$userInfoVisitorId = 'userInfoVisitorId-1297088752';
$userEventUserInfo->setVisitorId($userInfoVisitorId);
$userEvent->setUserInfo($userEventUserInfo);
- $request = (new PredictRequest())
- ->setName($formattedName)
- ->setUserEvent($userEvent);
+ $request = (new PredictRequest())->setName($formattedName)->setUserEvent($userEvent);
$response = $gapicClient->predictAsync($request)->wait();
$this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
$resources = iterator_to_array($response->iterateAllElements());
diff --git a/RecommendationEngine/tests/Unit/V1beta1/Client/UserEventServiceClientTest.php b/RecommendationEngine/tests/Unit/V1beta1/Client/UserEventServiceClientTest.php
index 72f0907876f5..1480936e062c 100644
--- a/RecommendationEngine/tests/Unit/V1beta1/Client/UserEventServiceClientTest.php
+++ b/RecommendationEngine/tests/Unit/V1beta1/Client/UserEventServiceClientTest.php
@@ -1,6 +1,6 @@
getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock();
+ return $this->getMockBuilder(CredentialsWrapper::class)
+ ->disableOriginalConstructor()
+ ->getMock();
}
/** @return UserEventServiceClient */
@@ -92,16 +94,17 @@ public function collectUserEventTest()
// Mock request
$formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
$userEvent = 'userEvent1921940774';
- $request = (new CollectUserEventRequest())
- ->setParent($formattedParent)
- ->setUserEvent($userEvent);
+ $request = (new CollectUserEventRequest())->setParent($formattedParent)->setUserEvent($userEvent);
$response = $gapicClient->collectUserEvent($request);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.UserEventService/CollectUserEvent', $actualFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.UserEventService/CollectUserEvent',
+ $actualFuncCall
+ );
$actualValue = $actualRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$actualValue = $actualRequestObject->getUserEvent();
@@ -120,19 +123,20 @@ public function collectUserEventExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$transport->addResponse(null, $status);
// Mock request
$formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
$userEvent = 'userEvent1921940774';
- $request = (new CollectUserEventRequest())
- ->setParent($formattedParent)
- ->setUserEvent($userEvent);
+ $request = (new CollectUserEventRequest())->setParent($formattedParent)->setUserEvent($userEvent);
try {
$gapicClient->collectUserEvent($request);
// If the $gapicClient method call did not throw, fail the test
@@ -178,9 +182,7 @@ public function importUserEventsTest()
// Mock request
$formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
$inputConfig = new InputConfig();
- $request = (new ImportUserEventsRequest())
- ->setParent($formattedParent)
- ->setInputConfig($inputConfig);
+ $request = (new ImportUserEventsRequest())->setParent($formattedParent)->setInputConfig($inputConfig);
$response = $gapicClient->importUserEvents($request);
$this->assertFalse($response->isDone());
$this->assertNull($response->getResult());
@@ -190,7 +192,10 @@ public function importUserEventsTest()
$this->assertSame(0, count($operationsRequestsEmpty));
$actualApiFuncCall = $apiRequests[0]->getFuncCall();
$actualApiRequestObject = $apiRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.UserEventService/ImportUserEvents', $actualApiFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.UserEventService/ImportUserEvents',
+ $actualApiFuncCall
+ );
$actualValue = $actualApiRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$actualValue = $actualApiRequestObject->getInputConfig();
@@ -238,19 +243,20 @@ public function importUserEventsExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$operationsTransport->addResponse(null, $status);
// Mock request
$formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
$inputConfig = new InputConfig();
- $request = (new ImportUserEventsRequest())
- ->setParent($formattedParent)
- ->setInputConfig($inputConfig);
+ $request = (new ImportUserEventsRequest())->setParent($formattedParent)->setInputConfig($inputConfig);
$response = $gapicClient->importUserEvents($request);
$this->assertFalse($response->isDone());
$this->assertNull($response->getResult());
@@ -284,17 +290,14 @@ public function listUserEventsTest()
// Mock response
$nextPageToken = '';
$userEventsElement = new UserEvent();
- $userEvents = [
- $userEventsElement,
- ];
+ $userEvents = [$userEventsElement];
$expectedResponse = new ListUserEventsResponse();
$expectedResponse->setNextPageToken($nextPageToken);
$expectedResponse->setUserEvents($userEvents);
$transport->addResponse($expectedResponse);
// Mock request
$formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $request = (new ListUserEventsRequest())
- ->setParent($formattedParent);
+ $request = (new ListUserEventsRequest())->setParent($formattedParent);
$response = $gapicClient->listUserEvents($request);
$this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
$resources = iterator_to_array($response->iterateAllElements());
@@ -304,7 +307,10 @@ public function listUserEventsTest()
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.UserEventService/ListUserEvents', $actualFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.UserEventService/ListUserEvents',
+ $actualFuncCall
+ );
$actualValue = $actualRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$this->assertTrue($transport->isExhausted());
@@ -321,17 +327,19 @@ public function listUserEventsExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$transport->addResponse(null, $status);
// Mock request
$formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $request = (new ListUserEventsRequest())
- ->setParent($formattedParent);
+ $request = (new ListUserEventsRequest())->setParent($formattedParent);
try {
$gapicClient->listUserEvents($request);
// If the $gapicClient method call did not throw, fail the test
@@ -379,9 +387,7 @@ public function purgeUserEventsTest()
// Mock request
$formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
$filter = 'filter-1274492040';
- $request = (new PurgeUserEventsRequest())
- ->setParent($formattedParent)
- ->setFilter($filter);
+ $request = (new PurgeUserEventsRequest())->setParent($formattedParent)->setFilter($filter);
$response = $gapicClient->purgeUserEvents($request);
$this->assertFalse($response->isDone());
$this->assertNull($response->getResult());
@@ -391,7 +397,10 @@ public function purgeUserEventsTest()
$this->assertSame(0, count($operationsRequestsEmpty));
$actualApiFuncCall = $apiRequests[0]->getFuncCall();
$actualApiRequestObject = $apiRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.UserEventService/PurgeUserEvents', $actualApiFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.UserEventService/PurgeUserEvents',
+ $actualApiFuncCall
+ );
$actualValue = $actualApiRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$actualValue = $actualApiRequestObject->getFilter();
@@ -439,19 +448,20 @@ public function purgeUserEventsExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$operationsTransport->addResponse(null, $status);
// Mock request
$formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
$filter = 'filter-1274492040';
- $request = (new PurgeUserEventsRequest())
- ->setParent($formattedParent)
- ->setFilter($filter);
+ $request = (new PurgeUserEventsRequest())->setParent($formattedParent)->setFilter($filter);
$response = $gapicClient->purgeUserEvents($request);
$this->assertFalse($response->isDone());
$this->assertNull($response->getResult());
@@ -496,16 +506,17 @@ public function writeUserEventTest()
$userInfoVisitorId = 'userInfoVisitorId-1297088752';
$userEventUserInfo->setVisitorId($userInfoVisitorId);
$userEvent->setUserInfo($userEventUserInfo);
- $request = (new WriteUserEventRequest())
- ->setParent($formattedParent)
- ->setUserEvent($userEvent);
+ $request = (new WriteUserEventRequest())->setParent($formattedParent)->setUserEvent($userEvent);
$response = $gapicClient->writeUserEvent($request);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.UserEventService/WriteUserEvent', $actualFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.UserEventService/WriteUserEvent',
+ $actualFuncCall
+ );
$actualValue = $actualRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$actualValue = $actualRequestObject->getUserEvent();
@@ -524,12 +535,15 @@ public function writeUserEventExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
$transport->addResponse(null, $status);
// Mock request
$formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
@@ -540,9 +554,7 @@ public function writeUserEventExceptionTest()
$userInfoVisitorId = 'userInfoVisitorId-1297088752';
$userEventUserInfo->setVisitorId($userInfoVisitorId);
$userEvent->setUserInfo($userEventUserInfo);
- $request = (new WriteUserEventRequest())
- ->setParent($formattedParent)
- ->setUserEvent($userEvent);
+ $request = (new WriteUserEventRequest())->setParent($formattedParent)->setUserEvent($userEvent);
try {
$gapicClient->writeUserEvent($request);
// If the $gapicClient method call did not throw, fail the test
@@ -574,16 +586,17 @@ public function collectUserEventAsyncTest()
// Mock request
$formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
$userEvent = 'userEvent1921940774';
- $request = (new CollectUserEventRequest())
- ->setParent($formattedParent)
- ->setUserEvent($userEvent);
+ $request = (new CollectUserEventRequest())->setParent($formattedParent)->setUserEvent($userEvent);
$response = $gapicClient->collectUserEventAsync($request)->wait();
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.UserEventService/CollectUserEvent', $actualFuncCall);
+ $this->assertSame(
+ '/google.cloud.recommendationengine.v1beta1.UserEventService/CollectUserEvent',
+ $actualFuncCall
+ );
$actualValue = $actualRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$actualValue = $actualRequestObject->getUserEvent();
diff --git a/RecommendationEngine/tests/Unit/V1beta1/PredictionApiKeyRegistryClientTest.php b/RecommendationEngine/tests/Unit/V1beta1/PredictionApiKeyRegistryClientTest.php
deleted file mode 100644
index 4792ad11d6ed..000000000000
--- a/RecommendationEngine/tests/Unit/V1beta1/PredictionApiKeyRegistryClientTest.php
+++ /dev/null
@@ -1,252 +0,0 @@
-getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock();
- }
-
- /** @return PredictionApiKeyRegistryClient */
- private function createClient(array $options = [])
- {
- $options += [
- 'credentials' => $this->createCredentials(),
- ];
- return new PredictionApiKeyRegistryClient($options);
- }
-
- /** @test */
- public function createPredictionApiKeyRegistrationTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- // Mock response
- $apiKey = 'apiKey-800085318';
- $expectedResponse = new PredictionApiKeyRegistration();
- $expectedResponse->setApiKey($apiKey);
- $transport->addResponse($expectedResponse);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $predictionApiKeyRegistration = new PredictionApiKeyRegistration();
- $response = $gapicClient->createPredictionApiKeyRegistration($formattedParent, $predictionApiKeyRegistration);
- $this->assertEquals($expectedResponse, $response);
- $actualRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($actualRequests));
- $actualFuncCall = $actualRequests[0]->getFuncCall();
- $actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/CreatePredictionApiKeyRegistration', $actualFuncCall);
- $actualValue = $actualRequestObject->getParent();
- $this->assertProtobufEquals($formattedParent, $actualValue);
- $actualValue = $actualRequestObject->getPredictionApiKeyRegistration();
- $this->assertProtobufEquals($predictionApiKeyRegistration, $actualValue);
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function createPredictionApiKeyRegistrationExceptionTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $transport->addResponse(null, $status);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $predictionApiKeyRegistration = new PredictionApiKeyRegistration();
- try {
- $gapicClient->createPredictionApiKeyRegistration($formattedParent, $predictionApiKeyRegistration);
- // If the $gapicClient method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stub is exhausted
- $transport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function deletePredictionApiKeyRegistrationTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- // Mock response
- $expectedResponse = new GPBEmpty();
- $transport->addResponse($expectedResponse);
- // Mock request
- $formattedName = $gapicClient->predictionApiKeyRegistrationName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]', '[PREDICTION_API_KEY_REGISTRATION]');
- $gapicClient->deletePredictionApiKeyRegistration($formattedName);
- $actualRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($actualRequests));
- $actualFuncCall = $actualRequests[0]->getFuncCall();
- $actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/DeletePredictionApiKeyRegistration', $actualFuncCall);
- $actualValue = $actualRequestObject->getName();
- $this->assertProtobufEquals($formattedName, $actualValue);
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function deletePredictionApiKeyRegistrationExceptionTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $transport->addResponse(null, $status);
- // Mock request
- $formattedName = $gapicClient->predictionApiKeyRegistrationName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]', '[PREDICTION_API_KEY_REGISTRATION]');
- try {
- $gapicClient->deletePredictionApiKeyRegistration($formattedName);
- // If the $gapicClient method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stub is exhausted
- $transport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function listPredictionApiKeyRegistrationsTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- // Mock response
- $nextPageToken = '';
- $predictionApiKeyRegistrationsElement = new PredictionApiKeyRegistration();
- $predictionApiKeyRegistrations = [
- $predictionApiKeyRegistrationsElement,
- ];
- $expectedResponse = new ListPredictionApiKeyRegistrationsResponse();
- $expectedResponse->setNextPageToken($nextPageToken);
- $expectedResponse->setPredictionApiKeyRegistrations($predictionApiKeyRegistrations);
- $transport->addResponse($expectedResponse);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $response = $gapicClient->listPredictionApiKeyRegistrations($formattedParent);
- $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
- $resources = iterator_to_array($response->iterateAllElements());
- $this->assertSame(1, count($resources));
- $this->assertEquals($expectedResponse->getPredictionApiKeyRegistrations()[0], $resources[0]);
- $actualRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($actualRequests));
- $actualFuncCall = $actualRequests[0]->getFuncCall();
- $actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry/ListPredictionApiKeyRegistrations', $actualFuncCall);
- $actualValue = $actualRequestObject->getParent();
- $this->assertProtobufEquals($formattedParent, $actualValue);
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function listPredictionApiKeyRegistrationsExceptionTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $transport->addResponse(null, $status);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- try {
- $gapicClient->listPredictionApiKeyRegistrations($formattedParent);
- // If the $gapicClient method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stub is exhausted
- $transport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- }
-}
diff --git a/RecommendationEngine/tests/Unit/V1beta1/PredictionServiceClientTest.php b/RecommendationEngine/tests/Unit/V1beta1/PredictionServiceClientTest.php
deleted file mode 100644
index 10d55fcabd17..000000000000
--- a/RecommendationEngine/tests/Unit/V1beta1/PredictionServiceClientTest.php
+++ /dev/null
@@ -1,152 +0,0 @@
-getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock();
- }
-
- /** @return PredictionServiceClient */
- private function createClient(array $options = [])
- {
- $options += [
- 'credentials' => $this->createCredentials(),
- ];
- return new PredictionServiceClient($options);
- }
-
- /** @test */
- public function predictTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- // Mock response
- $recommendationToken = 'recommendationToken-1973883405';
- $dryRun2 = true;
- $nextPageToken = '';
- $resultsElement = new PredictionResult();
- $results = [
- $resultsElement,
- ];
- $expectedResponse = new PredictResponse();
- $expectedResponse->setRecommendationToken($recommendationToken);
- $expectedResponse->setDryRun($dryRun2);
- $expectedResponse->setNextPageToken($nextPageToken);
- $expectedResponse->setResults($results);
- $transport->addResponse($expectedResponse);
- // Mock request
- $formattedName = $gapicClient->placementName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]', '[PLACEMENT]');
- $userEvent = new UserEvent();
- $userEventEventType = 'userEventEventType341658661';
- $userEvent->setEventType($userEventEventType);
- $userEventUserInfo = new UserInfo();
- $userInfoVisitorId = 'userInfoVisitorId-1297088752';
- $userEventUserInfo->setVisitorId($userInfoVisitorId);
- $userEvent->setUserInfo($userEventUserInfo);
- $response = $gapicClient->predict($formattedName, $userEvent);
- $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
- $resources = iterator_to_array($response->iterateAllElements());
- $this->assertSame(1, count($resources));
- $this->assertEquals($expectedResponse->getResults()[0], $resources[0]);
- $actualRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($actualRequests));
- $actualFuncCall = $actualRequests[0]->getFuncCall();
- $actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.PredictionService/Predict', $actualFuncCall);
- $actualValue = $actualRequestObject->getName();
- $this->assertProtobufEquals($formattedName, $actualValue);
- $actualValue = $actualRequestObject->getUserEvent();
- $this->assertProtobufEquals($userEvent, $actualValue);
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function predictExceptionTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $transport->addResponse(null, $status);
- // Mock request
- $formattedName = $gapicClient->placementName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]', '[PLACEMENT]');
- $userEvent = new UserEvent();
- $userEventEventType = 'userEventEventType341658661';
- $userEvent->setEventType($userEventEventType);
- $userEventUserInfo = new UserInfo();
- $userInfoVisitorId = 'userInfoVisitorId-1297088752';
- $userEventUserInfo->setVisitorId($userInfoVisitorId);
- $userEvent->setUserInfo($userEventUserInfo);
- try {
- $gapicClient->predict($formattedName, $userEvent);
- // If the $gapicClient method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stub is exhausted
- $transport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- }
-}
diff --git a/RecommendationEngine/tests/Unit/V1beta1/UserEventServiceClientTest.php b/RecommendationEngine/tests/Unit/V1beta1/UserEventServiceClientTest.php
deleted file mode 100644
index 4129f7b0b3d4..000000000000
--- a/RecommendationEngine/tests/Unit/V1beta1/UserEventServiceClientTest.php
+++ /dev/null
@@ -1,525 +0,0 @@
-getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock();
- }
-
- /** @return UserEventServiceClient */
- private function createClient(array $options = [])
- {
- $options += [
- 'credentials' => $this->createCredentials(),
- ];
- return new UserEventServiceClient($options);
- }
-
- /** @test */
- public function collectUserEventTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- // Mock response
- $contentType = 'contentType831846208';
- $data = '-86';
- $expectedResponse = new HttpBody();
- $expectedResponse->setContentType($contentType);
- $expectedResponse->setData($data);
- $transport->addResponse($expectedResponse);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $userEvent = 'userEvent1921940774';
- $response = $gapicClient->collectUserEvent($formattedParent, $userEvent);
- $this->assertEquals($expectedResponse, $response);
- $actualRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($actualRequests));
- $actualFuncCall = $actualRequests[0]->getFuncCall();
- $actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.UserEventService/CollectUserEvent', $actualFuncCall);
- $actualValue = $actualRequestObject->getParent();
- $this->assertProtobufEquals($formattedParent, $actualValue);
- $actualValue = $actualRequestObject->getUserEvent();
- $this->assertProtobufEquals($userEvent, $actualValue);
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function collectUserEventExceptionTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $transport->addResponse(null, $status);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $userEvent = 'userEvent1921940774';
- try {
- $gapicClient->collectUserEvent($formattedParent, $userEvent);
- // If the $gapicClient method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stub is exhausted
- $transport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function importUserEventsTest()
- {
- $operationsTransport = $this->createTransport();
- $operationsClient = new OperationsClient([
- 'apiEndpoint' => '',
- 'transport' => $operationsTransport,
- 'credentials' => $this->createCredentials(),
- ]);
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- 'operationsClient' => $operationsClient,
- ]);
- $this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
- // Mock response
- $incompleteOperation = new Operation();
- $incompleteOperation->setName('operations/importUserEventsTest');
- $incompleteOperation->setDone(false);
- $transport->addResponse($incompleteOperation);
- $expectedResponse = new ImportUserEventsResponse();
- $anyResponse = new Any();
- $anyResponse->setValue($expectedResponse->serializeToString());
- $completeOperation = new Operation();
- $completeOperation->setName('operations/importUserEventsTest');
- $completeOperation->setDone(true);
- $completeOperation->setResponse($anyResponse);
- $operationsTransport->addResponse($completeOperation);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $inputConfig = new InputConfig();
- $response = $gapicClient->importUserEvents($formattedParent, $inputConfig);
- $this->assertFalse($response->isDone());
- $this->assertNull($response->getResult());
- $apiRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($apiRequests));
- $operationsRequestsEmpty = $operationsTransport->popReceivedCalls();
- $this->assertSame(0, count($operationsRequestsEmpty));
- $actualApiFuncCall = $apiRequests[0]->getFuncCall();
- $actualApiRequestObject = $apiRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.UserEventService/ImportUserEvents', $actualApiFuncCall);
- $actualValue = $actualApiRequestObject->getParent();
- $this->assertProtobufEquals($formattedParent, $actualValue);
- $actualValue = $actualApiRequestObject->getInputConfig();
- $this->assertProtobufEquals($inputConfig, $actualValue);
- $expectedOperationsRequestObject = new GetOperationRequest();
- $expectedOperationsRequestObject->setName('operations/importUserEventsTest');
- $response->pollUntilComplete([
- 'initialPollDelayMillis' => 1,
- ]);
- $this->assertTrue($response->isDone());
- $this->assertEquals($expectedResponse, $response->getResult());
- $apiRequestsEmpty = $transport->popReceivedCalls();
- $this->assertSame(0, count($apiRequestsEmpty));
- $operationsRequests = $operationsTransport->popReceivedCalls();
- $this->assertSame(1, count($operationsRequests));
- $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall();
- $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject();
- $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall);
- $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject);
- $this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
- }
-
- /** @test */
- public function importUserEventsExceptionTest()
- {
- $operationsTransport = $this->createTransport();
- $operationsClient = new OperationsClient([
- 'apiEndpoint' => '',
- 'transport' => $operationsTransport,
- 'credentials' => $this->createCredentials(),
- ]);
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- 'operationsClient' => $operationsClient,
- ]);
- $this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
- // Mock response
- $incompleteOperation = new Operation();
- $incompleteOperation->setName('operations/importUserEventsTest');
- $incompleteOperation->setDone(false);
- $transport->addResponse($incompleteOperation);
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $operationsTransport->addResponse(null, $status);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $inputConfig = new InputConfig();
- $response = $gapicClient->importUserEvents($formattedParent, $inputConfig);
- $this->assertFalse($response->isDone());
- $this->assertNull($response->getResult());
- $expectedOperationsRequestObject = new GetOperationRequest();
- $expectedOperationsRequestObject->setName('operations/importUserEventsTest');
- try {
- $response->pollUntilComplete([
- 'initialPollDelayMillis' => 1,
- ]);
- // If the pollUntilComplete() method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stubs are exhausted
- $transport->popReceivedCalls();
- $operationsTransport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
- }
-
- /** @test */
- public function listUserEventsTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- // Mock response
- $nextPageToken = '';
- $userEventsElement = new UserEvent();
- $userEvents = [
- $userEventsElement,
- ];
- $expectedResponse = new ListUserEventsResponse();
- $expectedResponse->setNextPageToken($nextPageToken);
- $expectedResponse->setUserEvents($userEvents);
- $transport->addResponse($expectedResponse);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $response = $gapicClient->listUserEvents($formattedParent);
- $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
- $resources = iterator_to_array($response->iterateAllElements());
- $this->assertSame(1, count($resources));
- $this->assertEquals($expectedResponse->getUserEvents()[0], $resources[0]);
- $actualRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($actualRequests));
- $actualFuncCall = $actualRequests[0]->getFuncCall();
- $actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.UserEventService/ListUserEvents', $actualFuncCall);
- $actualValue = $actualRequestObject->getParent();
- $this->assertProtobufEquals($formattedParent, $actualValue);
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function listUserEventsExceptionTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $transport->addResponse(null, $status);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- try {
- $gapicClient->listUserEvents($formattedParent);
- // If the $gapicClient method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stub is exhausted
- $transport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function purgeUserEventsTest()
- {
- $operationsTransport = $this->createTransport();
- $operationsClient = new OperationsClient([
- 'apiEndpoint' => '',
- 'transport' => $operationsTransport,
- 'credentials' => $this->createCredentials(),
- ]);
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- 'operationsClient' => $operationsClient,
- ]);
- $this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
- // Mock response
- $incompleteOperation = new Operation();
- $incompleteOperation->setName('operations/purgeUserEventsTest');
- $incompleteOperation->setDone(false);
- $transport->addResponse($incompleteOperation);
- $purgedEventsCount = 310774833;
- $expectedResponse = new PurgeUserEventsResponse();
- $expectedResponse->setPurgedEventsCount($purgedEventsCount);
- $anyResponse = new Any();
- $anyResponse->setValue($expectedResponse->serializeToString());
- $completeOperation = new Operation();
- $completeOperation->setName('operations/purgeUserEventsTest');
- $completeOperation->setDone(true);
- $completeOperation->setResponse($anyResponse);
- $operationsTransport->addResponse($completeOperation);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $filter = 'filter-1274492040';
- $response = $gapicClient->purgeUserEvents($formattedParent, $filter);
- $this->assertFalse($response->isDone());
- $this->assertNull($response->getResult());
- $apiRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($apiRequests));
- $operationsRequestsEmpty = $operationsTransport->popReceivedCalls();
- $this->assertSame(0, count($operationsRequestsEmpty));
- $actualApiFuncCall = $apiRequests[0]->getFuncCall();
- $actualApiRequestObject = $apiRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.UserEventService/PurgeUserEvents', $actualApiFuncCall);
- $actualValue = $actualApiRequestObject->getParent();
- $this->assertProtobufEquals($formattedParent, $actualValue);
- $actualValue = $actualApiRequestObject->getFilter();
- $this->assertProtobufEquals($filter, $actualValue);
- $expectedOperationsRequestObject = new GetOperationRequest();
- $expectedOperationsRequestObject->setName('operations/purgeUserEventsTest');
- $response->pollUntilComplete([
- 'initialPollDelayMillis' => 1,
- ]);
- $this->assertTrue($response->isDone());
- $this->assertEquals($expectedResponse, $response->getResult());
- $apiRequestsEmpty = $transport->popReceivedCalls();
- $this->assertSame(0, count($apiRequestsEmpty));
- $operationsRequests = $operationsTransport->popReceivedCalls();
- $this->assertSame(1, count($operationsRequests));
- $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall();
- $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject();
- $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall);
- $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject);
- $this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
- }
-
- /** @test */
- public function purgeUserEventsExceptionTest()
- {
- $operationsTransport = $this->createTransport();
- $operationsClient = new OperationsClient([
- 'apiEndpoint' => '',
- 'transport' => $operationsTransport,
- 'credentials' => $this->createCredentials(),
- ]);
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- 'operationsClient' => $operationsClient,
- ]);
- $this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
- // Mock response
- $incompleteOperation = new Operation();
- $incompleteOperation->setName('operations/purgeUserEventsTest');
- $incompleteOperation->setDone(false);
- $transport->addResponse($incompleteOperation);
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $operationsTransport->addResponse(null, $status);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $filter = 'filter-1274492040';
- $response = $gapicClient->purgeUserEvents($formattedParent, $filter);
- $this->assertFalse($response->isDone());
- $this->assertNull($response->getResult());
- $expectedOperationsRequestObject = new GetOperationRequest();
- $expectedOperationsRequestObject->setName('operations/purgeUserEventsTest');
- try {
- $response->pollUntilComplete([
- 'initialPollDelayMillis' => 1,
- ]);
- // If the pollUntilComplete() method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stubs are exhausted
- $transport->popReceivedCalls();
- $operationsTransport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
- }
-
- /** @test */
- public function writeUserEventTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- // Mock response
- $eventType = 'eventType984376767';
- $expectedResponse = new UserEvent();
- $expectedResponse->setEventType($eventType);
- $transport->addResponse($expectedResponse);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $userEvent = new UserEvent();
- $userEventEventType = 'userEventEventType341658661';
- $userEvent->setEventType($userEventEventType);
- $userEventUserInfo = new UserInfo();
- $userInfoVisitorId = 'userInfoVisitorId-1297088752';
- $userEventUserInfo->setVisitorId($userInfoVisitorId);
- $userEvent->setUserInfo($userEventUserInfo);
- $response = $gapicClient->writeUserEvent($formattedParent, $userEvent);
- $this->assertEquals($expectedResponse, $response);
- $actualRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($actualRequests));
- $actualFuncCall = $actualRequests[0]->getFuncCall();
- $actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.recommendationengine.v1beta1.UserEventService/WriteUserEvent', $actualFuncCall);
- $actualValue = $actualRequestObject->getParent();
- $this->assertProtobufEquals($formattedParent, $actualValue);
- $actualValue = $actualRequestObject->getUserEvent();
- $this->assertProtobufEquals($userEvent, $actualValue);
- $this->assertTrue($transport->isExhausted());
- }
-
- /** @test */
- public function writeUserEventExceptionTest()
- {
- $transport = $this->createTransport();
- $gapicClient = $this->createClient([
- 'transport' => $transport,
- ]);
- $this->assertTrue($transport->isExhausted());
- $status = new stdClass();
- $status->code = Code::DATA_LOSS;
- $status->details = 'internal error';
- $expectedExceptionMessage = json_encode([
- 'message' => 'internal error',
- 'code' => Code::DATA_LOSS,
- 'status' => 'DATA_LOSS',
- 'details' => [],
- ], JSON_PRETTY_PRINT);
- $transport->addResponse(null, $status);
- // Mock request
- $formattedParent = $gapicClient->eventStoreName('[PROJECT]', '[LOCATION]', '[CATALOG]', '[EVENT_STORE]');
- $userEvent = new UserEvent();
- $userEventEventType = 'userEventEventType341658661';
- $userEvent->setEventType($userEventEventType);
- $userEventUserInfo = new UserInfo();
- $userInfoVisitorId = 'userInfoVisitorId-1297088752';
- $userEventUserInfo->setVisitorId($userInfoVisitorId);
- $userEvent->setUserInfo($userEventUserInfo);
- try {
- $gapicClient->writeUserEvent($formattedParent, $userEvent);
- // If the $gapicClient method call did not throw, fail the test
- $this->fail('Expected an ApiException, but no exception was thrown.');
- } catch (ApiException $ex) {
- $this->assertEquals($status->code, $ex->getCode());
- $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
- }
- // Call popReceivedCalls to ensure the stub is exhausted
- $transport->popReceivedCalls();
- $this->assertTrue($transport->isExhausted());
- }
-}