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.
- chunkify_analytics/__init__.py +102 -0
- chunkify_analytics/_base_client.py +2153 -0
- chunkify_analytics/_client.py +1262 -0
- chunkify_analytics/_compat.py +226 -0
- chunkify_analytics/_constants.py +14 -0
- chunkify_analytics/_exceptions.py +108 -0
- chunkify_analytics/_files.py +173 -0
- chunkify_analytics/_models.py +964 -0
- chunkify_analytics/_qs.py +149 -0
- chunkify_analytics/_resource.py +43 -0
- chunkify_analytics/_response.py +835 -0
- chunkify_analytics/_streaming.py +338 -0
- chunkify_analytics/_types.py +274 -0
- chunkify_analytics/_utils/__init__.py +64 -0
- chunkify_analytics/_utils/_compat.py +45 -0
- chunkify_analytics/_utils/_datetime_parse.py +136 -0
- chunkify_analytics/_utils/_json.py +35 -0
- chunkify_analytics/_utils/_logs.py +25 -0
- chunkify_analytics/_utils/_path.py +127 -0
- chunkify_analytics/_utils/_proxy.py +65 -0
- chunkify_analytics/_utils/_reflection.py +42 -0
- chunkify_analytics/_utils/_resources_proxy.py +24 -0
- chunkify_analytics/_utils/_streams.py +12 -0
- chunkify_analytics/_utils/_sync.py +58 -0
- chunkify_analytics/_utils/_transform.py +457 -0
- chunkify_analytics/_utils/_typing.py +156 -0
- chunkify_analytics/_utils/_utils.py +433 -0
- chunkify_analytics/_version.py +4 -0
- chunkify_analytics/lib/.keep +4 -0
- chunkify_analytics/pagination.py +221 -0
- chunkify_analytics/py.typed +0 -0
- chunkify_analytics/resources/__init__.py +243 -0
- chunkify_analytics/resources/admin/__init__.py +33 -0
- chunkify_analytics/resources/admin/admin.py +253 -0
- chunkify_analytics/resources/admin/keys.py +283 -0
- chunkify_analytics/resources/dimensions.py +436 -0
- chunkify_analytics/resources/engagement.py +479 -0
- chunkify_analytics/resources/errors.py +400 -0
- chunkify_analytics/resources/events.py +562 -0
- chunkify_analytics/resources/exports.py +584 -0
- chunkify_analytics/resources/health.py +159 -0
- chunkify_analytics/resources/playback_rates.py +391 -0
- chunkify_analytics/resources/project/__init__.py +33 -0
- chunkify_analytics/resources/project/keys.py +379 -0
- chunkify_analytics/resources/project/project.py +322 -0
- chunkify_analytics/resources/quality.py +471 -0
- chunkify_analytics/resources/renditions.py +391 -0
- chunkify_analytics/resources/retention.py +377 -0
- chunkify_analytics/resources/subtitles.py +389 -0
- chunkify_analytics/resources/summary.py +469 -0
- chunkify_analytics/resources/timeseries.py +399 -0
- chunkify_analytics/resources/videos.py +424 -0
- chunkify_analytics/resources/views.py +579 -0
- chunkify_analytics/types/__init__.py +145 -0
- chunkify_analytics/types/admin/__init__.py +3 -0
- chunkify_analytics/types/admin_create_project_params.py +25 -0
- chunkify_analytics/types/analytics_event.py +32 -0
- chunkify_analytics/types/analytics_event_param.py +30 -0
- chunkify_analytics/types/created_project.py +37 -0
- chunkify_analytics/types/created_project_key.py +34 -0
- chunkify_analytics/types/deleted_project.py +18 -0
- chunkify_analytics/types/dimension_list_values_params.py +124 -0
- chunkify_analytics/types/dimension_values.py +42 -0
- chunkify_analytics/types/engagement.py +60 -0
- chunkify_analytics/types/engagement_breakdown_page.py +44 -0
- chunkify_analytics/types/engagement_response.py +11 -0
- chunkify_analytics/types/engagement_retrieve_params.py +158 -0
- chunkify_analytics/types/engagement_timeseries.py +28 -0
- chunkify_analytics/types/engagement_timeseries_bucket.py +63 -0
- chunkify_analytics/types/error_group.py +17 -0
- chunkify_analytics/types/error_list_params.py +124 -0
- chunkify_analytics/types/error_page.py +14 -0
- chunkify_analytics/types/event_ingest_params.py +19 -0
- chunkify_analytics/types/event_ingest_response.py +11 -0
- chunkify_analytics/types/event_list_params.py +146 -0
- chunkify_analytics/types/event_page.py +18 -0
- chunkify_analytics/types/export.py +18 -0
- chunkify_analytics/types/export_columns.py +12 -0
- chunkify_analytics/types/export_create_params.py +40 -0
- chunkify_analytics/types/export_download_response.py +7 -0
- chunkify_analytics/types/export_list_columns_params.py +69 -0
- chunkify_analytics/types/export_query_param.py +141 -0
- chunkify_analytics/types/health.py +11 -0
- chunkify_analytics/types/metrics.py +13 -0
- chunkify_analytics/types/metrics_breakdown_page.py +40 -0
- chunkify_analytics/types/metrics_response.py +11 -0
- chunkify_analytics/types/native_created.py +13 -0
- chunkify_analytics/types/native_duplicate.py +13 -0
- chunkify_analytics/types/playback_error.py +180 -0
- chunkify_analytics/types/playback_error_param.py +182 -0
- chunkify_analytics/types/playback_rate_changed.py +150 -0
- chunkify_analytics/types/playback_rate_changed_param.py +152 -0
- chunkify_analytics/types/playback_rate_metric.py +21 -0
- chunkify_analytics/types/playback_rate_report.py +31 -0
- chunkify_analytics/types/playback_rate_retrieve_params.py +117 -0
- chunkify_analytics/types/playback_state_changed.py +150 -0
- chunkify_analytics/types/playback_state_changed_param.py +156 -0
- chunkify_analytics/types/project/__init__.py +6 -0
- chunkify_analytics/types/project/key_create_params.py +21 -0
- chunkify_analytics/types/project/project.py +35 -0
- chunkify_analytics/types/project_key.py +21 -0
- chunkify_analytics/types/project_keys.py +14 -0
- chunkify_analytics/types/project_update_params.py +25 -0
- chunkify_analytics/types/quality.py +117 -0
- chunkify_analytics/types/quality_breakdown_page.py +44 -0
- chunkify_analytics/types/quality_response.py +11 -0
- chunkify_analytics/types/quality_retrieve_params.py +158 -0
- chunkify_analytics/types/quality_timeseries.py +28 -0
- chunkify_analytics/types/quality_timeseries_bucket.py +120 -0
- chunkify_analytics/types/rendition_changed.py +156 -0
- chunkify_analytics/types/rendition_changed_param.py +158 -0
- chunkify_analytics/types/rendition_metric.py +40 -0
- chunkify_analytics/types/rendition_report.py +43 -0
- chunkify_analytics/types/rendition_retrieve_params.py +117 -0
- chunkify_analytics/types/retention_bucket.py +22 -0
- chunkify_analytics/types/retention_report.py +33 -0
- chunkify_analytics/types/retention_retrieve_params.py +110 -0
- chunkify_analytics/types/rotated_project_key.py +29 -0
- chunkify_analytics/types/seek_completed.py +166 -0
- chunkify_analytics/types/seek_completed_param.py +168 -0
- chunkify_analytics/types/shared/__init__.py +24 -0
- chunkify_analytics/types/shared/browser_context.py +62 -0
- chunkify_analytics/types/shared/custom_dimensions.py +8 -0
- chunkify_analytics/types/shared/event_context.py +161 -0
- chunkify_analytics/types/shared/event_envelope.py +152 -0
- chunkify_analytics/types/shared/metric_count_ratio.py +18 -0
- chunkify_analytics/types/shared/otlp_any_value.py +56 -0
- chunkify_analytics/types/shared/otlp_attribute.py +24 -0
- chunkify_analytics/types/shared/otlp_attribute_value.py +136 -0
- chunkify_analytics/types/shared/otlp_context_attribute.py +22 -0
- chunkify_analytics/types/shared/otlp_log_record.py +48 -0
- chunkify_analytics/types/shared/otlp_resource.py +20 -0
- chunkify_analytics/types/shared/otlp_scope.py +24 -0
- chunkify_analytics/types/shared/playback_rate_playing_time.py +12 -0
- chunkify_analytics/types/shared/playback_score.py +28 -0
- chunkify_analytics/types/shared/played_range.py +13 -0
- chunkify_analytics/types/shared/progress_reached.py +39 -0
- chunkify_analytics/types/shared/rendition_playing_time.py +21 -0
- chunkify_analytics/types/shared/startup_outcomes.py +39 -0
- chunkify_analytics/types/shared/stored_otlp_context.py +50 -0
- chunkify_analytics/types/shared/subtitle_playing_time.py +14 -0
- chunkify_analytics/types/shared/view_metrics.py +100 -0
- chunkify_analytics/types/shared/watch_time_distribution.py +41 -0
- chunkify_analytics/types/shared_params/__init__.py +8 -0
- chunkify_analytics/types/shared_params/browser_context.py +62 -0
- chunkify_analytics/types/shared_params/custom_dimensions.py +10 -0
- chunkify_analytics/types/shared_params/playback_rate_playing_time.py +14 -0
- chunkify_analytics/types/shared_params/played_range.py +15 -0
- chunkify_analytics/types/shared_params/rendition_playing_time.py +22 -0
- chunkify_analytics/types/shared_params/subtitle_playing_time.py +15 -0
- chunkify_analytics/types/stored_event.py +44 -0
- chunkify_analytics/types/subtitle_changed.py +150 -0
- chunkify_analytics/types/subtitle_changed_param.py +152 -0
- chunkify_analytics/types/subtitle_metric.py +26 -0
- chunkify_analytics/types/subtitle_report.py +31 -0
- chunkify_analytics/types/subtitle_retrieve_params.py +117 -0
- chunkify_analytics/types/summary_retrieve_params.py +158 -0
- chunkify_analytics/types/time_bucket.py +22 -0
- chunkify_analytics/types/timeseries.py +28 -0
- chunkify_analytics/types/timeseries_response.py +12 -0
- chunkify_analytics/types/timesery_retrieve_params.py +115 -0
- chunkify_analytics/types/video_list_params.py +140 -0
- chunkify_analytics/types/video_metrics.py +23 -0
- chunkify_analytics/types/video_page.py +14 -0
- chunkify_analytics/types/view.py +43 -0
- chunkify_analytics/types/view_detail.py +21 -0
- chunkify_analytics/types/view_ended.py +180 -0
- chunkify_analytics/types/view_ended_param.py +182 -0
- chunkify_analytics/types/view_list_params.py +152 -0
- chunkify_analytics/types/view_page.py +14 -0
- chunkify_analytics/types/view_retrieve_params.py +23 -0
- chunkify_analytics/types/view_snapshot.py +180 -0
- chunkify_analytics/types/view_snapshot_param.py +182 -0
- chunkify_analytics/types/view_started.py +192 -0
- chunkify_analytics/types/view_started_param.py +194 -0
- chunkify_analytics_sdk-0.9.0.dist-info/METADATA +487 -0
- chunkify_analytics_sdk-0.9.0.dist-info/RECORD +179 -0
- chunkify_analytics_sdk-0.9.0.dist-info/WHEEL +4 -0
- chunkify_analytics_sdk-0.9.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
10
|
+
from ..._utils import path_template, maybe_transform, async_maybe_transform
|
|
11
|
+
from ..._compat import cached_property
|
|
12
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
13
|
+
from ..._response import (
|
|
14
|
+
to_raw_response_wrapper,
|
|
15
|
+
to_streamed_response_wrapper,
|
|
16
|
+
async_to_raw_response_wrapper,
|
|
17
|
+
async_to_streamed_response_wrapper,
|
|
18
|
+
)
|
|
19
|
+
from ..._base_client import make_request_options
|
|
20
|
+
from ...types.project import key_create_params
|
|
21
|
+
from ...types.project_keys import ProjectKeys
|
|
22
|
+
from ...types.created_project_key import CreatedProjectKey
|
|
23
|
+
from ...types.rotated_project_key import RotatedProjectKey
|
|
24
|
+
|
|
25
|
+
__all__ = ["KeysResource", "AsyncKeysResource"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class KeysResource(SyncAPIResource):
|
|
29
|
+
"""Project origins and keys."""
|
|
30
|
+
|
|
31
|
+
@cached_property
|
|
32
|
+
def with_raw_response(self) -> KeysResourceWithRawResponse:
|
|
33
|
+
"""
|
|
34
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
35
|
+
the raw response object instead of the parsed content.
|
|
36
|
+
|
|
37
|
+
For more information, see https://www.github.com/chunkifydev/chunkify-analytics-python#accessing-raw-response-data-eg-headers
|
|
38
|
+
"""
|
|
39
|
+
return KeysResourceWithRawResponse(self)
|
|
40
|
+
|
|
41
|
+
@cached_property
|
|
42
|
+
def with_streaming_response(self) -> KeysResourceWithStreamingResponse:
|
|
43
|
+
"""
|
|
44
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
45
|
+
|
|
46
|
+
For more information, see https://www.github.com/chunkifydev/chunkify-analytics-python#with_streaming_response
|
|
47
|
+
"""
|
|
48
|
+
return KeysResourceWithStreamingResponse(self)
|
|
49
|
+
|
|
50
|
+
def create(
|
|
51
|
+
self,
|
|
52
|
+
*,
|
|
53
|
+
name: str,
|
|
54
|
+
permission: Literal["public", "secret"],
|
|
55
|
+
read_only: bool | Omit = omit,
|
|
56
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
57
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
58
|
+
extra_headers: Headers | None = None,
|
|
59
|
+
extra_query: Query | None = None,
|
|
60
|
+
extra_body: Body | None = None,
|
|
61
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
62
|
+
) -> CreatedProjectKey:
|
|
63
|
+
"""
|
|
64
|
+
Create a named public ingestion key or secret key in the authenticated project.
|
|
65
|
+
Secret keys default to full project access; set read_only to true for analytics
|
|
66
|
+
reads and exports only. Requires a full-access project secret key. Read-only
|
|
67
|
+
keys receive 403 and the installation admin key is not accepted. The key is
|
|
68
|
+
active immediately and its value is returned once; store it before leaving this
|
|
69
|
+
response. Each project supports at most 64 active keys, including its initial
|
|
70
|
+
keys.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
name: Key display name, up to 128 UTF-8 bytes. Whitespace-only names are rejected.
|
|
74
|
+
|
|
75
|
+
read_only: Only secret keys can be read-only. False grants full project management access
|
|
76
|
+
to secret keys; public keys only ingest events.
|
|
77
|
+
|
|
78
|
+
extra_headers: Send extra headers
|
|
79
|
+
|
|
80
|
+
extra_query: Add additional query parameters to the request
|
|
81
|
+
|
|
82
|
+
extra_body: Add additional JSON properties to the request
|
|
83
|
+
|
|
84
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
85
|
+
"""
|
|
86
|
+
return self._post(
|
|
87
|
+
"/v1/project/keys",
|
|
88
|
+
body=maybe_transform(
|
|
89
|
+
{
|
|
90
|
+
"name": name,
|
|
91
|
+
"permission": permission,
|
|
92
|
+
"read_only": read_only,
|
|
93
|
+
},
|
|
94
|
+
key_create_params.KeyCreateParams,
|
|
95
|
+
),
|
|
96
|
+
options=make_request_options(
|
|
97
|
+
extra_headers=extra_headers,
|
|
98
|
+
extra_query=extra_query,
|
|
99
|
+
extra_body=extra_body,
|
|
100
|
+
timeout=timeout,
|
|
101
|
+
security={"secret_key": True},
|
|
102
|
+
),
|
|
103
|
+
cast_to=CreatedProjectKey,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
def list(
|
|
107
|
+
self,
|
|
108
|
+
*,
|
|
109
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
110
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
111
|
+
extra_headers: Headers | None = None,
|
|
112
|
+
extra_query: Query | None = None,
|
|
113
|
+
extra_body: Body | None = None,
|
|
114
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
115
|
+
) -> ProjectKeys:
|
|
116
|
+
"""List key IDs, names, and types.
|
|
117
|
+
|
|
118
|
+
Key values are not returned. Requires a
|
|
119
|
+
full-access private key; read-only keys receive 403.
|
|
120
|
+
"""
|
|
121
|
+
return self._get(
|
|
122
|
+
"/v1/project/keys",
|
|
123
|
+
options=make_request_options(
|
|
124
|
+
extra_headers=extra_headers,
|
|
125
|
+
extra_query=extra_query,
|
|
126
|
+
extra_body=extra_body,
|
|
127
|
+
timeout=timeout,
|
|
128
|
+
security={"secret_key": True},
|
|
129
|
+
),
|
|
130
|
+
cast_to=ProjectKeys,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
def rotate(
|
|
134
|
+
self,
|
|
135
|
+
key_id: str,
|
|
136
|
+
*,
|
|
137
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
138
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
139
|
+
extra_headers: Headers | None = None,
|
|
140
|
+
extra_query: Query | None = None,
|
|
141
|
+
extra_body: Body | None = None,
|
|
142
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
143
|
+
) -> RotatedProjectKey:
|
|
144
|
+
"""Replace a key in this project.
|
|
145
|
+
|
|
146
|
+
The old value stops working immediately. Save the
|
|
147
|
+
returned replacement. Requires a full-access private key; read-only keys
|
|
148
|
+
receive 403. Only the selected key is rotated. If its replacement is lost, a
|
|
149
|
+
trusted backend can rotate it again through the installation admin API.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
extra_headers: Send extra headers
|
|
153
|
+
|
|
154
|
+
extra_query: Add additional query parameters to the request
|
|
155
|
+
|
|
156
|
+
extra_body: Add additional JSON properties to the request
|
|
157
|
+
|
|
158
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
159
|
+
"""
|
|
160
|
+
if not key_id:
|
|
161
|
+
raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}")
|
|
162
|
+
return self._post(
|
|
163
|
+
path_template("/v1/project/keys/{key_id}/rotate", key_id=key_id),
|
|
164
|
+
options=make_request_options(
|
|
165
|
+
extra_headers=extra_headers,
|
|
166
|
+
extra_query=extra_query,
|
|
167
|
+
extra_body=extra_body,
|
|
168
|
+
timeout=timeout,
|
|
169
|
+
security={"secret_key": True},
|
|
170
|
+
),
|
|
171
|
+
cast_to=RotatedProjectKey,
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
class AsyncKeysResource(AsyncAPIResource):
|
|
176
|
+
"""Project origins and keys."""
|
|
177
|
+
|
|
178
|
+
@cached_property
|
|
179
|
+
def with_raw_response(self) -> AsyncKeysResourceWithRawResponse:
|
|
180
|
+
"""
|
|
181
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
182
|
+
the raw response object instead of the parsed content.
|
|
183
|
+
|
|
184
|
+
For more information, see https://www.github.com/chunkifydev/chunkify-analytics-python#accessing-raw-response-data-eg-headers
|
|
185
|
+
"""
|
|
186
|
+
return AsyncKeysResourceWithRawResponse(self)
|
|
187
|
+
|
|
188
|
+
@cached_property
|
|
189
|
+
def with_streaming_response(self) -> AsyncKeysResourceWithStreamingResponse:
|
|
190
|
+
"""
|
|
191
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
192
|
+
|
|
193
|
+
For more information, see https://www.github.com/chunkifydev/chunkify-analytics-python#with_streaming_response
|
|
194
|
+
"""
|
|
195
|
+
return AsyncKeysResourceWithStreamingResponse(self)
|
|
196
|
+
|
|
197
|
+
async def create(
|
|
198
|
+
self,
|
|
199
|
+
*,
|
|
200
|
+
name: str,
|
|
201
|
+
permission: Literal["public", "secret"],
|
|
202
|
+
read_only: bool | Omit = omit,
|
|
203
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
204
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
205
|
+
extra_headers: Headers | None = None,
|
|
206
|
+
extra_query: Query | None = None,
|
|
207
|
+
extra_body: Body | None = None,
|
|
208
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
209
|
+
) -> CreatedProjectKey:
|
|
210
|
+
"""
|
|
211
|
+
Create a named public ingestion key or secret key in the authenticated project.
|
|
212
|
+
Secret keys default to full project access; set read_only to true for analytics
|
|
213
|
+
reads and exports only. Requires a full-access project secret key. Read-only
|
|
214
|
+
keys receive 403 and the installation admin key is not accepted. The key is
|
|
215
|
+
active immediately and its value is returned once; store it before leaving this
|
|
216
|
+
response. Each project supports at most 64 active keys, including its initial
|
|
217
|
+
keys.
|
|
218
|
+
|
|
219
|
+
Args:
|
|
220
|
+
name: Key display name, up to 128 UTF-8 bytes. Whitespace-only names are rejected.
|
|
221
|
+
|
|
222
|
+
read_only: Only secret keys can be read-only. False grants full project management access
|
|
223
|
+
to secret keys; public keys only ingest events.
|
|
224
|
+
|
|
225
|
+
extra_headers: Send extra headers
|
|
226
|
+
|
|
227
|
+
extra_query: Add additional query parameters to the request
|
|
228
|
+
|
|
229
|
+
extra_body: Add additional JSON properties to the request
|
|
230
|
+
|
|
231
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
232
|
+
"""
|
|
233
|
+
return await self._post(
|
|
234
|
+
"/v1/project/keys",
|
|
235
|
+
body=await async_maybe_transform(
|
|
236
|
+
{
|
|
237
|
+
"name": name,
|
|
238
|
+
"permission": permission,
|
|
239
|
+
"read_only": read_only,
|
|
240
|
+
},
|
|
241
|
+
key_create_params.KeyCreateParams,
|
|
242
|
+
),
|
|
243
|
+
options=make_request_options(
|
|
244
|
+
extra_headers=extra_headers,
|
|
245
|
+
extra_query=extra_query,
|
|
246
|
+
extra_body=extra_body,
|
|
247
|
+
timeout=timeout,
|
|
248
|
+
security={"secret_key": True},
|
|
249
|
+
),
|
|
250
|
+
cast_to=CreatedProjectKey,
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
async def list(
|
|
254
|
+
self,
|
|
255
|
+
*,
|
|
256
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
257
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
258
|
+
extra_headers: Headers | None = None,
|
|
259
|
+
extra_query: Query | None = None,
|
|
260
|
+
extra_body: Body | None = None,
|
|
261
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
262
|
+
) -> ProjectKeys:
|
|
263
|
+
"""List key IDs, names, and types.
|
|
264
|
+
|
|
265
|
+
Key values are not returned. Requires a
|
|
266
|
+
full-access private key; read-only keys receive 403.
|
|
267
|
+
"""
|
|
268
|
+
return await self._get(
|
|
269
|
+
"/v1/project/keys",
|
|
270
|
+
options=make_request_options(
|
|
271
|
+
extra_headers=extra_headers,
|
|
272
|
+
extra_query=extra_query,
|
|
273
|
+
extra_body=extra_body,
|
|
274
|
+
timeout=timeout,
|
|
275
|
+
security={"secret_key": True},
|
|
276
|
+
),
|
|
277
|
+
cast_to=ProjectKeys,
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
async def rotate(
|
|
281
|
+
self,
|
|
282
|
+
key_id: str,
|
|
283
|
+
*,
|
|
284
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
285
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
286
|
+
extra_headers: Headers | None = None,
|
|
287
|
+
extra_query: Query | None = None,
|
|
288
|
+
extra_body: Body | None = None,
|
|
289
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
290
|
+
) -> RotatedProjectKey:
|
|
291
|
+
"""Replace a key in this project.
|
|
292
|
+
|
|
293
|
+
The old value stops working immediately. Save the
|
|
294
|
+
returned replacement. Requires a full-access private key; read-only keys
|
|
295
|
+
receive 403. Only the selected key is rotated. If its replacement is lost, a
|
|
296
|
+
trusted backend can rotate it again through the installation admin API.
|
|
297
|
+
|
|
298
|
+
Args:
|
|
299
|
+
extra_headers: Send extra headers
|
|
300
|
+
|
|
301
|
+
extra_query: Add additional query parameters to the request
|
|
302
|
+
|
|
303
|
+
extra_body: Add additional JSON properties to the request
|
|
304
|
+
|
|
305
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
306
|
+
"""
|
|
307
|
+
if not key_id:
|
|
308
|
+
raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}")
|
|
309
|
+
return await self._post(
|
|
310
|
+
path_template("/v1/project/keys/{key_id}/rotate", key_id=key_id),
|
|
311
|
+
options=make_request_options(
|
|
312
|
+
extra_headers=extra_headers,
|
|
313
|
+
extra_query=extra_query,
|
|
314
|
+
extra_body=extra_body,
|
|
315
|
+
timeout=timeout,
|
|
316
|
+
security={"secret_key": True},
|
|
317
|
+
),
|
|
318
|
+
cast_to=RotatedProjectKey,
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
class KeysResourceWithRawResponse:
|
|
323
|
+
def __init__(self, keys: KeysResource) -> None:
|
|
324
|
+
self._keys = keys
|
|
325
|
+
|
|
326
|
+
self.create = to_raw_response_wrapper(
|
|
327
|
+
keys.create,
|
|
328
|
+
)
|
|
329
|
+
self.list = to_raw_response_wrapper(
|
|
330
|
+
keys.list,
|
|
331
|
+
)
|
|
332
|
+
self.rotate = to_raw_response_wrapper(
|
|
333
|
+
keys.rotate,
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
class AsyncKeysResourceWithRawResponse:
|
|
338
|
+
def __init__(self, keys: AsyncKeysResource) -> None:
|
|
339
|
+
self._keys = keys
|
|
340
|
+
|
|
341
|
+
self.create = async_to_raw_response_wrapper(
|
|
342
|
+
keys.create,
|
|
343
|
+
)
|
|
344
|
+
self.list = async_to_raw_response_wrapper(
|
|
345
|
+
keys.list,
|
|
346
|
+
)
|
|
347
|
+
self.rotate = async_to_raw_response_wrapper(
|
|
348
|
+
keys.rotate,
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
class KeysResourceWithStreamingResponse:
|
|
353
|
+
def __init__(self, keys: KeysResource) -> None:
|
|
354
|
+
self._keys = keys
|
|
355
|
+
|
|
356
|
+
self.create = to_streamed_response_wrapper(
|
|
357
|
+
keys.create,
|
|
358
|
+
)
|
|
359
|
+
self.list = to_streamed_response_wrapper(
|
|
360
|
+
keys.list,
|
|
361
|
+
)
|
|
362
|
+
self.rotate = to_streamed_response_wrapper(
|
|
363
|
+
keys.rotate,
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
class AsyncKeysResourceWithStreamingResponse:
|
|
368
|
+
def __init__(self, keys: AsyncKeysResource) -> None:
|
|
369
|
+
self._keys = keys
|
|
370
|
+
|
|
371
|
+
self.create = async_to_streamed_response_wrapper(
|
|
372
|
+
keys.create,
|
|
373
|
+
)
|
|
374
|
+
self.list = async_to_streamed_response_wrapper(
|
|
375
|
+
keys.list,
|
|
376
|
+
)
|
|
377
|
+
self.rotate = async_to_streamed_response_wrapper(
|
|
378
|
+
keys.rotate,
|
|
379
|
+
)
|
|
@@ -0,0 +1,322 @@
|
|
|
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 Optional
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from .keys import (
|
|
10
|
+
KeysResource,
|
|
11
|
+
AsyncKeysResource,
|
|
12
|
+
KeysResourceWithRawResponse,
|
|
13
|
+
AsyncKeysResourceWithRawResponse,
|
|
14
|
+
KeysResourceWithStreamingResponse,
|
|
15
|
+
AsyncKeysResourceWithStreamingResponse,
|
|
16
|
+
)
|
|
17
|
+
from ...types import project_update_params
|
|
18
|
+
from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
|
|
19
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
|
20
|
+
from ..._compat import cached_property
|
|
21
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
22
|
+
from ..._response import (
|
|
23
|
+
to_raw_response_wrapper,
|
|
24
|
+
to_streamed_response_wrapper,
|
|
25
|
+
async_to_raw_response_wrapper,
|
|
26
|
+
async_to_streamed_response_wrapper,
|
|
27
|
+
)
|
|
28
|
+
from ..._base_client import make_request_options
|
|
29
|
+
from ...types.deleted_project import DeletedProject
|
|
30
|
+
from ...types.project.project import Project
|
|
31
|
+
|
|
32
|
+
__all__ = ["ProjectResource", "AsyncProjectResource"]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ProjectResource(SyncAPIResource):
|
|
36
|
+
"""Project origins and keys."""
|
|
37
|
+
|
|
38
|
+
@cached_property
|
|
39
|
+
def keys(self) -> KeysResource:
|
|
40
|
+
"""Project origins and keys."""
|
|
41
|
+
return KeysResource(self._client)
|
|
42
|
+
|
|
43
|
+
@cached_property
|
|
44
|
+
def with_raw_response(self) -> ProjectResourceWithRawResponse:
|
|
45
|
+
"""
|
|
46
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
47
|
+
the raw response object instead of the parsed content.
|
|
48
|
+
|
|
49
|
+
For more information, see https://www.github.com/chunkifydev/chunkify-analytics-python#accessing-raw-response-data-eg-headers
|
|
50
|
+
"""
|
|
51
|
+
return ProjectResourceWithRawResponse(self)
|
|
52
|
+
|
|
53
|
+
@cached_property
|
|
54
|
+
def with_streaming_response(self) -> ProjectResourceWithStreamingResponse:
|
|
55
|
+
"""
|
|
56
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
57
|
+
|
|
58
|
+
For more information, see https://www.github.com/chunkifydev/chunkify-analytics-python#with_streaming_response
|
|
59
|
+
"""
|
|
60
|
+
return ProjectResourceWithStreamingResponse(self)
|
|
61
|
+
|
|
62
|
+
def update(
|
|
63
|
+
self,
|
|
64
|
+
*,
|
|
65
|
+
allowed_origins: SequenceNotStr[str] | Omit = omit,
|
|
66
|
+
name: str | Omit = omit,
|
|
67
|
+
retention_seconds: Optional[int] | Omit = omit,
|
|
68
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
69
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
70
|
+
extra_headers: Headers | None = None,
|
|
71
|
+
extra_query: Query | None = None,
|
|
72
|
+
extra_body: Body | None = None,
|
|
73
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
74
|
+
) -> Project:
|
|
75
|
+
"""Update the name, additional origins or retention of your project.
|
|
76
|
+
|
|
77
|
+
Omitted fields
|
|
78
|
+
stay unchanged. Set retention_seconds to null to inherit the installation
|
|
79
|
+
default, or 0 to disable expiration. Changes apply to existing and new events
|
|
80
|
+
without a restart. Requires a full-access private key; read-only keys
|
|
81
|
+
receive 403.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
allowed_origins: Additional project origins. Shared TOML origins are always included.
|
|
85
|
+
|
|
86
|
+
retention_seconds: Retention by server receipt time, in seconds. 0 disables expiration; null
|
|
87
|
+
inherits the installation default. Omission leaves the current setting
|
|
88
|
+
unchanged. Applies to existing and new events; removed data cannot be recovered.
|
|
89
|
+
|
|
90
|
+
extra_headers: Send extra headers
|
|
91
|
+
|
|
92
|
+
extra_query: Add additional query parameters to the request
|
|
93
|
+
|
|
94
|
+
extra_body: Add additional JSON properties to the request
|
|
95
|
+
|
|
96
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
97
|
+
"""
|
|
98
|
+
return self._patch(
|
|
99
|
+
"/v1/project",
|
|
100
|
+
body=maybe_transform(
|
|
101
|
+
{
|
|
102
|
+
"allowed_origins": allowed_origins,
|
|
103
|
+
"name": name,
|
|
104
|
+
"retention_seconds": retention_seconds,
|
|
105
|
+
},
|
|
106
|
+
project_update_params.ProjectUpdateParams,
|
|
107
|
+
),
|
|
108
|
+
options=make_request_options(
|
|
109
|
+
extra_headers=extra_headers,
|
|
110
|
+
extra_query=extra_query,
|
|
111
|
+
extra_body=extra_body,
|
|
112
|
+
timeout=timeout,
|
|
113
|
+
security={"secret_key": True},
|
|
114
|
+
),
|
|
115
|
+
cast_to=Project,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
def delete(
|
|
119
|
+
self,
|
|
120
|
+
*,
|
|
121
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
122
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
123
|
+
extra_headers: Headers | None = None,
|
|
124
|
+
extra_query: Query | None = None,
|
|
125
|
+
extra_body: Body | None = None,
|
|
126
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
127
|
+
) -> DeletedProject:
|
|
128
|
+
"""Revoke all project keys.
|
|
129
|
+
|
|
130
|
+
Stored events remain until their retention expires.
|
|
131
|
+
Requires a full-access private key; read-only keys receive 403.
|
|
132
|
+
"""
|
|
133
|
+
return self._delete(
|
|
134
|
+
"/v1/project",
|
|
135
|
+
options=make_request_options(
|
|
136
|
+
extra_headers=extra_headers,
|
|
137
|
+
extra_query=extra_query,
|
|
138
|
+
extra_body=extra_body,
|
|
139
|
+
timeout=timeout,
|
|
140
|
+
security={"secret_key": True},
|
|
141
|
+
),
|
|
142
|
+
cast_to=DeletedProject,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class AsyncProjectResource(AsyncAPIResource):
|
|
147
|
+
"""Project origins and keys."""
|
|
148
|
+
|
|
149
|
+
@cached_property
|
|
150
|
+
def keys(self) -> AsyncKeysResource:
|
|
151
|
+
"""Project origins and keys."""
|
|
152
|
+
return AsyncKeysResource(self._client)
|
|
153
|
+
|
|
154
|
+
@cached_property
|
|
155
|
+
def with_raw_response(self) -> AsyncProjectResourceWithRawResponse:
|
|
156
|
+
"""
|
|
157
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
158
|
+
the raw response object instead of the parsed content.
|
|
159
|
+
|
|
160
|
+
For more information, see https://www.github.com/chunkifydev/chunkify-analytics-python#accessing-raw-response-data-eg-headers
|
|
161
|
+
"""
|
|
162
|
+
return AsyncProjectResourceWithRawResponse(self)
|
|
163
|
+
|
|
164
|
+
@cached_property
|
|
165
|
+
def with_streaming_response(self) -> AsyncProjectResourceWithStreamingResponse:
|
|
166
|
+
"""
|
|
167
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
168
|
+
|
|
169
|
+
For more information, see https://www.github.com/chunkifydev/chunkify-analytics-python#with_streaming_response
|
|
170
|
+
"""
|
|
171
|
+
return AsyncProjectResourceWithStreamingResponse(self)
|
|
172
|
+
|
|
173
|
+
async def update(
|
|
174
|
+
self,
|
|
175
|
+
*,
|
|
176
|
+
allowed_origins: SequenceNotStr[str] | Omit = omit,
|
|
177
|
+
name: str | Omit = omit,
|
|
178
|
+
retention_seconds: Optional[int] | Omit = omit,
|
|
179
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
180
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
181
|
+
extra_headers: Headers | None = None,
|
|
182
|
+
extra_query: Query | None = None,
|
|
183
|
+
extra_body: Body | None = None,
|
|
184
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
185
|
+
) -> Project:
|
|
186
|
+
"""Update the name, additional origins or retention of your project.
|
|
187
|
+
|
|
188
|
+
Omitted fields
|
|
189
|
+
stay unchanged. Set retention_seconds to null to inherit the installation
|
|
190
|
+
default, or 0 to disable expiration. Changes apply to existing and new events
|
|
191
|
+
without a restart. Requires a full-access private key; read-only keys
|
|
192
|
+
receive 403.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
allowed_origins: Additional project origins. Shared TOML origins are always included.
|
|
196
|
+
|
|
197
|
+
retention_seconds: Retention by server receipt time, in seconds. 0 disables expiration; null
|
|
198
|
+
inherits the installation default. Omission leaves the current setting
|
|
199
|
+
unchanged. Applies to existing and new events; removed data cannot be recovered.
|
|
200
|
+
|
|
201
|
+
extra_headers: Send extra headers
|
|
202
|
+
|
|
203
|
+
extra_query: Add additional query parameters to the request
|
|
204
|
+
|
|
205
|
+
extra_body: Add additional JSON properties to the request
|
|
206
|
+
|
|
207
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
208
|
+
"""
|
|
209
|
+
return await self._patch(
|
|
210
|
+
"/v1/project",
|
|
211
|
+
body=await async_maybe_transform(
|
|
212
|
+
{
|
|
213
|
+
"allowed_origins": allowed_origins,
|
|
214
|
+
"name": name,
|
|
215
|
+
"retention_seconds": retention_seconds,
|
|
216
|
+
},
|
|
217
|
+
project_update_params.ProjectUpdateParams,
|
|
218
|
+
),
|
|
219
|
+
options=make_request_options(
|
|
220
|
+
extra_headers=extra_headers,
|
|
221
|
+
extra_query=extra_query,
|
|
222
|
+
extra_body=extra_body,
|
|
223
|
+
timeout=timeout,
|
|
224
|
+
security={"secret_key": True},
|
|
225
|
+
),
|
|
226
|
+
cast_to=Project,
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
async def delete(
|
|
230
|
+
self,
|
|
231
|
+
*,
|
|
232
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
233
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
234
|
+
extra_headers: Headers | None = None,
|
|
235
|
+
extra_query: Query | None = None,
|
|
236
|
+
extra_body: Body | None = None,
|
|
237
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
238
|
+
) -> DeletedProject:
|
|
239
|
+
"""Revoke all project keys.
|
|
240
|
+
|
|
241
|
+
Stored events remain until their retention expires.
|
|
242
|
+
Requires a full-access private key; read-only keys receive 403.
|
|
243
|
+
"""
|
|
244
|
+
return await self._delete(
|
|
245
|
+
"/v1/project",
|
|
246
|
+
options=make_request_options(
|
|
247
|
+
extra_headers=extra_headers,
|
|
248
|
+
extra_query=extra_query,
|
|
249
|
+
extra_body=extra_body,
|
|
250
|
+
timeout=timeout,
|
|
251
|
+
security={"secret_key": True},
|
|
252
|
+
),
|
|
253
|
+
cast_to=DeletedProject,
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
class ProjectResourceWithRawResponse:
|
|
258
|
+
def __init__(self, project: ProjectResource) -> None:
|
|
259
|
+
self._project = project
|
|
260
|
+
|
|
261
|
+
self.update = to_raw_response_wrapper(
|
|
262
|
+
project.update,
|
|
263
|
+
)
|
|
264
|
+
self.delete = to_raw_response_wrapper(
|
|
265
|
+
project.delete,
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
@cached_property
|
|
269
|
+
def keys(self) -> KeysResourceWithRawResponse:
|
|
270
|
+
"""Project origins and keys."""
|
|
271
|
+
return KeysResourceWithRawResponse(self._project.keys)
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
class AsyncProjectResourceWithRawResponse:
|
|
275
|
+
def __init__(self, project: AsyncProjectResource) -> None:
|
|
276
|
+
self._project = project
|
|
277
|
+
|
|
278
|
+
self.update = async_to_raw_response_wrapper(
|
|
279
|
+
project.update,
|
|
280
|
+
)
|
|
281
|
+
self.delete = async_to_raw_response_wrapper(
|
|
282
|
+
project.delete,
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
@cached_property
|
|
286
|
+
def keys(self) -> AsyncKeysResourceWithRawResponse:
|
|
287
|
+
"""Project origins and keys."""
|
|
288
|
+
return AsyncKeysResourceWithRawResponse(self._project.keys)
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
class ProjectResourceWithStreamingResponse:
|
|
292
|
+
def __init__(self, project: ProjectResource) -> None:
|
|
293
|
+
self._project = project
|
|
294
|
+
|
|
295
|
+
self.update = to_streamed_response_wrapper(
|
|
296
|
+
project.update,
|
|
297
|
+
)
|
|
298
|
+
self.delete = to_streamed_response_wrapper(
|
|
299
|
+
project.delete,
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
@cached_property
|
|
303
|
+
def keys(self) -> KeysResourceWithStreamingResponse:
|
|
304
|
+
"""Project origins and keys."""
|
|
305
|
+
return KeysResourceWithStreamingResponse(self._project.keys)
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
class AsyncProjectResourceWithStreamingResponse:
|
|
309
|
+
def __init__(self, project: AsyncProjectResource) -> None:
|
|
310
|
+
self._project = project
|
|
311
|
+
|
|
312
|
+
self.update = async_to_streamed_response_wrapper(
|
|
313
|
+
project.update,
|
|
314
|
+
)
|
|
315
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
316
|
+
project.delete,
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
@cached_property
|
|
320
|
+
def keys(self) -> AsyncKeysResourceWithStreamingResponse:
|
|
321
|
+
"""Project origins and keys."""
|
|
322
|
+
return AsyncKeysResourceWithStreamingResponse(self._project.keys)
|