Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [google-analytics-data] add the comparisons field to the Metadata resource #12978

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
CohortReportSettings,
CohortSpec,
CohortsRange,
Comparison,
ComparisonMetadata,
Compatibility,
DateRange,
Dimension,
Expand Down Expand Up @@ -120,6 +122,8 @@
"CohortReportSettings",
"CohortSpec",
"CohortsRange",
"Comparison",
"ComparisonMetadata",
"DateRange",
"Dimension",
"DimensionCompatibility",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.18.10" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.18.10" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
CohortReportSettings,
CohortSpec,
CohortsRange,
Comparison,
ComparisonMetadata,
Compatibility,
DateRange,
Dimension,
Expand Down Expand Up @@ -104,6 +106,8 @@
"CohortReportSettings",
"CohortSpec",
"CohortsRange",
"Comparison",
"ComparisonMetadata",
"Compatibility",
"CreateAudienceExportRequest",
"DateRange",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.18.10" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
CohortReportSettings,
CohortSpec,
CohortsRange,
Comparison,
ComparisonMetadata,
Compatibility,
DateRange,
Dimension,
Expand Down Expand Up @@ -107,6 +109,8 @@
"CohortReportSettings",
"CohortSpec",
"CohortsRange",
"Comparison",
"ComparisonMetadata",
"DateRange",
"Dimension",
"DimensionCompatibility",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ class Metadata(proto.Message):
The dimension descriptions.
metrics (MutableSequence[google.analytics.data_v1beta.types.MetricMetadata]):
The metric descriptions.
comparisons (MutableSequence[google.analytics.data_v1beta.types.ComparisonMetadata]):
The comparison descriptions.
"""

name: str = proto.Field(
Expand All @@ -173,6 +175,11 @@ class Metadata(proto.Message):
number=2,
message=data.MetricMetadata,
)
comparisons: MutableSequence[data.ComparisonMetadata] = proto.RepeatedField(
proto.MESSAGE,
number=4,
message=data.ComparisonMetadata,
)


class RunReportRequest(proto.Message):
Expand Down Expand Up @@ -269,6 +276,11 @@ class RunReportRequest(proto.Message):
Toggles whether to return the current state of this
Analytics Property's quota. Quota is returned in
`PropertyQuota <#PropertyQuota>`__.
comparisons (MutableSequence[google.analytics.data_v1beta.types.Comparison]):
Optional. The configuration of comparisons
requested and displayed. The request only
requires a comparisons field in order to receive
a comparison column in the response.
"""

property: str = proto.Field(
Expand Down Expand Up @@ -335,6 +347,11 @@ class RunReportRequest(proto.Message):
proto.BOOL,
number=14,
)
comparisons: MutableSequence[data.Comparison] = proto.RepeatedField(
proto.MESSAGE,
number=15,
message=data.Comparison,
)


class RunReportResponse(proto.Message):
Expand Down Expand Up @@ -504,6 +521,12 @@ class RunPivotReportRequest(proto.Message):
Toggles whether to return the current state of this
Analytics Property's quota. Quota is returned in
`PropertyQuota <#PropertyQuota>`__.
comparisons (MutableSequence[google.analytics.data_v1beta.types.Comparison]):
Optional. The configuration of comparisons
requested and displayed. The request requires
both a comparisons field and a comparisons
dimension to receive a comparison column in the
response.
"""

property: str = proto.Field(
Expand Down Expand Up @@ -557,6 +580,11 @@ class RunPivotReportRequest(proto.Message):
proto.BOOL,
number=11,
)
comparisons: MutableSequence[data.Comparison] = proto.RepeatedField(
proto.MESSAGE,
number=12,
message=data.Comparison,
)


class RunPivotReportResponse(proto.Message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"Dimension",
"DimensionExpression",
"Metric",
"Comparison",
"FilterExpression",
"FilterExpressionList",
"Filter",
Expand All @@ -54,6 +55,7 @@
"QuotaStatus",
"DimensionMetadata",
"MetricMetadata",
"ComparisonMetadata",
"DimensionCompatibility",
"MetricCompatibility",
},
Expand Down Expand Up @@ -471,6 +473,56 @@ class Metric(proto.Message):
)


class Comparison(proto.Message):
r"""Defines an individual comparison. Most requests will include
multiple comparisons so that the report compares between the
comparisons.

This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

Attributes:
name (str):
Each comparison produces separate rows in the
response. In the response, this comparison is
identified by this name. If name is unspecified,
we will use the saved comparisons display name.

This field is a member of `oneof`_ ``_name``.
dimension_filter (google.analytics.data_v1beta.types.FilterExpression):
A basic comparison.

This field is a member of `oneof`_ ``one_comparison``.
comparison (str):
A saved comparison identified by the
comparison's resource name. For example,
'comparisons/1234'.

This field is a member of `oneof`_ ``one_comparison``.
"""

name: str = proto.Field(
proto.STRING,
number=1,
optional=True,
)
dimension_filter: "FilterExpression" = proto.Field(
proto.MESSAGE,
number=2,
oneof="one_comparison",
message="FilterExpression",
)
comparison: str = proto.Field(
proto.STRING,
number=3,
oneof="one_comparison",
)


class FilterExpression(proto.Message):
r"""To express dimension or metric filters. The fields in the
same FilterExpression need to be either all dimensions or all
Expand Down Expand Up @@ -1751,8 +1803,14 @@ class DimensionMetadata(proto.Message):
the deprecation period, the dimension will be available only
by ``apiName``.
custom_definition (bool):
True if the dimension is a custom dimension
for this property.
True if the dimension is custom to this
property. This includes user, event, & item
scoped custom dimensions; to learn more about
custom dimensions, see
https://support.google.com/analytics/answer/14240153.
This also include custom channel groups; to
learn more about custom channel groups, see
https://support.google.com/analytics/answer/13051316.
category (str):
The display name of the category that this
dimension belongs to. Similar dimensions and
Expand Down Expand Up @@ -1889,6 +1947,35 @@ class BlockedReason(proto.Enum):
)


class ComparisonMetadata(proto.Message):
r"""The metadata for a single comparison.

Attributes:
api_name (str):
This comparison's resource name. Useable in
`Comparison <#Comparison>`__'s ``comparison`` field. For
example, 'comparisons/1234'.
ui_name (str):
This comparison's name within the Google
Analytics user interface.
description (str):
This comparison's description.
"""

api_name: str = proto.Field(
proto.STRING,
number=1,
)
ui_name: str = proto.Field(
proto.STRING,
number=2,
)
description: str = proto.Field(
proto.STRING,
number=3,
)


class DimensionCompatibility(proto.Message):
r"""The compatibility for a single dimension.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-analytics-data",
"version": "0.18.10"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-analytics-data",
"version": "0.18.10"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class dataCallTransformer(cst.CSTTransformer):
'get_metadata': ('name', ),
'list_audience_exports': ('parent', 'page_size', 'page_token', ),
'query_audience_export': ('name', 'offset', 'limit', ),
'run_pivot_report': ('property', 'dimensions', 'metrics', 'date_ranges', 'pivots', 'dimension_filter', 'metric_filter', 'currency_code', 'cohort_spec', 'keep_empty_rows', 'return_property_quota', ),
'run_pivot_report': ('property', 'dimensions', 'metrics', 'date_ranges', 'pivots', 'dimension_filter', 'metric_filter', 'currency_code', 'cohort_spec', 'keep_empty_rows', 'return_property_quota', 'comparisons', ),
'run_realtime_report': ('property', 'dimensions', 'metrics', 'dimension_filter', 'metric_filter', 'limit', 'metric_aggregations', 'order_bys', 'return_property_quota', 'minute_ranges', ),
'run_report': ('property', 'dimensions', 'metrics', 'date_ranges', 'dimension_filter', 'metric_filter', 'offset', 'limit', 'metric_aggregations', 'order_bys', 'currency_code', 'cohort_spec', 'keep_empty_rows', 'return_property_quota', ),
'run_report': ('property', 'dimensions', 'metrics', 'date_ranges', 'dimension_filter', 'metric_filter', 'offset', 'limit', 'metric_aggregations', 'order_bys', 'currency_code', 'cohort_spec', 'keep_empty_rows', 'return_property_quota', 'comparisons', ),
}

def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode:
Expand Down
Loading