chunkify-analytics-sdk 0.9.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. chunkify_analytics/__init__.py +102 -0
  2. chunkify_analytics/_base_client.py +2153 -0
  3. chunkify_analytics/_client.py +1262 -0
  4. chunkify_analytics/_compat.py +226 -0
  5. chunkify_analytics/_constants.py +14 -0
  6. chunkify_analytics/_exceptions.py +108 -0
  7. chunkify_analytics/_files.py +173 -0
  8. chunkify_analytics/_models.py +964 -0
  9. chunkify_analytics/_qs.py +149 -0
  10. chunkify_analytics/_resource.py +43 -0
  11. chunkify_analytics/_response.py +835 -0
  12. chunkify_analytics/_streaming.py +338 -0
  13. chunkify_analytics/_types.py +274 -0
  14. chunkify_analytics/_utils/__init__.py +64 -0
  15. chunkify_analytics/_utils/_compat.py +45 -0
  16. chunkify_analytics/_utils/_datetime_parse.py +136 -0
  17. chunkify_analytics/_utils/_json.py +35 -0
  18. chunkify_analytics/_utils/_logs.py +25 -0
  19. chunkify_analytics/_utils/_path.py +127 -0
  20. chunkify_analytics/_utils/_proxy.py +65 -0
  21. chunkify_analytics/_utils/_reflection.py +42 -0
  22. chunkify_analytics/_utils/_resources_proxy.py +24 -0
  23. chunkify_analytics/_utils/_streams.py +12 -0
  24. chunkify_analytics/_utils/_sync.py +58 -0
  25. chunkify_analytics/_utils/_transform.py +457 -0
  26. chunkify_analytics/_utils/_typing.py +156 -0
  27. chunkify_analytics/_utils/_utils.py +433 -0
  28. chunkify_analytics/_version.py +4 -0
  29. chunkify_analytics/lib/.keep +4 -0
  30. chunkify_analytics/pagination.py +221 -0
  31. chunkify_analytics/py.typed +0 -0
  32. chunkify_analytics/resources/__init__.py +243 -0
  33. chunkify_analytics/resources/admin/__init__.py +33 -0
  34. chunkify_analytics/resources/admin/admin.py +253 -0
  35. chunkify_analytics/resources/admin/keys.py +283 -0
  36. chunkify_analytics/resources/dimensions.py +436 -0
  37. chunkify_analytics/resources/engagement.py +479 -0
  38. chunkify_analytics/resources/errors.py +400 -0
  39. chunkify_analytics/resources/events.py +562 -0
  40. chunkify_analytics/resources/exports.py +584 -0
  41. chunkify_analytics/resources/health.py +159 -0
  42. chunkify_analytics/resources/playback_rates.py +391 -0
  43. chunkify_analytics/resources/project/__init__.py +33 -0
  44. chunkify_analytics/resources/project/keys.py +379 -0
  45. chunkify_analytics/resources/project/project.py +322 -0
  46. chunkify_analytics/resources/quality.py +471 -0
  47. chunkify_analytics/resources/renditions.py +391 -0
  48. chunkify_analytics/resources/retention.py +377 -0
  49. chunkify_analytics/resources/subtitles.py +389 -0
  50. chunkify_analytics/resources/summary.py +469 -0
  51. chunkify_analytics/resources/timeseries.py +399 -0
  52. chunkify_analytics/resources/videos.py +424 -0
  53. chunkify_analytics/resources/views.py +579 -0
  54. chunkify_analytics/types/__init__.py +145 -0
  55. chunkify_analytics/types/admin/__init__.py +3 -0
  56. chunkify_analytics/types/admin_create_project_params.py +25 -0
  57. chunkify_analytics/types/analytics_event.py +32 -0
  58. chunkify_analytics/types/analytics_event_param.py +30 -0
  59. chunkify_analytics/types/created_project.py +37 -0
  60. chunkify_analytics/types/created_project_key.py +34 -0
  61. chunkify_analytics/types/deleted_project.py +18 -0
  62. chunkify_analytics/types/dimension_list_values_params.py +124 -0
  63. chunkify_analytics/types/dimension_values.py +42 -0
  64. chunkify_analytics/types/engagement.py +60 -0
  65. chunkify_analytics/types/engagement_breakdown_page.py +44 -0
  66. chunkify_analytics/types/engagement_response.py +11 -0
  67. chunkify_analytics/types/engagement_retrieve_params.py +158 -0
  68. chunkify_analytics/types/engagement_timeseries.py +28 -0
  69. chunkify_analytics/types/engagement_timeseries_bucket.py +63 -0
  70. chunkify_analytics/types/error_group.py +17 -0
  71. chunkify_analytics/types/error_list_params.py +124 -0
  72. chunkify_analytics/types/error_page.py +14 -0
  73. chunkify_analytics/types/event_ingest_params.py +19 -0
  74. chunkify_analytics/types/event_ingest_response.py +11 -0
  75. chunkify_analytics/types/event_list_params.py +146 -0
  76. chunkify_analytics/types/event_page.py +18 -0
  77. chunkify_analytics/types/export.py +18 -0
  78. chunkify_analytics/types/export_columns.py +12 -0
  79. chunkify_analytics/types/export_create_params.py +40 -0
  80. chunkify_analytics/types/export_download_response.py +7 -0
  81. chunkify_analytics/types/export_list_columns_params.py +69 -0
  82. chunkify_analytics/types/export_query_param.py +141 -0
  83. chunkify_analytics/types/health.py +11 -0
  84. chunkify_analytics/types/metrics.py +13 -0
  85. chunkify_analytics/types/metrics_breakdown_page.py +40 -0
  86. chunkify_analytics/types/metrics_response.py +11 -0
  87. chunkify_analytics/types/native_created.py +13 -0
  88. chunkify_analytics/types/native_duplicate.py +13 -0
  89. chunkify_analytics/types/playback_error.py +180 -0
  90. chunkify_analytics/types/playback_error_param.py +182 -0
  91. chunkify_analytics/types/playback_rate_changed.py +150 -0
  92. chunkify_analytics/types/playback_rate_changed_param.py +152 -0
  93. chunkify_analytics/types/playback_rate_metric.py +21 -0
  94. chunkify_analytics/types/playback_rate_report.py +31 -0
  95. chunkify_analytics/types/playback_rate_retrieve_params.py +117 -0
  96. chunkify_analytics/types/playback_state_changed.py +150 -0
  97. chunkify_analytics/types/playback_state_changed_param.py +156 -0
  98. chunkify_analytics/types/project/__init__.py +6 -0
  99. chunkify_analytics/types/project/key_create_params.py +21 -0
  100. chunkify_analytics/types/project/project.py +35 -0
  101. chunkify_analytics/types/project_key.py +21 -0
  102. chunkify_analytics/types/project_keys.py +14 -0
  103. chunkify_analytics/types/project_update_params.py +25 -0
  104. chunkify_analytics/types/quality.py +117 -0
  105. chunkify_analytics/types/quality_breakdown_page.py +44 -0
  106. chunkify_analytics/types/quality_response.py +11 -0
  107. chunkify_analytics/types/quality_retrieve_params.py +158 -0
  108. chunkify_analytics/types/quality_timeseries.py +28 -0
  109. chunkify_analytics/types/quality_timeseries_bucket.py +120 -0
  110. chunkify_analytics/types/rendition_changed.py +156 -0
  111. chunkify_analytics/types/rendition_changed_param.py +158 -0
  112. chunkify_analytics/types/rendition_metric.py +40 -0
  113. chunkify_analytics/types/rendition_report.py +43 -0
  114. chunkify_analytics/types/rendition_retrieve_params.py +117 -0
  115. chunkify_analytics/types/retention_bucket.py +22 -0
  116. chunkify_analytics/types/retention_report.py +33 -0
  117. chunkify_analytics/types/retention_retrieve_params.py +110 -0
  118. chunkify_analytics/types/rotated_project_key.py +29 -0
  119. chunkify_analytics/types/seek_completed.py +166 -0
  120. chunkify_analytics/types/seek_completed_param.py +168 -0
  121. chunkify_analytics/types/shared/__init__.py +24 -0
  122. chunkify_analytics/types/shared/browser_context.py +62 -0
  123. chunkify_analytics/types/shared/custom_dimensions.py +8 -0
  124. chunkify_analytics/types/shared/event_context.py +161 -0
  125. chunkify_analytics/types/shared/event_envelope.py +152 -0
  126. chunkify_analytics/types/shared/metric_count_ratio.py +18 -0
  127. chunkify_analytics/types/shared/otlp_any_value.py +56 -0
  128. chunkify_analytics/types/shared/otlp_attribute.py +24 -0
  129. chunkify_analytics/types/shared/otlp_attribute_value.py +136 -0
  130. chunkify_analytics/types/shared/otlp_context_attribute.py +22 -0
  131. chunkify_analytics/types/shared/otlp_log_record.py +48 -0
  132. chunkify_analytics/types/shared/otlp_resource.py +20 -0
  133. chunkify_analytics/types/shared/otlp_scope.py +24 -0
  134. chunkify_analytics/types/shared/playback_rate_playing_time.py +12 -0
  135. chunkify_analytics/types/shared/playback_score.py +28 -0
  136. chunkify_analytics/types/shared/played_range.py +13 -0
  137. chunkify_analytics/types/shared/progress_reached.py +39 -0
  138. chunkify_analytics/types/shared/rendition_playing_time.py +21 -0
  139. chunkify_analytics/types/shared/startup_outcomes.py +39 -0
  140. chunkify_analytics/types/shared/stored_otlp_context.py +50 -0
  141. chunkify_analytics/types/shared/subtitle_playing_time.py +14 -0
  142. chunkify_analytics/types/shared/view_metrics.py +100 -0
  143. chunkify_analytics/types/shared/watch_time_distribution.py +41 -0
  144. chunkify_analytics/types/shared_params/__init__.py +8 -0
  145. chunkify_analytics/types/shared_params/browser_context.py +62 -0
  146. chunkify_analytics/types/shared_params/custom_dimensions.py +10 -0
  147. chunkify_analytics/types/shared_params/playback_rate_playing_time.py +14 -0
  148. chunkify_analytics/types/shared_params/played_range.py +15 -0
  149. chunkify_analytics/types/shared_params/rendition_playing_time.py +22 -0
  150. chunkify_analytics/types/shared_params/subtitle_playing_time.py +15 -0
  151. chunkify_analytics/types/stored_event.py +44 -0
  152. chunkify_analytics/types/subtitle_changed.py +150 -0
  153. chunkify_analytics/types/subtitle_changed_param.py +152 -0
  154. chunkify_analytics/types/subtitle_metric.py +26 -0
  155. chunkify_analytics/types/subtitle_report.py +31 -0
  156. chunkify_analytics/types/subtitle_retrieve_params.py +117 -0
  157. chunkify_analytics/types/summary_retrieve_params.py +158 -0
  158. chunkify_analytics/types/time_bucket.py +22 -0
  159. chunkify_analytics/types/timeseries.py +28 -0
  160. chunkify_analytics/types/timeseries_response.py +12 -0
  161. chunkify_analytics/types/timesery_retrieve_params.py +115 -0
  162. chunkify_analytics/types/video_list_params.py +140 -0
  163. chunkify_analytics/types/video_metrics.py +23 -0
  164. chunkify_analytics/types/video_page.py +14 -0
  165. chunkify_analytics/types/view.py +43 -0
  166. chunkify_analytics/types/view_detail.py +21 -0
  167. chunkify_analytics/types/view_ended.py +180 -0
  168. chunkify_analytics/types/view_ended_param.py +182 -0
  169. chunkify_analytics/types/view_list_params.py +152 -0
  170. chunkify_analytics/types/view_page.py +14 -0
  171. chunkify_analytics/types/view_retrieve_params.py +23 -0
  172. chunkify_analytics/types/view_snapshot.py +180 -0
  173. chunkify_analytics/types/view_snapshot_param.py +182 -0
  174. chunkify_analytics/types/view_started.py +192 -0
  175. chunkify_analytics/types/view_started_param.py +194 -0
  176. chunkify_analytics_sdk-0.9.0.dist-info/METADATA +487 -0
  177. chunkify_analytics_sdk-0.9.0.dist-info/RECORD +179 -0
  178. chunkify_analytics_sdk-0.9.0.dist-info/WHEEL +4 -0
  179. chunkify_analytics_sdk-0.9.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,579 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Union
6
+ from datetime import datetime
7
+ from typing_extensions import Literal
8
+
9
+ import httpx
10
+
11
+ from ..types import view_list_params, view_retrieve_params
12
+ from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
13
+ from .._utils import path_template, maybe_transform, async_maybe_transform
14
+ from .._compat import cached_property
15
+ from .._resource import SyncAPIResource, AsyncAPIResource
16
+ from .._response import (
17
+ to_raw_response_wrapper,
18
+ to_streamed_response_wrapper,
19
+ async_to_raw_response_wrapper,
20
+ async_to_streamed_response_wrapper,
21
+ )
22
+ from ..pagination import SyncViewsPage, AsyncViewsPage
23
+ from ..types.view import View
24
+ from .._base_client import AsyncPaginator, make_request_options
25
+ from ..types.view_detail import ViewDetail
26
+
27
+ __all__ = ["ViewsResource", "AsyncViewsResource"]
28
+
29
+
30
+ class ViewsResource(SyncAPIResource):
31
+ """Private retained-event and view-cohort queries."""
32
+
33
+ @cached_property
34
+ def with_raw_response(self) -> ViewsResourceWithRawResponse:
35
+ """
36
+ This property can be used as a prefix for any HTTP method call to return
37
+ the raw response object instead of the parsed content.
38
+
39
+ For more information, see https://www.github.com/chunkifydev/chunkify-analytics-python#accessing-raw-response-data-eg-headers
40
+ """
41
+ return ViewsResourceWithRawResponse(self)
42
+
43
+ @cached_property
44
+ def with_streaming_response(self) -> ViewsResourceWithStreamingResponse:
45
+ """
46
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
47
+
48
+ For more information, see https://www.github.com/chunkifydev/chunkify-analytics-python#with_streaming_response
49
+ """
50
+ return ViewsResourceWithStreamingResponse(self)
51
+
52
+ def retrieve(
53
+ self,
54
+ view_id: str,
55
+ *,
56
+ cursor: str | Omit = omit,
57
+ limit: int | Omit = omit,
58
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
59
+ # The extra values given here take precedence over values defined on the client or passed to this method.
60
+ extra_headers: Headers | None = None,
61
+ extra_query: Query | None = None,
62
+ extra_body: Body | None = None,
63
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
64
+ ) -> ViewDetail:
65
+ """
66
+ Returns start context and selected measurements, plus a paginated history of all
67
+ retained events for that view ID, in ingestion order. SDK sequence and
68
+ occurrence times remain in each event. Follow next_cursor with the same view ID;
69
+ the summary and event pages share the initial ingestion watermark. Orphaned
70
+ events without a retained start remain available through /v1/events?view_id=...
71
+ .
72
+
73
+ Args:
74
+ cursor: Use next_cursor from the previous page. Keep the same filters, sort_by and
75
+ order. Video cursors from earlier versions are invalid; start a new pagination
76
+ sequence after upgrading.
77
+
78
+ limit: Maximum rows on this page. Events and videos always support pagination; summary,
79
+ quality and engagement support it only with group_by.
80
+
81
+ extra_headers: Send extra headers
82
+
83
+ extra_query: Add additional query parameters to the request
84
+
85
+ extra_body: Add additional JSON properties to the request
86
+
87
+ timeout: Override the client-level default timeout for this request, in seconds
88
+ """
89
+ if not view_id:
90
+ raise ValueError(f"Expected a non-empty value for `view_id` but received {view_id!r}")
91
+ return self._get(
92
+ path_template("/v1/views/{view_id}", view_id=view_id),
93
+ options=make_request_options(
94
+ extra_headers=extra_headers,
95
+ extra_query=extra_query,
96
+ extra_body=extra_body,
97
+ timeout=timeout,
98
+ query=maybe_transform(
99
+ {
100
+ "cursor": cursor,
101
+ "limit": limit,
102
+ },
103
+ view_retrieve_params.ViewRetrieveParams,
104
+ ),
105
+ security={"secret_key": True},
106
+ ),
107
+ cast_to=ViewDetail,
108
+ )
109
+
110
+ def list(
111
+ self,
112
+ *,
113
+ browser_name: str | Omit = omit,
114
+ city: str | Omit = omit,
115
+ continent: Literal["AF", "AN", "AS", "EU", "NA", "OC", "SA"] | Omit = omit,
116
+ country: str | Omit = omit,
117
+ cursor: str | Omit = omit,
118
+ device_type: Literal["desktop", "mobile", "tablet", "unknown"] | Omit = omit,
119
+ from_: Union[str, datetime] | Omit = omit,
120
+ has_fatal_error: bool | Omit = omit,
121
+ limit: int | Omit = omit,
122
+ order: Literal["asc", "desc"] | Omit = omit,
123
+ os_name: str | Omit = omit,
124
+ page_origin: str | Omit = omit,
125
+ page_path: str | Omit = omit,
126
+ playback_rate: str | Omit = omit,
127
+ sort_by: Literal[
128
+ "started_at",
129
+ "video_id",
130
+ "view_id",
131
+ "device_type",
132
+ "playing_time_ms",
133
+ "startup_time_ms",
134
+ "rebuffer_duration_ms",
135
+ "playback_score",
136
+ ]
137
+ | Omit = omit,
138
+ subtitle_language: str | Omit = omit,
139
+ to: Union[str, datetime] | Omit = omit,
140
+ user_id: str | Omit = omit,
141
+ video_id: str | Omit = omit,
142
+ video_title: str | Omit = omit,
143
+ view_id: str | Omit = omit,
144
+ viewer_id: str | Omit = omit,
145
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
146
+ # The extra values given here take precedence over values defined on the client or passed to this method.
147
+ extra_headers: Headers | None = None,
148
+ extra_query: Query | None = None,
149
+ extra_body: Body | None = None,
150
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
151
+ ) -> SyncViewsPage[View]:
152
+ """
153
+ One row per first retained start, using the same final/latest measurement
154
+ selection as metrics. Filter by identity, context, dates or has_fatal_error.
155
+ Order by started_at descending by default (newest first), or ascending with
156
+ order=asc. Equal start times use view_id in the same direction. Cursors bind
157
+ filters, order, fatal-error selection, project and ingestion watermark. Missing
158
+ end or error events are not proof of an ongoing or successful playback. Sort the
159
+ entire matching cohort by sort_by before pagination, with missing values last.
160
+
161
+ Args:
162
+ browser_name: Exact browser name, such as Chrome. Missing values do not match.
163
+
164
+ city: Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
165
+ characters. Use country alongside city to distinguish places with the same name.
166
+ Missing locations do not match.
167
+
168
+ continent: Exact continent code from the local lookup. Missing locations do not match.
169
+
170
+ country: Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
171
+ do not match.
172
+
173
+ cursor: Use next_cursor from the previous page. Keep the same filters, sort_by and
174
+ order. Video cursors from earlier versions are invalid; start a new pagination
175
+ sequence after upgrading.
176
+
177
+ device_type: Exact device class. unknown matches an explicit unknown value.
178
+
179
+ from_: Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
180
+ queries apply it to the selected view_started event. Must be before to.
181
+
182
+ has_fatal_error: Select attempts with or without an observed fatal error. Absence of an observed
183
+ error does not prove successful playback.
184
+
185
+ limit: Maximum rows on this page. Events and videos always support pagination; summary,
186
+ quality and engagement support it only with group_by.
187
+
188
+ order: Sort by started_at and then view_id in this direction. Defaults to newest first.
189
+ Keep the same order with each cursor.
190
+
191
+ os_name: Exact operating-system name, such as macOS. Missing values do not match.
192
+
193
+ page_origin: Exact, case-sensitive page origin captured by the player, such as
194
+ https://example.com. Metrics use the first retained view start; raw events use
195
+ each event context. Missing values do not match.
196
+
197
+ page_path: Exact, case-sensitive page path captured by the player, such as /watch/video.
198
+ Filter by page_origin as well to distinguish identical paths on different sites.
199
+ Metrics use the first retained view start; raw events use each event context.
200
+ Missing values do not match.
201
+
202
+ playback_rate: Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
203
+ 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
204
+ start; raw events use each event's value.
205
+
206
+ sort_by: Sort all matching sessions before pagination. Missing values come last in both
207
+ directions. Ties use view_id in the requested direction. Keep sort_by, order and
208
+ filters unchanged with a cursor.
209
+
210
+ subtitle_language: Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
211
+ for a subtitles track without a language. Metrics use the language showing on
212
+ the first retained view start; raw events use each event's value. Views without
213
+ subtitles at start do not match.
214
+
215
+ to: Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
216
+ queries apply it to the selected view_started event.
217
+
218
+ user_id: Exact integrator-supplied user ID. Selects views by their start event; event
219
+ lists match each event's own value. Missing/null user IDs do not match. Reports
220
+ with this filter read one stored row per view.
221
+
222
+ video_id: Exact video ID; must not be blank. Combined with all other filters using AND.
223
+
224
+ video_title: Exact, case-sensitive video title. Selects views by the title on their first
225
+ retained start; event lists match each event's own value. Views without a title
226
+ do not match. Reports with this filter read one stored row per view.
227
+
228
+ view_id: Filter one playback attempt by view ID. Metrics use its first retained start.
229
+
230
+ viewer_id: Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
231
+ viewer IDs do not match.
232
+
233
+ extra_headers: Send extra headers
234
+
235
+ extra_query: Add additional query parameters to the request
236
+
237
+ extra_body: Add additional JSON properties to the request
238
+
239
+ timeout: Override the client-level default timeout for this request, in seconds
240
+ """
241
+ return self._get_api_list(
242
+ "/v1/views",
243
+ page=SyncViewsPage[View],
244
+ options=make_request_options(
245
+ extra_headers=extra_headers,
246
+ extra_query=extra_query,
247
+ extra_body=extra_body,
248
+ timeout=timeout,
249
+ query=maybe_transform(
250
+ {
251
+ "browser_name": browser_name,
252
+ "city": city,
253
+ "continent": continent,
254
+ "country": country,
255
+ "cursor": cursor,
256
+ "device_type": device_type,
257
+ "from_": from_,
258
+ "has_fatal_error": has_fatal_error,
259
+ "limit": limit,
260
+ "order": order,
261
+ "os_name": os_name,
262
+ "page_origin": page_origin,
263
+ "page_path": page_path,
264
+ "playback_rate": playback_rate,
265
+ "sort_by": sort_by,
266
+ "subtitle_language": subtitle_language,
267
+ "to": to,
268
+ "user_id": user_id,
269
+ "video_id": video_id,
270
+ "video_title": video_title,
271
+ "view_id": view_id,
272
+ "viewer_id": viewer_id,
273
+ },
274
+ view_list_params.ViewListParams,
275
+ ),
276
+ security={"secret_key": True},
277
+ ),
278
+ model=View,
279
+ )
280
+
281
+
282
+ class AsyncViewsResource(AsyncAPIResource):
283
+ """Private retained-event and view-cohort queries."""
284
+
285
+ @cached_property
286
+ def with_raw_response(self) -> AsyncViewsResourceWithRawResponse:
287
+ """
288
+ This property can be used as a prefix for any HTTP method call to return
289
+ the raw response object instead of the parsed content.
290
+
291
+ For more information, see https://www.github.com/chunkifydev/chunkify-analytics-python#accessing-raw-response-data-eg-headers
292
+ """
293
+ return AsyncViewsResourceWithRawResponse(self)
294
+
295
+ @cached_property
296
+ def with_streaming_response(self) -> AsyncViewsResourceWithStreamingResponse:
297
+ """
298
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
299
+
300
+ For more information, see https://www.github.com/chunkifydev/chunkify-analytics-python#with_streaming_response
301
+ """
302
+ return AsyncViewsResourceWithStreamingResponse(self)
303
+
304
+ async def retrieve(
305
+ self,
306
+ view_id: str,
307
+ *,
308
+ cursor: str | Omit = omit,
309
+ limit: int | Omit = omit,
310
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
311
+ # The extra values given here take precedence over values defined on the client or passed to this method.
312
+ extra_headers: Headers | None = None,
313
+ extra_query: Query | None = None,
314
+ extra_body: Body | None = None,
315
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
316
+ ) -> ViewDetail:
317
+ """
318
+ Returns start context and selected measurements, plus a paginated history of all
319
+ retained events for that view ID, in ingestion order. SDK sequence and
320
+ occurrence times remain in each event. Follow next_cursor with the same view ID;
321
+ the summary and event pages share the initial ingestion watermark. Orphaned
322
+ events without a retained start remain available through /v1/events?view_id=...
323
+ .
324
+
325
+ Args:
326
+ cursor: Use next_cursor from the previous page. Keep the same filters, sort_by and
327
+ order. Video cursors from earlier versions are invalid; start a new pagination
328
+ sequence after upgrading.
329
+
330
+ limit: Maximum rows on this page. Events and videos always support pagination; summary,
331
+ quality and engagement support it only with group_by.
332
+
333
+ extra_headers: Send extra headers
334
+
335
+ extra_query: Add additional query parameters to the request
336
+
337
+ extra_body: Add additional JSON properties to the request
338
+
339
+ timeout: Override the client-level default timeout for this request, in seconds
340
+ """
341
+ if not view_id:
342
+ raise ValueError(f"Expected a non-empty value for `view_id` but received {view_id!r}")
343
+ return await self._get(
344
+ path_template("/v1/views/{view_id}", view_id=view_id),
345
+ options=make_request_options(
346
+ extra_headers=extra_headers,
347
+ extra_query=extra_query,
348
+ extra_body=extra_body,
349
+ timeout=timeout,
350
+ query=await async_maybe_transform(
351
+ {
352
+ "cursor": cursor,
353
+ "limit": limit,
354
+ },
355
+ view_retrieve_params.ViewRetrieveParams,
356
+ ),
357
+ security={"secret_key": True},
358
+ ),
359
+ cast_to=ViewDetail,
360
+ )
361
+
362
+ def list(
363
+ self,
364
+ *,
365
+ browser_name: str | Omit = omit,
366
+ city: str | Omit = omit,
367
+ continent: Literal["AF", "AN", "AS", "EU", "NA", "OC", "SA"] | Omit = omit,
368
+ country: str | Omit = omit,
369
+ cursor: str | Omit = omit,
370
+ device_type: Literal["desktop", "mobile", "tablet", "unknown"] | Omit = omit,
371
+ from_: Union[str, datetime] | Omit = omit,
372
+ has_fatal_error: bool | Omit = omit,
373
+ limit: int | Omit = omit,
374
+ order: Literal["asc", "desc"] | Omit = omit,
375
+ os_name: str | Omit = omit,
376
+ page_origin: str | Omit = omit,
377
+ page_path: str | Omit = omit,
378
+ playback_rate: str | Omit = omit,
379
+ sort_by: Literal[
380
+ "started_at",
381
+ "video_id",
382
+ "view_id",
383
+ "device_type",
384
+ "playing_time_ms",
385
+ "startup_time_ms",
386
+ "rebuffer_duration_ms",
387
+ "playback_score",
388
+ ]
389
+ | Omit = omit,
390
+ subtitle_language: str | Omit = omit,
391
+ to: Union[str, datetime] | Omit = omit,
392
+ user_id: str | Omit = omit,
393
+ video_id: str | Omit = omit,
394
+ video_title: str | Omit = omit,
395
+ view_id: str | Omit = omit,
396
+ viewer_id: str | Omit = omit,
397
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
398
+ # The extra values given here take precedence over values defined on the client or passed to this method.
399
+ extra_headers: Headers | None = None,
400
+ extra_query: Query | None = None,
401
+ extra_body: Body | None = None,
402
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
403
+ ) -> AsyncPaginator[View, AsyncViewsPage[View]]:
404
+ """
405
+ One row per first retained start, using the same final/latest measurement
406
+ selection as metrics. Filter by identity, context, dates or has_fatal_error.
407
+ Order by started_at descending by default (newest first), or ascending with
408
+ order=asc. Equal start times use view_id in the same direction. Cursors bind
409
+ filters, order, fatal-error selection, project and ingestion watermark. Missing
410
+ end or error events are not proof of an ongoing or successful playback. Sort the
411
+ entire matching cohort by sort_by before pagination, with missing values last.
412
+
413
+ Args:
414
+ browser_name: Exact browser name, such as Chrome. Missing values do not match.
415
+
416
+ city: Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
417
+ characters. Use country alongside city to distinguish places with the same name.
418
+ Missing locations do not match.
419
+
420
+ continent: Exact continent code from the local lookup. Missing locations do not match.
421
+
422
+ country: Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
423
+ do not match.
424
+
425
+ cursor: Use next_cursor from the previous page. Keep the same filters, sort_by and
426
+ order. Video cursors from earlier versions are invalid; start a new pagination
427
+ sequence after upgrading.
428
+
429
+ device_type: Exact device class. unknown matches an explicit unknown value.
430
+
431
+ from_: Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
432
+ queries apply it to the selected view_started event. Must be before to.
433
+
434
+ has_fatal_error: Select attempts with or without an observed fatal error. Absence of an observed
435
+ error does not prove successful playback.
436
+
437
+ limit: Maximum rows on this page. Events and videos always support pagination; summary,
438
+ quality and engagement support it only with group_by.
439
+
440
+ order: Sort by started_at and then view_id in this direction. Defaults to newest first.
441
+ Keep the same order with each cursor.
442
+
443
+ os_name: Exact operating-system name, such as macOS. Missing values do not match.
444
+
445
+ page_origin: Exact, case-sensitive page origin captured by the player, such as
446
+ https://example.com. Metrics use the first retained view start; raw events use
447
+ each event context. Missing values do not match.
448
+
449
+ page_path: Exact, case-sensitive page path captured by the player, such as /watch/video.
450
+ Filter by page_origin as well to distinguish identical paths on different sites.
451
+ Metrics use the first retained view start; raw events use each event context.
452
+ Missing values do not match.
453
+
454
+ playback_rate: Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
455
+ 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
456
+ start; raw events use each event's value.
457
+
458
+ sort_by: Sort all matching sessions before pagination. Missing values come last in both
459
+ directions. Ties use view_id in the requested direction. Keep sort_by, order and
460
+ filters unchanged with a cursor.
461
+
462
+ subtitle_language: Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
463
+ for a subtitles track without a language. Metrics use the language showing on
464
+ the first retained view start; raw events use each event's value. Views without
465
+ subtitles at start do not match.
466
+
467
+ to: Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
468
+ queries apply it to the selected view_started event.
469
+
470
+ user_id: Exact integrator-supplied user ID. Selects views by their start event; event
471
+ lists match each event's own value. Missing/null user IDs do not match. Reports
472
+ with this filter read one stored row per view.
473
+
474
+ video_id: Exact video ID; must not be blank. Combined with all other filters using AND.
475
+
476
+ video_title: Exact, case-sensitive video title. Selects views by the title on their first
477
+ retained start; event lists match each event's own value. Views without a title
478
+ do not match. Reports with this filter read one stored row per view.
479
+
480
+ view_id: Filter one playback attempt by view ID. Metrics use its first retained start.
481
+
482
+ viewer_id: Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
483
+ viewer IDs do not match.
484
+
485
+ extra_headers: Send extra headers
486
+
487
+ extra_query: Add additional query parameters to the request
488
+
489
+ extra_body: Add additional JSON properties to the request
490
+
491
+ timeout: Override the client-level default timeout for this request, in seconds
492
+ """
493
+ return self._get_api_list(
494
+ "/v1/views",
495
+ page=AsyncViewsPage[View],
496
+ options=make_request_options(
497
+ extra_headers=extra_headers,
498
+ extra_query=extra_query,
499
+ extra_body=extra_body,
500
+ timeout=timeout,
501
+ query=maybe_transform(
502
+ {
503
+ "browser_name": browser_name,
504
+ "city": city,
505
+ "continent": continent,
506
+ "country": country,
507
+ "cursor": cursor,
508
+ "device_type": device_type,
509
+ "from_": from_,
510
+ "has_fatal_error": has_fatal_error,
511
+ "limit": limit,
512
+ "order": order,
513
+ "os_name": os_name,
514
+ "page_origin": page_origin,
515
+ "page_path": page_path,
516
+ "playback_rate": playback_rate,
517
+ "sort_by": sort_by,
518
+ "subtitle_language": subtitle_language,
519
+ "to": to,
520
+ "user_id": user_id,
521
+ "video_id": video_id,
522
+ "video_title": video_title,
523
+ "view_id": view_id,
524
+ "viewer_id": viewer_id,
525
+ },
526
+ view_list_params.ViewListParams,
527
+ ),
528
+ security={"secret_key": True},
529
+ ),
530
+ model=View,
531
+ )
532
+
533
+
534
+ class ViewsResourceWithRawResponse:
535
+ def __init__(self, views: ViewsResource) -> None:
536
+ self._views = views
537
+
538
+ self.retrieve = to_raw_response_wrapper(
539
+ views.retrieve,
540
+ )
541
+ self.list = to_raw_response_wrapper(
542
+ views.list,
543
+ )
544
+
545
+
546
+ class AsyncViewsResourceWithRawResponse:
547
+ def __init__(self, views: AsyncViewsResource) -> None:
548
+ self._views = views
549
+
550
+ self.retrieve = async_to_raw_response_wrapper(
551
+ views.retrieve,
552
+ )
553
+ self.list = async_to_raw_response_wrapper(
554
+ views.list,
555
+ )
556
+
557
+
558
+ class ViewsResourceWithStreamingResponse:
559
+ def __init__(self, views: ViewsResource) -> None:
560
+ self._views = views
561
+
562
+ self.retrieve = to_streamed_response_wrapper(
563
+ views.retrieve,
564
+ )
565
+ self.list = to_streamed_response_wrapper(
566
+ views.list,
567
+ )
568
+
569
+
570
+ class AsyncViewsResourceWithStreamingResponse:
571
+ def __init__(self, views: AsyncViewsResource) -> None:
572
+ self._views = views
573
+
574
+ self.retrieve = async_to_streamed_response_wrapper(
575
+ views.retrieve,
576
+ )
577
+ self.list = async_to_streamed_response_wrapper(
578
+ views.list,
579
+ )