payi 0.1.0a33__py3-none-any.whl → 0.1.0a35__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/_base_client.py +6 -0
  2. payi/_client.py +9 -9
  3. payi/_models.py +5 -1
  4. payi/_version.py +1 -1
  5. payi/lib/helpers.py +11 -8
  6. payi/resources/__init__.py +13 -13
  7. payi/resources/billing_models.py +4 -4
  8. payi/resources/experiences/__init__.py +0 -14
  9. payi/resources/experiences/experiences.py +0 -32
  10. payi/resources/experiences/properties.py +5 -5
  11. payi/resources/ingest.py +49 -23
  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 +5 -5
  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/__init__.py +0 -2
  22. payi/types/experiences/property_create_params.py +2 -2
  23. payi/types/ingest_event_param.py +29 -5
  24. payi/types/ingest_response.py +7 -7
  25. payi/types/ingest_units_params.py +28 -4
  26. payi/types/{budget_create_params.py → limit_create_params.py} +7 -9
  27. payi/types/limit_history_response.py +34 -0
  28. payi/types/{budget_list_params.py → limit_list_params.py} +3 -3
  29. payi/types/limit_reset_params.py +16 -0
  30. payi/types/{budget_response.py → limit_response.py} +11 -13
  31. payi/types/{budget_update_params.py → limit_update_params.py} +3 -3
  32. payi/types/{budgets → limits}/__init__.py +1 -1
  33. payi/types/{budgets/budget_tags.py → limits/limit_tags.py} +2 -2
  34. payi/types/{budgets → limits}/tag_create_params.py +1 -1
  35. payi/types/{budgets → limits}/tag_create_response.py +2 -2
  36. payi/types/{budgets → limits}/tag_delete_response.py +2 -2
  37. payi/types/{budgets → limits}/tag_list_response.py +2 -2
  38. payi/types/{budgets → limits}/tag_remove_params.py +1 -1
  39. payi/types/{budgets → limits}/tag_remove_response.py +2 -2
  40. payi/types/{budgets → limits}/tag_update_params.py +1 -1
  41. payi/types/{budgets → limits}/tag_update_response.py +2 -2
  42. payi/types/{paged_budget_list.py → paged_limit_list.py} +9 -11
  43. payi/types/requests/property_create_params.py +2 -2
  44. payi/types/shared/__init__.py +3 -0
  45. payi/types/{experiences/csat_response.py → shared/evaluation_response.py} +3 -2
  46. {payi-0.1.0a33.dist-info → payi-0.1.0a35.dist-info}/METADATA +22 -23
  47. {payi-0.1.0a33.dist-info → payi-0.1.0a35.dist-info}/RECORD +49 -49
  48. {payi-0.1.0a33.dist-info → payi-0.1.0a35.dist-info}/licenses/LICENSE +1 -1
  49. payi/resources/experiences/csat.py +0 -188
  50. payi/types/budget_history_response.py +0 -38
  51. payi/types/experiences/csat_create_params.py +0 -14
  52. {payi-0.1.0a33.dist-info → payi-0.1.0a35.dist-info}/WHEEL +0 -0
@@ -2,13 +2,13 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, Union, Optional
5
+ from typing import Dict, List, Union, Iterable, Optional
6
6
  from datetime import datetime
7
7
  from typing_extensions import Required, Annotated, TypedDict
8
8
 
9
9
  from .._utils import PropertyInfo
10
10
 
11
- __all__ = ["IngestUnitsParams", "Units"]
11
+ __all__ = ["IngestUnitsParams", "Units", "ProviderRequestHeader", "ProviderResponseHeader"]
12
12
 
13
13
 
14
14
  class IngestUnitsParams(TypedDict, total=False):
@@ -22,13 +22,25 @@ class IngestUnitsParams(TypedDict, total=False):
22
22
 
23
23
  event_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
24
24
 
25
+ experience_properties: Optional[Dict[str, str]]
26
+
25
27
  http_status_code: Optional[int]
26
28
 
27
- provisioned_resource_name: Optional[str]
29
+ properties: Optional[Dict[str, str]]
30
+
31
+ provider_request_headers: Optional[Iterable[ProviderRequestHeader]]
32
+
33
+ provider_request_json: Optional[str]
34
+
35
+ provider_response_headers: Optional[Iterable[ProviderResponseHeader]]
36
+
37
+ provider_response_json: Union[str, List[str], None]
38
+
39
+ provider_uri: Optional[str]
28
40
 
29
41
  time_to_first_token_ms: Optional[int]
30
42
 
31
- budget_ids: Annotated[Union[list[str], None], PropertyInfo(alias="xProxy-Budget-IDs")]
43
+ limit_ids: Annotated[Union[list[str], None], PropertyInfo(alias="xProxy-Limit-IDs")]
32
44
 
33
45
  request_tags: Annotated[Union[list[str], None], PropertyInfo(alias="xProxy-Request-Tags")]
34
46
 
@@ -42,3 +54,15 @@ class Units(TypedDict, total=False):
42
54
  input: int
43
55
 
44
56
  output: int
57
+
58
+
59
+ class ProviderRequestHeader(TypedDict, total=False):
60
+ name: Required[str]
61
+
62
+ value: Optional[str]
63
+
64
+
65
+ class ProviderResponseHeader(TypedDict, total=False):
66
+ name: Required[str]
67
+
68
+ value: Optional[str]
@@ -5,24 +5,22 @@ from __future__ import annotations
5
5
  from typing import List, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
- __all__ = ["BudgetCreateParams"]
8
+ __all__ = ["LimitCreateParams"]
9
9
 
10
10
 
11
- class BudgetCreateParams(TypedDict, total=False):
12
- budget_name: Required[str]
11
+ class LimitCreateParams(TypedDict, total=False):
12
+ limit_name: Required[str]
13
13
 
14
14
  max: Required[float]
15
15
 
16
- base_cost_estimate: Literal["max"]
17
-
18
16
  billing_model_id: Optional[str]
19
17
 
20
- budget_response_type: Literal["block", "allow"]
21
-
22
- budget_tags: Optional[List[str]]
23
-
24
18
  cost_basis: Literal["base", "billed"]
25
19
 
26
20
  currency: Literal["usd"]
27
21
 
22
+ limit_tags: Optional[List[str]]
23
+
24
+ limit_type: Literal["block", "allow"]
25
+
28
26
  threshold: Optional[float]
@@ -0,0 +1,34 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+ from datetime import datetime
5
+ from typing_extensions import Literal
6
+
7
+ from .._models import BaseModel
8
+ from .total_cost_data import TotalCostData
9
+
10
+ __all__ = ["LimitHistoryResponse", "LimitHistory"]
11
+
12
+
13
+ class LimitHistory(BaseModel):
14
+ limit_name: Optional[str] = None
15
+
16
+ limit_id: Optional[str] = None
17
+
18
+ limit_reset_timestamp: Optional[datetime] = None
19
+
20
+ limit_tags: Optional[List[str]] = None
21
+
22
+ limit_type: Optional[Literal["block", "allow"]] = None
23
+
24
+ max: Optional[float] = None
25
+
26
+ totals: Optional[TotalCostData] = None
27
+
28
+
29
+ class LimitHistoryResponse(BaseModel):
30
+ limit_history: LimitHistory
31
+
32
+ request_id: str
33
+
34
+ message: Optional[str] = None
@@ -4,11 +4,11 @@ from __future__ import annotations
4
4
 
5
5
  from typing_extensions import TypedDict
6
6
 
7
- __all__ = ["BudgetListParams"]
7
+ __all__ = ["LimitListParams"]
8
8
 
9
9
 
10
- class BudgetListParams(TypedDict, total=False):
11
- budget_name: str
10
+ class LimitListParams(TypedDict, total=False):
11
+ limit_name: str
12
12
 
13
13
  page_number: int
14
14
 
@@ -0,0 +1,16 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Union
6
+ from datetime import datetime
7
+ from typing_extensions import Annotated, TypedDict
8
+
9
+ from .._utils import PropertyInfo
10
+
11
+ __all__ = ["LimitResetParams"]
12
+
13
+
14
+ class LimitResetParams(TypedDict, total=False):
15
+ reset_date: Annotated[Union[str, datetime], PropertyInfo(alias="resetDate", format="iso8601")]
16
+ """Effective reset date"""
@@ -7,35 +7,33 @@ from typing_extensions import Literal
7
7
  from .._models import BaseModel
8
8
  from .total_cost_data import TotalCostData
9
9
 
10
- __all__ = ["BudgetResponse", "Budget"]
10
+ __all__ = ["LimitResponse", "Limit"]
11
11
 
12
12
 
13
- class Budget(BaseModel):
14
- base_cost_estimate: Literal["max"]
15
-
16
- budget_creation_timestamp: datetime
13
+ class Limit(BaseModel):
14
+ currency: Literal["usd"]
17
15
 
18
- budget_id: str
16
+ limit_creation_timestamp: datetime
19
17
 
20
- budget_name: str
18
+ limit_id: str
21
19
 
22
- budget_response_type: Literal["block", "allow"]
20
+ limit_name: str
23
21
 
24
- budget_update_timestamp: datetime
22
+ limit_type: Literal["block", "allow"]
25
23
 
26
- currency: Literal["usd"]
24
+ limit_update_timestamp: datetime
27
25
 
28
26
  max: float
29
27
 
30
28
  totals: TotalCostData
31
29
 
32
- budget_tags: Optional[List[str]] = None
30
+ limit_tags: Optional[List[str]] = None
33
31
 
34
32
  threshold: Optional[float] = None
35
33
 
36
34
 
37
- class BudgetResponse(BaseModel):
38
- budget: Budget
35
+ class LimitResponse(BaseModel):
36
+ limit: Limit
39
37
 
40
38
  request_id: str
41
39
 
@@ -5,10 +5,10 @@ from __future__ import annotations
5
5
  from typing import Optional
6
6
  from typing_extensions import TypedDict
7
7
 
8
- __all__ = ["BudgetUpdateParams"]
8
+ __all__ = ["LimitUpdateParams"]
9
9
 
10
10
 
11
- class BudgetUpdateParams(TypedDict, total=False):
12
- budget_name: Optional[str]
11
+ class LimitUpdateParams(TypedDict, total=False):
12
+ limit_name: Optional[str]
13
13
 
14
14
  max: Optional[float]
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from .budget_tags import BudgetTags as BudgetTags
5
+ from .limit_tags import LimitTags as LimitTags
6
6
  from .tag_create_params import TagCreateParams as TagCreateParams
7
7
  from .tag_list_response import TagListResponse as TagListResponse
8
8
  from .tag_remove_params import TagRemoveParams as TagRemoveParams
@@ -5,10 +5,10 @@ from datetime import datetime
5
5
 
6
6
  from ..._models import BaseModel
7
7
 
8
- __all__ = ["BudgetTags"]
8
+ __all__ = ["LimitTags"]
9
9
 
10
10
 
11
- class BudgetTags(BaseModel):
11
+ class LimitTags(BaseModel):
12
12
  created_on: Optional[datetime] = None
13
13
 
14
14
  tag_id: Optional[int] = None
@@ -9,4 +9,4 @@ __all__ = ["TagCreateParams"]
9
9
 
10
10
 
11
11
  class TagCreateParams(TypedDict, total=False):
12
- budget_tags: Required[List[str]]
12
+ limit_tags: Required[List[str]]
@@ -3,8 +3,8 @@
3
3
  from typing import List
4
4
  from typing_extensions import TypeAlias
5
5
 
6
- from .budget_tags import BudgetTags
6
+ from .limit_tags import LimitTags
7
7
 
8
8
  __all__ = ["TagCreateResponse"]
9
9
 
10
- TagCreateResponse: TypeAlias = List[BudgetTags]
10
+ TagCreateResponse: TypeAlias = List[LimitTags]
@@ -3,8 +3,8 @@
3
3
  from typing import List
4
4
  from typing_extensions import TypeAlias
5
5
 
6
- from .budget_tags import BudgetTags
6
+ from .limit_tags import LimitTags
7
7
 
8
8
  __all__ = ["TagDeleteResponse"]
9
9
 
10
- TagDeleteResponse: TypeAlias = List[BudgetTags]
10
+ TagDeleteResponse: TypeAlias = List[LimitTags]
@@ -3,8 +3,8 @@
3
3
  from typing import List
4
4
  from typing_extensions import TypeAlias
5
5
 
6
- from .budget_tags import BudgetTags
6
+ from .limit_tags import LimitTags
7
7
 
8
8
  __all__ = ["TagListResponse"]
9
9
 
10
- TagListResponse: TypeAlias = List[BudgetTags]
10
+ TagListResponse: TypeAlias = List[LimitTags]
@@ -9,4 +9,4 @@ __all__ = ["TagRemoveParams"]
9
9
 
10
10
 
11
11
  class TagRemoveParams(TypedDict, total=False):
12
- budget_tags: Required[List[str]]
12
+ limit_tags: Required[List[str]]
@@ -3,8 +3,8 @@
3
3
  from typing import List
4
4
  from typing_extensions import TypeAlias
5
5
 
6
- from .budget_tags import BudgetTags
6
+ from .limit_tags import LimitTags
7
7
 
8
8
  __all__ = ["TagRemoveResponse"]
9
9
 
10
- TagRemoveResponse: TypeAlias = List[BudgetTags]
10
+ TagRemoveResponse: TypeAlias = List[LimitTags]
@@ -9,4 +9,4 @@ __all__ = ["TagUpdateParams"]
9
9
 
10
10
 
11
11
  class TagUpdateParams(TypedDict, total=False):
12
- budget_tags: Required[List[str]]
12
+ limit_tags: Required[List[str]]
@@ -3,8 +3,8 @@
3
3
  from typing import List
4
4
  from typing_extensions import TypeAlias
5
5
 
6
- from .budget_tags import BudgetTags
6
+ from .limit_tags import LimitTags
7
7
 
8
8
  __all__ = ["TagUpdateResponse"]
9
9
 
10
- TagUpdateResponse: TypeAlias = List[BudgetTags]
10
+ TagUpdateResponse: TypeAlias = List[LimitTags]
@@ -9,34 +9,32 @@ from pydantic import Field as FieldInfo
9
9
  from .._models import BaseModel
10
10
  from .total_cost_data import TotalCostData
11
11
 
12
- __all__ = ["PagedBudgetList", "Item"]
12
+ __all__ = ["PagedLimitList", "Item"]
13
13
 
14
14
 
15
15
  class Item(BaseModel):
16
- base_cost_estimate: Literal["max"]
17
-
18
- budget_creation_timestamp: datetime
16
+ currency: Literal["usd"]
19
17
 
20
- budget_id: str
18
+ limit_creation_timestamp: datetime
21
19
 
22
- budget_name: str
20
+ limit_id: str
23
21
 
24
- budget_response_type: Literal["block", "allow"]
22
+ limit_name: str
25
23
 
26
- budget_update_timestamp: datetime
24
+ limit_type: Literal["block", "allow"]
27
25
 
28
- currency: Literal["usd"]
26
+ limit_update_timestamp: datetime
29
27
 
30
28
  max: float
31
29
 
32
30
  totals: TotalCostData
33
31
 
34
- budget_tags: Optional[List[str]] = None
32
+ limit_tags: Optional[List[str]] = None
35
33
 
36
34
  threshold: Optional[float] = None
37
35
 
38
36
 
39
- class PagedBudgetList(BaseModel):
37
+ class PagedLimitList(BaseModel):
40
38
  current_page: Optional[int] = FieldInfo(alias="currentPage", default=None)
41
39
 
42
40
  has_next_page: Optional[bool] = FieldInfo(alias="hasNextPage", default=None)
@@ -2,11 +2,11 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, Optional
5
+ from typing import Dict
6
6
  from typing_extensions import Required, TypedDict
7
7
 
8
8
  __all__ = ["PropertyCreateParams"]
9
9
 
10
10
 
11
11
  class PropertyCreateParams(TypedDict, total=False):
12
- properties: Required[Optional[Dict[str, str]]]
12
+ properties: Required[Dict[str, str]]
@@ -0,0 +1,3 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .evaluation_response import EvaluationResponse as EvaluationResponse
@@ -1,10 +1,11 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
 
4
+
4
5
  from ..._models import BaseModel
5
6
 
6
- __all__ = ["CsatResponse"]
7
+ __all__ = ["EvaluationResponse"]
7
8
 
8
9
 
9
- class CsatResponse(BaseModel):
10
+ class EvaluationResponse(BaseModel):
10
11
  request_id: str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: payi
3
- Version: 0.1.0a33
3
+ Version: 0.1.0a35
4
4
  Summary: The official Python library for the payi API
5
5
  Project-URL: Homepage, https://github.com/Pay-i/pay-i-python
6
6
  Project-URL: Repository, https://github.com/Pay-i/pay-i-python
@@ -63,11 +63,11 @@ client = Payi(
63
63
  api_key=os.environ.get("PAYI_API_KEY"), # This is the default and can be omitted
64
64
  )
65
65
 
66
- budget_response = client.budgets.create(
67
- budget_name="x",
66
+ limit_response = client.limits.create(
67
+ limit_name="x",
68
68
  max=0,
69
69
  )
70
- print(budget_response.request_id)
70
+ print(limit_response.request_id)
71
71
  ```
72
72
 
73
73
  While you can provide an `api_key` keyword argument,
@@ -90,11 +90,11 @@ client = AsyncPayi(
90
90
 
91
91
 
92
92
  async def main() -> None:
93
- budget_response = await client.budgets.create(
94
- budget_name="x",
93
+ limit_response = await client.limits.create(
94
+ limit_name="x",
95
95
  max=0,
96
96
  )
97
- print(budget_response.request_id)
97
+ print(limit_response.request_id)
98
98
 
99
99
 
100
100
  asyncio.run(main())
@@ -127,8 +127,8 @@ from payi import Payi
127
127
  client = Payi()
128
128
 
129
129
  try:
130
- client.budgets.create(
131
- budget_name="x",
130
+ client.limits.create(
131
+ limit_name="x",
132
132
  max=0,
133
133
  )
134
134
  except payi.APIConnectionError as e:
@@ -142,7 +142,7 @@ except payi.APIStatusError as e:
142
142
  print(e.response)
143
143
  ```
144
144
 
145
- Error codes are as followed:
145
+ Error codes are as follows:
146
146
 
147
147
  | Status Code | Error Type |
148
148
  | ----------- | -------------------------- |
@@ -173,8 +173,8 @@ client = Payi(
173
173
  )
174
174
 
175
175
  # Or, configure per-request:
176
- client.with_options(max_retries=5).budgets.create(
177
- budget_name="x",
176
+ client.with_options(max_retries=5).limits.create(
177
+ limit_name="x",
178
178
  max=0,
179
179
  )
180
180
  ```
@@ -199,8 +199,8 @@ client = Payi(
199
199
  )
200
200
 
201
201
  # Override per-request:
202
- client.with_options(timeout=5.0).budgets.create(
203
- budget_name="x",
202
+ client.with_options(timeout=5.0).limits.create(
203
+ limit_name="x",
204
204
  max=0,
205
205
  )
206
206
  ```
@@ -243,14 +243,14 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
243
243
  from payi import Payi
244
244
 
245
245
  client = Payi()
246
- response = client.budgets.with_raw_response.create(
247
- budget_name="x",
246
+ response = client.limits.with_raw_response.create(
247
+ limit_name="x",
248
248
  max=0,
249
249
  )
250
250
  print(response.headers.get('X-My-Header'))
251
251
 
252
- budget = response.parse() # get the object that `budgets.create()` would have returned
253
- print(budget.request_id)
252
+ limit = response.parse() # get the object that `limits.create()` would have returned
253
+ print(limit.request_id)
254
254
  ```
255
255
 
256
256
  These methods return an [`APIResponse`](https://github.com/Pay-i/pay-i-python/tree/main/src/payi/_response.py) object.
@@ -264,8 +264,8 @@ The above interface eagerly reads the full response body when you make the reque
264
264
  To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
265
265
 
266
266
  ```python
267
- with client.budgets.with_streaming_response.create(
268
- budget_name="x",
267
+ with client.limits.with_streaming_response.create(
268
+ limit_name="x",
269
269
  max=0,
270
270
  ) as response:
271
271
  print(response.headers.get("X-My-Header"))
@@ -285,8 +285,7 @@ If you need to access undocumented endpoints, params, or response properties, th
285
285
  #### Undocumented endpoints
286
286
 
287
287
  To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
288
- http verbs. Options on the client will be respected (such as retries) will be respected when making this
289
- request.
288
+ http verbs. Options on the client will be respected (such as retries) when making this request.
290
289
 
291
290
  ```py
292
291
  import httpx
@@ -358,7 +357,7 @@ with Payi() as client:
358
357
  This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
359
358
 
360
359
  1. Changes that only affect static types, without breaking runtime behavior.
361
- 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
360
+ 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
362
361
  3. Changes that we do not expect to impact the vast majority of users in practice.
363
362
 
364
363
  We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.