payi 0.1.0a59__py3-none-any.whl → 0.1.0a61__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 (52) hide show
  1. payi/_version.py +1 -1
  2. payi/lib/AnthropicInstrumentor.py +11 -11
  3. payi/lib/BedrockInstrumentor.py +15 -15
  4. payi/lib/OpenAIInstrumentor.py +16 -16
  5. payi/lib/helpers.py +16 -12
  6. payi/lib/instrument.py +180 -39
  7. payi/pagination.py +50 -0
  8. payi/resources/categories/categories.py +108 -23
  9. payi/resources/categories/resources.py +42 -12
  10. payi/resources/experiences/types/types.py +37 -17
  11. payi/resources/limits/limits.py +21 -30
  12. payi/resources/use_cases/__init__.py +14 -0
  13. payi/resources/use_cases/definitions/__init__.py +14 -0
  14. payi/resources/use_cases/definitions/definitions.py +68 -18
  15. payi/resources/use_cases/definitions/kpis.py +584 -0
  16. payi/resources/use_cases/kpis.py +469 -0
  17. payi/resources/use_cases/use_cases.py +32 -0
  18. payi/types/__init__.py +3 -3
  19. payi/types/categories/__init__.py +1 -1
  20. payi/types/categories/resource_list_params.py +17 -0
  21. payi/types/category_list_params.py +15 -0
  22. payi/types/category_list_resources_params.py +15 -0
  23. payi/types/category_response.py +0 -5
  24. payi/types/experiences/__init__.py +0 -1
  25. payi/types/experiences/type_list_params.py +6 -1
  26. payi/types/limit_list_params.py +4 -13
  27. payi/types/limit_list_response.py +30 -0
  28. payi/types/use_cases/__init__.py +4 -1
  29. payi/types/use_cases/definition_list_params.py +6 -1
  30. payi/types/use_cases/definitions/__init__.py +8 -0
  31. payi/types/use_cases/definitions/kpi_create_params.py +17 -0
  32. payi/types/use_cases/definitions/kpi_create_response.py +20 -0
  33. payi/types/use_cases/definitions/kpi_delete_response.py +20 -0
  34. payi/types/use_cases/definitions/kpi_list_params.py +17 -0
  35. payi/types/use_cases/definitions/kpi_list_response.py +20 -0
  36. payi/types/use_cases/definitions/kpi_retrieve_response.py +20 -0
  37. payi/types/use_cases/definitions/kpi_update_params.py +16 -0
  38. payi/types/use_cases/definitions/kpi_update_response.py +20 -0
  39. payi/types/use_cases/kpi_create_params.py +13 -0
  40. payi/types/use_cases/kpi_list_params.py +17 -0
  41. payi/types/use_cases/kpi_list_response.py +21 -0
  42. payi/types/use_cases/kpi_update_params.py +13 -0
  43. {payi-0.1.0a59.dist-info → payi-0.1.0a61.dist-info}/METADATA +91 -28
  44. {payi-0.1.0a59.dist-info → payi-0.1.0a61.dist-info}/RECORD +46 -33
  45. payi/types/categories/resource_list_response.py +0 -10
  46. payi/types/category_list_resources_response.py +0 -10
  47. payi/types/category_list_response.py +0 -10
  48. payi/types/experiences/type_list_response.py +0 -10
  49. payi/types/paged_limit_list.py +0 -52
  50. payi/types/use_cases/definition_list_response.py +0 -10
  51. {payi-0.1.0a59.dist-info → payi-0.1.0a61.dist-info}/WHEEL +0 -0
  52. {payi-0.1.0a59.dist-info → payi-0.1.0a61.dist-info}/licenses/LICENSE +0 -0
@@ -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)