openmeter 1.0.0b54__py3-none-any.whl → 2.0.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.
Potentially problematic release.
This version of openmeter might be problematic. Click here for more details.
- openmeter/__init__.py +89 -15
- openmeter/_base_client.py +2041 -0
- openmeter/_client.py +518 -70
- openmeter/_compat.py +221 -0
- openmeter/_constants.py +14 -0
- openmeter/_exceptions.py +108 -0
- openmeter/_files.py +127 -0
- openmeter/_models.py +777 -0
- openmeter/_qs.py +150 -0
- openmeter/_resource.py +43 -0
- openmeter/_response.py +820 -0
- openmeter/_streaming.py +333 -0
- openmeter/_types.py +222 -0
- openmeter/_utils/__init__.py +56 -0
- openmeter/_utils/_logs.py +25 -0
- openmeter/_utils/_proxy.py +63 -0
- openmeter/_utils/_reflection.py +42 -0
- openmeter/_utils/_streams.py +12 -0
- openmeter/_utils/_sync.py +81 -0
- openmeter/_utils/_transform.py +387 -0
- openmeter/_utils/_typing.py +120 -0
- openmeter/_utils/_utils.py +419 -0
- openmeter/_version.py +4 -0
- openmeter/lib/.keep +4 -0
- openmeter/py.typed +0 -1
- openmeter/resources/__init__.py +103 -0
- openmeter/resources/debug/__init__.py +33 -0
- openmeter/resources/debug/debug.py +102 -0
- openmeter/resources/debug/metrics.py +146 -0
- openmeter/resources/entitlements/__init__.py +47 -0
- openmeter/resources/entitlements/entitlements.py +450 -0
- openmeter/resources/entitlements/features.py +578 -0
- openmeter/resources/entitlements/grants.py +389 -0
- openmeter/resources/events.py +442 -0
- openmeter/resources/meters/__init__.py +33 -0
- openmeter/resources/meters/meters.py +666 -0
- openmeter/resources/meters/subjects.py +163 -0
- openmeter/resources/notifications/__init__.py +75 -0
- openmeter/resources/notifications/channels.py +686 -0
- openmeter/resources/notifications/events.py +365 -0
- openmeter/resources/notifications/notifications.py +198 -0
- openmeter/resources/notifications/rules.py +781 -0
- openmeter/resources/notifications/webhook.py +208 -0
- openmeter/resources/portal/__init__.py +47 -0
- openmeter/resources/portal/meters.py +230 -0
- openmeter/resources/portal/portal.py +112 -0
- openmeter/resources/portal/tokens.py +359 -0
- openmeter/resources/subjects/entitlements/__init__.py +33 -0
- openmeter/resources/subjects/entitlements/entitlements.py +1881 -0
- openmeter/resources/subjects/entitlements/grants.py +453 -0
- openmeter/resources/subjects.py +419 -0
- openmeter/types/__init__.py +21 -0
- openmeter/types/debug/__init__.py +5 -0
- openmeter/types/debug/metric_list_response.py +7 -0
- openmeter/types/entitlement.py +238 -0
- openmeter/types/entitlements/__init__.py +11 -0
- openmeter/types/entitlements/feature.py +61 -0
- openmeter/types/entitlements/feature_create_params.py +43 -0
- openmeter/types/entitlements/feature_list_params.py +23 -0
- openmeter/types/entitlements/grant_list_params.py +57 -0
- openmeter/types/entitlements/grant_list_response.py +11 -0
- openmeter/types/entitlements/grant_paginated_response.py +24 -0
- openmeter/types/entitlements/list_features_result.py +28 -0
- openmeter/types/event_ingest_params.py +46 -0
- openmeter/types/event_ingest_response.py +43 -0
- openmeter/types/event_list_params.py +22 -0
- openmeter/types/event_list_response.py +9 -0
- openmeter/types/ingested_event.py +59 -0
- openmeter/types/list_entitlements_result.py +28 -0
- openmeter/types/meter.py +53 -0
- openmeter/types/meter_create_params.py +50 -0
- openmeter/types/meter_list_response.py +9 -0
- openmeter/types/meter_query_params.py +50 -0
- openmeter/types/meter_query_result.py +35 -0
- openmeter/types/meters/__init__.py +5 -0
- openmeter/types/meters/subject_list_response.py +8 -0
- openmeter/types/notifications/__init__.py +18 -0
- openmeter/types/notifications/channel_create_params.py +34 -0
- openmeter/types/notifications/channel_list_params.py +41 -0
- openmeter/types/notifications/channel_list_response.py +24 -0
- openmeter/types/notifications/channel_update_params.py +34 -0
- openmeter/types/notifications/event_list_params.py +61 -0
- openmeter/types/notifications/event_list_response.py +24 -0
- openmeter/types/notifications/notification_channel.py +47 -0
- openmeter/types/notifications/notification_event.py +215 -0
- openmeter/types/notifications/notification_rule.py +70 -0
- openmeter/types/notifications/rule_create_params.py +39 -0
- openmeter/types/notifications/rule_list_params.py +54 -0
- openmeter/types/notifications/rule_list_response.py +24 -0
- openmeter/types/notifications/rule_update_params.py +39 -0
- openmeter/types/notifications/webhook_svix_params.py +26 -0
- openmeter/types/portal/__init__.py +10 -0
- openmeter/types/portal/meter_query_params.py +44 -0
- openmeter/types/portal/portal_token.py +28 -0
- openmeter/types/portal/token_create_params.py +17 -0
- openmeter/types/portal/token_invalidate_params.py +15 -0
- openmeter/types/portal/token_list_params.py +12 -0
- openmeter/types/portal/token_list_response.py +9 -0
- openmeter/types/shared/__init__.py +3 -0
- openmeter/types/subject.py +37 -0
- openmeter/types/subject_list_response.py +9 -0
- openmeter/types/subject_param.py +27 -0
- openmeter/types/subject_upsert_params.py +39 -0
- openmeter/types/subject_upsert_response.py +10 -0
- openmeter/types/subjects/__init__.py +13 -0
- openmeter/types/subjects/entitlement_history_params.py +35 -0
- openmeter/types/subjects/entitlement_history_response.py +98 -0
- openmeter/types/subjects/entitlement_list_response.py +10 -0
- openmeter/types/subjects/entitlements/__init__.py +8 -0
- openmeter/types/subjects/entitlements/entitlement_grant.py +103 -0
- openmeter/types/subjects/entitlements/grant_list_response.py +10 -0
- openmeter-2.0.0.dist-info/METADATA +396 -0
- openmeter-2.0.0.dist-info/RECORD +115 -0
- {openmeter-1.0.0b54.dist-info → openmeter-2.0.0.dist-info}/WHEEL +1 -1
- openmeter-2.0.0.dist-info/licenses/LICENSE +201 -0
- openmeter/_configuration.py +0 -36
- openmeter/_operations/__init__.py +0 -17
- openmeter/_operations/_operations.py +0 -2105
- openmeter/_operations/_patch.py +0 -20
- openmeter/_patch.py +0 -20
- openmeter/_serialization.py +0 -2008
- openmeter/_vendor.py +0 -24
- openmeter/aio/__init__.py +0 -21
- openmeter/aio/_client.py +0 -83
- openmeter/aio/_configuration.py +0 -36
- openmeter/aio/_operations/__init__.py +0 -17
- openmeter/aio/_operations/_operations.py +0 -1778
- openmeter/aio/_operations/_patch.py +0 -20
- openmeter/aio/_patch.py +0 -20
- openmeter/aio/_vendor.py +0 -24
- openmeter-1.0.0b54.dist-info/METADATA +0 -92
- openmeter-1.0.0b54.dist-info/RECORD +0 -21
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Union, Optional
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..types import event_list_params, event_ingest_params
|
|
11
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
12
|
+
from .._utils import (
|
|
13
|
+
maybe_transform,
|
|
14
|
+
async_maybe_transform,
|
|
15
|
+
)
|
|
16
|
+
from .._compat import cached_property
|
|
17
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
18
|
+
from .._response import (
|
|
19
|
+
to_raw_response_wrapper,
|
|
20
|
+
to_streamed_response_wrapper,
|
|
21
|
+
async_to_raw_response_wrapper,
|
|
22
|
+
async_to_streamed_response_wrapper,
|
|
23
|
+
)
|
|
24
|
+
from .._base_client import make_request_options
|
|
25
|
+
from ..types.event_list_response import EventListResponse
|
|
26
|
+
from ..types.event_ingest_response import EventIngestResponse
|
|
27
|
+
|
|
28
|
+
__all__ = ["EventsResource", "AsyncEventsResource"]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class EventsResource(SyncAPIResource):
|
|
32
|
+
@cached_property
|
|
33
|
+
def with_raw_response(self) -> EventsResourceWithRawResponse:
|
|
34
|
+
"""
|
|
35
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
36
|
+
the raw response object instead of the parsed content.
|
|
37
|
+
|
|
38
|
+
For more information, see https://www.github.com/openmeterio/openmeter-python#accessing-raw-response-data-eg-headers
|
|
39
|
+
"""
|
|
40
|
+
return EventsResourceWithRawResponse(self)
|
|
41
|
+
|
|
42
|
+
@cached_property
|
|
43
|
+
def with_streaming_response(self) -> EventsResourceWithStreamingResponse:
|
|
44
|
+
"""
|
|
45
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
46
|
+
|
|
47
|
+
For more information, see https://www.github.com/openmeterio/openmeter-python#with_streaming_response
|
|
48
|
+
"""
|
|
49
|
+
return EventsResourceWithStreamingResponse(self)
|
|
50
|
+
|
|
51
|
+
def list(
|
|
52
|
+
self,
|
|
53
|
+
*,
|
|
54
|
+
id: str | NotGiven = NOT_GIVEN,
|
|
55
|
+
from_: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
56
|
+
has_error: bool | NotGiven = NOT_GIVEN,
|
|
57
|
+
ingested_at_from: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
58
|
+
ingested_at_to: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
59
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
60
|
+
subject: str | NotGiven = NOT_GIVEN,
|
|
61
|
+
to: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
62
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
63
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
64
|
+
extra_headers: Headers | None = None,
|
|
65
|
+
extra_query: Query | None = None,
|
|
66
|
+
extra_body: Body | None = None,
|
|
67
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
68
|
+
) -> EventListResponse:
|
|
69
|
+
"""
|
|
70
|
+
List ingested events within a time range.
|
|
71
|
+
|
|
72
|
+
If the from query param is not provided it defaults to last 72 hours.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
id: The event ID.
|
|
76
|
+
|
|
77
|
+
Accepts partial ID.
|
|
78
|
+
|
|
79
|
+
from_: Start date-time in RFC 3339 format.
|
|
80
|
+
|
|
81
|
+
Inclusive.
|
|
82
|
+
|
|
83
|
+
has_error: If not provided lists all events.
|
|
84
|
+
|
|
85
|
+
If provided with true, only list events with processing error.
|
|
86
|
+
|
|
87
|
+
If provided with false, only list events without processing error.
|
|
88
|
+
|
|
89
|
+
ingested_at_from: Start date-time in RFC 3339 format.
|
|
90
|
+
|
|
91
|
+
Inclusive.
|
|
92
|
+
|
|
93
|
+
ingested_at_to: End date-time in RFC 3339 format.
|
|
94
|
+
|
|
95
|
+
Inclusive.
|
|
96
|
+
|
|
97
|
+
limit: Number of events to return.
|
|
98
|
+
|
|
99
|
+
subject: The event subject.
|
|
100
|
+
|
|
101
|
+
Accepts partial subject.
|
|
102
|
+
|
|
103
|
+
to: End date-time in RFC 3339 format.
|
|
104
|
+
|
|
105
|
+
Inclusive.
|
|
106
|
+
|
|
107
|
+
extra_headers: Send extra headers
|
|
108
|
+
|
|
109
|
+
extra_query: Add additional query parameters to the request
|
|
110
|
+
|
|
111
|
+
extra_body: Add additional JSON properties to the request
|
|
112
|
+
|
|
113
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
114
|
+
"""
|
|
115
|
+
return self._get(
|
|
116
|
+
"/api/v1/events",
|
|
117
|
+
options=make_request_options(
|
|
118
|
+
extra_headers=extra_headers,
|
|
119
|
+
extra_query=extra_query,
|
|
120
|
+
extra_body=extra_body,
|
|
121
|
+
timeout=timeout,
|
|
122
|
+
query=maybe_transform(
|
|
123
|
+
{
|
|
124
|
+
"id": id,
|
|
125
|
+
"from_": from_,
|
|
126
|
+
"has_error": has_error,
|
|
127
|
+
"ingested_at_from": ingested_at_from,
|
|
128
|
+
"ingested_at_to": ingested_at_to,
|
|
129
|
+
"limit": limit,
|
|
130
|
+
"subject": subject,
|
|
131
|
+
"to": to,
|
|
132
|
+
},
|
|
133
|
+
event_list_params.EventListParams,
|
|
134
|
+
),
|
|
135
|
+
),
|
|
136
|
+
cast_to=EventListResponse,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
def ingest(
|
|
140
|
+
self,
|
|
141
|
+
*,
|
|
142
|
+
id: str,
|
|
143
|
+
source: str,
|
|
144
|
+
specversion: str,
|
|
145
|
+
subject: str,
|
|
146
|
+
type: str,
|
|
147
|
+
data: Union[str, object, None] | NotGiven = NOT_GIVEN,
|
|
148
|
+
datacontenttype: Optional[str] | NotGiven = NOT_GIVEN,
|
|
149
|
+
dataschema: Optional[str] | NotGiven = NOT_GIVEN,
|
|
150
|
+
time: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
151
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
152
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
153
|
+
extra_headers: Headers | None = None,
|
|
154
|
+
extra_query: Query | None = None,
|
|
155
|
+
extra_body: Body | None = None,
|
|
156
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
157
|
+
) -> EventIngestResponse:
|
|
158
|
+
"""
|
|
159
|
+
Ingests an event or batch of events following the CloudEvents specification.
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
id: Identifies the event.
|
|
163
|
+
|
|
164
|
+
source: Identifies the context in which an event happened.
|
|
165
|
+
|
|
166
|
+
specversion: The version of the CloudEvents specification which the event uses.
|
|
167
|
+
|
|
168
|
+
subject: Describes the subject of the event in the context of the event producer
|
|
169
|
+
(identified by source).
|
|
170
|
+
|
|
171
|
+
type: Contains a value describing the type of event related to the originating
|
|
172
|
+
occurrence.
|
|
173
|
+
|
|
174
|
+
data: The event payload.
|
|
175
|
+
|
|
176
|
+
datacontenttype: Content type of the data value. Must adhere to RFC 2046 format.
|
|
177
|
+
|
|
178
|
+
dataschema: Identifies the schema that data adheres to.
|
|
179
|
+
|
|
180
|
+
time: Timestamp of when the occurrence happened. Must adhere to RFC 3339.
|
|
181
|
+
|
|
182
|
+
extra_headers: Send extra headers
|
|
183
|
+
|
|
184
|
+
extra_query: Add additional query parameters to the request
|
|
185
|
+
|
|
186
|
+
extra_body: Add additional JSON properties to the request
|
|
187
|
+
|
|
188
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
189
|
+
"""
|
|
190
|
+
extra_headers = {"Accept": "application/cloudevents+json", **(extra_headers or {})}
|
|
191
|
+
return self._post(
|
|
192
|
+
"/api/v1/events",
|
|
193
|
+
body=maybe_transform(
|
|
194
|
+
{
|
|
195
|
+
"id": id,
|
|
196
|
+
"source": source,
|
|
197
|
+
"specversion": specversion,
|
|
198
|
+
"subject": subject,
|
|
199
|
+
"type": type,
|
|
200
|
+
"data": data,
|
|
201
|
+
"datacontenttype": datacontenttype,
|
|
202
|
+
"dataschema": dataschema,
|
|
203
|
+
"time": time,
|
|
204
|
+
},
|
|
205
|
+
event_ingest_params.EventIngestParams,
|
|
206
|
+
),
|
|
207
|
+
options=make_request_options(
|
|
208
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
209
|
+
),
|
|
210
|
+
cast_to=EventIngestResponse,
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class AsyncEventsResource(AsyncAPIResource):
|
|
215
|
+
@cached_property
|
|
216
|
+
def with_raw_response(self) -> AsyncEventsResourceWithRawResponse:
|
|
217
|
+
"""
|
|
218
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
219
|
+
the raw response object instead of the parsed content.
|
|
220
|
+
|
|
221
|
+
For more information, see https://www.github.com/openmeterio/openmeter-python#accessing-raw-response-data-eg-headers
|
|
222
|
+
"""
|
|
223
|
+
return AsyncEventsResourceWithRawResponse(self)
|
|
224
|
+
|
|
225
|
+
@cached_property
|
|
226
|
+
def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse:
|
|
227
|
+
"""
|
|
228
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
229
|
+
|
|
230
|
+
For more information, see https://www.github.com/openmeterio/openmeter-python#with_streaming_response
|
|
231
|
+
"""
|
|
232
|
+
return AsyncEventsResourceWithStreamingResponse(self)
|
|
233
|
+
|
|
234
|
+
async def list(
|
|
235
|
+
self,
|
|
236
|
+
*,
|
|
237
|
+
id: str | NotGiven = NOT_GIVEN,
|
|
238
|
+
from_: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
239
|
+
has_error: bool | NotGiven = NOT_GIVEN,
|
|
240
|
+
ingested_at_from: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
241
|
+
ingested_at_to: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
242
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
243
|
+
subject: str | NotGiven = NOT_GIVEN,
|
|
244
|
+
to: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
245
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
246
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
247
|
+
extra_headers: Headers | None = None,
|
|
248
|
+
extra_query: Query | None = None,
|
|
249
|
+
extra_body: Body | None = None,
|
|
250
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
251
|
+
) -> EventListResponse:
|
|
252
|
+
"""
|
|
253
|
+
List ingested events within a time range.
|
|
254
|
+
|
|
255
|
+
If the from query param is not provided it defaults to last 72 hours.
|
|
256
|
+
|
|
257
|
+
Args:
|
|
258
|
+
id: The event ID.
|
|
259
|
+
|
|
260
|
+
Accepts partial ID.
|
|
261
|
+
|
|
262
|
+
from_: Start date-time in RFC 3339 format.
|
|
263
|
+
|
|
264
|
+
Inclusive.
|
|
265
|
+
|
|
266
|
+
has_error: If not provided lists all events.
|
|
267
|
+
|
|
268
|
+
If provided with true, only list events with processing error.
|
|
269
|
+
|
|
270
|
+
If provided with false, only list events without processing error.
|
|
271
|
+
|
|
272
|
+
ingested_at_from: Start date-time in RFC 3339 format.
|
|
273
|
+
|
|
274
|
+
Inclusive.
|
|
275
|
+
|
|
276
|
+
ingested_at_to: End date-time in RFC 3339 format.
|
|
277
|
+
|
|
278
|
+
Inclusive.
|
|
279
|
+
|
|
280
|
+
limit: Number of events to return.
|
|
281
|
+
|
|
282
|
+
subject: The event subject.
|
|
283
|
+
|
|
284
|
+
Accepts partial subject.
|
|
285
|
+
|
|
286
|
+
to: End date-time in RFC 3339 format.
|
|
287
|
+
|
|
288
|
+
Inclusive.
|
|
289
|
+
|
|
290
|
+
extra_headers: Send extra headers
|
|
291
|
+
|
|
292
|
+
extra_query: Add additional query parameters to the request
|
|
293
|
+
|
|
294
|
+
extra_body: Add additional JSON properties to the request
|
|
295
|
+
|
|
296
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
297
|
+
"""
|
|
298
|
+
return await self._get(
|
|
299
|
+
"/api/v1/events",
|
|
300
|
+
options=make_request_options(
|
|
301
|
+
extra_headers=extra_headers,
|
|
302
|
+
extra_query=extra_query,
|
|
303
|
+
extra_body=extra_body,
|
|
304
|
+
timeout=timeout,
|
|
305
|
+
query=await async_maybe_transform(
|
|
306
|
+
{
|
|
307
|
+
"id": id,
|
|
308
|
+
"from_": from_,
|
|
309
|
+
"has_error": has_error,
|
|
310
|
+
"ingested_at_from": ingested_at_from,
|
|
311
|
+
"ingested_at_to": ingested_at_to,
|
|
312
|
+
"limit": limit,
|
|
313
|
+
"subject": subject,
|
|
314
|
+
"to": to,
|
|
315
|
+
},
|
|
316
|
+
event_list_params.EventListParams,
|
|
317
|
+
),
|
|
318
|
+
),
|
|
319
|
+
cast_to=EventListResponse,
|
|
320
|
+
)
|
|
321
|
+
|
|
322
|
+
async def ingest(
|
|
323
|
+
self,
|
|
324
|
+
*,
|
|
325
|
+
id: str,
|
|
326
|
+
source: str,
|
|
327
|
+
specversion: str,
|
|
328
|
+
subject: str,
|
|
329
|
+
type: str,
|
|
330
|
+
data: Union[str, object, None] | NotGiven = NOT_GIVEN,
|
|
331
|
+
datacontenttype: Optional[str] | NotGiven = NOT_GIVEN,
|
|
332
|
+
dataschema: Optional[str] | NotGiven = NOT_GIVEN,
|
|
333
|
+
time: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
334
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
335
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
336
|
+
extra_headers: Headers | None = None,
|
|
337
|
+
extra_query: Query | None = None,
|
|
338
|
+
extra_body: Body | None = None,
|
|
339
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
340
|
+
) -> EventIngestResponse:
|
|
341
|
+
"""
|
|
342
|
+
Ingests an event or batch of events following the CloudEvents specification.
|
|
343
|
+
|
|
344
|
+
Args:
|
|
345
|
+
id: Identifies the event.
|
|
346
|
+
|
|
347
|
+
source: Identifies the context in which an event happened.
|
|
348
|
+
|
|
349
|
+
specversion: The version of the CloudEvents specification which the event uses.
|
|
350
|
+
|
|
351
|
+
subject: Describes the subject of the event in the context of the event producer
|
|
352
|
+
(identified by source).
|
|
353
|
+
|
|
354
|
+
type: Contains a value describing the type of event related to the originating
|
|
355
|
+
occurrence.
|
|
356
|
+
|
|
357
|
+
data: The event payload.
|
|
358
|
+
|
|
359
|
+
datacontenttype: Content type of the data value. Must adhere to RFC 2046 format.
|
|
360
|
+
|
|
361
|
+
dataschema: Identifies the schema that data adheres to.
|
|
362
|
+
|
|
363
|
+
time: Timestamp of when the occurrence happened. Must adhere to RFC 3339.
|
|
364
|
+
|
|
365
|
+
extra_headers: Send extra headers
|
|
366
|
+
|
|
367
|
+
extra_query: Add additional query parameters to the request
|
|
368
|
+
|
|
369
|
+
extra_body: Add additional JSON properties to the request
|
|
370
|
+
|
|
371
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
372
|
+
"""
|
|
373
|
+
extra_headers = {"Accept": "application/cloudevents+json", **(extra_headers or {})}
|
|
374
|
+
return await self._post(
|
|
375
|
+
"/api/v1/events",
|
|
376
|
+
body=await async_maybe_transform(
|
|
377
|
+
{
|
|
378
|
+
"id": id,
|
|
379
|
+
"source": source,
|
|
380
|
+
"specversion": specversion,
|
|
381
|
+
"subject": subject,
|
|
382
|
+
"type": type,
|
|
383
|
+
"data": data,
|
|
384
|
+
"datacontenttype": datacontenttype,
|
|
385
|
+
"dataschema": dataschema,
|
|
386
|
+
"time": time,
|
|
387
|
+
},
|
|
388
|
+
event_ingest_params.EventIngestParams,
|
|
389
|
+
),
|
|
390
|
+
options=make_request_options(
|
|
391
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
392
|
+
),
|
|
393
|
+
cast_to=EventIngestResponse,
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
class EventsResourceWithRawResponse:
|
|
398
|
+
def __init__(self, events: EventsResource) -> None:
|
|
399
|
+
self._events = events
|
|
400
|
+
|
|
401
|
+
self.list = to_raw_response_wrapper(
|
|
402
|
+
events.list,
|
|
403
|
+
)
|
|
404
|
+
self.ingest = to_raw_response_wrapper(
|
|
405
|
+
events.ingest,
|
|
406
|
+
)
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
class AsyncEventsResourceWithRawResponse:
|
|
410
|
+
def __init__(self, events: AsyncEventsResource) -> None:
|
|
411
|
+
self._events = events
|
|
412
|
+
|
|
413
|
+
self.list = async_to_raw_response_wrapper(
|
|
414
|
+
events.list,
|
|
415
|
+
)
|
|
416
|
+
self.ingest = async_to_raw_response_wrapper(
|
|
417
|
+
events.ingest,
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
class EventsResourceWithStreamingResponse:
|
|
422
|
+
def __init__(self, events: EventsResource) -> None:
|
|
423
|
+
self._events = events
|
|
424
|
+
|
|
425
|
+
self.list = to_streamed_response_wrapper(
|
|
426
|
+
events.list,
|
|
427
|
+
)
|
|
428
|
+
self.ingest = to_streamed_response_wrapper(
|
|
429
|
+
events.ingest,
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
class AsyncEventsResourceWithStreamingResponse:
|
|
434
|
+
def __init__(self, events: AsyncEventsResource) -> None:
|
|
435
|
+
self._events = events
|
|
436
|
+
|
|
437
|
+
self.list = async_to_streamed_response_wrapper(
|
|
438
|
+
events.list,
|
|
439
|
+
)
|
|
440
|
+
self.ingest = async_to_streamed_response_wrapper(
|
|
441
|
+
events.ingest,
|
|
442
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .meters import (
|
|
4
|
+
MetersResource,
|
|
5
|
+
AsyncMetersResource,
|
|
6
|
+
MetersResourceWithRawResponse,
|
|
7
|
+
AsyncMetersResourceWithRawResponse,
|
|
8
|
+
MetersResourceWithStreamingResponse,
|
|
9
|
+
AsyncMetersResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
11
|
+
from .subjects import (
|
|
12
|
+
SubjectsResource,
|
|
13
|
+
AsyncSubjectsResource,
|
|
14
|
+
SubjectsResourceWithRawResponse,
|
|
15
|
+
AsyncSubjectsResourceWithRawResponse,
|
|
16
|
+
SubjectsResourceWithStreamingResponse,
|
|
17
|
+
AsyncSubjectsResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"SubjectsResource",
|
|
22
|
+
"AsyncSubjectsResource",
|
|
23
|
+
"SubjectsResourceWithRawResponse",
|
|
24
|
+
"AsyncSubjectsResourceWithRawResponse",
|
|
25
|
+
"SubjectsResourceWithStreamingResponse",
|
|
26
|
+
"AsyncSubjectsResourceWithStreamingResponse",
|
|
27
|
+
"MetersResource",
|
|
28
|
+
"AsyncMetersResource",
|
|
29
|
+
"MetersResourceWithRawResponse",
|
|
30
|
+
"AsyncMetersResourceWithRawResponse",
|
|
31
|
+
"MetersResourceWithStreamingResponse",
|
|
32
|
+
"AsyncMetersResourceWithStreamingResponse",
|
|
33
|
+
]
|