payi 0.1.0a32__py3-none-any.whl → 0.1.0a34__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 (49) hide show
  1. payi/_client.py +63 -68
  2. payi/_models.py +3 -0
  3. payi/_response.py +10 -10
  4. payi/_utils/__init__.py +1 -0
  5. payi/_utils/_typing.py +30 -1
  6. payi/_version.py +1 -1
  7. payi/lib/helpers.py +8 -8
  8. payi/resources/__init__.py +13 -13
  9. payi/resources/billing_models.py +4 -4
  10. payi/resources/experiences/properties.py +3 -3
  11. payi/resources/ingest.py +47 -19
  12. payi/resources/{budgets → limits}/__init__.py +13 -13
  13. payi/resources/{budgets/budgets.py → limits/limits.py} +213 -196
  14. payi/resources/{budgets → limits}/tags.py +68 -68
  15. payi/resources/requests/properties.py +3 -3
  16. payi/types/__init__.py +8 -6
  17. payi/types/billing_model.py +1 -1
  18. payi/types/billing_model_create_params.py +1 -1
  19. payi/types/billing_model_update_params.py +1 -1
  20. payi/types/category_resource_response.py +4 -0
  21. payi/types/experiences/property_create_params.py +2 -2
  22. payi/types/ingest_event_param.py +16 -2
  23. payi/types/ingest_response.py +7 -7
  24. payi/types/ingest_units_params.py +16 -2
  25. payi/types/{budget_create_params.py → limit_create_params.py} +7 -9
  26. payi/types/limit_history_response.py +34 -0
  27. payi/types/{budget_list_params.py → limit_list_params.py} +3 -3
  28. payi/types/limit_reset_params.py +16 -0
  29. payi/types/{budget_response.py → limit_response.py} +11 -13
  30. payi/types/{budget_update_params.py → limit_update_params.py} +3 -3
  31. payi/types/{budgets → limits}/__init__.py +1 -1
  32. payi/types/{budgets/budget_tags.py → limits/limit_tags.py} +2 -2
  33. payi/types/{budgets → limits}/tag_create_params.py +1 -1
  34. payi/types/{budgets → limits}/tag_create_response.py +2 -2
  35. payi/types/{budgets → limits}/tag_delete_response.py +2 -2
  36. payi/types/{budgets → limits}/tag_list_response.py +2 -2
  37. payi/types/{budgets → limits}/tag_remove_params.py +1 -1
  38. payi/types/{budgets → limits}/tag_remove_response.py +2 -2
  39. payi/types/{budgets → limits}/tag_update_params.py +1 -1
  40. payi/types/{budgets → limits}/tag_update_response.py +2 -2
  41. payi/types/{paged_budget_list.py → paged_limit_list.py} +9 -11
  42. payi/types/requests/property_create_params.py +2 -2
  43. payi/types/shared/__init__.py +3 -0
  44. payi/types/shared/evaluation_response.py +11 -0
  45. {payi-0.1.0a32.dist-info → payi-0.1.0a34.dist-info}/METADATA +33 -22
  46. {payi-0.1.0a32.dist-info → payi-0.1.0a34.dist-info}/RECORD +48 -45
  47. {payi-0.1.0a32.dist-info → payi-0.1.0a34.dist-info}/WHEEL +1 -1
  48. {payi-0.1.0a32.dist-info → payi-0.1.0a34.dist-info}/licenses/LICENSE +1 -1
  49. payi/types/budget_history_response.py +0 -38
payi/_client.py CHANGED
@@ -8,7 +8,7 @@ from typing_extensions import Self, override
8
8
 
9
9
  import httpx
10
10
 
11
- from . import resources, _exceptions
11
+ from . import _exceptions
12
12
  from ._qs import Querystring
13
13
  from ._types import (
14
14
  NOT_GIVEN,
@@ -24,6 +24,7 @@ from ._utils import (
24
24
  get_async_library,
25
25
  )
26
26
  from ._version import __version__
27
+ from .resources import ingest, billing_models, price_modifiers
27
28
  from ._streaming import Stream as Stream, AsyncStream as AsyncStream
28
29
  from ._exceptions import PayiError, APIStatusError
29
30
  from ._base_client import (
@@ -31,28 +32,22 @@ from ._base_client import (
31
32
  SyncAPIClient,
32
33
  AsyncAPIClient,
33
34
  )
35
+ from .resources.limits import limits
36
+ from .resources.requests import requests
37
+ from .resources.categories import categories
38
+ from .resources.experiences import experiences
34
39
 
35
- __all__ = [
36
- "Timeout",
37
- "Transport",
38
- "ProxiesTypes",
39
- "RequestOptions",
40
- "resources",
41
- "Payi",
42
- "AsyncPayi",
43
- "Client",
44
- "AsyncClient",
45
- ]
40
+ __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Payi", "AsyncPayi", "Client", "AsyncClient"]
46
41
 
47
42
 
48
43
  class Payi(SyncAPIClient):
49
- budgets: resources.BudgetsResource
50
- ingest: resources.IngestResource
51
- categories: resources.CategoriesResource
52
- experiences: resources.ExperiencesResource
53
- billing_models: resources.BillingModelsResource
54
- price_modifiers: resources.PriceModifiersResource
55
- requests: resources.RequestsResource
44
+ limits: limits.LimitsResource
45
+ ingest: ingest.IngestResource
46
+ categories: categories.CategoriesResource
47
+ experiences: experiences.ExperiencesResource
48
+ billing_models: billing_models.BillingModelsResource
49
+ price_modifiers: price_modifiers.PriceModifiersResource
50
+ requests: requests.RequestsResource
56
51
  with_raw_response: PayiWithRawResponse
57
52
  with_streaming_response: PayiWithStreamedResponse
58
53
 
@@ -110,13 +105,13 @@ class Payi(SyncAPIClient):
110
105
  _strict_response_validation=_strict_response_validation,
111
106
  )
112
107
 
113
- self.budgets = resources.BudgetsResource(self)
114
- self.ingest = resources.IngestResource(self)
115
- self.categories = resources.CategoriesResource(self)
116
- self.experiences = resources.ExperiencesResource(self)
117
- self.billing_models = resources.BillingModelsResource(self)
118
- self.price_modifiers = resources.PriceModifiersResource(self)
119
- self.requests = resources.RequestsResource(self)
108
+ self.limits = limits.LimitsResource(self)
109
+ self.ingest = ingest.IngestResource(self)
110
+ self.categories = categories.CategoriesResource(self)
111
+ self.experiences = experiences.ExperiencesResource(self)
112
+ self.billing_models = billing_models.BillingModelsResource(self)
113
+ self.price_modifiers = price_modifiers.PriceModifiersResource(self)
114
+ self.requests = requests.RequestsResource(self)
120
115
  self.with_raw_response = PayiWithRawResponse(self)
121
116
  self.with_streaming_response = PayiWithStreamedResponse(self)
122
117
 
@@ -226,13 +221,13 @@ class Payi(SyncAPIClient):
226
221
 
227
222
 
228
223
  class AsyncPayi(AsyncAPIClient):
229
- budgets: resources.AsyncBudgetsResource
230
- ingest: resources.AsyncIngestResource
231
- categories: resources.AsyncCategoriesResource
232
- experiences: resources.AsyncExperiencesResource
233
- billing_models: resources.AsyncBillingModelsResource
234
- price_modifiers: resources.AsyncPriceModifiersResource
235
- requests: resources.AsyncRequestsResource
224
+ limits: limits.AsyncLimitsResource
225
+ ingest: ingest.AsyncIngestResource
226
+ categories: categories.AsyncCategoriesResource
227
+ experiences: experiences.AsyncExperiencesResource
228
+ billing_models: billing_models.AsyncBillingModelsResource
229
+ price_modifiers: price_modifiers.AsyncPriceModifiersResource
230
+ requests: requests.AsyncRequestsResource
236
231
  with_raw_response: AsyncPayiWithRawResponse
237
232
  with_streaming_response: AsyncPayiWithStreamedResponse
238
233
 
@@ -290,13 +285,13 @@ class AsyncPayi(AsyncAPIClient):
290
285
  _strict_response_validation=_strict_response_validation,
291
286
  )
292
287
 
293
- self.budgets = resources.AsyncBudgetsResource(self)
294
- self.ingest = resources.AsyncIngestResource(self)
295
- self.categories = resources.AsyncCategoriesResource(self)
296
- self.experiences = resources.AsyncExperiencesResource(self)
297
- self.billing_models = resources.AsyncBillingModelsResource(self)
298
- self.price_modifiers = resources.AsyncPriceModifiersResource(self)
299
- self.requests = resources.AsyncRequestsResource(self)
288
+ self.limits = limits.AsyncLimitsResource(self)
289
+ self.ingest = ingest.AsyncIngestResource(self)
290
+ self.categories = categories.AsyncCategoriesResource(self)
291
+ self.experiences = experiences.AsyncExperiencesResource(self)
292
+ self.billing_models = billing_models.AsyncBillingModelsResource(self)
293
+ self.price_modifiers = price_modifiers.AsyncPriceModifiersResource(self)
294
+ self.requests = requests.AsyncRequestsResource(self)
300
295
  self.with_raw_response = AsyncPayiWithRawResponse(self)
301
296
  self.with_streaming_response = AsyncPayiWithStreamedResponse(self)
302
297
 
@@ -407,46 +402,46 @@ class AsyncPayi(AsyncAPIClient):
407
402
 
408
403
  class PayiWithRawResponse:
409
404
  def __init__(self, client: Payi) -> None:
410
- self.budgets = resources.BudgetsResourceWithRawResponse(client.budgets)
411
- self.ingest = resources.IngestResourceWithRawResponse(client.ingest)
412
- self.categories = resources.CategoriesResourceWithRawResponse(client.categories)
413
- self.experiences = resources.ExperiencesResourceWithRawResponse(client.experiences)
414
- self.billing_models = resources.BillingModelsResourceWithRawResponse(client.billing_models)
415
- self.price_modifiers = resources.PriceModifiersResourceWithRawResponse(client.price_modifiers)
416
- self.requests = resources.RequestsResourceWithRawResponse(client.requests)
405
+ self.limits = limits.LimitsResourceWithRawResponse(client.limits)
406
+ self.ingest = ingest.IngestResourceWithRawResponse(client.ingest)
407
+ self.categories = categories.CategoriesResourceWithRawResponse(client.categories)
408
+ self.experiences = experiences.ExperiencesResourceWithRawResponse(client.experiences)
409
+ self.billing_models = billing_models.BillingModelsResourceWithRawResponse(client.billing_models)
410
+ self.price_modifiers = price_modifiers.PriceModifiersResourceWithRawResponse(client.price_modifiers)
411
+ self.requests = requests.RequestsResourceWithRawResponse(client.requests)
417
412
 
418
413
 
419
414
  class AsyncPayiWithRawResponse:
420
415
  def __init__(self, client: AsyncPayi) -> None:
421
- self.budgets = resources.AsyncBudgetsResourceWithRawResponse(client.budgets)
422
- self.ingest = resources.AsyncIngestResourceWithRawResponse(client.ingest)
423
- self.categories = resources.AsyncCategoriesResourceWithRawResponse(client.categories)
424
- self.experiences = resources.AsyncExperiencesResourceWithRawResponse(client.experiences)
425
- self.billing_models = resources.AsyncBillingModelsResourceWithRawResponse(client.billing_models)
426
- self.price_modifiers = resources.AsyncPriceModifiersResourceWithRawResponse(client.price_modifiers)
427
- self.requests = resources.AsyncRequestsResourceWithRawResponse(client.requests)
416
+ self.limits = limits.AsyncLimitsResourceWithRawResponse(client.limits)
417
+ self.ingest = ingest.AsyncIngestResourceWithRawResponse(client.ingest)
418
+ self.categories = categories.AsyncCategoriesResourceWithRawResponse(client.categories)
419
+ self.experiences = experiences.AsyncExperiencesResourceWithRawResponse(client.experiences)
420
+ self.billing_models = billing_models.AsyncBillingModelsResourceWithRawResponse(client.billing_models)
421
+ self.price_modifiers = price_modifiers.AsyncPriceModifiersResourceWithRawResponse(client.price_modifiers)
422
+ self.requests = requests.AsyncRequestsResourceWithRawResponse(client.requests)
428
423
 
429
424
 
430
425
  class PayiWithStreamedResponse:
431
426
  def __init__(self, client: Payi) -> None:
432
- self.budgets = resources.BudgetsResourceWithStreamingResponse(client.budgets)
433
- self.ingest = resources.IngestResourceWithStreamingResponse(client.ingest)
434
- self.categories = resources.CategoriesResourceWithStreamingResponse(client.categories)
435
- self.experiences = resources.ExperiencesResourceWithStreamingResponse(client.experiences)
436
- self.billing_models = resources.BillingModelsResourceWithStreamingResponse(client.billing_models)
437
- self.price_modifiers = resources.PriceModifiersResourceWithStreamingResponse(client.price_modifiers)
438
- self.requests = resources.RequestsResourceWithStreamingResponse(client.requests)
427
+ self.limits = limits.LimitsResourceWithStreamingResponse(client.limits)
428
+ self.ingest = ingest.IngestResourceWithStreamingResponse(client.ingest)
429
+ self.categories = categories.CategoriesResourceWithStreamingResponse(client.categories)
430
+ self.experiences = experiences.ExperiencesResourceWithStreamingResponse(client.experiences)
431
+ self.billing_models = billing_models.BillingModelsResourceWithStreamingResponse(client.billing_models)
432
+ self.price_modifiers = price_modifiers.PriceModifiersResourceWithStreamingResponse(client.price_modifiers)
433
+ self.requests = requests.RequestsResourceWithStreamingResponse(client.requests)
439
434
 
440
435
 
441
436
  class AsyncPayiWithStreamedResponse:
442
437
  def __init__(self, client: AsyncPayi) -> None:
443
- self.budgets = resources.AsyncBudgetsResourceWithStreamingResponse(client.budgets)
444
- self.ingest = resources.AsyncIngestResourceWithStreamingResponse(client.ingest)
445
- self.categories = resources.AsyncCategoriesResourceWithStreamingResponse(client.categories)
446
- self.experiences = resources.AsyncExperiencesResourceWithStreamingResponse(client.experiences)
447
- self.billing_models = resources.AsyncBillingModelsResourceWithStreamingResponse(client.billing_models)
448
- self.price_modifiers = resources.AsyncPriceModifiersResourceWithStreamingResponse(client.price_modifiers)
449
- self.requests = resources.AsyncRequestsResourceWithStreamingResponse(client.requests)
438
+ self.limits = limits.AsyncLimitsResourceWithStreamingResponse(client.limits)
439
+ self.ingest = ingest.AsyncIngestResourceWithStreamingResponse(client.ingest)
440
+ self.categories = categories.AsyncCategoriesResourceWithStreamingResponse(client.categories)
441
+ self.experiences = experiences.AsyncExperiencesResourceWithStreamingResponse(client.experiences)
442
+ self.billing_models = billing_models.AsyncBillingModelsResourceWithStreamingResponse(client.billing_models)
443
+ self.price_modifiers = price_modifiers.AsyncPriceModifiersResourceWithStreamingResponse(client.price_modifiers)
444
+ self.requests = requests.AsyncRequestsResourceWithStreamingResponse(client.requests)
450
445
 
451
446
 
452
447
  Client = Payi
payi/_models.py CHANGED
@@ -46,6 +46,7 @@ from ._utils import (
46
46
  strip_not_given,
47
47
  extract_type_arg,
48
48
  is_annotated_type,
49
+ is_type_alias_type,
49
50
  strip_annotated_type,
50
51
  )
51
52
  from ._compat import (
@@ -428,6 +429,8 @@ def construct_type(*, value: object, type_: object) -> object:
428
429
  # we allow `object` as the input type because otherwise, passing things like
429
430
  # `Literal['value']` will be reported as a type error by type checkers
430
431
  type_ = cast("type[object]", type_)
432
+ if is_type_alias_type(type_):
433
+ type_ = type_.__value__ # type: ignore[unreachable]
431
434
 
432
435
  # unwrap `Annotated[T, ...]` -> `T`
433
436
  if is_annotated_type(type_):
payi/_response.py CHANGED
@@ -25,7 +25,7 @@ import httpx
25
25
  import pydantic
26
26
 
27
27
  from ._types import NoneType
28
- from ._utils import is_given, extract_type_arg, is_annotated_type, extract_type_var_from_base
28
+ from ._utils import is_given, extract_type_arg, is_annotated_type, is_type_alias_type, extract_type_var_from_base
29
29
  from ._models import BaseModel, is_basemodel
30
30
  from ._constants import RAW_RESPONSE_HEADER, OVERRIDE_CAST_TO_HEADER
31
31
  from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type
@@ -126,9 +126,15 @@ class BaseAPIResponse(Generic[R]):
126
126
  )
127
127
 
128
128
  def _parse(self, *, to: type[_T] | None = None) -> R | _T:
129
+ cast_to = to if to is not None else self._cast_to
130
+
131
+ # unwrap `TypeAlias('Name', T)` -> `T`
132
+ if is_type_alias_type(cast_to):
133
+ cast_to = cast_to.__value__ # type: ignore[unreachable]
134
+
129
135
  # unwrap `Annotated[T, ...]` -> `T`
130
- if to and is_annotated_type(to):
131
- to = extract_type_arg(to, 0)
136
+ if cast_to and is_annotated_type(cast_to):
137
+ cast_to = extract_type_arg(cast_to, 0)
132
138
 
133
139
  if self._is_sse_stream:
134
140
  if to:
@@ -164,18 +170,12 @@ class BaseAPIResponse(Generic[R]):
164
170
  return cast(
165
171
  R,
166
172
  stream_cls(
167
- cast_to=self._cast_to,
173
+ cast_to=cast_to,
168
174
  response=self.http_response,
169
175
  client=cast(Any, self._client),
170
176
  ),
171
177
  )
172
178
 
173
- cast_to = to if to is not None else self._cast_to
174
-
175
- # unwrap `Annotated[T, ...]` -> `T`
176
- if is_annotated_type(cast_to):
177
- cast_to = extract_type_arg(cast_to, 0)
178
-
179
179
  if cast_to is NoneType:
180
180
  return cast(R, None)
181
181
 
payi/_utils/__init__.py CHANGED
@@ -39,6 +39,7 @@ from ._typing import (
39
39
  is_iterable_type as is_iterable_type,
40
40
  is_required_type as is_required_type,
41
41
  is_annotated_type as is_annotated_type,
42
+ is_type_alias_type as is_type_alias_type,
42
43
  strip_annotated_type as strip_annotated_type,
43
44
  extract_type_var_from_base as extract_type_var_from_base,
44
45
  )
payi/_utils/_typing.py CHANGED
@@ -1,8 +1,17 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import sys
4
+ import typing
5
+ import typing_extensions
3
6
  from typing import Any, TypeVar, Iterable, cast
4
7
  from collections import abc as _c_abc
5
- from typing_extensions import Required, Annotated, get_args, get_origin
8
+ from typing_extensions import (
9
+ TypeIs,
10
+ Required,
11
+ Annotated,
12
+ get_args,
13
+ get_origin,
14
+ )
6
15
 
7
16
  from .._types import InheritsGeneric
8
17
  from .._compat import is_union as _is_union
@@ -36,6 +45,26 @@ def is_typevar(typ: type) -> bool:
36
45
  return type(typ) == TypeVar # type: ignore
37
46
 
38
47
 
48
+ _TYPE_ALIAS_TYPES: tuple[type[typing_extensions.TypeAliasType], ...] = (typing_extensions.TypeAliasType,)
49
+ if sys.version_info >= (3, 12):
50
+ _TYPE_ALIAS_TYPES = (*_TYPE_ALIAS_TYPES, typing.TypeAliasType)
51
+
52
+
53
+ def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]:
54
+ """Return whether the provided argument is an instance of `TypeAliasType`.
55
+
56
+ ```python
57
+ type Int = int
58
+ is_type_alias_type(Int)
59
+ # > True
60
+ Str = TypeAliasType("Str", str)
61
+ is_type_alias_type(Str)
62
+ # > True
63
+ ```
64
+ """
65
+ return isinstance(tp, _TYPE_ALIAS_TYPES)
66
+
67
+
39
68
  # Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]]
40
69
  def strip_annotated_type(typ: type) -> type:
41
70
  if is_required_type(typ) or is_annotated_type(typ):
payi/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "payi"
4
- __version__ = "0.1.0-alpha.32" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.34" # x-release-please-version
payi/lib/helpers.py CHANGED
@@ -2,13 +2,13 @@
2
2
  from typing import Dict, List, Union
3
3
 
4
4
 
5
- def create_budget_header_from_ids(budget_ids: List[str]) -> Dict[str, str]:
6
- if not isinstance(budget_ids, list): # type: ignore
7
- raise TypeError("budget_ids must be a list")
5
+ def create_limit_header_from_ids(limit_ids: List[str]) -> Dict[str, str]:
6
+ if not isinstance(budglimit_idset_ids, list): # type: ignore
7
+ raise TypeError("limit_ids must be a list")
8
8
 
9
- valid_ids = [id.strip() for id in budget_ids if isinstance(id, str) and id.strip()] # type: ignore
9
+ valid_ids = [id.strip() for id in limit_ids if isinstance(id, str) and id.strip()] # type: ignore
10
10
 
11
- return {"xProxy-Budget-IDs": ",".join(valid_ids)} if valid_ids else {}
11
+ return {"xProxy-Limit-IDs": ",".join(valid_ids)} if valid_ids else {}
12
12
 
13
13
  def create_request_header_from_tags(request_tags: List[str]) -> Dict[str, str]:
14
14
  if not isinstance(request_tags, list): # type: ignore
@@ -19,15 +19,15 @@ def create_request_header_from_tags(request_tags: List[str]) -> Dict[str, str]:
19
19
  return {"xProxy-Request-Tags": ",".join(valid_tags)} if valid_tags else {}
20
20
 
21
21
  def create_headers(
22
- budget_ids: Union[List[str], None] = None,
22
+ limit_ids: Union[List[str], None] = None,
23
23
  request_tags: Union[List[str], None] = None,
24
24
  user_id: Union[str, None] = None,
25
25
  experience_id: Union[str, None] = None,
26
26
  ) -> Dict[str, str]:
27
27
  headers: Dict[str, str] = {}
28
28
 
29
- if budget_ids:
30
- headers.update(create_budget_header_from_ids(budget_ids))
29
+ if limit_ids:
30
+ headers.update(create_limit_header_from_ids(limit_ids))
31
31
  if request_tags:
32
32
  headers.update(create_request_header_from_tags(request_tags))
33
33
  if user_id:
@@ -8,13 +8,13 @@ from .ingest import (
8
8
  IngestResourceWithStreamingResponse,
9
9
  AsyncIngestResourceWithStreamingResponse,
10
10
  )
11
- from .budgets import (
12
- BudgetsResource,
13
- AsyncBudgetsResource,
14
- BudgetsResourceWithRawResponse,
15
- AsyncBudgetsResourceWithRawResponse,
16
- BudgetsResourceWithStreamingResponse,
17
- AsyncBudgetsResourceWithStreamingResponse,
11
+ from .limits import (
12
+ LimitsResource,
13
+ AsyncLimitsResource,
14
+ LimitsResourceWithRawResponse,
15
+ AsyncLimitsResourceWithRawResponse,
16
+ LimitsResourceWithStreamingResponse,
17
+ AsyncLimitsResourceWithStreamingResponse,
18
18
  )
19
19
  from .requests import (
20
20
  RequestsResource,
@@ -58,12 +58,12 @@ from .price_modifiers import (
58
58
  )
59
59
 
60
60
  __all__ = [
61
- "BudgetsResource",
62
- "AsyncBudgetsResource",
63
- "BudgetsResourceWithRawResponse",
64
- "AsyncBudgetsResourceWithRawResponse",
65
- "BudgetsResourceWithStreamingResponse",
66
- "AsyncBudgetsResourceWithStreamingResponse",
61
+ "LimitsResource",
62
+ "AsyncLimitsResource",
63
+ "LimitsResourceWithRawResponse",
64
+ "AsyncLimitsResourceWithRawResponse",
65
+ "LimitsResourceWithStreamingResponse",
66
+ "AsyncLimitsResourceWithStreamingResponse",
67
67
  "IngestResource",
68
68
  "AsyncIngestResource",
69
69
  "IngestResourceWithRawResponse",
@@ -52,7 +52,7 @@ class BillingModelsResource(SyncAPIResource):
52
52
  self,
53
53
  *,
54
54
  name: str,
55
- type: Literal["invalid", "costplus", "subscription", "hybrid"],
55
+ type: Literal["costplus", "subscription", "hybrid"],
56
56
  default_price_modifier: Optional[float] | NotGiven = NOT_GIVEN,
57
57
  prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
58
58
  prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
@@ -128,7 +128,7 @@ class BillingModelsResource(SyncAPIResource):
128
128
  self,
129
129
  billing_model_id: str,
130
130
  *,
131
- type: Literal["invalid", "costplus", "subscription", "hybrid"],
131
+ type: Literal["costplus", "subscription", "hybrid"],
132
132
  default_price_modifier: Optional[float] | NotGiven = NOT_GIVEN,
133
133
  name: Optional[str] | NotGiven = NOT_GIVEN,
134
134
  prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
@@ -246,7 +246,7 @@ class AsyncBillingModelsResource(AsyncAPIResource):
246
246
  self,
247
247
  *,
248
248
  name: str,
249
- type: Literal["invalid", "costplus", "subscription", "hybrid"],
249
+ type: Literal["costplus", "subscription", "hybrid"],
250
250
  default_price_modifier: Optional[float] | NotGiven = NOT_GIVEN,
251
251
  prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
252
252
  prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
@@ -322,7 +322,7 @@ class AsyncBillingModelsResource(AsyncAPIResource):
322
322
  self,
323
323
  billing_model_id: str,
324
324
  *,
325
- type: Literal["invalid", "costplus", "subscription", "hybrid"],
325
+ type: Literal["costplus", "subscription", "hybrid"],
326
326
  default_price_modifier: Optional[float] | NotGiven = NOT_GIVEN,
327
327
  name: Optional[str] | NotGiven = NOT_GIVEN,
328
328
  prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, Optional
5
+ from typing import Dict
6
6
 
7
7
  import httpx
8
8
 
@@ -50,7 +50,7 @@ class PropertiesResource(SyncAPIResource):
50
50
  self,
51
51
  experience_id: str,
52
52
  *,
53
- properties: Optional[Dict[str, str]],
53
+ properties: Dict[str, str],
54
54
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
55
55
  # The extra values given here take precedence over values defined on the client or passed to this method.
56
56
  extra_headers: Headers | None = None,
@@ -106,7 +106,7 @@ class AsyncPropertiesResource(AsyncAPIResource):
106
106
  self,
107
107
  experience_id: str,
108
108
  *,
109
- properties: Optional[Dict[str, str]],
109
+ properties: Dict[str, str],
110
110
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
111
111
  # The extra values given here take precedence over values defined on the client or passed to this method.
112
112
  extra_headers: Headers | None = None,
payi/resources/ingest.py CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, Union, Iterable, Optional
5
+ from typing import Dict, List, Union, Iterable, Optional
6
6
  from datetime import datetime
7
7
 
8
8
  import httpx
@@ -93,10 +93,17 @@ class IngestResource(SyncAPIResource):
93
93
  units: Dict[str, ingest_units_params.Units],
94
94
  end_to_end_latency_ms: Optional[int] | NotGiven = NOT_GIVEN,
95
95
  event_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
96
+ experience_properties: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
96
97
  http_status_code: Optional[int] | NotGiven = NOT_GIVEN,
98
+ properties: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
99
+ provider_prompt: Optional[str] | NotGiven = NOT_GIVEN,
100
+ provider_request_headers: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN,
101
+ provider_response: Optional[List[str]] | NotGiven = NOT_GIVEN,
102
+ provider_response_headers: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN,
103
+ provider_uri: Optional[str] | NotGiven = NOT_GIVEN,
97
104
  provisioned_resource_name: Optional[str] | NotGiven = NOT_GIVEN,
98
105
  time_to_first_token_ms: Optional[int] | NotGiven = NOT_GIVEN,
99
- budget_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
106
+ limit_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
100
107
  request_tags: Union[list[str], None] | NotGiven = NOT_GIVEN,
101
108
  experience_id: Union[str, None] | NotGiven = NOT_GIVEN,
102
109
  experience_name: Union[str, None] | NotGiven = NOT_GIVEN,
@@ -122,7 +129,7 @@ class IngestResource(SyncAPIResource):
122
129
 
123
130
  event_timestamp: (str, datetime, None): The timestamp of the event. Defaults to None.
124
131
 
125
- budget_ids (list[str], optional): The budget IDs to associate with the request. Defaults to None.
132
+ limit_ids (list[str], optional): The limit IDs to associate with the request. Defaults to None.
126
133
 
127
134
  request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
128
135
 
@@ -143,13 +150,13 @@ class IngestResource(SyncAPIResource):
143
150
  valid_ids_str: str | NotGiven = NOT_GIVEN
144
151
  valid_tags_str: str | NotGiven = NOT_GIVEN
145
152
 
146
- if budget_ids is None or isinstance(budget_ids, NotGiven):
153
+ if limit_ids is None or isinstance(limit_ids, NotGiven):
147
154
  valid_ids_str = NOT_GIVEN
148
- elif not isinstance(budget_ids, list): # type: ignore
149
- raise TypeError("budget_ids must be a list")
155
+ elif not isinstance(limit_ids, list): # type: ignore
156
+ raise TypeError("limit_ids must be a list")
150
157
  else:
151
- # Proceed with the list comprehension if budget_ids is not NotGiven
152
- valid_ids = [id.strip() for id in budget_ids if id.strip()]
158
+ # Proceed with the list comprehension if limit_ids is not NotGiven
159
+ valid_ids = [id.strip() for id in limit_ids if id.strip()]
153
160
  valid_ids_str = ",".join(valid_ids) if valid_ids else NOT_GIVEN
154
161
 
155
162
  if request_tags is None or isinstance(request_tags, NotGiven):
@@ -157,7 +164,7 @@ class IngestResource(SyncAPIResource):
157
164
  elif not isinstance(request_tags, list): # type: ignore
158
165
  raise TypeError("request_tags must be a list")
159
166
  else:
160
- # Proceed with the list comprehension if budget_ids is not NotGiven
167
+ # Proceed with the list comprehension if request_tags is not NotGiven
161
168
  valid_tags = [tag.strip() for tag in request_tags if tag.strip()]
162
169
  valid_tags_str = ",".join(valid_tags) if valid_tags else NOT_GIVEN
163
170
 
@@ -173,7 +180,7 @@ class IngestResource(SyncAPIResource):
173
180
  extra_headers = {
174
181
  **strip_not_given(
175
182
  {
176
- "xProxy-Budget-IDs": valid_ids_str,
183
+ "xProxy-Limit-IDs": valid_ids_str,
177
184
  "xProxy-Request-Tags": valid_tags_str,
178
185
  "xProxy-Experience-Id": experience_id,
179
186
  "xProxy-Experience-Name": experience_name,
@@ -191,7 +198,14 @@ class IngestResource(SyncAPIResource):
191
198
  "units": units,
192
199
  "end_to_end_latency_ms": end_to_end_latency_ms,
193
200
  "event_timestamp": event_timestamp,
201
+ "experience_properties": experience_properties,
194
202
  "http_status_code": http_status_code,
203
+ "properties": properties,
204
+ "provider_prompt": provider_prompt,
205
+ "provider_request_headers": provider_request_headers,
206
+ "provider_response": provider_response,
207
+ "provider_response_headers": provider_response_headers,
208
+ "provider_uri": provider_uri,
195
209
  "provisioned_resource_name": provisioned_resource_name,
196
210
  "time_to_first_token_ms": time_to_first_token_ms,
197
211
  },
@@ -266,10 +280,17 @@ class AsyncIngestResource(AsyncAPIResource):
266
280
  units: Dict[str, ingest_units_params.Units],
267
281
  end_to_end_latency_ms: Optional[int] | NotGiven = NOT_GIVEN,
268
282
  event_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
283
+ experience_properties: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
269
284
  http_status_code: Optional[int] | NotGiven = NOT_GIVEN,
285
+ properties: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
286
+ provider_prompt: Optional[str] | NotGiven = NOT_GIVEN,
287
+ provider_request_headers: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN,
288
+ provider_response: Optional[List[str]] | NotGiven = NOT_GIVEN,
289
+ provider_response_headers: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN,
290
+ provider_uri: Optional[str] | NotGiven = NOT_GIVEN,
270
291
  provisioned_resource_name: Optional[str] | NotGiven = NOT_GIVEN,
271
292
  time_to_first_token_ms: Optional[int] | NotGiven = NOT_GIVEN,
272
- budget_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
293
+ limit_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
273
294
  request_tags: Union[list[str], None] | NotGiven = NOT_GIVEN,
274
295
  experience_name: Union[str, None] | NotGiven = NOT_GIVEN,
275
296
  experience_id: Union[str, None] | NotGiven = NOT_GIVEN,
@@ -294,7 +315,7 @@ class AsyncIngestResource(AsyncAPIResource):
294
315
 
295
316
  event_timestamp: (datetime, None): The timestamp of the event. Defaults to None.
296
317
 
297
- budget_ids (list[str], optional): The budget IDs to associate with the request. Defaults to None.
318
+ limit_ids (list[str], optional): The limit IDs to associate with the request. Defaults to None.
298
319
 
299
320
  request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
300
321
 
@@ -315,13 +336,13 @@ class AsyncIngestResource(AsyncAPIResource):
315
336
  valid_ids_str: str | NotGiven = NOT_GIVEN
316
337
  valid_tags_str: str | NotGiven = NOT_GIVEN
317
338
 
318
- if budget_ids is None or isinstance(budget_ids, NotGiven):
339
+ if limit_ids is None or isinstance(limit_ids, NotGiven):
319
340
  valid_ids_str = NOT_GIVEN
320
- elif not isinstance(budget_ids, list): # type: ignore
321
- raise TypeError("budget_ids must be a list")
341
+ elif not isinstance(limit_ids, list): # type: ignore
342
+ raise TypeError("limit_ids must be a list")
322
343
  else:
323
- # Proceed with the list comprehension if budget_ids is not NotGiven
324
- valid_ids = [id.strip() for id in budget_ids if id.strip()]
344
+ # Proceed with the list comprehension if limit_ids is not NotGiven
345
+ valid_ids = [id.strip() for id in limit_ids if id.strip()]
325
346
  valid_ids_str = ",".join(valid_ids) if valid_ids else NOT_GIVEN
326
347
 
327
348
  if request_tags is None or isinstance(request_tags, NotGiven):
@@ -329,7 +350,7 @@ class AsyncIngestResource(AsyncAPIResource):
329
350
  elif not isinstance(request_tags, list): # type: ignore
330
351
  raise TypeError("request_tags must be a list")
331
352
  else:
332
- # Proceed with the list comprehension if budget_ids is not NotGiven
353
+ # Proceed with the list comprehension if request_tags is not NotGiven
333
354
  valid_tags = [tag.strip() for tag in request_tags if tag.strip()]
334
355
  valid_tags_str = ",".join(valid_tags) if valid_tags else NOT_GIVEN
335
356
 
@@ -345,7 +366,7 @@ class AsyncIngestResource(AsyncAPIResource):
345
366
  extra_headers = {
346
367
  **strip_not_given(
347
368
  {
348
- "xProxy-Budget-IDs": valid_ids_str,
369
+ "xProxy-Limit-IDs": valid_ids_str,
349
370
  "xProxy-Request-Tags": valid_tags_str,
350
371
  "xProxy-Experience-Name": experience_name,
351
372
  "xProxy-Experience-Id": experience_id,
@@ -363,7 +384,14 @@ class AsyncIngestResource(AsyncAPIResource):
363
384
  "units": units,
364
385
  "end_to_end_latency_ms": end_to_end_latency_ms,
365
386
  "event_timestamp": event_timestamp,
387
+ "experience_properties": experience_properties,
366
388
  "http_status_code": http_status_code,
389
+ "properties": properties,
390
+ "provider_prompt": provider_prompt,
391
+ "provider_request_headers": provider_request_headers,
392
+ "provider_response": provider_response,
393
+ "provider_response_headers": provider_response_headers,
394
+ "provider_uri": provider_uri,
367
395
  "provisioned_resource_name": provisioned_resource_name,
368
396
  "time_to_first_token_ms": time_to_first_token_ms,
369
397
  },