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,389 @@
|
|
|
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 Any, List, cast
|
|
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.entitlements import grant_list_params
|
|
25
|
+
from ...types.entitlements.grant_list_response import GrantListResponse
|
|
26
|
+
|
|
27
|
+
__all__ = ["GrantsResource", "AsyncGrantsResource"]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class GrantsResource(SyncAPIResource):
|
|
31
|
+
@cached_property
|
|
32
|
+
def with_raw_response(self) -> GrantsResourceWithRawResponse:
|
|
33
|
+
"""
|
|
34
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
35
|
+
the raw response object instead of the parsed content.
|
|
36
|
+
|
|
37
|
+
For more information, see https://www.github.com/openmeterio/openmeter-python#accessing-raw-response-data-eg-headers
|
|
38
|
+
"""
|
|
39
|
+
return GrantsResourceWithRawResponse(self)
|
|
40
|
+
|
|
41
|
+
@cached_property
|
|
42
|
+
def with_streaming_response(self) -> GrantsResourceWithStreamingResponse:
|
|
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/openmeterio/openmeter-python#with_streaming_response
|
|
47
|
+
"""
|
|
48
|
+
return GrantsResourceWithStreamingResponse(self)
|
|
49
|
+
|
|
50
|
+
def list(
|
|
51
|
+
self,
|
|
52
|
+
*,
|
|
53
|
+
feature: List[str] | NotGiven = NOT_GIVEN,
|
|
54
|
+
include_deleted: bool | NotGiven = NOT_GIVEN,
|
|
55
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
56
|
+
offset: int | NotGiven = NOT_GIVEN,
|
|
57
|
+
order: Literal["ASC", "DESC"] | NotGiven = NOT_GIVEN,
|
|
58
|
+
order_by: Literal["id", "createdAt", "updatedAt"] | NotGiven = NOT_GIVEN,
|
|
59
|
+
page: int | NotGiven = NOT_GIVEN,
|
|
60
|
+
page_size: int | NotGiven = NOT_GIVEN,
|
|
61
|
+
subject: List[str] | 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
|
+
) -> GrantListResponse:
|
|
69
|
+
"""List all grants for all the subjects and entitlements.
|
|
70
|
+
|
|
71
|
+
This endpoint is intended
|
|
72
|
+
for administrative purposes only. To fetch the grants of a specific entitlement
|
|
73
|
+
please use the
|
|
74
|
+
/api/v1/subjects/{subjectKeyOrID}/entitlements/{entitlementOrFeatureID}/grants
|
|
75
|
+
endpoint. If page is provided that takes precedence and the paginated response
|
|
76
|
+
is returned.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
feature: Filtering by multiple features.
|
|
80
|
+
|
|
81
|
+
Usage: `?feature=feature-1&feature=feature-2`
|
|
82
|
+
|
|
83
|
+
include_deleted: Include deleted
|
|
84
|
+
|
|
85
|
+
limit: Number of items to return.
|
|
86
|
+
|
|
87
|
+
Default is 100.
|
|
88
|
+
|
|
89
|
+
offset: Number of items to skip.
|
|
90
|
+
|
|
91
|
+
Default is 0.
|
|
92
|
+
|
|
93
|
+
order: The order direction.
|
|
94
|
+
|
|
95
|
+
order_by: The order by field.
|
|
96
|
+
|
|
97
|
+
page: Start date-time in RFC 3339 format.
|
|
98
|
+
|
|
99
|
+
Inclusive.
|
|
100
|
+
|
|
101
|
+
page_size: Number of items per page.
|
|
102
|
+
|
|
103
|
+
Default is 100.
|
|
104
|
+
|
|
105
|
+
subject: Filtering by multiple subjects.
|
|
106
|
+
|
|
107
|
+
Usage: `?subject=customer-1&subject=customer-2`
|
|
108
|
+
|
|
109
|
+
extra_headers: Send extra headers
|
|
110
|
+
|
|
111
|
+
extra_query: Add additional query parameters to the request
|
|
112
|
+
|
|
113
|
+
extra_body: Add additional JSON properties to the request
|
|
114
|
+
|
|
115
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
116
|
+
"""
|
|
117
|
+
return cast(
|
|
118
|
+
GrantListResponse,
|
|
119
|
+
self._get(
|
|
120
|
+
"/api/v1/grants",
|
|
121
|
+
options=make_request_options(
|
|
122
|
+
extra_headers=extra_headers,
|
|
123
|
+
extra_query=extra_query,
|
|
124
|
+
extra_body=extra_body,
|
|
125
|
+
timeout=timeout,
|
|
126
|
+
query=maybe_transform(
|
|
127
|
+
{
|
|
128
|
+
"feature": feature,
|
|
129
|
+
"include_deleted": include_deleted,
|
|
130
|
+
"limit": limit,
|
|
131
|
+
"offset": offset,
|
|
132
|
+
"order": order,
|
|
133
|
+
"order_by": order_by,
|
|
134
|
+
"page": page,
|
|
135
|
+
"page_size": page_size,
|
|
136
|
+
"subject": subject,
|
|
137
|
+
},
|
|
138
|
+
grant_list_params.GrantListParams,
|
|
139
|
+
),
|
|
140
|
+
),
|
|
141
|
+
cast_to=cast(Any, GrantListResponse), # Union types cannot be passed in as arguments in the type system
|
|
142
|
+
),
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
def void(
|
|
146
|
+
self,
|
|
147
|
+
grant_id: str,
|
|
148
|
+
*,
|
|
149
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
150
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
151
|
+
extra_headers: Headers | None = None,
|
|
152
|
+
extra_query: Query | None = None,
|
|
153
|
+
extra_body: Body | None = None,
|
|
154
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
155
|
+
) -> None:
|
|
156
|
+
"""
|
|
157
|
+
Voiding a grant means it is no longer valid, it doesn't take part in further
|
|
158
|
+
balance calculations. Voiding a grant does not retroactively take effect,
|
|
159
|
+
meaning any usage that has already been attributed to the grant will remain, but
|
|
160
|
+
future usage cannot be burnt down from the grant. For example, if you have a
|
|
161
|
+
single grant for your metered entitlement with an initial amount of 100, and so
|
|
162
|
+
far 60 usage has been metered, the grant (and the entitlement itself) would have
|
|
163
|
+
a balance of 40. If you then void that grant, balance becomes 0, but the 60
|
|
164
|
+
previous usage will not be affected.
|
|
165
|
+
|
|
166
|
+
Args:
|
|
167
|
+
extra_headers: Send extra headers
|
|
168
|
+
|
|
169
|
+
extra_query: Add additional query parameters to the request
|
|
170
|
+
|
|
171
|
+
extra_body: Add additional JSON properties to the request
|
|
172
|
+
|
|
173
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
174
|
+
"""
|
|
175
|
+
if not grant_id:
|
|
176
|
+
raise ValueError(f"Expected a non-empty value for `grant_id` but received {grant_id!r}")
|
|
177
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
178
|
+
return self._delete(
|
|
179
|
+
f"/api/v1/grants/{grant_id}",
|
|
180
|
+
options=make_request_options(
|
|
181
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
182
|
+
),
|
|
183
|
+
cast_to=NoneType,
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class AsyncGrantsResource(AsyncAPIResource):
|
|
188
|
+
@cached_property
|
|
189
|
+
def with_raw_response(self) -> AsyncGrantsResourceWithRawResponse:
|
|
190
|
+
"""
|
|
191
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
192
|
+
the raw response object instead of the parsed content.
|
|
193
|
+
|
|
194
|
+
For more information, see https://www.github.com/openmeterio/openmeter-python#accessing-raw-response-data-eg-headers
|
|
195
|
+
"""
|
|
196
|
+
return AsyncGrantsResourceWithRawResponse(self)
|
|
197
|
+
|
|
198
|
+
@cached_property
|
|
199
|
+
def with_streaming_response(self) -> AsyncGrantsResourceWithStreamingResponse:
|
|
200
|
+
"""
|
|
201
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
202
|
+
|
|
203
|
+
For more information, see https://www.github.com/openmeterio/openmeter-python#with_streaming_response
|
|
204
|
+
"""
|
|
205
|
+
return AsyncGrantsResourceWithStreamingResponse(self)
|
|
206
|
+
|
|
207
|
+
async def list(
|
|
208
|
+
self,
|
|
209
|
+
*,
|
|
210
|
+
feature: List[str] | NotGiven = NOT_GIVEN,
|
|
211
|
+
include_deleted: bool | NotGiven = NOT_GIVEN,
|
|
212
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
213
|
+
offset: int | NotGiven = NOT_GIVEN,
|
|
214
|
+
order: Literal["ASC", "DESC"] | NotGiven = NOT_GIVEN,
|
|
215
|
+
order_by: Literal["id", "createdAt", "updatedAt"] | NotGiven = NOT_GIVEN,
|
|
216
|
+
page: int | NotGiven = NOT_GIVEN,
|
|
217
|
+
page_size: int | NotGiven = NOT_GIVEN,
|
|
218
|
+
subject: List[str] | NotGiven = NOT_GIVEN,
|
|
219
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
220
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
221
|
+
extra_headers: Headers | None = None,
|
|
222
|
+
extra_query: Query | None = None,
|
|
223
|
+
extra_body: Body | None = None,
|
|
224
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
225
|
+
) -> GrantListResponse:
|
|
226
|
+
"""List all grants for all the subjects and entitlements.
|
|
227
|
+
|
|
228
|
+
This endpoint is intended
|
|
229
|
+
for administrative purposes only. To fetch the grants of a specific entitlement
|
|
230
|
+
please use the
|
|
231
|
+
/api/v1/subjects/{subjectKeyOrID}/entitlements/{entitlementOrFeatureID}/grants
|
|
232
|
+
endpoint. If page is provided that takes precedence and the paginated response
|
|
233
|
+
is returned.
|
|
234
|
+
|
|
235
|
+
Args:
|
|
236
|
+
feature: Filtering by multiple features.
|
|
237
|
+
|
|
238
|
+
Usage: `?feature=feature-1&feature=feature-2`
|
|
239
|
+
|
|
240
|
+
include_deleted: Include deleted
|
|
241
|
+
|
|
242
|
+
limit: Number of items to return.
|
|
243
|
+
|
|
244
|
+
Default is 100.
|
|
245
|
+
|
|
246
|
+
offset: Number of items to skip.
|
|
247
|
+
|
|
248
|
+
Default is 0.
|
|
249
|
+
|
|
250
|
+
order: The order direction.
|
|
251
|
+
|
|
252
|
+
order_by: The order by field.
|
|
253
|
+
|
|
254
|
+
page: Start date-time in RFC 3339 format.
|
|
255
|
+
|
|
256
|
+
Inclusive.
|
|
257
|
+
|
|
258
|
+
page_size: Number of items per page.
|
|
259
|
+
|
|
260
|
+
Default is 100.
|
|
261
|
+
|
|
262
|
+
subject: Filtering by multiple subjects.
|
|
263
|
+
|
|
264
|
+
Usage: `?subject=customer-1&subject=customer-2`
|
|
265
|
+
|
|
266
|
+
extra_headers: Send extra headers
|
|
267
|
+
|
|
268
|
+
extra_query: Add additional query parameters to the request
|
|
269
|
+
|
|
270
|
+
extra_body: Add additional JSON properties to the request
|
|
271
|
+
|
|
272
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
273
|
+
"""
|
|
274
|
+
return cast(
|
|
275
|
+
GrantListResponse,
|
|
276
|
+
await self._get(
|
|
277
|
+
"/api/v1/grants",
|
|
278
|
+
options=make_request_options(
|
|
279
|
+
extra_headers=extra_headers,
|
|
280
|
+
extra_query=extra_query,
|
|
281
|
+
extra_body=extra_body,
|
|
282
|
+
timeout=timeout,
|
|
283
|
+
query=await async_maybe_transform(
|
|
284
|
+
{
|
|
285
|
+
"feature": feature,
|
|
286
|
+
"include_deleted": include_deleted,
|
|
287
|
+
"limit": limit,
|
|
288
|
+
"offset": offset,
|
|
289
|
+
"order": order,
|
|
290
|
+
"order_by": order_by,
|
|
291
|
+
"page": page,
|
|
292
|
+
"page_size": page_size,
|
|
293
|
+
"subject": subject,
|
|
294
|
+
},
|
|
295
|
+
grant_list_params.GrantListParams,
|
|
296
|
+
),
|
|
297
|
+
),
|
|
298
|
+
cast_to=cast(Any, GrantListResponse), # Union types cannot be passed in as arguments in the type system
|
|
299
|
+
),
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
async def void(
|
|
303
|
+
self,
|
|
304
|
+
grant_id: str,
|
|
305
|
+
*,
|
|
306
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
307
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
308
|
+
extra_headers: Headers | None = None,
|
|
309
|
+
extra_query: Query | None = None,
|
|
310
|
+
extra_body: Body | None = None,
|
|
311
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
312
|
+
) -> None:
|
|
313
|
+
"""
|
|
314
|
+
Voiding a grant means it is no longer valid, it doesn't take part in further
|
|
315
|
+
balance calculations. Voiding a grant does not retroactively take effect,
|
|
316
|
+
meaning any usage that has already been attributed to the grant will remain, but
|
|
317
|
+
future usage cannot be burnt down from the grant. For example, if you have a
|
|
318
|
+
single grant for your metered entitlement with an initial amount of 100, and so
|
|
319
|
+
far 60 usage has been metered, the grant (and the entitlement itself) would have
|
|
320
|
+
a balance of 40. If you then void that grant, balance becomes 0, but the 60
|
|
321
|
+
previous usage will not be affected.
|
|
322
|
+
|
|
323
|
+
Args:
|
|
324
|
+
extra_headers: Send extra headers
|
|
325
|
+
|
|
326
|
+
extra_query: Add additional query parameters to the request
|
|
327
|
+
|
|
328
|
+
extra_body: Add additional JSON properties to the request
|
|
329
|
+
|
|
330
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
331
|
+
"""
|
|
332
|
+
if not grant_id:
|
|
333
|
+
raise ValueError(f"Expected a non-empty value for `grant_id` but received {grant_id!r}")
|
|
334
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
335
|
+
return await self._delete(
|
|
336
|
+
f"/api/v1/grants/{grant_id}",
|
|
337
|
+
options=make_request_options(
|
|
338
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
339
|
+
),
|
|
340
|
+
cast_to=NoneType,
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
class GrantsResourceWithRawResponse:
|
|
345
|
+
def __init__(self, grants: GrantsResource) -> None:
|
|
346
|
+
self._grants = grants
|
|
347
|
+
|
|
348
|
+
self.list = to_raw_response_wrapper(
|
|
349
|
+
grants.list,
|
|
350
|
+
)
|
|
351
|
+
self.void = to_raw_response_wrapper(
|
|
352
|
+
grants.void,
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
class AsyncGrantsResourceWithRawResponse:
|
|
357
|
+
def __init__(self, grants: AsyncGrantsResource) -> None:
|
|
358
|
+
self._grants = grants
|
|
359
|
+
|
|
360
|
+
self.list = async_to_raw_response_wrapper(
|
|
361
|
+
grants.list,
|
|
362
|
+
)
|
|
363
|
+
self.void = async_to_raw_response_wrapper(
|
|
364
|
+
grants.void,
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
class GrantsResourceWithStreamingResponse:
|
|
369
|
+
def __init__(self, grants: GrantsResource) -> None:
|
|
370
|
+
self._grants = grants
|
|
371
|
+
|
|
372
|
+
self.list = to_streamed_response_wrapper(
|
|
373
|
+
grants.list,
|
|
374
|
+
)
|
|
375
|
+
self.void = to_streamed_response_wrapper(
|
|
376
|
+
grants.void,
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
class AsyncGrantsResourceWithStreamingResponse:
|
|
381
|
+
def __init__(self, grants: AsyncGrantsResource) -> None:
|
|
382
|
+
self._grants = grants
|
|
383
|
+
|
|
384
|
+
self.list = async_to_streamed_response_wrapper(
|
|
385
|
+
grants.list,
|
|
386
|
+
)
|
|
387
|
+
self.void = async_to_streamed_response_wrapper(
|
|
388
|
+
grants.void,
|
|
389
|
+
)
|