diff --git a/AnalyticsData/metadata/V1Alpha/AnalyticsDataApi.php b/AnalyticsData/metadata/V1Alpha/AnalyticsDataApi.php index fce3ba97b717..0e18d43baed4 100644 Binary files a/AnalyticsData/metadata/V1Alpha/AnalyticsDataApi.php and b/AnalyticsData/metadata/V1Alpha/AnalyticsDataApi.php differ diff --git a/AnalyticsData/samples/V1alpha/AlphaAnalyticsDataClient/create_report_task.php b/AnalyticsData/samples/V1alpha/AlphaAnalyticsDataClient/create_report_task.php index 22e5fc7dfc78..f4f70e87051f 100644 --- a/AnalyticsData/samples/V1alpha/AlphaAnalyticsDataClient/create_report_task.php +++ b/AnalyticsData/samples/V1alpha/AlphaAnalyticsDataClient/create_report_task.php @@ -36,6 +36,12 @@ * asynchronous request to form a customized report of your Google Analytics * event data. * + * A report task will be retained and available for querying for 72 hours + * after it has been created. + * + * A report task created by one user can be listed and queried by all users + * who have access to the property. + * * @param string $formattedParent The parent resource where this report task will be created. * Format: `properties/{propertyId}` * Please see {@see AlphaAnalyticsDataClient::propertyName()} for help formatting this field. diff --git a/AnalyticsData/samples/V1alpha/AlphaAnalyticsDataClient/get_property_quotas_snapshot.php b/AnalyticsData/samples/V1alpha/AlphaAnalyticsDataClient/get_property_quotas_snapshot.php new file mode 100644 index 000000000000..ab0228bcf6ac --- /dev/null +++ b/AnalyticsData/samples/V1alpha/AlphaAnalyticsDataClient/get_property_quotas_snapshot.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var PropertyQuotasSnapshot $response */ + $response = $alphaAnalyticsDataClient->getPropertyQuotasSnapshot($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 = AlphaAnalyticsDataClient::propertyQuotasSnapshotName('[PROPERTY]'); + + get_property_quotas_snapshot_sample($formattedName); +} +// [END analyticsdata_v1alpha_generated_AlphaAnalyticsData_GetPropertyQuotasSnapshot_sync] diff --git a/AnalyticsData/src/V1alpha/Client/AlphaAnalyticsDataClient.php b/AnalyticsData/src/V1alpha/Client/AlphaAnalyticsDataClient.php index 6ef322b24f54..0f4e8ccbea65 100644 --- a/AnalyticsData/src/V1alpha/Client/AlphaAnalyticsDataClient.php +++ b/AnalyticsData/src/V1alpha/Client/AlphaAnalyticsDataClient.php @@ -31,11 +31,13 @@ use Google\Analytics\Data\V1alpha\CreateRecurringAudienceListRequest; use Google\Analytics\Data\V1alpha\CreateReportTaskRequest; use Google\Analytics\Data\V1alpha\GetAudienceListRequest; +use Google\Analytics\Data\V1alpha\GetPropertyQuotasSnapshotRequest; use Google\Analytics\Data\V1alpha\GetRecurringAudienceListRequest; use Google\Analytics\Data\V1alpha\GetReportTaskRequest; use Google\Analytics\Data\V1alpha\ListAudienceListsRequest; use Google\Analytics\Data\V1alpha\ListRecurringAudienceListsRequest; use Google\Analytics\Data\V1alpha\ListReportTasksRequest; +use Google\Analytics\Data\V1alpha\PropertyQuotasSnapshot; use Google\Analytics\Data\V1alpha\QueryAudienceListRequest; use Google\Analytics\Data\V1alpha\QueryAudienceListResponse; use Google\Analytics\Data\V1alpha\QueryReportTaskRequest; @@ -78,6 +80,7 @@ * @method PromiseInterface createRecurringAudienceListAsync(CreateRecurringAudienceListRequest $request, array $optionalArgs = []) * @method PromiseInterface createReportTaskAsync(CreateReportTaskRequest $request, array $optionalArgs = []) * @method PromiseInterface getAudienceListAsync(GetAudienceListRequest $request, array $optionalArgs = []) + * @method PromiseInterface getPropertyQuotasSnapshotAsync(GetPropertyQuotasSnapshotRequest $request, array $optionalArgs = []) * @method PromiseInterface getRecurringAudienceListAsync(GetRecurringAudienceListRequest $request, array $optionalArgs = []) * @method PromiseInterface getReportTaskAsync(GetReportTaskRequest $request, array $optionalArgs = []) * @method PromiseInterface listAudienceListsAsync(ListAudienceListsRequest $request, array $optionalArgs = []) @@ -211,6 +214,23 @@ public static function propertyName(string $property): string ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * property_quotas_snapshot resource. + * + * @param string $property + * + * @return string The formatted property_quotas_snapshot resource. + * + * @experimental + */ + public static function propertyQuotasSnapshotName(string $property): string + { + return self::getPathTemplate('propertyQuotasSnapshot')->render([ + 'property' => $property, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * recurring_audience_list resource. @@ -255,6 +275,7 @@ public static function reportTaskName(string $property, string $reportTask): str * Template: Pattern * - audienceList: properties/{property}/audienceLists/{audience_list} * - property: properties/{property} + * - propertyQuotasSnapshot: properties/{property}/propertyQuotasSnapshot * - recurringAudienceList: properties/{property}/recurringAudienceLists/{recurring_audience_list} * - reportTask: properties/{property}/reportTasks/{report_task} * @@ -456,6 +477,12 @@ public function createRecurringAudienceList(CreateRecurringAudienceListRequest $ * asynchronous request to form a customized report of your Google Analytics * event data. * + * A report task will be retained and available for querying for 72 hours + * after it has been created. + * + * A report task created by one user can be listed and queried by all users + * who have access to the property. + * * The async variant is {@see AlphaAnalyticsDataClient::createReportTaskAsync()} . * * @example samples/V1alpha/AlphaAnalyticsDataClient/create_report_task.php @@ -520,6 +547,36 @@ public function getAudienceList(GetAudienceListRequest $request, array $callOpti return $this->startApiCall('GetAudienceList', $request, $callOptions)->wait(); } + /** + * Get all property quotas organized by quota category for a given property. + * This will charge 1 property quota from the category with the most quota. + * + * The async variant is + * {@see AlphaAnalyticsDataClient::getPropertyQuotasSnapshotAsync()} . + * + * @example samples/V1alpha/AlphaAnalyticsDataClient/get_property_quotas_snapshot.php + * + * @param GetPropertyQuotasSnapshotRequest $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 PropertyQuotasSnapshot + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getPropertyQuotasSnapshot(GetPropertyQuotasSnapshotRequest $request, array $callOptions = []): PropertyQuotasSnapshot + { + return $this->startApiCall('GetPropertyQuotasSnapshot', $request, $callOptions)->wait(); + } + /** * Gets configuration metadata about a specific recurring audience list. This * method can be used to understand a recurring audience list's state after it diff --git a/AnalyticsData/src/V1alpha/Gapic/AlphaAnalyticsDataGapicClient.php b/AnalyticsData/src/V1alpha/Gapic/AlphaAnalyticsDataGapicClient.php index 749a0cf0226a..1181886c84ba 100644 --- a/AnalyticsData/src/V1alpha/Gapic/AlphaAnalyticsDataGapicClient.php +++ b/AnalyticsData/src/V1alpha/Gapic/AlphaAnalyticsDataGapicClient.php @@ -36,6 +36,7 @@ use Google\Analytics\Data\V1alpha\FunnelBreakdown; use Google\Analytics\Data\V1alpha\FunnelNextAction; use Google\Analytics\Data\V1alpha\GetAudienceListRequest; +use Google\Analytics\Data\V1alpha\GetPropertyQuotasSnapshotRequest; use Google\Analytics\Data\V1alpha\GetRecurringAudienceListRequest; use Google\Analytics\Data\V1alpha\GetReportTaskRequest; use Google\Analytics\Data\V1alpha\ListAudienceListsRequest; @@ -44,6 +45,7 @@ use Google\Analytics\Data\V1alpha\ListRecurringAudienceListsResponse; use Google\Analytics\Data\V1alpha\ListReportTasksRequest; use Google\Analytics\Data\V1alpha\ListReportTasksResponse; +use Google\Analytics\Data\V1alpha\PropertyQuotasSnapshot; use Google\Analytics\Data\V1alpha\QueryAudienceListRequest; use Google\Analytics\Data\V1alpha\QueryAudienceListResponse; use Google\Analytics\Data\V1alpha\QueryReportTaskRequest; @@ -155,6 +157,8 @@ class AlphaAnalyticsDataGapicClient private static $propertyNameTemplate; + private static $propertyQuotasSnapshotNameTemplate; + private static $recurringAudienceListNameTemplate; private static $reportTaskNameTemplate; @@ -212,6 +216,17 @@ private static function getPropertyNameTemplate() return self::$propertyNameTemplate; } + private static function getPropertyQuotasSnapshotNameTemplate() + { + if (self::$propertyQuotasSnapshotNameTemplate == null) { + self::$propertyQuotasSnapshotNameTemplate = new PathTemplate( + 'properties/{property}/propertyQuotasSnapshot' + ); + } + + return self::$propertyQuotasSnapshotNameTemplate; + } + private static function getRecurringAudienceListNameTemplate() { if (self::$recurringAudienceListNameTemplate == null) { @@ -240,6 +255,7 @@ private static function getPathTemplateMap() self::$pathTemplateMap = [ 'audienceList' => self::getAudienceListNameTemplate(), 'property' => self::getPropertyNameTemplate(), + 'propertyQuotasSnapshot' => self::getPropertyQuotasSnapshotNameTemplate(), 'recurringAudienceList' => self::getRecurringAudienceListNameTemplate(), 'reportTask' => self::getReportTaskNameTemplate(), ]; @@ -284,6 +300,23 @@ public static function propertyName($property) ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * property_quotas_snapshot resource. + * + * @param string $property + * + * @return string The formatted property_quotas_snapshot resource. + * + * @experimental + */ + public static function propertyQuotasSnapshotName($property) + { + return self::getPropertyQuotasSnapshotNameTemplate()->render([ + 'property' => $property, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * recurring_audience_list resource. @@ -330,6 +363,7 @@ public static function reportTaskName($property, $reportTask) * Template: Pattern * - audienceList: properties/{property}/audienceLists/{audience_list} * - property: properties/{property} + * - propertyQuotasSnapshot: properties/{property}/propertyQuotasSnapshot * - recurringAudienceList: properties/{property}/recurringAudienceLists/{recurring_audience_list} * - reportTask: properties/{property}/reportTasks/{report_task} * @@ -661,6 +695,12 @@ public function createRecurringAudienceList( * asynchronous request to form a customized report of your Google Analytics * event data. * + * A report task will be retained and available for querying for 72 hours + * after it has been created. + * + * A report task created by one user can be listed and queried by all users + * who have access to the property. + * * Sample code: * ``` * $alphaAnalyticsDataClient = new AlphaAnalyticsDataClient(); @@ -802,6 +842,58 @@ public function getAudienceList($name, array $optionalArgs = []) )->wait(); } + /** + * Get all property quotas organized by quota category for a given property. + * This will charge 1 property quota from the category with the most quota. + * + * Sample code: + * ``` + * $alphaAnalyticsDataClient = new AlphaAnalyticsDataClient(); + * try { + * $formattedName = $alphaAnalyticsDataClient->propertyQuotasSnapshotName('[PROPERTY]'); + * $response = $alphaAnalyticsDataClient->getPropertyQuotasSnapshot($formattedName); + * } finally { + * $alphaAnalyticsDataClient->close(); + * } + * ``` + * + * @param string $name Required. Quotas from this property will be listed in the response. + * Format: `properties/{property}/propertyQuotasSnapshot` + * @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\Data\V1alpha\PropertyQuotasSnapshot + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getPropertyQuotasSnapshot($name, array $optionalArgs = []) + { + $request = new GetPropertyQuotasSnapshotRequest(); + $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( + 'GetPropertyQuotasSnapshot', + PropertyQuotasSnapshot::class, + $optionalArgs, + $request + )->wait(); + } + /** * Gets configuration metadata about a specific recurring audience list. This * method can be used to understand a recurring audience list's state after it @@ -1401,9 +1493,9 @@ public function queryReportTask($name, array $optionalArgs = []) * Optional. * * @type string $property - * Optional. A Google Analytics GA4 property identifier whose events are - * tracked. Specified in the URL path and not the body. To learn more, see - * [where to find your Property + * Optional. A Google Analytics property identifier whose events are tracked. + * Specified in the URL path and not the body. To learn more, see [where to + * find your Property * ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). * Within a batch request, this property should either be unspecified or * consistent with the batch-level property. diff --git a/AnalyticsData/src/V1alpha/GetPropertyQuotasSnapshotRequest.php b/AnalyticsData/src/V1alpha/GetPropertyQuotasSnapshotRequest.php new file mode 100644 index 000000000000..cdc27c4a2bf5 --- /dev/null +++ b/AnalyticsData/src/V1alpha/GetPropertyQuotasSnapshotRequest.php @@ -0,0 +1,86 @@ +google.analytics.data.v1alpha.GetPropertyQuotasSnapshotRequest + */ +class GetPropertyQuotasSnapshotRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Quotas from this property will be listed in the response. + * Format: `properties/{property}/propertyQuotasSnapshot` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * @param string $name Required. Quotas from this property will be listed in the response. + * Format: `properties/{property}/propertyQuotasSnapshot` + * Please see {@see AlphaAnalyticsDataClient::propertyQuotasSnapshotName()} for help formatting this field. + * + * @return \Google\Analytics\Data\V1alpha\GetPropertyQuotasSnapshotRequest + * + * @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. Quotas from this property will be listed in the response. + * Format: `properties/{property}/propertyQuotasSnapshot` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Analytics\Data\V1Alpha\AnalyticsDataApi::initOnce(); + parent::__construct($data); + } + + /** + * Required. Quotas from this property will be listed in the response. + * Format: `properties/{property}/propertyQuotasSnapshot` + * + * 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. Quotas from this property will be listed in the response. + * Format: `properties/{property}/propertyQuotasSnapshot` + * + * 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/AnalyticsData/src/V1alpha/PropertyQuotasSnapshot.php b/AnalyticsData/src/V1alpha/PropertyQuotasSnapshot.php new file mode 100644 index 000000000000..2e339e91c599 --- /dev/null +++ b/AnalyticsData/src/V1alpha/PropertyQuotasSnapshot.php @@ -0,0 +1,199 @@ +google.analytics.data.v1alpha.PropertyQuotasSnapshot + */ +class PropertyQuotasSnapshot extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The property quota snapshot resource name. + * + * Generated from protobuf field string name = 4 [(.google.api.field_behavior) = IDENTIFIER]; + */ + private $name = ''; + /** + * Property Quota for core property tokens + * + * Generated from protobuf field .google.analytics.data.v1alpha.PropertyQuota core_property_quota = 1; + */ + private $core_property_quota = null; + /** + * Property Quota for realtime property tokens + * + * Generated from protobuf field .google.analytics.data.v1alpha.PropertyQuota realtime_property_quota = 2; + */ + private $realtime_property_quota = null; + /** + * Property Quota for funnel property tokens + * + * Generated from protobuf field .google.analytics.data.v1alpha.PropertyQuota funnel_property_quota = 3; + */ + private $funnel_property_quota = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The property quota snapshot resource name. + * @type \Google\Analytics\Data\V1alpha\PropertyQuota $core_property_quota + * Property Quota for core property tokens + * @type \Google\Analytics\Data\V1alpha\PropertyQuota $realtime_property_quota + * Property Quota for realtime property tokens + * @type \Google\Analytics\Data\V1alpha\PropertyQuota $funnel_property_quota + * Property Quota for funnel property tokens + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Analytics\Data\V1Alpha\AnalyticsDataApi::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The property quota snapshot resource name. + * + * Generated from protobuf field string name = 4 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The property quota snapshot resource name. + * + * Generated from protobuf field string name = 4 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Property Quota for core property tokens + * + * Generated from protobuf field .google.analytics.data.v1alpha.PropertyQuota core_property_quota = 1; + * @return \Google\Analytics\Data\V1alpha\PropertyQuota|null + */ + public function getCorePropertyQuota() + { + return $this->core_property_quota; + } + + public function hasCorePropertyQuota() + { + return isset($this->core_property_quota); + } + + public function clearCorePropertyQuota() + { + unset($this->core_property_quota); + } + + /** + * Property Quota for core property tokens + * + * Generated from protobuf field .google.analytics.data.v1alpha.PropertyQuota core_property_quota = 1; + * @param \Google\Analytics\Data\V1alpha\PropertyQuota $var + * @return $this + */ + public function setCorePropertyQuota($var) + { + GPBUtil::checkMessage($var, \Google\Analytics\Data\V1alpha\PropertyQuota::class); + $this->core_property_quota = $var; + + return $this; + } + + /** + * Property Quota for realtime property tokens + * + * Generated from protobuf field .google.analytics.data.v1alpha.PropertyQuota realtime_property_quota = 2; + * @return \Google\Analytics\Data\V1alpha\PropertyQuota|null + */ + public function getRealtimePropertyQuota() + { + return $this->realtime_property_quota; + } + + public function hasRealtimePropertyQuota() + { + return isset($this->realtime_property_quota); + } + + public function clearRealtimePropertyQuota() + { + unset($this->realtime_property_quota); + } + + /** + * Property Quota for realtime property tokens + * + * Generated from protobuf field .google.analytics.data.v1alpha.PropertyQuota realtime_property_quota = 2; + * @param \Google\Analytics\Data\V1alpha\PropertyQuota $var + * @return $this + */ + public function setRealtimePropertyQuota($var) + { + GPBUtil::checkMessage($var, \Google\Analytics\Data\V1alpha\PropertyQuota::class); + $this->realtime_property_quota = $var; + + return $this; + } + + /** + * Property Quota for funnel property tokens + * + * Generated from protobuf field .google.analytics.data.v1alpha.PropertyQuota funnel_property_quota = 3; + * @return \Google\Analytics\Data\V1alpha\PropertyQuota|null + */ + public function getFunnelPropertyQuota() + { + return $this->funnel_property_quota; + } + + public function hasFunnelPropertyQuota() + { + return isset($this->funnel_property_quota); + } + + public function clearFunnelPropertyQuota() + { + unset($this->funnel_property_quota); + } + + /** + * Property Quota for funnel property tokens + * + * Generated from protobuf field .google.analytics.data.v1alpha.PropertyQuota funnel_property_quota = 3; + * @param \Google\Analytics\Data\V1alpha\PropertyQuota $var + * @return $this + */ + public function setFunnelPropertyQuota($var) + { + GPBUtil::checkMessage($var, \Google\Analytics\Data\V1alpha\PropertyQuota::class); + $this->funnel_property_quota = $var; + + return $this; + } + +} + diff --git a/AnalyticsData/src/V1alpha/ReportTask.php b/AnalyticsData/src/V1alpha/ReportTask.php index 38e457422bb5..0b02911ad64b 100644 --- a/AnalyticsData/src/V1alpha/ReportTask.php +++ b/AnalyticsData/src/V1alpha/ReportTask.php @@ -17,7 +17,7 @@ class ReportTask extends \Google\Protobuf\Internal\Message { /** * Output only. Identifier. The report task resource name assigned during - * creation. Format: `properties/{property}/reportTasks/{report_task}` + * creation. Format: "properties/{property}/reportTasks/{report_task}" * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER, (.google.api.field_behavior) = OUTPUT_ONLY]; */ @@ -49,7 +49,7 @@ class ReportTask extends \Google\Protobuf\Internal\Message * * @type string $name * Output only. Identifier. The report task resource name assigned during - * creation. Format: `properties/{property}/reportTasks/{report_task}` + * creation. Format: "properties/{property}/reportTasks/{report_task}" * @type \Google\Analytics\Data\V1alpha\ReportTask\ReportDefinition $report_definition * Optional. A report definition to fetch report data, which describes the * structure of a report. It typically includes the fields that will be @@ -69,7 +69,7 @@ public function __construct($data = NULL) { /** * Output only. Identifier. The report task resource name assigned during - * creation. Format: `properties/{property}/reportTasks/{report_task}` + * creation. Format: "properties/{property}/reportTasks/{report_task}" * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER, (.google.api.field_behavior) = OUTPUT_ONLY]; * @return string @@ -81,7 +81,7 @@ public function getName() /** * Output only. Identifier. The report task resource name assigned during - * creation. Format: `properties/{property}/reportTasks/{report_task}` + * creation. Format: "properties/{property}/reportTasks/{report_task}" * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER, (.google.api.field_behavior) = OUTPUT_ONLY]; * @param string $var diff --git a/AnalyticsData/src/V1alpha/ReportTask/ReportDefinition.php b/AnalyticsData/src/V1alpha/ReportTask/ReportDefinition.php index caf7fa7236ba..4aa90625bd5e 100644 --- a/AnalyticsData/src/V1alpha/ReportTask/ReportDefinition.php +++ b/AnalyticsData/src/V1alpha/ReportTask/ReportDefinition.php @@ -114,7 +114,7 @@ class ReportDefinition extends \Google\Protobuf\Internal\Message * will not be returned. If true, these rows will be returned if they are * not separately removed by a filter. * Regardless of this `keep_empty_rows` setting, only data recorded by the - * Google Analytics (GA4) property can be displayed in a report. + * Google Analytics property can be displayed in a report. * For example if a property never logs a `purchase` event, then a query for * the `eventName` dimension and `eventCount` metric will not have a row * containing eventName: "purchase" and eventCount: 0. @@ -184,7 +184,7 @@ class ReportDefinition extends \Google\Protobuf\Internal\Message * will not be returned. If true, these rows will be returned if they are * not separately removed by a filter. * Regardless of this `keep_empty_rows` setting, only data recorded by the - * Google Analytics (GA4) property can be displayed in a report. + * Google Analytics property can be displayed in a report. * For example if a property never logs a `purchase` event, then a query for * the `eventName` dimension and `eventCount` metric will not have a row * containing eventName: "purchase" and eventCount: 0. @@ -572,7 +572,7 @@ public function setCohortSpec($var) * will not be returned. If true, these rows will be returned if they are * not separately removed by a filter. * Regardless of this `keep_empty_rows` setting, only data recorded by the - * Google Analytics (GA4) property can be displayed in a report. + * Google Analytics property can be displayed in a report. * For example if a property never logs a `purchase` event, then a query for * the `eventName` dimension and `eventCount` metric will not have a row * containing eventName: "purchase" and eventCount: 0. @@ -590,7 +590,7 @@ public function getKeepEmptyRows() * will not be returned. If true, these rows will be returned if they are * not separately removed by a filter. * Regardless of this `keep_empty_rows` setting, only data recorded by the - * Google Analytics (GA4) property can be displayed in a report. + * Google Analytics property can be displayed in a report. * For example if a property never logs a `purchase` event, then a query for * the `eventName` dimension and `eventCount` metric will not have a row * containing eventName: "purchase" and eventCount: 0. diff --git a/AnalyticsData/src/V1alpha/RestrictedMetricType.php b/AnalyticsData/src/V1alpha/RestrictedMetricType.php index b3c8bdd09ad0..6f5193ff022d 100644 --- a/AnalyticsData/src/V1alpha/RestrictedMetricType.php +++ b/AnalyticsData/src/V1alpha/RestrictedMetricType.php @@ -7,8 +7,8 @@ use UnexpectedValueException; /** - * Categories of data that you may be restricted from viewing on certain GA4 - * properties. + * Categories of data that you may be restricted from viewing on certain + * Google Analytics properties. * * Protobuf type google.analytics.data.v1alpha.RestrictedMetricType */ diff --git a/AnalyticsData/src/V1alpha/RunFunnelReportRequest.php b/AnalyticsData/src/V1alpha/RunFunnelReportRequest.php index ea3ac7856074..aa6ef6f3fa30 100644 --- a/AnalyticsData/src/V1alpha/RunFunnelReportRequest.php +++ b/AnalyticsData/src/V1alpha/RunFunnelReportRequest.php @@ -16,9 +16,9 @@ class RunFunnelReportRequest extends \Google\Protobuf\Internal\Message { /** - * Optional. A Google Analytics GA4 property identifier whose events are - * tracked. Specified in the URL path and not the body. To learn more, see - * [where to find your Property + * Optional. A Google Analytics property identifier whose events are tracked. + * Specified in the URL path and not the body. To learn more, see [where to + * find your Property * ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). * Within a batch request, this property should either be unspecified or * consistent with the batch-level property. @@ -119,9 +119,9 @@ class RunFunnelReportRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $property - * Optional. A Google Analytics GA4 property identifier whose events are - * tracked. Specified in the URL path and not the body. To learn more, see - * [where to find your Property + * Optional. A Google Analytics property identifier whose events are tracked. + * Specified in the URL path and not the body. To learn more, see [where to + * find your Property * ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). * Within a batch request, this property should either be unspecified or * consistent with the batch-level property. @@ -182,9 +182,9 @@ public function __construct($data = NULL) { } /** - * Optional. A Google Analytics GA4 property identifier whose events are - * tracked. Specified in the URL path and not the body. To learn more, see - * [where to find your Property + * Optional. A Google Analytics property identifier whose events are tracked. + * Specified in the URL path and not the body. To learn more, see [where to + * find your Property * ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). * Within a batch request, this property should either be unspecified or * consistent with the batch-level property. @@ -199,9 +199,9 @@ public function getProperty() } /** - * Optional. A Google Analytics GA4 property identifier whose events are - * tracked. Specified in the URL path and not the body. To learn more, see - * [where to find your Property + * Optional. A Google Analytics property identifier whose events are tracked. + * Specified in the URL path and not the body. To learn more, see [where to + * find your Property * ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). * Within a batch request, this property should either be unspecified or * consistent with the batch-level property. diff --git a/AnalyticsData/src/V1alpha/Segment.php b/AnalyticsData/src/V1alpha/Segment.php index bcb3beaa526d..42a8eeb450c2 100644 --- a/AnalyticsData/src/V1alpha/Segment.php +++ b/AnalyticsData/src/V1alpha/Segment.php @@ -13,7 +13,7 @@ * of users, one segment might be users from a particular country or city. * Another segment might be users who purchase a particular line of products or * who visit a specific part of your site or trigger certain events in your app. - * To learn more, see [GA4 Segment + * To learn more, see [Segment * Builder](https://support.google.com/analytics/answer/9304353). * * Generated from protobuf message google.analytics.data.v1alpha.Segment diff --git a/AnalyticsData/src/V1alpha/gapic_metadata.json b/AnalyticsData/src/V1alpha/gapic_metadata.json index 6b8b6ebe92b6..d2694d1bb0c5 100644 --- a/AnalyticsData/src/V1alpha/gapic_metadata.json +++ b/AnalyticsData/src/V1alpha/gapic_metadata.json @@ -30,6 +30,11 @@ "getAudienceList" ] }, + "GetPropertyQuotasSnapshot": { + "methods": [ + "getPropertyQuotasSnapshot" + ] + }, "GetRecurringAudienceList": { "methods": [ "getRecurringAudienceList" diff --git a/AnalyticsData/src/V1alpha/resources/alpha_analytics_data_client_config.json b/AnalyticsData/src/V1alpha/resources/alpha_analytics_data_client_config.json index 730a2dea65ba..e0a59f8bb5a1 100644 --- a/AnalyticsData/src/V1alpha/resources/alpha_analytics_data_client_config.json +++ b/AnalyticsData/src/V1alpha/resources/alpha_analytics_data_client_config.json @@ -58,6 +58,11 @@ "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "GetPropertyQuotasSnapshot": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "GetRecurringAudienceList": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", diff --git a/AnalyticsData/src/V1alpha/resources/alpha_analytics_data_descriptor_config.php b/AnalyticsData/src/V1alpha/resources/alpha_analytics_data_descriptor_config.php index 6903c5bf2ef3..a50b896c7461 100644 --- a/AnalyticsData/src/V1alpha/resources/alpha_analytics_data_descriptor_config.php +++ b/AnalyticsData/src/V1alpha/resources/alpha_analytics_data_descriptor_config.php @@ -85,6 +85,18 @@ ], ], ], + 'GetPropertyQuotasSnapshot' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Analytics\Data\V1alpha\PropertyQuotasSnapshot', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], 'GetRecurringAudienceList' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Analytics\Data\V1alpha\RecurringAudienceList', @@ -220,6 +232,7 @@ 'templateMap' => [ 'audienceList' => 'properties/{property}/audienceLists/{audience_list}', 'property' => 'properties/{property}', + 'propertyQuotasSnapshot' => 'properties/{property}/propertyQuotasSnapshot', 'recurringAudienceList' => 'properties/{property}/recurringAudienceLists/{recurring_audience_list}', 'reportTask' => 'properties/{property}/reportTasks/{report_task}', ], diff --git a/AnalyticsData/src/V1alpha/resources/alpha_analytics_data_rest_client_config.php b/AnalyticsData/src/V1alpha/resources/alpha_analytics_data_rest_client_config.php index 6b05bd390654..6ac05b334fca 100644 --- a/AnalyticsData/src/V1alpha/resources/alpha_analytics_data_rest_client_config.php +++ b/AnalyticsData/src/V1alpha/resources/alpha_analytics_data_rest_client_config.php @@ -70,6 +70,17 @@ ], ], ], + 'GetPropertyQuotasSnapshot' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=properties/*/propertyQuotasSnapshot}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetRecurringAudienceList' => [ 'method' => 'get', 'uriTemplate' => '/v1alpha/{name=properties/*/recurringAudienceLists/*}', diff --git a/AnalyticsData/tests/Unit/V1alpha/AlphaAnalyticsDataClientTest.php b/AnalyticsData/tests/Unit/V1alpha/AlphaAnalyticsDataClientTest.php index df143d25ace6..13f666dd6ea3 100644 --- a/AnalyticsData/tests/Unit/V1alpha/AlphaAnalyticsDataClientTest.php +++ b/AnalyticsData/tests/Unit/V1alpha/AlphaAnalyticsDataClientTest.php @@ -27,6 +27,7 @@ use Google\Analytics\Data\V1alpha\ListAudienceListsResponse; use Google\Analytics\Data\V1alpha\ListRecurringAudienceListsResponse; use Google\Analytics\Data\V1alpha\ListReportTasksResponse; +use Google\Analytics\Data\V1alpha\PropertyQuotasSnapshot; use Google\Analytics\Data\V1alpha\QueryAudienceListResponse; use Google\Analytics\Data\V1alpha\QueryReportTaskResponse; use Google\Analytics\Data\V1alpha\RecurringAudienceList; @@ -492,6 +493,66 @@ public function getAudienceListExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function getPropertyQuotasSnapshotTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new PropertyQuotasSnapshot(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->propertyQuotasSnapshotName('[PROPERTY]'); + $response = $gapicClient->getPropertyQuotasSnapshot($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.data.v1alpha.AlphaAnalyticsData/GetPropertyQuotasSnapshot', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPropertyQuotasSnapshotExceptionTest() + { + $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->propertyQuotasSnapshotName('[PROPERTY]'); + try { + $gapicClient->getPropertyQuotasSnapshot($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 getRecurringAudienceListTest() { diff --git a/AnalyticsData/tests/Unit/V1alpha/Client/AlphaAnalyticsDataClientTest.php b/AnalyticsData/tests/Unit/V1alpha/Client/AlphaAnalyticsDataClientTest.php index 27ed731150f6..073c77ef5975 100644 --- a/AnalyticsData/tests/Unit/V1alpha/Client/AlphaAnalyticsDataClientTest.php +++ b/AnalyticsData/tests/Unit/V1alpha/Client/AlphaAnalyticsDataClientTest.php @@ -28,6 +28,7 @@ use Google\Analytics\Data\V1alpha\CreateRecurringAudienceListRequest; use Google\Analytics\Data\V1alpha\CreateReportTaskRequest; use Google\Analytics\Data\V1alpha\GetAudienceListRequest; +use Google\Analytics\Data\V1alpha\GetPropertyQuotasSnapshotRequest; use Google\Analytics\Data\V1alpha\GetRecurringAudienceListRequest; use Google\Analytics\Data\V1alpha\GetReportTaskRequest; use Google\Analytics\Data\V1alpha\ListAudienceListsRequest; @@ -36,6 +37,7 @@ use Google\Analytics\Data\V1alpha\ListRecurringAudienceListsResponse; use Google\Analytics\Data\V1alpha\ListReportTasksRequest; use Google\Analytics\Data\V1alpha\ListReportTasksResponse; +use Google\Analytics\Data\V1alpha\PropertyQuotasSnapshot; use Google\Analytics\Data\V1alpha\QueryAudienceListRequest; use Google\Analytics\Data\V1alpha\QueryAudienceListResponse; use Google\Analytics\Data\V1alpha\QueryReportTaskRequest; @@ -527,6 +529,70 @@ public function getAudienceListExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function getPropertyQuotasSnapshotTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new PropertyQuotasSnapshot(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->propertyQuotasSnapshotName('[PROPERTY]'); + $request = (new GetPropertyQuotasSnapshotRequest()) + ->setName($formattedName); + $response = $gapicClient->getPropertyQuotasSnapshot($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.data.v1alpha.AlphaAnalyticsData/GetPropertyQuotasSnapshot', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPropertyQuotasSnapshotExceptionTest() + { + $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->propertyQuotasSnapshotName('[PROPERTY]'); + $request = (new GetPropertyQuotasSnapshotRequest()) + ->setName($formattedName); + try { + $gapicClient->getPropertyQuotasSnapshot($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 getRecurringAudienceListTest() {