Skip to content

Commit 583920a

Browse files
feat: add the schema_restriction_response field to the ResponseMetaData type (googleapis#157)
..that contains the schema restrictions actively enforced in creating a report - [ ] Regenerate this pull request now. PiperOrigin-RevId: 406725448 Source-Link: googleapis/googleapis@c1176cd Source-Link: https://github.com/googleapis/googleapis-gen/commit/4d391c476d0fcf76fd884a677d6a16a0fc44a22b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGQzOTFjNDc2ZDBmY2Y3NmZkODg0YTY3N2Q2YTE2YTBmYzQ0YTIyYiJ9 feat: add the `currency_code`, `time_zone` fields to the `ResponseMetaData` type feat: add the `empty_reason` field to the `ResponseMetaData` type that contains an empty report reason feat: add the `blocked_reasons` field to the `MetricMetadata` type that contains reasons why access was blocked
1 parent 1f81d4e commit 583920a

4 files changed

Lines changed: 106 additions & 0 deletions

File tree

google/analytics/data/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
from google.analytics.data_v1beta.types.data import Compatibility
8282
from google.analytics.data_v1beta.types.data import MetricAggregation
8383
from google.analytics.data_v1beta.types.data import MetricType
84+
from google.analytics.data_v1beta.types.data import RestrictedMetricType
8485

8586
__all__ = (
8687
"BetaAnalyticsDataClient",
@@ -131,4 +132,5 @@
131132
"Compatibility",
132133
"MetricAggregation",
133134
"MetricType",
135+
"RestrictedMetricType",
134136
)

google/analytics/data_v1beta/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
from .types.data import Compatibility
6464
from .types.data import MetricAggregation
6565
from .types.data import MetricType
66+
from .types.data import RestrictedMetricType
6667

6768
__all__ = (
6869
"BetaAnalyticsDataAsyncClient",
@@ -106,6 +107,7 @@
106107
"PropertyQuota",
107108
"QuotaStatus",
108109
"ResponseMetaData",
110+
"RestrictedMetricType",
109111
"Row",
110112
"RunPivotReportRequest",
111113
"RunPivotReportResponse",

google/analytics/data_v1beta/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
Compatibility,
6363
MetricAggregation,
6464
MetricType,
65+
RestrictedMetricType,
6566
)
6667

6768
__all__ = (
@@ -111,4 +112,5 @@
111112
"Compatibility",
112113
"MetricAggregation",
113114
"MetricType",
115+
"RestrictedMetricType",
114116
)

google/analytics/data_v1beta/types/data.py

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
manifest={
2222
"MetricAggregation",
2323
"MetricType",
24+
"RestrictedMetricType",
2425
"Compatibility",
2526
"DateRange",
2627
"MinuteRange",
@@ -81,6 +82,15 @@ class MetricType(proto.Enum):
8182
TYPE_KILOMETERS = 13
8283

8384

85+
class RestrictedMetricType(proto.Enum):
86+
r"""Categories of data that you may be restricted from viewing on
87+
certain GA4 properties.
88+
"""
89+
RESTRICTED_METRIC_TYPE_UNSPECIFIED = 0
90+
COST_DATA = 1
91+
REVENUE_DATA = 2
92+
93+
8494
class Compatibility(proto.Enum):
8595
r"""The compatibility types for a single dimension or metric."""
8696
COMPATIBILITY_UNSPECIFIED = 0
@@ -821,9 +831,82 @@ class ResponseMetaData(proto.Message):
821831
If true, indicates some buckets of dimension
822832
combinations are rolled into "(other)" row. This
823833
can happen for high cardinality reports.
834+
schema_restriction_response (google.analytics.data_v1beta.types.ResponseMetaData.SchemaRestrictionResponse):
835+
Describes the schema restrictions actively enforced in
836+
creating this report. To learn more, see `Access and
837+
data-restriction
838+
management <https://support.google.com/analytics/answer/10851388>`__.
839+
This field is a member of `oneof`_ ``_schema_restriction_response``.
840+
currency_code (str):
841+
The currency code used in this report. Intended to be used
842+
in formatting currency metrics like ``purchaseRevenue`` for
843+
visualization. If currency_code was specified in the
844+
request, this response parameter will echo the request
845+
parameter; otherwise, this response parameter is the
846+
property's current currency_code.
847+
848+
Currency codes are string encodings of currency types from
849+
the ISO 4217 standard
850+
(https://en.wikipedia.org/wiki/ISO_4217); for example "USD",
851+
"EUR", "JPY". To learn more, see
852+
https://support.google.com/analytics/answer/9796179.
853+
This field is a member of `oneof`_ ``_currency_code``.
854+
time_zone (str):
855+
The property's current timezone. Intended to be used to
856+
interpret time-based dimensions like ``hour`` and
857+
``minute``. Formatted as strings from the IANA Time Zone
858+
database (https://www.iana.org/time-zones); for example
859+
"America/New_York" or "Asia/Tokyo".
860+
This field is a member of `oneof`_ ``_time_zone``.
861+
empty_reason (str):
862+
If empty reason is specified, the report is
863+
empty for this reason.
864+
This field is a member of `oneof`_ ``_empty_reason``.
824865
"""
825866

867+
class SchemaRestrictionResponse(proto.Message):
868+
r"""The schema restrictions actively enforced in creating this report.
869+
To learn more, see `Access and data-restriction
870+
management <https://support.google.com/analytics/answer/10851388>`__.
871+
872+
Attributes:
873+
active_metric_restrictions (Sequence[google.analytics.data_v1beta.types.ResponseMetaData.SchemaRestrictionResponse.ActiveMetricRestriction]):
874+
All restrictions actively enforced in creating the report.
875+
For example, ``purchaseRevenue`` always has the restriction
876+
type ``REVENUE_DATA``. However, this active response
877+
restriction is only populated if the user's custom role
878+
disallows access to ``REVENUE_DATA``.
879+
"""
880+
881+
class ActiveMetricRestriction(proto.Message):
882+
r"""A metric actively restricted in creating the report.
883+
884+
Attributes:
885+
metric_name (str):
886+
The name of the restricted metric.
887+
This field is a member of `oneof`_ ``_metric_name``.
888+
restricted_metric_types (Sequence[google.analytics.data_v1beta.types.RestrictedMetricType]):
889+
The reason for this metric's restriction.
890+
"""
891+
892+
metric_name = proto.Field(proto.STRING, number=1, optional=True,)
893+
restricted_metric_types = proto.RepeatedField(
894+
proto.ENUM, number=2, enum="RestrictedMetricType",
895+
)
896+
897+
active_metric_restrictions = proto.RepeatedField(
898+
proto.MESSAGE,
899+
number=1,
900+
message="ResponseMetaData.SchemaRestrictionResponse.ActiveMetricRestriction",
901+
)
902+
826903
data_loss_from_other_row = proto.Field(proto.BOOL, number=3,)
904+
schema_restriction_response = proto.Field(
905+
proto.MESSAGE, number=4, optional=True, message=SchemaRestrictionResponse,
906+
)
907+
currency_code = proto.Field(proto.STRING, number=5, optional=True,)
908+
time_zone = proto.Field(proto.STRING, number=6, optional=True,)
909+
empty_reason = proto.Field(proto.STRING, number=7, optional=True,)
827910

828911

829912
class DimensionHeader(proto.Message):
@@ -1124,19 +1207,36 @@ class MetricMetadata(proto.Message):
11241207
custom_definition (bool):
11251208
True if the metric is a custom metric for
11261209
this property.
1210+
blocked_reasons (Sequence[google.analytics.data_v1beta.types.MetricMetadata.BlockedReason]):
1211+
If reasons are specified, your access is blocked to this
1212+
metric for this property. API requests from you to this
1213+
property for this metric will succeed; however, the report
1214+
will contain only zeros for this metric. API requests with
1215+
metric filters on blocked metrics will fail. If reasons are
1216+
empty, you have access to this metric.
1217+
1218+
To learn more, see `Access and data-restriction
1219+
management <https://support.google.com/analytics/answer/10851388>`__.
11271220
category (str):
11281221
The display name of the category that this
11291222
metrics belongs to. Similar dimensions and
11301223
metrics are categorized together.
11311224
"""
11321225

1226+
class BlockedReason(proto.Enum):
1227+
r"""Justifications for why this metric is blocked."""
1228+
BLOCKED_REASON_UNSPECIFIED = 0
1229+
NO_REVENUE_METRICS = 1
1230+
NO_COST_METRICS = 2
1231+
11331232
api_name = proto.Field(proto.STRING, number=1,)
11341233
ui_name = proto.Field(proto.STRING, number=2,)
11351234
description = proto.Field(proto.STRING, number=3,)
11361235
deprecated_api_names = proto.RepeatedField(proto.STRING, number=4,)
11371236
type_ = proto.Field(proto.ENUM, number=5, enum="MetricType",)
11381237
expression = proto.Field(proto.STRING, number=6,)
11391238
custom_definition = proto.Field(proto.BOOL, number=7,)
1239+
blocked_reasons = proto.RepeatedField(proto.ENUM, number=8, enum=BlockedReason,)
11401240
category = proto.Field(proto.STRING, number=10,)
11411241

11421242

0 commit comments

Comments
 (0)