payi 0.1.0a55__py3-none-any.whl → 0.1.0a56__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.

Files changed (57) hide show
  1. payi/_client.py +10 -17
  2. payi/_version.py +1 -1
  3. payi/lib/helpers.py +2 -2
  4. payi/resources/__init__.py +14 -28
  5. payi/resources/categories/resources.py +7 -7
  6. payi/resources/experiences/types/types.py +5 -2
  7. payi/resources/ingest.py +22 -12
  8. payi/resources/limits/limits.py +4 -0
  9. payi/resources/limits/tags.py +12 -0
  10. payi/resources/requests/properties.py +1 -1
  11. payi/resources/use_cases/__init__.py +47 -0
  12. payi/resources/use_cases/properties.py +174 -0
  13. payi/resources/use_cases/types/__init__.py +33 -0
  14. payi/resources/use_cases/types/limit_config.py +275 -0
  15. payi/resources/{billing_models.py → use_cases/types/types.py} +225 -161
  16. payi/resources/{price_modifiers.py → use_cases/use_cases.py} +160 -130
  17. payi/types/__init__.py +6 -9
  18. payi/types/categories/resource_create_params.py +6 -6
  19. payi/types/category_resource_response.py +2 -2
  20. payi/types/experience_instance_response.py +2 -0
  21. payi/types/experiences/__init__.py +0 -1
  22. payi/types/experiences/experience_type.py +8 -14
  23. payi/types/experiences/type_create_params.py +8 -14
  24. payi/types/ingest_event_param.py +10 -0
  25. payi/types/ingest_response.py +2 -0
  26. payi/types/ingest_units_params.py +9 -1
  27. payi/types/limit_list_params.py +6 -1
  28. payi/types/limits/tag_create_params.py +1 -0
  29. payi/types/limits/tag_remove_params.py +1 -0
  30. payi/types/limits/tag_update_params.py +1 -0
  31. payi/types/requests/request_result.py +2 -0
  32. payi/types/shared/__init__.py +4 -0
  33. payi/types/shared/pay_i_common_models_budget_management_create_limit_base.py +18 -0
  34. payi/types/shared_params/__init__.py +5 -0
  35. payi/types/shared_params/pay_i_common_models_budget_management_create_limit_base.py +18 -0
  36. payi/types/use_case_instance_response.py +15 -0
  37. payi/types/use_cases/__init__.py +10 -0
  38. payi/types/use_cases/property_create_params.py +12 -0
  39. payi/types/use_cases/type_create_params.py +22 -0
  40. payi/types/use_cases/type_list_params.py +12 -0
  41. payi/types/{billing_model_list_response.py → use_cases/type_list_response.py} +3 -3
  42. payi/types/use_cases/type_update_params.py +14 -0
  43. payi/types/use_cases/types/__init__.py +5 -0
  44. payi/types/use_cases/types/limit_config_create_params.py +18 -0
  45. payi/types/use_cases/use_case_type.py +24 -0
  46. {payi-0.1.0a55.dist-info → payi-0.1.0a56.dist-info}/METADATA +1 -1
  47. {payi-0.1.0a55.dist-info → payi-0.1.0a56.dist-info}/RECORD +50 -41
  48. payi/types/billing_model.py +0 -31
  49. payi/types/billing_model_create_params.py +0 -22
  50. payi/types/billing_model_update_params.py +0 -22
  51. payi/types/price_modifier.py +0 -26
  52. payi/types/price_modifier_create_params.py +0 -17
  53. payi/types/price_modifier_retrieve_response.py +0 -10
  54. payi/types/price_modifier_update_params.py +0 -17
  55. /payi/types/{experiences → shared}/properties_response.py +0 -0
  56. {payi-0.1.0a55.dist-info → payi-0.1.0a56.dist-info}/WHEEL +0 -0
  57. {payi-0.1.0a55.dist-info → payi-0.1.0a56.dist-info}/licenses/LICENSE +0 -0
@@ -3,68 +3,82 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from typing import Optional
6
- from typing_extensions import Literal
7
6
 
8
7
  import httpx
9
8
 
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 (
9
+ from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10
+ from ...._utils import (
13
11
  maybe_transform,
14
12
  async_maybe_transform,
15
13
  )
16
- from .._compat import cached_property
17
- from .._resource import SyncAPIResource, AsyncAPIResource
18
- from .._response import (
14
+ from ...._compat import cached_property
15
+ from ...._resource import SyncAPIResource, AsyncAPIResource
16
+ from ...._response import (
19
17
  to_raw_response_wrapper,
20
18
  to_streamed_response_wrapper,
21
19
  async_to_raw_response_wrapper,
22
20
  async_to_streamed_response_wrapper,
23
21
  )
24
- from .._base_client import make_request_options
25
- from ..types.billing_model import BillingModel
26
- from ..types.billing_model_list_response import BillingModelListResponse
22
+ from .limit_config import (
23
+ LimitConfigResource,
24
+ AsyncLimitConfigResource,
25
+ LimitConfigResourceWithRawResponse,
26
+ AsyncLimitConfigResourceWithRawResponse,
27
+ LimitConfigResourceWithStreamingResponse,
28
+ AsyncLimitConfigResourceWithStreamingResponse,
29
+ )
30
+ from ...._base_client import make_request_options
31
+ from ....types.use_cases import type_list_params, type_create_params, type_update_params
32
+ from ....types.use_cases.use_case_type import UseCaseType
33
+ from ....types.use_cases.type_list_response import TypeListResponse
34
+ from ....types.shared_params.pay_i_common_models_budget_management_create_limit_base import (
35
+ PayICommonModelsBudgetManagementCreateLimitBase,
36
+ )
27
37
 
28
- __all__ = ["BillingModelsResource", "AsyncBillingModelsResource"]
38
+ __all__ = ["TypesResource", "AsyncTypesResource"]
29
39
 
30
40
 
31
- class BillingModelsResource(SyncAPIResource):
41
+ class TypesResource(SyncAPIResource):
42
+ @cached_property
43
+ def limit_config(self) -> LimitConfigResource:
44
+ return LimitConfigResource(self._client)
45
+
32
46
  @cached_property
33
- def with_raw_response(self) -> BillingModelsResourceWithRawResponse:
47
+ def with_raw_response(self) -> TypesResourceWithRawResponse:
34
48
  """
35
49
  This property can be used as a prefix for any HTTP method call to return
36
50
  the raw response object instead of the parsed content.
37
51
 
38
52
  For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
39
53
  """
40
- return BillingModelsResourceWithRawResponse(self)
54
+ return TypesResourceWithRawResponse(self)
41
55
 
42
56
  @cached_property
43
- def with_streaming_response(self) -> BillingModelsResourceWithStreamingResponse:
57
+ def with_streaming_response(self) -> TypesResourceWithStreamingResponse:
44
58
  """
45
59
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
46
60
 
47
61
  For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
48
62
  """
49
- return BillingModelsResourceWithStreamingResponse(self)
63
+ return TypesResourceWithStreamingResponse(self)
50
64
 
51
65
  def create(
52
66
  self,
53
67
  *,
68
+ description: str,
54
69
  name: str,
55
- type: Literal["costplus", "subscription", "hybrid"],
56
- default_price_modifier: Optional[float] | NotGiven = NOT_GIVEN,
57
- prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
58
- prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
59
- threshold: Optional[float] | NotGiven = NOT_GIVEN,
70
+ limit_config: PayICommonModelsBudgetManagementCreateLimitBase | NotGiven = NOT_GIVEN,
71
+ logging_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
60
72
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
61
73
  # The extra values given here take precedence over values defined on the client or passed to this method.
62
74
  extra_headers: Headers | None = None,
63
75
  extra_query: Query | None = None,
64
76
  extra_body: Body | None = None,
65
77
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
66
- ) -> BillingModel:
78
+ ) -> UseCaseType:
67
79
  """
80
+ Create a new Use Case
81
+
68
82
  Args:
69
83
  extra_headers: Send extra headers
70
84
 
@@ -75,27 +89,25 @@ class BillingModelsResource(SyncAPIResource):
75
89
  timeout: Override the client-level default timeout for this request, in seconds
76
90
  """
77
91
  return self._post(
78
- "/api/v1/billing-model",
92
+ "/api/v1/use_cases/types",
79
93
  body=maybe_transform(
80
94
  {
95
+ "description": description,
81
96
  "name": name,
82
- "type": type,
83
- "default_price_modifier": default_price_modifier,
84
- "prepaid_amount": prepaid_amount,
85
- "prepaid_max": prepaid_max,
86
- "threshold": threshold,
97
+ "limit_config": limit_config,
98
+ "logging_enabled": logging_enabled,
87
99
  },
88
- billing_model_create_params.BillingModelCreateParams,
100
+ type_create_params.TypeCreateParams,
89
101
  ),
90
102
  options=make_request_options(
91
103
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
92
104
  ),
93
- cast_to=BillingModel,
105
+ cast_to=UseCaseType,
94
106
  )
95
107
 
96
108
  def retrieve(
97
109
  self,
98
- billing_model_id: str,
110
+ use_case_name: str,
99
111
  *,
100
112
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
101
113
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -103,8 +115,10 @@ class BillingModelsResource(SyncAPIResource):
103
115
  extra_query: Query | None = None,
104
116
  extra_body: Body | None = None,
105
117
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
106
- ) -> BillingModel:
118
+ ) -> UseCaseType:
107
119
  """
120
+ Get Use Case details
121
+
108
122
  Args:
109
123
  extra_headers: Send extra headers
110
124
 
@@ -114,34 +128,32 @@ class BillingModelsResource(SyncAPIResource):
114
128
 
115
129
  timeout: Override the client-level default timeout for this request, in seconds
116
130
  """
117
- if not billing_model_id:
118
- raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
131
+ if not use_case_name:
132
+ raise ValueError(f"Expected a non-empty value for `use_case_name` but received {use_case_name!r}")
119
133
  return self._get(
120
- f"/api/v1/billing-model/{billing_model_id}",
134
+ f"/api/v1/use_cases/types/{use_case_name}",
121
135
  options=make_request_options(
122
136
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
123
137
  ),
124
- cast_to=BillingModel,
138
+ cast_to=UseCaseType,
125
139
  )
126
140
 
127
141
  def update(
128
142
  self,
129
- billing_model_id: str,
143
+ use_case_name: str,
130
144
  *,
131
- type: Literal["costplus", "subscription", "hybrid"],
132
- default_price_modifier: Optional[float] | NotGiven = NOT_GIVEN,
133
- name: Optional[str] | NotGiven = NOT_GIVEN,
134
- prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
135
- prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
136
- threshold: Optional[float] | NotGiven = NOT_GIVEN,
145
+ description: Optional[str] | NotGiven = NOT_GIVEN,
146
+ logging_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
137
147
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
138
148
  # The extra values given here take precedence over values defined on the client or passed to this method.
139
149
  extra_headers: Headers | None = None,
140
150
  extra_query: Query | None = None,
141
151
  extra_body: Body | None = None,
142
152
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
143
- ) -> BillingModel:
153
+ ) -> UseCaseType:
144
154
  """
155
+ Update a Use Case configuration
156
+
145
157
  Args:
146
158
  extra_headers: Send extra headers
147
159
 
@@ -151,48 +163,63 @@ class BillingModelsResource(SyncAPIResource):
151
163
 
152
164
  timeout: Override the client-level default timeout for this request, in seconds
153
165
  """
154
- if not billing_model_id:
155
- raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
156
- return self._put(
157
- f"/api/v1/billing-model/{billing_model_id}",
166
+ if not use_case_name:
167
+ raise ValueError(f"Expected a non-empty value for `use_case_name` but received {use_case_name!r}")
168
+ return self._patch(
169
+ f"/api/v1/use_cases/types/{use_case_name}",
158
170
  body=maybe_transform(
159
171
  {
160
- "type": type,
161
- "default_price_modifier": default_price_modifier,
162
- "name": name,
163
- "prepaid_amount": prepaid_amount,
164
- "prepaid_max": prepaid_max,
165
- "threshold": threshold,
172
+ "description": description,
173
+ "logging_enabled": logging_enabled,
166
174
  },
167
- billing_model_update_params.BillingModelUpdateParams,
175
+ type_update_params.TypeUpdateParams,
168
176
  ),
169
177
  options=make_request_options(
170
178
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
171
179
  ),
172
- cast_to=BillingModel,
180
+ cast_to=UseCaseType,
173
181
  )
174
182
 
175
183
  def list(
176
184
  self,
177
185
  *,
186
+ use_case_name: str | NotGiven = NOT_GIVEN,
178
187
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
179
188
  # The extra values given here take precedence over values defined on the client or passed to this method.
180
189
  extra_headers: Headers | None = None,
181
190
  extra_query: Query | None = None,
182
191
  extra_body: Body | None = None,
183
192
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
184
- ) -> BillingModelListResponse:
193
+ ) -> TypeListResponse:
194
+ """
195
+ Get all Use Cases
196
+
197
+ Args:
198
+ use_case_name: Use Case name
199
+
200
+ extra_headers: Send extra headers
201
+
202
+ extra_query: Add additional query parameters to the request
203
+
204
+ extra_body: Add additional JSON properties to the request
205
+
206
+ timeout: Override the client-level default timeout for this request, in seconds
207
+ """
185
208
  return self._get(
186
- "/api/v1/billing-model",
209
+ "/api/v1/use_cases/types",
187
210
  options=make_request_options(
188
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
211
+ extra_headers=extra_headers,
212
+ extra_query=extra_query,
213
+ extra_body=extra_body,
214
+ timeout=timeout,
215
+ query=maybe_transform({"use_case_name": use_case_name}, type_list_params.TypeListParams),
189
216
  ),
190
- cast_to=BillingModelListResponse,
217
+ cast_to=TypeListResponse,
191
218
  )
192
219
 
193
- def set_default(
220
+ def delete(
194
221
  self,
195
- billing_model_id: str,
222
+ use_case_name: str,
196
223
  *,
197
224
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
198
225
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -200,8 +227,10 @@ class BillingModelsResource(SyncAPIResource):
200
227
  extra_query: Query | None = None,
201
228
  extra_body: Body | None = None,
202
229
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
203
- ) -> BillingModel:
230
+ ) -> UseCaseType:
204
231
  """
232
+ Delete a Use Case
233
+
205
234
  Args:
206
235
  extra_headers: Send extra headers
207
236
 
@@ -211,54 +240,58 @@ class BillingModelsResource(SyncAPIResource):
211
240
 
212
241
  timeout: Override the client-level default timeout for this request, in seconds
213
242
  """
214
- if not billing_model_id:
215
- raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
216
- return self._put(
217
- f"/api/v1/billing-model/{billing_model_id}/default",
243
+ if not use_case_name:
244
+ raise ValueError(f"Expected a non-empty value for `use_case_name` but received {use_case_name!r}")
245
+ return self._delete(
246
+ f"/api/v1/use_cases/types/{use_case_name}",
218
247
  options=make_request_options(
219
248
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
220
249
  ),
221
- cast_to=BillingModel,
250
+ cast_to=UseCaseType,
222
251
  )
223
252
 
224
253
 
225
- class AsyncBillingModelsResource(AsyncAPIResource):
254
+ class AsyncTypesResource(AsyncAPIResource):
226
255
  @cached_property
227
- def with_raw_response(self) -> AsyncBillingModelsResourceWithRawResponse:
256
+ def limit_config(self) -> AsyncLimitConfigResource:
257
+ return AsyncLimitConfigResource(self._client)
258
+
259
+ @cached_property
260
+ def with_raw_response(self) -> AsyncTypesResourceWithRawResponse:
228
261
  """
229
262
  This property can be used as a prefix for any HTTP method call to return
230
263
  the raw response object instead of the parsed content.
231
264
 
232
265
  For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
233
266
  """
234
- return AsyncBillingModelsResourceWithRawResponse(self)
267
+ return AsyncTypesResourceWithRawResponse(self)
235
268
 
236
269
  @cached_property
237
- def with_streaming_response(self) -> AsyncBillingModelsResourceWithStreamingResponse:
270
+ def with_streaming_response(self) -> AsyncTypesResourceWithStreamingResponse:
238
271
  """
239
272
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
240
273
 
241
274
  For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
242
275
  """
243
- return AsyncBillingModelsResourceWithStreamingResponse(self)
276
+ return AsyncTypesResourceWithStreamingResponse(self)
244
277
 
245
278
  async def create(
246
279
  self,
247
280
  *,
281
+ description: str,
248
282
  name: str,
249
- type: Literal["costplus", "subscription", "hybrid"],
250
- default_price_modifier: Optional[float] | NotGiven = NOT_GIVEN,
251
- prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
252
- prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
253
- threshold: Optional[float] | NotGiven = NOT_GIVEN,
283
+ limit_config: PayICommonModelsBudgetManagementCreateLimitBase | NotGiven = NOT_GIVEN,
284
+ logging_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
254
285
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
255
286
  # The extra values given here take precedence over values defined on the client or passed to this method.
256
287
  extra_headers: Headers | None = None,
257
288
  extra_query: Query | None = None,
258
289
  extra_body: Body | None = None,
259
290
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
260
- ) -> BillingModel:
291
+ ) -> UseCaseType:
261
292
  """
293
+ Create a new Use Case
294
+
262
295
  Args:
263
296
  extra_headers: Send extra headers
264
297
 
@@ -269,27 +302,25 @@ class AsyncBillingModelsResource(AsyncAPIResource):
269
302
  timeout: Override the client-level default timeout for this request, in seconds
270
303
  """
271
304
  return await self._post(
272
- "/api/v1/billing-model",
305
+ "/api/v1/use_cases/types",
273
306
  body=await async_maybe_transform(
274
307
  {
308
+ "description": description,
275
309
  "name": name,
276
- "type": type,
277
- "default_price_modifier": default_price_modifier,
278
- "prepaid_amount": prepaid_amount,
279
- "prepaid_max": prepaid_max,
280
- "threshold": threshold,
310
+ "limit_config": limit_config,
311
+ "logging_enabled": logging_enabled,
281
312
  },
282
- billing_model_create_params.BillingModelCreateParams,
313
+ type_create_params.TypeCreateParams,
283
314
  ),
284
315
  options=make_request_options(
285
316
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
286
317
  ),
287
- cast_to=BillingModel,
318
+ cast_to=UseCaseType,
288
319
  )
289
320
 
290
321
  async def retrieve(
291
322
  self,
292
- billing_model_id: str,
323
+ use_case_name: str,
293
324
  *,
294
325
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
295
326
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -297,8 +328,10 @@ class AsyncBillingModelsResource(AsyncAPIResource):
297
328
  extra_query: Query | None = None,
298
329
  extra_body: Body | None = None,
299
330
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
300
- ) -> BillingModel:
331
+ ) -> UseCaseType:
301
332
  """
333
+ Get Use Case details
334
+
302
335
  Args:
303
336
  extra_headers: Send extra headers
304
337
 
@@ -308,34 +341,32 @@ class AsyncBillingModelsResource(AsyncAPIResource):
308
341
 
309
342
  timeout: Override the client-level default timeout for this request, in seconds
310
343
  """
311
- if not billing_model_id:
312
- raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
344
+ if not use_case_name:
345
+ raise ValueError(f"Expected a non-empty value for `use_case_name` but received {use_case_name!r}")
313
346
  return await self._get(
314
- f"/api/v1/billing-model/{billing_model_id}",
347
+ f"/api/v1/use_cases/types/{use_case_name}",
315
348
  options=make_request_options(
316
349
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
317
350
  ),
318
- cast_to=BillingModel,
351
+ cast_to=UseCaseType,
319
352
  )
320
353
 
321
354
  async def update(
322
355
  self,
323
- billing_model_id: str,
356
+ use_case_name: str,
324
357
  *,
325
- type: Literal["costplus", "subscription", "hybrid"],
326
- default_price_modifier: Optional[float] | NotGiven = NOT_GIVEN,
327
- name: Optional[str] | NotGiven = NOT_GIVEN,
328
- prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
329
- prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
330
- threshold: Optional[float] | NotGiven = NOT_GIVEN,
358
+ description: Optional[str] | NotGiven = NOT_GIVEN,
359
+ logging_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
331
360
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
332
361
  # The extra values given here take precedence over values defined on the client or passed to this method.
333
362
  extra_headers: Headers | None = None,
334
363
  extra_query: Query | None = None,
335
364
  extra_body: Body | None = None,
336
365
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
337
- ) -> BillingModel:
366
+ ) -> UseCaseType:
338
367
  """
368
+ Update a Use Case configuration
369
+
339
370
  Args:
340
371
  extra_headers: Send extra headers
341
372
 
@@ -345,48 +376,63 @@ class AsyncBillingModelsResource(AsyncAPIResource):
345
376
 
346
377
  timeout: Override the client-level default timeout for this request, in seconds
347
378
  """
348
- if not billing_model_id:
349
- raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
350
- return await self._put(
351
- f"/api/v1/billing-model/{billing_model_id}",
379
+ if not use_case_name:
380
+ raise ValueError(f"Expected a non-empty value for `use_case_name` but received {use_case_name!r}")
381
+ return await self._patch(
382
+ f"/api/v1/use_cases/types/{use_case_name}",
352
383
  body=await async_maybe_transform(
353
384
  {
354
- "type": type,
355
- "default_price_modifier": default_price_modifier,
356
- "name": name,
357
- "prepaid_amount": prepaid_amount,
358
- "prepaid_max": prepaid_max,
359
- "threshold": threshold,
385
+ "description": description,
386
+ "logging_enabled": logging_enabled,
360
387
  },
361
- billing_model_update_params.BillingModelUpdateParams,
388
+ type_update_params.TypeUpdateParams,
362
389
  ),
363
390
  options=make_request_options(
364
391
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
365
392
  ),
366
- cast_to=BillingModel,
393
+ cast_to=UseCaseType,
367
394
  )
368
395
 
369
396
  async def list(
370
397
  self,
371
398
  *,
399
+ use_case_name: str | NotGiven = NOT_GIVEN,
372
400
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
373
401
  # The extra values given here take precedence over values defined on the client or passed to this method.
374
402
  extra_headers: Headers | None = None,
375
403
  extra_query: Query | None = None,
376
404
  extra_body: Body | None = None,
377
405
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
378
- ) -> BillingModelListResponse:
406
+ ) -> TypeListResponse:
407
+ """
408
+ Get all Use Cases
409
+
410
+ Args:
411
+ use_case_name: Use Case name
412
+
413
+ extra_headers: Send extra headers
414
+
415
+ extra_query: Add additional query parameters to the request
416
+
417
+ extra_body: Add additional JSON properties to the request
418
+
419
+ timeout: Override the client-level default timeout for this request, in seconds
420
+ """
379
421
  return await self._get(
380
- "/api/v1/billing-model",
422
+ "/api/v1/use_cases/types",
381
423
  options=make_request_options(
382
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
424
+ extra_headers=extra_headers,
425
+ extra_query=extra_query,
426
+ extra_body=extra_body,
427
+ timeout=timeout,
428
+ query=await async_maybe_transform({"use_case_name": use_case_name}, type_list_params.TypeListParams),
383
429
  ),
384
- cast_to=BillingModelListResponse,
430
+ cast_to=TypeListResponse,
385
431
  )
386
432
 
387
- async def set_default(
433
+ async def delete(
388
434
  self,
389
- billing_model_id: str,
435
+ use_case_name: str,
390
436
  *,
391
437
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
392
438
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -394,8 +440,10 @@ class AsyncBillingModelsResource(AsyncAPIResource):
394
440
  extra_query: Query | None = None,
395
441
  extra_body: Body | None = None,
396
442
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
397
- ) -> BillingModel:
443
+ ) -> UseCaseType:
398
444
  """
445
+ Delete a Use Case
446
+
399
447
  Args:
400
448
  extra_headers: Send extra headers
401
449
 
@@ -405,96 +453,112 @@ class AsyncBillingModelsResource(AsyncAPIResource):
405
453
 
406
454
  timeout: Override the client-level default timeout for this request, in seconds
407
455
  """
408
- if not billing_model_id:
409
- raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
410
- return await self._put(
411
- f"/api/v1/billing-model/{billing_model_id}/default",
456
+ if not use_case_name:
457
+ raise ValueError(f"Expected a non-empty value for `use_case_name` but received {use_case_name!r}")
458
+ return await self._delete(
459
+ f"/api/v1/use_cases/types/{use_case_name}",
412
460
  options=make_request_options(
413
461
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
414
462
  ),
415
- cast_to=BillingModel,
463
+ cast_to=UseCaseType,
416
464
  )
417
465
 
418
466
 
419
- class BillingModelsResourceWithRawResponse:
420
- def __init__(self, billing_models: BillingModelsResource) -> None:
421
- self._billing_models = billing_models
467
+ class TypesResourceWithRawResponse:
468
+ def __init__(self, types: TypesResource) -> None:
469
+ self._types = types
422
470
 
423
471
  self.create = to_raw_response_wrapper(
424
- billing_models.create,
472
+ types.create,
425
473
  )
426
474
  self.retrieve = to_raw_response_wrapper(
427
- billing_models.retrieve,
475
+ types.retrieve,
428
476
  )
429
477
  self.update = to_raw_response_wrapper(
430
- billing_models.update,
478
+ types.update,
431
479
  )
432
480
  self.list = to_raw_response_wrapper(
433
- billing_models.list,
481
+ types.list,
434
482
  )
435
- self.set_default = to_raw_response_wrapper(
436
- billing_models.set_default,
483
+ self.delete = to_raw_response_wrapper(
484
+ types.delete,
437
485
  )
438
486
 
487
+ @cached_property
488
+ def limit_config(self) -> LimitConfigResourceWithRawResponse:
489
+ return LimitConfigResourceWithRawResponse(self._types.limit_config)
490
+
439
491
 
440
- class AsyncBillingModelsResourceWithRawResponse:
441
- def __init__(self, billing_models: AsyncBillingModelsResource) -> None:
442
- self._billing_models = billing_models
492
+ class AsyncTypesResourceWithRawResponse:
493
+ def __init__(self, types: AsyncTypesResource) -> None:
494
+ self._types = types
443
495
 
444
496
  self.create = async_to_raw_response_wrapper(
445
- billing_models.create,
497
+ types.create,
446
498
  )
447
499
  self.retrieve = async_to_raw_response_wrapper(
448
- billing_models.retrieve,
500
+ types.retrieve,
449
501
  )
450
502
  self.update = async_to_raw_response_wrapper(
451
- billing_models.update,
503
+ types.update,
452
504
  )
453
505
  self.list = async_to_raw_response_wrapper(
454
- billing_models.list,
506
+ types.list,
455
507
  )
456
- self.set_default = async_to_raw_response_wrapper(
457
- billing_models.set_default,
508
+ self.delete = async_to_raw_response_wrapper(
509
+ types.delete,
458
510
  )
459
511
 
512
+ @cached_property
513
+ def limit_config(self) -> AsyncLimitConfigResourceWithRawResponse:
514
+ return AsyncLimitConfigResourceWithRawResponse(self._types.limit_config)
515
+
460
516
 
461
- class BillingModelsResourceWithStreamingResponse:
462
- def __init__(self, billing_models: BillingModelsResource) -> None:
463
- self._billing_models = billing_models
517
+ class TypesResourceWithStreamingResponse:
518
+ def __init__(self, types: TypesResource) -> None:
519
+ self._types = types
464
520
 
465
521
  self.create = to_streamed_response_wrapper(
466
- billing_models.create,
522
+ types.create,
467
523
  )
468
524
  self.retrieve = to_streamed_response_wrapper(
469
- billing_models.retrieve,
525
+ types.retrieve,
470
526
  )
471
527
  self.update = to_streamed_response_wrapper(
472
- billing_models.update,
528
+ types.update,
473
529
  )
474
530
  self.list = to_streamed_response_wrapper(
475
- billing_models.list,
531
+ types.list,
476
532
  )
477
- self.set_default = to_streamed_response_wrapper(
478
- billing_models.set_default,
533
+ self.delete = to_streamed_response_wrapper(
534
+ types.delete,
479
535
  )
480
536
 
537
+ @cached_property
538
+ def limit_config(self) -> LimitConfigResourceWithStreamingResponse:
539
+ return LimitConfigResourceWithStreamingResponse(self._types.limit_config)
540
+
481
541
 
482
- class AsyncBillingModelsResourceWithStreamingResponse:
483
- def __init__(self, billing_models: AsyncBillingModelsResource) -> None:
484
- self._billing_models = billing_models
542
+ class AsyncTypesResourceWithStreamingResponse:
543
+ def __init__(self, types: AsyncTypesResource) -> None:
544
+ self._types = types
485
545
 
486
546
  self.create = async_to_streamed_response_wrapper(
487
- billing_models.create,
547
+ types.create,
488
548
  )
489
549
  self.retrieve = async_to_streamed_response_wrapper(
490
- billing_models.retrieve,
550
+ types.retrieve,
491
551
  )
492
552
  self.update = async_to_streamed_response_wrapper(
493
- billing_models.update,
553
+ types.update,
494
554
  )
495
555
  self.list = async_to_streamed_response_wrapper(
496
- billing_models.list,
556
+ types.list,
497
557
  )
498
- self.set_default = async_to_streamed_response_wrapper(
499
- billing_models.set_default,
558
+ self.delete = async_to_streamed_response_wrapper(
559
+ types.delete,
500
560
  )
561
+
562
+ @cached_property
563
+ def limit_config(self) -> AsyncLimitConfigResourceWithStreamingResponse:
564
+ return AsyncLimitConfigResourceWithStreamingResponse(self._types.limit_config)