payi 0.1.0a25__py3-none-any.whl → 0.1.0a27__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 payi might be problematic. Click here for more details.
- payi/_base_client.py +13 -3
- payi/_client.py +24 -8
- payi/_response.py +3 -0
- payi/_version.py +1 -1
- payi/resources/__init__.py +42 -14
- payi/resources/billing_models.py +492 -0
- payi/resources/budgets/budgets.py +4 -4
- payi/resources/categories/resources.py +9 -9
- payi/resources/{evaluations/experiences.py → csat.py} +49 -49
- payi/resources/ingest.py +23 -11
- payi/resources/price_modifiers.py +353 -0
- payi/types/__init__.py +10 -1
- payi/types/billing_model.py +29 -0
- payi/types/billing_model_create_params.py +20 -0
- payi/types/billing_model_list_response.py +10 -0
- payi/types/billing_model_update_params.py +20 -0
- payi/types/budget_create_params.py +2 -2
- payi/types/budget_response.py +2 -2
- payi/types/bulk_ingest_response.py +7 -0
- payi/types/categories/resource_create_params.py +10 -4
- payi/types/category_resource_response.py +10 -4
- payi/types/cost_data.py +0 -1
- payi/types/{shared/evaluation_response.py → csat.py} +3 -4
- payi/types/csat_create_params.py +14 -0
- payi/types/experience_instance.py +0 -1
- payi/types/experiences/experience_type.py +0 -1
- payi/types/ingest_event_param.py +14 -6
- payi/types/ingest_response.py +7 -1
- payi/types/ingest_units_params.py +13 -6
- payi/types/paged_budget_list.py +2 -2
- payi/types/price_modifier.py +26 -0
- payi/types/price_modifier_create_params.py +17 -0
- payi/types/price_modifier_retrieve_response.py +10 -0
- payi/types/price_modifier_update_params.py +17 -0
- payi/types/requests_data.py +2 -1
- payi/types/shared/__init__.py +0 -1
- payi/types/total_cost_data.py +0 -1
- {payi-0.1.0a25.dist-info → payi-0.1.0a27.dist-info}/METADATA +5 -1
- {payi-0.1.0a25.dist-info → payi-0.1.0a27.dist-info}/RECORD +41 -33
- payi/resources/evaluations/__init__.py +0 -47
- payi/resources/evaluations/evaluations.py +0 -134
- payi/resources/evaluations/requests.py +0 -200
- {payi-0.1.0a25.dist-info → payi-0.1.0a27.dist-info}/WHEEL +0 -0
- {payi-0.1.0a25.dist-info → payi-0.1.0a27.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,492 @@
|
|
|
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
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..types import billing_model_create_params, billing_model_update_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.billing_model import BillingModel
|
|
26
|
+
from ..types.billing_model_list_response import BillingModelListResponse
|
|
27
|
+
|
|
28
|
+
__all__ = ["BillingModelsResource", "AsyncBillingModelsResource"]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class BillingModelsResource(SyncAPIResource):
|
|
32
|
+
@cached_property
|
|
33
|
+
def with_raw_response(self) -> BillingModelsResourceWithRawResponse:
|
|
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/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
39
|
+
"""
|
|
40
|
+
return BillingModelsResourceWithRawResponse(self)
|
|
41
|
+
|
|
42
|
+
@cached_property
|
|
43
|
+
def with_streaming_response(self) -> BillingModelsResourceWithStreamingResponse:
|
|
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/Pay-i/pay-i-python#with_streaming_response
|
|
48
|
+
"""
|
|
49
|
+
return BillingModelsResourceWithStreamingResponse(self)
|
|
50
|
+
|
|
51
|
+
def create(
|
|
52
|
+
self,
|
|
53
|
+
*,
|
|
54
|
+
name: str,
|
|
55
|
+
type: Literal["costplus"],
|
|
56
|
+
prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
|
|
57
|
+
prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
|
|
58
|
+
threshold: Optional[float] | NotGiven = NOT_GIVEN,
|
|
59
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
60
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
61
|
+
extra_headers: Headers | None = None,
|
|
62
|
+
extra_query: Query | None = None,
|
|
63
|
+
extra_body: Body | None = None,
|
|
64
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
65
|
+
) -> BillingModel:
|
|
66
|
+
"""
|
|
67
|
+
Args:
|
|
68
|
+
extra_headers: Send extra headers
|
|
69
|
+
|
|
70
|
+
extra_query: Add additional query parameters to the request
|
|
71
|
+
|
|
72
|
+
extra_body: Add additional JSON properties to the request
|
|
73
|
+
|
|
74
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
75
|
+
"""
|
|
76
|
+
return self._post(
|
|
77
|
+
"/api/v1/billing-model",
|
|
78
|
+
body=maybe_transform(
|
|
79
|
+
{
|
|
80
|
+
"name": name,
|
|
81
|
+
"type": type,
|
|
82
|
+
"prepaid_amount": prepaid_amount,
|
|
83
|
+
"prepaid_max": prepaid_max,
|
|
84
|
+
"threshold": threshold,
|
|
85
|
+
},
|
|
86
|
+
billing_model_create_params.BillingModelCreateParams,
|
|
87
|
+
),
|
|
88
|
+
options=make_request_options(
|
|
89
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
90
|
+
),
|
|
91
|
+
cast_to=BillingModel,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
def retrieve(
|
|
95
|
+
self,
|
|
96
|
+
billing_model_id: str,
|
|
97
|
+
*,
|
|
98
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
99
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
100
|
+
extra_headers: Headers | None = None,
|
|
101
|
+
extra_query: Query | None = None,
|
|
102
|
+
extra_body: Body | None = None,
|
|
103
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
104
|
+
) -> BillingModel:
|
|
105
|
+
"""
|
|
106
|
+
Args:
|
|
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
|
+
if not billing_model_id:
|
|
116
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
117
|
+
return self._get(
|
|
118
|
+
f"/api/v1/billing-model/{billing_model_id}",
|
|
119
|
+
options=make_request_options(
|
|
120
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
121
|
+
),
|
|
122
|
+
cast_to=BillingModel,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
def update(
|
|
126
|
+
self,
|
|
127
|
+
billing_model_id: str,
|
|
128
|
+
*,
|
|
129
|
+
type: Literal["costplus"],
|
|
130
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
131
|
+
prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
|
|
132
|
+
prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
|
|
133
|
+
threshold: Optional[float] | NotGiven = NOT_GIVEN,
|
|
134
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
135
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
136
|
+
extra_headers: Headers | None = None,
|
|
137
|
+
extra_query: Query | None = None,
|
|
138
|
+
extra_body: Body | None = None,
|
|
139
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
140
|
+
) -> BillingModel:
|
|
141
|
+
"""
|
|
142
|
+
Args:
|
|
143
|
+
extra_headers: Send extra headers
|
|
144
|
+
|
|
145
|
+
extra_query: Add additional query parameters to the request
|
|
146
|
+
|
|
147
|
+
extra_body: Add additional JSON properties to the request
|
|
148
|
+
|
|
149
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
150
|
+
"""
|
|
151
|
+
if not billing_model_id:
|
|
152
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
153
|
+
return self._put(
|
|
154
|
+
f"/api/v1/billing-model/{billing_model_id}",
|
|
155
|
+
body=maybe_transform(
|
|
156
|
+
{
|
|
157
|
+
"type": type,
|
|
158
|
+
"name": name,
|
|
159
|
+
"prepaid_amount": prepaid_amount,
|
|
160
|
+
"prepaid_max": prepaid_max,
|
|
161
|
+
"threshold": threshold,
|
|
162
|
+
},
|
|
163
|
+
billing_model_update_params.BillingModelUpdateParams,
|
|
164
|
+
),
|
|
165
|
+
options=make_request_options(
|
|
166
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
167
|
+
),
|
|
168
|
+
cast_to=BillingModel,
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
def list(
|
|
172
|
+
self,
|
|
173
|
+
*,
|
|
174
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
175
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
176
|
+
extra_headers: Headers | None = None,
|
|
177
|
+
extra_query: Query | None = None,
|
|
178
|
+
extra_body: Body | None = None,
|
|
179
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
180
|
+
) -> BillingModelListResponse:
|
|
181
|
+
return self._get(
|
|
182
|
+
"/api/v1/billing-model",
|
|
183
|
+
options=make_request_options(
|
|
184
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
185
|
+
),
|
|
186
|
+
cast_to=BillingModelListResponse,
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
def set_default(
|
|
190
|
+
self,
|
|
191
|
+
billing_model_id: str,
|
|
192
|
+
*,
|
|
193
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
194
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
195
|
+
extra_headers: Headers | None = None,
|
|
196
|
+
extra_query: Query | None = None,
|
|
197
|
+
extra_body: Body | None = None,
|
|
198
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
199
|
+
) -> BillingModel:
|
|
200
|
+
"""
|
|
201
|
+
Args:
|
|
202
|
+
extra_headers: Send extra headers
|
|
203
|
+
|
|
204
|
+
extra_query: Add additional query parameters to the request
|
|
205
|
+
|
|
206
|
+
extra_body: Add additional JSON properties to the request
|
|
207
|
+
|
|
208
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
209
|
+
"""
|
|
210
|
+
if not billing_model_id:
|
|
211
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
212
|
+
return self._put(
|
|
213
|
+
f"/api/v1/billing-model/{billing_model_id}/default",
|
|
214
|
+
options=make_request_options(
|
|
215
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
216
|
+
),
|
|
217
|
+
cast_to=BillingModel,
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
class AsyncBillingModelsResource(AsyncAPIResource):
|
|
222
|
+
@cached_property
|
|
223
|
+
def with_raw_response(self) -> AsyncBillingModelsResourceWithRawResponse:
|
|
224
|
+
"""
|
|
225
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
226
|
+
the raw response object instead of the parsed content.
|
|
227
|
+
|
|
228
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
229
|
+
"""
|
|
230
|
+
return AsyncBillingModelsResourceWithRawResponse(self)
|
|
231
|
+
|
|
232
|
+
@cached_property
|
|
233
|
+
def with_streaming_response(self) -> AsyncBillingModelsResourceWithStreamingResponse:
|
|
234
|
+
"""
|
|
235
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
236
|
+
|
|
237
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
|
|
238
|
+
"""
|
|
239
|
+
return AsyncBillingModelsResourceWithStreamingResponse(self)
|
|
240
|
+
|
|
241
|
+
async def create(
|
|
242
|
+
self,
|
|
243
|
+
*,
|
|
244
|
+
name: str,
|
|
245
|
+
type: Literal["costplus"],
|
|
246
|
+
prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
|
|
247
|
+
prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
|
|
248
|
+
threshold: Optional[float] | NotGiven = NOT_GIVEN,
|
|
249
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
250
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
251
|
+
extra_headers: Headers | None = None,
|
|
252
|
+
extra_query: Query | None = None,
|
|
253
|
+
extra_body: Body | None = None,
|
|
254
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
255
|
+
) -> BillingModel:
|
|
256
|
+
"""
|
|
257
|
+
Args:
|
|
258
|
+
extra_headers: Send extra headers
|
|
259
|
+
|
|
260
|
+
extra_query: Add additional query parameters to the request
|
|
261
|
+
|
|
262
|
+
extra_body: Add additional JSON properties to the request
|
|
263
|
+
|
|
264
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
265
|
+
"""
|
|
266
|
+
return await self._post(
|
|
267
|
+
"/api/v1/billing-model",
|
|
268
|
+
body=await async_maybe_transform(
|
|
269
|
+
{
|
|
270
|
+
"name": name,
|
|
271
|
+
"type": type,
|
|
272
|
+
"prepaid_amount": prepaid_amount,
|
|
273
|
+
"prepaid_max": prepaid_max,
|
|
274
|
+
"threshold": threshold,
|
|
275
|
+
},
|
|
276
|
+
billing_model_create_params.BillingModelCreateParams,
|
|
277
|
+
),
|
|
278
|
+
options=make_request_options(
|
|
279
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
280
|
+
),
|
|
281
|
+
cast_to=BillingModel,
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
async def retrieve(
|
|
285
|
+
self,
|
|
286
|
+
billing_model_id: str,
|
|
287
|
+
*,
|
|
288
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
289
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
290
|
+
extra_headers: Headers | None = None,
|
|
291
|
+
extra_query: Query | None = None,
|
|
292
|
+
extra_body: Body | None = None,
|
|
293
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
294
|
+
) -> BillingModel:
|
|
295
|
+
"""
|
|
296
|
+
Args:
|
|
297
|
+
extra_headers: Send extra headers
|
|
298
|
+
|
|
299
|
+
extra_query: Add additional query parameters to the request
|
|
300
|
+
|
|
301
|
+
extra_body: Add additional JSON properties to the request
|
|
302
|
+
|
|
303
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
304
|
+
"""
|
|
305
|
+
if not billing_model_id:
|
|
306
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
307
|
+
return await self._get(
|
|
308
|
+
f"/api/v1/billing-model/{billing_model_id}",
|
|
309
|
+
options=make_request_options(
|
|
310
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
311
|
+
),
|
|
312
|
+
cast_to=BillingModel,
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
async def update(
|
|
316
|
+
self,
|
|
317
|
+
billing_model_id: str,
|
|
318
|
+
*,
|
|
319
|
+
type: Literal["costplus"],
|
|
320
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
321
|
+
prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
|
|
322
|
+
prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
|
|
323
|
+
threshold: Optional[float] | NotGiven = NOT_GIVEN,
|
|
324
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
325
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
326
|
+
extra_headers: Headers | None = None,
|
|
327
|
+
extra_query: Query | None = None,
|
|
328
|
+
extra_body: Body | None = None,
|
|
329
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
330
|
+
) -> BillingModel:
|
|
331
|
+
"""
|
|
332
|
+
Args:
|
|
333
|
+
extra_headers: Send extra headers
|
|
334
|
+
|
|
335
|
+
extra_query: Add additional query parameters to the request
|
|
336
|
+
|
|
337
|
+
extra_body: Add additional JSON properties to the request
|
|
338
|
+
|
|
339
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
340
|
+
"""
|
|
341
|
+
if not billing_model_id:
|
|
342
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
343
|
+
return await self._put(
|
|
344
|
+
f"/api/v1/billing-model/{billing_model_id}",
|
|
345
|
+
body=await async_maybe_transform(
|
|
346
|
+
{
|
|
347
|
+
"type": type,
|
|
348
|
+
"name": name,
|
|
349
|
+
"prepaid_amount": prepaid_amount,
|
|
350
|
+
"prepaid_max": prepaid_max,
|
|
351
|
+
"threshold": threshold,
|
|
352
|
+
},
|
|
353
|
+
billing_model_update_params.BillingModelUpdateParams,
|
|
354
|
+
),
|
|
355
|
+
options=make_request_options(
|
|
356
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
357
|
+
),
|
|
358
|
+
cast_to=BillingModel,
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
async def list(
|
|
362
|
+
self,
|
|
363
|
+
*,
|
|
364
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
365
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
366
|
+
extra_headers: Headers | None = None,
|
|
367
|
+
extra_query: Query | None = None,
|
|
368
|
+
extra_body: Body | None = None,
|
|
369
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
370
|
+
) -> BillingModelListResponse:
|
|
371
|
+
return await self._get(
|
|
372
|
+
"/api/v1/billing-model",
|
|
373
|
+
options=make_request_options(
|
|
374
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
375
|
+
),
|
|
376
|
+
cast_to=BillingModelListResponse,
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
async def set_default(
|
|
380
|
+
self,
|
|
381
|
+
billing_model_id: str,
|
|
382
|
+
*,
|
|
383
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
384
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
385
|
+
extra_headers: Headers | None = None,
|
|
386
|
+
extra_query: Query | None = None,
|
|
387
|
+
extra_body: Body | None = None,
|
|
388
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
389
|
+
) -> BillingModel:
|
|
390
|
+
"""
|
|
391
|
+
Args:
|
|
392
|
+
extra_headers: Send extra headers
|
|
393
|
+
|
|
394
|
+
extra_query: Add additional query parameters to the request
|
|
395
|
+
|
|
396
|
+
extra_body: Add additional JSON properties to the request
|
|
397
|
+
|
|
398
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
399
|
+
"""
|
|
400
|
+
if not billing_model_id:
|
|
401
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
402
|
+
return await self._put(
|
|
403
|
+
f"/api/v1/billing-model/{billing_model_id}/default",
|
|
404
|
+
options=make_request_options(
|
|
405
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
406
|
+
),
|
|
407
|
+
cast_to=BillingModel,
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
class BillingModelsResourceWithRawResponse:
|
|
412
|
+
def __init__(self, billing_models: BillingModelsResource) -> None:
|
|
413
|
+
self._billing_models = billing_models
|
|
414
|
+
|
|
415
|
+
self.create = to_raw_response_wrapper(
|
|
416
|
+
billing_models.create,
|
|
417
|
+
)
|
|
418
|
+
self.retrieve = to_raw_response_wrapper(
|
|
419
|
+
billing_models.retrieve,
|
|
420
|
+
)
|
|
421
|
+
self.update = to_raw_response_wrapper(
|
|
422
|
+
billing_models.update,
|
|
423
|
+
)
|
|
424
|
+
self.list = to_raw_response_wrapper(
|
|
425
|
+
billing_models.list,
|
|
426
|
+
)
|
|
427
|
+
self.set_default = to_raw_response_wrapper(
|
|
428
|
+
billing_models.set_default,
|
|
429
|
+
)
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
class AsyncBillingModelsResourceWithRawResponse:
|
|
433
|
+
def __init__(self, billing_models: AsyncBillingModelsResource) -> None:
|
|
434
|
+
self._billing_models = billing_models
|
|
435
|
+
|
|
436
|
+
self.create = async_to_raw_response_wrapper(
|
|
437
|
+
billing_models.create,
|
|
438
|
+
)
|
|
439
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
440
|
+
billing_models.retrieve,
|
|
441
|
+
)
|
|
442
|
+
self.update = async_to_raw_response_wrapper(
|
|
443
|
+
billing_models.update,
|
|
444
|
+
)
|
|
445
|
+
self.list = async_to_raw_response_wrapper(
|
|
446
|
+
billing_models.list,
|
|
447
|
+
)
|
|
448
|
+
self.set_default = async_to_raw_response_wrapper(
|
|
449
|
+
billing_models.set_default,
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
class BillingModelsResourceWithStreamingResponse:
|
|
454
|
+
def __init__(self, billing_models: BillingModelsResource) -> None:
|
|
455
|
+
self._billing_models = billing_models
|
|
456
|
+
|
|
457
|
+
self.create = to_streamed_response_wrapper(
|
|
458
|
+
billing_models.create,
|
|
459
|
+
)
|
|
460
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
461
|
+
billing_models.retrieve,
|
|
462
|
+
)
|
|
463
|
+
self.update = to_streamed_response_wrapper(
|
|
464
|
+
billing_models.update,
|
|
465
|
+
)
|
|
466
|
+
self.list = to_streamed_response_wrapper(
|
|
467
|
+
billing_models.list,
|
|
468
|
+
)
|
|
469
|
+
self.set_default = to_streamed_response_wrapper(
|
|
470
|
+
billing_models.set_default,
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
class AsyncBillingModelsResourceWithStreamingResponse:
|
|
475
|
+
def __init__(self, billing_models: AsyncBillingModelsResource) -> None:
|
|
476
|
+
self._billing_models = billing_models
|
|
477
|
+
|
|
478
|
+
self.create = async_to_streamed_response_wrapper(
|
|
479
|
+
billing_models.create,
|
|
480
|
+
)
|
|
481
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
482
|
+
billing_models.retrieve,
|
|
483
|
+
)
|
|
484
|
+
self.update = async_to_streamed_response_wrapper(
|
|
485
|
+
billing_models.update,
|
|
486
|
+
)
|
|
487
|
+
self.list = async_to_streamed_response_wrapper(
|
|
488
|
+
billing_models.list,
|
|
489
|
+
)
|
|
490
|
+
self.set_default = async_to_streamed_response_wrapper(
|
|
491
|
+
billing_models.set_default,
|
|
492
|
+
)
|
|
@@ -71,9 +71,9 @@ class BudgetsResource(SyncAPIResource):
|
|
|
71
71
|
billing_model_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
72
72
|
budget_response_type: Literal["block", "allow"] | NotGiven = NOT_GIVEN,
|
|
73
73
|
budget_tags: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
74
|
-
budget_type: Literal["conservative", "liberal"] | NotGiven = NOT_GIVEN,
|
|
75
74
|
cost_basis: Literal["base", "billed"] | NotGiven = NOT_GIVEN,
|
|
76
75
|
currency: Literal["usd"] | NotGiven = NOT_GIVEN,
|
|
76
|
+
threshold: Optional[float] | NotGiven = NOT_GIVEN,
|
|
77
77
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
78
78
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
79
79
|
extra_headers: Headers | None = None,
|
|
@@ -106,9 +106,9 @@ class BudgetsResource(SyncAPIResource):
|
|
|
106
106
|
"billing_model_id": billing_model_id,
|
|
107
107
|
"budget_response_type": budget_response_type,
|
|
108
108
|
"budget_tags": budget_tags,
|
|
109
|
-
"budget_type": budget_type,
|
|
110
109
|
"cost_basis": cost_basis,
|
|
111
110
|
"currency": currency,
|
|
111
|
+
"threshold": threshold,
|
|
112
112
|
},
|
|
113
113
|
budget_create_params.BudgetCreateParams,
|
|
114
114
|
),
|
|
@@ -334,9 +334,9 @@ class AsyncBudgetsResource(AsyncAPIResource):
|
|
|
334
334
|
billing_model_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
335
335
|
budget_response_type: Literal["block", "allow"] | NotGiven = NOT_GIVEN,
|
|
336
336
|
budget_tags: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
337
|
-
budget_type: Literal["conservative", "liberal"] | NotGiven = NOT_GIVEN,
|
|
338
337
|
cost_basis: Literal["base", "billed"] | NotGiven = NOT_GIVEN,
|
|
339
338
|
currency: Literal["usd"] | NotGiven = NOT_GIVEN,
|
|
339
|
+
threshold: Optional[float] | NotGiven = NOT_GIVEN,
|
|
340
340
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
341
341
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
342
342
|
extra_headers: Headers | None = None,
|
|
@@ -366,9 +366,9 @@ class AsyncBudgetsResource(AsyncAPIResource):
|
|
|
366
366
|
"billing_model_id": billing_model_id,
|
|
367
367
|
"budget_response_type": budget_response_type,
|
|
368
368
|
"budget_tags": budget_tags,
|
|
369
|
-
"budget_type": budget_type,
|
|
370
369
|
"cost_basis": cost_basis,
|
|
371
370
|
"currency": currency,
|
|
371
|
+
"threshold": threshold,
|
|
372
372
|
},
|
|
373
373
|
budget_create_params.BudgetCreateParams,
|
|
374
374
|
),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Union
|
|
5
|
+
from typing import Dict, Union
|
|
6
6
|
from datetime import datetime
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
@@ -53,10 +53,10 @@ class ResourcesResource(SyncAPIResource):
|
|
|
53
53
|
resource: str,
|
|
54
54
|
*,
|
|
55
55
|
category: str,
|
|
56
|
-
|
|
56
|
+
units: Dict[str, resource_create_params.Units],
|
|
57
57
|
max_input_units: int | NotGiven = NOT_GIVEN,
|
|
58
58
|
max_output_units: int | NotGiven = NOT_GIVEN,
|
|
59
|
-
|
|
59
|
+
max_total_units: int | NotGiven = NOT_GIVEN,
|
|
60
60
|
start_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
61
61
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
62
62
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -85,10 +85,10 @@ class ResourcesResource(SyncAPIResource):
|
|
|
85
85
|
f"/api/v1/categories/{category}/resources/{resource}",
|
|
86
86
|
body=maybe_transform(
|
|
87
87
|
{
|
|
88
|
-
"
|
|
88
|
+
"units": units,
|
|
89
89
|
"max_input_units": max_input_units,
|
|
90
90
|
"max_output_units": max_output_units,
|
|
91
|
-
"
|
|
91
|
+
"max_total_units": max_total_units,
|
|
92
92
|
"start_timestamp": start_timestamp,
|
|
93
93
|
},
|
|
94
94
|
resource_create_params.ResourceCreateParams,
|
|
@@ -239,10 +239,10 @@ class AsyncResourcesResource(AsyncAPIResource):
|
|
|
239
239
|
resource: str,
|
|
240
240
|
*,
|
|
241
241
|
category: str,
|
|
242
|
-
|
|
242
|
+
units: Dict[str, resource_create_params.Units],
|
|
243
243
|
max_input_units: int | NotGiven = NOT_GIVEN,
|
|
244
244
|
max_output_units: int | NotGiven = NOT_GIVEN,
|
|
245
|
-
|
|
245
|
+
max_total_units: int | NotGiven = NOT_GIVEN,
|
|
246
246
|
start_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
247
247
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
248
248
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -271,10 +271,10 @@ class AsyncResourcesResource(AsyncAPIResource):
|
|
|
271
271
|
f"/api/v1/categories/{category}/resources/{resource}",
|
|
272
272
|
body=await async_maybe_transform(
|
|
273
273
|
{
|
|
274
|
-
"
|
|
274
|
+
"units": units,
|
|
275
275
|
"max_input_units": max_input_units,
|
|
276
276
|
"max_output_units": max_output_units,
|
|
277
|
-
"
|
|
277
|
+
"max_total_units": max_total_units,
|
|
278
278
|
"start_timestamp": start_timestamp,
|
|
279
279
|
},
|
|
280
280
|
resource_create_params.ResourceCreateParams,
|