diff --git a/AnalyticsAdmin/metadata/V1Alpha/AnalyticsAdmin.php b/AnalyticsAdmin/metadata/V1Alpha/AnalyticsAdmin.php
index b210d11b9d0e..14c68bfa01bd 100644
--- a/AnalyticsAdmin/metadata/V1Alpha/AnalyticsAdmin.php
+++ b/AnalyticsAdmin/metadata/V1Alpha/AnalyticsAdmin.php
@@ -30,7 +30,7 @@ public static function initOnce() {
\GPBMetadata\Google\Protobuf\Timestamp::initOnce();
$pool->internalAddGeneratedFile(
'
-â°
+ÁÀ
4google/analytics/admin/v1alpha/analytics_admin.protogoogle.analytics.admin.v1alpha-google/analytics/admin/v1alpha/audience.proto2google/analytics/admin/v1alpha/channel_group.proto:google/analytics/admin/v1alpha/event_create_and_edit.proto6google/analytics/admin/v1alpha/expanded_data_set.proto.google/analytics/admin/v1alpha/resources.proto=google/analytics/admin/v1alpha/subproperty_event_filter.protogoogle/api/annotations.protogoogle/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.protogoogle/protobuf/empty.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"à
RunAccessReportRequest
entity ( C
@@ -332,7 +332,28 @@ public static function initOnce() {
*analyticsadmin.googleapis.com/CustomMetric"Z
GetCustomMetricRequest@
name ( B2àAúA,
-*analyticsadmin.googleapis.com/CustomMetric"l
+*analyticsadmin.googleapis.com/CustomMetric"Ü
+CreateCalculatedMetricRequestF
+parent ( B6àAúA0.analyticsadmin.googleapis.com/CalculatedMetric!
+calculated_metric_id ( BàAP
+calculated_metric (20.google.analytics.admin.v1alpha.CalculatedMetricBàA"§
+UpdateCalculatedMetricRequestP
+calculated_metric (20.google.analytics.admin.v1alpha.CalculatedMetricBàA4
+update_mask (2.google.protobuf.FieldMaskBàA"e
+DeleteCalculatedMetricRequestD
+name ( B6àAúA0
+.analyticsadmin.googleapis.com/CalculatedMetric"—
+ListCalculatedMetricsRequestF
+parent ( B6àAúA0.analyticsadmin.googleapis.com/CalculatedMetric
+ page_size (BàA
+
+page_token ( BàA"†
+ListCalculatedMetricsResponseL
+calculated_metrics (20.google.analytics.admin.v1alpha.CalculatedMetric
+next_page_token ( "b
+GetCalculatedMetricRequestD
+name ( B6àAúA0
+.analyticsadmin.googleapis.com/CalculatedMetric"l
GetDataRetentionSettingsRequestI
name ( B;àAúA5
3analyticsadmin.googleapis.com/DataRetentionSettings"·
@@ -597,7 +618,7 @@ public static function initOnce() {
update_mask (2.google.protobuf.FieldMaskBàA"q
#DeleteSubpropertyEventFilterRequestJ
name ( B<àAúA6
-4analyticsadmin.googleapis.com/SubpropertyEventFilter2ûî
+4analyticsadmin.googleapis.com/SubpropertyEventFilter2ã÷
AnalyticsAdminService“
GetAccount1.google.analytics.admin.v1alpha.GetAccountRequest\'.google.analytics.admin.v1alpha.Account")‚Óä“/v1alpha/{name=accounts/*}ÚAname”
@@ -719,7 +740,12 @@ public static function initOnce() {
UpdateEventCreateRule<.google.analytics.admin.v1alpha.UpdateEventCreateRuleRequest/.google.analytics.admin.v1alpha.EventCreateRule"Š‚Óä“d2O/v1alpha/{event_create_rule.name=properties/*/dataStreams/*/eventCreateRules/*}:event_create_ruleÚAevent_create_rule,update_mask»
DeleteEventCreateRule<.google.analytics.admin.v1alpha.DeleteEventCreateRuleRequest.google.protobuf.Empty"L‚Óä“?*=/v1alpha/{name=properties/*/dataStreams/*/eventCreateRules/*}ÚAnameº
UpdateDataRedactionSettingsB.google.analytics.admin.v1alpha.UpdateDataRedactionSettingsRequest5.google.analytics.admin.v1alpha.DataRedactionSettings"Ÿ‚Óä“s2X/v1alpha/{data_redaction_settings.name=properties/*/dataStreams/*/dataRedactionSettings}:data_redaction_settingsÚA#data_redaction_settings,update_maskã
-GetDataRedactionSettings?.google.analytics.admin.v1alpha.GetDataRedactionSettingsRequest5.google.analytics.admin.v1alpha.DataRedactionSettings"O‚Óä“B@/v1alpha/{name=properties/*/dataStreams/*/dataRedactionSettings}ÚAnameÆ
+GetDataRedactionSettings?.google.analytics.admin.v1alpha.GetDataRedactionSettingsRequest5.google.analytics.admin.v1alpha.DataRedactionSettings"O‚Óä“B@/v1alpha/{name=properties/*/dataStreams/*/dataRedactionSettings}ÚAnameÄ
+GetCalculatedMetric:.google.analytics.admin.v1alpha.GetCalculatedMetricRequest0.google.analytics.admin.v1alpha.CalculatedMetric"?‚Óä“20/v1alpha/{name=properties/*/calculatedMetrics/*}ÚAname†
+CreateCalculatedMetric=.google.analytics.admin.v1alpha.CreateCalculatedMetricRequest0.google.analytics.admin.v1alpha.CalculatedMetric"{‚Óä“E"0/v1alpha/{parent=properties/*}/calculatedMetrics:calculated_metricÚA-parent,calculated_metric,calculated_metric_id×
+ListCalculatedMetrics<.google.analytics.admin.v1alpha.ListCalculatedMetricsRequest=.google.analytics.admin.v1alpha.ListCalculatedMetricsResponse"A‚Óä“20/v1alpha/{parent=properties/*}/calculatedMetricsÚAparentˆ
+UpdateCalculatedMetric=.google.analytics.admin.v1alpha.UpdateCalculatedMetricRequest0.google.analytics.admin.v1alpha.CalculatedMetric"}‚Óä“W2B/v1alpha/{calculated_metric.name=properties/*/calculatedMetrics/*}:calculated_metricÚAcalculated_metric,update_mask°
+DeleteCalculatedMetric=.google.analytics.admin.v1alpha.DeleteCalculatedMetricRequest.google.protobuf.Empty"?‚Óä“2*0/v1alpha/{name=properties/*/calculatedMetrics/*}ÚAnameÆ
CreateRollupProperty;.google.analytics.admin.v1alpha.CreateRollupPropertyRequest<.google.analytics.admin.v1alpha.CreateRollupPropertyResponse"3‚Óä“-"(/v1alpha/properties:createRollupProperty:*ä
GetRollupPropertySourceLinkB.google.analytics.admin.v1alpha.GetRollupPropertySourceLinkRequest8.google.analytics.admin.v1alpha.RollupPropertySourceLink"G‚Óä“:8/v1alpha/{name=properties/*/rollupPropertySourceLinks/*}ÚAname÷
ListRollupPropertySourceLinksD.google.analytics.admin.v1alpha.ListRollupPropertySourceLinksRequestE.google.analytics.admin.v1alpha.ListRollupPropertySourceLinksResponse"I‚Óä“:8/v1alpha/{parent=properties/*}/rollupPropertySourceLinksÚAparent¦
diff --git a/AnalyticsAdmin/metadata/V1Alpha/Resources.php b/AnalyticsAdmin/metadata/V1Alpha/Resources.php
index 0eab4ba71b7c..0c764e72c1ec 100644
Binary files a/AnalyticsAdmin/metadata/V1Alpha/Resources.php and b/AnalyticsAdmin/metadata/V1Alpha/Resources.php differ
diff --git a/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/create_calculated_metric.php b/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/create_calculated_metric.php
new file mode 100644
index 000000000000..9b4c8e486e1d
--- /dev/null
+++ b/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/create_calculated_metric.php
@@ -0,0 +1,112 @@
+setDisplayName($calculatedMetricDisplayName)
+ ->setMetricUnit($calculatedMetricMetricUnit)
+ ->setFormula($calculatedMetricFormula);
+ $request = (new CreateCalculatedMetricRequest())
+ ->setParent($formattedParent)
+ ->setCalculatedMetricId($calculatedMetricId)
+ ->setCalculatedMetric($calculatedMetric);
+
+ // Call the API and handle any network failures.
+ try {
+ /** @var CalculatedMetric $response */
+ $response = $analyticsAdminServiceClient->createCalculatedMetric($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 = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
+ $calculatedMetricId = '[CALCULATED_METRIC_ID]';
+ $calculatedMetricDisplayName = '[DISPLAY_NAME]';
+ $calculatedMetricMetricUnit = MetricUnit::METRIC_UNIT_UNSPECIFIED;
+ $calculatedMetricFormula = '[FORMULA]';
+
+ create_calculated_metric_sample(
+ $formattedParent,
+ $calculatedMetricId,
+ $calculatedMetricDisplayName,
+ $calculatedMetricMetricUnit,
+ $calculatedMetricFormula
+ );
+}
+// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCalculatedMetric_sync]
diff --git a/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/delete_calculated_metric.php b/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/delete_calculated_metric.php
new file mode 100644
index 000000000000..851bdbfeed77
--- /dev/null
+++ b/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/delete_calculated_metric.php
@@ -0,0 +1,74 @@
+setName($formattedName);
+
+ // Call the API and handle any network failures.
+ try {
+ $analyticsAdminServiceClient->deleteCalculatedMetric($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 = AnalyticsAdminServiceClient::calculatedMetricName(
+ '[PROPERTY]',
+ '[CALCULATED_METRIC]'
+ );
+
+ delete_calculated_metric_sample($formattedName);
+}
+// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteCalculatedMetric_sync]
diff --git a/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/get_calculated_metric.php b/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/get_calculated_metric.php
new file mode 100644
index 000000000000..84bd845aea62
--- /dev/null
+++ b/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/get_calculated_metric.php
@@ -0,0 +1,76 @@
+setName($formattedName);
+
+ // Call the API and handle any network failures.
+ try {
+ /** @var CalculatedMetric $response */
+ $response = $analyticsAdminServiceClient->getCalculatedMetric($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 = AnalyticsAdminServiceClient::calculatedMetricName(
+ '[PROPERTY]',
+ '[CALCULATED_METRIC]'
+ );
+
+ get_calculated_metric_sample($formattedName);
+}
+// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCalculatedMetric_sync]
diff --git a/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/list_calculated_metrics.php b/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/list_calculated_metrics.php
new file mode 100644
index 000000000000..f140df8b4c96
--- /dev/null
+++ b/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/list_calculated_metrics.php
@@ -0,0 +1,76 @@
+setParent($formattedParent);
+
+ // Call the API and handle any network failures.
+ try {
+ /** @var PagedListResponse $response */
+ $response = $analyticsAdminServiceClient->listCalculatedMetrics($request);
+
+ /** @var CalculatedMetric $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 = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
+
+ list_calculated_metrics_sample($formattedParent);
+}
+// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCalculatedMetrics_sync]
diff --git a/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/search_change_history_events.php b/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/search_change_history_events.php
index 968839c9c599..587a15a62ea3 100644
--- a/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/search_change_history_events.php
+++ b/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/search_change_history_events.php
@@ -34,8 +34,8 @@
* specified set of filters.
*
* @param string $formattedAccount The account resource for which to return change history
- * resources. Please see
- * {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
+ * resources. Format: accounts/{account} Example: "accounts/100"
+ * Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
*/
function search_change_history_events_sample(string $formattedAccount): void
{
diff --git a/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/update_calculated_metric.php b/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/update_calculated_metric.php
new file mode 100644
index 000000000000..3d911647f31d
--- /dev/null
+++ b/AnalyticsAdmin/samples/V1alpha/AnalyticsAdminServiceClient/update_calculated_metric.php
@@ -0,0 +1,96 @@
+setDisplayName($calculatedMetricDisplayName)
+ ->setMetricUnit($calculatedMetricMetricUnit)
+ ->setFormula($calculatedMetricFormula);
+ $updateMask = new FieldMask();
+ $request = (new UpdateCalculatedMetricRequest())
+ ->setCalculatedMetric($calculatedMetric)
+ ->setUpdateMask($updateMask);
+
+ // Call the API and handle any network failures.
+ try {
+ /** @var CalculatedMetric $response */
+ $response = $analyticsAdminServiceClient->updateCalculatedMetric($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
+{
+ $calculatedMetricDisplayName = '[DISPLAY_NAME]';
+ $calculatedMetricMetricUnit = MetricUnit::METRIC_UNIT_UNSPECIFIED;
+ $calculatedMetricFormula = '[FORMULA]';
+
+ update_calculated_metric_sample(
+ $calculatedMetricDisplayName,
+ $calculatedMetricMetricUnit,
+ $calculatedMetricFormula
+ );
+}
+// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCalculatedMetric_sync]
diff --git a/AnalyticsAdmin/src/V1alpha/CalculatedMetric.php b/AnalyticsAdmin/src/V1alpha/CalculatedMetric.php
new file mode 100644
index 000000000000..10f0a1d84d8a
--- /dev/null
+++ b/AnalyticsAdmin/src/V1alpha/CalculatedMetric.php
@@ -0,0 +1,361 @@
+google.analytics.admin.v1alpha.CalculatedMetric
+ */
+class CalculatedMetric extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Output only. Resource name for this CalculatedMetric.
+ * Format: 'properties/{property_id}/calculatedMetrics/{calculated_metric_id}'
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $name = '';
+ /**
+ * Optional. Description for this calculated metric.
+ * Max length of 4096 characters.
+ *
+ * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ private $description = '';
+ /**
+ * Required. Display name for this calculated metric as shown in the
+ * Google Analytics UI. Max length 82 characters.
+ *
+ * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $display_name = '';
+ /**
+ * Output only. The ID to use for the calculated metric. In the UI, this is
+ * referred to as the "API name."
+ * The calculated_metric_id is used when referencing this calculated metric
+ * from external APIs. For example, "calcMetric:{calculated_metric_id}".
+ *
+ * Generated from protobuf field string calculated_metric_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $calculated_metric_id = '';
+ /**
+ * Required. The type for the calculated metric's value.
+ *
+ * Generated from protobuf field .google.analytics.admin.v1alpha.CalculatedMetric.MetricUnit metric_unit = 5 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $metric_unit = 0;
+ /**
+ * Output only. Types of restricted data that this metric contains.
+ *
+ * Generated from protobuf field repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $restricted_metric_type;
+ /**
+ * Required. The calculated metric's definition. Maximum number of unique
+ * referenced custom metrics is 5. Formulas supports the following operations:
+ * + (addition), - (subtraction), - (negative), * (multiplication), /
+ * (division), () (parenthesis). Any valid real numbers are acceptable that
+ * fit in a Long (64bit integer) or a Double (64 bit floating point number).
+ * Example formula:
+ * "( customEvent:parameter_name + cartPurchaseQuantity ) / 2.0"
+ *
+ * Generated from protobuf field string formula = 7 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $formula = '';
+ /**
+ * Output only. If true, this calculated metric has a invalid metric
+ * reference. Anything using a calculated metric with invalid_metric_reference
+ * set to true may fail, produce warnings, or produce unexpected results.
+ *
+ * Generated from protobuf field bool invalid_metric_reference = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $invalid_metric_reference = false;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Output only. Resource name for this CalculatedMetric.
+ * Format: 'properties/{property_id}/calculatedMetrics/{calculated_metric_id}'
+ * @type string $description
+ * Optional. Description for this calculated metric.
+ * Max length of 4096 characters.
+ * @type string $display_name
+ * Required. Display name for this calculated metric as shown in the
+ * Google Analytics UI. Max length 82 characters.
+ * @type string $calculated_metric_id
+ * Output only. The ID to use for the calculated metric. In the UI, this is
+ * referred to as the "API name."
+ * The calculated_metric_id is used when referencing this calculated metric
+ * from external APIs. For example, "calcMetric:{calculated_metric_id}".
+ * @type int $metric_unit
+ * Required. The type for the calculated metric's value.
+ * @type array|\Google\Protobuf\Internal\RepeatedField $restricted_metric_type
+ * Output only. Types of restricted data that this metric contains.
+ * @type string $formula
+ * Required. The calculated metric's definition. Maximum number of unique
+ * referenced custom metrics is 5. Formulas supports the following operations:
+ * + (addition), - (subtraction), - (negative), * (multiplication), /
+ * (division), () (parenthesis). Any valid real numbers are acceptable that
+ * fit in a Long (64bit integer) or a Double (64 bit floating point number).
+ * Example formula:
+ * "( customEvent:parameter_name + cartPurchaseQuantity ) / 2.0"
+ * @type bool $invalid_metric_reference
+ * Output only. If true, this calculated metric has a invalid metric
+ * reference. Anything using a calculated metric with invalid_metric_reference
+ * set to true may fail, produce warnings, or produce unexpected results.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Analytics\Admin\V1Alpha\Resources::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Output only. Resource name for this CalculatedMetric.
+ * Format: 'properties/{property_id}/calculatedMetrics/{calculated_metric_id}'
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Output only. Resource name for this CalculatedMetric.
+ * Format: 'properties/{property_id}/calculatedMetrics/{calculated_metric_id}'
+ *
+ * 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;
+ }
+
+ /**
+ * Optional. Description for this calculated metric.
+ * Max length of 4096 characters.
+ *
+ * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Optional. Description for this calculated metric.
+ * Max length of 4096 characters.
+ *
+ * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @param string $var
+ * @return $this
+ */
+ public function setDescription($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->description = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. Display name for this calculated metric as shown in the
+ * Google Analytics UI. Max length 82 characters.
+ *
+ * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getDisplayName()
+ {
+ return $this->display_name;
+ }
+
+ /**
+ * Required. Display name for this calculated metric as shown in the
+ * Google Analytics UI. Max length 82 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;
+ }
+
+ /**
+ * Output only. The ID to use for the calculated metric. In the UI, this is
+ * referred to as the "API name."
+ * The calculated_metric_id is used when referencing this calculated metric
+ * from external APIs. For example, "calcMetric:{calculated_metric_id}".
+ *
+ * Generated from protobuf field string calculated_metric_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return string
+ */
+ public function getCalculatedMetricId()
+ {
+ return $this->calculated_metric_id;
+ }
+
+ /**
+ * Output only. The ID to use for the calculated metric. In the UI, this is
+ * referred to as the "API name."
+ * The calculated_metric_id is used when referencing this calculated metric
+ * from external APIs. For example, "calcMetric:{calculated_metric_id}".
+ *
+ * Generated from protobuf field string calculated_metric_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param string $var
+ * @return $this
+ */
+ public function setCalculatedMetricId($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->calculated_metric_id = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. The type for the calculated metric's value.
+ *
+ * Generated from protobuf field .google.analytics.admin.v1alpha.CalculatedMetric.MetricUnit metric_unit = 5 [(.google.api.field_behavior) = REQUIRED];
+ * @return int
+ */
+ public function getMetricUnit()
+ {
+ return $this->metric_unit;
+ }
+
+ /**
+ * Required. The type for the calculated metric's value.
+ *
+ * Generated from protobuf field .google.analytics.admin.v1alpha.CalculatedMetric.MetricUnit metric_unit = 5 [(.google.api.field_behavior) = REQUIRED];
+ * @param int $var
+ * @return $this
+ */
+ public function setMetricUnit($var)
+ {
+ GPBUtil::checkEnum($var, \Google\Analytics\Admin\V1alpha\CalculatedMetric\MetricUnit::class);
+ $this->metric_unit = $var;
+
+ return $this;
+ }
+
+ /**
+ * Output only. Types of restricted data that this metric contains.
+ *
+ * Generated from protobuf field repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getRestrictedMetricType()
+ {
+ return $this->restricted_metric_type;
+ }
+
+ /**
+ * Output only. Types of restricted data that this metric contains.
+ *
+ * Generated from protobuf field repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param array|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setRestrictedMetricType($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Analytics\Admin\V1alpha\CalculatedMetric\RestrictedMetricType::class);
+ $this->restricted_metric_type = $arr;
+
+ return $this;
+ }
+
+ /**
+ * Required. The calculated metric's definition. Maximum number of unique
+ * referenced custom metrics is 5. Formulas supports the following operations:
+ * + (addition), - (subtraction), - (negative), * (multiplication), /
+ * (division), () (parenthesis). Any valid real numbers are acceptable that
+ * fit in a Long (64bit integer) or a Double (64 bit floating point number).
+ * Example formula:
+ * "( customEvent:parameter_name + cartPurchaseQuantity ) / 2.0"
+ *
+ * Generated from protobuf field string formula = 7 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getFormula()
+ {
+ return $this->formula;
+ }
+
+ /**
+ * Required. The calculated metric's definition. Maximum number of unique
+ * referenced custom metrics is 5. Formulas supports the following operations:
+ * + (addition), - (subtraction), - (negative), * (multiplication), /
+ * (division), () (parenthesis). Any valid real numbers are acceptable that
+ * fit in a Long (64bit integer) or a Double (64 bit floating point number).
+ * Example formula:
+ * "( customEvent:parameter_name + cartPurchaseQuantity ) / 2.0"
+ *
+ * Generated from protobuf field string formula = 7 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setFormula($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->formula = $var;
+
+ return $this;
+ }
+
+ /**
+ * Output only. If true, this calculated metric has a invalid metric
+ * reference. Anything using a calculated metric with invalid_metric_reference
+ * set to true may fail, produce warnings, or produce unexpected results.
+ *
+ * Generated from protobuf field bool invalid_metric_reference = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return bool
+ */
+ public function getInvalidMetricReference()
+ {
+ return $this->invalid_metric_reference;
+ }
+
+ /**
+ * Output only. If true, this calculated metric has a invalid metric
+ * reference. Anything using a calculated metric with invalid_metric_reference
+ * set to true may fail, produce warnings, or produce unexpected results.
+ *
+ * Generated from protobuf field bool invalid_metric_reference = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param bool $var
+ * @return $this
+ */
+ public function setInvalidMetricReference($var)
+ {
+ GPBUtil::checkBool($var);
+ $this->invalid_metric_reference = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/AnalyticsAdmin/src/V1alpha/CalculatedMetric/MetricUnit.php b/AnalyticsAdmin/src/V1alpha/CalculatedMetric/MetricUnit.php
new file mode 100644
index 000000000000..d250ca5fa645
--- /dev/null
+++ b/AnalyticsAdmin/src/V1alpha/CalculatedMetric/MetricUnit.php
@@ -0,0 +1,120 @@
+google.analytics.admin.v1alpha.CalculatedMetric.MetricUnit
+ */
+class MetricUnit
+{
+ /**
+ * MetricUnit unspecified or missing.
+ *
+ * Generated from protobuf enum METRIC_UNIT_UNSPECIFIED = 0;
+ */
+ const METRIC_UNIT_UNSPECIFIED = 0;
+ /**
+ * This metric uses default units.
+ *
+ * Generated from protobuf enum STANDARD = 1;
+ */
+ const STANDARD = 1;
+ /**
+ * This metric measures a currency.
+ *
+ * Generated from protobuf enum CURRENCY = 2;
+ */
+ const CURRENCY = 2;
+ /**
+ * This metric measures feet.
+ *
+ * Generated from protobuf enum FEET = 3;
+ */
+ const FEET = 3;
+ /**
+ * This metric measures miles.
+ *
+ * Generated from protobuf enum MILES = 4;
+ */
+ const MILES = 4;
+ /**
+ * This metric measures meters.
+ *
+ * Generated from protobuf enum METERS = 5;
+ */
+ const METERS = 5;
+ /**
+ * This metric measures kilometers.
+ *
+ * Generated from protobuf enum KILOMETERS = 6;
+ */
+ const KILOMETERS = 6;
+ /**
+ * This metric measures milliseconds.
+ *
+ * Generated from protobuf enum MILLISECONDS = 7;
+ */
+ const MILLISECONDS = 7;
+ /**
+ * This metric measures seconds.
+ *
+ * Generated from protobuf enum SECONDS = 8;
+ */
+ const SECONDS = 8;
+ /**
+ * This metric measures minutes.
+ *
+ * Generated from protobuf enum MINUTES = 9;
+ */
+ const MINUTES = 9;
+ /**
+ * This metric measures hours.
+ *
+ * Generated from protobuf enum HOURS = 10;
+ */
+ const HOURS = 10;
+
+ private static $valueToName = [
+ self::METRIC_UNIT_UNSPECIFIED => 'METRIC_UNIT_UNSPECIFIED',
+ self::STANDARD => 'STANDARD',
+ self::CURRENCY => 'CURRENCY',
+ self::FEET => 'FEET',
+ self::MILES => 'MILES',
+ self::METERS => 'METERS',
+ self::KILOMETERS => 'KILOMETERS',
+ self::MILLISECONDS => 'MILLISECONDS',
+ self::SECONDS => 'SECONDS',
+ self::MINUTES => 'MINUTES',
+ self::HOURS => 'HOURS',
+ ];
+
+ 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(MetricUnit::class, \Google\Analytics\Admin\V1alpha\CalculatedMetric_MetricUnit::class);
+
diff --git a/AnalyticsAdmin/src/V1alpha/CalculatedMetric/RestrictedMetricType.php b/AnalyticsAdmin/src/V1alpha/CalculatedMetric/RestrictedMetricType.php
new file mode 100644
index 000000000000..3443ac49b443
--- /dev/null
+++ b/AnalyticsAdmin/src/V1alpha/CalculatedMetric/RestrictedMetricType.php
@@ -0,0 +1,65 @@
+google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType
+ */
+class RestrictedMetricType
+{
+ /**
+ * Type unknown or unspecified.
+ *
+ * Generated from protobuf enum RESTRICTED_METRIC_TYPE_UNSPECIFIED = 0;
+ */
+ const RESTRICTED_METRIC_TYPE_UNSPECIFIED = 0;
+ /**
+ * Metric reports cost data.
+ *
+ * Generated from protobuf enum COST_DATA = 1;
+ */
+ const COST_DATA = 1;
+ /**
+ * Metric reports revenue data.
+ *
+ * Generated from protobuf enum REVENUE_DATA = 2;
+ */
+ const REVENUE_DATA = 2;
+
+ private static $valueToName = [
+ self::RESTRICTED_METRIC_TYPE_UNSPECIFIED => 'RESTRICTED_METRIC_TYPE_UNSPECIFIED',
+ self::COST_DATA => 'COST_DATA',
+ self::REVENUE_DATA => 'REVENUE_DATA',
+ ];
+
+ 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(RestrictedMetricType::class, \Google\Analytics\Admin\V1alpha\CalculatedMetric_RestrictedMetricType::class);
+
diff --git a/AnalyticsAdmin/src/V1alpha/ChangeHistoryChange/ChangeHistoryResource.php b/AnalyticsAdmin/src/V1alpha/ChangeHistoryChange/ChangeHistoryResource.php
index 782755107f06..28c4f33e6054 100644
--- a/AnalyticsAdmin/src/V1alpha/ChangeHistoryChange/ChangeHistoryResource.php
+++ b/AnalyticsAdmin/src/V1alpha/ChangeHistoryChange/ChangeHistoryResource.php
@@ -75,6 +75,8 @@ class ChangeHistoryResource extends \Google\Protobuf\Internal\Message
* A snapshot of an Audience resource in change history.
* @type \Google\Analytics\Admin\V1alpha\EventCreateRule $event_create_rule
* A snapshot of an EventCreateRule resource in change history.
+ * @type \Google\Analytics\Admin\V1alpha\CalculatedMetric $calculated_metric
+ * A snapshot of a CalculatedMetric resource in change history.
* }
*/
public function __construct($data = NULL) {
@@ -832,6 +834,37 @@ public function setEventCreateRule($var)
return $this;
}
+ /**
+ * A snapshot of a CalculatedMetric resource in change history.
+ *
+ * Generated from protobuf field .google.analytics.admin.v1alpha.CalculatedMetric calculated_metric = 31;
+ * @return \Google\Analytics\Admin\V1alpha\CalculatedMetric|null
+ */
+ public function getCalculatedMetric()
+ {
+ return $this->readOneof(31);
+ }
+
+ public function hasCalculatedMetric()
+ {
+ return $this->hasOneof(31);
+ }
+
+ /**
+ * A snapshot of a CalculatedMetric resource in change history.
+ *
+ * Generated from protobuf field .google.analytics.admin.v1alpha.CalculatedMetric calculated_metric = 31;
+ * @param \Google\Analytics\Admin\V1alpha\CalculatedMetric $var
+ * @return $this
+ */
+ public function setCalculatedMetric($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Analytics\Admin\V1alpha\CalculatedMetric::class);
+ $this->writeOneof(31, $var);
+
+ return $this;
+ }
+
/**
* @return string
*/
diff --git a/AnalyticsAdmin/src/V1alpha/ChangeHistoryResourceType.php b/AnalyticsAdmin/src/V1alpha/ChangeHistoryResourceType.php
index f42497a79ac6..c6ebdef9b099 100644
--- a/AnalyticsAdmin/src/V1alpha/ChangeHistoryResourceType.php
+++ b/AnalyticsAdmin/src/V1alpha/ChangeHistoryResourceType.php
@@ -157,6 +157,12 @@ class ChangeHistoryResourceType
* Generated from protobuf enum EVENT_CREATE_RULE = 29;
*/
const EVENT_CREATE_RULE = 29;
+ /**
+ * CalculatedMetric resource
+ *
+ * Generated from protobuf enum CALCULATED_METRIC = 31;
+ */
+ const CALCULATED_METRIC = 31;
private static $valueToName = [
self::CHANGE_HISTORY_RESOURCE_TYPE_UNSPECIFIED => 'CHANGE_HISTORY_RESOURCE_TYPE_UNSPECIFIED',
@@ -183,6 +189,7 @@ class ChangeHistoryResourceType
self::ADSENSE_LINK => 'ADSENSE_LINK',
self::AUDIENCE => 'AUDIENCE',
self::EVENT_CREATE_RULE => 'EVENT_CREATE_RULE',
+ self::CALCULATED_METRIC => 'CALCULATED_METRIC',
];
public static function name($value)
diff --git a/AnalyticsAdmin/src/V1alpha/Client/AnalyticsAdminServiceClient.php b/AnalyticsAdmin/src/V1alpha/Client/AnalyticsAdminServiceClient.php
index 428ea2b94aa6..62b37b74df17 100644
--- a/AnalyticsAdmin/src/V1alpha/Client/AnalyticsAdminServiceClient.php
+++ b/AnalyticsAdmin/src/V1alpha/Client/AnalyticsAdminServiceClient.php
@@ -46,12 +46,14 @@
use Google\Analytics\Admin\V1alpha\BatchUpdateAccessBindingsRequest;
use Google\Analytics\Admin\V1alpha\BatchUpdateAccessBindingsResponse;
use Google\Analytics\Admin\V1alpha\BigQueryLink;
+use Google\Analytics\Admin\V1alpha\CalculatedMetric;
use Google\Analytics\Admin\V1alpha\CancelDisplayVideo360AdvertiserLinkProposalRequest;
use Google\Analytics\Admin\V1alpha\ChannelGroup;
use Google\Analytics\Admin\V1alpha\ConversionEvent;
use Google\Analytics\Admin\V1alpha\CreateAccessBindingRequest;
use Google\Analytics\Admin\V1alpha\CreateAdSenseLinkRequest;
use Google\Analytics\Admin\V1alpha\CreateAudienceRequest;
+use Google\Analytics\Admin\V1alpha\CreateCalculatedMetricRequest;
use Google\Analytics\Admin\V1alpha\CreateChannelGroupRequest;
use Google\Analytics\Admin\V1alpha\CreateConnectedSiteTagRequest;
use Google\Analytics\Admin\V1alpha\CreateConnectedSiteTagResponse;
@@ -84,6 +86,7 @@
use Google\Analytics\Admin\V1alpha\DeleteAccessBindingRequest;
use Google\Analytics\Admin\V1alpha\DeleteAccountRequest;
use Google\Analytics\Admin\V1alpha\DeleteAdSenseLinkRequest;
+use Google\Analytics\Admin\V1alpha\DeleteCalculatedMetricRequest;
use Google\Analytics\Admin\V1alpha\DeleteChannelGroupRequest;
use Google\Analytics\Admin\V1alpha\DeleteConnectedSiteTagRequest;
use Google\Analytics\Admin\V1alpha\DeleteConversionEventRequest;
@@ -116,6 +119,7 @@
use Google\Analytics\Admin\V1alpha\GetAttributionSettingsRequest;
use Google\Analytics\Admin\V1alpha\GetAudienceRequest;
use Google\Analytics\Admin\V1alpha\GetBigQueryLinkRequest;
+use Google\Analytics\Admin\V1alpha\GetCalculatedMetricRequest;
use Google\Analytics\Admin\V1alpha\GetChannelGroupRequest;
use Google\Analytics\Admin\V1alpha\GetConversionEventRequest;
use Google\Analytics\Admin\V1alpha\GetCustomDimensionRequest;
@@ -146,6 +150,7 @@
use Google\Analytics\Admin\V1alpha\ListAdSenseLinksRequest;
use Google\Analytics\Admin\V1alpha\ListAudiencesRequest;
use Google\Analytics\Admin\V1alpha\ListBigQueryLinksRequest;
+use Google\Analytics\Admin\V1alpha\ListCalculatedMetricsRequest;
use Google\Analytics\Admin\V1alpha\ListChannelGroupsRequest;
use Google\Analytics\Admin\V1alpha\ListConnectedSiteTagsRequest;
use Google\Analytics\Admin\V1alpha\ListConnectedSiteTagsResponse;
@@ -182,6 +187,7 @@
use Google\Analytics\Admin\V1alpha\UpdateAccountRequest;
use Google\Analytics\Admin\V1alpha\UpdateAttributionSettingsRequest;
use Google\Analytics\Admin\V1alpha\UpdateAudienceRequest;
+use Google\Analytics\Admin\V1alpha\UpdateCalculatedMetricRequest;
use Google\Analytics\Admin\V1alpha\UpdateChannelGroupRequest;
use Google\Analytics\Admin\V1alpha\UpdateConversionEventRequest;
use Google\Analytics\Admin\V1alpha\UpdateCustomDimensionRequest;
@@ -237,6 +243,7 @@
* @method PromiseInterface createAccessBindingAsync(CreateAccessBindingRequest $request, array $optionalArgs = [])
* @method PromiseInterface createAdSenseLinkAsync(CreateAdSenseLinkRequest $request, array $optionalArgs = [])
* @method PromiseInterface createAudienceAsync(CreateAudienceRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface createCalculatedMetricAsync(CreateCalculatedMetricRequest $request, array $optionalArgs = [])
* @method PromiseInterface createChannelGroupAsync(CreateChannelGroupRequest $request, array $optionalArgs = [])
* @method PromiseInterface createConnectedSiteTagAsync(CreateConnectedSiteTagRequest $request, array $optionalArgs = [])
* @method PromiseInterface createConversionEventAsync(CreateConversionEventRequest $request, array $optionalArgs = [])
@@ -260,6 +267,7 @@
* @method PromiseInterface deleteAccessBindingAsync(DeleteAccessBindingRequest $request, array $optionalArgs = [])
* @method PromiseInterface deleteAccountAsync(DeleteAccountRequest $request, array $optionalArgs = [])
* @method PromiseInterface deleteAdSenseLinkAsync(DeleteAdSenseLinkRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface deleteCalculatedMetricAsync(DeleteCalculatedMetricRequest $request, array $optionalArgs = [])
* @method PromiseInterface deleteChannelGroupAsync(DeleteChannelGroupRequest $request, array $optionalArgs = [])
* @method PromiseInterface deleteConnectedSiteTagAsync(DeleteConnectedSiteTagRequest $request, array $optionalArgs = [])
* @method PromiseInterface deleteConversionEventAsync(DeleteConversionEventRequest $request, array $optionalArgs = [])
@@ -284,6 +292,7 @@
* @method PromiseInterface getAttributionSettingsAsync(GetAttributionSettingsRequest $request, array $optionalArgs = [])
* @method PromiseInterface getAudienceAsync(GetAudienceRequest $request, array $optionalArgs = [])
* @method PromiseInterface getBigQueryLinkAsync(GetBigQueryLinkRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface getCalculatedMetricAsync(GetCalculatedMetricRequest $request, array $optionalArgs = [])
* @method PromiseInterface getChannelGroupAsync(GetChannelGroupRequest $request, array $optionalArgs = [])
* @method PromiseInterface getConversionEventAsync(GetConversionEventRequest $request, array $optionalArgs = [])
* @method PromiseInterface getCustomDimensionAsync(GetCustomDimensionRequest $request, array $optionalArgs = [])
@@ -311,6 +320,7 @@
* @method PromiseInterface listAdSenseLinksAsync(ListAdSenseLinksRequest $request, array $optionalArgs = [])
* @method PromiseInterface listAudiencesAsync(ListAudiencesRequest $request, array $optionalArgs = [])
* @method PromiseInterface listBigQueryLinksAsync(ListBigQueryLinksRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface listCalculatedMetricsAsync(ListCalculatedMetricsRequest $request, array $optionalArgs = [])
* @method PromiseInterface listChannelGroupsAsync(ListChannelGroupsRequest $request, array $optionalArgs = [])
* @method PromiseInterface listConnectedSiteTagsAsync(ListConnectedSiteTagsRequest $request, array $optionalArgs = [])
* @method PromiseInterface listConversionEventsAsync(ListConversionEventsRequest $request, array $optionalArgs = [])
@@ -337,6 +347,7 @@
* @method PromiseInterface updateAccountAsync(UpdateAccountRequest $request, array $optionalArgs = [])
* @method PromiseInterface updateAttributionSettingsAsync(UpdateAttributionSettingsRequest $request, array $optionalArgs = [])
* @method PromiseInterface updateAudienceAsync(UpdateAudienceRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface updateCalculatedMetricAsync(UpdateCalculatedMetricRequest $request, array $optionalArgs = [])
* @method PromiseInterface updateChannelGroupAsync(UpdateChannelGroupRequest $request, array $optionalArgs = [])
* @method PromiseInterface updateConversionEventAsync(UpdateConversionEventRequest $request, array $optionalArgs = [])
* @method PromiseInterface updateCustomDimensionAsync(UpdateCustomDimensionRequest $request, array $optionalArgs = [])
@@ -536,6 +547,25 @@ public static function bigQueryLinkName(string $property, string $bigqueryLink):
]);
}
+ /**
+ * Formats a string containing the fully-qualified path to represent a
+ * calculated_metric resource.
+ *
+ * @param string $property
+ * @param string $calculatedMetric
+ *
+ * @return string The formatted calculated_metric resource.
+ *
+ * @experimental
+ */
+ public static function calculatedMetricName(string $property, string $calculatedMetric): string
+ {
+ return self::getPathTemplate('calculatedMetric')->render([
+ 'property' => $property,
+ 'calculated_metric' => $calculatedMetric,
+ ]);
+ }
+
/**
* Formats a string containing the fully-qualified path to represent a
* channel_group resource.
@@ -1001,6 +1031,7 @@ public static function subpropertyEventFilterName(string $property, string $subP
* - attributionSettings: properties/{property}/attributionSettings
* - audience: properties/{property}/audiences/{audience}
* - bigQueryLink: properties/{property}/bigQueryLinks/{bigquery_link}
+ * - calculatedMetric: properties/{property}/calculatedMetrics/{calculated_metric}
* - channelGroup: properties/{property}/channelGroups/{channel_group}
* - conversionEvent: properties/{property}/conversionEvents/{conversion_event}
* - customDimension: properties/{property}/customDimensions/{custom_dimension}
@@ -1504,6 +1535,35 @@ public function createAudience(CreateAudienceRequest $request, array $callOption
return $this->startApiCall('CreateAudience', $request, $callOptions)->wait();
}
+ /**
+ * Creates a CalculatedMetric.
+ *
+ * The async variant is
+ * {@see AnalyticsAdminServiceClient::createCalculatedMetricAsync()} .
+ *
+ * @example samples/V1alpha/AnalyticsAdminServiceClient/create_calculated_metric.php
+ *
+ * @param CreateCalculatedMetricRequest $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 CalculatedMetric
+ *
+ * @throws ApiException Thrown if the API call fails.
+ *
+ * @experimental
+ */
+ public function createCalculatedMetric(CreateCalculatedMetricRequest $request, array $callOptions = []): CalculatedMetric
+ {
+ return $this->startApiCall('CreateCalculatedMetric', $request, $callOptions)->wait();
+ }
+
/**
* Creates a ChannelGroup.
*
@@ -2186,6 +2246,33 @@ public function deleteAdSenseLink(DeleteAdSenseLinkRequest $request, array $call
$this->startApiCall('DeleteAdSenseLink', $request, $callOptions)->wait();
}
+ /**
+ * Deletes a CalculatedMetric on a property.
+ *
+ * The async variant is
+ * {@see AnalyticsAdminServiceClient::deleteCalculatedMetricAsync()} .
+ *
+ * @example samples/V1alpha/AnalyticsAdminServiceClient/delete_calculated_metric.php
+ *
+ * @param DeleteCalculatedMetricRequest $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 deleteCalculatedMetric(DeleteCalculatedMetricRequest $request, array $callOptions = []): void
+ {
+ $this->startApiCall('DeleteCalculatedMetric', $request, $callOptions)->wait();
+ }
+
/**
* Deletes a ChannelGroup on a property.
*
@@ -2870,6 +2957,35 @@ public function getBigQueryLink(GetBigQueryLinkRequest $request, array $callOpti
return $this->startApiCall('GetBigQueryLink', $request, $callOptions)->wait();
}
+ /**
+ * Lookup for a single CalculatedMetric.
+ *
+ * The async variant is
+ * {@see AnalyticsAdminServiceClient::getCalculatedMetricAsync()} .
+ *
+ * @example samples/V1alpha/AnalyticsAdminServiceClient/get_calculated_metric.php
+ *
+ * @param GetCalculatedMetricRequest $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 CalculatedMetric
+ *
+ * @throws ApiException Thrown if the API call fails.
+ *
+ * @experimental
+ */
+ public function getCalculatedMetric(GetCalculatedMetricRequest $request, array $callOptions = []): CalculatedMetric
+ {
+ return $this->startApiCall('GetCalculatedMetric', $request, $callOptions)->wait();
+ }
+
/**
* Lookup for a single ChannelGroup.
*
@@ -3662,6 +3778,35 @@ public function listBigQueryLinks(ListBigQueryLinksRequest $request, array $call
return $this->startApiCall('ListBigQueryLinks', $request, $callOptions);
}
+ /**
+ * Lists CalculatedMetrics on a property.
+ *
+ * The async variant is
+ * {@see AnalyticsAdminServiceClient::listCalculatedMetricsAsync()} .
+ *
+ * @example samples/V1alpha/AnalyticsAdminServiceClient/list_calculated_metrics.php
+ *
+ * @param ListCalculatedMetricsRequest $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 listCalculatedMetrics(ListCalculatedMetricsRequest $request, array $callOptions = []): PagedListResponse
+ {
+ return $this->startApiCall('ListCalculatedMetrics', $request, $callOptions);
+ }
+
/**
* Lists ChannelGroups on a property.
*
@@ -4446,6 +4591,35 @@ public function updateAudience(UpdateAudienceRequest $request, array $callOption
return $this->startApiCall('UpdateAudience', $request, $callOptions)->wait();
}
+ /**
+ * Updates a CalculatedMetric on a property.
+ *
+ * The async variant is
+ * {@see AnalyticsAdminServiceClient::updateCalculatedMetricAsync()} .
+ *
+ * @example samples/V1alpha/AnalyticsAdminServiceClient/update_calculated_metric.php
+ *
+ * @param UpdateCalculatedMetricRequest $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 CalculatedMetric
+ *
+ * @throws ApiException Thrown if the API call fails.
+ *
+ * @experimental
+ */
+ public function updateCalculatedMetric(UpdateCalculatedMetricRequest $request, array $callOptions = []): CalculatedMetric
+ {
+ return $this->startApiCall('UpdateCalculatedMetric', $request, $callOptions)->wait();
+ }
+
/**
* Updates a ChannelGroup.
*
diff --git a/AnalyticsAdmin/src/V1alpha/ConversionEvent/DefaultConversionValue.php b/AnalyticsAdmin/src/V1alpha/ConversionEvent/DefaultConversionValue.php
index 9da47c77fa36..b7c015acff03 100644
--- a/AnalyticsAdmin/src/V1alpha/ConversionEvent/DefaultConversionValue.php
+++ b/AnalyticsAdmin/src/V1alpha/ConversionEvent/DefaultConversionValue.php
@@ -27,7 +27,7 @@ class DefaultConversionValue extends \Google\Protobuf\Internal\Message
* When a conversion event for this event_name has no set currency,
* this currency will be applied as the default. Must be in ISO 4217
* currency code format. See https://en.wikipedia.org/wiki/ISO_4217 for
- * more.
+ * more information.
*
* Generated from protobuf field optional string currency_code = 2;
*/
@@ -46,7 +46,7 @@ class DefaultConversionValue extends \Google\Protobuf\Internal\Message
* When a conversion event for this event_name has no set currency,
* this currency will be applied as the default. Must be in ISO 4217
* currency code format. See https://en.wikipedia.org/wiki/ISO_4217 for
- * more.
+ * more information.
* }
*/
public function __construct($data = NULL) {
@@ -96,7 +96,7 @@ public function setValue($var)
* When a conversion event for this event_name has no set currency,
* this currency will be applied as the default. Must be in ISO 4217
* currency code format. See https://en.wikipedia.org/wiki/ISO_4217 for
- * more.
+ * more information.
*
* Generated from protobuf field optional string currency_code = 2;
* @return string
@@ -120,7 +120,7 @@ public function clearCurrencyCode()
* When a conversion event for this event_name has no set currency,
* this currency will be applied as the default. Must be in ISO 4217
* currency code format. See https://en.wikipedia.org/wiki/ISO_4217 for
- * more.
+ * more information.
*
* Generated from protobuf field optional string currency_code = 2;
* @param string $var
diff --git a/AnalyticsAdmin/src/V1alpha/CreateCalculatedMetricRequest.php b/AnalyticsAdmin/src/V1alpha/CreateCalculatedMetricRequest.php
new file mode 100644
index 000000000000..aff60c531e6a
--- /dev/null
+++ b/AnalyticsAdmin/src/V1alpha/CreateCalculatedMetricRequest.php
@@ -0,0 +1,199 @@
+google.analytics.admin.v1alpha.CreateCalculatedMetricRequest
+ */
+class CreateCalculatedMetricRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. Format: properties/{property_id}
+ * Example: properties/1234
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $parent = '';
+ /**
+ * Required. The ID to use for the calculated metric which will become the
+ * final component of the calculated metric's resource name.
+ * This value should be 1-80 characters and valid characters are
+ * /[a-zA-Z0-9_]/, no spaces allowed. calculated_metric_id must be unique
+ * between all calculated metrics under a property. The calculated_metric_id
+ * is used when referencing this calculated metric from external APIs, for
+ * example, "calcMetric:{calculated_metric_id}".
+ *
+ * Generated from protobuf field string calculated_metric_id = 2 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $calculated_metric_id = '';
+ /**
+ * Required. The CalculatedMetric to create.
+ *
+ * Generated from protobuf field .google.analytics.admin.v1alpha.CalculatedMetric calculated_metric = 3 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $calculated_metric = null;
+
+ /**
+ * @param string $parent Required. Format: properties/{property_id}
+ * Example: properties/1234
+ * Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
+ * @param \Google\Analytics\Admin\V1alpha\CalculatedMetric $calculatedMetric Required. The CalculatedMetric to create.
+ * @param string $calculatedMetricId Required. The ID to use for the calculated metric which will become the
+ * final component of the calculated metric's resource name.
+ *
+ * This value should be 1-80 characters and valid characters are
+ * /[a-zA-Z0-9_]/, no spaces allowed. calculated_metric_id must be unique
+ * between all calculated metrics under a property. The calculated_metric_id
+ * is used when referencing this calculated metric from external APIs, for
+ * example, "calcMetric:{calculated_metric_id}".
+ *
+ * @return \Google\Analytics\Admin\V1alpha\CreateCalculatedMetricRequest
+ *
+ * @experimental
+ */
+ public static function build(string $parent, \Google\Analytics\Admin\V1alpha\CalculatedMetric $calculatedMetric, string $calculatedMetricId): self
+ {
+ return (new self())
+ ->setParent($parent)
+ ->setCalculatedMetric($calculatedMetric)
+ ->setCalculatedMetricId($calculatedMetricId);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * Required. Format: properties/{property_id}
+ * Example: properties/1234
+ * @type string $calculated_metric_id
+ * Required. The ID to use for the calculated metric which will become the
+ * final component of the calculated metric's resource name.
+ * This value should be 1-80 characters and valid characters are
+ * /[a-zA-Z0-9_]/, no spaces allowed. calculated_metric_id must be unique
+ * between all calculated metrics under a property. The calculated_metric_id
+ * is used when referencing this calculated metric from external APIs, for
+ * example, "calcMetric:{calculated_metric_id}".
+ * @type \Google\Analytics\Admin\V1alpha\CalculatedMetric $calculated_metric
+ * Required. The CalculatedMetric to create.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Analytics\Admin\V1Alpha\AnalyticsAdmin::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. Format: properties/{property_id}
+ * Example: properties/1234
+ *
+ * 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. Format: properties/{property_id}
+ * Example: properties/1234
+ *
+ * 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 ID to use for the calculated metric which will become the
+ * final component of the calculated metric's resource name.
+ * This value should be 1-80 characters and valid characters are
+ * /[a-zA-Z0-9_]/, no spaces allowed. calculated_metric_id must be unique
+ * between all calculated metrics under a property. The calculated_metric_id
+ * is used when referencing this calculated metric from external APIs, for
+ * example, "calcMetric:{calculated_metric_id}".
+ *
+ * Generated from protobuf field string calculated_metric_id = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getCalculatedMetricId()
+ {
+ return $this->calculated_metric_id;
+ }
+
+ /**
+ * Required. The ID to use for the calculated metric which will become the
+ * final component of the calculated metric's resource name.
+ * This value should be 1-80 characters and valid characters are
+ * /[a-zA-Z0-9_]/, no spaces allowed. calculated_metric_id must be unique
+ * between all calculated metrics under a property. The calculated_metric_id
+ * is used when referencing this calculated metric from external APIs, for
+ * example, "calcMetric:{calculated_metric_id}".
+ *
+ * Generated from protobuf field string calculated_metric_id = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setCalculatedMetricId($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->calculated_metric_id = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. The CalculatedMetric to create.
+ *
+ * Generated from protobuf field .google.analytics.admin.v1alpha.CalculatedMetric calculated_metric = 3 [(.google.api.field_behavior) = REQUIRED];
+ * @return \Google\Analytics\Admin\V1alpha\CalculatedMetric|null
+ */
+ public function getCalculatedMetric()
+ {
+ return $this->calculated_metric;
+ }
+
+ public function hasCalculatedMetric()
+ {
+ return isset($this->calculated_metric);
+ }
+
+ public function clearCalculatedMetric()
+ {
+ unset($this->calculated_metric);
+ }
+
+ /**
+ * Required. The CalculatedMetric to create.
+ *
+ * Generated from protobuf field .google.analytics.admin.v1alpha.CalculatedMetric calculated_metric = 3 [(.google.api.field_behavior) = REQUIRED];
+ * @param \Google\Analytics\Admin\V1alpha\CalculatedMetric $var
+ * @return $this
+ */
+ public function setCalculatedMetric($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Analytics\Admin\V1alpha\CalculatedMetric::class);
+ $this->calculated_metric = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/AnalyticsAdmin/src/V1alpha/DeleteCalculatedMetricRequest.php b/AnalyticsAdmin/src/V1alpha/DeleteCalculatedMetricRequest.php
new file mode 100644
index 000000000000..e900ce55e4af
--- /dev/null
+++ b/AnalyticsAdmin/src/V1alpha/DeleteCalculatedMetricRequest.php
@@ -0,0 +1,91 @@
+google.analytics.admin.v1alpha.DeleteCalculatedMetricRequest
+ */
+class DeleteCalculatedMetricRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The name of the CalculatedMetric to delete.
+ * Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
+ * Example: properties/1234/calculatedMetrics/Metric01
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $name = '';
+
+ /**
+ * @param string $name Required. The name of the CalculatedMetric to delete.
+ * Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
+ * Example: properties/1234/calculatedMetrics/Metric01
+ * Please see {@see AnalyticsAdminServiceClient::calculatedMetricName()} for help formatting this field.
+ *
+ * @return \Google\Analytics\Admin\V1alpha\DeleteCalculatedMetricRequest
+ *
+ * @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 CalculatedMetric to delete.
+ * Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
+ * Example: properties/1234/calculatedMetrics/Metric01
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Analytics\Admin\V1Alpha\AnalyticsAdmin::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The name of the CalculatedMetric to delete.
+ * Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
+ * Example: properties/1234/calculatedMetrics/Metric01
+ *
+ * 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 CalculatedMetric to delete.
+ * Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
+ * Example: properties/1234/calculatedMetrics/Metric01
+ *
+ * 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/AnalyticsAdmin/src/V1alpha/Gapic/AnalyticsAdminServiceGapicClient.php b/AnalyticsAdmin/src/V1alpha/Gapic/AnalyticsAdminServiceGapicClient.php
index 2e72be5348cc..fe69ade622e8 100644
--- a/AnalyticsAdmin/src/V1alpha/Gapic/AnalyticsAdminServiceGapicClient.php
+++ b/AnalyticsAdmin/src/V1alpha/Gapic/AnalyticsAdminServiceGapicClient.php
@@ -51,6 +51,7 @@
use Google\Analytics\Admin\V1alpha\BatchUpdateAccessBindingsRequest;
use Google\Analytics\Admin\V1alpha\BatchUpdateAccessBindingsResponse;
use Google\Analytics\Admin\V1alpha\BigQueryLink;
+use Google\Analytics\Admin\V1alpha\CalculatedMetric;
use Google\Analytics\Admin\V1alpha\CancelDisplayVideo360AdvertiserLinkProposalRequest;
use Google\Analytics\Admin\V1alpha\ChannelGroup;
use Google\Analytics\Admin\V1alpha\ConnectedSiteTag;
@@ -58,6 +59,7 @@
use Google\Analytics\Admin\V1alpha\CreateAccessBindingRequest;
use Google\Analytics\Admin\V1alpha\CreateAdSenseLinkRequest;
use Google\Analytics\Admin\V1alpha\CreateAudienceRequest;
+use Google\Analytics\Admin\V1alpha\CreateCalculatedMetricRequest;
use Google\Analytics\Admin\V1alpha\CreateChannelGroupRequest;
use Google\Analytics\Admin\V1alpha\CreateConnectedSiteTagRequest;
use Google\Analytics\Admin\V1alpha\CreateConnectedSiteTagResponse;
@@ -90,6 +92,7 @@
use Google\Analytics\Admin\V1alpha\DeleteAccessBindingRequest;
use Google\Analytics\Admin\V1alpha\DeleteAccountRequest;
use Google\Analytics\Admin\V1alpha\DeleteAdSenseLinkRequest;
+use Google\Analytics\Admin\V1alpha\DeleteCalculatedMetricRequest;
use Google\Analytics\Admin\V1alpha\DeleteChannelGroupRequest;
use Google\Analytics\Admin\V1alpha\DeleteConnectedSiteTagRequest;
use Google\Analytics\Admin\V1alpha\DeleteConversionEventRequest;
@@ -122,6 +125,7 @@
use Google\Analytics\Admin\V1alpha\GetAttributionSettingsRequest;
use Google\Analytics\Admin\V1alpha\GetAudienceRequest;
use Google\Analytics\Admin\V1alpha\GetBigQueryLinkRequest;
+use Google\Analytics\Admin\V1alpha\GetCalculatedMetricRequest;
use Google\Analytics\Admin\V1alpha\GetChannelGroupRequest;
use Google\Analytics\Admin\V1alpha\GetConversionEventRequest;
use Google\Analytics\Admin\V1alpha\GetCustomDimensionRequest;
@@ -158,6 +162,8 @@
use Google\Analytics\Admin\V1alpha\ListAudiencesResponse;
use Google\Analytics\Admin\V1alpha\ListBigQueryLinksRequest;
use Google\Analytics\Admin\V1alpha\ListBigQueryLinksResponse;
+use Google\Analytics\Admin\V1alpha\ListCalculatedMetricsRequest;
+use Google\Analytics\Admin\V1alpha\ListCalculatedMetricsResponse;
use Google\Analytics\Admin\V1alpha\ListChannelGroupsRequest;
use Google\Analytics\Admin\V1alpha\ListChannelGroupsResponse;
use Google\Analytics\Admin\V1alpha\ListConnectedSiteTagsRequest;
@@ -212,6 +218,7 @@
use Google\Analytics\Admin\V1alpha\UpdateAccountRequest;
use Google\Analytics\Admin\V1alpha\UpdateAttributionSettingsRequest;
use Google\Analytics\Admin\V1alpha\UpdateAudienceRequest;
+use Google\Analytics\Admin\V1alpha\UpdateCalculatedMetricRequest;
use Google\Analytics\Admin\V1alpha\UpdateChannelGroupRequest;
use Google\Analytics\Admin\V1alpha\UpdateConversionEventRequest;
use Google\Analytics\Admin\V1alpha\UpdateCustomDimensionRequest;
@@ -314,6 +321,8 @@ class AnalyticsAdminServiceGapicClient
private static $bigQueryLinkNameTemplate;
+ private static $calculatedMetricNameTemplate;
+
private static $channelGroupNameTemplate;
private static $conversionEventNameTemplate;
@@ -446,6 +455,15 @@ private static function getBigQueryLinkNameTemplate()
return self::$bigQueryLinkNameTemplate;
}
+ private static function getCalculatedMetricNameTemplate()
+ {
+ if (self::$calculatedMetricNameTemplate == null) {
+ self::$calculatedMetricNameTemplate = new PathTemplate('properties/{property}/calculatedMetrics/{calculated_metric}');
+ }
+
+ return self::$calculatedMetricNameTemplate;
+ }
+
private static function getChannelGroupNameTemplate()
{
if (self::$channelGroupNameTemplate == null) {
@@ -673,6 +691,7 @@ private static function getPathTemplateMap()
'attributionSettings' => self::getAttributionSettingsNameTemplate(),
'audience' => self::getAudienceNameTemplate(),
'bigQueryLink' => self::getBigQueryLinkNameTemplate(),
+ 'calculatedMetric' => self::getCalculatedMetricNameTemplate(),
'channelGroup' => self::getChannelGroupNameTemplate(),
'conversionEvent' => self::getConversionEventNameTemplate(),
'customDimension' => self::getCustomDimensionNameTemplate(),
@@ -832,6 +851,25 @@ public static function bigQueryLinkName($property, $bigqueryLink)
]);
}
+ /**
+ * Formats a string containing the fully-qualified path to represent a
+ * calculated_metric resource.
+ *
+ * @param string $property
+ * @param string $calculatedMetric
+ *
+ * @return string The formatted calculated_metric resource.
+ *
+ * @experimental
+ */
+ public static function calculatedMetricName($property, $calculatedMetric)
+ {
+ return self::getCalculatedMetricNameTemplate()->render([
+ 'property' => $property,
+ 'calculated_metric' => $calculatedMetric,
+ ]);
+ }
+
/**
* Formats a string containing the fully-qualified path to represent a
* channel_group resource.
@@ -1297,6 +1335,7 @@ public static function subpropertyEventFilterName($property, $subPropertyEventFi
* - attributionSettings: properties/{property}/attributionSettings
* - audience: properties/{property}/audiences/{audience}
* - bigQueryLink: properties/{property}/bigQueryLinks/{bigquery_link}
+ * - calculatedMetric: properties/{property}/calculatedMetrics/{calculated_metric}
* - channelGroup: properties/{property}/channelGroups/{channel_group}
* - conversionEvent: properties/{property}/conversionEvents/{conversion_event}
* - customDimension: properties/{property}/customDimensions/{custom_dimension}
@@ -2026,6 +2065,61 @@ public function createAudience($parent, $audience, array $optionalArgs = [])
return $this->startCall('CreateAudience', Audience::class, $optionalArgs, $request)->wait();
}
+ /**
+ * Creates a CalculatedMetric.
+ *
+ * Sample code:
+ * ```
+ * $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
+ * try {
+ * $formattedParent = $analyticsAdminServiceClient->propertyName('[PROPERTY]');
+ * $calculatedMetricId = 'calculated_metric_id';
+ * $calculatedMetric = new CalculatedMetric();
+ * $response = $analyticsAdminServiceClient->createCalculatedMetric($formattedParent, $calculatedMetricId, $calculatedMetric);
+ * } finally {
+ * $analyticsAdminServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $parent Required. Format: properties/{property_id}
+ * Example: properties/1234
+ * @param string $calculatedMetricId Required. The ID to use for the calculated metric which will become the
+ * final component of the calculated metric's resource name.
+ *
+ * This value should be 1-80 characters and valid characters are
+ * /[a-zA-Z0-9_]/, no spaces allowed. calculated_metric_id must be unique
+ * between all calculated metrics under a property. The calculated_metric_id
+ * is used when referencing this calculated metric from external APIs, for
+ * example, "calcMetric:{calculated_metric_id}".
+ * @param CalculatedMetric $calculatedMetric Required. The CalculatedMetric to create.
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Analytics\Admin\V1alpha\CalculatedMetric
+ *
+ * @throws ApiException if the remote call fails
+ *
+ * @experimental
+ */
+ public function createCalculatedMetric($parent, $calculatedMetricId, $calculatedMetric, array $optionalArgs = [])
+ {
+ $request = new CreateCalculatedMetricRequest();
+ $requestParamHeaders = [];
+ $request->setParent($parent);
+ $request->setCalculatedMetricId($calculatedMetricId);
+ $request->setCalculatedMetric($calculatedMetric);
+ $requestParamHeaders['parent'] = $parent;
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->startCall('CreateCalculatedMetric', CalculatedMetric::class, $optionalArgs, $request)->wait();
+ }
+
/**
* Creates a ChannelGroup.
*
@@ -3057,6 +3151,47 @@ public function deleteAdSenseLink($name, array $optionalArgs = [])
return $this->startCall('DeleteAdSenseLink', GPBEmpty::class, $optionalArgs, $request)->wait();
}
+ /**
+ * Deletes a CalculatedMetric on a property.
+ *
+ * Sample code:
+ * ```
+ * $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
+ * try {
+ * $formattedName = $analyticsAdminServiceClient->calculatedMetricName('[PROPERTY]', '[CALCULATED_METRIC]');
+ * $analyticsAdminServiceClient->deleteCalculatedMetric($formattedName);
+ * } finally {
+ * $analyticsAdminServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $name Required. The name of the CalculatedMetric to delete.
+ * Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
+ * Example: properties/1234/calculatedMetrics/Metric01
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @throws ApiException if the remote call fails
+ *
+ * @experimental
+ */
+ public function deleteCalculatedMetric($name, array $optionalArgs = [])
+ {
+ $request = new DeleteCalculatedMetricRequest();
+ $requestParamHeaders = [];
+ $request->setName($name);
+ $requestParamHeaders['name'] = $name;
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->startCall('DeleteCalculatedMetric', GPBEmpty::class, $optionalArgs, $request)->wait();
+ }
+
/**
* Deletes a ChannelGroup on a property.
*
@@ -4069,6 +4204,49 @@ public function getBigQueryLink($name, array $optionalArgs = [])
return $this->startCall('GetBigQueryLink', BigQueryLink::class, $optionalArgs, $request)->wait();
}
+ /**
+ * Lookup for a single CalculatedMetric.
+ *
+ * Sample code:
+ * ```
+ * $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
+ * try {
+ * $formattedName = $analyticsAdminServiceClient->calculatedMetricName('[PROPERTY]', '[CALCULATED_METRIC]');
+ * $response = $analyticsAdminServiceClient->getCalculatedMetric($formattedName);
+ * } finally {
+ * $analyticsAdminServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $name Required. The name of the CalculatedMetric to get.
+ * Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
+ * Example: properties/1234/calculatedMetrics/Metric01
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Analytics\Admin\V1alpha\CalculatedMetric
+ *
+ * @throws ApiException if the remote call fails
+ *
+ * @experimental
+ */
+ public function getCalculatedMetric($name, array $optionalArgs = [])
+ {
+ $request = new GetCalculatedMetricRequest();
+ $requestParamHeaders = [];
+ $request->setName($name);
+ $requestParamHeaders['name'] = $name;
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->startCall('GetCalculatedMetric', CalculatedMetric::class, $optionalArgs, $request)->wait();
+ }
+
/**
* Lookup for a single ChannelGroup.
*
@@ -5400,6 +5578,76 @@ public function listBigQueryLinks($parent, array $optionalArgs = [])
return $this->getPagedListResponse('ListBigQueryLinks', $optionalArgs, ListBigQueryLinksResponse::class, $request);
}
+ /**
+ * Lists CalculatedMetrics on a property.
+ *
+ * Sample code:
+ * ```
+ * $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
+ * try {
+ * $formattedParent = $analyticsAdminServiceClient->propertyName('[PROPERTY]');
+ * // Iterate over pages of elements
+ * $pagedResponse = $analyticsAdminServiceClient->listCalculatedMetrics($formattedParent);
+ * foreach ($pagedResponse->iteratePages() as $page) {
+ * foreach ($page as $element) {
+ * // doSomethingWith($element);
+ * }
+ * }
+ * // Alternatively:
+ * // Iterate through all elements
+ * $pagedResponse = $analyticsAdminServiceClient->listCalculatedMetrics($formattedParent);
+ * foreach ($pagedResponse->iterateAllElements() as $element) {
+ * // doSomethingWith($element);
+ * }
+ * } finally {
+ * $analyticsAdminServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $parent Required. Example format: properties/1234
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type int $pageSize
+ * The maximum number of resources contained in the underlying API
+ * response. The API may return fewer values in a page, even if
+ * there are additional values to be retrieved.
+ * @type string $pageToken
+ * A page token is used to specify a page of values to be returned.
+ * If no page token is specified (the default), the first page
+ * of values will be returned. Any page token used here must have
+ * been generated by a previous call to the API.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\ApiCore\PagedListResponse
+ *
+ * @throws ApiException if the remote call fails
+ *
+ * @experimental
+ */
+ public function listCalculatedMetrics($parent, array $optionalArgs = [])
+ {
+ $request = new ListCalculatedMetricsRequest();
+ $requestParamHeaders = [];
+ $request->setParent($parent);
+ $requestParamHeaders['parent'] = $parent;
+ if (isset($optionalArgs['pageSize'])) {
+ $request->setPageSize($optionalArgs['pageSize']);
+ }
+
+ if (isset($optionalArgs['pageToken'])) {
+ $request->setPageToken($optionalArgs['pageToken']);
+ }
+
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->getPagedListResponse('ListCalculatedMetrics', $optionalArgs, ListCalculatedMetricsResponse::class, $request);
+ }
+
/**
* Lists ChannelGroups on a property.
*
@@ -6933,13 +7181,15 @@ public function runAccessReport(array $optionalArgs = [])
* ```
*
* @param string $account Required. The account resource for which to return change history
- * resources.
+ * resources. Format: accounts/{account} Example: "accounts/100"
* @param array $optionalArgs {
* Optional.
*
* @type string $property
* Optional. Resource name for a child property. If set, only return changes
* made to this property or its child resources.
+ * Format: properties/{propertyId}
+ * Example: "properties/100"
* @type int[] $resourceType
* Optional. If set, only return changes if they are for a resource that
* matches at least one of these types.
@@ -7252,6 +7502,52 @@ public function updateAudience($audience, $updateMask, array $optionalArgs = [])
return $this->startCall('UpdateAudience', Audience::class, $optionalArgs, $request)->wait();
}
+ /**
+ * Updates a CalculatedMetric on a property.
+ *
+ * Sample code:
+ * ```
+ * $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
+ * try {
+ * $calculatedMetric = new CalculatedMetric();
+ * $updateMask = new FieldMask();
+ * $response = $analyticsAdminServiceClient->updateCalculatedMetric($calculatedMetric, $updateMask);
+ * } finally {
+ * $analyticsAdminServiceClient->close();
+ * }
+ * ```
+ *
+ * @param CalculatedMetric $calculatedMetric Required. The CalculatedMetric to update
+ * @param FieldMask $updateMask Required. The list of fields to be updated. Omitted fields will not be
+ * updated. To replace the entire entity, use one path with the string "*" to
+ * match all fields.
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Analytics\Admin\V1alpha\CalculatedMetric
+ *
+ * @throws ApiException if the remote call fails
+ *
+ * @experimental
+ */
+ public function updateCalculatedMetric($calculatedMetric, $updateMask, array $optionalArgs = [])
+ {
+ $request = new UpdateCalculatedMetricRequest();
+ $requestParamHeaders = [];
+ $request->setCalculatedMetric($calculatedMetric);
+ $request->setUpdateMask($updateMask);
+ $requestParamHeaders['calculated_metric.name'] = $calculatedMetric->getName();
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->startCall('UpdateCalculatedMetric', CalculatedMetric::class, $optionalArgs, $request)->wait();
+ }
+
/**
* Updates a ChannelGroup.
*
diff --git a/AnalyticsAdmin/src/V1alpha/GetCalculatedMetricRequest.php b/AnalyticsAdmin/src/V1alpha/GetCalculatedMetricRequest.php
new file mode 100644
index 000000000000..1a17f495da52
--- /dev/null
+++ b/AnalyticsAdmin/src/V1alpha/GetCalculatedMetricRequest.php
@@ -0,0 +1,91 @@
+google.analytics.admin.v1alpha.GetCalculatedMetricRequest
+ */
+class GetCalculatedMetricRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The name of the CalculatedMetric to get.
+ * Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
+ * Example: properties/1234/calculatedMetrics/Metric01
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $name = '';
+
+ /**
+ * @param string $name Required. The name of the CalculatedMetric to get.
+ * Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
+ * Example: properties/1234/calculatedMetrics/Metric01
+ * Please see {@see AnalyticsAdminServiceClient::calculatedMetricName()} for help formatting this field.
+ *
+ * @return \Google\Analytics\Admin\V1alpha\GetCalculatedMetricRequest
+ *
+ * @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 CalculatedMetric to get.
+ * Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
+ * Example: properties/1234/calculatedMetrics/Metric01
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Analytics\Admin\V1Alpha\AnalyticsAdmin::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The name of the CalculatedMetric to get.
+ * Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
+ * Example: properties/1234/calculatedMetrics/Metric01
+ *
+ * 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 CalculatedMetric to get.
+ * Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
+ * Example: properties/1234/calculatedMetrics/Metric01
+ *
+ * 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/AnalyticsAdmin/src/V1alpha/ListCalculatedMetricsRequest.php b/AnalyticsAdmin/src/V1alpha/ListCalculatedMetricsRequest.php
new file mode 100644
index 000000000000..4c2826553631
--- /dev/null
+++ b/AnalyticsAdmin/src/V1alpha/ListCalculatedMetricsRequest.php
@@ -0,0 +1,169 @@
+google.analytics.admin.v1alpha.ListCalculatedMetricsRequest
+ */
+class ListCalculatedMetricsRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. Example format: properties/1234
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $parent = '';
+ /**
+ * Optional. The maximum number of resources to return.
+ * If unspecified, at most 50 resources will be returned.
+ * The maximum value is 200 (higher values will be coerced to the maximum).
+ *
+ * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ private $page_size = 0;
+ /**
+ * Optional. A page token, received from a previous `ListCalculatedMetrics`
+ * call. Provide this to retrieve the subsequent page.
+ * When paginating, all other parameters provided to `ListCalculatedMetrics`
+ * must match the call that provided the page token.
+ *
+ * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ private $page_token = '';
+
+ /**
+ * @param string $parent Required. Example format: properties/1234
+ * Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
+ *
+ * @return \Google\Analytics\Admin\V1alpha\ListCalculatedMetricsRequest
+ *
+ * @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. Example format: properties/1234
+ * @type int $page_size
+ * Optional. The maximum number of resources to return.
+ * If unspecified, at most 50 resources will be returned.
+ * The maximum value is 200 (higher values will be coerced to the maximum).
+ * @type string $page_token
+ * Optional. A page token, received from a previous `ListCalculatedMetrics`
+ * call. Provide this to retrieve the subsequent page.
+ * When paginating, all other parameters provided to `ListCalculatedMetrics`
+ * must match the call that provided the page token.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Analytics\Admin\V1Alpha\AnalyticsAdmin::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. Example format: properties/1234
+ *
+ * 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. Example format: properties/1234
+ *
+ * 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 resources to return.
+ * If unspecified, at most 50 resources will be returned.
+ * The maximum value is 200 (higher values will be coerced to the maximum).
+ *
+ * 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 resources to return.
+ * If unspecified, at most 50 resources will be returned.
+ * The maximum value is 200 (higher values will be coerced to the maximum).
+ *
+ * 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. A page token, received from a previous `ListCalculatedMetrics`
+ * call. Provide this to retrieve the subsequent page.
+ * When paginating, all other parameters provided to `ListCalculatedMetrics`
+ * must match the call that provided the 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. A page token, received from a previous `ListCalculatedMetrics`
+ * call. Provide this to retrieve the subsequent page.
+ * When paginating, all other parameters provided to `ListCalculatedMetrics`
+ * must match the call that provided the 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;
+ }
+
+}
+
diff --git a/AnalyticsAdmin/src/V1alpha/ListCalculatedMetricsResponse.php b/AnalyticsAdmin/src/V1alpha/ListCalculatedMetricsResponse.php
new file mode 100644
index 000000000000..c6f78a8eecb7
--- /dev/null
+++ b/AnalyticsAdmin/src/V1alpha/ListCalculatedMetricsResponse.php
@@ -0,0 +1,105 @@
+google.analytics.admin.v1alpha.ListCalculatedMetricsResponse
+ */
+class ListCalculatedMetricsResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * List of CalculatedMetrics.
+ *
+ * Generated from protobuf field repeated .google.analytics.admin.v1alpha.CalculatedMetric calculated_metrics = 1;
+ */
+ private $calculated_metrics;
+ /**
+ * A token, which can be sent as `page_token` to retrieve the next page.
+ * If this field is omitted, there are no subsequent pages.
+ *
+ * Generated from protobuf field string next_page_token = 2;
+ */
+ private $next_page_token = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type array<\Google\Analytics\Admin\V1alpha\CalculatedMetric>|\Google\Protobuf\Internal\RepeatedField $calculated_metrics
+ * List of CalculatedMetrics.
+ * @type string $next_page_token
+ * A token, which can be sent as `page_token` to retrieve the next page.
+ * If this field is omitted, there are no subsequent pages.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Analytics\Admin\V1Alpha\AnalyticsAdmin::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * List of CalculatedMetrics.
+ *
+ * Generated from protobuf field repeated .google.analytics.admin.v1alpha.CalculatedMetric calculated_metrics = 1;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getCalculatedMetrics()
+ {
+ return $this->calculated_metrics;
+ }
+
+ /**
+ * List of CalculatedMetrics.
+ *
+ * Generated from protobuf field repeated .google.analytics.admin.v1alpha.CalculatedMetric calculated_metrics = 1;
+ * @param array<\Google\Analytics\Admin\V1alpha\CalculatedMetric>|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setCalculatedMetrics($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Analytics\Admin\V1alpha\CalculatedMetric::class);
+ $this->calculated_metrics = $arr;
+
+ return $this;
+ }
+
+ /**
+ * A token, which can be sent as `page_token` to retrieve the next page.
+ * If this field is omitted, there are no subsequent pages.
+ *
+ * Generated from protobuf field string next_page_token = 2;
+ * @return string
+ */
+ public function getNextPageToken()
+ {
+ return $this->next_page_token;
+ }
+
+ /**
+ * A token, which can be sent as `page_token` to retrieve the next page.
+ * If this field is omitted, there are no subsequent pages.
+ *
+ * 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/AnalyticsAdmin/src/V1alpha/SearchChangeHistoryEventsRequest.php b/AnalyticsAdmin/src/V1alpha/SearchChangeHistoryEventsRequest.php
index 386ab18e96b6..aa745c63df2a 100644
--- a/AnalyticsAdmin/src/V1alpha/SearchChangeHistoryEventsRequest.php
+++ b/AnalyticsAdmin/src/V1alpha/SearchChangeHistoryEventsRequest.php
@@ -17,7 +17,7 @@ class SearchChangeHistoryEventsRequest extends \Google\Protobuf\Internal\Message
{
/**
* Required. The account resource for which to return change history
- * resources.
+ * resources. Format: accounts/{account} Example: "accounts/100"
*
* Generated from protobuf field string account = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
@@ -25,6 +25,8 @@ class SearchChangeHistoryEventsRequest extends \Google\Protobuf\Internal\Message
/**
* Optional. Resource name for a child property. If set, only return changes
* made to this property or its child resources.
+ * Format: properties/{propertyId}
+ * Example: "properties/100"
*
* Generated from protobuf field string property = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {
*/
@@ -90,10 +92,12 @@ class SearchChangeHistoryEventsRequest extends \Google\Protobuf\Internal\Message
*
* @type string $account
* Required. The account resource for which to return change history
- * resources.
+ * resources. Format: accounts/{account} Example: "accounts/100"
* @type string $property
* Optional. Resource name for a child property. If set, only return changes
* made to this property or its child resources.
+ * Format: properties/{propertyId}
+ * Example: "properties/100"
* @type array|\Google\Protobuf\Internal\RepeatedField $resource_type
* Optional. If set, only return changes if they are for a resource that
* matches at least one of these types.
@@ -127,7 +131,7 @@ public function __construct($data = NULL) {
/**
* Required. The account resource for which to return change history
- * resources.
+ * resources. Format: accounts/{account} Example: "accounts/100"
*
* Generated from protobuf field string account = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
* @return string
@@ -139,7 +143,7 @@ public function getAccount()
/**
* Required. The account resource for which to return change history
- * resources.
+ * resources. Format: accounts/{account} Example: "accounts/100"
*
* Generated from protobuf field string account = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
* @param string $var
@@ -156,6 +160,8 @@ public function setAccount($var)
/**
* Optional. Resource name for a child property. If set, only return changes
* made to this property or its child resources.
+ * Format: properties/{propertyId}
+ * Example: "properties/100"
*
* Generated from protobuf field string property = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {
* @return string
@@ -168,6 +174,8 @@ public function getProperty()
/**
* Optional. Resource name for a child property. If set, only return changes
* made to this property or its child resources.
+ * Format: properties/{propertyId}
+ * Example: "properties/100"
*
* Generated from protobuf field string property = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {
* @param string $var
diff --git a/AnalyticsAdmin/src/V1alpha/UpdateCalculatedMetricRequest.php b/AnalyticsAdmin/src/V1alpha/UpdateCalculatedMetricRequest.php
new file mode 100644
index 000000000000..ad598117c10c
--- /dev/null
+++ b/AnalyticsAdmin/src/V1alpha/UpdateCalculatedMetricRequest.php
@@ -0,0 +1,146 @@
+google.analytics.admin.v1alpha.UpdateCalculatedMetricRequest
+ */
+class UpdateCalculatedMetricRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The CalculatedMetric to update
+ *
+ * Generated from protobuf field .google.analytics.admin.v1alpha.CalculatedMetric calculated_metric = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $calculated_metric = null;
+ /**
+ * Required. The list of fields to be updated. Omitted fields will not be
+ * updated. To replace the entire entity, use one path with the string "*" to
+ * match all fields.
+ *
+ * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $update_mask = null;
+
+ /**
+ * @param \Google\Analytics\Admin\V1alpha\CalculatedMetric $calculatedMetric Required. The CalculatedMetric to update
+ * @param \Google\Protobuf\FieldMask $updateMask Required. The list of fields to be updated. Omitted fields will not be
+ * updated. To replace the entire entity, use one path with the string "*" to
+ * match all fields.
+ *
+ * @return \Google\Analytics\Admin\V1alpha\UpdateCalculatedMetricRequest
+ *
+ * @experimental
+ */
+ public static function build(\Google\Analytics\Admin\V1alpha\CalculatedMetric $calculatedMetric, \Google\Protobuf\FieldMask $updateMask): self
+ {
+ return (new self())
+ ->setCalculatedMetric($calculatedMetric)
+ ->setUpdateMask($updateMask);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Analytics\Admin\V1alpha\CalculatedMetric $calculated_metric
+ * Required. The CalculatedMetric to update
+ * @type \Google\Protobuf\FieldMask $update_mask
+ * Required. The list of fields to be updated. Omitted fields will not be
+ * updated. To replace the entire entity, use one path with the string "*" to
+ * match all fields.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Analytics\Admin\V1Alpha\AnalyticsAdmin::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The CalculatedMetric to update
+ *
+ * Generated from protobuf field .google.analytics.admin.v1alpha.CalculatedMetric calculated_metric = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return \Google\Analytics\Admin\V1alpha\CalculatedMetric|null
+ */
+ public function getCalculatedMetric()
+ {
+ return $this->calculated_metric;
+ }
+
+ public function hasCalculatedMetric()
+ {
+ return isset($this->calculated_metric);
+ }
+
+ public function clearCalculatedMetric()
+ {
+ unset($this->calculated_metric);
+ }
+
+ /**
+ * Required. The CalculatedMetric to update
+ *
+ * Generated from protobuf field .google.analytics.admin.v1alpha.CalculatedMetric calculated_metric = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param \Google\Analytics\Admin\V1alpha\CalculatedMetric $var
+ * @return $this
+ */
+ public function setCalculatedMetric($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Analytics\Admin\V1alpha\CalculatedMetric::class);
+ $this->calculated_metric = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. The list of fields to be updated. Omitted fields will not be
+ * updated. To replace the entire entity, use one path with the string "*" to
+ * match all fields.
+ *
+ * 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. The list of fields to be updated. Omitted fields will not be
+ * updated. To replace the entire entity, use one path with the string "*" to
+ * match all fields.
+ *
+ * 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/AnalyticsAdmin/src/V1alpha/gapic_metadata.json b/AnalyticsAdmin/src/V1alpha/gapic_metadata.json
index 71b75ec43a89..47d62b14b02e 100644
--- a/AnalyticsAdmin/src/V1alpha/gapic_metadata.json
+++ b/AnalyticsAdmin/src/V1alpha/gapic_metadata.json
@@ -75,6 +75,11 @@
"createAudience"
]
},
+ "CreateCalculatedMetric": {
+ "methods": [
+ "createCalculatedMetric"
+ ]
+ },
"CreateChannelGroup": {
"methods": [
"createChannelGroup"
@@ -190,6 +195,11 @@
"deleteAdSenseLink"
]
},
+ "DeleteCalculatedMetric": {
+ "methods": [
+ "deleteCalculatedMetric"
+ ]
+ },
"DeleteChannelGroup": {
"methods": [
"deleteChannelGroup"
@@ -310,6 +320,11 @@
"getBigQueryLink"
]
},
+ "GetCalculatedMetric": {
+ "methods": [
+ "getCalculatedMetric"
+ ]
+ },
"GetChannelGroup": {
"methods": [
"getChannelGroup"
@@ -445,6 +460,11 @@
"listBigQueryLinks"
]
},
+ "ListCalculatedMetrics": {
+ "methods": [
+ "listCalculatedMetrics"
+ ]
+ },
"ListChannelGroups": {
"methods": [
"listChannelGroups"
@@ -575,6 +595,11 @@
"updateAudience"
]
},
+ "UpdateCalculatedMetric": {
+ "methods": [
+ "updateCalculatedMetric"
+ ]
+ },
"UpdateChannelGroup": {
"methods": [
"updateChannelGroup"
diff --git a/AnalyticsAdmin/src/V1alpha/resources/analytics_admin_service_client_config.json b/AnalyticsAdmin/src/V1alpha/resources/analytics_admin_service_client_config.json
index 08ed98660e37..d6a6cddd092d 100644
--- a/AnalyticsAdmin/src/V1alpha/resources/analytics_admin_service_client_config.json
+++ b/AnalyticsAdmin/src/V1alpha/resources/analytics_admin_service_client_config.json
@@ -104,6 +104,11 @@
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params"
},
+ "CreateCalculatedMetric": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "retry_policy_1_codes",
+ "retry_params_name": "retry_policy_1_params"
+ },
"CreateChannelGroup": {
"timeout_millis": 60000,
"retry_codes_name": "retry_policy_1_codes",
@@ -219,6 +224,11 @@
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params"
},
+ "DeleteCalculatedMetric": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "retry_policy_1_codes",
+ "retry_params_name": "retry_policy_1_params"
+ },
"DeleteChannelGroup": {
"timeout_millis": 60000,
"retry_codes_name": "retry_policy_1_codes",
@@ -339,6 +349,11 @@
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params"
},
+ "GetCalculatedMetric": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "retry_policy_1_codes",
+ "retry_params_name": "retry_policy_1_params"
+ },
"GetChannelGroup": {
"timeout_millis": 60000,
"retry_codes_name": "retry_policy_1_codes",
@@ -474,6 +489,11 @@
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params"
},
+ "ListCalculatedMetrics": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "retry_policy_1_codes",
+ "retry_params_name": "retry_policy_1_params"
+ },
"ListChannelGroups": {
"timeout_millis": 60000,
"retry_codes_name": "retry_policy_1_codes",
@@ -604,6 +624,11 @@
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params"
},
+ "UpdateCalculatedMetric": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "retry_policy_1_codes",
+ "retry_params_name": "retry_policy_1_params"
+ },
"UpdateChannelGroup": {
"timeout_millis": 60000,
"retry_codes_name": "retry_policy_1_codes",
diff --git a/AnalyticsAdmin/src/V1alpha/resources/analytics_admin_service_descriptor_config.php b/AnalyticsAdmin/src/V1alpha/resources/analytics_admin_service_descriptor_config.php
index 49176ef3d43b..8b2e551bbc4b 100644
--- a/AnalyticsAdmin/src/V1alpha/resources/analytics_admin_service_descriptor_config.php
+++ b/AnalyticsAdmin/src/V1alpha/resources/analytics_admin_service_descriptor_config.php
@@ -159,6 +159,18 @@
],
],
],
+ 'CreateCalculatedMetric' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Analytics\Admin\V1alpha\CalculatedMetric',
+ 'headerParams' => [
+ [
+ 'keyName' => 'parent',
+ 'fieldAccessors' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
'CreateChannelGroup' => [
'callType' => \Google\ApiCore\Call::UNARY_CALL,
'responseType' => 'Google\Analytics\Admin\V1alpha\ChannelGroup',
@@ -403,6 +415,18 @@
],
],
],
+ 'DeleteCalculatedMetric' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Protobuf\GPBEmpty',
+ 'headerParams' => [
+ [
+ 'keyName' => 'name',
+ 'fieldAccessors' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'DeleteChannelGroup' => [
'callType' => \Google\ApiCore\Call::UNARY_CALL,
'responseType' => 'Google\Protobuf\GPBEmpty',
@@ -667,6 +691,18 @@
],
],
],
+ 'GetCalculatedMetric' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Analytics\Admin\V1alpha\CalculatedMetric',
+ 'headerParams' => [
+ [
+ 'keyName' => 'name',
+ 'fieldAccessors' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'GetChannelGroup' => [
'callType' => \Google\ApiCore\Call::UNARY_CALL,
'responseType' => 'Google\Analytics\Admin\V1alpha\ChannelGroup',
@@ -1023,6 +1059,26 @@
],
],
],
+ 'ListCalculatedMetrics' => [
+ 'pageStreaming' => [
+ 'requestPageTokenGetMethod' => 'getPageToken',
+ 'requestPageTokenSetMethod' => 'setPageToken',
+ 'requestPageSizeGetMethod' => 'getPageSize',
+ 'requestPageSizeSetMethod' => 'setPageSize',
+ 'responsePageTokenGetMethod' => 'getNextPageToken',
+ 'resourcesGetMethod' => 'getCalculatedMetrics',
+ ],
+ 'callType' => \Google\ApiCore\Call::PAGINATED_CALL,
+ 'responseType' => 'Google\Analytics\Admin\V1alpha\ListCalculatedMetricsResponse',
+ 'headerParams' => [
+ [
+ 'keyName' => 'parent',
+ 'fieldAccessors' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
'ListChannelGroups' => [
'pageStreaming' => [
'requestPageTokenGetMethod' => 'getPageToken',
@@ -1451,6 +1507,19 @@
],
],
],
+ 'UpdateCalculatedMetric' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Analytics\Admin\V1alpha\CalculatedMetric',
+ 'headerParams' => [
+ [
+ 'keyName' => 'calculated_metric.name',
+ 'fieldAccessors' => [
+ 'getCalculatedMetric',
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'UpdateChannelGroup' => [
'callType' => \Google\ApiCore\Call::UNARY_CALL,
'responseType' => 'Google\Analytics\Admin\V1alpha\ChannelGroup',
@@ -1693,6 +1762,7 @@
'attributionSettings' => 'properties/{property}/attributionSettings',
'audience' => 'properties/{property}/audiences/{audience}',
'bigQueryLink' => 'properties/{property}/bigQueryLinks/{bigquery_link}',
+ 'calculatedMetric' => 'properties/{property}/calculatedMetrics/{calculated_metric}',
'channelGroup' => 'properties/{property}/channelGroups/{channel_group}',
'conversionEvent' => 'properties/{property}/conversionEvents/{conversion_event}',
'customDimension' => 'properties/{property}/customDimensions/{custom_dimension}',
diff --git a/AnalyticsAdmin/src/V1alpha/resources/analytics_admin_service_rest_client_config.php b/AnalyticsAdmin/src/V1alpha/resources/analytics_admin_service_rest_client_config.php
index c6ce31e8e5c8..a143ff7e2880 100644
--- a/AnalyticsAdmin/src/V1alpha/resources/analytics_admin_service_rest_client_config.php
+++ b/AnalyticsAdmin/src/V1alpha/resources/analytics_admin_service_rest_client_config.php
@@ -192,6 +192,21 @@
],
],
],
+ 'CreateCalculatedMetric' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1alpha/{parent=properties/*}/calculatedMetrics',
+ 'body' => 'calculated_metric',
+ 'placeholders' => [
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ 'queryParams' => [
+ 'calculated_metric_id',
+ ],
+ ],
'CreateChannelGroup' => [
'method' => 'post',
'uriTemplate' => '/v1alpha/{parent=properties/*}/channelGroups',
@@ -443,6 +458,17 @@
],
],
],
+ 'DeleteCalculatedMetric' => [
+ 'method' => 'delete',
+ 'uriTemplate' => '/v1alpha/{name=properties/*/calculatedMetrics/*}',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'DeleteChannelGroup' => [
'method' => 'delete',
'uriTemplate' => '/v1alpha/{name=properties/*/channelGroups/*}',
@@ -694,6 +720,17 @@
],
],
],
+ 'GetCalculatedMetric' => [
+ 'method' => 'get',
+ 'uriTemplate' => '/v1alpha/{name=properties/*/calculatedMetrics/*}',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'GetChannelGroup' => [
'method' => 'get',
'uriTemplate' => '/v1alpha/{name=properties/*/channelGroups/*}',
@@ -983,6 +1020,17 @@
],
],
],
+ 'ListCalculatedMetrics' => [
+ 'method' => 'get',
+ 'uriTemplate' => '/v1alpha/{parent=properties/*}/calculatedMetrics',
+ 'placeholders' => [
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
'ListChannelGroups' => [
'method' => 'get',
'uriTemplate' => '/v1alpha/{parent=properties/*}/channelGroups',
@@ -1280,6 +1328,22 @@
'update_mask',
],
],
+ 'UpdateCalculatedMetric' => [
+ 'method' => 'patch',
+ 'uriTemplate' => '/v1alpha/{calculated_metric.name=properties/*/calculatedMetrics/*}',
+ 'body' => 'calculated_metric',
+ 'placeholders' => [
+ 'calculated_metric.name' => [
+ 'getters' => [
+ 'getCalculatedMetric',
+ 'getName',
+ ],
+ ],
+ ],
+ 'queryParams' => [
+ 'update_mask',
+ ],
+ ],
'UpdateChannelGroup' => [
'method' => 'patch',
'uriTemplate' => '/v1alpha/{channel_group.name=properties/*/channelGroups/*}',
diff --git a/AnalyticsAdmin/tests/Unit/V1alpha/AnalyticsAdminServiceClientTest.php b/AnalyticsAdmin/tests/Unit/V1alpha/AnalyticsAdminServiceClientTest.php
index bce61a3b0ac3..3ffc5c45f745 100644
--- a/AnalyticsAdmin/tests/Unit/V1alpha/AnalyticsAdminServiceClientTest.php
+++ b/AnalyticsAdmin/tests/Unit/V1alpha/AnalyticsAdminServiceClientTest.php
@@ -39,6 +39,8 @@
use Google\Analytics\Admin\V1alpha\BatchGetAccessBindingsResponse;
use Google\Analytics\Admin\V1alpha\BatchUpdateAccessBindingsResponse;
use Google\Analytics\Admin\V1alpha\BigQueryLink;
+use Google\Analytics\Admin\V1alpha\CalculatedMetric;
+use Google\Analytics\Admin\V1alpha\CalculatedMetric\MetricUnit;
use Google\Analytics\Admin\V1alpha\ChangeHistoryEvent;
use Google\Analytics\Admin\V1alpha\ChannelGroup;
use Google\Analytics\Admin\V1alpha\ConnectedSiteTag;
@@ -73,6 +75,7 @@
use Google\Analytics\Admin\V1alpha\ListAdSenseLinksResponse;
use Google\Analytics\Admin\V1alpha\ListAudiencesResponse;
use Google\Analytics\Admin\V1alpha\ListBigQueryLinksResponse;
+use Google\Analytics\Admin\V1alpha\ListCalculatedMetricsResponse;
use Google\Analytics\Admin\V1alpha\ListChannelGroupsResponse;
use Google\Analytics\Admin\V1alpha\ListConnectedSiteTagsResponse;
use Google\Analytics\Admin\V1alpha\ListConversionEventsResponse;
@@ -967,6 +970,96 @@ public function createAudienceExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function createCalculatedMetricTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $name = 'name3373707';
+ $description = 'description-1724546052';
+ $displayName = 'displayName1615086568';
+ $calculatedMetricId2 = 'calculatedMetricId2-706401732';
+ $formula = 'formula-677424794';
+ $invalidMetricReference = true;
+ $expectedResponse = new CalculatedMetric();
+ $expectedResponse->setName($name);
+ $expectedResponse->setDescription($description);
+ $expectedResponse->setDisplayName($displayName);
+ $expectedResponse->setCalculatedMetricId($calculatedMetricId2);
+ $expectedResponse->setFormula($formula);
+ $expectedResponse->setInvalidMetricReference($invalidMetricReference);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->propertyName('[PROPERTY]');
+ $calculatedMetricId = 'calculatedMetricId8203465';
+ $calculatedMetric = new CalculatedMetric();
+ $calculatedMetricDisplayName = 'calculatedMetricDisplayName-1927551873';
+ $calculatedMetric->setDisplayName($calculatedMetricDisplayName);
+ $calculatedMetricMetricUnit = MetricUnit::METRIC_UNIT_UNSPECIFIED;
+ $calculatedMetric->setMetricUnit($calculatedMetricMetricUnit);
+ $calculatedMetricFormula = 'calculatedMetricFormula752695416';
+ $calculatedMetric->setFormula($calculatedMetricFormula);
+ $response = $gapicClient->createCalculatedMetric($formattedParent, $calculatedMetricId, $calculatedMetric);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateCalculatedMetric', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $actualValue = $actualRequestObject->getCalculatedMetricId();
+ $this->assertProtobufEquals($calculatedMetricId, $actualValue);
+ $actualValue = $actualRequestObject->getCalculatedMetric();
+ $this->assertProtobufEquals($calculatedMetric, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function createCalculatedMetricExceptionTest()
+ {
+ $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->propertyName('[PROPERTY]');
+ $calculatedMetricId = 'calculatedMetricId8203465';
+ $calculatedMetric = new CalculatedMetric();
+ $calculatedMetricDisplayName = 'calculatedMetricDisplayName-1927551873';
+ $calculatedMetric->setDisplayName($calculatedMetricDisplayName);
+ $calculatedMetricMetricUnit = MetricUnit::METRIC_UNIT_UNSPECIFIED;
+ $calculatedMetric->setMetricUnit($calculatedMetricMetricUnit);
+ $calculatedMetricFormula = 'calculatedMetricFormula752695416';
+ $calculatedMetric->setFormula($calculatedMetricFormula);
+ try {
+ $gapicClient->createCalculatedMetric($formattedParent, $calculatedMetricId, $calculatedMetric);
+ // 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 createChannelGroupTest()
{
@@ -2574,6 +2667,63 @@ public function deleteAdSenseLinkExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function deleteCalculatedMetricTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $expectedResponse = new GPBEmpty();
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedName = $gapicClient->calculatedMetricName('[PROPERTY]', '[CALCULATED_METRIC]');
+ $gapicClient->deleteCalculatedMetric($formattedName);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteCalculatedMetric', $actualFuncCall);
+ $actualValue = $actualRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function deleteCalculatedMetricExceptionTest()
+ {
+ $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->calculatedMetricName('[PROPERTY]', '[CALCULATED_METRIC]');
+ try {
+ $gapicClient->deleteCalculatedMetric($formattedName);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
/** @test */
public function deleteChannelGroupTest()
{
@@ -4001,6 +4151,76 @@ public function getBigQueryLinkExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function getCalculatedMetricTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $name2 = 'name2-1052831874';
+ $description = 'description-1724546052';
+ $displayName = 'displayName1615086568';
+ $calculatedMetricId = 'calculatedMetricId8203465';
+ $formula = 'formula-677424794';
+ $invalidMetricReference = true;
+ $expectedResponse = new CalculatedMetric();
+ $expectedResponse->setName($name2);
+ $expectedResponse->setDescription($description);
+ $expectedResponse->setDisplayName($displayName);
+ $expectedResponse->setCalculatedMetricId($calculatedMetricId);
+ $expectedResponse->setFormula($formula);
+ $expectedResponse->setInvalidMetricReference($invalidMetricReference);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedName = $gapicClient->calculatedMetricName('[PROPERTY]', '[CALCULATED_METRIC]');
+ $response = $gapicClient->getCalculatedMetric($formattedName);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.analytics.admin.v1alpha.AnalyticsAdminService/GetCalculatedMetric', $actualFuncCall);
+ $actualValue = $actualRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function getCalculatedMetricExceptionTest()
+ {
+ $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->calculatedMetricName('[PROPERTY]', '[CALCULATED_METRIC]');
+ try {
+ $gapicClient->getCalculatedMetric($formattedName);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
/** @test */
public function getChannelGroupTest()
{
@@ -5765,6 +5985,74 @@ public function listBigQueryLinksExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function listCalculatedMetricsTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $nextPageToken = '';
+ $calculatedMetricsElement = new CalculatedMetric();
+ $calculatedMetrics = [
+ $calculatedMetricsElement,
+ ];
+ $expectedResponse = new ListCalculatedMetricsResponse();
+ $expectedResponse->setNextPageToken($nextPageToken);
+ $expectedResponse->setCalculatedMetrics($calculatedMetrics);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->propertyName('[PROPERTY]');
+ $response = $gapicClient->listCalculatedMetrics($formattedParent);
+ $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
+ $resources = iterator_to_array($response->iterateAllElements());
+ $this->assertSame(1, count($resources));
+ $this->assertEquals($expectedResponse->getCalculatedMetrics()[0], $resources[0]);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.analytics.admin.v1alpha.AnalyticsAdminService/ListCalculatedMetrics', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listCalculatedMetricsExceptionTest()
+ {
+ $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->propertyName('[PROPERTY]');
+ try {
+ $gapicClient->listCalculatedMetrics($formattedParent);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
/** @test */
public function listChannelGroupsTest()
{
@@ -7511,6 +7799,92 @@ public function updateAudienceExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function updateCalculatedMetricTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $name = 'name3373707';
+ $description = 'description-1724546052';
+ $displayName = 'displayName1615086568';
+ $calculatedMetricId = 'calculatedMetricId8203465';
+ $formula = 'formula-677424794';
+ $invalidMetricReference = true;
+ $expectedResponse = new CalculatedMetric();
+ $expectedResponse->setName($name);
+ $expectedResponse->setDescription($description);
+ $expectedResponse->setDisplayName($displayName);
+ $expectedResponse->setCalculatedMetricId($calculatedMetricId);
+ $expectedResponse->setFormula($formula);
+ $expectedResponse->setInvalidMetricReference($invalidMetricReference);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $calculatedMetric = new CalculatedMetric();
+ $calculatedMetricDisplayName = 'calculatedMetricDisplayName-1927551873';
+ $calculatedMetric->setDisplayName($calculatedMetricDisplayName);
+ $calculatedMetricMetricUnit = MetricUnit::METRIC_UNIT_UNSPECIFIED;
+ $calculatedMetric->setMetricUnit($calculatedMetricMetricUnit);
+ $calculatedMetricFormula = 'calculatedMetricFormula752695416';
+ $calculatedMetric->setFormula($calculatedMetricFormula);
+ $updateMask = new FieldMask();
+ $response = $gapicClient->updateCalculatedMetric($calculatedMetric, $updateMask);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateCalculatedMetric', $actualFuncCall);
+ $actualValue = $actualRequestObject->getCalculatedMetric();
+ $this->assertProtobufEquals($calculatedMetric, $actualValue);
+ $actualValue = $actualRequestObject->getUpdateMask();
+ $this->assertProtobufEquals($updateMask, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function updateCalculatedMetricExceptionTest()
+ {
+ $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
+ $calculatedMetric = new CalculatedMetric();
+ $calculatedMetricDisplayName = 'calculatedMetricDisplayName-1927551873';
+ $calculatedMetric->setDisplayName($calculatedMetricDisplayName);
+ $calculatedMetricMetricUnit = MetricUnit::METRIC_UNIT_UNSPECIFIED;
+ $calculatedMetric->setMetricUnit($calculatedMetricMetricUnit);
+ $calculatedMetricFormula = 'calculatedMetricFormula752695416';
+ $calculatedMetric->setFormula($calculatedMetricFormula);
+ $updateMask = new FieldMask();
+ try {
+ $gapicClient->updateCalculatedMetric($calculatedMetric, $updateMask);
+ // 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 updateChannelGroupTest()
{
diff --git a/AnalyticsAdmin/tests/Unit/V1alpha/Client/AnalyticsAdminServiceClientTest.php b/AnalyticsAdmin/tests/Unit/V1alpha/Client/AnalyticsAdminServiceClientTest.php
index 5164e78c8977..3bc605662b67 100644
--- a/AnalyticsAdmin/tests/Unit/V1alpha/Client/AnalyticsAdminServiceClientTest.php
+++ b/AnalyticsAdmin/tests/Unit/V1alpha/Client/AnalyticsAdminServiceClientTest.php
@@ -47,6 +47,8 @@
use Google\Analytics\Admin\V1alpha\BatchUpdateAccessBindingsRequest;
use Google\Analytics\Admin\V1alpha\BatchUpdateAccessBindingsResponse;
use Google\Analytics\Admin\V1alpha\BigQueryLink;
+use Google\Analytics\Admin\V1alpha\CalculatedMetric;
+use Google\Analytics\Admin\V1alpha\CalculatedMetric\MetricUnit;
use Google\Analytics\Admin\V1alpha\CancelDisplayVideo360AdvertiserLinkProposalRequest;
use Google\Analytics\Admin\V1alpha\ChangeHistoryEvent;
use Google\Analytics\Admin\V1alpha\ChannelGroup;
@@ -56,6 +58,7 @@
use Google\Analytics\Admin\V1alpha\CreateAccessBindingRequest;
use Google\Analytics\Admin\V1alpha\CreateAdSenseLinkRequest;
use Google\Analytics\Admin\V1alpha\CreateAudienceRequest;
+use Google\Analytics\Admin\V1alpha\CreateCalculatedMetricRequest;
use Google\Analytics\Admin\V1alpha\CreateChannelGroupRequest;
use Google\Analytics\Admin\V1alpha\CreateConnectedSiteTagRequest;
use Google\Analytics\Admin\V1alpha\CreateConnectedSiteTagResponse;
@@ -92,6 +95,7 @@
use Google\Analytics\Admin\V1alpha\DeleteAccessBindingRequest;
use Google\Analytics\Admin\V1alpha\DeleteAccountRequest;
use Google\Analytics\Admin\V1alpha\DeleteAdSenseLinkRequest;
+use Google\Analytics\Admin\V1alpha\DeleteCalculatedMetricRequest;
use Google\Analytics\Admin\V1alpha\DeleteChannelGroupRequest;
use Google\Analytics\Admin\V1alpha\DeleteConnectedSiteTagRequest;
use Google\Analytics\Admin\V1alpha\DeleteConversionEventRequest;
@@ -124,6 +128,7 @@
use Google\Analytics\Admin\V1alpha\GetAttributionSettingsRequest;
use Google\Analytics\Admin\V1alpha\GetAudienceRequest;
use Google\Analytics\Admin\V1alpha\GetBigQueryLinkRequest;
+use Google\Analytics\Admin\V1alpha\GetCalculatedMetricRequest;
use Google\Analytics\Admin\V1alpha\GetChannelGroupRequest;
use Google\Analytics\Admin\V1alpha\GetConversionEventRequest;
use Google\Analytics\Admin\V1alpha\GetCustomDimensionRequest;
@@ -160,6 +165,8 @@
use Google\Analytics\Admin\V1alpha\ListAudiencesResponse;
use Google\Analytics\Admin\V1alpha\ListBigQueryLinksRequest;
use Google\Analytics\Admin\V1alpha\ListBigQueryLinksResponse;
+use Google\Analytics\Admin\V1alpha\ListCalculatedMetricsRequest;
+use Google\Analytics\Admin\V1alpha\ListCalculatedMetricsResponse;
use Google\Analytics\Admin\V1alpha\ListChannelGroupsRequest;
use Google\Analytics\Admin\V1alpha\ListChannelGroupsResponse;
use Google\Analytics\Admin\V1alpha\ListConnectedSiteTagsRequest;
@@ -215,6 +222,7 @@
use Google\Analytics\Admin\V1alpha\UpdateAccountRequest;
use Google\Analytics\Admin\V1alpha\UpdateAttributionSettingsRequest;
use Google\Analytics\Admin\V1alpha\UpdateAudienceRequest;
+use Google\Analytics\Admin\V1alpha\UpdateCalculatedMetricRequest;
use Google\Analytics\Admin\V1alpha\UpdateChannelGroupRequest;
use Google\Analytics\Admin\V1alpha\UpdateConversionEventRequest;
use Google\Analytics\Admin\V1alpha\UpdateCustomDimensionRequest;
@@ -1166,6 +1174,104 @@ public function createAudienceExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function createCalculatedMetricTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $name = 'name3373707';
+ $description = 'description-1724546052';
+ $displayName = 'displayName1615086568';
+ $calculatedMetricId2 = 'calculatedMetricId2-706401732';
+ $formula = 'formula-677424794';
+ $invalidMetricReference = true;
+ $expectedResponse = new CalculatedMetric();
+ $expectedResponse->setName($name);
+ $expectedResponse->setDescription($description);
+ $expectedResponse->setDisplayName($displayName);
+ $expectedResponse->setCalculatedMetricId($calculatedMetricId2);
+ $expectedResponse->setFormula($formula);
+ $expectedResponse->setInvalidMetricReference($invalidMetricReference);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->propertyName('[PROPERTY]');
+ $calculatedMetricId = 'calculatedMetricId8203465';
+ $calculatedMetric = new CalculatedMetric();
+ $calculatedMetricDisplayName = 'calculatedMetricDisplayName-1927551873';
+ $calculatedMetric->setDisplayName($calculatedMetricDisplayName);
+ $calculatedMetricMetricUnit = MetricUnit::METRIC_UNIT_UNSPECIFIED;
+ $calculatedMetric->setMetricUnit($calculatedMetricMetricUnit);
+ $calculatedMetricFormula = 'calculatedMetricFormula752695416';
+ $calculatedMetric->setFormula($calculatedMetricFormula);
+ $request = (new CreateCalculatedMetricRequest())
+ ->setParent($formattedParent)
+ ->setCalculatedMetricId($calculatedMetricId)
+ ->setCalculatedMetric($calculatedMetric);
+ $response = $gapicClient->createCalculatedMetric($request);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateCalculatedMetric', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $actualValue = $actualRequestObject->getCalculatedMetricId();
+ $this->assertProtobufEquals($calculatedMetricId, $actualValue);
+ $actualValue = $actualRequestObject->getCalculatedMetric();
+ $this->assertProtobufEquals($calculatedMetric, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function createCalculatedMetricExceptionTest()
+ {
+ $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->propertyName('[PROPERTY]');
+ $calculatedMetricId = 'calculatedMetricId8203465';
+ $calculatedMetric = new CalculatedMetric();
+ $calculatedMetricDisplayName = 'calculatedMetricDisplayName-1927551873';
+ $calculatedMetric->setDisplayName($calculatedMetricDisplayName);
+ $calculatedMetricMetricUnit = MetricUnit::METRIC_UNIT_UNSPECIFIED;
+ $calculatedMetric->setMetricUnit($calculatedMetricMetricUnit);
+ $calculatedMetricFormula = 'calculatedMetricFormula752695416';
+ $calculatedMetric->setFormula($calculatedMetricFormula);
+ $request = (new CreateCalculatedMetricRequest())
+ ->setParent($formattedParent)
+ ->setCalculatedMetricId($calculatedMetricId)
+ ->setCalculatedMetric($calculatedMetric);
+ try {
+ $gapicClient->createCalculatedMetric($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 createChannelGroupTest()
{
@@ -2899,6 +3005,67 @@ public function deleteAdSenseLinkExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function deleteCalculatedMetricTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $expectedResponse = new GPBEmpty();
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedName = $gapicClient->calculatedMetricName('[PROPERTY]', '[CALCULATED_METRIC]');
+ $request = (new DeleteCalculatedMetricRequest())
+ ->setName($formattedName);
+ $gapicClient->deleteCalculatedMetric($request);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteCalculatedMetric', $actualFuncCall);
+ $actualValue = $actualRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function deleteCalculatedMetricExceptionTest()
+ {
+ $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->calculatedMetricName('[PROPERTY]', '[CALCULATED_METRIC]');
+ $request = (new DeleteCalculatedMetricRequest())
+ ->setName($formattedName);
+ try {
+ $gapicClient->deleteCalculatedMetric($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 deleteChannelGroupTest()
{
@@ -4420,6 +4587,80 @@ public function getBigQueryLinkExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function getCalculatedMetricTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $name2 = 'name2-1052831874';
+ $description = 'description-1724546052';
+ $displayName = 'displayName1615086568';
+ $calculatedMetricId = 'calculatedMetricId8203465';
+ $formula = 'formula-677424794';
+ $invalidMetricReference = true;
+ $expectedResponse = new CalculatedMetric();
+ $expectedResponse->setName($name2);
+ $expectedResponse->setDescription($description);
+ $expectedResponse->setDisplayName($displayName);
+ $expectedResponse->setCalculatedMetricId($calculatedMetricId);
+ $expectedResponse->setFormula($formula);
+ $expectedResponse->setInvalidMetricReference($invalidMetricReference);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedName = $gapicClient->calculatedMetricName('[PROPERTY]', '[CALCULATED_METRIC]');
+ $request = (new GetCalculatedMetricRequest())
+ ->setName($formattedName);
+ $response = $gapicClient->getCalculatedMetric($request);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.analytics.admin.v1alpha.AnalyticsAdminService/GetCalculatedMetric', $actualFuncCall);
+ $actualValue = $actualRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function getCalculatedMetricExceptionTest()
+ {
+ $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->calculatedMetricName('[PROPERTY]', '[CALCULATED_METRIC]');
+ $request = (new GetCalculatedMetricRequest())
+ ->setName($formattedName);
+ try {
+ $gapicClient->getCalculatedMetric($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 getChannelGroupTest()
{
@@ -6288,6 +6529,78 @@ public function listBigQueryLinksExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function listCalculatedMetricsTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $nextPageToken = '';
+ $calculatedMetricsElement = new CalculatedMetric();
+ $calculatedMetrics = [
+ $calculatedMetricsElement,
+ ];
+ $expectedResponse = new ListCalculatedMetricsResponse();
+ $expectedResponse->setNextPageToken($nextPageToken);
+ $expectedResponse->setCalculatedMetrics($calculatedMetrics);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->propertyName('[PROPERTY]');
+ $request = (new ListCalculatedMetricsRequest())
+ ->setParent($formattedParent);
+ $response = $gapicClient->listCalculatedMetrics($request);
+ $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
+ $resources = iterator_to_array($response->iterateAllElements());
+ $this->assertSame(1, count($resources));
+ $this->assertEquals($expectedResponse->getCalculatedMetrics()[0], $resources[0]);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.analytics.admin.v1alpha.AnalyticsAdminService/ListCalculatedMetrics', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listCalculatedMetricsExceptionTest()
+ {
+ $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->propertyName('[PROPERTY]');
+ $request = (new ListCalculatedMetricsRequest())
+ ->setParent($formattedParent);
+ try {
+ $gapicClient->listCalculatedMetrics($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 listChannelGroupsTest()
{
@@ -8138,6 +8451,98 @@ public function updateAudienceExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function updateCalculatedMetricTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $name = 'name3373707';
+ $description = 'description-1724546052';
+ $displayName = 'displayName1615086568';
+ $calculatedMetricId = 'calculatedMetricId8203465';
+ $formula = 'formula-677424794';
+ $invalidMetricReference = true;
+ $expectedResponse = new CalculatedMetric();
+ $expectedResponse->setName($name);
+ $expectedResponse->setDescription($description);
+ $expectedResponse->setDisplayName($displayName);
+ $expectedResponse->setCalculatedMetricId($calculatedMetricId);
+ $expectedResponse->setFormula($formula);
+ $expectedResponse->setInvalidMetricReference($invalidMetricReference);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $calculatedMetric = new CalculatedMetric();
+ $calculatedMetricDisplayName = 'calculatedMetricDisplayName-1927551873';
+ $calculatedMetric->setDisplayName($calculatedMetricDisplayName);
+ $calculatedMetricMetricUnit = MetricUnit::METRIC_UNIT_UNSPECIFIED;
+ $calculatedMetric->setMetricUnit($calculatedMetricMetricUnit);
+ $calculatedMetricFormula = 'calculatedMetricFormula752695416';
+ $calculatedMetric->setFormula($calculatedMetricFormula);
+ $updateMask = new FieldMask();
+ $request = (new UpdateCalculatedMetricRequest())
+ ->setCalculatedMetric($calculatedMetric)
+ ->setUpdateMask($updateMask);
+ $response = $gapicClient->updateCalculatedMetric($request);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateCalculatedMetric', $actualFuncCall);
+ $actualValue = $actualRequestObject->getCalculatedMetric();
+ $this->assertProtobufEquals($calculatedMetric, $actualValue);
+ $actualValue = $actualRequestObject->getUpdateMask();
+ $this->assertProtobufEquals($updateMask, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function updateCalculatedMetricExceptionTest()
+ {
+ $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
+ $calculatedMetric = new CalculatedMetric();
+ $calculatedMetricDisplayName = 'calculatedMetricDisplayName-1927551873';
+ $calculatedMetric->setDisplayName($calculatedMetricDisplayName);
+ $calculatedMetricMetricUnit = MetricUnit::METRIC_UNIT_UNSPECIFIED;
+ $calculatedMetric->setMetricUnit($calculatedMetricMetricUnit);
+ $calculatedMetricFormula = 'calculatedMetricFormula752695416';
+ $calculatedMetric->setFormula($calculatedMetricFormula);
+ $updateMask = new FieldMask();
+ $request = (new UpdateCalculatedMetricRequest())
+ ->setCalculatedMetric($calculatedMetric)
+ ->setUpdateMask($updateMask);
+ try {
+ $gapicClient->updateCalculatedMetric($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 updateChannelGroupTest()
{