diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/GPBMetadata/Google/Shopping/Merchant/Conversions/V1Beta/Conversionsources.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/GPBMetadata/Google/Shopping/Merchant/Conversions/V1Beta/Conversionsources.php new file mode 100644 index 000000000000..2f8bacb6e695 Binary files /dev/null and b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/GPBMetadata/Google/Shopping/Merchant/Conversions/V1Beta/Conversionsources.php differ diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/AttributionSettings.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/AttributionSettings.php new file mode 100644 index 000000000000..991a2dcb98f0 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/AttributionSettings.php @@ -0,0 +1,148 @@ +google.shopping.merchant.conversions.v1beta.AttributionSettings + */ +class AttributionSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Lookback windows (in days) used for attribution in this source. + * Supported values are 7, 30, 40. + * + * Generated from protobuf field int32 attribution_lookback_window_days = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $attribution_lookback_window_days = 0; + /** + * Required. Attribution model. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.AttributionSettings.AttributionModel attribution_model = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $attribution_model = 0; + /** + * Immutable. Unordered list. List of different conversion types a conversion + * event can be classified as. A standard "purchase" type will be + * automatically created if this list is empty at creation time. + * + * Generated from protobuf field repeated .google.shopping.merchant.conversions.v1beta.AttributionSettings.ConversionType conversion_type = 3 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = IMMUTABLE]; + */ + private $conversion_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $attribution_lookback_window_days + * Required. Lookback windows (in days) used for attribution in this source. + * Supported values are 7, 30, 40. + * @type int $attribution_model + * Required. Attribution model. + * @type array<\Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings\ConversionType>|\Google\Protobuf\Internal\RepeatedField $conversion_type + * Immutable. Unordered list. List of different conversion types a conversion + * event can be classified as. A standard "purchase" type will be + * automatically created if this list is empty at creation time. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Conversions\V1Beta\Conversionsources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Lookback windows (in days) used for attribution in this source. + * Supported values are 7, 30, 40. + * + * Generated from protobuf field int32 attribution_lookback_window_days = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getAttributionLookbackWindowDays() + { + return $this->attribution_lookback_window_days; + } + + /** + * Required. Lookback windows (in days) used for attribution in this source. + * Supported values are 7, 30, 40. + * + * Generated from protobuf field int32 attribution_lookback_window_days = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setAttributionLookbackWindowDays($var) + { + GPBUtil::checkInt32($var); + $this->attribution_lookback_window_days = $var; + + return $this; + } + + /** + * Required. Attribution model. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.AttributionSettings.AttributionModel attribution_model = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getAttributionModel() + { + return $this->attribution_model; + } + + /** + * Required. Attribution model. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.AttributionSettings.AttributionModel attribution_model = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setAttributionModel($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings\AttributionModel::class); + $this->attribution_model = $var; + + return $this; + } + + /** + * Immutable. Unordered list. List of different conversion types a conversion + * event can be classified as. A standard "purchase" type will be + * automatically created if this list is empty at creation time. + * + * Generated from protobuf field repeated .google.shopping.merchant.conversions.v1beta.AttributionSettings.ConversionType conversion_type = 3 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConversionType() + { + return $this->conversion_type; + } + + /** + * Immutable. Unordered list. List of different conversion types a conversion + * event can be classified as. A standard "purchase" type will be + * automatically created if this list is empty at creation time. + * + * Generated from protobuf field repeated .google.shopping.merchant.conversions.v1beta.AttributionSettings.ConversionType conversion_type = 3 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = IMMUTABLE]; + * @param array<\Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings\ConversionType>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConversionType($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings\ConversionType::class); + $this->conversion_type = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/AttributionSettings/AttributionModel.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/AttributionSettings/AttributionModel.php new file mode 100644 index 000000000000..901ec26578e8 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/AttributionSettings/AttributionModel.php @@ -0,0 +1,101 @@ +google.shopping.merchant.conversions.v1beta.AttributionSettings.AttributionModel + */ +class AttributionModel +{ + /** + * Unspecified model. + * + * Generated from protobuf enum ATTRIBUTION_MODEL_UNSPECIFIED = 0; + */ + const ATTRIBUTION_MODEL_UNSPECIFIED = 0; + /** + * Cross-channel Last Click model. + * + * Generated from protobuf enum CROSS_CHANNEL_LAST_CLICK = 1; + */ + const CROSS_CHANNEL_LAST_CLICK = 1; + /** + * Ads-preferred Last Click model. + * + * Generated from protobuf enum ADS_PREFERRED_LAST_CLICK = 2; + */ + const ADS_PREFERRED_LAST_CLICK = 2; + /** + * Cross-channel Data Driven model. + * + * Generated from protobuf enum CROSS_CHANNEL_DATA_DRIVEN = 5; + */ + const CROSS_CHANNEL_DATA_DRIVEN = 5; + /** + * Cross-channel First Click model. + * + * Generated from protobuf enum CROSS_CHANNEL_FIRST_CLICK = 6; + */ + const CROSS_CHANNEL_FIRST_CLICK = 6; + /** + * Cross-channel Linear model. + * + * Generated from protobuf enum CROSS_CHANNEL_LINEAR = 7; + */ + const CROSS_CHANNEL_LINEAR = 7; + /** + * Cross-channel Position Based model. + * + * Generated from protobuf enum CROSS_CHANNEL_POSITION_BASED = 8; + */ + const CROSS_CHANNEL_POSITION_BASED = 8; + /** + * Cross-channel Time Decay model. + * + * Generated from protobuf enum CROSS_CHANNEL_TIME_DECAY = 9; + */ + const CROSS_CHANNEL_TIME_DECAY = 9; + + private static $valueToName = [ + self::ATTRIBUTION_MODEL_UNSPECIFIED => 'ATTRIBUTION_MODEL_UNSPECIFIED', + self::CROSS_CHANNEL_LAST_CLICK => 'CROSS_CHANNEL_LAST_CLICK', + self::ADS_PREFERRED_LAST_CLICK => 'ADS_PREFERRED_LAST_CLICK', + self::CROSS_CHANNEL_DATA_DRIVEN => 'CROSS_CHANNEL_DATA_DRIVEN', + self::CROSS_CHANNEL_FIRST_CLICK => 'CROSS_CHANNEL_FIRST_CLICK', + self::CROSS_CHANNEL_LINEAR => 'CROSS_CHANNEL_LINEAR', + self::CROSS_CHANNEL_POSITION_BASED => 'CROSS_CHANNEL_POSITION_BASED', + self::CROSS_CHANNEL_TIME_DECAY => 'CROSS_CHANNEL_TIME_DECAY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AttributionModel::class, \Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings_AttributionModel::class); + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/AttributionSettings/ConversionType.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/AttributionSettings/ConversionType.php new file mode 100644 index 000000000000..19cf33147067 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/AttributionSettings/ConversionType.php @@ -0,0 +1,108 @@ +google.shopping.merchant.conversions.v1beta.AttributionSettings.ConversionType + */ +class ConversionType extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Conversion event name, as it'll be reported by the client. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Option indicating if the type should be included in Merchant + * Center reporting. + * + * Generated from protobuf field bool report = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $report = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. Conversion event name, as it'll be reported by the client. + * @type bool $report + * Output only. Option indicating if the type should be included in Merchant + * Center reporting. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Conversions\V1Beta\Conversionsources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Conversion event name, as it'll be reported by the client. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. Conversion event name, as it'll be reported by the client. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Option indicating if the type should be included in Merchant + * Center reporting. + * + * Generated from protobuf field bool report = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReport() + { + return $this->report; + } + + /** + * Output only. Option indicating if the type should be included in Merchant + * Center reporting. + * + * Generated from protobuf field bool report = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReport($var) + { + GPBUtil::checkBool($var); + $this->report = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ConversionType::class, \Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings_ConversionType::class); + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ConversionSource.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ConversionSource.php new file mode 100644 index 000000000000..b2acdf0e5549 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ConversionSource.php @@ -0,0 +1,291 @@ +google.shopping.merchant.conversions.v1beta.ConversionSource + */ +class ConversionSource extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Identifier. Generated by the Content API upon creation of a + * new `ConversionSource`. Format: [a-z]{4}:.+ The four characters before the + * colon represent the type of conversio source. Content after the colon + * represents the ID of the conversion source within that type. The ID of two + * different conversion sources might be the same across different types. The + * following type prefixes are supported: + * - galk: For GoogleAnalyticsLink sources. + * - mcdn: For MerchantCenterDestination sources. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. Current state of this conversion source. Can't be edited + * through the API. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.ConversionSource.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The time when an archived conversion source becomes + * permanently deleted and is no longer available to undelete. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $expire_time = null; + /** + * Output only. Controller of the conversion source. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.ConversionSource.Controller controller = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $controller = 0; + protected $source_data; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Shopping\Merchant\Conversions\V1beta\GoogleAnalyticsLink $google_analytics_link + * Immutable. Conversion Source of type "Link to Google Analytics Property". + * @type \Google\Shopping\Merchant\Conversions\V1beta\MerchantCenterDestination $merchant_center_destination + * Conversion Source of type "Merchant Center Tag Destination". + * @type string $name + * Output only. Identifier. Generated by the Content API upon creation of a + * new `ConversionSource`. Format: [a-z]{4}:.+ The four characters before the + * colon represent the type of conversio source. Content after the colon + * represents the ID of the conversion source within that type. The ID of two + * different conversion sources might be the same across different types. The + * following type prefixes are supported: + * - galk: For GoogleAnalyticsLink sources. + * - mcdn: For MerchantCenterDestination sources. + * @type int $state + * Output only. Current state of this conversion source. Can't be edited + * through the API. + * @type \Google\Protobuf\Timestamp $expire_time + * Output only. The time when an archived conversion source becomes + * permanently deleted and is no longer available to undelete. + * @type int $controller + * Output only. Controller of the conversion source. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Conversions\V1Beta\Conversionsources::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. Conversion Source of type "Link to Google Analytics Property". + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.GoogleAnalyticsLink google_analytics_link = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Shopping\Merchant\Conversions\V1beta\GoogleAnalyticsLink|null + */ + public function getGoogleAnalyticsLink() + { + return $this->readOneof(3); + } + + public function hasGoogleAnalyticsLink() + { + return $this->hasOneof(3); + } + + /** + * Immutable. Conversion Source of type "Link to Google Analytics Property". + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.GoogleAnalyticsLink google_analytics_link = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Shopping\Merchant\Conversions\V1beta\GoogleAnalyticsLink $var + * @return $this + */ + public function setGoogleAnalyticsLink($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Conversions\V1beta\GoogleAnalyticsLink::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Conversion Source of type "Merchant Center Tag Destination". + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.MerchantCenterDestination merchant_center_destination = 4; + * @return \Google\Shopping\Merchant\Conversions\V1beta\MerchantCenterDestination|null + */ + public function getMerchantCenterDestination() + { + return $this->readOneof(4); + } + + public function hasMerchantCenterDestination() + { + return $this->hasOneof(4); + } + + /** + * Conversion Source of type "Merchant Center Tag Destination". + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.MerchantCenterDestination merchant_center_destination = 4; + * @param \Google\Shopping\Merchant\Conversions\V1beta\MerchantCenterDestination $var + * @return $this + */ + public function setMerchantCenterDestination($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Conversions\V1beta\MerchantCenterDestination::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Output only. Identifier. Generated by the Content API upon creation of a + * new `ConversionSource`. Format: [a-z]{4}:.+ The four characters before the + * colon represent the type of conversio source. Content after the colon + * represents the ID of the conversion source within that type. The ID of two + * different conversion sources might be the same across different types. The + * following type prefixes are supported: + * - galk: For GoogleAnalyticsLink sources. + * - mcdn: For MerchantCenterDestination sources. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. Identifier. Generated by the Content API upon creation of a + * new `ConversionSource`. Format: [a-z]{4}:.+ The four characters before the + * colon represent the type of conversio source. Content after the colon + * represents the ID of the conversion source within that type. The ID of two + * different conversion sources might be the same across different types. The + * following type prefixes are supported: + * - galk: For GoogleAnalyticsLink sources. + * - mcdn: For MerchantCenterDestination sources. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Current state of this conversion source. Can't be edited + * through the API. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.ConversionSource.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. Current state of this conversion source. Can't be edited + * through the API. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.ConversionSource.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The time when an archived conversion source becomes + * permanently deleted and is no longer available to undelete. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpireTime() + { + return $this->expire_time; + } + + public function hasExpireTime() + { + return isset($this->expire_time); + } + + public function clearExpireTime() + { + unset($this->expire_time); + } + + /** + * Output only. The time when an archived conversion source becomes + * permanently deleted and is no longer available to undelete. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expire_time = $var; + + return $this; + } + + /** + * Output only. Controller of the conversion source. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.ConversionSource.Controller controller = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getController() + { + return $this->controller; + } + + /** + * Output only. Controller of the conversion source. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.ConversionSource.Controller controller = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setController($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource\Controller::class); + $this->controller = $var; + + return $this; + } + + /** + * @return string + */ + public function getSourceData() + { + return $this->whichOneof("source_data"); + } + +} + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ConversionSource/Controller.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ConversionSource/Controller.php new file mode 100644 index 000000000000..50219e1c4748 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ConversionSource/Controller.php @@ -0,0 +1,64 @@ +google.shopping.merchant.conversions.v1beta.ConversionSource.Controller + */ +class Controller +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum CONTROLLER_UNSPECIFIED = 0; + */ + const CONTROLLER_UNSPECIFIED = 0; + /** + * Controlled by the Merchant who owns the Conversion Source. + * + * Generated from protobuf enum MERCHANT = 1; + */ + const MERCHANT = 1; + /** + * Controlled by the YT Affiliates program. + * + * Generated from protobuf enum YOUTUBE_AFFILIATES = 2; + */ + const YOUTUBE_AFFILIATES = 2; + + private static $valueToName = [ + self::CONTROLLER_UNSPECIFIED => 'CONTROLLER_UNSPECIFIED', + self::MERCHANT => 'MERCHANT', + self::YOUTUBE_AFFILIATES => 'YOUTUBE_AFFILIATES', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Controller::class, \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource_Controller::class); + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ConversionSource/State.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ConversionSource/State.php new file mode 100644 index 000000000000..46681e4bf6e9 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ConversionSource/State.php @@ -0,0 +1,72 @@ +google.shopping.merchant.conversions.v1beta.ConversionSource.State + */ +class State +{ + /** + * Conversion source has unspecified state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Conversion source is fully functional. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Conversion source has been archived in the last 30 days and not + * currently functional. Can be restored using the undelete method. + * + * Generated from protobuf enum ARCHIVED = 2; + */ + const ARCHIVED = 2; + /** + * Conversion source creation has started but not fully finished yet. + * + * Generated from protobuf enum PENDING = 3; + */ + const PENDING = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::ARCHIVED => 'ARCHIVED', + self::PENDING => 'PENDING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource_State::class); + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/CreateConversionSourceRequest.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/CreateConversionSourceRequest.php new file mode 100644 index 000000000000..0e3a79786436 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/CreateConversionSourceRequest.php @@ -0,0 +1,137 @@ +google.shopping.merchant.conversions.v1beta.CreateConversionSourceRequest + */ +class CreateConversionSourceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The merchant account that will own the new conversion source. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The conversion source description. A new ID will be automatically + * assigned to it upon creation. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.ConversionSource conversion_source = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $conversion_source = null; + + /** + * @param string $parent Required. The merchant account that will own the new conversion source. + * Format: accounts/{account} + * Please see {@see ConversionSourcesServiceClient::accountName()} for help formatting this field. + * @param \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource $conversionSource Required. The conversion source description. A new ID will be automatically + * assigned to it upon creation. + * + * @return \Google\Shopping\Merchant\Conversions\V1beta\CreateConversionSourceRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource $conversionSource): self + { + return (new self()) + ->setParent($parent) + ->setConversionSource($conversionSource); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The merchant account that will own the new conversion source. + * Format: accounts/{account} + * @type \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource $conversion_source + * Required. The conversion source description. A new ID will be automatically + * assigned to it upon creation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Conversions\V1Beta\Conversionsources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The merchant account that will own the new conversion source. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The merchant account that will own the new conversion source. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The conversion source description. A new ID will be automatically + * assigned to it upon creation. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.ConversionSource conversion_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource|null + */ + public function getConversionSource() + { + return $this->conversion_source; + } + + public function hasConversionSource() + { + return isset($this->conversion_source); + } + + public function clearConversionSource() + { + unset($this->conversion_source); + } + + /** + * Required. The conversion source description. A new ID will be automatically + * assigned to it upon creation. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.ConversionSource conversion_source = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource $var + * @return $this + */ + public function setConversionSource($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource::class); + $this->conversion_source = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/DeleteConversionSourceRequest.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/DeleteConversionSourceRequest.php new file mode 100644 index 000000000000..a149f757807b --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/DeleteConversionSourceRequest.php @@ -0,0 +1,86 @@ +google.shopping.merchant.conversions.v1beta.DeleteConversionSourceRequest + */ +class DeleteConversionSourceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the conversion source to be deleted. + * Format: accounts/{account}/conversionSources/{conversion_source} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the conversion source to be deleted. + * Format: accounts/{account}/conversionSources/{conversion_source} + * Please see {@see ConversionSourcesServiceClient::conversionSourceName()} for help formatting this field. + * + * @return \Google\Shopping\Merchant\Conversions\V1beta\DeleteConversionSourceRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the conversion source to be deleted. + * Format: accounts/{account}/conversionSources/{conversion_source} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Conversions\V1Beta\Conversionsources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the conversion source to be deleted. + * Format: accounts/{account}/conversionSources/{conversion_source} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the conversion source to be deleted. + * Format: accounts/{account}/conversionSources/{conversion_source} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/GetConversionSourceRequest.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/GetConversionSourceRequest.php new file mode 100644 index 000000000000..aa725dd86e65 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/GetConversionSourceRequest.php @@ -0,0 +1,86 @@ +google.shopping.merchant.conversions.v1beta.GetConversionSourceRequest + */ +class GetConversionSourceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the conversion source to be fetched. + * Format: accounts/{account}/conversionsources/{conversion_source} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the conversion source to be fetched. + * Format: accounts/{account}/conversionsources/{conversion_source} + * Please see {@see ConversionSourcesServiceClient::conversionSourceName()} for help formatting this field. + * + * @return \Google\Shopping\Merchant\Conversions\V1beta\GetConversionSourceRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the conversion source to be fetched. + * Format: accounts/{account}/conversionsources/{conversion_source} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Conversions\V1Beta\Conversionsources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the conversion source to be fetched. + * Format: accounts/{account}/conversionsources/{conversion_source} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the conversion source to be fetched. + * Format: accounts/{account}/conversionsources/{conversion_source} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/GoogleAnalyticsLink.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/GoogleAnalyticsLink.php new file mode 100644 index 000000000000..a064064e1f2c --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/GoogleAnalyticsLink.php @@ -0,0 +1,154 @@ +google.shopping.merchant.conversions.v1beta.GoogleAnalyticsLink + */ +class GoogleAnalyticsLink extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Immutable. ID of the Google Analytics property the merchant is + * linked to. + * + * Generated from protobuf field int64 property_id = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + */ + protected $property_id = 0; + /** + * Output only. Attribution settings for the linked Google Analytics property. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.AttributionSettings attribution_settings = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $attribution_settings = null; + /** + * Output only. Name of the Google Analytics property the merchant is linked + * to. + * + * Generated from protobuf field string property = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $property = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $property_id + * Required. Immutable. ID of the Google Analytics property the merchant is + * linked to. + * @type \Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings $attribution_settings + * Output only. Attribution settings for the linked Google Analytics property. + * @type string $property + * Output only. Name of the Google Analytics property the merchant is linked + * to. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Conversions\V1Beta\Conversionsources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Immutable. ID of the Google Analytics property the merchant is + * linked to. + * + * Generated from protobuf field int64 property_id = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @return int|string + */ + public function getPropertyId() + { + return $this->property_id; + } + + /** + * Required. Immutable. ID of the Google Analytics property the merchant is + * linked to. + * + * Generated from protobuf field int64 property_id = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @param int|string $var + * @return $this + */ + public function setPropertyId($var) + { + GPBUtil::checkInt64($var); + $this->property_id = $var; + + return $this; + } + + /** + * Output only. Attribution settings for the linked Google Analytics property. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.AttributionSettings attribution_settings = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings|null + */ + public function getAttributionSettings() + { + return $this->attribution_settings; + } + + public function hasAttributionSettings() + { + return isset($this->attribution_settings); + } + + public function clearAttributionSettings() + { + unset($this->attribution_settings); + } + + /** + * Output only. Attribution settings for the linked Google Analytics property. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.AttributionSettings attribution_settings = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings $var + * @return $this + */ + public function setAttributionSettings($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings::class); + $this->attribution_settings = $var; + + return $this; + } + + /** + * Output only. Name of the Google Analytics property the merchant is linked + * to. + * + * Generated from protobuf field string property = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getProperty() + { + return $this->property; + } + + /** + * Output only. Name of the Google Analytics property the merchant is linked + * to. + * + * Generated from protobuf field string property = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setProperty($var) + { + GPBUtil::checkString($var, True); + $this->property = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ListConversionSourcesRequest.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ListConversionSourcesRequest.php new file mode 100644 index 000000000000..f348886adf2d --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ListConversionSourcesRequest.php @@ -0,0 +1,204 @@ +google.shopping.merchant.conversions.v1beta.ListConversionSourcesRequest + */ +class ListConversionSourcesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The merchant account who owns the collection of conversion + * sources. Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of conversion sources to return in a page. + * If no `page_size` is specified, `100` is used as the default value. The + * maximum value is `200`. Values above `200` will be coerced to `200`. + * Regardless of pagination, at most `200` conversion sources are returned + * in total. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. Page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Show deleted (archived) option. + * + * Generated from protobuf field bool show_deleted = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $show_deleted = false; + + /** + * @param string $parent Required. The merchant account who owns the collection of conversion + * sources. Format: accounts/{account} + * Please see {@see ConversionSourcesServiceClient::accountName()} for help formatting this field. + * + * @return \Google\Shopping\Merchant\Conversions\V1beta\ListConversionSourcesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The merchant account who owns the collection of conversion + * sources. Format: accounts/{account} + * @type int $page_size + * Optional. The maximum number of conversion sources to return in a page. + * If no `page_size` is specified, `100` is used as the default value. The + * maximum value is `200`. Values above `200` will be coerced to `200`. + * Regardless of pagination, at most `200` conversion sources are returned + * in total. + * @type string $page_token + * Optional. Page token. + * @type bool $show_deleted + * Optional. Show deleted (archived) option. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Conversions\V1Beta\Conversionsources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The merchant account who owns the collection of conversion + * sources. Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The merchant account who owns the collection of conversion + * sources. Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of conversion sources to return in a page. + * If no `page_size` is specified, `100` is used as the default value. The + * maximum value is `200`. Values above `200` will be coerced to `200`. + * Regardless of pagination, at most `200` conversion sources are returned + * in total. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of conversion sources to return in a page. + * If no `page_size` is specified, `100` is used as the default value. The + * maximum value is `200`. Values above `200` will be coerced to `200`. + * Regardless of pagination, at most `200` conversion sources are returned + * in total. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. Page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. Page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Show deleted (archived) option. + * + * Generated from protobuf field bool show_deleted = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getShowDeleted() + { + return $this->show_deleted; + } + + /** + * Optional. Show deleted (archived) option. + * + * Generated from protobuf field bool show_deleted = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setShowDeleted($var) + { + GPBUtil::checkBool($var); + $this->show_deleted = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ListConversionSourcesResponse.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ListConversionSourcesResponse.php new file mode 100644 index 000000000000..f903b9d6c706 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/ListConversionSourcesResponse.php @@ -0,0 +1,101 @@ +google.shopping.merchant.conversions.v1beta.ListConversionSourcesResponse + */ +class ListConversionSourcesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of conversion sources. + * + * Generated from protobuf field repeated .google.shopping.merchant.conversions.v1beta.ConversionSource conversion_sources = 1; + */ + private $conversion_sources; + /** + * Token to be used to fetch the next results page. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Shopping\Merchant\Conversions\V1beta\ConversionSource>|\Google\Protobuf\Internal\RepeatedField $conversion_sources + * List of conversion sources. + * @type string $next_page_token + * Token to be used to fetch the next results page. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Conversions\V1Beta\Conversionsources::initOnce(); + parent::__construct($data); + } + + /** + * List of conversion sources. + * + * Generated from protobuf field repeated .google.shopping.merchant.conversions.v1beta.ConversionSource conversion_sources = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConversionSources() + { + return $this->conversion_sources; + } + + /** + * List of conversion sources. + * + * Generated from protobuf field repeated .google.shopping.merchant.conversions.v1beta.ConversionSource conversion_sources = 1; + * @param array<\Google\Shopping\Merchant\Conversions\V1beta\ConversionSource>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConversionSources($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource::class); + $this->conversion_sources = $arr; + + return $this; + } + + /** + * Token to be used to fetch the next results page. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to be used to fetch the next results page. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/MerchantCenterDestination.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/MerchantCenterDestination.php new file mode 100644 index 000000000000..e3d932f76e21 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/MerchantCenterDestination.php @@ -0,0 +1,201 @@ +google.shopping.merchant.conversions.v1beta.MerchantCenterDestination + */ +class MerchantCenterDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Merchant Center Destination ID. + * + * Generated from protobuf field string destination = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $destination = ''; + /** + * Required. Attribution settings being used for the Merchant Center + * Destination. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.AttributionSettings attribution_settings = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $attribution_settings = null; + /** + * Required. Merchant-specified display name for the destination. This is the + * name that identifies the conversion source within the Merchant Center UI. + * Limited to 64 characters. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * Required. Three-letter currency code (ISO 4217). The currency code defines + * in which currency the conversions sent to this destination will be reported + * in Merchant Center. + * + * Generated from protobuf field string currency_code = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $currency_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $destination + * Output only. Merchant Center Destination ID. + * @type \Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings $attribution_settings + * Required. Attribution settings being used for the Merchant Center + * Destination. + * @type string $display_name + * Required. Merchant-specified display name for the destination. This is the + * name that identifies the conversion source within the Merchant Center UI. + * Limited to 64 characters. + * @type string $currency_code + * Required. Three-letter currency code (ISO 4217). The currency code defines + * in which currency the conversions sent to this destination will be reported + * in Merchant Center. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Conversions\V1Beta\Conversionsources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Merchant Center Destination ID. + * + * Generated from protobuf field string destination = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDestination() + { + return $this->destination; + } + + /** + * Output only. Merchant Center Destination ID. + * + * Generated from protobuf field string destination = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDestination($var) + { + GPBUtil::checkString($var, True); + $this->destination = $var; + + return $this; + } + + /** + * Required. Attribution settings being used for the Merchant Center + * Destination. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.AttributionSettings attribution_settings = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings|null + */ + public function getAttributionSettings() + { + return $this->attribution_settings; + } + + public function hasAttributionSettings() + { + return isset($this->attribution_settings); + } + + public function clearAttributionSettings() + { + unset($this->attribution_settings); + } + + /** + * Required. Attribution settings being used for the Merchant Center + * Destination. + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.AttributionSettings attribution_settings = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings $var + * @return $this + */ + public function setAttributionSettings($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Conversions\V1beta\AttributionSettings::class); + $this->attribution_settings = $var; + + return $this; + } + + /** + * Required. Merchant-specified display name for the destination. This is the + * name that identifies the conversion source within the Merchant Center UI. + * Limited to 64 characters. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. Merchant-specified display name for the destination. This is the + * name that identifies the conversion source within the Merchant Center UI. + * Limited to 64 characters. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Required. Three-letter currency code (ISO 4217). The currency code defines + * in which currency the conversions sent to this destination will be reported + * in Merchant Center. + * + * Generated from protobuf field string currency_code = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCurrencyCode() + { + return $this->currency_code; + } + + /** + * Required. Three-letter currency code (ISO 4217). The currency code defines + * in which currency the conversions sent to this destination will be reported + * in Merchant Center. + * + * Generated from protobuf field string currency_code = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCurrencyCode($var) + { + GPBUtil::checkString($var, True); + $this->currency_code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/UndeleteConversionSourceRequest.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/UndeleteConversionSourceRequest.php new file mode 100644 index 000000000000..c5229fafc28f --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/UndeleteConversionSourceRequest.php @@ -0,0 +1,71 @@ +google.shopping.merchant.conversions.v1beta.UndeleteConversionSourceRequest + */ +class UndeleteConversionSourceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the conversion source to be undeleted. + * Format: accounts/{account}/conversionSources/{conversion_source} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the conversion source to be undeleted. + * Format: accounts/{account}/conversionSources/{conversion_source} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Conversions\V1Beta\Conversionsources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the conversion source to be undeleted. + * Format: accounts/{account}/conversionSources/{conversion_source} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the conversion source to be undeleted. + * Format: accounts/{account}/conversionSources/{conversion_source} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/UpdateConversionSourceRequest.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/UpdateConversionSourceRequest.php new file mode 100644 index 000000000000..4250c3ae1168 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/proto/src/Google/Shopping/Merchant/Conversions/V1beta/UpdateConversionSourceRequest.php @@ -0,0 +1,141 @@ +google.shopping.merchant.conversions.v1beta.UpdateConversionSourceRequest + */ +class UpdateConversionSourceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The new version of the conversion source data. + * Format: accounts/{account}/conversionSources/{conversion_source} + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.ConversionSource conversion_source = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $conversion_source = null; + /** + * Required. List of fields being updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource $conversionSource Required. The new version of the conversion source data. + * Format: accounts/{account}/conversionSources/{conversion_source} + * @param \Google\Protobuf\FieldMask $updateMask Required. List of fields being updated. + * + * @return \Google\Shopping\Merchant\Conversions\V1beta\UpdateConversionSourceRequest + * + * @experimental + */ + public static function build(\Google\Shopping\Merchant\Conversions\V1beta\ConversionSource $conversionSource, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setConversionSource($conversionSource) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource $conversion_source + * Required. The new version of the conversion source data. + * Format: accounts/{account}/conversionSources/{conversion_source} + * @type \Google\Protobuf\FieldMask $update_mask + * Required. List of fields being updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Conversions\V1Beta\Conversionsources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The new version of the conversion source data. + * Format: accounts/{account}/conversionSources/{conversion_source} + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.ConversionSource conversion_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource|null + */ + public function getConversionSource() + { + return $this->conversion_source; + } + + public function hasConversionSource() + { + return isset($this->conversion_source); + } + + public function clearConversionSource() + { + unset($this->conversion_source); + } + + /** + * Required. The new version of the conversion source data. + * Format: accounts/{account}/conversionSources/{conversion_source} + * + * Generated from protobuf field .google.shopping.merchant.conversions.v1beta.ConversionSource conversion_source = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource $var + * @return $this + */ + public function setConversionSource($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Conversions\V1beta\ConversionSource::class); + $this->conversion_source = $var; + + return $this; + } + + /** + * Required. List of fields being updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. List of fields being updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/create_conversion_source.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/create_conversion_source.php new file mode 100644 index 000000000000..628d66f3749c --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/create_conversion_source.php @@ -0,0 +1,74 @@ +setParent($formattedParent) + ->setConversionSource($conversionSource); + + // Call the API and handle any network failures. + try { + /** @var ConversionSource $response */ + $response = $conversionSourcesServiceClient->createConversionSource($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ConversionSourcesServiceClient::accountName('[ACCOUNT]'); + + create_conversion_source_sample($formattedParent); +} +// [END merchantapi_v1beta_generated_ConversionSourcesService_CreateConversionSource_sync] diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/delete_conversion_source.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/delete_conversion_source.php new file mode 100644 index 000000000000..7e8f6058bf70 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/delete_conversion_source.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $conversionSourcesServiceClient->deleteConversionSource($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ConversionSourcesServiceClient::conversionSourceName( + '[ACCOUNT]', + '[CONVERSION_SOURCE]' + ); + + delete_conversion_source_sample($formattedName); +} +// [END merchantapi_v1beta_generated_ConversionSourcesService_DeleteConversionSource_sync] diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/get_conversion_source.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/get_conversion_source.php new file mode 100644 index 000000000000..cce96028b2de --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/get_conversion_source.php @@ -0,0 +1,75 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ConversionSource $response */ + $response = $conversionSourcesServiceClient->getConversionSource($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ConversionSourcesServiceClient::conversionSourceName( + '[ACCOUNT]', + '[CONVERSION_SOURCE]' + ); + + get_conversion_source_sample($formattedName); +} +// [END merchantapi_v1beta_generated_ConversionSourcesService_GetConversionSource_sync] diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/list_conversion_sources.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/list_conversion_sources.php new file mode 100644 index 000000000000..53a6eca6788e --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/list_conversion_sources.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $conversionSourcesServiceClient->listConversionSources($request); + + /** @var ConversionSource $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ConversionSourcesServiceClient::accountName('[ACCOUNT]'); + + list_conversion_sources_sample($formattedParent); +} +// [END merchantapi_v1beta_generated_ConversionSourcesService_ListConversionSources_sync] diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/undelete_conversion_source.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/undelete_conversion_source.php new file mode 100644 index 000000000000..61be0f71c2b1 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/undelete_conversion_source.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ConversionSource $response */ + $response = $conversionSourcesServiceClient->undeleteConversionSource($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ConversionSourcesServiceClient::conversionSourceName( + '[ACCOUNT]', + '[CONVERSION_SOURCE]' + ); + + undelete_conversion_source_sample($formattedName); +} +// [END merchantapi_v1beta_generated_ConversionSourcesService_UndeleteConversionSource_sync] diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/update_conversion_source.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/update_conversion_source.php new file mode 100644 index 000000000000..1279d6a41e7b --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/samples/V1beta/ConversionSourcesServiceClient/update_conversion_source.php @@ -0,0 +1,63 @@ +setConversionSource($conversionSource) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var ConversionSource $response */ + $response = $conversionSourcesServiceClient->updateConversionSource($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END merchantapi_v1beta_generated_ConversionSourcesService_UpdateConversionSource_sync] diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/Client/ConversionSourcesServiceClient.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/Client/ConversionSourcesServiceClient.php new file mode 100644 index 000000000000..9674851e7c78 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/Client/ConversionSourcesServiceClient.php @@ -0,0 +1,427 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/conversion_sources_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/conversion_sources_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/conversion_sources_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/conversion_sources_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a account + * resource. + * + * @param string $account + * + * @return string The formatted account resource. + * + * @experimental + */ + public static function accountName(string $account): string + { + return self::getPathTemplate('account')->render([ + 'account' => $account, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * conversion_source resource. + * + * @param string $account + * @param string $conversionSource + * + * @return string The formatted conversion_source resource. + * + * @experimental + */ + public static function conversionSourceName(string $account, string $conversionSource): string + { + return self::getPathTemplate('conversionSource')->render([ + 'account' => $account, + 'conversion_source' => $conversionSource, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - account: accounts/{account} + * - conversionSource: accounts/{account}/conversionSources/{conversion_source} + * + * 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(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'merchantapi.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new conversion source. + * + * The async variant is + * {@see ConversionSourcesServiceClient::createConversionSourceAsync()} . + * + * @example samples/V1beta/ConversionSourcesServiceClient/create_conversion_source.php + * + * @param CreateConversionSourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ConversionSource + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function createConversionSource(CreateConversionSourceRequest $request, array $callOptions = []): ConversionSource + { + return $this->startApiCall('CreateConversionSource', $request, $callOptions)->wait(); + } + + /** + * Archives an existing conversion source. If the conversion source is a + * Merchant Center Destination, it will be recoverable for 30 days. If the + * conversion source is a Google Analytics Link, it will be deleted + * immediately and can be restored by creating a new one. + * + * The async variant is + * {@see ConversionSourcesServiceClient::deleteConversionSourceAsync()} . + * + * @example samples/V1beta/ConversionSourcesServiceClient/delete_conversion_source.php + * + * @param DeleteConversionSourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Thrown if the API call fails. + * + * @experimental + */ + public function deleteConversionSource(DeleteConversionSourceRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteConversionSource', $request, $callOptions)->wait(); + } + + /** + * Fetches a conversion source. + * + * The async variant is + * {@see ConversionSourcesServiceClient::getConversionSourceAsync()} . + * + * @example samples/V1beta/ConversionSourcesServiceClient/get_conversion_source.php + * + * @param GetConversionSourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ConversionSource + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getConversionSource(GetConversionSourceRequest $request, array $callOptions = []): ConversionSource + { + return $this->startApiCall('GetConversionSource', $request, $callOptions)->wait(); + } + + /** + * Retrieves the list of conversion sources the caller has access to. + * + * The async variant is + * {@see ConversionSourcesServiceClient::listConversionSourcesAsync()} . + * + * @example samples/V1beta/ConversionSourcesServiceClient/list_conversion_sources.php + * + * @param ListConversionSourcesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function listConversionSources(ListConversionSourcesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListConversionSources', $request, $callOptions); + } + + /** + * Re-enables an archived conversion source. Only Available for Merchant + * Center Destination conversion sources. + * + * The async variant is + * {@see ConversionSourcesServiceClient::undeleteConversionSourceAsync()} . + * + * @example samples/V1beta/ConversionSourcesServiceClient/undelete_conversion_source.php + * + * @param UndeleteConversionSourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ConversionSource + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function undeleteConversionSource(UndeleteConversionSourceRequest $request, array $callOptions = []): ConversionSource + { + return $this->startApiCall('UndeleteConversionSource', $request, $callOptions)->wait(); + } + + /** + * Updates information of an existing conversion source. Available only for + * Merchant Center Destination conversion sources. + * + * The async variant is + * {@see ConversionSourcesServiceClient::updateConversionSourceAsync()} . + * + * @example samples/V1beta/ConversionSourcesServiceClient/update_conversion_source.php + * + * @param UpdateConversionSourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ConversionSource + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function updateConversionSource(UpdateConversionSourceRequest $request, array $callOptions = []): ConversionSource + { + return $this->startApiCall('UpdateConversionSource', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/gapic_metadata.json b/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/gapic_metadata.json new file mode 100644 index 000000000000..8c3a4d2928de --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/gapic_metadata.json @@ -0,0 +1,48 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.shopping.merchant.conversions.v1beta", + "libraryPackage": "Google\\Shopping\\Merchant\\Conversions\\V1beta", + "services": { + "ConversionSourcesService": { + "clients": { + "grpc": { + "libraryClient": "ConversionSourcesServiceGapicClient", + "rpcs": { + "CreateConversionSource": { + "methods": [ + "createConversionSource" + ] + }, + "DeleteConversionSource": { + "methods": [ + "deleteConversionSource" + ] + }, + "GetConversionSource": { + "methods": [ + "getConversionSource" + ] + }, + "ListConversionSources": { + "methods": [ + "listConversionSources" + ] + }, + "UndeleteConversionSource": { + "methods": [ + "undeleteConversionSource" + ] + }, + "UpdateConversionSource": { + "methods": [ + "updateConversionSource" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/resources/conversion_sources_service_client_config.json b/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/resources/conversion_sources_service_client_config.json new file mode 100644 index 000000000000..a7f105b4bb7b --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/resources/conversion_sources_service_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.shopping.merchant.conversions.v1beta.ConversionSourcesService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CreateConversionSource": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeleteConversionSource": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetConversionSource": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListConversionSources": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UndeleteConversionSource": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateConversionSource": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/resources/conversion_sources_service_descriptor_config.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/resources/conversion_sources_service_descriptor_config.php new file mode 100644 index 000000000000..85c79fc96cba --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/resources/conversion_sources_service_descriptor_config.php @@ -0,0 +1,113 @@ + [ + 'google.shopping.merchant.conversions.v1beta.ConversionSourcesService' => [ + 'CreateConversionSource' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Merchant\Conversions\V1beta\ConversionSource', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteConversionSource' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetConversionSource' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Merchant\Conversions\V1beta\ConversionSource', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListConversionSources' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getConversionSources', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Shopping\Merchant\Conversions\V1beta\ListConversionSourcesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UndeleteConversionSource' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Merchant\Conversions\V1beta\ConversionSource', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateConversionSource' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Merchant\Conversions\V1beta\ConversionSource', + 'headerParams' => [ + [ + 'keyName' => 'conversion_source.name', + 'fieldAccessors' => [ + 'getConversionSource', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'account' => 'accounts/{account}', + 'conversionSource' => 'accounts/{account}/conversionSources/{conversion_source}', + ], + ], + ], +]; diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/resources/conversion_sources_service_rest_client_config.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/resources/conversion_sources_service_rest_client_config.php new file mode 100644 index 000000000000..aec10f4e58c7 --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/src/V1beta/resources/conversion_sources_service_rest_client_config.php @@ -0,0 +1,102 @@ + [ + 'google.shopping.merchant.conversions.v1beta.ConversionSourcesService' => [ + 'CreateConversionSource' => [ + 'method' => 'post', + 'uriTemplate' => '/conversions/v1beta/{parent=accounts/*}/conversionSources', + 'body' => 'conversion_source', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteConversionSource' => [ + 'method' => 'delete', + 'uriTemplate' => '/conversions/v1beta/{name=accounts/*/conversionSources/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetConversionSource' => [ + 'method' => 'get', + 'uriTemplate' => '/conversions/v1beta/{name=accounts/*/conversionSources/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListConversionSources' => [ + 'method' => 'get', + 'uriTemplate' => '/conversions/v1beta/{parent=accounts/*}/conversionSources', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UndeleteConversionSource' => [ + 'method' => 'post', + 'uriTemplate' => '/conversions/v1beta/{name=accounts/*/conversionSources/*}:undelete', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateConversionSource' => [ + 'method' => 'patch', + 'uriTemplate' => '/conversions/v1beta/{conversion_source.name=accounts/*/conversionSources/*}', + 'body' => 'conversion_source', + 'placeholders' => [ + 'conversion_source.name' => [ + 'getters' => [ + 'getConversionSource', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/ShoppingMerchantConversions/v1beta/tests/Unit/V1beta/Client/ConversionSourcesServiceClientTest.php b/owl-bot-staging/ShoppingMerchantConversions/v1beta/tests/Unit/V1beta/Client/ConversionSourcesServiceClientTest.php new file mode 100644 index 000000000000..d35847a7e93e --- /dev/null +++ b/owl-bot-staging/ShoppingMerchantConversions/v1beta/tests/Unit/V1beta/Client/ConversionSourcesServiceClientTest.php @@ -0,0 +1,504 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ConversionSourcesServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ConversionSourcesServiceClient($options); + } + + /** @test */ + public function createConversionSourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new ConversionSource(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->accountName('[ACCOUNT]'); + $conversionSource = new ConversionSource(); + $request = (new CreateConversionSourceRequest()) + ->setParent($formattedParent) + ->setConversionSource($conversionSource); + $response = $gapicClient->createConversionSource($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.merchant.conversions.v1beta.ConversionSourcesService/CreateConversionSource', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getConversionSource(); + $this->assertProtobufEquals($conversionSource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createConversionSourceExceptionTest() + { + $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->accountName('[ACCOUNT]'); + $conversionSource = new ConversionSource(); + $request = (new CreateConversionSourceRequest()) + ->setParent($formattedParent) + ->setConversionSource($conversionSource); + try { + $gapicClient->createConversionSource($request); + // 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 deleteConversionSourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->conversionSourceName('[ACCOUNT]', '[CONVERSION_SOURCE]'); + $request = (new DeleteConversionSourceRequest()) + ->setName($formattedName); + $gapicClient->deleteConversionSource($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.merchant.conversions.v1beta.ConversionSourcesService/DeleteConversionSource', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteConversionSourceExceptionTest() + { + $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->conversionSourceName('[ACCOUNT]', '[CONVERSION_SOURCE]'); + $request = (new DeleteConversionSourceRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteConversionSource($request); + // 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 getConversionSourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new ConversionSource(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->conversionSourceName('[ACCOUNT]', '[CONVERSION_SOURCE]'); + $request = (new GetConversionSourceRequest()) + ->setName($formattedName); + $response = $gapicClient->getConversionSource($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.merchant.conversions.v1beta.ConversionSourcesService/GetConversionSource', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getConversionSourceExceptionTest() + { + $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->conversionSourceName('[ACCOUNT]', '[CONVERSION_SOURCE]'); + $request = (new GetConversionSourceRequest()) + ->setName($formattedName); + try { + $gapicClient->getConversionSource($request); + // 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 listConversionSourcesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $conversionSourcesElement = new ConversionSource(); + $conversionSources = [ + $conversionSourcesElement, + ]; + $expectedResponse = new ListConversionSourcesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setConversionSources($conversionSources); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->accountName('[ACCOUNT]'); + $request = (new ListConversionSourcesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listConversionSources($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getConversionSources()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.merchant.conversions.v1beta.ConversionSourcesService/ListConversionSources', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listConversionSourcesExceptionTest() + { + $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->accountName('[ACCOUNT]'); + $request = (new ListConversionSourcesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listConversionSources($request); + // 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 undeleteConversionSourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new ConversionSource(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->conversionSourceName('[ACCOUNT]', '[CONVERSION_SOURCE]'); + $request = (new UndeleteConversionSourceRequest()) + ->setName($formattedName); + $response = $gapicClient->undeleteConversionSource($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.merchant.conversions.v1beta.ConversionSourcesService/UndeleteConversionSource', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function undeleteConversionSourceExceptionTest() + { + $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->conversionSourceName('[ACCOUNT]', '[CONVERSION_SOURCE]'); + $request = (new UndeleteConversionSourceRequest()) + ->setName($formattedName); + try { + $gapicClient->undeleteConversionSource($request); + // 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 updateConversionSourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new ConversionSource(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $conversionSource = new ConversionSource(); + $updateMask = new FieldMask(); + $request = (new UpdateConversionSourceRequest()) + ->setConversionSource($conversionSource) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateConversionSource($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.merchant.conversions.v1beta.ConversionSourcesService/UpdateConversionSource', $actualFuncCall); + $actualValue = $actualRequestObject->getConversionSource(); + $this->assertProtobufEquals($conversionSource, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateConversionSourceExceptionTest() + { + $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 + $conversionSource = new ConversionSource(); + $updateMask = new FieldMask(); + $request = (new UpdateConversionSourceRequest()) + ->setConversionSource($conversionSource) + ->setUpdateMask($updateMask); + try { + $gapicClient->updateConversionSource($request); + // 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 createConversionSourceAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new ConversionSource(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->accountName('[ACCOUNT]'); + $conversionSource = new ConversionSource(); + $request = (new CreateConversionSourceRequest()) + ->setParent($formattedParent) + ->setConversionSource($conversionSource); + $response = $gapicClient->createConversionSourceAsync($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.shopping.merchant.conversions.v1beta.ConversionSourcesService/CreateConversionSource', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getConversionSource(); + $this->assertProtobufEquals($conversionSource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +}