From d395233f8ffbee93df8db344a8628407fe1c1f15 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:42:14 -0400 Subject: [PATCH] feat: [google-analytics-data] add `SamplingLevel` type to Data API v1alpha (#13177) - [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: add `SamplingLevel` type to Data API v1alpha feat: add `sampling_level` to the `ReportDefinition` type END_COMMIT_OVERRIDE PiperOrigin-RevId: 686560382 Source-Link: https://github.com/googleapis/googleapis/commit/7b6975c4bb1f02bb05fd94cb6f8614f08fb55d24 Source-Link: https://github.com/googleapis/googleapis-gen/commit/52607af0302837ce880471a94e473deab5ca0e4f Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFuYWx5dGljcy1kYXRhLy5Pd2xCb3QueWFtbCIsImgiOiI1MjYwN2FmMDMwMjgzN2NlODgwNDcxYTk0ZTQ3M2RlYWI1Y2EwZTRmIn0= --------- Co-authored-by: Owl Bot Co-authored-by: Victor Chudnovsky --- .../google/analytics/data_v1alpha/__init__.py | 2 ++ .../analytics/data_v1alpha/types/__init__.py | 2 ++ .../data_v1alpha/types/analytics_data_api.py | 12 +++++++++ .../analytics/data_v1alpha/types/data.py | 27 +++++++++++++++++++ .../data_v1alpha/test_alpha_analytics_data.py | 1 + 5 files changed, 44 insertions(+) diff --git a/packages/google-analytics-data/google/analytics/data_v1alpha/__init__.py b/packages/google-analytics-data/google/analytics/data_v1alpha/__init__.py index 4b5c6ad3ac51..e57495e726b7 100644 --- a/packages/google-analytics-data/google/analytics/data_v1alpha/__init__.py +++ b/packages/google-analytics-data/google/analytics/data_v1alpha/__init__.py @@ -102,6 +102,7 @@ ResponseMetaData, RestrictedMetricType, Row, + SamplingLevel, SamplingMetadata, Segment, SegmentEventFilter, @@ -207,6 +208,7 @@ "Row", "RunFunnelReportRequest", "RunFunnelReportResponse", + "SamplingLevel", "SamplingMetadata", "Segment", "SegmentEventFilter", diff --git a/packages/google-analytics-data/google/analytics/data_v1alpha/types/__init__.py b/packages/google-analytics-data/google/analytics/data_v1alpha/types/__init__.py index c5f36ceee95f..02ce8d2a0bc2 100644 --- a/packages/google-analytics-data/google/analytics/data_v1alpha/types/__init__.py +++ b/packages/google-analytics-data/google/analytics/data_v1alpha/types/__init__.py @@ -93,6 +93,7 @@ ResponseMetaData, RestrictedMetricType, Row, + SamplingLevel, SamplingMetadata, Segment, SegmentEventFilter, @@ -221,6 +222,7 @@ "MetricAggregation", "MetricType", "RestrictedMetricType", + "SamplingLevel", "SessionCriteriaScoping", "SessionExclusionDuration", "UserCriteriaScoping", diff --git a/packages/google-analytics-data/google/analytics/data_v1alpha/types/analytics_data_api.py b/packages/google-analytics-data/google/analytics/data_v1alpha/types/analytics_data_api.py index 5ef02adbab94..e6b1690f993c 100644 --- a/packages/google-analytics-data/google/analytics/data_v1alpha/types/analytics_data_api.py +++ b/packages/google-analytics-data/google/analytics/data_v1alpha/types/analytics_data_api.py @@ -1221,6 +1221,8 @@ class ReportTask(proto.Message): class ReportDefinition(proto.Message): r"""The definition of how a report should be run. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: dimensions (MutableSequence[google.analytics.data_v1alpha.types.Dimension]): Optional. The dimensions requested and @@ -1299,6 +1301,10 @@ class ReportDefinition(proto.Message): then a query for the ``eventName`` dimension and ``eventCount`` metric will not have a row containing eventName: "purchase" and eventCount: 0. + sampling_level (google.analytics.data_v1alpha.types.SamplingLevel): + Optional. The report's sampling level. + + This field is a member of `oneof`_ ``_sampling_level``. """ dimensions: MutableSequence[data.Dimension] = proto.RepeatedField( @@ -1359,6 +1365,12 @@ class ReportDefinition(proto.Message): proto.BOOL, number=13, ) + sampling_level: data.SamplingLevel = proto.Field( + proto.ENUM, + number=14, + optional=True, + enum=data.SamplingLevel, + ) class ReportMetadata(proto.Message): r"""The report metadata for a specific report task. diff --git a/packages/google-analytics-data/google/analytics/data_v1alpha/types/data.py b/packages/google-analytics-data/google/analytics/data_v1alpha/types/data.py index f3e86639400b..36f1c23b7c14 100644 --- a/packages/google-analytics-data/google/analytics/data_v1alpha/types/data.py +++ b/packages/google-analytics-data/google/analytics/data_v1alpha/types/data.py @@ -32,6 +32,7 @@ "MetricAggregation", "MetricType", "RestrictedMetricType", + "SamplingLevel", "DateRange", "Dimension", "DimensionExpression", @@ -308,6 +309,32 @@ class RestrictedMetricType(proto.Enum): REVENUE_DATA = 2 +class SamplingLevel(proto.Enum): + r"""Categories of sampling levels for the requests. + + Values: + SAMPLING_LEVEL_UNSPECIFIED (0): + Unspecified type. + LOW (1): + Applies a sampling level of 10 million to + standard properties and 100 million to Google + Analytics 360 properties. + MEDIUM (2): + Exclusive to Google Analytics 360 properties + with a sampling level of 1 billion. + UNSAMPLED (3): + Exclusive to Google Analytics 360 properties. + Unsampled explorations are more accurate and can + reveal insights that aren't visible in standard + explorations. To learn more, see + https://support.google.com/analytics/answer/10896953. + """ + SAMPLING_LEVEL_UNSPECIFIED = 0 + LOW = 1 + MEDIUM = 2 + UNSAMPLED = 3 + + class DateRange(proto.Message): r"""A contiguous set of days: ``startDate``, ``startDate + 1``, ..., ``endDate``. Requests are allowed up to 4 date ranges. diff --git a/packages/google-analytics-data/tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.py b/packages/google-analytics-data/tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.py index 1bae8158710a..39b4b1e0362f 100644 --- a/packages/google-analytics-data/tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.py +++ b/packages/google-analytics-data/tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.py @@ -11681,6 +11681,7 @@ def test_create_report_task_rest_call_success(request_type): "cohort_report_settings": {"accumulate": True}, }, "keep_empty_rows": True, + "sampling_level": 1, }, "report_metadata": { "state": 1,