diff --git a/.flake8 b/.flake8
index ed93163..29227d4 100644
--- a/.flake8
+++ b/.flake8
@@ -26,6 +26,7 @@ exclude =
*_pb2.py
# Standard linting exemptions.
+ **/.nox/**
__pycache__,
.git,
*.pyc,
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..a9024b1
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,17 @@
+# See https://pre-commit.com for more information
+# See https://pre-commit.com/hooks.html for more hooks
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v3.4.0
+ hooks:
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ - id: check-yaml
+- repo: https://github.com/psf/black
+ rev: 19.10b0
+ hooks:
+ - id: black
+- repo: https://gitlab.com/pycqa/flake8
+ rev: 3.8.4
+ hooks:
+ - id: flake8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e58acbb..154a420 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
# Changelog
+## [0.3.0](https://www.github.com/googleapis/python-analytics-data/compare/v0.2.0...v0.3.0) (2021-01-06)
+
+
+### Features
+
+* add custom_definition to DimensionMetadata object and MetricMetadata object ([9bd3477](https://www.github.com/googleapis/python-analytics-data/commit/9bd347737319ea5cae0cf6556d55cd8397a06811))
+* add from_service_account_info factory and fix sphinx identifiers ([#27](https://www.github.com/googleapis/python-analytics-data/issues/27)) ([2775104](https://www.github.com/googleapis/python-analytics-data/commit/2775104b84dda7cccc0fe2813cb8fde5e8930ae8))
+
+
+### Bug Fixes
+
+* remove client recv msg limit and add enums to `types/__init__.py` ([#22](https://www.github.com/googleapis/python-analytics-data/issues/22)) ([b3dc882](https://www.github.com/googleapis/python-analytics-data/commit/b3dc88221da924816f04e8c0ce716c0d45555d4c))
+
## [0.2.0](https://www.github.com/googleapis/python-analytics-data/compare/v0.1.0...v0.2.0) (2020-11-16)
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 4c414fa..b88c721 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -21,8 +21,8 @@ In order to add a feature:
- The feature must be documented in both the API and narrative
documentation.
-- The feature must work fully on the following CPython versions: 2.7,
- 3.5, 3.6, 3.7 and 3.8 on both UNIX and Windows.
+- The feature must work fully on the following CPython versions:
+ 3.6, 3.7, 3.8 and 3.9 on both UNIX and Windows.
- The feature must not add unnecessary dependencies (where
"unnecessary" is of course subjective, but new dependencies should
@@ -111,6 +111,16 @@ Coding Style
should point to the official ``googleapis`` checkout and the
the branch should be the main branch on that remote (``master``).
+- This repository contains configuration for the
+ `pre-commit `__ tool, which automates checking
+ our linters during a commit. If you have it installed on your ``$PATH``,
+ you can enable enforcing those checks via:
+
+.. code-block:: bash
+
+ $ pre-commit install
+ pre-commit installed at .git/hooks/pre-commit
+
Exceptions to PEP8:
- Many unit tests use a helper method, ``_call_fut`` ("FUT" is short for
@@ -192,25 +202,24 @@ Supported Python Versions
We support:
-- `Python 3.5`_
- `Python 3.6`_
- `Python 3.7`_
- `Python 3.8`_
+- `Python 3.9`_
-.. _Python 3.5: https://docs.python.org/3.5/
.. _Python 3.6: https://docs.python.org/3.6/
.. _Python 3.7: https://docs.python.org/3.7/
.. _Python 3.8: https://docs.python.org/3.8/
+.. _Python 3.9: https://docs.python.org/3.9/
Supported versions can be found in our ``noxfile.py`` `config`_.
.. _config: https://github.com/googleapis/python-analytics-data/blob/master/noxfile.py
-Python 2.7 support is deprecated. All code changes should maintain Python 2.7 compatibility until January 1, 2020.
We also explicitly decided to support Python 3 beginning with version
-3.5. Reasons for this include:
+3.6. Reasons for this include:
- Encouraging use of newest versions of Python 3
- Taking the lead of `prominent`_ open-source `projects`_
diff --git a/docs/conf.py b/docs/conf.py
index cea6615..f261e5b 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -345,10 +345,10 @@
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
- "python": ("http://python.readthedocs.org/en/latest/", None),
- "google-auth": ("https://google-auth.readthedocs.io/en/stable", None),
+ "python": ("https://python.readthedocs.org/en/latest/", None),
+ "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
"google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
- "grpc": ("https://grpc.io/grpc/python/", None),
+ "grpc": ("https://grpc.github.io/grpc/python/", None),
"proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
}
diff --git a/docs/data_v1alpha/alpha_analytics_data.rst b/docs/data_v1alpha/alpha_analytics_data.rst
new file mode 100644
index 0000000..a59186b
--- /dev/null
+++ b/docs/data_v1alpha/alpha_analytics_data.rst
@@ -0,0 +1,6 @@
+AlphaAnalyticsData
+------------------------------------
+
+.. automodule:: google.analytics.data_v1alpha.services.alpha_analytics_data
+ :members:
+ :inherited-members:
diff --git a/docs/data_v1alpha/services.rst b/docs/data_v1alpha/services.rst
index 58e994d..607505d 100644
--- a/docs/data_v1alpha/services.rst
+++ b/docs/data_v1alpha/services.rst
@@ -1,6 +1,6 @@
Services for Google Analytics Data v1alpha API
==============================================
+.. toctree::
+ :maxdepth: 2
-.. automodule:: google.analytics.data_v1alpha.services.alpha_analytics_data
- :members:
- :inherited-members:
+ alpha_analytics_data
diff --git a/docs/data_v1alpha/types.rst b/docs/data_v1alpha/types.rst
index c0378d5..8498253 100644
--- a/docs/data_v1alpha/types.rst
+++ b/docs/data_v1alpha/types.rst
@@ -3,4 +3,5 @@ Types for Google Analytics Data v1alpha API
.. automodule:: google.analytics.data_v1alpha.types
:members:
+ :undoc-members:
:show-inheritance:
diff --git a/google/analytics/data_v1alpha/services/alpha_analytics_data/async_client.py b/google/analytics/data_v1alpha/services/alpha_analytics_data/async_client.py
index f39cc9d..cf5ba1b 100644
--- a/google/analytics/data_v1alpha/services/alpha_analytics_data/async_client.py
+++ b/google/analytics/data_v1alpha/services/alpha_analytics_data/async_client.py
@@ -76,6 +76,7 @@ class AlphaAnalyticsDataAsyncClient:
AlphaAnalyticsDataClient.parse_common_location_path
)
+ from_service_account_info = AlphaAnalyticsDataClient.from_service_account_info
from_service_account_file = AlphaAnalyticsDataClient.from_service_account_file
from_service_account_json = from_service_account_file
@@ -160,7 +161,7 @@ async def run_report(
criteria, such as country or event name.
Args:
- request (:class:`~.analytics_data_api.RunReportRequest`):
+ request (:class:`google.analytics.data_v1alpha.types.RunReportRequest`):
The request object. The request to generate a report.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
@@ -170,7 +171,7 @@ async def run_report(
sent along with the request as metadata.
Returns:
- ~.analytics_data_api.RunReportResponse:
+ google.analytics.data_v1alpha.types.RunReportResponse:
The response report table
corresponding to a request.
@@ -209,7 +210,7 @@ async def run_pivot_report(
dissect your data.
Args:
- request (:class:`~.analytics_data_api.RunPivotReportRequest`):
+ request (:class:`google.analytics.data_v1alpha.types.RunPivotReportRequest`):
The request object. The request to generate a pivot
report.
@@ -220,7 +221,7 @@ async def run_pivot_report(
sent along with the request as metadata.
Returns:
- ~.analytics_data_api.RunPivotReportResponse:
+ google.analytics.data_v1alpha.types.RunPivotReportResponse:
The response pivot report table
corresponding to a pivot request.
@@ -255,7 +256,7 @@ async def batch_run_reports(
be for the same Entity.
Args:
- request (:class:`~.analytics_data_api.BatchRunReportsRequest`):
+ request (:class:`google.analytics.data_v1alpha.types.BatchRunReportsRequest`):
The request object. The batch request containing
multiple report requests.
@@ -266,7 +267,7 @@ async def batch_run_reports(
sent along with the request as metadata.
Returns:
- ~.analytics_data_api.BatchRunReportsResponse:
+ google.analytics.data_v1alpha.types.BatchRunReportsResponse:
The batch response containing
multiple reports.
@@ -301,7 +302,7 @@ async def batch_run_pivot_reports(
reports must be for the same Entity.
Args:
- request (:class:`~.analytics_data_api.BatchRunPivotReportsRequest`):
+ request (:class:`google.analytics.data_v1alpha.types.BatchRunPivotReportsRequest`):
The request object. The batch request containing
multiple pivot report requests.
@@ -312,7 +313,7 @@ async def batch_run_pivot_reports(
sent along with the request as metadata.
Returns:
- ~.analytics_data_api.BatchRunPivotReportsResponse:
+ google.analytics.data_v1alpha.types.BatchRunPivotReportsResponse:
The batch response containing
multiple pivot reports.
@@ -357,7 +358,7 @@ async def get_metadata(
such as ``country`` and ``totalUsers``.
Args:
- request (:class:`~.analytics_data_api.GetMetadataRequest`):
+ request (:class:`google.analytics.data_v1alpha.types.GetMetadataRequest`):
The request object. Request for a property's dimension
and metric metadata.
name (:class:`str`):
@@ -366,13 +367,14 @@ async def get_metadata(
parameters. Property is a numeric Google Analytics GA4
Property identifier. To learn more, see `where to find
your Property
- ID `__.
+ ID `__.
Example: properties/1234/metadata
Set the Property ID to 0 for dimensions and metrics
common to all properties. In this special mode, this
method will not return custom dimensions and metrics.
+
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
@@ -384,7 +386,7 @@ async def get_metadata(
sent along with the request as metadata.
Returns:
- ~.analytics_data_api.Metadata:
+ google.analytics.data_v1alpha.types.Metadata:
The dimensions and metrics currently
accepted in reporting methods.
@@ -441,7 +443,7 @@ async def run_realtime_report(
last 30 minutes.
Args:
- request (:class:`~.analytics_data_api.RunRealtimeReportRequest`):
+ request (:class:`google.analytics.data_v1alpha.types.RunRealtimeReportRequest`):
The request object. The request to generate a realtime
report.
@@ -452,7 +454,7 @@ async def run_realtime_report(
sent along with the request as metadata.
Returns:
- ~.analytics_data_api.RunRealtimeReportResponse:
+ google.analytics.data_v1alpha.types.RunRealtimeReportResponse:
The response realtime report table
corresponding to a request.
diff --git a/google/analytics/data_v1alpha/services/alpha_analytics_data/client.py b/google/analytics/data_v1alpha/services/alpha_analytics_data/client.py
index 27046e4..682c278 100644
--- a/google/analytics/data_v1alpha/services/alpha_analytics_data/client.py
+++ b/google/analytics/data_v1alpha/services/alpha_analytics_data/client.py
@@ -112,6 +112,22 @@ def _get_default_mtls_endpoint(api_endpoint):
DEFAULT_ENDPOINT
)
+ @classmethod
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
+ """Creates an instance of this client using the provided credentials info.
+
+ Args:
+ info (dict): The service account private key info.
+ args: Additional arguments to pass to the constructor.
+ kwargs: Additional arguments to pass to the constructor.
+
+ Returns:
+ AlphaAnalyticsDataClient: The constructed client.
+ """
+ credentials = service_account.Credentials.from_service_account_info(info)
+ kwargs["credentials"] = credentials
+ return cls(*args, **kwargs)
+
@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
@@ -124,7 +140,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
kwargs: Additional arguments to pass to the constructor.
Returns:
- {@api.name}: The constructed client.
+ AlphaAnalyticsDataClient: The constructed client.
"""
credentials = service_account.Credentials.from_service_account_file(filename)
kwargs["credentials"] = credentials
@@ -227,10 +243,10 @@ def __init__(
credentials identify the application to the service; if none
are specified, the client will attempt to ascertain the
credentials from the environment.
- transport (Union[str, ~.AlphaAnalyticsDataTransport]): The
+ transport (Union[str, AlphaAnalyticsDataTransport]): The
transport to use. If set to None, a transport is chosen
automatically.
- client_options (client_options_lib.ClientOptions): Custom options for the
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
client. It won't take effect if a ``transport`` instance is provided.
(1) The ``api_endpoint`` property can be used to override the
default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
@@ -347,7 +363,7 @@ def run_report(
criteria, such as country or event name.
Args:
- request (:class:`~.analytics_data_api.RunReportRequest`):
+ request (google.analytics.data_v1alpha.types.RunReportRequest):
The request object. The request to generate a report.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
@@ -357,7 +373,7 @@ def run_report(
sent along with the request as metadata.
Returns:
- ~.analytics_data_api.RunReportResponse:
+ google.analytics.data_v1alpha.types.RunReportResponse:
The response report table
corresponding to a request.
@@ -397,7 +413,7 @@ def run_pivot_report(
dissect your data.
Args:
- request (:class:`~.analytics_data_api.RunPivotReportRequest`):
+ request (google.analytics.data_v1alpha.types.RunPivotReportRequest):
The request object. The request to generate a pivot
report.
@@ -408,7 +424,7 @@ def run_pivot_report(
sent along with the request as metadata.
Returns:
- ~.analytics_data_api.RunPivotReportResponse:
+ google.analytics.data_v1alpha.types.RunPivotReportResponse:
The response pivot report table
corresponding to a pivot request.
@@ -444,7 +460,7 @@ def batch_run_reports(
be for the same Entity.
Args:
- request (:class:`~.analytics_data_api.BatchRunReportsRequest`):
+ request (google.analytics.data_v1alpha.types.BatchRunReportsRequest):
The request object. The batch request containing
multiple report requests.
@@ -455,7 +471,7 @@ def batch_run_reports(
sent along with the request as metadata.
Returns:
- ~.analytics_data_api.BatchRunReportsResponse:
+ google.analytics.data_v1alpha.types.BatchRunReportsResponse:
The batch response containing
multiple reports.
@@ -491,7 +507,7 @@ def batch_run_pivot_reports(
reports must be for the same Entity.
Args:
- request (:class:`~.analytics_data_api.BatchRunPivotReportsRequest`):
+ request (google.analytics.data_v1alpha.types.BatchRunPivotReportsRequest):
The request object. The batch request containing
multiple pivot report requests.
@@ -502,7 +518,7 @@ def batch_run_pivot_reports(
sent along with the request as metadata.
Returns:
- ~.analytics_data_api.BatchRunPivotReportsResponse:
+ google.analytics.data_v1alpha.types.BatchRunPivotReportsResponse:
The batch response containing
multiple pivot reports.
@@ -548,22 +564,23 @@ def get_metadata(
such as ``country`` and ``totalUsers``.
Args:
- request (:class:`~.analytics_data_api.GetMetadataRequest`):
+ request (google.analytics.data_v1alpha.types.GetMetadataRequest):
The request object. Request for a property's dimension
and metric metadata.
- name (:class:`str`):
+ name (str):
Required. The resource name of the metadata to retrieve.
This name field is specified in the URL path and not URL
parameters. Property is a numeric Google Analytics GA4
Property identifier. To learn more, see `where to find
your Property
- ID `__.
+ ID `__.
Example: properties/1234/metadata
Set the Property ID to 0 for dimensions and metrics
common to all properties. In this special mode, this
method will not return custom dimensions and metrics.
+
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
@@ -575,7 +592,7 @@ def get_metadata(
sent along with the request as metadata.
Returns:
- ~.analytics_data_api.Metadata:
+ google.analytics.data_v1alpha.types.Metadata:
The dimensions and metrics currently
accepted in reporting methods.
@@ -633,7 +650,7 @@ def run_realtime_report(
last 30 minutes.
Args:
- request (:class:`~.analytics_data_api.RunRealtimeReportRequest`):
+ request (google.analytics.data_v1alpha.types.RunRealtimeReportRequest):
The request object. The request to generate a realtime
report.
@@ -644,7 +661,7 @@ def run_realtime_report(
sent along with the request as metadata.
Returns:
- ~.analytics_data_api.RunRealtimeReportResponse:
+ google.analytics.data_v1alpha.types.RunRealtimeReportResponse:
The response realtime report table
corresponding to a request.
diff --git a/google/analytics/data_v1alpha/services/alpha_analytics_data/transports/__init__.py b/google/analytics/data_v1alpha/services/alpha_analytics_data/transports/__init__.py
index 73ffede..77f8bc5 100644
--- a/google/analytics/data_v1alpha/services/alpha_analytics_data/transports/__init__.py
+++ b/google/analytics/data_v1alpha/services/alpha_analytics_data/transports/__init__.py
@@ -30,7 +30,6 @@
_transport_registry["grpc"] = AlphaAnalyticsDataGrpcTransport
_transport_registry["grpc_asyncio"] = AlphaAnalyticsDataGrpcAsyncIOTransport
-
__all__ = (
"AlphaAnalyticsDataTransport",
"AlphaAnalyticsDataGrpcTransport",
diff --git a/google/analytics/data_v1alpha/services/alpha_analytics_data/transports/grpc.py b/google/analytics/data_v1alpha/services/alpha_analytics_data/transports/grpc.py
index 239fb3e..da3658b 100644
--- a/google/analytics/data_v1alpha/services/alpha_analytics_data/transports/grpc.py
+++ b/google/analytics/data_v1alpha/services/alpha_analytics_data/transports/grpc.py
@@ -146,6 +146,10 @@ def __init__(
ssl_credentials=ssl_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
)
self._ssl_channel_credentials = ssl_credentials
else:
@@ -164,6 +168,10 @@ def __init__(
ssl_credentials=ssl_channel_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
)
self._stubs = {} # type: Dict[str, Callable]
@@ -190,7 +198,7 @@ def create_channel(
) -> grpc.Channel:
"""Create and return a gRPC channel object.
Args:
- address (Optionsl[str]): The host for the channel to use.
+ address (Optional[str]): The host for the channel to use.
credentials (Optional[~.Credentials]): The
authorization credentials to attach to requests. These
credentials identify this application to the service. If
diff --git a/google/analytics/data_v1alpha/services/alpha_analytics_data/transports/grpc_asyncio.py b/google/analytics/data_v1alpha/services/alpha_analytics_data/transports/grpc_asyncio.py
index 2a02979..30d97c1 100644
--- a/google/analytics/data_v1alpha/services/alpha_analytics_data/transports/grpc_asyncio.py
+++ b/google/analytics/data_v1alpha/services/alpha_analytics_data/transports/grpc_asyncio.py
@@ -191,6 +191,10 @@ def __init__(
ssl_credentials=ssl_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
)
self._ssl_channel_credentials = ssl_credentials
else:
@@ -209,6 +213,10 @@ def __init__(
ssl_credentials=ssl_channel_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
)
# Run the base constructor.
diff --git a/google/analytics/data_v1alpha/types/__init__.py b/google/analytics/data_v1alpha/types/__init__.py
index c6be9f3..ca30e25 100644
--- a/google/analytics/data_v1alpha/types/__init__.py
+++ b/google/analytics/data_v1alpha/types/__init__.py
@@ -28,8 +28,8 @@
Pivot,
CohortSpec,
Cohort,
- CohortReportSettings,
CohortsRange,
+ CohortReportSettings,
ResponseMetaData,
DimensionHeader,
MetricHeader,
@@ -43,6 +43,8 @@
QuotaStatus,
DimensionMetadata,
MetricMetadata,
+ MetricAggregation,
+ MetricType,
)
from .analytics_data_api import (
Metadata,
@@ -59,7 +61,6 @@
RunRealtimeReportResponse,
)
-
__all__ = (
"DateRange",
"Entity",
@@ -73,8 +74,8 @@
"Pivot",
"CohortSpec",
"Cohort",
- "CohortReportSettings",
"CohortsRange",
+ "CohortReportSettings",
"ResponseMetaData",
"DimensionHeader",
"MetricHeader",
@@ -88,6 +89,8 @@
"QuotaStatus",
"DimensionMetadata",
"MetricMetadata",
+ "MetricAggregation",
+ "MetricType",
"Metadata",
"RunReportRequest",
"RunReportResponse",
diff --git a/google/analytics/data_v1alpha/types/analytics_data_api.py b/google/analytics/data_v1alpha/types/analytics_data_api.py
index e23a091..30a98d8 100644
--- a/google/analytics/data_v1alpha/types/analytics_data_api.py
+++ b/google/analytics/data_v1alpha/types/analytics_data_api.py
@@ -47,9 +47,9 @@ class Metadata(proto.Message):
Attributes:
name (str):
Resource name of this metadata.
- dimensions (Sequence[~.data.DimensionMetadata]):
+ dimensions (Sequence[google.analytics.data_v1alpha.types.DimensionMetadata]):
The dimension descriptions.
- metrics (Sequence[~.data.MetricMetadata]):
+ metrics (Sequence[google.analytics.data_v1alpha.types.MetricMetadata]):
The metric descriptions.
"""
@@ -66,16 +66,16 @@ class RunReportRequest(proto.Message):
r"""The request to generate a report.
Attributes:
- entity (~.data.Entity):
+ entity (google.analytics.data_v1alpha.types.Entity):
A property whose events are tracked. Within a
batch request, this entity should either be
unspecified or consistent with the batch-level
entity.
- dimensions (Sequence[~.data.Dimension]):
+ dimensions (Sequence[google.analytics.data_v1alpha.types.Dimension]):
The dimensions requested and displayed.
- metrics (Sequence[~.data.Metric]):
+ metrics (Sequence[google.analytics.data_v1alpha.types.Metric]):
The metrics requested and displayed.
- date_ranges (Sequence[~.data.DateRange]):
+ date_ranges (Sequence[google.analytics.data_v1alpha.types.DateRange]):
Date ranges of data to read. If multiple date ranges are
requested, each response row will contain a zero based date
range index. If two date ranges overlap, the event data for
@@ -87,35 +87,35 @@ class RunReportRequest(proto.Message):
row 0.
To learn more about this pagination parameter, see
- `Pagination `__.
+ `Pagination `__.
limit (int):
The number of rows to return. If unspecified, 10 rows are
returned. If -1, all rows are returned.
To learn more about this pagination parameter, see
- `Pagination `__.
- metric_aggregations (Sequence[~.data.MetricAggregation]):
+ `Pagination `__.
+ metric_aggregations (Sequence[google.analytics.data_v1alpha.types.MetricAggregation]):
Aggregation of metrics. Aggregated metric values will be
shown in rows where the dimension_values are set to
"RESERVED_(MetricAggregation)".
- dimension_filter (~.data.FilterExpression):
+ dimension_filter (google.analytics.data_v1alpha.types.FilterExpression):
The filter clause of dimensions. Dimensions
must be requested to be used in this filter.
Metrics cannot be used in this filter.
- metric_filter (~.data.FilterExpression):
+ metric_filter (google.analytics.data_v1alpha.types.FilterExpression):
The filter clause of metrics. Applied at post
aggregation phase, similar to SQL having-clause.
Metrics must be requested to be used in this
filter. Dimensions cannot be used in this
filter.
- order_bys (Sequence[~.data.OrderBy]):
+ order_bys (Sequence[google.analytics.data_v1alpha.types.OrderBy]):
Specifies how rows are ordered in the
response.
currency_code (str):
A currency code in ISO4217 format, such as
"AED", "USD", "JPY". If the field is empty, the
report uses the entity's default currency.
- cohort_spec (~.data.CohortSpec):
+ cohort_spec (google.analytics.data_v1alpha.types.CohortSpec):
Cohort group associated with this request. If
there is a cohort group in the request the
'cohort' dimension must be present.
@@ -167,23 +167,23 @@ class RunReportResponse(proto.Message):
r"""The response report table corresponding to a request.
Attributes:
- dimension_headers (Sequence[~.data.DimensionHeader]):
+ dimension_headers (Sequence[google.analytics.data_v1alpha.types.DimensionHeader]):
Describes dimension columns. The number of
DimensionHeaders and ordering of
DimensionHeaders matches the dimensions present
in rows.
- metric_headers (Sequence[~.data.MetricHeader]):
+ metric_headers (Sequence[google.analytics.data_v1alpha.types.MetricHeader]):
Describes metric columns. The number of
MetricHeaders and ordering of MetricHeaders
matches the metrics present in rows.
- rows (Sequence[~.data.Row]):
+ rows (Sequence[google.analytics.data_v1alpha.types.Row]):
Rows of dimension value combinations and
metric values in the report.
- totals (Sequence[~.data.Row]):
+ totals (Sequence[google.analytics.data_v1alpha.types.Row]):
If requested, the totaled values of metrics.
- maximums (Sequence[~.data.Row]):
+ maximums (Sequence[google.analytics.data_v1alpha.types.Row]):
If requested, the maximum values of metrics.
- minimums (Sequence[~.data.Row]):
+ minimums (Sequence[google.analytics.data_v1alpha.types.Row]):
If requested, the minimum values of metrics.
row_count (int):
The total number of rows in the query result, regardless of
@@ -193,10 +193,10 @@ class RunReportResponse(proto.Message):
50 rows.
To learn more about this pagination parameter, see
- `Pagination `__.
- metadata (~.data.ResponseMetaData):
+ `Pagination `__.
+ metadata (google.analytics.data_v1alpha.types.ResponseMetaData):
Metadata for the report.
- property_quota (~.data.PropertyQuota):
+ property_quota (google.analytics.data_v1alpha.types.PropertyQuota):
This Analytics Property's quota state
including this request.
"""
@@ -228,30 +228,30 @@ class RunPivotReportRequest(proto.Message):
r"""The request to generate a pivot report.
Attributes:
- entity (~.data.Entity):
+ entity (google.analytics.data_v1alpha.types.Entity):
A property whose events are tracked. Within a
batch request, this entity should either be
unspecified or consistent with the batch-level
entity.
- dimensions (Sequence[~.data.Dimension]):
+ dimensions (Sequence[google.analytics.data_v1alpha.types.Dimension]):
The dimensions requested. All defined dimensions must be
used by one of the following: dimension_expression,
dimension_filter, pivots, order_bys.
- metrics (Sequence[~.data.Metric]):
+ metrics (Sequence[google.analytics.data_v1alpha.types.Metric]):
The metrics requested, at least one metric needs to be
specified. All defined metrics must be used by one of the
following: metric_expression, metric_filter, order_bys.
- dimension_filter (~.data.FilterExpression):
+ dimension_filter (google.analytics.data_v1alpha.types.FilterExpression):
The filter clause of dimensions. Dimensions
must be requested to be used in this filter.
Metrics cannot be used in this filter.
- metric_filter (~.data.FilterExpression):
+ metric_filter (google.analytics.data_v1alpha.types.FilterExpression):
The filter clause of metrics. Applied at post
aggregation phase, similar to SQL having-clause.
Metrics must be requested to be used in this
filter. Dimensions cannot be used in this
filter.
- pivots (Sequence[~.data.Pivot]):
+ pivots (Sequence[google.analytics.data_v1alpha.types.Pivot]):
Describes the visual format of the report's
dimensions in columns or rows. The union of the
fieldNames (dimension names) in all pivots must
@@ -259,7 +259,7 @@ class RunPivotReportRequest(proto.Message):
Dimensions. No two pivots can share a dimension.
A dimension is only visible if it appears in a
pivot.
- date_ranges (Sequence[~.data.DateRange]):
+ date_ranges (Sequence[google.analytics.data_v1alpha.types.DateRange]):
The date range to retrieve event data for the report. If
multiple date ranges are specified, event data from each
date range is used in the report. A special dimension with
@@ -271,7 +271,7 @@ class RunPivotReportRequest(proto.Message):
A currency code in ISO4217 format, such as
"AED", "USD", "JPY". If the field is empty, the
report uses the entity's default currency.
- cohort_spec (~.data.CohortSpec):
+ cohort_spec (google.analytics.data_v1alpha.types.CohortSpec):
Cohort group associated with this request. If
there is a cohort group in the request the
'cohort' dimension must be present.
@@ -316,7 +316,7 @@ class RunPivotReportResponse(proto.Message):
request.
Attributes:
- pivot_headers (Sequence[~.data.PivotHeader]):
+ pivot_headers (Sequence[google.analytics.data_v1alpha.types.PivotHeader]):
Summarizes the columns and rows created by a pivot. Each
pivot in the request produces one header in the response. If
we have a request like this:
@@ -357,27 +357,27 @@ class RunPivotReportResponse(proto.Message):
"dimensionValues": [{ "value": "scroll" }]
}]
}]
- dimension_headers (Sequence[~.data.DimensionHeader]):
+ dimension_headers (Sequence[google.analytics.data_v1alpha.types.DimensionHeader]):
Describes dimension columns. The number of
DimensionHeaders and ordering of
DimensionHeaders matches the dimensions present
in rows.
- metric_headers (Sequence[~.data.MetricHeader]):
+ metric_headers (Sequence[google.analytics.data_v1alpha.types.MetricHeader]):
Describes metric columns. The number of
MetricHeaders and ordering of MetricHeaders
matches the metrics present in rows.
- rows (Sequence[~.data.Row]):
+ rows (Sequence[google.analytics.data_v1alpha.types.Row]):
Rows of dimension value combinations and
metric values in the report.
- aggregates (Sequence[~.data.Row]):
+ aggregates (Sequence[google.analytics.data_v1alpha.types.Row]):
Aggregation of metric values. Can be totals, minimums, or
maximums. The returned aggregations are controlled by the
metric_aggregations in the pivot. The type of aggregation
returned in each row is shown by the dimension_values which
are set to "RESERVED\_".
- metadata (~.data.ResponseMetaData):
+ metadata (google.analytics.data_v1alpha.types.ResponseMetaData):
Metadata for the report.
- property_quota (~.data.PropertyQuota):
+ property_quota (google.analytics.data_v1alpha.types.PropertyQuota):
This Analytics Property's quota state
including this request.
"""
@@ -407,12 +407,12 @@ class BatchRunReportsRequest(proto.Message):
r"""The batch request containing multiple report requests.
Attributes:
- entity (~.data.Entity):
+ entity (google.analytics.data_v1alpha.types.Entity):
A property whose events are tracked. This
entity must be specified for the batch. The
entity within RunReportRequest may either be
unspecified or consistent with this entity.
- requests (Sequence[~.analytics_data_api.RunReportRequest]):
+ requests (Sequence[google.analytics.data_v1alpha.types.RunReportRequest]):
Individual requests. Each request has a
separate report response. Each batch request is
allowed up to 5 requests.
@@ -427,7 +427,7 @@ class BatchRunReportsResponse(proto.Message):
r"""The batch response containing multiple reports.
Attributes:
- reports (Sequence[~.analytics_data_api.RunReportResponse]):
+ reports (Sequence[google.analytics.data_v1alpha.types.RunReportResponse]):
Individual responses. Each response has a
separate report request.
"""
@@ -439,12 +439,12 @@ class BatchRunPivotReportsRequest(proto.Message):
r"""The batch request containing multiple pivot report requests.
Attributes:
- entity (~.data.Entity):
+ entity (google.analytics.data_v1alpha.types.Entity):
A property whose events are tracked. This
entity must be specified for the batch. The
entity within RunPivotReportRequest may either
be unspecified or consistent with this entity.
- requests (Sequence[~.analytics_data_api.RunPivotReportRequest]):
+ requests (Sequence[google.analytics.data_v1alpha.types.RunPivotReportRequest]):
Individual requests. Each request has a
separate pivot report response. Each batch
request is allowed up to 5 requests.
@@ -461,7 +461,7 @@ class BatchRunPivotReportsResponse(proto.Message):
r"""The batch response containing multiple pivot reports.
Attributes:
- pivot_reports (Sequence[~.analytics_data_api.RunPivotReportResponse]):
+ pivot_reports (Sequence[google.analytics.data_v1alpha.types.RunPivotReportResponse]):
Individual responses. Each response has a
separate pivot report request.
"""
@@ -481,7 +481,7 @@ class GetMetadataRequest(proto.Message):
parameters. Property is a numeric Google Analytics GA4
Property identifier. To learn more, see `where to find your
Property
- ID `__.
+ ID `__.
Example: properties/1234/metadata
@@ -501,32 +501,32 @@ class RunRealtimeReportRequest(proto.Message):
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
- ID `__.
+ ID `__.
Example: properties/1234
- dimensions (Sequence[~.data.Dimension]):
+ dimensions (Sequence[google.analytics.data_v1alpha.types.Dimension]):
The dimensions requested and displayed.
- metrics (Sequence[~.data.Metric]):
+ metrics (Sequence[google.analytics.data_v1alpha.types.Metric]):
The metrics requested and displayed.
limit (int):
The number of rows to return. If unspecified,
10 rows are returned. If -1, all rows are
returned.
- dimension_filter (~.data.FilterExpression):
+ dimension_filter (google.analytics.data_v1alpha.types.FilterExpression):
The filter clause of dimensions. Dimensions
must be requested to be used in this filter.
Metrics cannot be used in this filter.
- metric_filter (~.data.FilterExpression):
+ metric_filter (google.analytics.data_v1alpha.types.FilterExpression):
The filter clause of metrics. Applied at post
aggregation phase, similar to SQL having-clause.
Metrics must be requested to be used in this
filter. Dimensions cannot be used in this
filter.
- metric_aggregations (Sequence[~.data.MetricAggregation]):
+ metric_aggregations (Sequence[google.analytics.data_v1alpha.types.MetricAggregation]):
Aggregation of metrics. Aggregated metric values will be
shown in rows where the dimension_values are set to
"RESERVED_(MetricAggregation)".
- order_bys (Sequence[~.data.OrderBy]):
+ order_bys (Sequence[google.analytics.data_v1alpha.types.OrderBy]):
Specifies how rows are ordered in the
response.
return_property_quota (bool):
@@ -563,23 +563,23 @@ class RunRealtimeReportResponse(proto.Message):
request.
Attributes:
- dimension_headers (Sequence[~.data.DimensionHeader]):
+ dimension_headers (Sequence[google.analytics.data_v1alpha.types.DimensionHeader]):
Describes dimension columns. The number of
DimensionHeaders and ordering of
DimensionHeaders matches the dimensions present
in rows.
- metric_headers (Sequence[~.data.MetricHeader]):
+ metric_headers (Sequence[google.analytics.data_v1alpha.types.MetricHeader]):
Describes metric columns. The number of
MetricHeaders and ordering of MetricHeaders
matches the metrics present in rows.
- rows (Sequence[~.data.Row]):
+ rows (Sequence[google.analytics.data_v1alpha.types.Row]):
Rows of dimension value combinations and
metric values in the report.
- totals (Sequence[~.data.Row]):
+ totals (Sequence[google.analytics.data_v1alpha.types.Row]):
If requested, the totaled values of metrics.
- maximums (Sequence[~.data.Row]):
+ maximums (Sequence[google.analytics.data_v1alpha.types.Row]):
If requested, the maximum values of metrics.
- minimums (Sequence[~.data.Row]):
+ minimums (Sequence[google.analytics.data_v1alpha.types.Row]):
If requested, the minimum values of metrics.
row_count (int):
The total number of rows in the query result, regardless of
@@ -587,7 +587,7 @@ class RunRealtimeReportResponse(proto.Message):
a query returns 175 rows and includes limit = 50 in the API
request, the response will contain row_count = 175 but only
50 rows.
- property_quota (~.data.PropertyQuota):
+ property_quota (google.analytics.data_v1alpha.types.PropertyQuota):
This Analytics Property's Realtime quota
state including this request.
"""
diff --git a/google/analytics/data_v1alpha/types/data.py b/google/analytics/data_v1alpha/types/data.py
index 24d2e77..05606cb 100644
--- a/google/analytics/data_v1alpha/types/data.py
+++ b/google/analytics/data_v1alpha/types/data.py
@@ -35,8 +35,8 @@
"Pivot",
"CohortSpec",
"Cohort",
- "CohortReportSettings",
"CohortsRange",
+ "CohortReportSettings",
"ResponseMetaData",
"DimensionHeader",
"MetricHeader",
@@ -120,7 +120,7 @@ class Entity(proto.Message):
property_id (str):
A Google Analytics GA4 property id. To learn more, see
`where to find your Property
- ID `__.
+ ID `__.
"""
property_id = proto.Field(proto.STRING, number=1)
@@ -136,7 +136,7 @@ class Dimension(proto.Message):
Attributes:
name (str):
The name of the dimension. See the `API
- Dimensions `__
+ Dimensions `__
for the list of dimension names.
If ``dimensionExpression`` is specified, ``name`` can be any
@@ -147,7 +147,7 @@ class Dimension(proto.Message):
Dimensions are referenced by ``name`` in
``dimensionFilter``, ``orderBys``, ``dimensionExpression``,
and ``pivots``.
- dimension_expression (~.data.DimensionExpression):
+ dimension_expression (google.analytics.data_v1alpha.types.DimensionExpression):
One dimension can be the result of an
expression of multiple dimensions. For example,
dimension "country, city": concatenate(country,
@@ -169,13 +169,13 @@ class DimensionExpression(proto.Message):
2) concatenate(dimension1, symbol, dimension2).
Attributes:
- lower_case (~.data.DimensionExpression.CaseExpression):
+ lower_case (google.analytics.data_v1alpha.types.DimensionExpression.CaseExpression):
Used to convert a dimension value to lower
case.
- upper_case (~.data.DimensionExpression.CaseExpression):
+ upper_case (google.analytics.data_v1alpha.types.DimensionExpression.CaseExpression):
Used to convert a dimension value to upper
case.
- concatenate (~.data.DimensionExpression.ConcatenateExpression):
+ concatenate (google.analytics.data_v1alpha.types.DimensionExpression.ConcatenateExpression):
Used to combine dimension values to a single
dimension. For example, dimension "country,
city": concatenate(country, ", ", city).
@@ -236,7 +236,7 @@ class Metric(proto.Message):
Attributes:
name (str):
The name of the metric. See the `API
- Metrics `__
+ Metrics `__
for the list of metric names.
If ``expression`` is specified, ``name`` can be any string
@@ -270,13 +270,13 @@ class FilterExpression(proto.Message):
dimensions or all metrics.
Attributes:
- and_group (~.data.FilterExpressionList):
+ and_group (google.analytics.data_v1alpha.types.FilterExpressionList):
The FilterExpressions in and_group have an AND relationship.
- or_group (~.data.FilterExpressionList):
+ or_group (google.analytics.data_v1alpha.types.FilterExpressionList):
The FilterExpressions in or_group have an OR relationship.
- not_expression (~.data.FilterExpression):
+ not_expression (google.analytics.data_v1alpha.types.FilterExpression):
The FilterExpression is NOT of not_expression.
- filter (~.data.Filter):
+ filter (google.analytics.data_v1alpha.types.Filter):
A primitive filter.
All fields in filter in same FilterExpression
needs to be either all dimensions or metrics.
@@ -301,7 +301,7 @@ class FilterExpressionList(proto.Message):
r"""A list of filter expressions.
Attributes:
- expressions (Sequence[~.data.FilterExpression]):
+ expressions (Sequence[google.analytics.data_v1alpha.types.FilterExpression]):
A list of filter expressions.
"""
@@ -324,13 +324,13 @@ class Filter(proto.Message):
expression. For example, a NOT expression of a
null filter removes rows when a dimension is
null.
- string_filter (~.data.Filter.StringFilter):
+ string_filter (google.analytics.data_v1alpha.types.Filter.StringFilter):
Strings related filter.
- in_list_filter (~.data.Filter.InListFilter):
+ in_list_filter (google.analytics.data_v1alpha.types.Filter.InListFilter):
A filter for in list values.
- numeric_filter (~.data.Filter.NumericFilter):
+ numeric_filter (google.analytics.data_v1alpha.types.Filter.NumericFilter):
A filter for numeric or date values.
- between_filter (~.data.Filter.BetweenFilter):
+ between_filter (google.analytics.data_v1alpha.types.Filter.BetweenFilter):
A filter for two values.
"""
@@ -338,7 +338,7 @@ class StringFilter(proto.Message):
r"""The filter for string
Attributes:
- match_type (~.data.Filter.StringFilter.MatchType):
+ match_type (google.analytics.data_v1alpha.types.Filter.StringFilter.MatchType):
The match type for this filter.
value (str):
The string value used for the matching.
@@ -383,9 +383,9 @@ class NumericFilter(proto.Message):
r"""Filters for numeric or date values.
Attributes:
- operation (~.data.Filter.NumericFilter.Operation):
+ operation (google.analytics.data_v1alpha.types.Filter.NumericFilter.Operation):
The operation type for this filter.
- value (~.data.NumericValue):
+ value (google.analytics.data_v1alpha.types.NumericValue):
A numeric value or a date value.
"""
@@ -409,9 +409,9 @@ class BetweenFilter(proto.Message):
(inclusive).
Attributes:
- from_value (~.data.NumericValue):
+ from_value (google.analytics.data_v1alpha.types.NumericValue):
Begins with this number.
- to_value (~.data.NumericValue):
+ to_value (google.analytics.data_v1alpha.types.NumericValue):
Ends with this number.
"""
@@ -444,11 +444,11 @@ class OrderBy(proto.Message):
r"""The sort options.
Attributes:
- metric (~.data.OrderBy.MetricOrderBy):
+ metric (google.analytics.data_v1alpha.types.OrderBy.MetricOrderBy):
Sorts results by a metric's values.
- dimension (~.data.OrderBy.DimensionOrderBy):
+ dimension (google.analytics.data_v1alpha.types.OrderBy.DimensionOrderBy):
Sorts results by a dimension's values.
- pivot (~.data.OrderBy.PivotOrderBy):
+ pivot (google.analytics.data_v1alpha.types.OrderBy.PivotOrderBy):
Sorts results by a metric's values within a
pivot column group.
desc (bool):
@@ -471,7 +471,7 @@ class DimensionOrderBy(proto.Message):
Attributes:
dimension_name (str):
A dimension name in the request to order by.
- order_type (~.data.OrderBy.DimensionOrderBy.OrderType):
+ order_type (google.analytics.data_v1alpha.types.OrderBy.DimensionOrderBy.OrderType):
Controls the rule for dimension value
ordering.
"""
@@ -497,7 +497,7 @@ class PivotOrderBy(proto.Message):
In the response to order by, order rows by
this column. Must be a metric name from the
request.
- pivot_selections (Sequence[~.data.OrderBy.PivotOrderBy.PivotSelection]):
+ pivot_selections (Sequence[google.analytics.data_v1alpha.types.OrderBy.PivotOrderBy.PivotSelection]):
Used to select a dimension name and value
pivot. If multiple pivot selections are given,
the sort occurs on rows where all pivot
@@ -570,7 +570,7 @@ class Pivot(proto.Message):
response, dimension values in the date range
column will indicate the corresponding date
range from the request.
- order_bys (Sequence[~.data.OrderBy]):
+ order_bys (Sequence[google.analytics.data_v1alpha.types.OrderBy]):
Specifies how dimensions are ordered in the pivot. In the
first Pivot, the OrderBys determine Row and
PivotDimensionHeader ordering; in subsequent Pivots, the
@@ -584,7 +584,7 @@ class Pivot(proto.Message):
The number of rows to return in this pivot.
If unspecified, 10 rows are returned. If -1, all
rows are returned.
- metric_aggregations (Sequence[~.data.MetricAggregation]):
+ metric_aggregations (Sequence[google.analytics.data_v1alpha.types.MetricAggregation]):
Aggregate the metrics by dimensions in this pivot using the
specified metric_aggregations.
"""
@@ -603,15 +603,35 @@ class Pivot(proto.Message):
class CohortSpec(proto.Message):
- r"""Specification for a cohort report.
+ r"""Specification of cohorts for a cohort report. Cohort reports can be
+ used for example to create a time series of user retention for the
+ cohort. For example, you could select the cohort of users that were
+ acquired in the first week of September and follow that cohort for
+ the next six weeks. Selecting the users acquired in the first week
+ of September cohort is specified in the ``cohort`` object. Following
+ that cohort for the next six weeks is specified in the
+ ``cohortsRange`` object.
+
+ The report response could show a weekly time series where say your
+ app has retained 60% of this cohort after three weeks and 25% of
+ this cohort after six weeks. These two percentages can be calculated
+ by the metric ``cohortActiveUsers/cohortTotalUsers`` and will be
+ separate rows in the report.
Attributes:
- cohorts (Sequence[~.data.Cohort]):
- The definition for the cohorts.
- cohorts_range (~.data.CohortsRange):
- The data ranges of cohorts.
- cohort_report_settings (~.data.CohortReportSettings):
- Settings of a cohort report.
+ cohorts (Sequence[google.analytics.data_v1alpha.types.Cohort]):
+ Defines the selection criteria to group users
+ into cohorts.
+ Most cohort reports define only a single cohort.
+ If multiple cohorts are specified, each cohort
+ can be recognized in the report by their name.
+ cohorts_range (google.analytics.data_v1alpha.types.CohortsRange):
+ Cohort reports follow cohorts over an
+ extended reporting date range. This range
+ specifies an offset duration to follow the
+ cohorts over.
+ cohort_report_settings (google.analytics.data_v1alpha.types.CohortReportSettings):
+ Optional settings for a cohort report.
"""
cohorts = proto.RepeatedField(proto.MESSAGE, number=1, message="Cohort",)
@@ -624,9 +644,9 @@ class CohortSpec(proto.Message):
class Cohort(proto.Message):
- r"""Defines a cohort. A cohort is a group of users who share a
- common characteristic. For example, all users with the same
- acquisition date belong to the same cohort.
+ r"""Defines a cohort selection criteria. A cohort is a group of users
+ who share a common characteristic. For example, users with the same
+ ``firstTouchDate`` belong to the same cohort.
Attributes:
name (str):
@@ -636,23 +656,30 @@ class Cohort(proto.Message):
are named by their zero based index ``cohort_0``,
``cohort_1``, etc.
dimension (str):
- The dimension used by cohort. Only supports
- ``firstTouchDate`` for retention report.
- date_range (~.data.DateRange):
- The cohort selects users whose first visit date is between
- start date and end date defined in the ``dateRange``. In a
- cohort request, this ``dateRange`` is required and the
+ Dimension used by the cohort. Required and only supports
+ ``firstTouchDate``.
+ date_range (google.analytics.data_v1alpha.types.DateRange):
+ The cohort selects users whose first touch date is between
+ start date and end date defined in the ``dateRange``. This
+ ``dateRange`` does not specify the full date range of event
+ data that is present in a cohort report. In a cohort report,
+ this ``dateRange`` is extended by the granularity and offset
+ present in the ``cohortsRange``; event data for the extended
+ reporting date range is present in a cohort report.
+
+ In a cohort request, this ``dateRange`` is required and the
``dateRanges`` in the ``RunReportRequest`` or
``RunPivotReportRequest`` must be unspecified.
- The date range should be aligned with the cohort's
- granularity. If CohortsRange uses daily granularity, the
- date range can be aligned to any day. If CohortsRange uses
- weekly granularity, the date range should be aligned to the
- week boundary, starting at Sunday and ending Saturday. If
- CohortsRange uses monthly granularity, the date range should
- be aligned to the month, starting at the first and ending on
- the last day of the month.
+ This ``dateRange`` should generally be aligned with the
+ cohort's granularity. If ``CohortsRange`` uses daily
+ granularity, this ``dateRange`` can be a single day. If
+ ``CohortsRange`` uses weekly granularity, this ``dateRange``
+ can be aligned to a week boundary, starting at Sunday and
+ ending Saturday. If ``CohortsRange`` uses monthly
+ granularity, this ``dateRange`` can be aligned to a month,
+ starting at the first and ending on the last day of the
+ month.
"""
name = proto.Field(proto.STRING, number=1)
@@ -662,37 +689,57 @@ class Cohort(proto.Message):
date_range = proto.Field(proto.MESSAGE, number=3, message="DateRange",)
-class CohortReportSettings(proto.Message):
- r"""Settings of a cohort report.
-
- Attributes:
- accumulate (bool):
- If true, accumulates the result from first visit day to the
- end day. Not supported in ``RunReportRequest``.
- """
-
- accumulate = proto.Field(proto.BOOL, number=1)
-
-
class CohortsRange(proto.Message):
- r"""Describes date range for a cohort report.
+ r"""Configures the extended reporting date range for a cohort
+ report. Specifies an offset duration to follow the cohorts over.
Attributes:
- granularity (~.data.CohortsRange.Granularity):
- Reporting date range for each cohort is
- calculated based on these three fields.
+ granularity (google.analytics.data_v1alpha.types.CohortsRange.Granularity):
+ The granularity used to interpret the ``startOffset`` and
+ ``endOffset`` for the extended reporting date range for a
+ cohort report.
start_offset (int):
- For daily cohorts, this will be the start day
- offset. For weekly cohorts, this will be the
- week offset.
+ ``startOffset`` specifies the start date of the extended
+ reporting date range for a cohort report. ``startOffset`` is
+ commonly set to 0 so that reports contain data from the
+ acquisition of the cohort forward.
+
+ If ``granularity`` is ``DAILY``, the ``startDate`` of the
+ extended reporting date range is ``startDate`` of the cohort
+ plus ``startOffset`` days.
+
+ If ``granularity`` is ``WEEKLY``, the ``startDate`` of the
+ extended reporting date range is ``startDate`` of the cohort
+ plus ``startOffset * 7`` days.
+
+ If ``granularity`` is ``MONTHLY``, the ``startDate`` of the
+ extended reporting date range is ``startDate`` of the cohort
+ plus ``startOffset * 30`` days.
end_offset (int):
- For daily cohorts, this will be the end day
- offset. For weekly cohorts, this will be the
- week offset.
+ ``endOffset`` specifies the end date of the extended
+ reporting date range for a cohort report. ``endOffset`` can
+ be any positive integer but is commonly set to 5 to 10 so
+ that reports contain data on the cohort for the next several
+ granularity time periods.
+
+ If ``granularity`` is ``DAILY``, the ``endDate`` of the
+ extended reporting date range is ``endDate`` of the cohort
+ plus ``endOffset`` days.
+
+ If ``granularity`` is ``WEEKLY``, the ``endDate`` of the
+ extended reporting date range is ``endDate`` of the cohort
+ plus ``endOffset * 7`` days.
+
+ If ``granularity`` is ``MONTHLY``, the ``endDate`` of the
+ extended reporting date range is ``endDate`` of the cohort
+ plus ``endOffset * 30`` days.
"""
class Granularity(proto.Enum):
- r"""Reporting granularity for the cohorts."""
+ r"""The granularity used to interpret the ``startOffset`` and
+ ``endOffset`` for the extended reporting date range for a cohort
+ report.
+ """
GRANULARITY_UNSPECIFIED = 0
DAILY = 1
WEEKLY = 2
@@ -705,6 +752,18 @@ class Granularity(proto.Enum):
end_offset = proto.Field(proto.INT32, number=3)
+class CohortReportSettings(proto.Message):
+ r"""Optional settings of a cohort report.
+
+ Attributes:
+ accumulate (bool):
+ If true, accumulates the result from first touch day to the
+ end day. Not supported in ``RunReportRequest``.
+ """
+
+ accumulate = proto.Field(proto.BOOL, number=1)
+
+
class ResponseMetaData(proto.Message):
r"""Response's metadata carrying additional information about the
report content.
@@ -744,7 +803,7 @@ class MetricHeader(proto.Message):
Attributes:
name (str):
The metric's name.
- type_ (~.data.MetricType):
+ type_ (google.analytics.data_v1alpha.types.MetricType):
The metric's data type.
"""
@@ -757,7 +816,7 @@ class PivotHeader(proto.Message):
r"""Dimensions' values in a single pivot.
Attributes:
- pivot_dimension_headers (Sequence[~.data.PivotDimensionHeader]):
+ pivot_dimension_headers (Sequence[google.analytics.data_v1alpha.types.PivotDimensionHeader]):
The size is the same as the cardinality of
the corresponding dimension combinations.
row_count (int):
@@ -779,7 +838,7 @@ class PivotDimensionHeader(proto.Message):
r"""Summarizes dimension values from a row for this pivot.
Attributes:
- dimension_values (Sequence[~.data.DimensionValue]):
+ dimension_values (Sequence[google.analytics.data_v1alpha.types.DimensionValue]):
Values of multiple dimensions in a pivot.
"""
@@ -827,11 +886,11 @@ class Row(proto.Message):
]
Attributes:
- dimension_values (Sequence[~.data.DimensionValue]):
+ dimension_values (Sequence[google.analytics.data_v1alpha.types.DimensionValue]):
List of requested dimension values. In a PivotReport,
dimension_values are only listed for dimensions included in
a pivot.
- metric_values (Sequence[~.data.MetricValue]):
+ metric_values (Sequence[google.analytics.data_v1alpha.types.MetricValue]):
List of requested visible metric values.
"""
@@ -886,23 +945,23 @@ class PropertyQuota(proto.Message):
property will return Resource Exhausted errors.
Attributes:
- tokens_per_day (~.data.QuotaStatus):
+ tokens_per_day (google.analytics.data_v1alpha.types.QuotaStatus):
Standard Analytics Properties can use up to
25,000 tokens per day; Analytics 360 Properties
can use 250,000 tokens per day. Most requests
consume fewer than 10 tokens.
- tokens_per_hour (~.data.QuotaStatus):
+ tokens_per_hour (google.analytics.data_v1alpha.types.QuotaStatus):
Standard Analytics Properties can use up to
5,000 tokens per day; Analytics 360 Properties
can use 50,000 tokens per day. An API request
consumes a single number of tokens, and that
number is deducted from both the hourly and
daily quotas.
- concurrent_requests (~.data.QuotaStatus):
+ concurrent_requests (google.analytics.data_v1alpha.types.QuotaStatus):
Standard Analytics Properties can send up to
10 concurrent requests; Analytics 360 Properties
can use up to 50 concurrent requests.
- server_errors_per_project_per_hour (~.data.QuotaStatus):
+ server_errors_per_project_per_hour (google.analytics.data_v1alpha.types.QuotaStatus):
Standard Analytics Properties and cloud
project pairs can have up to 10 server errors
per hour; Analytics 360 Properties and cloud
@@ -956,6 +1015,9 @@ class DimensionMetadata(proto.Message):
or one of ``deprecatedApiNames`` for a period of time. After
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.
"""
api_name = proto.Field(proto.STRING, number=1)
@@ -966,6 +1028,8 @@ class DimensionMetadata(proto.Message):
deprecated_api_names = proto.RepeatedField(proto.STRING, number=4)
+ custom_definition = proto.Field(proto.BOOL, number=5)
+
class MetricMetadata(proto.Message):
r"""Explains a metric.
@@ -986,13 +1050,16 @@ class MetricMetadata(proto.Message):
one of ``deprecatedApiNames`` for a period of time. After
the deprecation period, the metric will be available only by
``apiName``.
- type_ (~.data.MetricType):
+ type_ (google.analytics.data_v1alpha.types.MetricType):
The type of this metric.
expression (str):
The mathematical expression for this derived metric. Can be
used in `Metric <#Metric>`__'s ``expression`` field for
equivalent reports. Most metrics are not expressions, and
for non-expressions, this field is empty.
+ custom_definition (bool):
+ True if the metric is a custom metric for
+ this property.
"""
api_name = proto.Field(proto.STRING, number=1)
@@ -1007,5 +1074,7 @@ class MetricMetadata(proto.Message):
expression = proto.Field(proto.STRING, number=6)
+ custom_definition = proto.Field(proto.BOOL, number=7)
+
__all__ = tuple(sorted(__protobuf__.manifest))
diff --git a/noxfile.py b/noxfile.py
index 7bbf2c3..a57e24b 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -81,9 +81,8 @@ def default(session):
session.run(
"py.test",
"--quiet",
- "--cov=google.analytics.data",
- "--cov=google.analytics",
- "--cov=tests.unit",
+ "--cov=google/cloud",
+ "--cov=tests/unit",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt
index 7c41f24..7d0b1a8 100644
--- a/samples/snippets/requirements.txt
+++ b/samples/snippets/requirements.txt
@@ -1 +1 @@
-google-analytics-data==0.1.0
+google-analytics-data==0.2.0
diff --git a/setup.py b/setup.py
index c6e4e7d..ff9ba09 100644
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,7 @@
import os
import setuptools # type: ignore
-version = "0.2.0"
+version = "0.3.0"
package_root = os.path.abspath(os.path.dirname(__file__))
diff --git a/synth.metadata b/synth.metadata
index 6dd04c0..2197936 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -3,30 +3,30 @@
{
"git": {
"name": ".",
- "remote": "git@github.com:googleapis/python-analytics-data",
- "sha": "18c45b829791509a8ae08a14089803718fa7b388"
+ "remote": "https://github.com/googleapis/python-analytics-data.git",
+ "sha": "054c81a64157c0a8ab213daac262e51ea5dfb072"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
- "sha": "6a69c750c3f01a69017662395f90515bbf1fe1ff",
- "internalRef": "342721036"
+ "sha": "520682435235d9c503983a360a2090025aa47cd1",
+ "internalRef": "350246057"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
- "sha": "d5fc0bcf9ea9789c5b0e3154a9e3b29e5cea6116"
+ "sha": "373861061648b5fe5e0ac4f8a38b32d639ee93e4"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
- "sha": "d5fc0bcf9ea9789c5b0e3154a9e3b29e5cea6116"
+ "sha": "373861061648b5fe5e0ac4f8a38b32d639ee93e4"
}
}
],
@@ -40,5 +40,93 @@
"generator": "bazel"
}
}
+ ],
+ "generatedFiles": [
+ ".coveragerc",
+ ".flake8",
+ ".github/CONTRIBUTING.md",
+ ".github/ISSUE_TEMPLATE/bug_report.md",
+ ".github/ISSUE_TEMPLATE/feature_request.md",
+ ".github/ISSUE_TEMPLATE/support_request.md",
+ ".github/PULL_REQUEST_TEMPLATE.md",
+ ".github/release-please.yml",
+ ".github/snippet-bot.yml",
+ ".gitignore",
+ ".kokoro/build.sh",
+ ".kokoro/continuous/common.cfg",
+ ".kokoro/continuous/continuous.cfg",
+ ".kokoro/docker/docs/Dockerfile",
+ ".kokoro/docker/docs/fetch_gpg_keys.sh",
+ ".kokoro/docs/common.cfg",
+ ".kokoro/docs/docs-presubmit.cfg",
+ ".kokoro/docs/docs.cfg",
+ ".kokoro/populate-secrets.sh",
+ ".kokoro/presubmit/common.cfg",
+ ".kokoro/presubmit/presubmit.cfg",
+ ".kokoro/publish-docs.sh",
+ ".kokoro/release.sh",
+ ".kokoro/release/common.cfg",
+ ".kokoro/release/release.cfg",
+ ".kokoro/samples/lint/common.cfg",
+ ".kokoro/samples/lint/continuous.cfg",
+ ".kokoro/samples/lint/periodic.cfg",
+ ".kokoro/samples/lint/presubmit.cfg",
+ ".kokoro/samples/python3.6/common.cfg",
+ ".kokoro/samples/python3.6/continuous.cfg",
+ ".kokoro/samples/python3.6/periodic.cfg",
+ ".kokoro/samples/python3.6/presubmit.cfg",
+ ".kokoro/samples/python3.7/common.cfg",
+ ".kokoro/samples/python3.7/continuous.cfg",
+ ".kokoro/samples/python3.7/periodic.cfg",
+ ".kokoro/samples/python3.7/presubmit.cfg",
+ ".kokoro/samples/python3.8/common.cfg",
+ ".kokoro/samples/python3.8/continuous.cfg",
+ ".kokoro/samples/python3.8/periodic.cfg",
+ ".kokoro/samples/python3.8/presubmit.cfg",
+ ".kokoro/test-samples.sh",
+ ".kokoro/trampoline.sh",
+ ".kokoro/trampoline_v2.sh",
+ ".pre-commit-config.yaml",
+ ".trampolinerc",
+ "CODE_OF_CONDUCT.md",
+ "CONTRIBUTING.rst",
+ "LICENSE",
+ "MANIFEST.in",
+ "docs/_static/custom.css",
+ "docs/_templates/layout.html",
+ "docs/conf.py",
+ "docs/data_v1alpha/alpha_analytics_data.rst",
+ "docs/data_v1alpha/services.rst",
+ "docs/data_v1alpha/types.rst",
+ "docs/multiprocessing.rst",
+ "google/analytics/data/__init__.py",
+ "google/analytics/data/py.typed",
+ "google/analytics/data_v1alpha/__init__.py",
+ "google/analytics/data_v1alpha/py.typed",
+ "google/analytics/data_v1alpha/services/__init__.py",
+ "google/analytics/data_v1alpha/services/alpha_analytics_data/__init__.py",
+ "google/analytics/data_v1alpha/services/alpha_analytics_data/async_client.py",
+ "google/analytics/data_v1alpha/services/alpha_analytics_data/client.py",
+ "google/analytics/data_v1alpha/services/alpha_analytics_data/transports/__init__.py",
+ "google/analytics/data_v1alpha/services/alpha_analytics_data/transports/base.py",
+ "google/analytics/data_v1alpha/services/alpha_analytics_data/transports/grpc.py",
+ "google/analytics/data_v1alpha/services/alpha_analytics_data/transports/grpc_asyncio.py",
+ "google/analytics/data_v1alpha/types/__init__.py",
+ "google/analytics/data_v1alpha/types/analytics_data_api.py",
+ "google/analytics/data_v1alpha/types/data.py",
+ "mypy.ini",
+ "noxfile.py",
+ "renovate.json",
+ "scripts/decrypt-secrets.sh",
+ "scripts/readme-gen/readme_gen.py",
+ "scripts/readme-gen/templates/README.tmpl.rst",
+ "scripts/readme-gen/templates/auth.tmpl.rst",
+ "scripts/readme-gen/templates/auth_api_key.tmpl.rst",
+ "scripts/readme-gen/templates/install_deps.tmpl.rst",
+ "scripts/readme-gen/templates/install_portaudio.tmpl.rst",
+ "setup.cfg",
+ "testing/.gitignore",
+ "tests/unit/gapic/data_v1alpha/__init__.py",
+ "tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.py"
]
}
\ No newline at end of file
diff --git a/tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.py b/tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.py
index 560ab56..17c8aac 100644
--- a/tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.py
+++ b/tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.py
@@ -89,8 +89,21 @@ def test__get_default_mtls_endpoint():
)
+def test_alpha_analytics_data_client_from_service_account_info():
+ creds = credentials.AnonymousCredentials()
+ with mock.patch.object(
+ service_account.Credentials, "from_service_account_info"
+ ) as factory:
+ factory.return_value = creds
+ info = {"valid": True}
+ client = AlphaAnalyticsDataClient.from_service_account_info(info)
+ assert client.transport._credentials == creds
+
+ assert client.transport._host == "analyticsdata.googleapis.com:443"
+
+
@pytest.mark.parametrize(
- "client_class", [AlphaAnalyticsDataClient, AlphaAnalyticsDataAsyncClient]
+ "client_class", [AlphaAnalyticsDataClient, AlphaAnalyticsDataAsyncClient,]
)
def test_alpha_analytics_data_client_from_service_account_file(client_class):
creds = credentials.AnonymousCredentials()
@@ -109,7 +122,10 @@ def test_alpha_analytics_data_client_from_service_account_file(client_class):
def test_alpha_analytics_data_client_get_transport_class():
transport = AlphaAnalyticsDataClient.get_transport_class()
- assert transport == transports.AlphaAnalyticsDataGrpcTransport
+ available_transports = [
+ transports.AlphaAnalyticsDataGrpcTransport,
+ ]
+ assert transport in available_transports
transport = AlphaAnalyticsDataClient.get_transport_class("grpc")
assert transport == transports.AlphaAnalyticsDataGrpcTransport
@@ -1269,7 +1285,7 @@ def test_alpha_analytics_data_host_with_port():
def test_alpha_analytics_data_grpc_transport_channel():
- channel = grpc.insecure_channel("http://localhost/")
+ channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials())
# Check that channel is used if provided.
transport = transports.AlphaAnalyticsDataGrpcTransport(
@@ -1281,7 +1297,7 @@ def test_alpha_analytics_data_grpc_transport_channel():
def test_alpha_analytics_data_grpc_asyncio_transport_channel():
- channel = aio.insecure_channel("http://localhost/")
+ channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials())
# Check that channel is used if provided.
transport = transports.AlphaAnalyticsDataGrpcAsyncIOTransport(
@@ -1306,7 +1322,7 @@ def test_alpha_analytics_data_transport_channel_mtls_with_client_cert_source(
"grpc.ssl_channel_credentials", autospec=True
) as grpc_ssl_channel_cred:
with mock.patch.object(
- transport_class, "create_channel", autospec=True
+ transport_class, "create_channel"
) as grpc_create_channel:
mock_ssl_cred = mock.Mock()
grpc_ssl_channel_cred.return_value = mock_ssl_cred
@@ -1338,6 +1354,10 @@ def test_alpha_analytics_data_transport_channel_mtls_with_client_cert_source(
),
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
)
assert transport.grpc_channel == mock_grpc_channel
assert transport._ssl_channel_credentials == mock_ssl_cred
@@ -1358,7 +1378,7 @@ def test_alpha_analytics_data_transport_channel_mtls_with_adc(transport_class):
ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
):
with mock.patch.object(
- transport_class, "create_channel", autospec=True
+ transport_class, "create_channel"
) as grpc_create_channel:
mock_grpc_channel = mock.Mock()
grpc_create_channel.return_value = mock_grpc_channel
@@ -1382,6 +1402,10 @@ def test_alpha_analytics_data_transport_channel_mtls_with_adc(transport_class):
),
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
)
assert transport.grpc_channel == mock_grpc_channel