payi 0.1.0a53__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.
- payi/_base_client.py +1 -96
- payi/_client.py +10 -17
- payi/_models.py +5 -2
- payi/_version.py +1 -1
- payi/lib/helpers.py +12 -1
- payi/resources/__init__.py +14 -28
- payi/resources/categories/resources.py +7 -7
- payi/resources/experiences/types/types.py +5 -2
- payi/resources/ingest.py +58 -6
- payi/resources/limits/limits.py +4 -0
- payi/resources/limits/tags.py +12 -0
- payi/resources/requests/properties.py +1 -1
- payi/resources/use_cases/__init__.py +47 -0
- payi/resources/use_cases/properties.py +174 -0
- payi/resources/use_cases/types/__init__.py +33 -0
- payi/resources/use_cases/types/limit_config.py +275 -0
- payi/resources/{billing_models.py → use_cases/types/types.py} +225 -161
- payi/resources/{price_modifiers.py → use_cases/use_cases.py} +160 -130
- payi/types/__init__.py +6 -9
- payi/types/categories/resource_create_params.py +6 -6
- payi/types/category_resource_response.py +2 -2
- payi/types/experience_instance_response.py +2 -0
- payi/types/experiences/__init__.py +0 -1
- payi/types/experiences/experience_type.py +8 -14
- payi/types/experiences/type_create_params.py +8 -14
- payi/types/ingest_event_param.py +10 -0
- payi/types/ingest_response.py +2 -0
- payi/types/ingest_units_params.py +9 -1
- payi/types/limit_list_params.py +6 -1
- payi/types/limits/tag_create_params.py +1 -0
- payi/types/limits/tag_remove_params.py +1 -0
- payi/types/limits/tag_update_params.py +1 -0
- payi/types/requests/request_result.py +2 -0
- payi/types/shared/__init__.py +4 -0
- payi/types/shared/pay_i_common_models_budget_management_create_limit_base.py +18 -0
- payi/types/shared_params/__init__.py +5 -0
- payi/types/shared_params/pay_i_common_models_budget_management_create_limit_base.py +18 -0
- payi/types/use_case_instance_response.py +15 -0
- payi/types/use_cases/__init__.py +10 -0
- payi/types/use_cases/property_create_params.py +12 -0
- payi/types/use_cases/type_create_params.py +22 -0
- payi/types/use_cases/type_list_params.py +12 -0
- payi/types/{billing_model_list_response.py → use_cases/type_list_response.py} +3 -3
- payi/types/use_cases/type_update_params.py +14 -0
- payi/types/use_cases/types/__init__.py +5 -0
- payi/types/use_cases/types/limit_config_create_params.py +18 -0
- payi/types/use_cases/use_case_type.py +24 -0
- {payi-0.1.0a53.dist-info → payi-0.1.0a56.dist-info}/METADATA +25 -4
- {payi-0.1.0a53.dist-info → payi-0.1.0a56.dist-info}/RECORD +52 -43
- {payi-0.1.0a53.dist-info → payi-0.1.0a56.dist-info}/WHEEL +1 -1
- payi/types/billing_model.py +0 -31
- payi/types/billing_model_create_params.py +0 -22
- payi/types/billing_model_update_params.py +0 -22
- payi/types/price_modifier.py +0 -26
- payi/types/price_modifier_create_params.py +0 -17
- payi/types/price_modifier_retrieve_response.py +0 -10
- payi/types/price_modifier_update_params.py +0 -17
- /payi/types/{experiences → shared}/properties_response.py +0 -0
- {payi-0.1.0a53.dist-info → payi-0.1.0a56.dist-info}/licenses/LICENSE +0 -0
payi/_base_client.py
CHANGED
|
@@ -9,7 +9,6 @@ import asyncio
|
|
|
9
9
|
import inspect
|
|
10
10
|
import logging
|
|
11
11
|
import platform
|
|
12
|
-
import warnings
|
|
13
12
|
import email.utils
|
|
14
13
|
from types import TracebackType
|
|
15
14
|
from random import random
|
|
@@ -36,7 +35,7 @@ import anyio
|
|
|
36
35
|
import httpx
|
|
37
36
|
import distro
|
|
38
37
|
import pydantic
|
|
39
|
-
from httpx import URL
|
|
38
|
+
from httpx import URL
|
|
40
39
|
from pydantic import PrivateAttr
|
|
41
40
|
|
|
42
41
|
from . import _exceptions
|
|
@@ -51,13 +50,10 @@ from ._types import (
|
|
|
51
50
|
Timeout,
|
|
52
51
|
NotGiven,
|
|
53
52
|
ResponseT,
|
|
54
|
-
Transport,
|
|
55
53
|
AnyMapping,
|
|
56
54
|
PostParser,
|
|
57
|
-
ProxiesTypes,
|
|
58
55
|
RequestFiles,
|
|
59
56
|
HttpxSendArgs,
|
|
60
|
-
AsyncTransport,
|
|
61
57
|
RequestOptions,
|
|
62
58
|
HttpxRequestFiles,
|
|
63
59
|
ModelBuilderProtocol,
|
|
@@ -337,9 +333,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
337
333
|
_base_url: URL
|
|
338
334
|
max_retries: int
|
|
339
335
|
timeout: Union[float, Timeout, None]
|
|
340
|
-
_limits: httpx.Limits
|
|
341
|
-
_proxies: ProxiesTypes | None
|
|
342
|
-
_transport: Transport | AsyncTransport | None
|
|
343
336
|
_strict_response_validation: bool
|
|
344
337
|
_idempotency_header: str | None
|
|
345
338
|
_default_stream_cls: type[_DefaultStreamT] | None = None
|
|
@@ -352,9 +345,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
352
345
|
_strict_response_validation: bool,
|
|
353
346
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
354
347
|
timeout: float | Timeout | None = DEFAULT_TIMEOUT,
|
|
355
|
-
limits: httpx.Limits,
|
|
356
|
-
transport: Transport | AsyncTransport | None,
|
|
357
|
-
proxies: ProxiesTypes | None,
|
|
358
348
|
custom_headers: Mapping[str, str] | None = None,
|
|
359
349
|
custom_query: Mapping[str, object] | None = None,
|
|
360
350
|
) -> None:
|
|
@@ -362,9 +352,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
362
352
|
self._base_url = self._enforce_trailing_slash(URL(base_url))
|
|
363
353
|
self.max_retries = max_retries
|
|
364
354
|
self.timeout = timeout
|
|
365
|
-
self._limits = limits
|
|
366
|
-
self._proxies = proxies
|
|
367
|
-
self._transport = transport
|
|
368
355
|
self._custom_headers = custom_headers or {}
|
|
369
356
|
self._custom_query = custom_query or {}
|
|
370
357
|
self._strict_response_validation = _strict_response_validation
|
|
@@ -800,46 +787,11 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
800
787
|
base_url: str | URL,
|
|
801
788
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
802
789
|
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
|
|
803
|
-
transport: Transport | None = None,
|
|
804
|
-
proxies: ProxiesTypes | None = None,
|
|
805
|
-
limits: Limits | None = None,
|
|
806
790
|
http_client: httpx.Client | None = None,
|
|
807
791
|
custom_headers: Mapping[str, str] | None = None,
|
|
808
792
|
custom_query: Mapping[str, object] | None = None,
|
|
809
793
|
_strict_response_validation: bool,
|
|
810
794
|
) -> None:
|
|
811
|
-
kwargs: dict[str, Any] = {}
|
|
812
|
-
if limits is not None:
|
|
813
|
-
warnings.warn(
|
|
814
|
-
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
|
|
815
|
-
category=DeprecationWarning,
|
|
816
|
-
stacklevel=3,
|
|
817
|
-
)
|
|
818
|
-
if http_client is not None:
|
|
819
|
-
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
|
|
820
|
-
else:
|
|
821
|
-
limits = DEFAULT_CONNECTION_LIMITS
|
|
822
|
-
|
|
823
|
-
if transport is not None:
|
|
824
|
-
kwargs["transport"] = transport
|
|
825
|
-
warnings.warn(
|
|
826
|
-
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
|
|
827
|
-
category=DeprecationWarning,
|
|
828
|
-
stacklevel=3,
|
|
829
|
-
)
|
|
830
|
-
if http_client is not None:
|
|
831
|
-
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
|
|
832
|
-
|
|
833
|
-
if proxies is not None:
|
|
834
|
-
kwargs["proxies"] = proxies
|
|
835
|
-
warnings.warn(
|
|
836
|
-
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
|
|
837
|
-
category=DeprecationWarning,
|
|
838
|
-
stacklevel=3,
|
|
839
|
-
)
|
|
840
|
-
if http_client is not None:
|
|
841
|
-
raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
|
|
842
|
-
|
|
843
795
|
if not is_given(timeout):
|
|
844
796
|
# if the user passed in a custom http client with a non-default
|
|
845
797
|
# timeout set then we use that timeout.
|
|
@@ -860,12 +812,9 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
860
812
|
|
|
861
813
|
super().__init__(
|
|
862
814
|
version=version,
|
|
863
|
-
limits=limits,
|
|
864
815
|
# cast to a valid type because mypy doesn't understand our type narrowing
|
|
865
816
|
timeout=cast(Timeout, timeout),
|
|
866
|
-
proxies=proxies,
|
|
867
817
|
base_url=base_url,
|
|
868
|
-
transport=transport,
|
|
869
818
|
max_retries=max_retries,
|
|
870
819
|
custom_query=custom_query,
|
|
871
820
|
custom_headers=custom_headers,
|
|
@@ -875,9 +824,6 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
875
824
|
base_url=base_url,
|
|
876
825
|
# cast to a valid type because mypy doesn't understand our type narrowing
|
|
877
826
|
timeout=cast(Timeout, timeout),
|
|
878
|
-
limits=limits,
|
|
879
|
-
follow_redirects=True,
|
|
880
|
-
**kwargs, # type: ignore
|
|
881
827
|
)
|
|
882
828
|
|
|
883
829
|
def is_closed(self) -> bool:
|
|
@@ -1372,45 +1318,10 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1372
1318
|
_strict_response_validation: bool,
|
|
1373
1319
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
1374
1320
|
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
|
|
1375
|
-
transport: AsyncTransport | None = None,
|
|
1376
|
-
proxies: ProxiesTypes | None = None,
|
|
1377
|
-
limits: Limits | None = None,
|
|
1378
1321
|
http_client: httpx.AsyncClient | None = None,
|
|
1379
1322
|
custom_headers: Mapping[str, str] | None = None,
|
|
1380
1323
|
custom_query: Mapping[str, object] | None = None,
|
|
1381
1324
|
) -> None:
|
|
1382
|
-
kwargs: dict[str, Any] = {}
|
|
1383
|
-
if limits is not None:
|
|
1384
|
-
warnings.warn(
|
|
1385
|
-
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
|
|
1386
|
-
category=DeprecationWarning,
|
|
1387
|
-
stacklevel=3,
|
|
1388
|
-
)
|
|
1389
|
-
if http_client is not None:
|
|
1390
|
-
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
|
|
1391
|
-
else:
|
|
1392
|
-
limits = DEFAULT_CONNECTION_LIMITS
|
|
1393
|
-
|
|
1394
|
-
if transport is not None:
|
|
1395
|
-
kwargs["transport"] = transport
|
|
1396
|
-
warnings.warn(
|
|
1397
|
-
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
|
|
1398
|
-
category=DeprecationWarning,
|
|
1399
|
-
stacklevel=3,
|
|
1400
|
-
)
|
|
1401
|
-
if http_client is not None:
|
|
1402
|
-
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
|
|
1403
|
-
|
|
1404
|
-
if proxies is not None:
|
|
1405
|
-
kwargs["proxies"] = proxies
|
|
1406
|
-
warnings.warn(
|
|
1407
|
-
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
|
|
1408
|
-
category=DeprecationWarning,
|
|
1409
|
-
stacklevel=3,
|
|
1410
|
-
)
|
|
1411
|
-
if http_client is not None:
|
|
1412
|
-
raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
|
|
1413
|
-
|
|
1414
1325
|
if not is_given(timeout):
|
|
1415
1326
|
# if the user passed in a custom http client with a non-default
|
|
1416
1327
|
# timeout set then we use that timeout.
|
|
@@ -1432,11 +1343,8 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1432
1343
|
super().__init__(
|
|
1433
1344
|
version=version,
|
|
1434
1345
|
base_url=base_url,
|
|
1435
|
-
limits=limits,
|
|
1436
1346
|
# cast to a valid type because mypy doesn't understand our type narrowing
|
|
1437
1347
|
timeout=cast(Timeout, timeout),
|
|
1438
|
-
proxies=proxies,
|
|
1439
|
-
transport=transport,
|
|
1440
1348
|
max_retries=max_retries,
|
|
1441
1349
|
custom_query=custom_query,
|
|
1442
1350
|
custom_headers=custom_headers,
|
|
@@ -1446,9 +1354,6 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1446
1354
|
base_url=base_url,
|
|
1447
1355
|
# cast to a valid type because mypy doesn't understand our type narrowing
|
|
1448
1356
|
timeout=cast(Timeout, timeout),
|
|
1449
|
-
limits=limits,
|
|
1450
|
-
follow_redirects=True,
|
|
1451
|
-
**kwargs, # type: ignore
|
|
1452
1357
|
)
|
|
1453
1358
|
|
|
1454
1359
|
def is_closed(self) -> bool:
|
payi/_client.py
CHANGED
|
@@ -24,7 +24,7 @@ from ._utils import (
|
|
|
24
24
|
get_async_library,
|
|
25
25
|
)
|
|
26
26
|
from ._version import __version__
|
|
27
|
-
from .resources import ingest
|
|
27
|
+
from .resources import ingest
|
|
28
28
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
29
29
|
from ._exceptions import PayiError, APIStatusError
|
|
30
30
|
from ._base_client import (
|
|
@@ -34,6 +34,7 @@ from ._base_client import (
|
|
|
34
34
|
)
|
|
35
35
|
from .resources.limits import limits
|
|
36
36
|
from .resources.requests import requests
|
|
37
|
+
from .resources.use_cases import use_cases
|
|
37
38
|
from .resources.categories import categories
|
|
38
39
|
from .resources.experiences import experiences
|
|
39
40
|
|
|
@@ -45,8 +46,7 @@ class Payi(SyncAPIClient):
|
|
|
45
46
|
ingest: ingest.IngestResource
|
|
46
47
|
categories: categories.CategoriesResource
|
|
47
48
|
experiences: experiences.ExperiencesResource
|
|
48
|
-
|
|
49
|
-
price_modifiers: price_modifiers.PriceModifiersResource
|
|
49
|
+
use_cases: use_cases.UseCasesResource
|
|
50
50
|
requests: requests.RequestsResource
|
|
51
51
|
with_raw_response: PayiWithRawResponse
|
|
52
52
|
with_streaming_response: PayiWithStreamedResponse
|
|
@@ -109,8 +109,7 @@ class Payi(SyncAPIClient):
|
|
|
109
109
|
self.ingest = ingest.IngestResource(self)
|
|
110
110
|
self.categories = categories.CategoriesResource(self)
|
|
111
111
|
self.experiences = experiences.ExperiencesResource(self)
|
|
112
|
-
self.
|
|
113
|
-
self.price_modifiers = price_modifiers.PriceModifiersResource(self)
|
|
112
|
+
self.use_cases = use_cases.UseCasesResource(self)
|
|
114
113
|
self.requests = requests.RequestsResource(self)
|
|
115
114
|
self.with_raw_response = PayiWithRawResponse(self)
|
|
116
115
|
self.with_streaming_response = PayiWithStreamedResponse(self)
|
|
@@ -225,8 +224,7 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
225
224
|
ingest: ingest.AsyncIngestResource
|
|
226
225
|
categories: categories.AsyncCategoriesResource
|
|
227
226
|
experiences: experiences.AsyncExperiencesResource
|
|
228
|
-
|
|
229
|
-
price_modifiers: price_modifiers.AsyncPriceModifiersResource
|
|
227
|
+
use_cases: use_cases.AsyncUseCasesResource
|
|
230
228
|
requests: requests.AsyncRequestsResource
|
|
231
229
|
with_raw_response: AsyncPayiWithRawResponse
|
|
232
230
|
with_streaming_response: AsyncPayiWithStreamedResponse
|
|
@@ -289,8 +287,7 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
289
287
|
self.ingest = ingest.AsyncIngestResource(self)
|
|
290
288
|
self.categories = categories.AsyncCategoriesResource(self)
|
|
291
289
|
self.experiences = experiences.AsyncExperiencesResource(self)
|
|
292
|
-
self.
|
|
293
|
-
self.price_modifiers = price_modifiers.AsyncPriceModifiersResource(self)
|
|
290
|
+
self.use_cases = use_cases.AsyncUseCasesResource(self)
|
|
294
291
|
self.requests = requests.AsyncRequestsResource(self)
|
|
295
292
|
self.with_raw_response = AsyncPayiWithRawResponse(self)
|
|
296
293
|
self.with_streaming_response = AsyncPayiWithStreamedResponse(self)
|
|
@@ -406,8 +403,7 @@ class PayiWithRawResponse:
|
|
|
406
403
|
self.ingest = ingest.IngestResourceWithRawResponse(client.ingest)
|
|
407
404
|
self.categories = categories.CategoriesResourceWithRawResponse(client.categories)
|
|
408
405
|
self.experiences = experiences.ExperiencesResourceWithRawResponse(client.experiences)
|
|
409
|
-
self.
|
|
410
|
-
self.price_modifiers = price_modifiers.PriceModifiersResourceWithRawResponse(client.price_modifiers)
|
|
406
|
+
self.use_cases = use_cases.UseCasesResourceWithRawResponse(client.use_cases)
|
|
411
407
|
self.requests = requests.RequestsResourceWithRawResponse(client.requests)
|
|
412
408
|
|
|
413
409
|
|
|
@@ -417,8 +413,7 @@ class AsyncPayiWithRawResponse:
|
|
|
417
413
|
self.ingest = ingest.AsyncIngestResourceWithRawResponse(client.ingest)
|
|
418
414
|
self.categories = categories.AsyncCategoriesResourceWithRawResponse(client.categories)
|
|
419
415
|
self.experiences = experiences.AsyncExperiencesResourceWithRawResponse(client.experiences)
|
|
420
|
-
self.
|
|
421
|
-
self.price_modifiers = price_modifiers.AsyncPriceModifiersResourceWithRawResponse(client.price_modifiers)
|
|
416
|
+
self.use_cases = use_cases.AsyncUseCasesResourceWithRawResponse(client.use_cases)
|
|
422
417
|
self.requests = requests.AsyncRequestsResourceWithRawResponse(client.requests)
|
|
423
418
|
|
|
424
419
|
|
|
@@ -428,8 +423,7 @@ class PayiWithStreamedResponse:
|
|
|
428
423
|
self.ingest = ingest.IngestResourceWithStreamingResponse(client.ingest)
|
|
429
424
|
self.categories = categories.CategoriesResourceWithStreamingResponse(client.categories)
|
|
430
425
|
self.experiences = experiences.ExperiencesResourceWithStreamingResponse(client.experiences)
|
|
431
|
-
self.
|
|
432
|
-
self.price_modifiers = price_modifiers.PriceModifiersResourceWithStreamingResponse(client.price_modifiers)
|
|
426
|
+
self.use_cases = use_cases.UseCasesResourceWithStreamingResponse(client.use_cases)
|
|
433
427
|
self.requests = requests.RequestsResourceWithStreamingResponse(client.requests)
|
|
434
428
|
|
|
435
429
|
|
|
@@ -439,8 +433,7 @@ class AsyncPayiWithStreamedResponse:
|
|
|
439
433
|
self.ingest = ingest.AsyncIngestResourceWithStreamingResponse(client.ingest)
|
|
440
434
|
self.categories = categories.AsyncCategoriesResourceWithStreamingResponse(client.categories)
|
|
441
435
|
self.experiences = experiences.AsyncExperiencesResourceWithStreamingResponse(client.experiences)
|
|
442
|
-
self.
|
|
443
|
-
self.price_modifiers = price_modifiers.AsyncPriceModifiersResourceWithStreamingResponse(client.price_modifiers)
|
|
436
|
+
self.use_cases = use_cases.AsyncUseCasesResourceWithStreamingResponse(client.use_cases)
|
|
444
437
|
self.requests = requests.AsyncRequestsResourceWithStreamingResponse(client.requests)
|
|
445
438
|
|
|
446
439
|
|
payi/_models.py
CHANGED
|
@@ -65,7 +65,7 @@ from ._compat import (
|
|
|
65
65
|
from ._constants import RAW_RESPONSE_HEADER
|
|
66
66
|
|
|
67
67
|
if TYPE_CHECKING:
|
|
68
|
-
from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema
|
|
68
|
+
from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema
|
|
69
69
|
|
|
70
70
|
__all__ = ["BaseModel", "GenericModel"]
|
|
71
71
|
|
|
@@ -646,15 +646,18 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
|
|
|
646
646
|
|
|
647
647
|
def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None:
|
|
648
648
|
schema = model.__pydantic_core_schema__
|
|
649
|
+
if schema["type"] == "definitions":
|
|
650
|
+
schema = schema["schema"]
|
|
651
|
+
|
|
649
652
|
if schema["type"] != "model":
|
|
650
653
|
return None
|
|
651
654
|
|
|
655
|
+
schema = cast("ModelSchema", schema)
|
|
652
656
|
fields_schema = schema["schema"]
|
|
653
657
|
if fields_schema["type"] != "model-fields":
|
|
654
658
|
return None
|
|
655
659
|
|
|
656
660
|
fields_schema = cast("ModelFieldsSchema", fields_schema)
|
|
657
|
-
|
|
658
661
|
field = fields_schema["fields"].get(field_name)
|
|
659
662
|
if not field:
|
|
660
663
|
return None
|
payi/_version.py
CHANGED
payi/lib/helpers.py
CHANGED
|
@@ -7,6 +7,9 @@ class PayiHeaderNames:
|
|
|
7
7
|
request_tags:str = "xProxy-Request-Tags"
|
|
8
8
|
experience_id:str = "xProxy-Experience-ID"
|
|
9
9
|
experience_name:str = "xProxy-Experience-Name"
|
|
10
|
+
use_case_id:str = "xProxy-UseCase-ID"
|
|
11
|
+
use_case_name:str = "xProxy-UseCase-Name"
|
|
12
|
+
use_case_version:str = "xProxy-UseCase-Version"
|
|
10
13
|
user_id:str = "xProxy-User-ID"
|
|
11
14
|
route_as_resource:str = "xProxy-RouteAs-Resource"
|
|
12
15
|
provider_base_uri = "xProxy-Provider-BaseUri"
|
|
@@ -42,6 +45,9 @@ def create_headers(
|
|
|
42
45
|
user_id: Union[str, None] = None,
|
|
43
46
|
experience_id: Union[str, None] = None,
|
|
44
47
|
experience_name: Union[str, None] = None,
|
|
48
|
+
use_case_id: Union[str, None] = None,
|
|
49
|
+
use_case_name: Union[str, None] = None,
|
|
50
|
+
use_case_version: Union[int, None] = None,
|
|
45
51
|
) -> Dict[str, str]:
|
|
46
52
|
headers: Dict[str, str] = {}
|
|
47
53
|
|
|
@@ -55,7 +61,12 @@ def create_headers(
|
|
|
55
61
|
headers.update({ PayiHeaderNames.experience_id: experience_id})
|
|
56
62
|
if experience_name:
|
|
57
63
|
headers.update({ PayiHeaderNames.experience_name: experience_name})
|
|
58
|
-
|
|
64
|
+
if use_case_id:
|
|
65
|
+
headers.update({ PayiHeaderNames.use_case_id: use_case_id})
|
|
66
|
+
if use_case_name:
|
|
67
|
+
headers.update({ PayiHeaderNames.use_case_name: use_case_name})
|
|
68
|
+
if use_case_version:
|
|
69
|
+
headers.update({ PayiHeaderNames.use_case_version: str(use_case_version)})
|
|
59
70
|
return headers
|
|
60
71
|
|
|
61
72
|
def payi_anthropic_url(payi_base_url: Union[str, None] = None) -> str:
|
payi/resources/__init__.py
CHANGED
|
@@ -24,6 +24,14 @@ from .requests import (
|
|
|
24
24
|
RequestsResourceWithStreamingResponse,
|
|
25
25
|
AsyncRequestsResourceWithStreamingResponse,
|
|
26
26
|
)
|
|
27
|
+
from .use_cases import (
|
|
28
|
+
UseCasesResource,
|
|
29
|
+
AsyncUseCasesResource,
|
|
30
|
+
UseCasesResourceWithRawResponse,
|
|
31
|
+
AsyncUseCasesResourceWithRawResponse,
|
|
32
|
+
UseCasesResourceWithStreamingResponse,
|
|
33
|
+
AsyncUseCasesResourceWithStreamingResponse,
|
|
34
|
+
)
|
|
27
35
|
from .categories import (
|
|
28
36
|
CategoriesResource,
|
|
29
37
|
AsyncCategoriesResource,
|
|
@@ -40,22 +48,6 @@ from .experiences import (
|
|
|
40
48
|
ExperiencesResourceWithStreamingResponse,
|
|
41
49
|
AsyncExperiencesResourceWithStreamingResponse,
|
|
42
50
|
)
|
|
43
|
-
from .billing_models import (
|
|
44
|
-
BillingModelsResource,
|
|
45
|
-
AsyncBillingModelsResource,
|
|
46
|
-
BillingModelsResourceWithRawResponse,
|
|
47
|
-
AsyncBillingModelsResourceWithRawResponse,
|
|
48
|
-
BillingModelsResourceWithStreamingResponse,
|
|
49
|
-
AsyncBillingModelsResourceWithStreamingResponse,
|
|
50
|
-
)
|
|
51
|
-
from .price_modifiers import (
|
|
52
|
-
PriceModifiersResource,
|
|
53
|
-
AsyncPriceModifiersResource,
|
|
54
|
-
PriceModifiersResourceWithRawResponse,
|
|
55
|
-
AsyncPriceModifiersResourceWithRawResponse,
|
|
56
|
-
PriceModifiersResourceWithStreamingResponse,
|
|
57
|
-
AsyncPriceModifiersResourceWithStreamingResponse,
|
|
58
|
-
)
|
|
59
51
|
|
|
60
52
|
__all__ = [
|
|
61
53
|
"LimitsResource",
|
|
@@ -82,18 +74,12 @@ __all__ = [
|
|
|
82
74
|
"AsyncExperiencesResourceWithRawResponse",
|
|
83
75
|
"ExperiencesResourceWithStreamingResponse",
|
|
84
76
|
"AsyncExperiencesResourceWithStreamingResponse",
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"PriceModifiersResource",
|
|
92
|
-
"AsyncPriceModifiersResource",
|
|
93
|
-
"PriceModifiersResourceWithRawResponse",
|
|
94
|
-
"AsyncPriceModifiersResourceWithRawResponse",
|
|
95
|
-
"PriceModifiersResourceWithStreamingResponse",
|
|
96
|
-
"AsyncPriceModifiersResourceWithStreamingResponse",
|
|
77
|
+
"UseCasesResource",
|
|
78
|
+
"AsyncUseCasesResource",
|
|
79
|
+
"UseCasesResourceWithRawResponse",
|
|
80
|
+
"AsyncUseCasesResourceWithRawResponse",
|
|
81
|
+
"UseCasesResourceWithStreamingResponse",
|
|
82
|
+
"AsyncUseCasesResourceWithStreamingResponse",
|
|
97
83
|
"RequestsResource",
|
|
98
84
|
"AsyncRequestsResource",
|
|
99
85
|
"RequestsResourceWithRawResponse",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict, Union
|
|
5
|
+
from typing import Dict, Union, Optional
|
|
6
6
|
from datetime import datetime
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
@@ -54,9 +54,9 @@ class ResourcesResource(SyncAPIResource):
|
|
|
54
54
|
*,
|
|
55
55
|
category: str,
|
|
56
56
|
units: Dict[str, resource_create_params.Units],
|
|
57
|
-
max_input_units: int | NotGiven = NOT_GIVEN,
|
|
58
|
-
max_output_units: int | NotGiven = NOT_GIVEN,
|
|
59
|
-
max_total_units: int | NotGiven = NOT_GIVEN,
|
|
57
|
+
max_input_units: Optional[int] | NotGiven = NOT_GIVEN,
|
|
58
|
+
max_output_units: Optional[int] | NotGiven = NOT_GIVEN,
|
|
59
|
+
max_total_units: Optional[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.
|
|
@@ -240,9 +240,9 @@ class AsyncResourcesResource(AsyncAPIResource):
|
|
|
240
240
|
*,
|
|
241
241
|
category: str,
|
|
242
242
|
units: Dict[str, resource_create_params.Units],
|
|
243
|
-
max_input_units: int | NotGiven = NOT_GIVEN,
|
|
244
|
-
max_output_units: int | NotGiven = NOT_GIVEN,
|
|
245
|
-
max_total_units: int | NotGiven = NOT_GIVEN,
|
|
243
|
+
max_input_units: Optional[int] | NotGiven = NOT_GIVEN,
|
|
244
|
+
max_output_units: Optional[int] | NotGiven = NOT_GIVEN,
|
|
245
|
+
max_total_units: Optional[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.
|
|
@@ -31,6 +31,9 @@ from ...._base_client import make_request_options
|
|
|
31
31
|
from ....types.experiences import type_list_params, type_create_params, type_update_params
|
|
32
32
|
from ....types.experiences.experience_type import ExperienceType
|
|
33
33
|
from ....types.experiences.type_list_response import TypeListResponse
|
|
34
|
+
from ....types.shared_params.pay_i_common_models_budget_management_create_limit_base import (
|
|
35
|
+
PayICommonModelsBudgetManagementCreateLimitBase,
|
|
36
|
+
)
|
|
34
37
|
|
|
35
38
|
__all__ = ["TypesResource", "AsyncTypesResource"]
|
|
36
39
|
|
|
@@ -64,7 +67,7 @@ class TypesResource(SyncAPIResource):
|
|
|
64
67
|
*,
|
|
65
68
|
description: str,
|
|
66
69
|
name: str,
|
|
67
|
-
limit_config:
|
|
70
|
+
limit_config: PayICommonModelsBudgetManagementCreateLimitBase | NotGiven = NOT_GIVEN,
|
|
68
71
|
logging_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
69
72
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
70
73
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -277,7 +280,7 @@ class AsyncTypesResource(AsyncAPIResource):
|
|
|
277
280
|
*,
|
|
278
281
|
description: str,
|
|
279
282
|
name: str,
|
|
280
|
-
limit_config:
|
|
283
|
+
limit_config: PayICommonModelsBudgetManagementCreateLimitBase | NotGiven = NOT_GIVEN,
|
|
281
284
|
logging_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
282
285
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
283
286
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
payi/resources/ingest.py
CHANGED
|
@@ -101,10 +101,14 @@ class IngestResource(SyncAPIResource):
|
|
|
101
101
|
provider_response_json: Union[str, List[str], None] | NotGiven = NOT_GIVEN,
|
|
102
102
|
provider_uri: Optional[str] | NotGiven = NOT_GIVEN,
|
|
103
103
|
time_to_first_token_ms: Optional[int] | NotGiven = NOT_GIVEN,
|
|
104
|
+
use_case_properties: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
104
105
|
limit_ids: Optional[list[str]] | NotGiven = NOT_GIVEN,
|
|
105
106
|
request_tags: Optional[list[str]] | NotGiven = NOT_GIVEN,
|
|
106
107
|
experience_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
107
108
|
experience_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
109
|
+
use_case_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
110
|
+
use_case_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
111
|
+
use_case_version: Optional[int] | NotGiven = NOT_GIVEN,
|
|
108
112
|
user_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
109
113
|
resource_scope: Optional[str] | NotGiven = NOT_GIVEN,
|
|
110
114
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -132,9 +136,15 @@ class IngestResource(SyncAPIResource):
|
|
|
132
136
|
|
|
133
137
|
request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
|
|
134
138
|
|
|
135
|
-
experience_name (str, optional):
|
|
139
|
+
experience_name (str, optional): DEPRECATED, replaced with use_case_name.
|
|
136
140
|
|
|
137
|
-
experience_id (str, optional):
|
|
141
|
+
experience_id (str, optional): DEPRECATED, replaced with use_case_id.
|
|
142
|
+
|
|
143
|
+
use_case_name (str, optional): The use case name
|
|
144
|
+
|
|
145
|
+
use_case_id (str, optional): The use case instance id
|
|
146
|
+
|
|
147
|
+
use_case_version (int, optional): The use case instance version
|
|
138
148
|
|
|
139
149
|
user_id (str, optional): The user id
|
|
140
150
|
|
|
@@ -150,6 +160,7 @@ class IngestResource(SyncAPIResource):
|
|
|
150
160
|
"""
|
|
151
161
|
valid_ids_str: str | NotGiven = NOT_GIVEN
|
|
152
162
|
valid_tags_str: str | NotGiven = NOT_GIVEN
|
|
163
|
+
use_case_version_str: str | NotGiven = NOT_GIVEN
|
|
153
164
|
|
|
154
165
|
if limit_ids is None or isinstance(limit_ids, NotGiven):
|
|
155
166
|
valid_ids_str = NOT_GIVEN
|
|
@@ -175,6 +186,17 @@ class IngestResource(SyncAPIResource):
|
|
|
175
186
|
if experience_id is None or isinstance(experience_id, NotGiven):
|
|
176
187
|
experience_id = NOT_GIVEN
|
|
177
188
|
|
|
189
|
+
if use_case_name is None or isinstance(use_case_name, NotGiven):
|
|
190
|
+
use_case_name = NOT_GIVEN
|
|
191
|
+
|
|
192
|
+
if use_case_id is None or isinstance(use_case_id, NotGiven):
|
|
193
|
+
use_case_id = NOT_GIVEN
|
|
194
|
+
|
|
195
|
+
if use_case_version is None or isinstance(use_case_version, NotGiven):
|
|
196
|
+
use_case_version_str = NOT_GIVEN
|
|
197
|
+
else:
|
|
198
|
+
use_case_version_str = str(use_case_version)
|
|
199
|
+
|
|
178
200
|
if user_id is None or isinstance(user_id, NotGiven):
|
|
179
201
|
user_id = NOT_GIVEN
|
|
180
202
|
|
|
@@ -183,7 +205,10 @@ class IngestResource(SyncAPIResource):
|
|
|
183
205
|
"xProxy-Limit-IDs": valid_ids_str,
|
|
184
206
|
"xProxy-Request-Tags": valid_tags_str,
|
|
185
207
|
"xProxy-Experience-Name": experience_name,
|
|
186
|
-
"xProxy-Experience-
|
|
208
|
+
"xProxy-Experience-ID": experience_id,
|
|
209
|
+
"xProxy-UseCase-ID": use_case_id,
|
|
210
|
+
"xProxy-UseCase-Name": use_case_name,
|
|
211
|
+
"xProxy-UseCase-Version": use_case_version_str,
|
|
187
212
|
"xProxy-User-ID": user_id,
|
|
188
213
|
"xProxy-Resource-Scope": resource_scope,
|
|
189
214
|
}).items() if value is not None}, # Ensure no 'None' values are included
|
|
@@ -209,6 +234,7 @@ class IngestResource(SyncAPIResource):
|
|
|
209
234
|
"provider_response_json": provider_response_json,
|
|
210
235
|
"provider_uri": provider_uri,
|
|
211
236
|
"time_to_first_token_ms": time_to_first_token_ms,
|
|
237
|
+
"use_case_properties": use_case_properties,
|
|
212
238
|
},
|
|
213
239
|
ingest_units_params.IngestUnitsParams,
|
|
214
240
|
),
|
|
@@ -289,10 +315,14 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
289
315
|
provider_response_json: Union[str, List[str], None] | NotGiven = NOT_GIVEN,
|
|
290
316
|
provider_uri: Optional[str] | NotGiven = NOT_GIVEN,
|
|
291
317
|
time_to_first_token_ms: Optional[int] | NotGiven = NOT_GIVEN,
|
|
318
|
+
use_case_properties: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
292
319
|
limit_ids: Optional[list[str]] | NotGiven = NOT_GIVEN,
|
|
293
320
|
request_tags: Optional[list[str]] | NotGiven = NOT_GIVEN,
|
|
294
321
|
experience_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
295
322
|
experience_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
323
|
+
use_case_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
324
|
+
use_case_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
325
|
+
use_case_version: Optional[int] | NotGiven = NOT_GIVEN,
|
|
296
326
|
user_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
297
327
|
resource_scope: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
298
328
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -319,9 +349,15 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
319
349
|
|
|
320
350
|
request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
|
|
321
351
|
|
|
322
|
-
experience_name (str, optional):
|
|
352
|
+
experience_name (str, optional): DEPRECATED, replaced with use_case_name.
|
|
353
|
+
|
|
354
|
+
experience_id (str, optional): DEPRECATED, replaced with use_case_id.
|
|
323
355
|
|
|
324
|
-
|
|
356
|
+
use_case_name (str, optional): The use case name
|
|
357
|
+
|
|
358
|
+
use_case_id (str, optional): The use case instance id
|
|
359
|
+
|
|
360
|
+
use_case_version (int, optional): The use case instance version
|
|
325
361
|
|
|
326
362
|
user_id (str, optional): The user id
|
|
327
363
|
|
|
@@ -337,6 +373,7 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
337
373
|
"""
|
|
338
374
|
valid_ids_str: str | NotGiven = NOT_GIVEN
|
|
339
375
|
valid_tags_str: str | NotGiven = NOT_GIVEN
|
|
376
|
+
use_case_version_str: str | NotGiven = NOT_GIVEN
|
|
340
377
|
|
|
341
378
|
if limit_ids is None or isinstance(limit_ids, NotGiven):
|
|
342
379
|
valid_ids_str = NOT_GIVEN
|
|
@@ -362,6 +399,17 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
362
399
|
if experience_id is None or isinstance(experience_id, NotGiven):
|
|
363
400
|
experience_id = NOT_GIVEN
|
|
364
401
|
|
|
402
|
+
if use_case_name is None or isinstance(use_case_name, NotGiven):
|
|
403
|
+
use_case_name = NOT_GIVEN
|
|
404
|
+
|
|
405
|
+
if use_case_id is None or isinstance(use_case_id, NotGiven):
|
|
406
|
+
use_case_id = NOT_GIVEN
|
|
407
|
+
|
|
408
|
+
if use_case_version is None or isinstance(use_case_version, NotGiven):
|
|
409
|
+
use_case_version_str = NOT_GIVEN
|
|
410
|
+
else:
|
|
411
|
+
use_case_version_str = str(use_case_version)
|
|
412
|
+
|
|
365
413
|
if user_id is None or isinstance(user_id, NotGiven):
|
|
366
414
|
user_id = NOT_GIVEN
|
|
367
415
|
|
|
@@ -370,7 +418,10 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
370
418
|
"xProxy-Limit-IDs": valid_ids_str,
|
|
371
419
|
"xProxy-Request-Tags": valid_tags_str,
|
|
372
420
|
"xProxy-Experience-Name": experience_name,
|
|
373
|
-
"xProxy-Experience-
|
|
421
|
+
"xProxy-Experience-ID": experience_id,
|
|
422
|
+
"xProxy-UseCase-ID": use_case_id,
|
|
423
|
+
"xProxy-UseCase-Name": use_case_name,
|
|
424
|
+
"xProxy-UseCase-Version": use_case_version_str,
|
|
374
425
|
"xProxy-User-ID": user_id,
|
|
375
426
|
"xProxy-Resource-Scope": resource_scope,
|
|
376
427
|
}).items() if value is not None}, # Ensure no 'None' values are included
|
|
@@ -395,6 +446,7 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
395
446
|
"provider_response_json": provider_response_json,
|
|
396
447
|
"provider_uri": provider_uri,
|
|
397
448
|
"time_to_first_token_ms": time_to_first_token_ms,
|
|
449
|
+
"use_case_properties": use_case_properties,
|
|
398
450
|
},
|
|
399
451
|
ingest_units_params.IngestUnitsParams,
|
|
400
452
|
),
|
payi/resources/limits/limits.py
CHANGED
|
@@ -195,6 +195,7 @@ class LimitsResource(SyncAPIResource):
|
|
|
195
195
|
page_size: int | NotGiven = NOT_GIVEN,
|
|
196
196
|
sort_ascending: bool | NotGiven = NOT_GIVEN,
|
|
197
197
|
sort_by: str | NotGiven = NOT_GIVEN,
|
|
198
|
+
tag_list: List[str] | NotGiven = NOT_GIVEN,
|
|
198
199
|
tags: str | NotGiven = NOT_GIVEN,
|
|
199
200
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
200
201
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -229,6 +230,7 @@ class LimitsResource(SyncAPIResource):
|
|
|
229
230
|
"page_size": page_size,
|
|
230
231
|
"sort_ascending": sort_ascending,
|
|
231
232
|
"sort_by": sort_by,
|
|
233
|
+
"tag_list": tag_list,
|
|
232
234
|
"tags": tags,
|
|
233
235
|
},
|
|
234
236
|
limit_list_params.LimitListParams,
|
|
@@ -467,6 +469,7 @@ class AsyncLimitsResource(AsyncAPIResource):
|
|
|
467
469
|
page_size: int | NotGiven = NOT_GIVEN,
|
|
468
470
|
sort_ascending: bool | NotGiven = NOT_GIVEN,
|
|
469
471
|
sort_by: str | NotGiven = NOT_GIVEN,
|
|
472
|
+
tag_list: List[str] | NotGiven = NOT_GIVEN,
|
|
470
473
|
tags: str | NotGiven = NOT_GIVEN,
|
|
471
474
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
472
475
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -501,6 +504,7 @@ class AsyncLimitsResource(AsyncAPIResource):
|
|
|
501
504
|
"page_size": page_size,
|
|
502
505
|
"sort_ascending": sort_ascending,
|
|
503
506
|
"sort_by": sort_by,
|
|
507
|
+
"tag_list": tag_list,
|
|
504
508
|
"tags": tags,
|
|
505
509
|
},
|
|
506
510
|
limit_list_params.LimitListParams,
|