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,1262 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ from typing import TYPE_CHECKING, Any, Mapping
7
+ from typing_extensions import Self, override
8
+
9
+ import httpx
10
+
11
+ from . import _exceptions
12
+ from ._qs import Querystring
13
+ from ._types import (
14
+ Omit,
15
+ Timeout,
16
+ NotGiven,
17
+ Transport,
18
+ ProxiesTypes,
19
+ RequestOptions,
20
+ not_given,
21
+ )
22
+ from ._utils import (
23
+ is_given,
24
+ is_mapping_t,
25
+ get_async_library,
26
+ )
27
+ from ._compat import cached_property
28
+ from ._models import SecurityOptions
29
+ from ._version import __version__
30
+ from ._streaming import Stream as Stream, AsyncStream as AsyncStream
31
+ from ._exceptions import APIStatusError
32
+ from ._base_client import (
33
+ DEFAULT_MAX_RETRIES,
34
+ SyncAPIClient,
35
+ AsyncAPIClient,
36
+ )
37
+
38
+ if TYPE_CHECKING:
39
+ from .resources import (
40
+ admin,
41
+ views,
42
+ errors,
43
+ events,
44
+ health,
45
+ videos,
46
+ exports,
47
+ project,
48
+ quality,
49
+ summary,
50
+ retention,
51
+ subtitles,
52
+ dimensions,
53
+ engagement,
54
+ renditions,
55
+ timeseries,
56
+ playback_rates,
57
+ )
58
+ from .resources.views import ViewsResource, AsyncViewsResource
59
+ from .resources.errors import ErrorsResource, AsyncErrorsResource
60
+ from .resources.events import EventsResource, AsyncEventsResource
61
+ from .resources.health import HealthResource, AsyncHealthResource
62
+ from .resources.videos import VideosResource, AsyncVideosResource
63
+ from .resources.exports import ExportsResource, AsyncExportsResource
64
+ from .resources.quality import QualityResource, AsyncQualityResource
65
+ from .resources.summary import SummaryResource, AsyncSummaryResource
66
+ from .resources.retention import RetentionResource, AsyncRetentionResource
67
+ from .resources.subtitles import SubtitlesResource, AsyncSubtitlesResource
68
+ from .resources.dimensions import DimensionsResource, AsyncDimensionsResource
69
+ from .resources.engagement import EngagementResource, AsyncEngagementResource
70
+ from .resources.renditions import RenditionsResource, AsyncRenditionsResource
71
+ from .resources.timeseries import TimeseriesResource, AsyncTimeseriesResource
72
+ from .resources.admin.admin import AdminResource, AsyncAdminResource
73
+ from .resources.playback_rates import PlaybackRatesResource, AsyncPlaybackRatesResource
74
+ from .resources.project.project import ProjectResource, AsyncProjectResource
75
+
76
+ __all__ = [
77
+ "Timeout",
78
+ "Transport",
79
+ "ProxiesTypes",
80
+ "RequestOptions",
81
+ "ChunkifyAnalytics",
82
+ "AsyncChunkifyAnalytics",
83
+ "Client",
84
+ "AsyncClient",
85
+ ]
86
+
87
+
88
+ class ChunkifyAnalytics(SyncAPIClient):
89
+ # client options
90
+ public_key: str | None
91
+ secret_key: str | None
92
+ admin_key: str | None
93
+
94
+ def __init__(
95
+ self,
96
+ *,
97
+ public_key: str | None = None,
98
+ secret_key: str | None = None,
99
+ admin_key: str | None = None,
100
+ base_url: str | httpx.URL | None = None,
101
+ timeout: float | Timeout | None | NotGiven = not_given,
102
+ max_retries: int = DEFAULT_MAX_RETRIES,
103
+ default_headers: Mapping[str, str] | None = None,
104
+ default_query: Mapping[str, object] | None = None,
105
+ # Configure a custom httpx client.
106
+ # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
107
+ # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details.
108
+ http_client: httpx.Client | None = None,
109
+ # Enable or disable schema validation for data returned by the API.
110
+ # When enabled an error APIResponseValidationError is raised
111
+ # if the API responds with invalid data for the expected schema.
112
+ #
113
+ # This parameter may be removed or changed in the future.
114
+ # If you rely on this feature, please open a GitHub issue
115
+ # outlining your use-case to help us decide if it should be
116
+ # part of our public interface in the future.
117
+ _strict_response_validation: bool = False,
118
+ ) -> None:
119
+ """Construct a new synchronous ChunkifyAnalytics client instance.
120
+
121
+ This automatically infers the following arguments from their corresponding environment variables if they are not provided:
122
+ - `public_key` from `CHUNKIFY_ANALYTICS_PUBLIC_KEY`
123
+ - `secret_key` from `CHUNKIFY_ANALYTICS_SECRET_KEY`
124
+ - `admin_key` from `CHUNKIFY_ANALYTICS_ADMIN_KEY`
125
+ """
126
+ if public_key is None:
127
+ public_key = os.environ.get("CHUNKIFY_ANALYTICS_PUBLIC_KEY")
128
+ self.public_key = public_key
129
+
130
+ if secret_key is None:
131
+ secret_key = os.environ.get("CHUNKIFY_ANALYTICS_SECRET_KEY")
132
+ self.secret_key = secret_key
133
+
134
+ if admin_key is None:
135
+ admin_key = os.environ.get("CHUNKIFY_ANALYTICS_ADMIN_KEY")
136
+ self.admin_key = admin_key
137
+
138
+ if base_url is None:
139
+ base_url = os.environ.get("CHUNKIFY_ANALYTICS_BASE_URL")
140
+ if base_url is None:
141
+ base_url = f"https://analytics.chunkify.dev"
142
+
143
+ custom_headers_env = os.environ.get("CHUNKIFY_ANALYTICS_CUSTOM_HEADERS")
144
+ if custom_headers_env is not None:
145
+ parsed: dict[str, str] = {}
146
+ for line in custom_headers_env.split("\n"):
147
+ colon = line.find(":")
148
+ if colon >= 0:
149
+ parsed[line[:colon].strip()] = line[colon + 1 :].strip()
150
+ default_headers = {**parsed, **(default_headers if is_mapping_t(default_headers) else {})}
151
+
152
+ super().__init__(
153
+ version=__version__,
154
+ base_url=base_url,
155
+ max_retries=max_retries,
156
+ timeout=timeout,
157
+ http_client=http_client,
158
+ custom_headers=default_headers,
159
+ custom_query=default_query,
160
+ _strict_response_validation=_strict_response_validation,
161
+ )
162
+
163
+ @cached_property
164
+ def health(self) -> HealthResource:
165
+ """Health and private ingestion status."""
166
+ from .resources.health import HealthResource
167
+
168
+ return HealthResource(self)
169
+
170
+ @cached_property
171
+ def events(self) -> EventsResource:
172
+ from .resources.events import EventsResource
173
+
174
+ return EventsResource(self)
175
+
176
+ @cached_property
177
+ def summary(self) -> SummaryResource:
178
+ """Private retained-event and view-cohort queries."""
179
+ from .resources.summary import SummaryResource
180
+
181
+ return SummaryResource(self)
182
+
183
+ @cached_property
184
+ def videos(self) -> VideosResource:
185
+ """Private retained-event and view-cohort queries."""
186
+ from .resources.videos import VideosResource
187
+
188
+ return VideosResource(self)
189
+
190
+ @cached_property
191
+ def timeseries(self) -> TimeseriesResource:
192
+ """Private retained-event and view-cohort queries."""
193
+ from .resources.timeseries import TimeseriesResource
194
+
195
+ return TimeseriesResource(self)
196
+
197
+ @cached_property
198
+ def quality(self) -> QualityResource:
199
+ """Private retained-event and view-cohort queries."""
200
+ from .resources.quality import QualityResource
201
+
202
+ return QualityResource(self)
203
+
204
+ @cached_property
205
+ def engagement(self) -> EngagementResource:
206
+ """Private retained-event and view-cohort queries."""
207
+ from .resources.engagement import EngagementResource
208
+
209
+ return EngagementResource(self)
210
+
211
+ @cached_property
212
+ def project(self) -> ProjectResource:
213
+ """Project origins and keys."""
214
+ from .resources.project import ProjectResource
215
+
216
+ return ProjectResource(self)
217
+
218
+ @cached_property
219
+ def admin(self) -> AdminResource:
220
+ """Project origins and keys."""
221
+ from .resources.admin import AdminResource
222
+
223
+ return AdminResource(self)
224
+
225
+ @cached_property
226
+ def views(self) -> ViewsResource:
227
+ """Private retained-event and view-cohort queries."""
228
+ from .resources.views import ViewsResource
229
+
230
+ return ViewsResource(self)
231
+
232
+ @cached_property
233
+ def errors(self) -> ErrorsResource:
234
+ """Private retained-event and view-cohort queries."""
235
+ from .resources.errors import ErrorsResource
236
+
237
+ return ErrorsResource(self)
238
+
239
+ @cached_property
240
+ def dimensions(self) -> DimensionsResource:
241
+ """Private retained-event and view-cohort queries."""
242
+ from .resources.dimensions import DimensionsResource
243
+
244
+ return DimensionsResource(self)
245
+
246
+ @cached_property
247
+ def exports(self) -> ExportsResource:
248
+ from .resources.exports import ExportsResource
249
+
250
+ return ExportsResource(self)
251
+
252
+ @cached_property
253
+ def retention(self) -> RetentionResource:
254
+ """Private retained-event and view-cohort queries."""
255
+ from .resources.retention import RetentionResource
256
+
257
+ return RetentionResource(self)
258
+
259
+ @cached_property
260
+ def renditions(self) -> RenditionsResource:
261
+ """Private retained-event and view-cohort queries."""
262
+ from .resources.renditions import RenditionsResource
263
+
264
+ return RenditionsResource(self)
265
+
266
+ @cached_property
267
+ def subtitles(self) -> SubtitlesResource:
268
+ """Private retained-event and view-cohort queries."""
269
+ from .resources.subtitles import SubtitlesResource
270
+
271
+ return SubtitlesResource(self)
272
+
273
+ @cached_property
274
+ def playback_rates(self) -> PlaybackRatesResource:
275
+ """Private retained-event and view-cohort queries."""
276
+ from .resources.playback_rates import PlaybackRatesResource
277
+
278
+ return PlaybackRatesResource(self)
279
+
280
+ @cached_property
281
+ def with_raw_response(self) -> ChunkifyAnalyticsWithRawResponse:
282
+ return ChunkifyAnalyticsWithRawResponse(self)
283
+
284
+ @cached_property
285
+ def with_streaming_response(self) -> ChunkifyAnalyticsWithStreamedResponse:
286
+ return ChunkifyAnalyticsWithStreamedResponse(self)
287
+
288
+ @property
289
+ @override
290
+ def qs(self) -> Querystring:
291
+ return Querystring(array_format="repeat")
292
+
293
+ @override
294
+ def _auth_headers(self, security: SecurityOptions) -> dict[str, str]:
295
+ headers: dict[str, str] = {}
296
+ if security.get("public_key", False):
297
+ for key, value in self._public_key.items():
298
+ headers.setdefault(key, value)
299
+ if security.get("secret_key", False):
300
+ for key, value in self._secret_key.items():
301
+ headers.setdefault(key, value)
302
+ if security.get("admin_key", False):
303
+ for key, value in self._admin_key.items():
304
+ headers.setdefault(key, value)
305
+ return headers
306
+
307
+ @property
308
+ def _public_key(self) -> dict[str, str]:
309
+ public_key = self.public_key
310
+ if public_key is None:
311
+ return {}
312
+ return {"X-Chunkify-Ingest-Key": public_key}
313
+
314
+ @property
315
+ def _secret_key(self) -> dict[str, str]:
316
+ secret_key = self.secret_key
317
+ if secret_key is None:
318
+ return {}
319
+ return {"Authorization": f"Bearer {secret_key}"}
320
+
321
+ @property
322
+ def _admin_key(self) -> dict[str, str]:
323
+ admin_key = self.admin_key
324
+ if admin_key is None:
325
+ return {}
326
+ return {"Authorization": f"Bearer {admin_key}"}
327
+
328
+ @property
329
+ @override
330
+ def default_headers(self) -> dict[str, str | Omit]:
331
+ return {
332
+ **super().default_headers,
333
+ "X-Stainless-Async": "false",
334
+ **self._custom_headers,
335
+ }
336
+
337
+ def copy(
338
+ self,
339
+ *,
340
+ public_key: str | None = None,
341
+ secret_key: str | None = None,
342
+ admin_key: str | None = None,
343
+ base_url: str | httpx.URL | None = None,
344
+ timeout: float | Timeout | None | NotGiven = not_given,
345
+ http_client: httpx.Client | None = None,
346
+ max_retries: int | NotGiven = not_given,
347
+ default_headers: Mapping[str, str] | None = None,
348
+ set_default_headers: Mapping[str, str] | None = None,
349
+ default_query: Mapping[str, object] | None = None,
350
+ set_default_query: Mapping[str, object] | None = None,
351
+ _extra_kwargs: Mapping[str, Any] = {},
352
+ ) -> Self:
353
+ """
354
+ Create a new client instance re-using the same options given to the current client with optional overriding.
355
+ """
356
+ if default_headers is not None and set_default_headers is not None:
357
+ raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive")
358
+
359
+ if default_query is not None and set_default_query is not None:
360
+ raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive")
361
+
362
+ headers = self._custom_headers
363
+ if default_headers is not None:
364
+ headers = {**headers, **default_headers}
365
+ elif set_default_headers is not None:
366
+ headers = set_default_headers
367
+
368
+ params = self._custom_query
369
+ if default_query is not None:
370
+ params = {**params, **default_query}
371
+ elif set_default_query is not None:
372
+ params = set_default_query
373
+
374
+ http_client = http_client or self._client
375
+ return self.__class__(
376
+ public_key=public_key or self.public_key,
377
+ secret_key=secret_key or self.secret_key,
378
+ admin_key=admin_key or self.admin_key,
379
+ base_url=base_url or self.base_url,
380
+ timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
381
+ http_client=http_client,
382
+ max_retries=max_retries if is_given(max_retries) else self.max_retries,
383
+ default_headers=headers,
384
+ default_query=params,
385
+ **_extra_kwargs,
386
+ )
387
+
388
+ # Alias for `copy` for nicer inline usage, e.g.
389
+ # client.with_options(timeout=10).foo.create(...)
390
+ with_options = copy
391
+
392
+ @override
393
+ def _make_status_error(
394
+ self,
395
+ err_msg: str,
396
+ *,
397
+ body: object,
398
+ response: httpx.Response,
399
+ ) -> APIStatusError:
400
+ if response.status_code == 400:
401
+ return _exceptions.BadRequestError(err_msg, response=response, body=body)
402
+
403
+ if response.status_code == 401:
404
+ return _exceptions.AuthenticationError(err_msg, response=response, body=body)
405
+
406
+ if response.status_code == 403:
407
+ return _exceptions.PermissionDeniedError(err_msg, response=response, body=body)
408
+
409
+ if response.status_code == 404:
410
+ return _exceptions.NotFoundError(err_msg, response=response, body=body)
411
+
412
+ if response.status_code == 409:
413
+ return _exceptions.ConflictError(err_msg, response=response, body=body)
414
+
415
+ if response.status_code == 422:
416
+ return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body)
417
+
418
+ if response.status_code == 429:
419
+ return _exceptions.RateLimitError(err_msg, response=response, body=body)
420
+
421
+ if response.status_code >= 500:
422
+ return _exceptions.InternalServerError(err_msg, response=response, body=body)
423
+ return APIStatusError(err_msg, response=response, body=body)
424
+
425
+
426
+ class AsyncChunkifyAnalytics(AsyncAPIClient):
427
+ # client options
428
+ public_key: str | None
429
+ secret_key: str | None
430
+ admin_key: str | None
431
+
432
+ def __init__(
433
+ self,
434
+ *,
435
+ public_key: str | None = None,
436
+ secret_key: str | None = None,
437
+ admin_key: str | None = None,
438
+ base_url: str | httpx.URL | None = None,
439
+ timeout: float | Timeout | None | NotGiven = not_given,
440
+ max_retries: int = DEFAULT_MAX_RETRIES,
441
+ default_headers: Mapping[str, str] | None = None,
442
+ default_query: Mapping[str, object] | None = None,
443
+ # Configure a custom httpx client.
444
+ # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
445
+ # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details.
446
+ http_client: httpx.AsyncClient | None = None,
447
+ # Enable or disable schema validation for data returned by the API.
448
+ # When enabled an error APIResponseValidationError is raised
449
+ # if the API responds with invalid data for the expected schema.
450
+ #
451
+ # This parameter may be removed or changed in the future.
452
+ # If you rely on this feature, please open a GitHub issue
453
+ # outlining your use-case to help us decide if it should be
454
+ # part of our public interface in the future.
455
+ _strict_response_validation: bool = False,
456
+ ) -> None:
457
+ """Construct a new async AsyncChunkifyAnalytics client instance.
458
+
459
+ This automatically infers the following arguments from their corresponding environment variables if they are not provided:
460
+ - `public_key` from `CHUNKIFY_ANALYTICS_PUBLIC_KEY`
461
+ - `secret_key` from `CHUNKIFY_ANALYTICS_SECRET_KEY`
462
+ - `admin_key` from `CHUNKIFY_ANALYTICS_ADMIN_KEY`
463
+ """
464
+ if public_key is None:
465
+ public_key = os.environ.get("CHUNKIFY_ANALYTICS_PUBLIC_KEY")
466
+ self.public_key = public_key
467
+
468
+ if secret_key is None:
469
+ secret_key = os.environ.get("CHUNKIFY_ANALYTICS_SECRET_KEY")
470
+ self.secret_key = secret_key
471
+
472
+ if admin_key is None:
473
+ admin_key = os.environ.get("CHUNKIFY_ANALYTICS_ADMIN_KEY")
474
+ self.admin_key = admin_key
475
+
476
+ if base_url is None:
477
+ base_url = os.environ.get("CHUNKIFY_ANALYTICS_BASE_URL")
478
+ if base_url is None:
479
+ base_url = f"https://analytics.chunkify.dev"
480
+
481
+ custom_headers_env = os.environ.get("CHUNKIFY_ANALYTICS_CUSTOM_HEADERS")
482
+ if custom_headers_env is not None:
483
+ parsed: dict[str, str] = {}
484
+ for line in custom_headers_env.split("\n"):
485
+ colon = line.find(":")
486
+ if colon >= 0:
487
+ parsed[line[:colon].strip()] = line[colon + 1 :].strip()
488
+ default_headers = {**parsed, **(default_headers if is_mapping_t(default_headers) else {})}
489
+
490
+ super().__init__(
491
+ version=__version__,
492
+ base_url=base_url,
493
+ max_retries=max_retries,
494
+ timeout=timeout,
495
+ http_client=http_client,
496
+ custom_headers=default_headers,
497
+ custom_query=default_query,
498
+ _strict_response_validation=_strict_response_validation,
499
+ )
500
+
501
+ @cached_property
502
+ def health(self) -> AsyncHealthResource:
503
+ """Health and private ingestion status."""
504
+ from .resources.health import AsyncHealthResource
505
+
506
+ return AsyncHealthResource(self)
507
+
508
+ @cached_property
509
+ def events(self) -> AsyncEventsResource:
510
+ from .resources.events import AsyncEventsResource
511
+
512
+ return AsyncEventsResource(self)
513
+
514
+ @cached_property
515
+ def summary(self) -> AsyncSummaryResource:
516
+ """Private retained-event and view-cohort queries."""
517
+ from .resources.summary import AsyncSummaryResource
518
+
519
+ return AsyncSummaryResource(self)
520
+
521
+ @cached_property
522
+ def videos(self) -> AsyncVideosResource:
523
+ """Private retained-event and view-cohort queries."""
524
+ from .resources.videos import AsyncVideosResource
525
+
526
+ return AsyncVideosResource(self)
527
+
528
+ @cached_property
529
+ def timeseries(self) -> AsyncTimeseriesResource:
530
+ """Private retained-event and view-cohort queries."""
531
+ from .resources.timeseries import AsyncTimeseriesResource
532
+
533
+ return AsyncTimeseriesResource(self)
534
+
535
+ @cached_property
536
+ def quality(self) -> AsyncQualityResource:
537
+ """Private retained-event and view-cohort queries."""
538
+ from .resources.quality import AsyncQualityResource
539
+
540
+ return AsyncQualityResource(self)
541
+
542
+ @cached_property
543
+ def engagement(self) -> AsyncEngagementResource:
544
+ """Private retained-event and view-cohort queries."""
545
+ from .resources.engagement import AsyncEngagementResource
546
+
547
+ return AsyncEngagementResource(self)
548
+
549
+ @cached_property
550
+ def project(self) -> AsyncProjectResource:
551
+ """Project origins and keys."""
552
+ from .resources.project import AsyncProjectResource
553
+
554
+ return AsyncProjectResource(self)
555
+
556
+ @cached_property
557
+ def admin(self) -> AsyncAdminResource:
558
+ """Project origins and keys."""
559
+ from .resources.admin import AsyncAdminResource
560
+
561
+ return AsyncAdminResource(self)
562
+
563
+ @cached_property
564
+ def views(self) -> AsyncViewsResource:
565
+ """Private retained-event and view-cohort queries."""
566
+ from .resources.views import AsyncViewsResource
567
+
568
+ return AsyncViewsResource(self)
569
+
570
+ @cached_property
571
+ def errors(self) -> AsyncErrorsResource:
572
+ """Private retained-event and view-cohort queries."""
573
+ from .resources.errors import AsyncErrorsResource
574
+
575
+ return AsyncErrorsResource(self)
576
+
577
+ @cached_property
578
+ def dimensions(self) -> AsyncDimensionsResource:
579
+ """Private retained-event and view-cohort queries."""
580
+ from .resources.dimensions import AsyncDimensionsResource
581
+
582
+ return AsyncDimensionsResource(self)
583
+
584
+ @cached_property
585
+ def exports(self) -> AsyncExportsResource:
586
+ from .resources.exports import AsyncExportsResource
587
+
588
+ return AsyncExportsResource(self)
589
+
590
+ @cached_property
591
+ def retention(self) -> AsyncRetentionResource:
592
+ """Private retained-event and view-cohort queries."""
593
+ from .resources.retention import AsyncRetentionResource
594
+
595
+ return AsyncRetentionResource(self)
596
+
597
+ @cached_property
598
+ def renditions(self) -> AsyncRenditionsResource:
599
+ """Private retained-event and view-cohort queries."""
600
+ from .resources.renditions import AsyncRenditionsResource
601
+
602
+ return AsyncRenditionsResource(self)
603
+
604
+ @cached_property
605
+ def subtitles(self) -> AsyncSubtitlesResource:
606
+ """Private retained-event and view-cohort queries."""
607
+ from .resources.subtitles import AsyncSubtitlesResource
608
+
609
+ return AsyncSubtitlesResource(self)
610
+
611
+ @cached_property
612
+ def playback_rates(self) -> AsyncPlaybackRatesResource:
613
+ """Private retained-event and view-cohort queries."""
614
+ from .resources.playback_rates import AsyncPlaybackRatesResource
615
+
616
+ return AsyncPlaybackRatesResource(self)
617
+
618
+ @cached_property
619
+ def with_raw_response(self) -> AsyncChunkifyAnalyticsWithRawResponse:
620
+ return AsyncChunkifyAnalyticsWithRawResponse(self)
621
+
622
+ @cached_property
623
+ def with_streaming_response(self) -> AsyncChunkifyAnalyticsWithStreamedResponse:
624
+ return AsyncChunkifyAnalyticsWithStreamedResponse(self)
625
+
626
+ @property
627
+ @override
628
+ def qs(self) -> Querystring:
629
+ return Querystring(array_format="repeat")
630
+
631
+ @override
632
+ def _auth_headers(self, security: SecurityOptions) -> dict[str, str]:
633
+ headers: dict[str, str] = {}
634
+ if security.get("public_key", False):
635
+ for key, value in self._public_key.items():
636
+ headers.setdefault(key, value)
637
+ if security.get("secret_key", False):
638
+ for key, value in self._secret_key.items():
639
+ headers.setdefault(key, value)
640
+ if security.get("admin_key", False):
641
+ for key, value in self._admin_key.items():
642
+ headers.setdefault(key, value)
643
+ return headers
644
+
645
+ @property
646
+ def _public_key(self) -> dict[str, str]:
647
+ public_key = self.public_key
648
+ if public_key is None:
649
+ return {}
650
+ return {"X-Chunkify-Ingest-Key": public_key}
651
+
652
+ @property
653
+ def _secret_key(self) -> dict[str, str]:
654
+ secret_key = self.secret_key
655
+ if secret_key is None:
656
+ return {}
657
+ return {"Authorization": f"Bearer {secret_key}"}
658
+
659
+ @property
660
+ def _admin_key(self) -> dict[str, str]:
661
+ admin_key = self.admin_key
662
+ if admin_key is None:
663
+ return {}
664
+ return {"Authorization": f"Bearer {admin_key}"}
665
+
666
+ @property
667
+ @override
668
+ def default_headers(self) -> dict[str, str | Omit]:
669
+ return {
670
+ **super().default_headers,
671
+ "X-Stainless-Async": f"async:{get_async_library()}",
672
+ **self._custom_headers,
673
+ }
674
+
675
+ def copy(
676
+ self,
677
+ *,
678
+ public_key: str | None = None,
679
+ secret_key: str | None = None,
680
+ admin_key: str | None = None,
681
+ base_url: str | httpx.URL | None = None,
682
+ timeout: float | Timeout | None | NotGiven = not_given,
683
+ http_client: httpx.AsyncClient | None = None,
684
+ max_retries: int | NotGiven = not_given,
685
+ default_headers: Mapping[str, str] | None = None,
686
+ set_default_headers: Mapping[str, str] | None = None,
687
+ default_query: Mapping[str, object] | None = None,
688
+ set_default_query: Mapping[str, object] | None = None,
689
+ _extra_kwargs: Mapping[str, Any] = {},
690
+ ) -> Self:
691
+ """
692
+ Create a new client instance re-using the same options given to the current client with optional overriding.
693
+ """
694
+ if default_headers is not None and set_default_headers is not None:
695
+ raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive")
696
+
697
+ if default_query is not None and set_default_query is not None:
698
+ raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive")
699
+
700
+ headers = self._custom_headers
701
+ if default_headers is not None:
702
+ headers = {**headers, **default_headers}
703
+ elif set_default_headers is not None:
704
+ headers = set_default_headers
705
+
706
+ params = self._custom_query
707
+ if default_query is not None:
708
+ params = {**params, **default_query}
709
+ elif set_default_query is not None:
710
+ params = set_default_query
711
+
712
+ http_client = http_client or self._client
713
+ return self.__class__(
714
+ public_key=public_key or self.public_key,
715
+ secret_key=secret_key or self.secret_key,
716
+ admin_key=admin_key or self.admin_key,
717
+ base_url=base_url or self.base_url,
718
+ timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
719
+ http_client=http_client,
720
+ max_retries=max_retries if is_given(max_retries) else self.max_retries,
721
+ default_headers=headers,
722
+ default_query=params,
723
+ **_extra_kwargs,
724
+ )
725
+
726
+ # Alias for `copy` for nicer inline usage, e.g.
727
+ # client.with_options(timeout=10).foo.create(...)
728
+ with_options = copy
729
+
730
+ @override
731
+ def _make_status_error(
732
+ self,
733
+ err_msg: str,
734
+ *,
735
+ body: object,
736
+ response: httpx.Response,
737
+ ) -> APIStatusError:
738
+ if response.status_code == 400:
739
+ return _exceptions.BadRequestError(err_msg, response=response, body=body)
740
+
741
+ if response.status_code == 401:
742
+ return _exceptions.AuthenticationError(err_msg, response=response, body=body)
743
+
744
+ if response.status_code == 403:
745
+ return _exceptions.PermissionDeniedError(err_msg, response=response, body=body)
746
+
747
+ if response.status_code == 404:
748
+ return _exceptions.NotFoundError(err_msg, response=response, body=body)
749
+
750
+ if response.status_code == 409:
751
+ return _exceptions.ConflictError(err_msg, response=response, body=body)
752
+
753
+ if response.status_code == 422:
754
+ return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body)
755
+
756
+ if response.status_code == 429:
757
+ return _exceptions.RateLimitError(err_msg, response=response, body=body)
758
+
759
+ if response.status_code >= 500:
760
+ return _exceptions.InternalServerError(err_msg, response=response, body=body)
761
+ return APIStatusError(err_msg, response=response, body=body)
762
+
763
+
764
+ class ChunkifyAnalyticsWithRawResponse:
765
+ _client: ChunkifyAnalytics
766
+
767
+ def __init__(self, client: ChunkifyAnalytics) -> None:
768
+ self._client = client
769
+
770
+ @cached_property
771
+ def health(self) -> health.HealthResourceWithRawResponse:
772
+ """Health and private ingestion status."""
773
+ from .resources.health import HealthResourceWithRawResponse
774
+
775
+ return HealthResourceWithRawResponse(self._client.health)
776
+
777
+ @cached_property
778
+ def events(self) -> events.EventsResourceWithRawResponse:
779
+ from .resources.events import EventsResourceWithRawResponse
780
+
781
+ return EventsResourceWithRawResponse(self._client.events)
782
+
783
+ @cached_property
784
+ def summary(self) -> summary.SummaryResourceWithRawResponse:
785
+ """Private retained-event and view-cohort queries."""
786
+ from .resources.summary import SummaryResourceWithRawResponse
787
+
788
+ return SummaryResourceWithRawResponse(self._client.summary)
789
+
790
+ @cached_property
791
+ def videos(self) -> videos.VideosResourceWithRawResponse:
792
+ """Private retained-event and view-cohort queries."""
793
+ from .resources.videos import VideosResourceWithRawResponse
794
+
795
+ return VideosResourceWithRawResponse(self._client.videos)
796
+
797
+ @cached_property
798
+ def timeseries(self) -> timeseries.TimeseriesResourceWithRawResponse:
799
+ """Private retained-event and view-cohort queries."""
800
+ from .resources.timeseries import TimeseriesResourceWithRawResponse
801
+
802
+ return TimeseriesResourceWithRawResponse(self._client.timeseries)
803
+
804
+ @cached_property
805
+ def quality(self) -> quality.QualityResourceWithRawResponse:
806
+ """Private retained-event and view-cohort queries."""
807
+ from .resources.quality import QualityResourceWithRawResponse
808
+
809
+ return QualityResourceWithRawResponse(self._client.quality)
810
+
811
+ @cached_property
812
+ def engagement(self) -> engagement.EngagementResourceWithRawResponse:
813
+ """Private retained-event and view-cohort queries."""
814
+ from .resources.engagement import EngagementResourceWithRawResponse
815
+
816
+ return EngagementResourceWithRawResponse(self._client.engagement)
817
+
818
+ @cached_property
819
+ def project(self) -> project.ProjectResourceWithRawResponse:
820
+ """Project origins and keys."""
821
+ from .resources.project import ProjectResourceWithRawResponse
822
+
823
+ return ProjectResourceWithRawResponse(self._client.project)
824
+
825
+ @cached_property
826
+ def admin(self) -> admin.AdminResourceWithRawResponse:
827
+ """Project origins and keys."""
828
+ from .resources.admin import AdminResourceWithRawResponse
829
+
830
+ return AdminResourceWithRawResponse(self._client.admin)
831
+
832
+ @cached_property
833
+ def views(self) -> views.ViewsResourceWithRawResponse:
834
+ """Private retained-event and view-cohort queries."""
835
+ from .resources.views import ViewsResourceWithRawResponse
836
+
837
+ return ViewsResourceWithRawResponse(self._client.views)
838
+
839
+ @cached_property
840
+ def errors(self) -> errors.ErrorsResourceWithRawResponse:
841
+ """Private retained-event and view-cohort queries."""
842
+ from .resources.errors import ErrorsResourceWithRawResponse
843
+
844
+ return ErrorsResourceWithRawResponse(self._client.errors)
845
+
846
+ @cached_property
847
+ def dimensions(self) -> dimensions.DimensionsResourceWithRawResponse:
848
+ """Private retained-event and view-cohort queries."""
849
+ from .resources.dimensions import DimensionsResourceWithRawResponse
850
+
851
+ return DimensionsResourceWithRawResponse(self._client.dimensions)
852
+
853
+ @cached_property
854
+ def exports(self) -> exports.ExportsResourceWithRawResponse:
855
+ from .resources.exports import ExportsResourceWithRawResponse
856
+
857
+ return ExportsResourceWithRawResponse(self._client.exports)
858
+
859
+ @cached_property
860
+ def retention(self) -> retention.RetentionResourceWithRawResponse:
861
+ """Private retained-event and view-cohort queries."""
862
+ from .resources.retention import RetentionResourceWithRawResponse
863
+
864
+ return RetentionResourceWithRawResponse(self._client.retention)
865
+
866
+ @cached_property
867
+ def renditions(self) -> renditions.RenditionsResourceWithRawResponse:
868
+ """Private retained-event and view-cohort queries."""
869
+ from .resources.renditions import RenditionsResourceWithRawResponse
870
+
871
+ return RenditionsResourceWithRawResponse(self._client.renditions)
872
+
873
+ @cached_property
874
+ def subtitles(self) -> subtitles.SubtitlesResourceWithRawResponse:
875
+ """Private retained-event and view-cohort queries."""
876
+ from .resources.subtitles import SubtitlesResourceWithRawResponse
877
+
878
+ return SubtitlesResourceWithRawResponse(self._client.subtitles)
879
+
880
+ @cached_property
881
+ def playback_rates(self) -> playback_rates.PlaybackRatesResourceWithRawResponse:
882
+ """Private retained-event and view-cohort queries."""
883
+ from .resources.playback_rates import PlaybackRatesResourceWithRawResponse
884
+
885
+ return PlaybackRatesResourceWithRawResponse(self._client.playback_rates)
886
+
887
+
888
+ class AsyncChunkifyAnalyticsWithRawResponse:
889
+ _client: AsyncChunkifyAnalytics
890
+
891
+ def __init__(self, client: AsyncChunkifyAnalytics) -> None:
892
+ self._client = client
893
+
894
+ @cached_property
895
+ def health(self) -> health.AsyncHealthResourceWithRawResponse:
896
+ """Health and private ingestion status."""
897
+ from .resources.health import AsyncHealthResourceWithRawResponse
898
+
899
+ return AsyncHealthResourceWithRawResponse(self._client.health)
900
+
901
+ @cached_property
902
+ def events(self) -> events.AsyncEventsResourceWithRawResponse:
903
+ from .resources.events import AsyncEventsResourceWithRawResponse
904
+
905
+ return AsyncEventsResourceWithRawResponse(self._client.events)
906
+
907
+ @cached_property
908
+ def summary(self) -> summary.AsyncSummaryResourceWithRawResponse:
909
+ """Private retained-event and view-cohort queries."""
910
+ from .resources.summary import AsyncSummaryResourceWithRawResponse
911
+
912
+ return AsyncSummaryResourceWithRawResponse(self._client.summary)
913
+
914
+ @cached_property
915
+ def videos(self) -> videos.AsyncVideosResourceWithRawResponse:
916
+ """Private retained-event and view-cohort queries."""
917
+ from .resources.videos import AsyncVideosResourceWithRawResponse
918
+
919
+ return AsyncVideosResourceWithRawResponse(self._client.videos)
920
+
921
+ @cached_property
922
+ def timeseries(self) -> timeseries.AsyncTimeseriesResourceWithRawResponse:
923
+ """Private retained-event and view-cohort queries."""
924
+ from .resources.timeseries import AsyncTimeseriesResourceWithRawResponse
925
+
926
+ return AsyncTimeseriesResourceWithRawResponse(self._client.timeseries)
927
+
928
+ @cached_property
929
+ def quality(self) -> quality.AsyncQualityResourceWithRawResponse:
930
+ """Private retained-event and view-cohort queries."""
931
+ from .resources.quality import AsyncQualityResourceWithRawResponse
932
+
933
+ return AsyncQualityResourceWithRawResponse(self._client.quality)
934
+
935
+ @cached_property
936
+ def engagement(self) -> engagement.AsyncEngagementResourceWithRawResponse:
937
+ """Private retained-event and view-cohort queries."""
938
+ from .resources.engagement import AsyncEngagementResourceWithRawResponse
939
+
940
+ return AsyncEngagementResourceWithRawResponse(self._client.engagement)
941
+
942
+ @cached_property
943
+ def project(self) -> project.AsyncProjectResourceWithRawResponse:
944
+ """Project origins and keys."""
945
+ from .resources.project import AsyncProjectResourceWithRawResponse
946
+
947
+ return AsyncProjectResourceWithRawResponse(self._client.project)
948
+
949
+ @cached_property
950
+ def admin(self) -> admin.AsyncAdminResourceWithRawResponse:
951
+ """Project origins and keys."""
952
+ from .resources.admin import AsyncAdminResourceWithRawResponse
953
+
954
+ return AsyncAdminResourceWithRawResponse(self._client.admin)
955
+
956
+ @cached_property
957
+ def views(self) -> views.AsyncViewsResourceWithRawResponse:
958
+ """Private retained-event and view-cohort queries."""
959
+ from .resources.views import AsyncViewsResourceWithRawResponse
960
+
961
+ return AsyncViewsResourceWithRawResponse(self._client.views)
962
+
963
+ @cached_property
964
+ def errors(self) -> errors.AsyncErrorsResourceWithRawResponse:
965
+ """Private retained-event and view-cohort queries."""
966
+ from .resources.errors import AsyncErrorsResourceWithRawResponse
967
+
968
+ return AsyncErrorsResourceWithRawResponse(self._client.errors)
969
+
970
+ @cached_property
971
+ def dimensions(self) -> dimensions.AsyncDimensionsResourceWithRawResponse:
972
+ """Private retained-event and view-cohort queries."""
973
+ from .resources.dimensions import AsyncDimensionsResourceWithRawResponse
974
+
975
+ return AsyncDimensionsResourceWithRawResponse(self._client.dimensions)
976
+
977
+ @cached_property
978
+ def exports(self) -> exports.AsyncExportsResourceWithRawResponse:
979
+ from .resources.exports import AsyncExportsResourceWithRawResponse
980
+
981
+ return AsyncExportsResourceWithRawResponse(self._client.exports)
982
+
983
+ @cached_property
984
+ def retention(self) -> retention.AsyncRetentionResourceWithRawResponse:
985
+ """Private retained-event and view-cohort queries."""
986
+ from .resources.retention import AsyncRetentionResourceWithRawResponse
987
+
988
+ return AsyncRetentionResourceWithRawResponse(self._client.retention)
989
+
990
+ @cached_property
991
+ def renditions(self) -> renditions.AsyncRenditionsResourceWithRawResponse:
992
+ """Private retained-event and view-cohort queries."""
993
+ from .resources.renditions import AsyncRenditionsResourceWithRawResponse
994
+
995
+ return AsyncRenditionsResourceWithRawResponse(self._client.renditions)
996
+
997
+ @cached_property
998
+ def subtitles(self) -> subtitles.AsyncSubtitlesResourceWithRawResponse:
999
+ """Private retained-event and view-cohort queries."""
1000
+ from .resources.subtitles import AsyncSubtitlesResourceWithRawResponse
1001
+
1002
+ return AsyncSubtitlesResourceWithRawResponse(self._client.subtitles)
1003
+
1004
+ @cached_property
1005
+ def playback_rates(self) -> playback_rates.AsyncPlaybackRatesResourceWithRawResponse:
1006
+ """Private retained-event and view-cohort queries."""
1007
+ from .resources.playback_rates import AsyncPlaybackRatesResourceWithRawResponse
1008
+
1009
+ return AsyncPlaybackRatesResourceWithRawResponse(self._client.playback_rates)
1010
+
1011
+
1012
+ class ChunkifyAnalyticsWithStreamedResponse:
1013
+ _client: ChunkifyAnalytics
1014
+
1015
+ def __init__(self, client: ChunkifyAnalytics) -> None:
1016
+ self._client = client
1017
+
1018
+ @cached_property
1019
+ def health(self) -> health.HealthResourceWithStreamingResponse:
1020
+ """Health and private ingestion status."""
1021
+ from .resources.health import HealthResourceWithStreamingResponse
1022
+
1023
+ return HealthResourceWithStreamingResponse(self._client.health)
1024
+
1025
+ @cached_property
1026
+ def events(self) -> events.EventsResourceWithStreamingResponse:
1027
+ from .resources.events import EventsResourceWithStreamingResponse
1028
+
1029
+ return EventsResourceWithStreamingResponse(self._client.events)
1030
+
1031
+ @cached_property
1032
+ def summary(self) -> summary.SummaryResourceWithStreamingResponse:
1033
+ """Private retained-event and view-cohort queries."""
1034
+ from .resources.summary import SummaryResourceWithStreamingResponse
1035
+
1036
+ return SummaryResourceWithStreamingResponse(self._client.summary)
1037
+
1038
+ @cached_property
1039
+ def videos(self) -> videos.VideosResourceWithStreamingResponse:
1040
+ """Private retained-event and view-cohort queries."""
1041
+ from .resources.videos import VideosResourceWithStreamingResponse
1042
+
1043
+ return VideosResourceWithStreamingResponse(self._client.videos)
1044
+
1045
+ @cached_property
1046
+ def timeseries(self) -> timeseries.TimeseriesResourceWithStreamingResponse:
1047
+ """Private retained-event and view-cohort queries."""
1048
+ from .resources.timeseries import TimeseriesResourceWithStreamingResponse
1049
+
1050
+ return TimeseriesResourceWithStreamingResponse(self._client.timeseries)
1051
+
1052
+ @cached_property
1053
+ def quality(self) -> quality.QualityResourceWithStreamingResponse:
1054
+ """Private retained-event and view-cohort queries."""
1055
+ from .resources.quality import QualityResourceWithStreamingResponse
1056
+
1057
+ return QualityResourceWithStreamingResponse(self._client.quality)
1058
+
1059
+ @cached_property
1060
+ def engagement(self) -> engagement.EngagementResourceWithStreamingResponse:
1061
+ """Private retained-event and view-cohort queries."""
1062
+ from .resources.engagement import EngagementResourceWithStreamingResponse
1063
+
1064
+ return EngagementResourceWithStreamingResponse(self._client.engagement)
1065
+
1066
+ @cached_property
1067
+ def project(self) -> project.ProjectResourceWithStreamingResponse:
1068
+ """Project origins and keys."""
1069
+ from .resources.project import ProjectResourceWithStreamingResponse
1070
+
1071
+ return ProjectResourceWithStreamingResponse(self._client.project)
1072
+
1073
+ @cached_property
1074
+ def admin(self) -> admin.AdminResourceWithStreamingResponse:
1075
+ """Project origins and keys."""
1076
+ from .resources.admin import AdminResourceWithStreamingResponse
1077
+
1078
+ return AdminResourceWithStreamingResponse(self._client.admin)
1079
+
1080
+ @cached_property
1081
+ def views(self) -> views.ViewsResourceWithStreamingResponse:
1082
+ """Private retained-event and view-cohort queries."""
1083
+ from .resources.views import ViewsResourceWithStreamingResponse
1084
+
1085
+ return ViewsResourceWithStreamingResponse(self._client.views)
1086
+
1087
+ @cached_property
1088
+ def errors(self) -> errors.ErrorsResourceWithStreamingResponse:
1089
+ """Private retained-event and view-cohort queries."""
1090
+ from .resources.errors import ErrorsResourceWithStreamingResponse
1091
+
1092
+ return ErrorsResourceWithStreamingResponse(self._client.errors)
1093
+
1094
+ @cached_property
1095
+ def dimensions(self) -> dimensions.DimensionsResourceWithStreamingResponse:
1096
+ """Private retained-event and view-cohort queries."""
1097
+ from .resources.dimensions import DimensionsResourceWithStreamingResponse
1098
+
1099
+ return DimensionsResourceWithStreamingResponse(self._client.dimensions)
1100
+
1101
+ @cached_property
1102
+ def exports(self) -> exports.ExportsResourceWithStreamingResponse:
1103
+ from .resources.exports import ExportsResourceWithStreamingResponse
1104
+
1105
+ return ExportsResourceWithStreamingResponse(self._client.exports)
1106
+
1107
+ @cached_property
1108
+ def retention(self) -> retention.RetentionResourceWithStreamingResponse:
1109
+ """Private retained-event and view-cohort queries."""
1110
+ from .resources.retention import RetentionResourceWithStreamingResponse
1111
+
1112
+ return RetentionResourceWithStreamingResponse(self._client.retention)
1113
+
1114
+ @cached_property
1115
+ def renditions(self) -> renditions.RenditionsResourceWithStreamingResponse:
1116
+ """Private retained-event and view-cohort queries."""
1117
+ from .resources.renditions import RenditionsResourceWithStreamingResponse
1118
+
1119
+ return RenditionsResourceWithStreamingResponse(self._client.renditions)
1120
+
1121
+ @cached_property
1122
+ def subtitles(self) -> subtitles.SubtitlesResourceWithStreamingResponse:
1123
+ """Private retained-event and view-cohort queries."""
1124
+ from .resources.subtitles import SubtitlesResourceWithStreamingResponse
1125
+
1126
+ return SubtitlesResourceWithStreamingResponse(self._client.subtitles)
1127
+
1128
+ @cached_property
1129
+ def playback_rates(self) -> playback_rates.PlaybackRatesResourceWithStreamingResponse:
1130
+ """Private retained-event and view-cohort queries."""
1131
+ from .resources.playback_rates import PlaybackRatesResourceWithStreamingResponse
1132
+
1133
+ return PlaybackRatesResourceWithStreamingResponse(self._client.playback_rates)
1134
+
1135
+
1136
+ class AsyncChunkifyAnalyticsWithStreamedResponse:
1137
+ _client: AsyncChunkifyAnalytics
1138
+
1139
+ def __init__(self, client: AsyncChunkifyAnalytics) -> None:
1140
+ self._client = client
1141
+
1142
+ @cached_property
1143
+ def health(self) -> health.AsyncHealthResourceWithStreamingResponse:
1144
+ """Health and private ingestion status."""
1145
+ from .resources.health import AsyncHealthResourceWithStreamingResponse
1146
+
1147
+ return AsyncHealthResourceWithStreamingResponse(self._client.health)
1148
+
1149
+ @cached_property
1150
+ def events(self) -> events.AsyncEventsResourceWithStreamingResponse:
1151
+ from .resources.events import AsyncEventsResourceWithStreamingResponse
1152
+
1153
+ return AsyncEventsResourceWithStreamingResponse(self._client.events)
1154
+
1155
+ @cached_property
1156
+ def summary(self) -> summary.AsyncSummaryResourceWithStreamingResponse:
1157
+ """Private retained-event and view-cohort queries."""
1158
+ from .resources.summary import AsyncSummaryResourceWithStreamingResponse
1159
+
1160
+ return AsyncSummaryResourceWithStreamingResponse(self._client.summary)
1161
+
1162
+ @cached_property
1163
+ def videos(self) -> videos.AsyncVideosResourceWithStreamingResponse:
1164
+ """Private retained-event and view-cohort queries."""
1165
+ from .resources.videos import AsyncVideosResourceWithStreamingResponse
1166
+
1167
+ return AsyncVideosResourceWithStreamingResponse(self._client.videos)
1168
+
1169
+ @cached_property
1170
+ def timeseries(self) -> timeseries.AsyncTimeseriesResourceWithStreamingResponse:
1171
+ """Private retained-event and view-cohort queries."""
1172
+ from .resources.timeseries import AsyncTimeseriesResourceWithStreamingResponse
1173
+
1174
+ return AsyncTimeseriesResourceWithStreamingResponse(self._client.timeseries)
1175
+
1176
+ @cached_property
1177
+ def quality(self) -> quality.AsyncQualityResourceWithStreamingResponse:
1178
+ """Private retained-event and view-cohort queries."""
1179
+ from .resources.quality import AsyncQualityResourceWithStreamingResponse
1180
+
1181
+ return AsyncQualityResourceWithStreamingResponse(self._client.quality)
1182
+
1183
+ @cached_property
1184
+ def engagement(self) -> engagement.AsyncEngagementResourceWithStreamingResponse:
1185
+ """Private retained-event and view-cohort queries."""
1186
+ from .resources.engagement import AsyncEngagementResourceWithStreamingResponse
1187
+
1188
+ return AsyncEngagementResourceWithStreamingResponse(self._client.engagement)
1189
+
1190
+ @cached_property
1191
+ def project(self) -> project.AsyncProjectResourceWithStreamingResponse:
1192
+ """Project origins and keys."""
1193
+ from .resources.project import AsyncProjectResourceWithStreamingResponse
1194
+
1195
+ return AsyncProjectResourceWithStreamingResponse(self._client.project)
1196
+
1197
+ @cached_property
1198
+ def admin(self) -> admin.AsyncAdminResourceWithStreamingResponse:
1199
+ """Project origins and keys."""
1200
+ from .resources.admin import AsyncAdminResourceWithStreamingResponse
1201
+
1202
+ return AsyncAdminResourceWithStreamingResponse(self._client.admin)
1203
+
1204
+ @cached_property
1205
+ def views(self) -> views.AsyncViewsResourceWithStreamingResponse:
1206
+ """Private retained-event and view-cohort queries."""
1207
+ from .resources.views import AsyncViewsResourceWithStreamingResponse
1208
+
1209
+ return AsyncViewsResourceWithStreamingResponse(self._client.views)
1210
+
1211
+ @cached_property
1212
+ def errors(self) -> errors.AsyncErrorsResourceWithStreamingResponse:
1213
+ """Private retained-event and view-cohort queries."""
1214
+ from .resources.errors import AsyncErrorsResourceWithStreamingResponse
1215
+
1216
+ return AsyncErrorsResourceWithStreamingResponse(self._client.errors)
1217
+
1218
+ @cached_property
1219
+ def dimensions(self) -> dimensions.AsyncDimensionsResourceWithStreamingResponse:
1220
+ """Private retained-event and view-cohort queries."""
1221
+ from .resources.dimensions import AsyncDimensionsResourceWithStreamingResponse
1222
+
1223
+ return AsyncDimensionsResourceWithStreamingResponse(self._client.dimensions)
1224
+
1225
+ @cached_property
1226
+ def exports(self) -> exports.AsyncExportsResourceWithStreamingResponse:
1227
+ from .resources.exports import AsyncExportsResourceWithStreamingResponse
1228
+
1229
+ return AsyncExportsResourceWithStreamingResponse(self._client.exports)
1230
+
1231
+ @cached_property
1232
+ def retention(self) -> retention.AsyncRetentionResourceWithStreamingResponse:
1233
+ """Private retained-event and view-cohort queries."""
1234
+ from .resources.retention import AsyncRetentionResourceWithStreamingResponse
1235
+
1236
+ return AsyncRetentionResourceWithStreamingResponse(self._client.retention)
1237
+
1238
+ @cached_property
1239
+ def renditions(self) -> renditions.AsyncRenditionsResourceWithStreamingResponse:
1240
+ """Private retained-event and view-cohort queries."""
1241
+ from .resources.renditions import AsyncRenditionsResourceWithStreamingResponse
1242
+
1243
+ return AsyncRenditionsResourceWithStreamingResponse(self._client.renditions)
1244
+
1245
+ @cached_property
1246
+ def subtitles(self) -> subtitles.AsyncSubtitlesResourceWithStreamingResponse:
1247
+ """Private retained-event and view-cohort queries."""
1248
+ from .resources.subtitles import AsyncSubtitlesResourceWithStreamingResponse
1249
+
1250
+ return AsyncSubtitlesResourceWithStreamingResponse(self._client.subtitles)
1251
+
1252
+ @cached_property
1253
+ def playback_rates(self) -> playback_rates.AsyncPlaybackRatesResourceWithStreamingResponse:
1254
+ """Private retained-event and view-cohort queries."""
1255
+ from .resources.playback_rates import AsyncPlaybackRatesResourceWithStreamingResponse
1256
+
1257
+ return AsyncPlaybackRatesResourceWithStreamingResponse(self._client.playback_rates)
1258
+
1259
+
1260
+ Client = ChunkifyAnalytics
1261
+
1262
+ AsyncClient = AsyncChunkifyAnalytics