payi 0.1.0a12__tar.gz → 0.1.0a14__tar.gz

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 (111) hide show
  1. payi-0.1.0a14/.release-please-manifest.json +3 -0
  2. {payi-0.1.0a12 → payi-0.1.0a14}/CHANGELOG.md +30 -0
  3. {payi-0.1.0a12 → payi-0.1.0a14}/PKG-INFO +8 -2
  4. {payi-0.1.0a12 → payi-0.1.0a14}/README.md +7 -1
  5. {payi-0.1.0a12 → payi-0.1.0a14}/api.md +37 -0
  6. payi-0.1.0a14/bin/check-release-environment +21 -0
  7. {payi-0.1.0a12 → payi-0.1.0a14}/pyproject.toml +1 -1
  8. {payi-0.1.0a12 → payi-0.1.0a14}/requirements-dev.lock +1 -1
  9. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_base_client.py +22 -12
  10. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_client.py +8 -0
  11. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_compat.py +3 -3
  12. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_models.py +17 -0
  13. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_version.py +1 -1
  14. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/resources/__init__.py +14 -0
  15. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/resources/budgets/budgets.py +13 -7
  16. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/resources/budgets/tags.py +1 -3
  17. payi-0.1.0a14/src/payi/resources/categories/__init__.py +33 -0
  18. payi-0.1.0a14/src/payi/resources/categories/categories.py +388 -0
  19. payi-0.1.0a14/src/payi/resources/categories/resources.py +450 -0
  20. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/resources/ingest.py +53 -18
  21. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/__init__.py +6 -0
  22. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budget_create_params.py +4 -0
  23. payi-0.1.0a14/src/payi/types/budget_history_response.py +61 -0
  24. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budget_response.py +19 -3
  25. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budget_update_params.py +4 -3
  26. payi-0.1.0a14/src/payi/types/categories/__init__.py +6 -0
  27. payi-0.1.0a14/src/payi/types/categories/resource_create_params.py +25 -0
  28. payi-0.1.0a14/src/payi/types/categories/resource_list_response.py +9 -0
  29. payi-0.1.0a14/src/payi/types/category_delete_resource_response.py +9 -0
  30. payi-0.1.0a14/src/payi/types/category_delete_response.py +9 -0
  31. payi-0.1.0a14/src/payi/types/category_list_resources_response.py +9 -0
  32. payi-0.1.0a14/src/payi/types/category_list_response.py +9 -0
  33. payi-0.1.0a14/src/payi/types/category_resource_response.py +24 -0
  34. payi-0.1.0a14/src/payi/types/category_response.py +15 -0
  35. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/ingest_units_params.py +6 -2
  36. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/paged_budget_list.py +19 -3
  37. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/requests_data.py +3 -7
  38. {payi-0.1.0a12 → payi-0.1.0a14}/tests/api_resources/budgets/test_tags.py +36 -36
  39. payi-0.1.0a14/tests/api_resources/categories/__init__.py +1 -0
  40. payi-0.1.0a14/tests/api_resources/categories/test_resources.py +492 -0
  41. {payi-0.1.0a12 → payi-0.1.0a14}/tests/api_resources/test_budgets.py +40 -44
  42. payi-0.1.0a14/tests/api_resources/test_categories.py +325 -0
  43. {payi-0.1.0a12 → payi-0.1.0a14}/tests/api_resources/test_ingest.py +19 -16
  44. payi-0.1.0a12/.release-please-manifest.json +0 -3
  45. payi-0.1.0a12/bin/check-release-environment +0 -32
  46. payi-0.1.0a12/src/payi/types/budget_history_response.py +0 -110
  47. {payi-0.1.0a12 → payi-0.1.0a14}/.gitignore +0 -0
  48. {payi-0.1.0a12 → payi-0.1.0a14}/CONTRIBUTING.md +0 -0
  49. {payi-0.1.0a12 → payi-0.1.0a14}/LICENSE +0 -0
  50. {payi-0.1.0a12 → payi-0.1.0a14}/SECURITY.md +0 -0
  51. {payi-0.1.0a12 → payi-0.1.0a14}/bin/publish-pypi +0 -0
  52. {payi-0.1.0a12 → payi-0.1.0a14}/examples/.keep +0 -0
  53. {payi-0.1.0a12 → payi-0.1.0a14}/mypy.ini +0 -0
  54. {payi-0.1.0a12 → payi-0.1.0a14}/noxfile.py +0 -0
  55. {payi-0.1.0a12 → payi-0.1.0a14}/release-please-config.json +0 -0
  56. {payi-0.1.0a12 → payi-0.1.0a14}/requirements.lock +0 -0
  57. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/__init__.py +0 -0
  58. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_constants.py +0 -0
  59. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_exceptions.py +0 -0
  60. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_files.py +0 -0
  61. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_qs.py +0 -0
  62. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_resource.py +0 -0
  63. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_response.py +0 -0
  64. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_streaming.py +0 -0
  65. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_types.py +0 -0
  66. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_utils/__init__.py +0 -0
  67. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_utils/_logs.py +0 -0
  68. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_utils/_proxy.py +0 -0
  69. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_utils/_reflection.py +0 -0
  70. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_utils/_streams.py +0 -0
  71. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_utils/_sync.py +0 -0
  72. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_utils/_transform.py +0 -0
  73. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_utils/_typing.py +0 -0
  74. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/_utils/_utils.py +0 -0
  75. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/lib/.keep +0 -0
  76. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/lib/helpers.py +0 -0
  77. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/py.typed +0 -0
  78. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/resources/budgets/__init__.py +0 -0
  79. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budget_list_params.py +0 -0
  80. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budgets/__init__.py +0 -0
  81. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budgets/budget_tags.py +0 -0
  82. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budgets/tag_create_params.py +0 -0
  83. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budgets/tag_create_response.py +0 -0
  84. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budgets/tag_delete_response.py +0 -0
  85. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budgets/tag_list_response.py +0 -0
  86. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budgets/tag_remove_params.py +0 -0
  87. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budgets/tag_remove_response.py +0 -0
  88. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budgets/tag_update_params.py +0 -0
  89. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/budgets/tag_update_response.py +0 -0
  90. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/cost_data.py +0 -0
  91. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/cost_details.py +0 -0
  92. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/default_response.py +0 -0
  93. {payi-0.1.0a12 → payi-0.1.0a14}/src/payi/types/proxy_result.py +0 -0
  94. {payi-0.1.0a12 → payi-0.1.0a14}/tests/__init__.py +0 -0
  95. {payi-0.1.0a12 → payi-0.1.0a14}/tests/api_resources/__init__.py +0 -0
  96. {payi-0.1.0a12 → payi-0.1.0a14}/tests/api_resources/budgets/__init__.py +0 -0
  97. {payi-0.1.0a12 → payi-0.1.0a14}/tests/conftest.py +0 -0
  98. {payi-0.1.0a12 → payi-0.1.0a14}/tests/sample_file.txt +0 -0
  99. {payi-0.1.0a12 → payi-0.1.0a14}/tests/test_client.py +0 -0
  100. {payi-0.1.0a12 → payi-0.1.0a14}/tests/test_deepcopy.py +0 -0
  101. {payi-0.1.0a12 → payi-0.1.0a14}/tests/test_extract_files.py +0 -0
  102. {payi-0.1.0a12 → payi-0.1.0a14}/tests/test_files.py +0 -0
  103. {payi-0.1.0a12 → payi-0.1.0a14}/tests/test_models.py +0 -0
  104. {payi-0.1.0a12 → payi-0.1.0a14}/tests/test_qs.py +0 -0
  105. {payi-0.1.0a12 → payi-0.1.0a14}/tests/test_required_args.py +0 -0
  106. {payi-0.1.0a12 → payi-0.1.0a14}/tests/test_response.py +0 -0
  107. {payi-0.1.0a12 → payi-0.1.0a14}/tests/test_streaming.py +0 -0
  108. {payi-0.1.0a12 → payi-0.1.0a14}/tests/test_transform.py +0 -0
  109. {payi-0.1.0a12 → payi-0.1.0a14}/tests/test_utils/test_proxy.py +0 -0
  110. {payi-0.1.0a12 → payi-0.1.0a14}/tests/test_utils/test_typing.py +0 -0
  111. {payi-0.1.0a12 → payi-0.1.0a14}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.0-alpha.14"
3
+ }
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.14 (2024-07-30)
4
+
5
+ Full Changelog: [v0.1.0-alpha.13...v0.1.0-alpha.14](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.13...v0.1.0-alpha.14)
6
+
7
+ ### Features
8
+
9
+ * **api:** update via SDK Studio ([#48](https://github.com/Pay-i/pay-i-python/issues/48)) ([5b67542](https://github.com/Pay-i/pay-i-python/commit/5b6754279d6b6dcb3b65bda1bf59b0d0092b4bec))
10
+ * **api:** update via SDK Studio ([#50](https://github.com/Pay-i/pay-i-python/issues/50)) ([91c7d2c](https://github.com/Pay-i/pay-i-python/commit/91c7d2c29430835dfee501520d8b247755e1679d))
11
+ * **api:** update via SDK Studio ([#57](https://github.com/Pay-i/pay-i-python/issues/57)) ([8d6ce22](https://github.com/Pay-i/pay-i-python/commit/8d6ce2229764aeaac2b0229cb70266545759cc7d))
12
+ * **api:** update via SDK Studio ([#58](https://github.com/Pay-i/pay-i-python/issues/58)) ([013389a](https://github.com/Pay-i/pay-i-python/commit/013389a52fc87312e7173c34c3f27256e52b7ed5))
13
+ * **api:** update via SDK Studio ([#59](https://github.com/Pay-i/pay-i-python/issues/59)) ([9f895e6](https://github.com/Pay-i/pay-i-python/commit/9f895e649a06a9000b1da8ab4a0b2fb779b09db9))
14
+
15
+
16
+ ### Chores
17
+
18
+ * **ci:** limit release doctor target branches ([#54](https://github.com/Pay-i/pay-i-python/issues/54)) ([926140e](https://github.com/Pay-i/pay-i-python/commit/926140e37dacca0b1e4ae481ed6fb839a154ad88))
19
+ * **docs:** document how to do per-request http client customization ([#53](https://github.com/Pay-i/pay-i-python/issues/53)) ([ea27182](https://github.com/Pay-i/pay-i-python/commit/ea271822df7ba59dc1cafc88e610b800a162c991))
20
+ * **internal:** add type construction helper ([#60](https://github.com/Pay-i/pay-i-python/issues/60)) ([65303cf](https://github.com/Pay-i/pay-i-python/commit/65303cf704602ece488a31e8a608be100279a1bc))
21
+ * **internal:** codegen related update ([#52](https://github.com/Pay-i/pay-i-python/issues/52)) ([4a469a0](https://github.com/Pay-i/pay-i-python/commit/4a469a0691431fe21ca111803ca6e256978cd21b))
22
+ * **internal:** refactor release doctor script ([#55](https://github.com/Pay-i/pay-i-python/issues/55)) ([b0a2707](https://github.com/Pay-i/pay-i-python/commit/b0a2707b711baa23ee4af9152b7a3f8558ac8d09))
23
+ * **tests:** update prism version ([#56](https://github.com/Pay-i/pay-i-python/issues/56)) ([df7370f](https://github.com/Pay-i/pay-i-python/commit/df7370f0aa1c8aa77e3091cb0b7c60238fb35ba0))
24
+
25
+ ## 0.1.0-alpha.13 (2024-07-11)
26
+
27
+ Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.12...v0.1.0-alpha.13)
28
+
29
+ ### Features
30
+
31
+ * **api:** update via SDK Studio ([#45](https://github.com/Pay-i/pay-i-python/issues/45)) ([8129c56](https://github.com/Pay-i/pay-i-python/commit/8129c56fe00cc676e56e8318533b98be3234cf8f))
32
+
3
33
  ## 0.1.0-alpha.12 (2024-07-08)
4
34
 
5
35
  Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.11...v0.1.0-alpha.12)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: payi
3
- Version: 0.1.0a12
3
+ Version: 0.1.0a14
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
@@ -44,7 +44,7 @@ It is generated with [Stainless](https://www.stainlessapi.com/).
44
44
 
45
45
  ## Documentation
46
46
 
47
- The REST API documentation can be found [on docs.payi.com](https://docs.payi.com). The full API of this library can be found in [api.md](https://github.com/Pay-i/pay-i-python/tree/main/api.md).
47
+ The REST API documentation can be found on [docs.payi.com](https://docs.payi.com). The full API of this library can be found in [api.md](https://github.com/Pay-i/pay-i-python/tree/main/api.md).
48
48
 
49
49
  ## Installation
50
50
 
@@ -334,6 +334,12 @@ client = Payi(
334
334
  )
335
335
  ```
336
336
 
337
+ You can also customize the client on a per-request basis by using `with_options()`:
338
+
339
+ ```python
340
+ client.with_options(http_client=DefaultHttpxClient(...))
341
+ ```
342
+
337
343
  ### Managing HTTP resources
338
344
 
339
345
  By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
@@ -10,7 +10,7 @@ It is generated with [Stainless](https://www.stainlessapi.com/).
10
10
 
11
11
  ## Documentation
12
12
 
13
- The REST API documentation can be found [on docs.payi.com](https://docs.payi.com). The full API of this library can be found in [api.md](api.md).
13
+ The REST API documentation can be found on [docs.payi.com](https://docs.payi.com). The full API of this library can be found in [api.md](api.md).
14
14
 
15
15
  ## Installation
16
16
 
@@ -300,6 +300,12 @@ client = Payi(
300
300
  )
301
301
  ```
302
302
 
303
+ You can also customize the client on a per-request basis by using `with_options()`:
304
+
305
+ ```python
306
+ client.with_options(http_client=DefaultHttpxClient(...))
307
+ ```
308
+
303
309
  ### Managing HTTP resources
304
310
 
305
311
  By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
@@ -57,3 +57,40 @@ from payi.types import ProxyResult
57
57
  Methods:
58
58
 
59
59
  - <code title="post /api/v1/ingest">client.ingest.<a href="./src/payi/resources/ingest.py">units</a>(\*\*<a href="src/payi/types/ingest_units_params.py">params</a>) -> <a href="./src/payi/types/proxy_result.py">ProxyResult</a></code>
60
+
61
+ # Categories
62
+
63
+ Types:
64
+
65
+ ```python
66
+ from payi.types import (
67
+ CategoryResourceResponse,
68
+ CategoryResponse,
69
+ CategoryListResponse,
70
+ CategoryDeleteResponse,
71
+ CategoryDeleteResourceResponse,
72
+ CategoryListResourcesResponse,
73
+ )
74
+ ```
75
+
76
+ Methods:
77
+
78
+ - <code title="get /api/v1/categories">client.categories.<a href="./src/payi/resources/categories/categories.py">list</a>() -> <a href="./src/payi/types/category_list_response.py">CategoryListResponse</a></code>
79
+ - <code title="delete /api/v1/categories/{category}">client.categories.<a href="./src/payi/resources/categories/categories.py">delete</a>(category) -> <a href="./src/payi/types/category_delete_response.py">CategoryDeleteResponse</a></code>
80
+ - <code title="delete /api/v1/categories/{category}/resources/{resource}">client.categories.<a href="./src/payi/resources/categories/categories.py">delete_resource</a>(resource, \*, category) -> <a href="./src/payi/types/category_delete_resource_response.py">CategoryDeleteResourceResponse</a></code>
81
+ - <code title="get /api/v1/categories/{category}/resources">client.categories.<a href="./src/payi/resources/categories/categories.py">list_resources</a>(category) -> <a href="./src/payi/types/category_list_resources_response.py">CategoryListResourcesResponse</a></code>
82
+
83
+ ## Resources
84
+
85
+ Types:
86
+
87
+ ```python
88
+ from payi.types.categories import ResourceListResponse
89
+ ```
90
+
91
+ Methods:
92
+
93
+ - <code title="post /api/v1/categories/{category}/resources/{resource}">client.categories.resources.<a href="./src/payi/resources/categories/resources.py">create</a>(resource, \*, category, \*\*<a href="src/payi/types/categories/resource_create_params.py">params</a>) -> <a href="./src/payi/types/category_resource_response.py">CategoryResourceResponse</a></code>
94
+ - <code title="get /api/v1/categories/{category}/resources/{resource}/{start_timestamp}">client.categories.resources.<a href="./src/payi/resources/categories/resources.py">retrieve</a>(start_timestamp, \*, category, resource) -> <a href="./src/payi/types/category_resource_response.py">CategoryResourceResponse</a></code>
95
+ - <code title="get /api/v1/categories/{category}/resources/{resource}">client.categories.resources.<a href="./src/payi/resources/categories/resources.py">list</a>(resource, \*, category) -> <a href="./src/payi/types/categories/resource_list_response.py">ResourceListResponse</a></code>
96
+ - <code title="delete /api/v1/categories/{category}/resources/{resource}/{start_timestamp}">client.categories.resources.<a href="./src/payi/resources/categories/resources.py">delete</a>(start_timestamp, \*, category, resource) -> <a href="./src/payi/types/category_resource_response.py">CategoryResourceResponse</a></code>
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+
3
+ errors=()
4
+
5
+ if [ -z "${PYPI_TOKEN}" ]; then
6
+ errors+=("The PAYI_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
7
+ fi
8
+
9
+ lenErrors=${#errors[@]}
10
+
11
+ if [[ lenErrors -gt 0 ]]; then
12
+ echo -e "Found the following errors in the release environment:\n"
13
+
14
+ for error in "${errors[@]}"; do
15
+ echo -e "- $error\n"
16
+ done
17
+
18
+ exit 1
19
+ fi
20
+
21
+ echo "The environment is ready to push releases!"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "payi"
3
- version = "0.1.0-alpha.12"
3
+ version = "0.1.0-alpha.14"
4
4
  description = "The official Python library for the payi API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -49,7 +49,7 @@ markdown-it-py==3.0.0
49
49
  # via rich
50
50
  mdurl==0.1.2
51
51
  # via markdown-it-py
52
- mypy==1.7.1
52
+ mypy==1.10.1
53
53
  mypy-extensions==1.0.0
54
54
  # via mypy
55
55
  nodeenv==1.8.0
@@ -879,9 +879,9 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
879
879
  def _prepare_options(
880
880
  self,
881
881
  options: FinalRequestOptions, # noqa: ARG002
882
- ) -> None:
882
+ ) -> FinalRequestOptions:
883
883
  """Hook for mutating the given options"""
884
- return None
884
+ return options
885
885
 
886
886
  def _prepare_request(
887
887
  self,
@@ -955,8 +955,13 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
955
955
  stream: bool,
956
956
  stream_cls: type[_StreamT] | None,
957
957
  ) -> ResponseT | _StreamT:
958
+ # create a copy of the options we were given so that if the
959
+ # options are mutated later & we then retry, the retries are
960
+ # given the original options
961
+ input_options = model_copy(options)
962
+
958
963
  cast_to = self._maybe_override_cast_to(cast_to, options)
959
- self._prepare_options(options)
964
+ options = self._prepare_options(options)
960
965
 
961
966
  retries = self._remaining_retries(remaining_retries, options)
962
967
  request = self._build_request(options)
@@ -979,7 +984,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
979
984
 
980
985
  if retries > 0:
981
986
  return self._retry_request(
982
- options,
987
+ input_options,
983
988
  cast_to,
984
989
  retries,
985
990
  stream=stream,
@@ -994,7 +999,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
994
999
 
995
1000
  if retries > 0:
996
1001
  return self._retry_request(
997
- options,
1002
+ input_options,
998
1003
  cast_to,
999
1004
  retries,
1000
1005
  stream=stream,
@@ -1022,7 +1027,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
1022
1027
  if retries > 0 and self._should_retry(err.response):
1023
1028
  err.response.close()
1024
1029
  return self._retry_request(
1025
- options,
1030
+ input_options,
1026
1031
  cast_to,
1027
1032
  retries,
1028
1033
  err.response.headers,
@@ -1437,9 +1442,9 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1437
1442
  async def _prepare_options(
1438
1443
  self,
1439
1444
  options: FinalRequestOptions, # noqa: ARG002
1440
- ) -> None:
1445
+ ) -> FinalRequestOptions:
1441
1446
  """Hook for mutating the given options"""
1442
- return None
1447
+ return options
1443
1448
 
1444
1449
  async def _prepare_request(
1445
1450
  self,
@@ -1518,8 +1523,13 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1518
1523
  # execute it earlier while we are in an async context
1519
1524
  self._platform = await asyncify(get_platform)()
1520
1525
 
1526
+ # create a copy of the options we were given so that if the
1527
+ # options are mutated later & we then retry, the retries are
1528
+ # given the original options
1529
+ input_options = model_copy(options)
1530
+
1521
1531
  cast_to = self._maybe_override_cast_to(cast_to, options)
1522
- await self._prepare_options(options)
1532
+ options = await self._prepare_options(options)
1523
1533
 
1524
1534
  retries = self._remaining_retries(remaining_retries, options)
1525
1535
  request = self._build_request(options)
@@ -1540,7 +1550,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1540
1550
 
1541
1551
  if retries > 0:
1542
1552
  return await self._retry_request(
1543
- options,
1553
+ input_options,
1544
1554
  cast_to,
1545
1555
  retries,
1546
1556
  stream=stream,
@@ -1555,7 +1565,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1555
1565
 
1556
1566
  if retries > 0:
1557
1567
  return await self._retry_request(
1558
- options,
1568
+ input_options,
1559
1569
  cast_to,
1560
1570
  retries,
1561
1571
  stream=stream,
@@ -1578,7 +1588,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1578
1588
  if retries > 0 and self._should_retry(err.response):
1579
1589
  await err.response.aclose()
1580
1590
  return await self._retry_request(
1581
- options,
1591
+ input_options,
1582
1592
  cast_to,
1583
1593
  retries,
1584
1594
  err.response.headers,
@@ -48,6 +48,7 @@ __all__ = [
48
48
  class Payi(SyncAPIClient):
49
49
  budgets: resources.BudgetsResource
50
50
  ingest: resources.IngestResource
51
+ categories: resources.CategoriesResource
51
52
  with_raw_response: PayiWithRawResponse
52
53
  with_streaming_response: PayiWithStreamedResponse
53
54
 
@@ -107,6 +108,7 @@ class Payi(SyncAPIClient):
107
108
 
108
109
  self.budgets = resources.BudgetsResource(self)
109
110
  self.ingest = resources.IngestResource(self)
111
+ self.categories = resources.CategoriesResource(self)
110
112
  self.with_raw_response = PayiWithRawResponse(self)
111
113
  self.with_streaming_response = PayiWithStreamedResponse(self)
112
114
 
@@ -218,6 +220,7 @@ class Payi(SyncAPIClient):
218
220
  class AsyncPayi(AsyncAPIClient):
219
221
  budgets: resources.AsyncBudgetsResource
220
222
  ingest: resources.AsyncIngestResource
223
+ categories: resources.AsyncCategoriesResource
221
224
  with_raw_response: AsyncPayiWithRawResponse
222
225
  with_streaming_response: AsyncPayiWithStreamedResponse
223
226
 
@@ -277,6 +280,7 @@ class AsyncPayi(AsyncAPIClient):
277
280
 
278
281
  self.budgets = resources.AsyncBudgetsResource(self)
279
282
  self.ingest = resources.AsyncIngestResource(self)
283
+ self.categories = resources.AsyncCategoriesResource(self)
280
284
  self.with_raw_response = AsyncPayiWithRawResponse(self)
281
285
  self.with_streaming_response = AsyncPayiWithStreamedResponse(self)
282
286
 
@@ -389,24 +393,28 @@ class PayiWithRawResponse:
389
393
  def __init__(self, client: Payi) -> None:
390
394
  self.budgets = resources.BudgetsResourceWithRawResponse(client.budgets)
391
395
  self.ingest = resources.IngestResourceWithRawResponse(client.ingest)
396
+ self.categories = resources.CategoriesResourceWithRawResponse(client.categories)
392
397
 
393
398
 
394
399
  class AsyncPayiWithRawResponse:
395
400
  def __init__(self, client: AsyncPayi) -> None:
396
401
  self.budgets = resources.AsyncBudgetsResourceWithRawResponse(client.budgets)
397
402
  self.ingest = resources.AsyncIngestResourceWithRawResponse(client.ingest)
403
+ self.categories = resources.AsyncCategoriesResourceWithRawResponse(client.categories)
398
404
 
399
405
 
400
406
  class PayiWithStreamedResponse:
401
407
  def __init__(self, client: Payi) -> None:
402
408
  self.budgets = resources.BudgetsResourceWithStreamingResponse(client.budgets)
403
409
  self.ingest = resources.IngestResourceWithStreamingResponse(client.ingest)
410
+ self.categories = resources.CategoriesResourceWithStreamingResponse(client.categories)
404
411
 
405
412
 
406
413
  class AsyncPayiWithStreamedResponse:
407
414
  def __init__(self, client: AsyncPayi) -> None:
408
415
  self.budgets = resources.AsyncBudgetsResourceWithStreamingResponse(client.budgets)
409
416
  self.ingest = resources.AsyncIngestResourceWithStreamingResponse(client.ingest)
417
+ self.categories = resources.AsyncCategoriesResourceWithStreamingResponse(client.categories)
410
418
 
411
419
 
412
420
  Client = Payi
@@ -118,10 +118,10 @@ def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]:
118
118
  return model.__fields__ # type: ignore
119
119
 
120
120
 
121
- def model_copy(model: _ModelT) -> _ModelT:
121
+ def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT:
122
122
  if PYDANTIC_V2:
123
- return model.model_copy()
124
- return model.copy() # type: ignore
123
+ return model.model_copy(deep=deep)
124
+ return model.copy(deep=deep) # type: ignore
125
125
 
126
126
 
127
127
  def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str:
@@ -406,6 +406,15 @@ def build(
406
406
  return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs))
407
407
 
408
408
 
409
+ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T:
410
+ """Loose coercion to the expected type with construction of nested values.
411
+
412
+ Note: the returned value from this function is not guaranteed to match the
413
+ given type.
414
+ """
415
+ return cast(_T, construct_type(value=value, type_=type_))
416
+
417
+
409
418
  def construct_type(*, value: object, type_: object) -> object:
410
419
  """Loose coercion to the expected type with construction of nested values.
411
420
 
@@ -643,6 +652,14 @@ def validate_type(*, type_: type[_T], value: object) -> _T:
643
652
  return cast(_T, _validate_non_model_type(type_=type_, value=value))
644
653
 
645
654
 
655
+ def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None:
656
+ """Add a pydantic config for the given type.
657
+
658
+ Note: this is a no-op on Pydantic v1.
659
+ """
660
+ setattr(typ, "__pydantic_config__", config) # noqa: B010
661
+
662
+
646
663
  # our use of subclasssing here causes weirdness for type checkers,
647
664
  # so we just pretend that we don't subclass
648
665
  if TYPE_CHECKING:
@@ -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.12" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.14" # x-release-please-version
@@ -16,6 +16,14 @@ from .budgets import (
16
16
  BudgetsResourceWithStreamingResponse,
17
17
  AsyncBudgetsResourceWithStreamingResponse,
18
18
  )
19
+ from .categories import (
20
+ CategoriesResource,
21
+ AsyncCategoriesResource,
22
+ CategoriesResourceWithRawResponse,
23
+ AsyncCategoriesResourceWithRawResponse,
24
+ CategoriesResourceWithStreamingResponse,
25
+ AsyncCategoriesResourceWithStreamingResponse,
26
+ )
19
27
 
20
28
  __all__ = [
21
29
  "BudgetsResource",
@@ -30,4 +38,10 @@ __all__ = [
30
38
  "AsyncIngestResourceWithRawResponse",
31
39
  "IngestResourceWithStreamingResponse",
32
40
  "AsyncIngestResourceWithStreamingResponse",
41
+ "CategoriesResource",
42
+ "AsyncCategoriesResource",
43
+ "CategoriesResourceWithRawResponse",
44
+ "AsyncCategoriesResourceWithRawResponse",
45
+ "CategoriesResourceWithStreamingResponse",
46
+ "AsyncCategoriesResourceWithStreamingResponse",
33
47
  ]
@@ -29,9 +29,7 @@ from ..._response import (
29
29
  async_to_raw_response_wrapper,
30
30
  async_to_streamed_response_wrapper,
31
31
  )
32
- from ..._base_client import (
33
- make_request_options,
34
- )
32
+ from ..._base_client import make_request_options
35
33
  from ...types.budget_response import BudgetResponse
36
34
  from ...types.default_response import DefaultResponse
37
35
  from ...types.paged_budget_list import PagedBudgetList
@@ -59,9 +57,11 @@ class BudgetsResource(SyncAPIResource):
59
57
  budget_name: str,
60
58
  max: float,
61
59
  base_cost_estimate: Literal["max"] | NotGiven = NOT_GIVEN,
60
+ billing_model_id: Optional[int] | NotGiven = NOT_GIVEN,
62
61
  budget_response_type: Literal["block", "allow"] | NotGiven = NOT_GIVEN,
63
62
  budget_tags: Optional[List[str]] | NotGiven = NOT_GIVEN,
64
63
  budget_type: Literal["conservative", "liberal"] | NotGiven = NOT_GIVEN,
64
+ cost_basis: Literal["base", "billed"] | NotGiven = NOT_GIVEN,
65
65
  currency: Literal["usd"] | NotGiven = NOT_GIVEN,
66
66
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
67
67
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -92,9 +92,11 @@ class BudgetsResource(SyncAPIResource):
92
92
  "budget_name": budget_name,
93
93
  "max": max,
94
94
  "base_cost_estimate": base_cost_estimate,
95
+ "billing_model_id": billing_model_id,
95
96
  "budget_response_type": budget_response_type,
96
97
  "budget_tags": budget_tags,
97
98
  "budget_type": budget_type,
99
+ "cost_basis": cost_basis,
98
100
  "currency": currency,
99
101
  },
100
102
  budget_create_params.BudgetCreateParams,
@@ -140,8 +142,8 @@ class BudgetsResource(SyncAPIResource):
140
142
  self,
141
143
  budget_id: str,
142
144
  *,
143
- budget_name: str,
144
- max: float | NotGiven = NOT_GIVEN,
145
+ budget_name: Optional[str] | NotGiven = NOT_GIVEN,
146
+ max: Optional[float] | NotGiven = NOT_GIVEN,
145
147
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
146
148
  # The extra values given here take precedence over values defined on the client or passed to this method.
147
149
  extra_headers: Headers | None = None,
@@ -307,9 +309,11 @@ class AsyncBudgetsResource(AsyncAPIResource):
307
309
  budget_name: str,
308
310
  max: float,
309
311
  base_cost_estimate: Literal["max"] | NotGiven = NOT_GIVEN,
312
+ billing_model_id: Optional[int] | NotGiven = NOT_GIVEN,
310
313
  budget_response_type: Literal["block", "allow"] | NotGiven = NOT_GIVEN,
311
314
  budget_tags: Optional[List[str]] | NotGiven = NOT_GIVEN,
312
315
  budget_type: Literal["conservative", "liberal"] | NotGiven = NOT_GIVEN,
316
+ cost_basis: Literal["base", "billed"] | NotGiven = NOT_GIVEN,
313
317
  currency: Literal["usd"] | NotGiven = NOT_GIVEN,
314
318
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
315
319
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -337,9 +341,11 @@ class AsyncBudgetsResource(AsyncAPIResource):
337
341
  "budget_name": budget_name,
338
342
  "max": max,
339
343
  "base_cost_estimate": base_cost_estimate,
344
+ "billing_model_id": billing_model_id,
340
345
  "budget_response_type": budget_response_type,
341
346
  "budget_tags": budget_tags,
342
347
  "budget_type": budget_type,
348
+ "cost_basis": cost_basis,
343
349
  "currency": currency,
344
350
  },
345
351
  budget_create_params.BudgetCreateParams,
@@ -387,8 +393,8 @@ class AsyncBudgetsResource(AsyncAPIResource):
387
393
  self,
388
394
  budget_id: str,
389
395
  *,
390
- budget_name: str,
391
- max: float | NotGiven = NOT_GIVEN,
396
+ budget_name: Optional[str] | NotGiven = NOT_GIVEN,
397
+ max: Optional[float] | NotGiven = NOT_GIVEN,
392
398
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
393
399
  # The extra values given here take precedence over values defined on the client or passed to this method.
394
400
  extra_headers: Headers | None = None,
@@ -19,9 +19,7 @@ from ..._response import (
19
19
  async_to_raw_response_wrapper,
20
20
  async_to_streamed_response_wrapper,
21
21
  )
22
- from ..._base_client import (
23
- make_request_options,
24
- )
22
+ from ..._base_client import make_request_options
25
23
  from ...types.budgets import tag_create_params, tag_remove_params, tag_update_params
26
24
  from ...types.budgets.tag_list_response import TagListResponse
27
25
  from ...types.budgets.tag_create_response import TagCreateResponse
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .resources import (
4
+ ResourcesResource,
5
+ AsyncResourcesResource,
6
+ ResourcesResourceWithRawResponse,
7
+ AsyncResourcesResourceWithRawResponse,
8
+ ResourcesResourceWithStreamingResponse,
9
+ AsyncResourcesResourceWithStreamingResponse,
10
+ )
11
+ from .categories import (
12
+ CategoriesResource,
13
+ AsyncCategoriesResource,
14
+ CategoriesResourceWithRawResponse,
15
+ AsyncCategoriesResourceWithRawResponse,
16
+ CategoriesResourceWithStreamingResponse,
17
+ AsyncCategoriesResourceWithStreamingResponse,
18
+ )
19
+
20
+ __all__ = [
21
+ "ResourcesResource",
22
+ "AsyncResourcesResource",
23
+ "ResourcesResourceWithRawResponse",
24
+ "AsyncResourcesResourceWithRawResponse",
25
+ "ResourcesResourceWithStreamingResponse",
26
+ "AsyncResourcesResourceWithStreamingResponse",
27
+ "CategoriesResource",
28
+ "AsyncCategoriesResource",
29
+ "CategoriesResourceWithRawResponse",
30
+ "AsyncCategoriesResourceWithRawResponse",
31
+ "CategoriesResourceWithStreamingResponse",
32
+ "AsyncCategoriesResourceWithStreamingResponse",
33
+ ]