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.

Files changed (132) hide show
  1. openmeter/__init__.py +89 -15
  2. openmeter/_base_client.py +2041 -0
  3. openmeter/_client.py +518 -70
  4. openmeter/_compat.py +221 -0
  5. openmeter/_constants.py +14 -0
  6. openmeter/_exceptions.py +108 -0
  7. openmeter/_files.py +127 -0
  8. openmeter/_models.py +777 -0
  9. openmeter/_qs.py +150 -0
  10. openmeter/_resource.py +43 -0
  11. openmeter/_response.py +820 -0
  12. openmeter/_streaming.py +333 -0
  13. openmeter/_types.py +222 -0
  14. openmeter/_utils/__init__.py +56 -0
  15. openmeter/_utils/_logs.py +25 -0
  16. openmeter/_utils/_proxy.py +63 -0
  17. openmeter/_utils/_reflection.py +42 -0
  18. openmeter/_utils/_streams.py +12 -0
  19. openmeter/_utils/_sync.py +81 -0
  20. openmeter/_utils/_transform.py +387 -0
  21. openmeter/_utils/_typing.py +120 -0
  22. openmeter/_utils/_utils.py +419 -0
  23. openmeter/_version.py +4 -0
  24. openmeter/lib/.keep +4 -0
  25. openmeter/py.typed +0 -1
  26. openmeter/resources/__init__.py +103 -0
  27. openmeter/resources/debug/__init__.py +33 -0
  28. openmeter/resources/debug/debug.py +102 -0
  29. openmeter/resources/debug/metrics.py +146 -0
  30. openmeter/resources/entitlements/__init__.py +47 -0
  31. openmeter/resources/entitlements/entitlements.py +450 -0
  32. openmeter/resources/entitlements/features.py +578 -0
  33. openmeter/resources/entitlements/grants.py +389 -0
  34. openmeter/resources/events.py +442 -0
  35. openmeter/resources/meters/__init__.py +33 -0
  36. openmeter/resources/meters/meters.py +666 -0
  37. openmeter/resources/meters/subjects.py +163 -0
  38. openmeter/resources/notifications/__init__.py +75 -0
  39. openmeter/resources/notifications/channels.py +686 -0
  40. openmeter/resources/notifications/events.py +365 -0
  41. openmeter/resources/notifications/notifications.py +198 -0
  42. openmeter/resources/notifications/rules.py +781 -0
  43. openmeter/resources/notifications/webhook.py +208 -0
  44. openmeter/resources/portal/__init__.py +47 -0
  45. openmeter/resources/portal/meters.py +230 -0
  46. openmeter/resources/portal/portal.py +112 -0
  47. openmeter/resources/portal/tokens.py +359 -0
  48. openmeter/resources/subjects/entitlements/__init__.py +33 -0
  49. openmeter/resources/subjects/entitlements/entitlements.py +1881 -0
  50. openmeter/resources/subjects/entitlements/grants.py +453 -0
  51. openmeter/resources/subjects.py +419 -0
  52. openmeter/types/__init__.py +21 -0
  53. openmeter/types/debug/__init__.py +5 -0
  54. openmeter/types/debug/metric_list_response.py +7 -0
  55. openmeter/types/entitlement.py +238 -0
  56. openmeter/types/entitlements/__init__.py +11 -0
  57. openmeter/types/entitlements/feature.py +61 -0
  58. openmeter/types/entitlements/feature_create_params.py +43 -0
  59. openmeter/types/entitlements/feature_list_params.py +23 -0
  60. openmeter/types/entitlements/grant_list_params.py +57 -0
  61. openmeter/types/entitlements/grant_list_response.py +11 -0
  62. openmeter/types/entitlements/grant_paginated_response.py +24 -0
  63. openmeter/types/entitlements/list_features_result.py +28 -0
  64. openmeter/types/event_ingest_params.py +46 -0
  65. openmeter/types/event_ingest_response.py +43 -0
  66. openmeter/types/event_list_params.py +22 -0
  67. openmeter/types/event_list_response.py +9 -0
  68. openmeter/types/ingested_event.py +59 -0
  69. openmeter/types/list_entitlements_result.py +28 -0
  70. openmeter/types/meter.py +53 -0
  71. openmeter/types/meter_create_params.py +50 -0
  72. openmeter/types/meter_list_response.py +9 -0
  73. openmeter/types/meter_query_params.py +50 -0
  74. openmeter/types/meter_query_result.py +35 -0
  75. openmeter/types/meters/__init__.py +5 -0
  76. openmeter/types/meters/subject_list_response.py +8 -0
  77. openmeter/types/notifications/__init__.py +18 -0
  78. openmeter/types/notifications/channel_create_params.py +34 -0
  79. openmeter/types/notifications/channel_list_params.py +41 -0
  80. openmeter/types/notifications/channel_list_response.py +24 -0
  81. openmeter/types/notifications/channel_update_params.py +34 -0
  82. openmeter/types/notifications/event_list_params.py +61 -0
  83. openmeter/types/notifications/event_list_response.py +24 -0
  84. openmeter/types/notifications/notification_channel.py +47 -0
  85. openmeter/types/notifications/notification_event.py +215 -0
  86. openmeter/types/notifications/notification_rule.py +70 -0
  87. openmeter/types/notifications/rule_create_params.py +39 -0
  88. openmeter/types/notifications/rule_list_params.py +54 -0
  89. openmeter/types/notifications/rule_list_response.py +24 -0
  90. openmeter/types/notifications/rule_update_params.py +39 -0
  91. openmeter/types/notifications/webhook_svix_params.py +26 -0
  92. openmeter/types/portal/__init__.py +10 -0
  93. openmeter/types/portal/meter_query_params.py +44 -0
  94. openmeter/types/portal/portal_token.py +28 -0
  95. openmeter/types/portal/token_create_params.py +17 -0
  96. openmeter/types/portal/token_invalidate_params.py +15 -0
  97. openmeter/types/portal/token_list_params.py +12 -0
  98. openmeter/types/portal/token_list_response.py +9 -0
  99. openmeter/types/shared/__init__.py +3 -0
  100. openmeter/types/subject.py +37 -0
  101. openmeter/types/subject_list_response.py +9 -0
  102. openmeter/types/subject_param.py +27 -0
  103. openmeter/types/subject_upsert_params.py +39 -0
  104. openmeter/types/subject_upsert_response.py +10 -0
  105. openmeter/types/subjects/__init__.py +13 -0
  106. openmeter/types/subjects/entitlement_history_params.py +35 -0
  107. openmeter/types/subjects/entitlement_history_response.py +98 -0
  108. openmeter/types/subjects/entitlement_list_response.py +10 -0
  109. openmeter/types/subjects/entitlements/__init__.py +8 -0
  110. openmeter/types/subjects/entitlements/entitlement_grant.py +103 -0
  111. openmeter/types/subjects/entitlements/grant_list_response.py +10 -0
  112. openmeter-2.0.0.dist-info/METADATA +396 -0
  113. openmeter-2.0.0.dist-info/RECORD +115 -0
  114. {openmeter-1.0.0b54.dist-info → openmeter-2.0.0.dist-info}/WHEEL +1 -1
  115. openmeter-2.0.0.dist-info/licenses/LICENSE +201 -0
  116. openmeter/_configuration.py +0 -36
  117. openmeter/_operations/__init__.py +0 -17
  118. openmeter/_operations/_operations.py +0 -2105
  119. openmeter/_operations/_patch.py +0 -20
  120. openmeter/_patch.py +0 -20
  121. openmeter/_serialization.py +0 -2008
  122. openmeter/_vendor.py +0 -24
  123. openmeter/aio/__init__.py +0 -21
  124. openmeter/aio/_client.py +0 -83
  125. openmeter/aio/_configuration.py +0 -36
  126. openmeter/aio/_operations/__init__.py +0 -17
  127. openmeter/aio/_operations/_operations.py +0 -1778
  128. openmeter/aio/_operations/_patch.py +0 -20
  129. openmeter/aio/_patch.py +0 -20
  130. openmeter/aio/_vendor.py +0 -24
  131. openmeter-1.0.0b54.dist-info/METADATA +0 -92
  132. openmeter-1.0.0b54.dist-info/RECORD +0 -21
@@ -0,0 +1,686 @@
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 Dict
6
+ from typing_extensions import Literal
7
+
8
+ import httpx
9
+
10
+ from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
11
+ from ..._utils import (
12
+ maybe_transform,
13
+ async_maybe_transform,
14
+ )
15
+ from ..._compat import cached_property
16
+ from ..._resource import SyncAPIResource, AsyncAPIResource
17
+ from ..._response import (
18
+ to_raw_response_wrapper,
19
+ to_streamed_response_wrapper,
20
+ async_to_raw_response_wrapper,
21
+ async_to_streamed_response_wrapper,
22
+ )
23
+ from ..._base_client import make_request_options
24
+ from ...types.notifications import channel_list_params, channel_create_params, channel_update_params
25
+ from ...types.notifications.notification_channel import NotificationChannel
26
+ from ...types.notifications.channel_list_response import ChannelListResponse
27
+
28
+ __all__ = ["ChannelsResource", "AsyncChannelsResource"]
29
+
30
+
31
+ class ChannelsResource(SyncAPIResource):
32
+ @cached_property
33
+ def with_raw_response(self) -> ChannelsResourceWithRawResponse:
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 ChannelsResourceWithRawResponse(self)
41
+
42
+ @cached_property
43
+ def with_streaming_response(self) -> ChannelsResourceWithStreamingResponse:
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 ChannelsResourceWithStreamingResponse(self)
50
+
51
+ def create(
52
+ self,
53
+ *,
54
+ name: str,
55
+ type: Literal["WEBHOOK"],
56
+ url: str,
57
+ custom_headers: Dict[str, str] | NotGiven = NOT_GIVEN,
58
+ disabled: bool | NotGiven = NOT_GIVEN,
59
+ signing_secret: str | NotGiven = NOT_GIVEN,
60
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
61
+ # The extra values given here take precedence over values defined on the client or passed to this method.
62
+ extra_headers: Headers | None = None,
63
+ extra_query: Query | None = None,
64
+ extra_body: Body | None = None,
65
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
66
+ ) -> NotificationChannel:
67
+ """
68
+ Create a new notification channel.
69
+
70
+ Args:
71
+ name: User friendly name of the channel.
72
+
73
+ type: Notification channel type.
74
+
75
+ url: Webhook URL where the notification is sent.
76
+
77
+ custom_headers: Custom HTTP headers sent as part of the webhook request.
78
+
79
+ disabled: Whether the channel is disabled or not.
80
+
81
+ signing_secret: Signing secret used for webhook request validation on the receiving end.
82
+
83
+ Format: `base64` encoded random bytes optionally prefixed with `whsec_`.
84
+ Recommended size: 24
85
+
86
+ extra_headers: Send extra headers
87
+
88
+ extra_query: Add additional query parameters to the request
89
+
90
+ extra_body: Add additional JSON properties to the request
91
+
92
+ timeout: Override the client-level default timeout for this request, in seconds
93
+ """
94
+ return self._post(
95
+ "/api/v1/notification/channels",
96
+ body=maybe_transform(
97
+ {
98
+ "name": name,
99
+ "type": type,
100
+ "url": url,
101
+ "custom_headers": custom_headers,
102
+ "disabled": disabled,
103
+ "signing_secret": signing_secret,
104
+ },
105
+ channel_create_params.ChannelCreateParams,
106
+ ),
107
+ options=make_request_options(
108
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
109
+ ),
110
+ cast_to=NotificationChannel,
111
+ )
112
+
113
+ def retrieve(
114
+ self,
115
+ channel_id: str,
116
+ *,
117
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
118
+ # The extra values given here take precedence over values defined on the client or passed to this method.
119
+ extra_headers: Headers | None = None,
120
+ extra_query: Query | None = None,
121
+ extra_body: Body | None = None,
122
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
123
+ ) -> NotificationChannel:
124
+ """
125
+ Get a notification channel by id.
126
+
127
+ Args:
128
+ extra_headers: Send extra headers
129
+
130
+ extra_query: Add additional query parameters to the request
131
+
132
+ extra_body: Add additional JSON properties to the request
133
+
134
+ timeout: Override the client-level default timeout for this request, in seconds
135
+ """
136
+ if not channel_id:
137
+ raise ValueError(f"Expected a non-empty value for `channel_id` but received {channel_id!r}")
138
+ return self._get(
139
+ f"/api/v1/notification/channels/{channel_id}",
140
+ options=make_request_options(
141
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
142
+ ),
143
+ cast_to=NotificationChannel,
144
+ )
145
+
146
+ def update(
147
+ self,
148
+ channel_id: str,
149
+ *,
150
+ name: str,
151
+ type: Literal["WEBHOOK"],
152
+ url: str,
153
+ custom_headers: Dict[str, str] | NotGiven = NOT_GIVEN,
154
+ disabled: bool | NotGiven = NOT_GIVEN,
155
+ signing_secret: str | NotGiven = NOT_GIVEN,
156
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
157
+ # The extra values given here take precedence over values defined on the client or passed to this method.
158
+ extra_headers: Headers | None = None,
159
+ extra_query: Query | None = None,
160
+ extra_body: Body | None = None,
161
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
162
+ ) -> NotificationChannel:
163
+ """
164
+ Update notification channel.
165
+
166
+ Args:
167
+ name: User friendly name of the channel.
168
+
169
+ type: Notification channel type.
170
+
171
+ url: Webhook URL where the notification is sent.
172
+
173
+ custom_headers: Custom HTTP headers sent as part of the webhook request.
174
+
175
+ disabled: Whether the channel is disabled or not.
176
+
177
+ signing_secret: Signing secret used for webhook request validation on the receiving end.
178
+
179
+ Format: `base64` encoded random bytes optionally prefixed with `whsec_`.
180
+ Recommended size: 24
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
+ if not channel_id:
191
+ raise ValueError(f"Expected a non-empty value for `channel_id` but received {channel_id!r}")
192
+ return self._put(
193
+ f"/api/v1/notification/channels/{channel_id}",
194
+ body=maybe_transform(
195
+ {
196
+ "name": name,
197
+ "type": type,
198
+ "url": url,
199
+ "custom_headers": custom_headers,
200
+ "disabled": disabled,
201
+ "signing_secret": signing_secret,
202
+ },
203
+ channel_update_params.ChannelUpdateParams,
204
+ ),
205
+ options=make_request_options(
206
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
207
+ ),
208
+ cast_to=NotificationChannel,
209
+ )
210
+
211
+ def list(
212
+ self,
213
+ *,
214
+ include_deleted: bool | NotGiven = NOT_GIVEN,
215
+ include_disabled: bool | NotGiven = NOT_GIVEN,
216
+ order: Literal["ASC", "DESC"] | NotGiven = NOT_GIVEN,
217
+ order_by: Literal["id", "type", "createdAt", "updatedAt"] | NotGiven = NOT_GIVEN,
218
+ page: int | NotGiven = NOT_GIVEN,
219
+ page_size: int | NotGiven = NOT_GIVEN,
220
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
221
+ # The extra values given here take precedence over values defined on the client or passed to this method.
222
+ extra_headers: Headers | None = None,
223
+ extra_query: Query | None = None,
224
+ extra_body: Body | None = None,
225
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
226
+ ) -> ChannelListResponse:
227
+ """
228
+ List all notification channels.
229
+
230
+ Args:
231
+ include_deleted: Include deleted notification channels in response.
232
+
233
+ Usage: `?includeDeleted=true`
234
+
235
+ include_disabled: Include disabled notification channels in response.
236
+
237
+ Usage: `?includeDisabled=false`
238
+
239
+ order: The order direction.
240
+
241
+ order_by: The order by field.
242
+
243
+ page: Start date-time in RFC 3339 format.
244
+
245
+ Inclusive.
246
+
247
+ page_size: Number of items per page.
248
+
249
+ Default is 100.
250
+
251
+ extra_headers: Send extra headers
252
+
253
+ extra_query: Add additional query parameters to the request
254
+
255
+ extra_body: Add additional JSON properties to the request
256
+
257
+ timeout: Override the client-level default timeout for this request, in seconds
258
+ """
259
+ return self._get(
260
+ "/api/v1/notification/channels",
261
+ options=make_request_options(
262
+ extra_headers=extra_headers,
263
+ extra_query=extra_query,
264
+ extra_body=extra_body,
265
+ timeout=timeout,
266
+ query=maybe_transform(
267
+ {
268
+ "include_deleted": include_deleted,
269
+ "include_disabled": include_disabled,
270
+ "order": order,
271
+ "order_by": order_by,
272
+ "page": page,
273
+ "page_size": page_size,
274
+ },
275
+ channel_list_params.ChannelListParams,
276
+ ),
277
+ ),
278
+ cast_to=ChannelListResponse,
279
+ )
280
+
281
+ def delete(
282
+ self,
283
+ channel_id: str,
284
+ *,
285
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
286
+ # The extra values given here take precedence over values defined on the client or passed to this method.
287
+ extra_headers: Headers | None = None,
288
+ extra_query: Query | None = None,
289
+ extra_body: Body | None = None,
290
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
291
+ ) -> None:
292
+ """
293
+ Soft delete notification channel by id.
294
+
295
+ Once a notification channel is deleted it cannot be undeleted.
296
+
297
+ Args:
298
+ extra_headers: Send extra headers
299
+
300
+ extra_query: Add additional query parameters to the request
301
+
302
+ extra_body: Add additional JSON properties to the request
303
+
304
+ timeout: Override the client-level default timeout for this request, in seconds
305
+ """
306
+ if not channel_id:
307
+ raise ValueError(f"Expected a non-empty value for `channel_id` but received {channel_id!r}")
308
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
309
+ return self._delete(
310
+ f"/api/v1/notification/channels/{channel_id}",
311
+ options=make_request_options(
312
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
313
+ ),
314
+ cast_to=NoneType,
315
+ )
316
+
317
+
318
+ class AsyncChannelsResource(AsyncAPIResource):
319
+ @cached_property
320
+ def with_raw_response(self) -> AsyncChannelsResourceWithRawResponse:
321
+ """
322
+ This property can be used as a prefix for any HTTP method call to return the
323
+ the raw response object instead of the parsed content.
324
+
325
+ For more information, see https://www.github.com/openmeterio/openmeter-python#accessing-raw-response-data-eg-headers
326
+ """
327
+ return AsyncChannelsResourceWithRawResponse(self)
328
+
329
+ @cached_property
330
+ def with_streaming_response(self) -> AsyncChannelsResourceWithStreamingResponse:
331
+ """
332
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
333
+
334
+ For more information, see https://www.github.com/openmeterio/openmeter-python#with_streaming_response
335
+ """
336
+ return AsyncChannelsResourceWithStreamingResponse(self)
337
+
338
+ async def create(
339
+ self,
340
+ *,
341
+ name: str,
342
+ type: Literal["WEBHOOK"],
343
+ url: str,
344
+ custom_headers: Dict[str, str] | NotGiven = NOT_GIVEN,
345
+ disabled: bool | NotGiven = NOT_GIVEN,
346
+ signing_secret: str | NotGiven = NOT_GIVEN,
347
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
348
+ # The extra values given here take precedence over values defined on the client or passed to this method.
349
+ extra_headers: Headers | None = None,
350
+ extra_query: Query | None = None,
351
+ extra_body: Body | None = None,
352
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
353
+ ) -> NotificationChannel:
354
+ """
355
+ Create a new notification channel.
356
+
357
+ Args:
358
+ name: User friendly name of the channel.
359
+
360
+ type: Notification channel type.
361
+
362
+ url: Webhook URL where the notification is sent.
363
+
364
+ custom_headers: Custom HTTP headers sent as part of the webhook request.
365
+
366
+ disabled: Whether the channel is disabled or not.
367
+
368
+ signing_secret: Signing secret used for webhook request validation on the receiving end.
369
+
370
+ Format: `base64` encoded random bytes optionally prefixed with `whsec_`.
371
+ Recommended size: 24
372
+
373
+ extra_headers: Send extra headers
374
+
375
+ extra_query: Add additional query parameters to the request
376
+
377
+ extra_body: Add additional JSON properties to the request
378
+
379
+ timeout: Override the client-level default timeout for this request, in seconds
380
+ """
381
+ return await self._post(
382
+ "/api/v1/notification/channels",
383
+ body=await async_maybe_transform(
384
+ {
385
+ "name": name,
386
+ "type": type,
387
+ "url": url,
388
+ "custom_headers": custom_headers,
389
+ "disabled": disabled,
390
+ "signing_secret": signing_secret,
391
+ },
392
+ channel_create_params.ChannelCreateParams,
393
+ ),
394
+ options=make_request_options(
395
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
396
+ ),
397
+ cast_to=NotificationChannel,
398
+ )
399
+
400
+ async def retrieve(
401
+ self,
402
+ channel_id: str,
403
+ *,
404
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
405
+ # The extra values given here take precedence over values defined on the client or passed to this method.
406
+ extra_headers: Headers | None = None,
407
+ extra_query: Query | None = None,
408
+ extra_body: Body | None = None,
409
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
410
+ ) -> NotificationChannel:
411
+ """
412
+ Get a notification channel by id.
413
+
414
+ Args:
415
+ extra_headers: Send extra headers
416
+
417
+ extra_query: Add additional query parameters to the request
418
+
419
+ extra_body: Add additional JSON properties to the request
420
+
421
+ timeout: Override the client-level default timeout for this request, in seconds
422
+ """
423
+ if not channel_id:
424
+ raise ValueError(f"Expected a non-empty value for `channel_id` but received {channel_id!r}")
425
+ return await self._get(
426
+ f"/api/v1/notification/channels/{channel_id}",
427
+ options=make_request_options(
428
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
429
+ ),
430
+ cast_to=NotificationChannel,
431
+ )
432
+
433
+ async def update(
434
+ self,
435
+ channel_id: str,
436
+ *,
437
+ name: str,
438
+ type: Literal["WEBHOOK"],
439
+ url: str,
440
+ custom_headers: Dict[str, str] | NotGiven = NOT_GIVEN,
441
+ disabled: bool | NotGiven = NOT_GIVEN,
442
+ signing_secret: str | NotGiven = NOT_GIVEN,
443
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
444
+ # The extra values given here take precedence over values defined on the client or passed to this method.
445
+ extra_headers: Headers | None = None,
446
+ extra_query: Query | None = None,
447
+ extra_body: Body | None = None,
448
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
449
+ ) -> NotificationChannel:
450
+ """
451
+ Update notification channel.
452
+
453
+ Args:
454
+ name: User friendly name of the channel.
455
+
456
+ type: Notification channel type.
457
+
458
+ url: Webhook URL where the notification is sent.
459
+
460
+ custom_headers: Custom HTTP headers sent as part of the webhook request.
461
+
462
+ disabled: Whether the channel is disabled or not.
463
+
464
+ signing_secret: Signing secret used for webhook request validation on the receiving end.
465
+
466
+ Format: `base64` encoded random bytes optionally prefixed with `whsec_`.
467
+ Recommended size: 24
468
+
469
+ extra_headers: Send extra headers
470
+
471
+ extra_query: Add additional query parameters to the request
472
+
473
+ extra_body: Add additional JSON properties to the request
474
+
475
+ timeout: Override the client-level default timeout for this request, in seconds
476
+ """
477
+ if not channel_id:
478
+ raise ValueError(f"Expected a non-empty value for `channel_id` but received {channel_id!r}")
479
+ return await self._put(
480
+ f"/api/v1/notification/channels/{channel_id}",
481
+ body=await async_maybe_transform(
482
+ {
483
+ "name": name,
484
+ "type": type,
485
+ "url": url,
486
+ "custom_headers": custom_headers,
487
+ "disabled": disabled,
488
+ "signing_secret": signing_secret,
489
+ },
490
+ channel_update_params.ChannelUpdateParams,
491
+ ),
492
+ options=make_request_options(
493
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
494
+ ),
495
+ cast_to=NotificationChannel,
496
+ )
497
+
498
+ async def list(
499
+ self,
500
+ *,
501
+ include_deleted: bool | NotGiven = NOT_GIVEN,
502
+ include_disabled: bool | NotGiven = NOT_GIVEN,
503
+ order: Literal["ASC", "DESC"] | NotGiven = NOT_GIVEN,
504
+ order_by: Literal["id", "type", "createdAt", "updatedAt"] | NotGiven = NOT_GIVEN,
505
+ page: int | NotGiven = NOT_GIVEN,
506
+ page_size: int | NotGiven = NOT_GIVEN,
507
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
508
+ # The extra values given here take precedence over values defined on the client or passed to this method.
509
+ extra_headers: Headers | None = None,
510
+ extra_query: Query | None = None,
511
+ extra_body: Body | None = None,
512
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
513
+ ) -> ChannelListResponse:
514
+ """
515
+ List all notification channels.
516
+
517
+ Args:
518
+ include_deleted: Include deleted notification channels in response.
519
+
520
+ Usage: `?includeDeleted=true`
521
+
522
+ include_disabled: Include disabled notification channels in response.
523
+
524
+ Usage: `?includeDisabled=false`
525
+
526
+ order: The order direction.
527
+
528
+ order_by: The order by field.
529
+
530
+ page: Start date-time in RFC 3339 format.
531
+
532
+ Inclusive.
533
+
534
+ page_size: Number of items per page.
535
+
536
+ Default is 100.
537
+
538
+ extra_headers: Send extra headers
539
+
540
+ extra_query: Add additional query parameters to the request
541
+
542
+ extra_body: Add additional JSON properties to the request
543
+
544
+ timeout: Override the client-level default timeout for this request, in seconds
545
+ """
546
+ return await self._get(
547
+ "/api/v1/notification/channels",
548
+ options=make_request_options(
549
+ extra_headers=extra_headers,
550
+ extra_query=extra_query,
551
+ extra_body=extra_body,
552
+ timeout=timeout,
553
+ query=await async_maybe_transform(
554
+ {
555
+ "include_deleted": include_deleted,
556
+ "include_disabled": include_disabled,
557
+ "order": order,
558
+ "order_by": order_by,
559
+ "page": page,
560
+ "page_size": page_size,
561
+ },
562
+ channel_list_params.ChannelListParams,
563
+ ),
564
+ ),
565
+ cast_to=ChannelListResponse,
566
+ )
567
+
568
+ async def delete(
569
+ self,
570
+ channel_id: str,
571
+ *,
572
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
573
+ # The extra values given here take precedence over values defined on the client or passed to this method.
574
+ extra_headers: Headers | None = None,
575
+ extra_query: Query | None = None,
576
+ extra_body: Body | None = None,
577
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
578
+ ) -> None:
579
+ """
580
+ Soft delete notification channel by id.
581
+
582
+ Once a notification channel is deleted it cannot be undeleted.
583
+
584
+ Args:
585
+ extra_headers: Send extra headers
586
+
587
+ extra_query: Add additional query parameters to the request
588
+
589
+ extra_body: Add additional JSON properties to the request
590
+
591
+ timeout: Override the client-level default timeout for this request, in seconds
592
+ """
593
+ if not channel_id:
594
+ raise ValueError(f"Expected a non-empty value for `channel_id` but received {channel_id!r}")
595
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
596
+ return await self._delete(
597
+ f"/api/v1/notification/channels/{channel_id}",
598
+ options=make_request_options(
599
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
600
+ ),
601
+ cast_to=NoneType,
602
+ )
603
+
604
+
605
+ class ChannelsResourceWithRawResponse:
606
+ def __init__(self, channels: ChannelsResource) -> None:
607
+ self._channels = channels
608
+
609
+ self.create = to_raw_response_wrapper(
610
+ channels.create,
611
+ )
612
+ self.retrieve = to_raw_response_wrapper(
613
+ channels.retrieve,
614
+ )
615
+ self.update = to_raw_response_wrapper(
616
+ channels.update,
617
+ )
618
+ self.list = to_raw_response_wrapper(
619
+ channels.list,
620
+ )
621
+ self.delete = to_raw_response_wrapper(
622
+ channels.delete,
623
+ )
624
+
625
+
626
+ class AsyncChannelsResourceWithRawResponse:
627
+ def __init__(self, channels: AsyncChannelsResource) -> None:
628
+ self._channels = channels
629
+
630
+ self.create = async_to_raw_response_wrapper(
631
+ channels.create,
632
+ )
633
+ self.retrieve = async_to_raw_response_wrapper(
634
+ channels.retrieve,
635
+ )
636
+ self.update = async_to_raw_response_wrapper(
637
+ channels.update,
638
+ )
639
+ self.list = async_to_raw_response_wrapper(
640
+ channels.list,
641
+ )
642
+ self.delete = async_to_raw_response_wrapper(
643
+ channels.delete,
644
+ )
645
+
646
+
647
+ class ChannelsResourceWithStreamingResponse:
648
+ def __init__(self, channels: ChannelsResource) -> None:
649
+ self._channels = channels
650
+
651
+ self.create = to_streamed_response_wrapper(
652
+ channels.create,
653
+ )
654
+ self.retrieve = to_streamed_response_wrapper(
655
+ channels.retrieve,
656
+ )
657
+ self.update = to_streamed_response_wrapper(
658
+ channels.update,
659
+ )
660
+ self.list = to_streamed_response_wrapper(
661
+ channels.list,
662
+ )
663
+ self.delete = to_streamed_response_wrapper(
664
+ channels.delete,
665
+ )
666
+
667
+
668
+ class AsyncChannelsResourceWithStreamingResponse:
669
+ def __init__(self, channels: AsyncChannelsResource) -> None:
670
+ self._channels = channels
671
+
672
+ self.create = async_to_streamed_response_wrapper(
673
+ channels.create,
674
+ )
675
+ self.retrieve = async_to_streamed_response_wrapper(
676
+ channels.retrieve,
677
+ )
678
+ self.update = async_to_streamed_response_wrapper(
679
+ channels.update,
680
+ )
681
+ self.list = async_to_streamed_response_wrapper(
682
+ channels.list,
683
+ )
684
+ self.delete = async_to_streamed_response_wrapper(
685
+ channels.delete,
686
+ )