Skip to content
This repository has been archived by the owner on Nov 9, 2024. It is now read-only.

feat: add minute_ranges field to RunRealtimeReportRequest object #101

Merged
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
2 changes: 2 additions & 0 deletions google/analytics/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
from google.analytics.data_v1beta.types.data import MetricHeader
from google.analytics.data_v1beta.types.data import MetricMetadata
from google.analytics.data_v1beta.types.data import MetricValue
from google.analytics.data_v1beta.types.data import MinuteRange
from google.analytics.data_v1beta.types.data import NumericValue
from google.analytics.data_v1beta.types.data import OrderBy
from google.analytics.data_v1beta.types.data import Pivot
Expand Down Expand Up @@ -104,6 +105,7 @@
"MetricHeader",
"MetricMetadata",
"MetricValue",
"MinuteRange",
"NumericValue",
"OrderBy",
"Pivot",
Expand Down
2 changes: 2 additions & 0 deletions google/analytics/data_v1beta/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from .types.data import MetricHeader
from .types.data import MetricMetadata
from .types.data import MetricValue
from .types.data import MinuteRange
from .types.data import NumericValue
from .types.data import OrderBy
from .types.data import Pivot
Expand Down Expand Up @@ -86,6 +87,7 @@
"MetricMetadata",
"MetricType",
"MetricValue",
"MinuteRange",
"NumericValue",
"OrderBy",
"Pivot",
Expand Down
2 changes: 2 additions & 0 deletions google/analytics/data_v1beta/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
MetricHeader,
MetricMetadata,
MetricValue,
MinuteRange,
NumericValue,
OrderBy,
Pivot,
Expand Down Expand Up @@ -88,6 +89,7 @@
"MetricHeader",
"MetricMetadata",
"MetricValue",
"MinuteRange",
"NumericValue",
"OrderBy",
"Pivot",
Expand Down
12 changes: 12 additions & 0 deletions google/analytics/data_v1beta/types/analytics_data_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,15 @@ class RunRealtimeReportRequest(proto.Message):
Toggles whether to return the current state of this
Analytics Property's Realtime quota. Quota is returned in
`PropertyQuota <#PropertyQuota>`__.
minute_ranges (Sequence[google.analytics.data_v1beta.types.MinuteRange]):
The minute ranges of event data to read. If
unspecified, one minute range for the last 30
minutes will be used. If multiple minute ranges
are requested, each response row will contain a
zero based minute range index. If two minute
ranges overlap, the event data for the
overlapping minutes is included in the response
rows for both minute ranges.
"""

property = proto.Field(proto.STRING, number=1,)
Expand All @@ -562,6 +571,9 @@ class RunRealtimeReportRequest(proto.Message):
)
order_bys = proto.RepeatedField(proto.MESSAGE, number=8, message=data.OrderBy,)
return_property_quota = proto.Field(proto.BOOL, number=9,)
minute_ranges = proto.RepeatedField(
proto.MESSAGE, number=10, message=data.MinuteRange,
)


class RunRealtimeReportResponse(proto.Message):
Expand Down
45 changes: 44 additions & 1 deletion google/analytics/data_v1beta/types/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"MetricAggregation",
"MetricType",
"DateRange",
"MinuteRange",
"Dimension",
"DimensionExpression",
"Metric",
Expand Down Expand Up @@ -107,12 +108,54 @@ class DateRange(proto.Message):
name = proto.Field(proto.STRING, number=3,)


class MinuteRange(proto.Message):
r"""A contiguous set of minutes: startMinutesAgo, startMinutesAgo
+ 1, ..., endMinutesAgo. Requests are allowed up to 2 minute
ranges.

Attributes:
start_minutes_ago (int):
The inclusive start minute for the query as a number of
minutes before now. For example, ``"startMinutesAgo": 29``
specifies the report should include event data from 29
minutes ago and after. Cannot be after ``endMinutesAgo``.

If unspecified, ``startMinutesAgo`` is defaulted to 29.
Standard Analytics properties can request up to the last 30
minutes of event data (``startMinutesAgo <= 29``), and 360
Analytics properties can request up to the last 60 minutes
of event data (``startMinutesAgo <= 59``).
end_minutes_ago (int):
The inclusive end minute for the query as a number of
minutes before now. Cannot be before ``startMinutesAgo``.
For example, ``"endMinutesAgo": 15`` specifies the report
should include event data from prior to 15 minutes ago.

If unspecified, ``endMinutesAgo`` is defaulted to 0.
Standard Analytics properties can request any minute in the
last 30 minutes of event data (``endMinutesAgo <= 29``), and
360 Analytics properties can request any minute in the last
60 minutes of event data (``endMinutesAgo <= 59``).
name (str):
Assigns a name to this minute range. The dimension
``dateRange`` is valued to this name in a report response.
If set, cannot begin with ``date_range_`` or ``RESERVED_``.
If not set, minute ranges are named by their zero based
index in the request: ``date_range_0``, ``date_range_1``,
etc.
"""

start_minutes_ago = proto.Field(proto.INT32, number=1, optional=True,)
end_minutes_ago = proto.Field(proto.INT32, number=2, optional=True,)
name = proto.Field(proto.STRING, number=3,)


class Dimension(proto.Message):
r"""Dimensions are attributes of your data. For example, the
dimension city indicates the city from which an event
originates. Dimension values in report responses are strings;
for example, city could be "Paris" or "New York". Requests are
allowed up to 8 dimensions.
allowed up to 9 dimensions.

Attributes:
name (str):
Expand Down