payi 0.1.0a58__py3-none-any.whl → 0.1.0a60__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 (48) hide show
  1. payi/_version.py +1 -1
  2. payi/lib/instrument.py +128 -18
  3. payi/pagination.py +50 -0
  4. payi/resources/categories/categories.py +108 -23
  5. payi/resources/categories/resources.py +42 -12
  6. payi/resources/experiences/types/types.py +37 -17
  7. payi/resources/limits/limits.py +21 -30
  8. payi/resources/use_cases/__init__.py +14 -0
  9. payi/resources/use_cases/definitions/__init__.py +14 -0
  10. payi/resources/use_cases/definitions/definitions.py +68 -18
  11. payi/resources/use_cases/definitions/kpis.py +584 -0
  12. payi/resources/use_cases/kpis.py +469 -0
  13. payi/resources/use_cases/use_cases.py +32 -0
  14. payi/types/__init__.py +3 -3
  15. payi/types/categories/__init__.py +1 -1
  16. payi/types/categories/resource_list_params.py +17 -0
  17. payi/types/category_list_params.py +15 -0
  18. payi/types/category_list_resources_params.py +15 -0
  19. payi/types/category_response.py +0 -5
  20. payi/types/experiences/__init__.py +0 -1
  21. payi/types/experiences/type_list_params.py +6 -1
  22. payi/types/limit_list_params.py +4 -13
  23. payi/types/limit_list_response.py +30 -0
  24. payi/types/use_cases/__init__.py +4 -1
  25. payi/types/use_cases/definition_list_params.py +6 -1
  26. payi/types/use_cases/definitions/__init__.py +8 -0
  27. payi/types/use_cases/definitions/kpi_create_params.py +17 -0
  28. payi/types/use_cases/definitions/kpi_create_response.py +20 -0
  29. payi/types/use_cases/definitions/kpi_delete_response.py +20 -0
  30. payi/types/use_cases/definitions/kpi_list_params.py +17 -0
  31. payi/types/use_cases/definitions/kpi_list_response.py +20 -0
  32. payi/types/use_cases/definitions/kpi_retrieve_response.py +20 -0
  33. payi/types/use_cases/definitions/kpi_update_params.py +16 -0
  34. payi/types/use_cases/definitions/kpi_update_response.py +20 -0
  35. payi/types/use_cases/kpi_create_params.py +13 -0
  36. payi/types/use_cases/kpi_list_params.py +17 -0
  37. payi/types/use_cases/kpi_list_response.py +21 -0
  38. payi/types/use_cases/kpi_update_params.py +13 -0
  39. {payi-0.1.0a58.dist-info → payi-0.1.0a60.dist-info}/METADATA +91 -28
  40. {payi-0.1.0a58.dist-info → payi-0.1.0a60.dist-info}/RECORD +42 -29
  41. payi/types/categories/resource_list_response.py +0 -10
  42. payi/types/category_list_resources_response.py +0 -10
  43. payi/types/category_list_response.py +0 -10
  44. payi/types/experiences/type_list_response.py +0 -10
  45. payi/types/paged_limit_list.py +0 -52
  46. payi/types/use_cases/definition_list_response.py +0 -10
  47. {payi-0.1.0a58.dist-info → payi-0.1.0a60.dist-info}/WHEEL +0 -0
  48. {payi-0.1.0a58.dist-info → payi-0.1.0a60.dist-info}/licenses/LICENSE +0 -0
@@ -20,10 +20,10 @@ from ..._response import (
20
20
  async_to_raw_response_wrapper,
21
21
  async_to_streamed_response_wrapper,
22
22
  )
23
- from ..._base_client import make_request_options
24
- from ...types.categories import resource_create_params
23
+ from ...pagination import SyncCursorPage, AsyncCursorPage
24
+ from ..._base_client import AsyncPaginator, make_request_options
25
+ from ...types.categories import resource_list_params, resource_create_params
25
26
  from ...types.category_resource_response import CategoryResourceResponse
26
- from ...types.categories.resource_list_response import ResourceListResponse
27
27
 
28
28
  __all__ = ["ResourcesResource", "AsyncResourcesResource"]
29
29
 
@@ -143,13 +143,16 @@ class ResourcesResource(SyncAPIResource):
143
143
  resource: str,
144
144
  *,
145
145
  category: str,
146
+ cursor: str | NotGiven = NOT_GIVEN,
147
+ limit: int | NotGiven = NOT_GIVEN,
148
+ sort_ascending: bool | NotGiven = NOT_GIVEN,
146
149
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
147
150
  # The extra values given here take precedence over values defined on the client or passed to this method.
148
151
  extra_headers: Headers | None = None,
149
152
  extra_query: Query | None = None,
150
153
  extra_body: Body | None = None,
151
154
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
152
- ) -> ResourceListResponse:
155
+ ) -> SyncCursorPage[CategoryResourceResponse]:
153
156
  """
154
157
  Get a list of versions of a Resource
155
158
 
@@ -166,12 +169,24 @@ class ResourcesResource(SyncAPIResource):
166
169
  raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
167
170
  if not resource:
168
171
  raise ValueError(f"Expected a non-empty value for `resource` but received {resource!r}")
169
- return self._get(
172
+ return self._get_api_list(
170
173
  f"/api/v1/categories/{category}/resources/{resource}",
174
+ page=SyncCursorPage[CategoryResourceResponse],
171
175
  options=make_request_options(
172
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
176
+ extra_headers=extra_headers,
177
+ extra_query=extra_query,
178
+ extra_body=extra_body,
179
+ timeout=timeout,
180
+ query=maybe_transform(
181
+ {
182
+ "cursor": cursor,
183
+ "limit": limit,
184
+ "sort_ascending": sort_ascending,
185
+ },
186
+ resource_list_params.ResourceListParams,
187
+ ),
173
188
  ),
174
- cast_to=ResourceListResponse,
189
+ model=CategoryResourceResponse,
175
190
  )
176
191
 
177
192
  def delete(
@@ -324,18 +339,21 @@ class AsyncResourcesResource(AsyncAPIResource):
324
339
  cast_to=CategoryResourceResponse,
325
340
  )
326
341
 
327
- async def list(
342
+ def list(
328
343
  self,
329
344
  resource: str,
330
345
  *,
331
346
  category: str,
347
+ cursor: str | NotGiven = NOT_GIVEN,
348
+ limit: int | NotGiven = NOT_GIVEN,
349
+ sort_ascending: bool | NotGiven = NOT_GIVEN,
332
350
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
333
351
  # The extra values given here take precedence over values defined on the client or passed to this method.
334
352
  extra_headers: Headers | None = None,
335
353
  extra_query: Query | None = None,
336
354
  extra_body: Body | None = None,
337
355
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
338
- ) -> ResourceListResponse:
356
+ ) -> AsyncPaginator[CategoryResourceResponse, AsyncCursorPage[CategoryResourceResponse]]:
339
357
  """
340
358
  Get a list of versions of a Resource
341
359
 
@@ -352,12 +370,24 @@ class AsyncResourcesResource(AsyncAPIResource):
352
370
  raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
353
371
  if not resource:
354
372
  raise ValueError(f"Expected a non-empty value for `resource` but received {resource!r}")
355
- return await self._get(
373
+ return self._get_api_list(
356
374
  f"/api/v1/categories/{category}/resources/{resource}",
375
+ page=AsyncCursorPage[CategoryResourceResponse],
357
376
  options=make_request_options(
358
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
377
+ extra_headers=extra_headers,
378
+ extra_query=extra_query,
379
+ extra_body=extra_body,
380
+ timeout=timeout,
381
+ query=maybe_transform(
382
+ {
383
+ "cursor": cursor,
384
+ "limit": limit,
385
+ "sort_ascending": sort_ascending,
386
+ },
387
+ resource_list_params.ResourceListParams,
388
+ ),
359
389
  ),
360
- cast_to=ResourceListResponse,
390
+ model=CategoryResourceResponse,
361
391
  )
362
392
 
363
393
  async def delete(
@@ -27,10 +27,10 @@ from .limit_config import (
27
27
  LimitConfigResourceWithStreamingResponse,
28
28
  AsyncLimitConfigResourceWithStreamingResponse,
29
29
  )
30
- from ...._base_client import make_request_options
30
+ from ....pagination import SyncCursorPage, AsyncCursorPage
31
+ from ...._base_client import AsyncPaginator, make_request_options
31
32
  from ....types.experiences import type_list_params, type_create_params, type_update_params
32
33
  from ....types.experiences.experience_type import ExperienceType
33
- from ....types.experiences.type_list_response import TypeListResponse
34
34
  from ....types.shared_params.pay_i_common_models_budget_management_create_limit_base import (
35
35
  PayICommonModelsBudgetManagementCreateLimitBase,
36
36
  )
@@ -165,7 +165,7 @@ class TypesResource(SyncAPIResource):
165
165
  """
166
166
  if not experience_name:
167
167
  raise ValueError(f"Expected a non-empty value for `experience_name` but received {experience_name!r}")
168
- return self._patch(
168
+ return self._put(
169
169
  f"/api/v1/experiences/types/{experience_name}",
170
170
  body=maybe_transform(
171
171
  {
@@ -183,20 +183,21 @@ class TypesResource(SyncAPIResource):
183
183
  def list(
184
184
  self,
185
185
  *,
186
+ cursor: str | NotGiven = NOT_GIVEN,
187
+ limit: int | NotGiven = NOT_GIVEN,
186
188
  name: str | NotGiven = NOT_GIVEN,
189
+ sort_ascending: bool | NotGiven = NOT_GIVEN,
187
190
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
188
191
  # The extra values given here take precedence over values defined on the client or passed to this method.
189
192
  extra_headers: Headers | None = None,
190
193
  extra_query: Query | None = None,
191
194
  extra_body: Body | None = None,
192
195
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
193
- ) -> TypeListResponse:
196
+ ) -> SyncCursorPage[ExperienceType]:
194
197
  """
195
198
  Get all Experience Types
196
199
 
197
200
  Args:
198
- name: Experience Type Name
199
-
200
201
  extra_headers: Send extra headers
201
202
 
202
203
  extra_query: Add additional query parameters to the request
@@ -205,16 +206,25 @@ class TypesResource(SyncAPIResource):
205
206
 
206
207
  timeout: Override the client-level default timeout for this request, in seconds
207
208
  """
208
- return self._get(
209
+ return self._get_api_list(
209
210
  "/api/v1/experiences/types",
211
+ page=SyncCursorPage[ExperienceType],
210
212
  options=make_request_options(
211
213
  extra_headers=extra_headers,
212
214
  extra_query=extra_query,
213
215
  extra_body=extra_body,
214
216
  timeout=timeout,
215
- query=maybe_transform({"name": name}, type_list_params.TypeListParams),
217
+ query=maybe_transform(
218
+ {
219
+ "cursor": cursor,
220
+ "limit": limit,
221
+ "name": name,
222
+ "sort_ascending": sort_ascending,
223
+ },
224
+ type_list_params.TypeListParams,
225
+ ),
216
226
  ),
217
- cast_to=TypeListResponse,
227
+ model=ExperienceType,
218
228
  )
219
229
 
220
230
  def delete(
@@ -378,7 +388,7 @@ class AsyncTypesResource(AsyncAPIResource):
378
388
  """
379
389
  if not experience_name:
380
390
  raise ValueError(f"Expected a non-empty value for `experience_name` but received {experience_name!r}")
381
- return await self._patch(
391
+ return await self._put(
382
392
  f"/api/v1/experiences/types/{experience_name}",
383
393
  body=await async_maybe_transform(
384
394
  {
@@ -393,23 +403,24 @@ class AsyncTypesResource(AsyncAPIResource):
393
403
  cast_to=ExperienceType,
394
404
  )
395
405
 
396
- async def list(
406
+ def list(
397
407
  self,
398
408
  *,
409
+ cursor: str | NotGiven = NOT_GIVEN,
410
+ limit: int | NotGiven = NOT_GIVEN,
399
411
  name: str | NotGiven = NOT_GIVEN,
412
+ sort_ascending: bool | NotGiven = NOT_GIVEN,
400
413
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
401
414
  # The extra values given here take precedence over values defined on the client or passed to this method.
402
415
  extra_headers: Headers | None = None,
403
416
  extra_query: Query | None = None,
404
417
  extra_body: Body | None = None,
405
418
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
406
- ) -> TypeListResponse:
419
+ ) -> AsyncPaginator[ExperienceType, AsyncCursorPage[ExperienceType]]:
407
420
  """
408
421
  Get all Experience Types
409
422
 
410
423
  Args:
411
- name: Experience Type Name
412
-
413
424
  extra_headers: Send extra headers
414
425
 
415
426
  extra_query: Add additional query parameters to the request
@@ -418,16 +429,25 @@ class AsyncTypesResource(AsyncAPIResource):
418
429
 
419
430
  timeout: Override the client-level default timeout for this request, in seconds
420
431
  """
421
- return await self._get(
432
+ return self._get_api_list(
422
433
  "/api/v1/experiences/types",
434
+ page=AsyncCursorPage[ExperienceType],
423
435
  options=make_request_options(
424
436
  extra_headers=extra_headers,
425
437
  extra_query=extra_query,
426
438
  extra_body=extra_body,
427
439
  timeout=timeout,
428
- query=await async_maybe_transform({"name": name}, type_list_params.TypeListParams),
440
+ query=maybe_transform(
441
+ {
442
+ "cursor": cursor,
443
+ "limit": limit,
444
+ "name": name,
445
+ "sort_ascending": sort_ascending,
446
+ },
447
+ type_list_params.TypeListParams,
448
+ ),
429
449
  ),
430
- cast_to=TypeListResponse,
450
+ model=ExperienceType,
431
451
  )
432
452
 
433
453
  async def delete(
@@ -30,10 +30,11 @@ from ..._response import (
30
30
  async_to_raw_response_wrapper,
31
31
  async_to_streamed_response_wrapper,
32
32
  )
33
- from ..._base_client import make_request_options
33
+ from ...pagination import SyncCursorPage, AsyncCursorPage
34
+ from ..._base_client import AsyncPaginator, make_request_options
34
35
  from ...types.limit_response import LimitResponse
35
36
  from ...types.default_response import DefaultResponse
36
- from ...types.paged_limit_list import PagedLimitList
37
+ from ...types.limit_list_response import LimitListResponse
37
38
  from ...types.limit_history_response import LimitHistoryResponse
38
39
 
39
40
  __all__ = ["LimitsResource", "AsyncLimitsResource"]
@@ -190,20 +191,17 @@ class LimitsResource(SyncAPIResource):
190
191
  def list(
191
192
  self,
192
193
  *,
194
+ cursor: str | NotGiven = NOT_GIVEN,
195
+ limit: int | NotGiven = NOT_GIVEN,
193
196
  limit_name: str | NotGiven = NOT_GIVEN,
194
- page_number: int | NotGiven = NOT_GIVEN,
195
- page_size: int | NotGiven = NOT_GIVEN,
196
197
  sort_ascending: bool | NotGiven = NOT_GIVEN,
197
- sort_by: str | NotGiven = NOT_GIVEN,
198
- tag_list: List[str] | NotGiven = NOT_GIVEN,
199
- tags: str | NotGiven = NOT_GIVEN,
200
198
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
201
199
  # The extra values given here take precedence over values defined on the client or passed to this method.
202
200
  extra_headers: Headers | None = None,
203
201
  extra_query: Query | None = None,
204
202
  extra_body: Body | None = None,
205
203
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
206
- ) -> PagedLimitList:
204
+ ) -> SyncCursorPage[LimitListResponse]:
207
205
  """
208
206
  Get all Limits
209
207
 
@@ -216,8 +214,9 @@ class LimitsResource(SyncAPIResource):
216
214
 
217
215
  timeout: Override the client-level default timeout for this request, in seconds
218
216
  """
219
- return self._get(
217
+ return self._get_api_list(
220
218
  "/api/v1/limits",
219
+ page=SyncCursorPage[LimitListResponse],
221
220
  options=make_request_options(
222
221
  extra_headers=extra_headers,
223
222
  extra_query=extra_query,
@@ -225,18 +224,15 @@ class LimitsResource(SyncAPIResource):
225
224
  timeout=timeout,
226
225
  query=maybe_transform(
227
226
  {
227
+ "cursor": cursor,
228
+ "limit": limit,
228
229
  "limit_name": limit_name,
229
- "page_number": page_number,
230
- "page_size": page_size,
231
230
  "sort_ascending": sort_ascending,
232
- "sort_by": sort_by,
233
- "tag_list": tag_list,
234
- "tags": tags,
235
231
  },
236
232
  limit_list_params.LimitListParams,
237
233
  ),
238
234
  ),
239
- cast_to=PagedLimitList,
235
+ model=LimitListResponse,
240
236
  )
241
237
 
242
238
  def delete(
@@ -461,23 +457,20 @@ class AsyncLimitsResource(AsyncAPIResource):
461
457
  cast_to=LimitResponse,
462
458
  )
463
459
 
464
- async def list(
460
+ def list(
465
461
  self,
466
462
  *,
463
+ cursor: str | NotGiven = NOT_GIVEN,
464
+ limit: int | NotGiven = NOT_GIVEN,
467
465
  limit_name: str | NotGiven = NOT_GIVEN,
468
- page_number: int | NotGiven = NOT_GIVEN,
469
- page_size: int | NotGiven = NOT_GIVEN,
470
466
  sort_ascending: bool | NotGiven = NOT_GIVEN,
471
- sort_by: str | NotGiven = NOT_GIVEN,
472
- tag_list: List[str] | NotGiven = NOT_GIVEN,
473
- tags: str | NotGiven = NOT_GIVEN,
474
467
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
475
468
  # The extra values given here take precedence over values defined on the client or passed to this method.
476
469
  extra_headers: Headers | None = None,
477
470
  extra_query: Query | None = None,
478
471
  extra_body: Body | None = None,
479
472
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
480
- ) -> PagedLimitList:
473
+ ) -> AsyncPaginator[LimitListResponse, AsyncCursorPage[LimitListResponse]]:
481
474
  """
482
475
  Get all Limits
483
476
 
@@ -490,27 +483,25 @@ class AsyncLimitsResource(AsyncAPIResource):
490
483
 
491
484
  timeout: Override the client-level default timeout for this request, in seconds
492
485
  """
493
- return await self._get(
486
+ return self._get_api_list(
494
487
  "/api/v1/limits",
488
+ page=AsyncCursorPage[LimitListResponse],
495
489
  options=make_request_options(
496
490
  extra_headers=extra_headers,
497
491
  extra_query=extra_query,
498
492
  extra_body=extra_body,
499
493
  timeout=timeout,
500
- query=await async_maybe_transform(
494
+ query=maybe_transform(
501
495
  {
496
+ "cursor": cursor,
497
+ "limit": limit,
502
498
  "limit_name": limit_name,
503
- "page_number": page_number,
504
- "page_size": page_size,
505
499
  "sort_ascending": sort_ascending,
506
- "sort_by": sort_by,
507
- "tag_list": tag_list,
508
- "tags": tags,
509
500
  },
510
501
  limit_list_params.LimitListParams,
511
502
  ),
512
503
  ),
513
- cast_to=PagedLimitList,
504
+ model=LimitListResponse,
514
505
  )
515
506
 
516
507
  async def delete(
@@ -1,5 +1,13 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ from .kpis import (
4
+ KpisResource,
5
+ AsyncKpisResource,
6
+ KpisResourceWithRawResponse,
7
+ AsyncKpisResourceWithRawResponse,
8
+ KpisResourceWithStreamingResponse,
9
+ AsyncKpisResourceWithStreamingResponse,
10
+ )
3
11
  from .use_cases import (
4
12
  UseCasesResource,
5
13
  AsyncUseCasesResource,
@@ -26,6 +34,12 @@ from .definitions import (
26
34
  )
27
35
 
28
36
  __all__ = [
37
+ "KpisResource",
38
+ "AsyncKpisResource",
39
+ "KpisResourceWithRawResponse",
40
+ "AsyncKpisResourceWithRawResponse",
41
+ "KpisResourceWithStreamingResponse",
42
+ "AsyncKpisResourceWithStreamingResponse",
29
43
  "DefinitionsResource",
30
44
  "AsyncDefinitionsResource",
31
45
  "DefinitionsResourceWithRawResponse",
@@ -1,5 +1,13 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ from .kpis import (
4
+ KpisResource,
5
+ AsyncKpisResource,
6
+ KpisResourceWithRawResponse,
7
+ AsyncKpisResourceWithRawResponse,
8
+ KpisResourceWithStreamingResponse,
9
+ AsyncKpisResourceWithStreamingResponse,
10
+ )
3
11
  from .version import (
4
12
  VersionResource,
5
13
  AsyncVersionResource,
@@ -26,6 +34,12 @@ from .limit_config import (
26
34
  )
27
35
 
28
36
  __all__ = [
37
+ "KpisResource",
38
+ "AsyncKpisResource",
39
+ "KpisResourceWithRawResponse",
40
+ "AsyncKpisResourceWithRawResponse",
41
+ "KpisResourceWithStreamingResponse",
42
+ "AsyncKpisResourceWithStreamingResponse",
29
43
  "LimitConfigResource",
30
44
  "AsyncLimitConfigResource",
31
45
  "LimitConfigResourceWithRawResponse",
@@ -6,6 +6,14 @@ from typing import Optional
6
6
 
7
7
  import httpx
8
8
 
9
+ from .kpis import (
10
+ KpisResource,
11
+ AsyncKpisResource,
12
+ KpisResourceWithRawResponse,
13
+ AsyncKpisResourceWithRawResponse,
14
+ KpisResourceWithStreamingResponse,
15
+ AsyncKpisResourceWithStreamingResponse,
16
+ )
9
17
  from .version import (
10
18
  VersionResource,
11
19
  AsyncVersionResource,
@@ -35,10 +43,10 @@ from .limit_config import (
35
43
  LimitConfigResourceWithStreamingResponse,
36
44
  AsyncLimitConfigResourceWithStreamingResponse,
37
45
  )
38
- from ...._base_client import make_request_options
46
+ from ....pagination import SyncCursorPage, AsyncCursorPage
47
+ from ...._base_client import AsyncPaginator, make_request_options
39
48
  from ....types.use_cases import definition_list_params, definition_create_params, definition_update_params
40
49
  from ....types.use_cases.use_case_definition import UseCaseDefinition
41
- from ....types.use_cases.definition_list_response import DefinitionListResponse
42
50
  from ....types.shared_params.pay_i_common_models_budget_management_create_limit_base import (
43
51
  PayICommonModelsBudgetManagementCreateLimitBase,
44
52
  )
@@ -47,6 +55,10 @@ __all__ = ["DefinitionsResource", "AsyncDefinitionsResource"]
47
55
 
48
56
 
49
57
  class DefinitionsResource(SyncAPIResource):
58
+ @cached_property
59
+ def kpis(self) -> KpisResource:
60
+ return KpisResource(self._client)
61
+
50
62
  @cached_property
51
63
  def limit_config(self) -> LimitConfigResource:
52
64
  return LimitConfigResource(self._client)
@@ -177,7 +189,7 @@ class DefinitionsResource(SyncAPIResource):
177
189
  """
178
190
  if not use_case_name:
179
191
  raise ValueError(f"Expected a non-empty value for `use_case_name` but received {use_case_name!r}")
180
- return self._patch(
192
+ return self._put(
181
193
  f"/api/v1/use_cases/definitions/{use_case_name}",
182
194
  body=maybe_transform(
183
195
  {
@@ -195,6 +207,9 @@ class DefinitionsResource(SyncAPIResource):
195
207
  def list(
196
208
  self,
197
209
  *,
210
+ cursor: str | NotGiven = NOT_GIVEN,
211
+ limit: int | NotGiven = NOT_GIVEN,
212
+ sort_ascending: bool | NotGiven = NOT_GIVEN,
198
213
  use_case_name: str | NotGiven = NOT_GIVEN,
199
214
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
200
215
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -202,13 +217,11 @@ class DefinitionsResource(SyncAPIResource):
202
217
  extra_query: Query | None = None,
203
218
  extra_body: Body | None = None,
204
219
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
205
- ) -> DefinitionListResponse:
220
+ ) -> SyncCursorPage[UseCaseDefinition]:
206
221
  """
207
222
  Get all Use Cases
208
223
 
209
224
  Args:
210
- use_case_name: Use Case name
211
-
212
225
  extra_headers: Send extra headers
213
226
 
214
227
  extra_query: Add additional query parameters to the request
@@ -217,16 +230,25 @@ class DefinitionsResource(SyncAPIResource):
217
230
 
218
231
  timeout: Override the client-level default timeout for this request, in seconds
219
232
  """
220
- return self._get(
233
+ return self._get_api_list(
221
234
  "/api/v1/use_cases/definitions",
235
+ page=SyncCursorPage[UseCaseDefinition],
222
236
  options=make_request_options(
223
237
  extra_headers=extra_headers,
224
238
  extra_query=extra_query,
225
239
  extra_body=extra_body,
226
240
  timeout=timeout,
227
- query=maybe_transform({"use_case_name": use_case_name}, definition_list_params.DefinitionListParams),
241
+ query=maybe_transform(
242
+ {
243
+ "cursor": cursor,
244
+ "limit": limit,
245
+ "sort_ascending": sort_ascending,
246
+ "use_case_name": use_case_name,
247
+ },
248
+ definition_list_params.DefinitionListParams,
249
+ ),
228
250
  ),
229
- cast_to=DefinitionListResponse,
251
+ model=UseCaseDefinition,
230
252
  )
231
253
 
232
254
  def delete(
@@ -264,6 +286,10 @@ class DefinitionsResource(SyncAPIResource):
264
286
 
265
287
 
266
288
  class AsyncDefinitionsResource(AsyncAPIResource):
289
+ @cached_property
290
+ def kpis(self) -> AsyncKpisResource:
291
+ return AsyncKpisResource(self._client)
292
+
267
293
  @cached_property
268
294
  def limit_config(self) -> AsyncLimitConfigResource:
269
295
  return AsyncLimitConfigResource(self._client)
@@ -394,7 +420,7 @@ class AsyncDefinitionsResource(AsyncAPIResource):
394
420
  """
395
421
  if not use_case_name:
396
422
  raise ValueError(f"Expected a non-empty value for `use_case_name` but received {use_case_name!r}")
397
- return await self._patch(
423
+ return await self._put(
398
424
  f"/api/v1/use_cases/definitions/{use_case_name}",
399
425
  body=await async_maybe_transform(
400
426
  {
@@ -409,9 +435,12 @@ class AsyncDefinitionsResource(AsyncAPIResource):
409
435
  cast_to=UseCaseDefinition,
410
436
  )
411
437
 
412
- async def list(
438
+ def list(
413
439
  self,
414
440
  *,
441
+ cursor: str | NotGiven = NOT_GIVEN,
442
+ limit: int | NotGiven = NOT_GIVEN,
443
+ sort_ascending: bool | NotGiven = NOT_GIVEN,
415
444
  use_case_name: str | NotGiven = NOT_GIVEN,
416
445
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
417
446
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -419,13 +448,11 @@ class AsyncDefinitionsResource(AsyncAPIResource):
419
448
  extra_query: Query | None = None,
420
449
  extra_body: Body | None = None,
421
450
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
422
- ) -> DefinitionListResponse:
451
+ ) -> AsyncPaginator[UseCaseDefinition, AsyncCursorPage[UseCaseDefinition]]:
423
452
  """
424
453
  Get all Use Cases
425
454
 
426
455
  Args:
427
- use_case_name: Use Case name
428
-
429
456
  extra_headers: Send extra headers
430
457
 
431
458
  extra_query: Add additional query parameters to the request
@@ -434,18 +461,25 @@ class AsyncDefinitionsResource(AsyncAPIResource):
434
461
 
435
462
  timeout: Override the client-level default timeout for this request, in seconds
436
463
  """
437
- return await self._get(
464
+ return self._get_api_list(
438
465
  "/api/v1/use_cases/definitions",
466
+ page=AsyncCursorPage[UseCaseDefinition],
439
467
  options=make_request_options(
440
468
  extra_headers=extra_headers,
441
469
  extra_query=extra_query,
442
470
  extra_body=extra_body,
443
471
  timeout=timeout,
444
- query=await async_maybe_transform(
445
- {"use_case_name": use_case_name}, definition_list_params.DefinitionListParams
472
+ query=maybe_transform(
473
+ {
474
+ "cursor": cursor,
475
+ "limit": limit,
476
+ "sort_ascending": sort_ascending,
477
+ "use_case_name": use_case_name,
478
+ },
479
+ definition_list_params.DefinitionListParams,
446
480
  ),
447
481
  ),
448
- cast_to=DefinitionListResponse,
482
+ model=UseCaseDefinition,
449
483
  )
450
484
 
451
485
  async def delete(
@@ -502,6 +536,10 @@ class DefinitionsResourceWithRawResponse:
502
536
  definitions.delete,
503
537
  )
504
538
 
539
+ @cached_property
540
+ def kpis(self) -> KpisResourceWithRawResponse:
541
+ return KpisResourceWithRawResponse(self._definitions.kpis)
542
+
505
543
  @cached_property
506
544
  def limit_config(self) -> LimitConfigResourceWithRawResponse:
507
545
  return LimitConfigResourceWithRawResponse(self._definitions.limit_config)
@@ -531,6 +569,10 @@ class AsyncDefinitionsResourceWithRawResponse:
531
569
  definitions.delete,
532
570
  )
533
571
 
572
+ @cached_property
573
+ def kpis(self) -> AsyncKpisResourceWithRawResponse:
574
+ return AsyncKpisResourceWithRawResponse(self._definitions.kpis)
575
+
534
576
  @cached_property
535
577
  def limit_config(self) -> AsyncLimitConfigResourceWithRawResponse:
536
578
  return AsyncLimitConfigResourceWithRawResponse(self._definitions.limit_config)
@@ -560,6 +602,10 @@ class DefinitionsResourceWithStreamingResponse:
560
602
  definitions.delete,
561
603
  )
562
604
 
605
+ @cached_property
606
+ def kpis(self) -> KpisResourceWithStreamingResponse:
607
+ return KpisResourceWithStreamingResponse(self._definitions.kpis)
608
+
563
609
  @cached_property
564
610
  def limit_config(self) -> LimitConfigResourceWithStreamingResponse:
565
611
  return LimitConfigResourceWithStreamingResponse(self._definitions.limit_config)
@@ -589,6 +635,10 @@ class AsyncDefinitionsResourceWithStreamingResponse:
589
635
  definitions.delete,
590
636
  )
591
637
 
638
+ @cached_property
639
+ def kpis(self) -> AsyncKpisResourceWithStreamingResponse:
640
+ return AsyncKpisResourceWithStreamingResponse(self._definitions.kpis)
641
+
592
642
  @cached_property
593
643
  def limit_config(self) -> AsyncLimitConfigResourceWithStreamingResponse:
594
644
  return AsyncLimitConfigResourceWithStreamingResponse(self._definitions.limit_config)