payi 0.1.0a24__tar.gz → 0.1.0a26__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 (135) hide show
  1. payi-0.1.0a26/.release-please-manifest.json +3 -0
  2. {payi-0.1.0a24 → payi-0.1.0a26}/CHANGELOG.md +27 -0
  3. {payi-0.1.0a24 → payi-0.1.0a26}/CONTRIBUTING.md +4 -4
  4. {payi-0.1.0a24 → payi-0.1.0a26}/PKG-INFO +12 -1
  5. {payi-0.1.0a24 → payi-0.1.0a26}/README.md +11 -0
  6. {payi-0.1.0a24 → payi-0.1.0a26}/api.md +18 -0
  7. {payi-0.1.0a24 → payi-0.1.0a26}/pyproject.toml +1 -5
  8. {payi-0.1.0a24 → payi-0.1.0a26}/requirements-dev.lock +3 -3
  9. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_base_client.py +63 -48
  10. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_client.py +8 -0
  11. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_compat.py +2 -0
  12. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_utils/_utils.py +4 -3
  13. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_version.py +1 -1
  14. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/resources/__init__.py +14 -0
  15. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/resources/budgets/budgets.py +22 -0
  16. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/resources/budgets/tags.py +22 -0
  17. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/resources/categories/categories.py +22 -0
  18. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/resources/categories/resources.py +26 -0
  19. payi-0.1.0a26/src/payi/resources/csat.py +188 -0
  20. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/resources/experiences/experiences.py +22 -0
  21. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/resources/experiences/types.py +22 -0
  22. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/resources/ingest.py +27 -2
  23. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/__init__.py +2 -0
  24. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/bulk_ingest_response.py +7 -0
  25. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/categories/resource_create_params.py +2 -0
  26. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/category_resource_response.py +2 -0
  27. payi-0.1.0a26/src/payi/types/csat.py +11 -0
  28. payi-0.1.0a26/src/payi/types/csat_create_params.py +14 -0
  29. payi-0.1.0a26/src/payi/types/evaluations/__init__.py +6 -0
  30. payi-0.1.0a26/src/payi/types/evaluations/experience_create_params.py +14 -0
  31. payi-0.1.0a26/src/payi/types/evaluations/request_create_params.py +14 -0
  32. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/experiences/experience_type.py +0 -2
  33. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/ingest_event_param.py +2 -0
  34. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/ingest_units_params.py +3 -1
  35. payi-0.1.0a26/src/payi/types/shared/__init__.py +2 -0
  36. {payi-0.1.0a24 → payi-0.1.0a26}/tests/api_resources/categories/test_resources.py +2 -0
  37. payi-0.1.0a26/tests/api_resources/experiences/__init__.py +1 -0
  38. payi-0.1.0a26/tests/api_resources/test_csat.py +124 -0
  39. {payi-0.1.0a24 → payi-0.1.0a26}/tests/api_resources/test_ingest.py +2 -0
  40. {payi-0.1.0a24 → payi-0.1.0a26}/tests/test_client.py +102 -0
  41. payi-0.1.0a24/.release-please-manifest.json +0 -3
  42. {payi-0.1.0a24 → payi-0.1.0a26}/.gitignore +0 -0
  43. {payi-0.1.0a24 → payi-0.1.0a26}/LICENSE +0 -0
  44. {payi-0.1.0a24 → payi-0.1.0a26}/SECURITY.md +0 -0
  45. {payi-0.1.0a24 → payi-0.1.0a26}/bin/check-release-environment +0 -0
  46. {payi-0.1.0a24 → payi-0.1.0a26}/bin/publish-pypi +0 -0
  47. {payi-0.1.0a24 → payi-0.1.0a26}/examples/.keep +0 -0
  48. {payi-0.1.0a24 → payi-0.1.0a26}/mypy.ini +0 -0
  49. {payi-0.1.0a24 → payi-0.1.0a26}/noxfile.py +0 -0
  50. {payi-0.1.0a24 → payi-0.1.0a26}/release-please-config.json +0 -0
  51. {payi-0.1.0a24 → payi-0.1.0a26}/requirements.lock +0 -0
  52. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/__init__.py +0 -0
  53. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_constants.py +0 -0
  54. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_exceptions.py +0 -0
  55. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_files.py +0 -0
  56. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_models.py +0 -0
  57. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_qs.py +0 -0
  58. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_resource.py +0 -0
  59. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_response.py +0 -0
  60. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_streaming.py +0 -0
  61. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_types.py +0 -0
  62. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_utils/__init__.py +0 -0
  63. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_utils/_logs.py +0 -0
  64. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_utils/_proxy.py +0 -0
  65. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_utils/_reflection.py +0 -0
  66. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_utils/_streams.py +0 -0
  67. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_utils/_sync.py +0 -0
  68. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_utils/_transform.py +0 -0
  69. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/_utils/_typing.py +0 -0
  70. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/lib/.keep +0 -0
  71. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/lib/helpers.py +0 -0
  72. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/py.typed +0 -0
  73. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/resources/budgets/__init__.py +0 -0
  74. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/resources/categories/__init__.py +0 -0
  75. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/resources/experiences/__init__.py +0 -0
  76. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budget_create_params.py +0 -0
  77. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budget_history_response.py +0 -0
  78. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budget_list_params.py +0 -0
  79. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budget_response.py +0 -0
  80. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budget_update_params.py +0 -0
  81. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budgets/__init__.py +0 -0
  82. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budgets/budget_tags.py +0 -0
  83. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budgets/tag_create_params.py +0 -0
  84. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budgets/tag_create_response.py +0 -0
  85. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budgets/tag_delete_response.py +0 -0
  86. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budgets/tag_list_response.py +0 -0
  87. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budgets/tag_remove_params.py +0 -0
  88. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budgets/tag_remove_response.py +0 -0
  89. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budgets/tag_update_params.py +0 -0
  90. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/budgets/tag_update_response.py +0 -0
  91. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/categories/__init__.py +0 -0
  92. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/categories/resource_list_response.py +0 -0
  93. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/category_delete_resource_response.py +0 -0
  94. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/category_delete_response.py +0 -0
  95. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/category_list_resources_response.py +0 -0
  96. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/category_list_response.py +0 -0
  97. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/category_response.py +0 -0
  98. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/cost_data.py +0 -0
  99. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/cost_details.py +0 -0
  100. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/default_response.py +0 -0
  101. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/experience_instance.py +0 -0
  102. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/experiences/__init__.py +0 -0
  103. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/experiences/type_create_params.py +0 -0
  104. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/experiences/type_list_params.py +0 -0
  105. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/experiences/type_list_response.py +0 -0
  106. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/experiences/type_update_params.py +0 -0
  107. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/ingest_bulk_params.py +0 -0
  108. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/ingest_response.py +0 -0
  109. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/paged_budget_list.py +0 -0
  110. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/requests_data.py +0 -0
  111. {payi-0.1.0a24 → payi-0.1.0a26}/src/payi/types/total_cost_data.py +0 -0
  112. {payi-0.1.0a24 → payi-0.1.0a26}/tests/__init__.py +0 -0
  113. {payi-0.1.0a24 → payi-0.1.0a26}/tests/api_resources/__init__.py +0 -0
  114. {payi-0.1.0a24 → payi-0.1.0a26}/tests/api_resources/budgets/__init__.py +0 -0
  115. {payi-0.1.0a24 → payi-0.1.0a26}/tests/api_resources/budgets/test_tags.py +0 -0
  116. {payi-0.1.0a24 → payi-0.1.0a26}/tests/api_resources/categories/__init__.py +0 -0
  117. {payi-0.1.0a24/tests/api_resources/experiences → payi-0.1.0a26/tests/api_resources/evaluations}/__init__.py +0 -0
  118. {payi-0.1.0a24 → payi-0.1.0a26}/tests/api_resources/experiences/test_types.py +0 -0
  119. {payi-0.1.0a24 → payi-0.1.0a26}/tests/api_resources/test_budgets.py +0 -0
  120. {payi-0.1.0a24 → payi-0.1.0a26}/tests/api_resources/test_categories.py +0 -0
  121. {payi-0.1.0a24 → payi-0.1.0a26}/tests/api_resources/test_experiences.py +0 -0
  122. {payi-0.1.0a24 → payi-0.1.0a26}/tests/conftest.py +0 -0
  123. {payi-0.1.0a24 → payi-0.1.0a26}/tests/sample_file.txt +0 -0
  124. {payi-0.1.0a24 → payi-0.1.0a26}/tests/test_deepcopy.py +0 -0
  125. {payi-0.1.0a24 → payi-0.1.0a26}/tests/test_extract_files.py +0 -0
  126. {payi-0.1.0a24 → payi-0.1.0a26}/tests/test_files.py +0 -0
  127. {payi-0.1.0a24 → payi-0.1.0a26}/tests/test_models.py +0 -0
  128. {payi-0.1.0a24 → payi-0.1.0a26}/tests/test_qs.py +0 -0
  129. {payi-0.1.0a24 → payi-0.1.0a26}/tests/test_required_args.py +0 -0
  130. {payi-0.1.0a24 → payi-0.1.0a26}/tests/test_response.py +0 -0
  131. {payi-0.1.0a24 → payi-0.1.0a26}/tests/test_streaming.py +0 -0
  132. {payi-0.1.0a24 → payi-0.1.0a26}/tests/test_transform.py +0 -0
  133. {payi-0.1.0a24 → payi-0.1.0a26}/tests/test_utils/test_proxy.py +0 -0
  134. {payi-0.1.0a24 → payi-0.1.0a26}/tests/test_utils/test_typing.py +0 -0
  135. {payi-0.1.0a24 → payi-0.1.0a26}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.0-alpha.26"
3
+ }
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.26 (2024-10-01)
4
+
5
+ Full Changelog: [v0.1.0-alpha.25...v0.1.0-alpha.26](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.25...v0.1.0-alpha.26)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([#121](https://github.com/Pay-i/pay-i-python/issues/121)) ([2705291](https://github.com/Pay-i/pay-i-python/commit/27052910f37169c45456fc2a752a8525eb858d4e))
10
+
11
+
12
+ ### Chores
13
+
14
+ * **internal:** codegen related update ([#119](https://github.com/Pay-i/pay-i-python/issues/119)) ([1e7361a](https://github.com/Pay-i/pay-i-python/commit/1e7361a69e9751e834bb32a450624324aa27c646))
15
+
16
+ ## 0.1.0-alpha.25 (2024-09-25)
17
+
18
+ Full Changelog: [v0.1.0-alpha.24...v0.1.0-alpha.25](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.24...v0.1.0-alpha.25)
19
+
20
+ ### Features
21
+
22
+ * **api:** add Evaluations ([#114](https://github.com/Pay-i/pay-i-python/issues/114)) ([6352b8d](https://github.com/Pay-i/pay-i-python/commit/6352b8d8d69a8e2d636e7fd43745dae02b8c7fc9))
23
+
24
+
25
+ ### Chores
26
+
27
+ * **internal:** codegen related update ([#115](https://github.com/Pay-i/pay-i-python/issues/115)) ([17c1b4d](https://github.com/Pay-i/pay-i-python/commit/17c1b4d89f6b54d87bc9e8dbceea2d6f4bd4f30a))
28
+ * **internal:** update pydantic v1 compat helpers ([#117](https://github.com/Pay-i/pay-i-python/issues/117)) ([e4a11c5](https://github.com/Pay-i/pay-i-python/commit/e4a11c5d2ad7baf3920d5608d07a31d9649ff570))
29
+
3
30
  ## 0.1.0-alpha.24 (2024-09-03)
4
31
 
5
32
  Full Changelog: [v0.1.0-alpha.23...v0.1.0-alpha.24](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.23...v0.1.0-alpha.24)
@@ -31,13 +31,13 @@ $ pip install -r requirements-dev.lock
31
31
 
32
32
  ## Modifying/Adding code
33
33
 
34
- Most of the SDK is generated code, and any modified code will be overridden on the next generation. The
35
- `src/payi/lib/` and `examples/` directories are exceptions and will never be overridden.
34
+ Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
35
+ result in merge conflicts between manual patches and changes from the generator. The generator will never
36
+ modify the contents of the `src/payi/lib/` and `examples/` directories.
36
37
 
37
38
  ## Adding and running examples
38
39
 
39
- All files in the `examples/` directory are not modified by the Stainless generator and can be freely edited or
40
- added to.
40
+ All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.
41
41
 
42
42
  ```bash
43
43
  # add an example to examples/<your-example>.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: payi
3
- Version: 0.1.0a24
3
+ Version: 0.1.0a26
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
@@ -356,6 +356,17 @@ We take backwards-compatibility seriously and work hard to ensure you can rely o
356
356
 
357
357
  We are keen for your feedback; please open an [issue](https://www.github.com/Pay-i/pay-i-python/issues) with questions, bugs, or suggestions.
358
358
 
359
+ ### Determining the installed version
360
+
361
+ If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version.
362
+
363
+ You can determine the version that is being used at runtime with:
364
+
365
+ ```py
366
+ import payi
367
+ print(payi.__version__)
368
+ ```
369
+
359
370
  ## Requirements
360
371
 
361
372
  Python 3.7 or higher.
@@ -322,6 +322,17 @@ We take backwards-compatibility seriously and work hard to ensure you can rely o
322
322
 
323
323
  We are keen for your feedback; please open an [issue](https://www.github.com/Pay-i/pay-i-python/issues) with questions, bugs, or suggestions.
324
324
 
325
+ ### Determining the installed version
326
+
327
+ If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version.
328
+
329
+ You can determine the version that is being used at runtime with:
330
+
331
+ ```py
332
+ import payi
333
+ print(payi.__version__)
334
+ ```
335
+
325
336
  ## Requirements
326
337
 
327
338
  Python 3.7 or higher.
@@ -1,3 +1,9 @@
1
+ # Shared Types
2
+
3
+ ```python
4
+ from payi.types import EvaluationResponse
5
+ ```
6
+
1
7
  # Budgets
2
8
 
3
9
  Types:
@@ -126,3 +132,15 @@ Methods:
126
132
  - <code title="patch /api/v1/experiences/types/{experience_name}">client.experiences.types.<a href="./src/payi/resources/experiences/types.py">update</a>(experience_name, \*\*<a href="src/payi/types/experiences/type_update_params.py">params</a>) -> <a href="./src/payi/types/experiences/experience_type.py">ExperienceType</a></code>
127
133
  - <code title="get /api/v1/experiences/types">client.experiences.types.<a href="./src/payi/resources/experiences/types.py">list</a>(\*\*<a href="src/payi/types/experiences/type_list_params.py">params</a>) -> <a href="./src/payi/types/experiences/type_list_response.py">TypeListResponse</a></code>
128
134
  - <code title="delete /api/v1/experiences/types/{experience_name}">client.experiences.types.<a href="./src/payi/resources/experiences/types.py">delete</a>(experience_name) -> <a href="./src/payi/types/experiences/experience_type.py">ExperienceType</a></code>
135
+
136
+ # Csat
137
+
138
+ Types:
139
+
140
+ ```python
141
+ from payi.types import Csat
142
+ ```
143
+
144
+ Methods:
145
+
146
+ - <code title="post /api/v1/csat/experiences/{experience_id}">client.csat.<a href="./src/payi/resources/csat.py">create</a>(experience_id, \*\*<a href="src/payi/types/csat_create_params.py">params</a>) -> <a href="./src/payi/types/csat.py">Csat</a></code>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "payi"
3
- version = "0.1.0-alpha.24"
3
+ version = "0.1.0-alpha.26"
4
4
  description = "The official Python library for the payi API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -15,7 +15,6 @@ dependencies = [
15
15
  "distro>=1.7.0, <2",
16
16
  "sniffio",
17
17
  "cached-property; python_version < '3.8'",
18
-
19
18
  ]
20
19
  requires-python = ">= 3.7"
21
20
  classifiers = [
@@ -36,8 +35,6 @@ classifiers = [
36
35
  "License :: OSI Approved :: Apache Software License"
37
36
  ]
38
37
 
39
-
40
-
41
38
  [project.urls]
42
39
  Homepage = "https://github.com/Pay-i/pay-i-python"
43
40
  Repository = "https://github.com/Pay-i/pay-i-python"
@@ -59,7 +56,6 @@ dev-dependencies = [
59
56
  "dirty-equals>=0.6.0",
60
57
  "importlib-metadata>=6.7.0",
61
58
  "rich>=13.7.1",
62
-
63
59
  ]
64
60
 
65
61
  [tool.rye.scripts]
@@ -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.10.1
52
+ mypy==1.11.2
53
53
  mypy-extensions==1.0.0
54
54
  # via mypy
55
55
  nodeenv==1.8.0
@@ -70,7 +70,7 @@ pydantic-core==2.18.2
70
70
  # via pydantic
71
71
  pygments==2.18.0
72
72
  # via rich
73
- pyright==1.1.374
73
+ pyright==1.1.380
74
74
  pytest==7.1.1
75
75
  # via pytest-asyncio
76
76
  pytest-asyncio==0.21.1
@@ -80,7 +80,7 @@ pytz==2023.3.post1
80
80
  # via dirty-equals
81
81
  respx==0.20.2
82
82
  rich==13.7.1
83
- ruff==0.5.6
83
+ ruff==0.6.5
84
84
  setuptools==68.2.2
85
85
  # via nodeenv
86
86
  six==1.16.0
@@ -400,14 +400,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
400
400
  ) -> _exceptions.APIStatusError:
401
401
  raise NotImplementedError()
402
402
 
403
- def _remaining_retries(
404
- self,
405
- remaining_retries: Optional[int],
406
- options: FinalRequestOptions,
407
- ) -> int:
408
- return remaining_retries if remaining_retries is not None else options.get_max_retries(self.max_retries)
409
-
410
- def _build_headers(self, options: FinalRequestOptions) -> httpx.Headers:
403
+ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0) -> httpx.Headers:
411
404
  custom_headers = options.headers or {}
412
405
  headers_dict = _merge_mappings(self.default_headers, custom_headers)
413
406
  self._validate_headers(headers_dict, custom_headers)
@@ -419,6 +412,11 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
419
412
  if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers:
420
413
  headers[idempotency_header] = options.idempotency_key or self._idempotency_key()
421
414
 
415
+ # Don't set the retry count header if it was already set or removed by the caller. We check
416
+ # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case.
417
+ if "x-stainless-retry-count" not in (header.lower() for header in custom_headers):
418
+ headers["x-stainless-retry-count"] = str(retries_taken)
419
+
422
420
  return headers
423
421
 
424
422
  def _prepare_url(self, url: str) -> URL:
@@ -440,6 +438,8 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
440
438
  def _build_request(
441
439
  self,
442
440
  options: FinalRequestOptions,
441
+ *,
442
+ retries_taken: int = 0,
443
443
  ) -> httpx.Request:
444
444
  if log.isEnabledFor(logging.DEBUG):
445
445
  log.debug("Request options: %s", model_dump(options, exclude_unset=True))
@@ -455,7 +455,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
455
455
  else:
456
456
  raise RuntimeError(f"Unexpected JSON data type, {type(json_data)}, cannot merge with `extra_body`")
457
457
 
458
- headers = self._build_headers(options)
458
+ headers = self._build_headers(options, retries_taken=retries_taken)
459
459
  params = _merge_mappings(self.default_query, options.params)
460
460
  content_type = headers.get("Content-Type")
461
461
  files = options.files
@@ -489,12 +489,17 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
489
489
  if not files:
490
490
  files = cast(HttpxRequestFiles, ForceMultipartDict())
491
491
 
492
+ prepared_url = self._prepare_url(options.url)
493
+ if "_" in prepared_url.host:
494
+ # work around https://github.com/encode/httpx/discussions/2880
495
+ kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
496
+
492
497
  # TODO: report this error to httpx
493
498
  return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
494
499
  headers=headers,
495
500
  timeout=self.timeout if isinstance(options.timeout, NotGiven) else options.timeout,
496
501
  method=options.method,
497
- url=self._prepare_url(options.url),
502
+ url=prepared_url,
498
503
  # the `Query` type that we use is incompatible with qs'
499
504
  # `Params` type as it needs to be typed as `Mapping[str, object]`
500
505
  # so that passing a `TypedDict` doesn't cause an error.
@@ -933,12 +938,17 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
933
938
  stream: bool = False,
934
939
  stream_cls: type[_StreamT] | None = None,
935
940
  ) -> ResponseT | _StreamT:
941
+ if remaining_retries is not None:
942
+ retries_taken = options.get_max_retries(self.max_retries) - remaining_retries
943
+ else:
944
+ retries_taken = 0
945
+
936
946
  return self._request(
937
947
  cast_to=cast_to,
938
948
  options=options,
939
949
  stream=stream,
940
950
  stream_cls=stream_cls,
941
- remaining_retries=remaining_retries,
951
+ retries_taken=retries_taken,
942
952
  )
943
953
 
944
954
  def _request(
@@ -946,7 +956,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
946
956
  *,
947
957
  cast_to: Type[ResponseT],
948
958
  options: FinalRequestOptions,
949
- remaining_retries: int | None,
959
+ retries_taken: int,
950
960
  stream: bool,
951
961
  stream_cls: type[_StreamT] | None,
952
962
  ) -> ResponseT | _StreamT:
@@ -958,8 +968,8 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
958
968
  cast_to = self._maybe_override_cast_to(cast_to, options)
959
969
  options = self._prepare_options(options)
960
970
 
961
- retries = self._remaining_retries(remaining_retries, options)
962
- request = self._build_request(options)
971
+ remaining_retries = options.get_max_retries(self.max_retries) - retries_taken
972
+ request = self._build_request(options, retries_taken=retries_taken)
963
973
  self._prepare_request(request)
964
974
 
965
975
  kwargs: HttpxSendArgs = {}
@@ -977,11 +987,11 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
977
987
  except httpx.TimeoutException as err:
978
988
  log.debug("Encountered httpx.TimeoutException", exc_info=True)
979
989
 
980
- if retries > 0:
990
+ if remaining_retries > 0:
981
991
  return self._retry_request(
982
992
  input_options,
983
993
  cast_to,
984
- retries,
994
+ retries_taken=retries_taken,
985
995
  stream=stream,
986
996
  stream_cls=stream_cls,
987
997
  response_headers=None,
@@ -992,11 +1002,11 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
992
1002
  except Exception as err:
993
1003
  log.debug("Encountered Exception", exc_info=True)
994
1004
 
995
- if retries > 0:
1005
+ if remaining_retries > 0:
996
1006
  return self._retry_request(
997
1007
  input_options,
998
1008
  cast_to,
999
- retries,
1009
+ retries_taken=retries_taken,
1000
1010
  stream=stream,
1001
1011
  stream_cls=stream_cls,
1002
1012
  response_headers=None,
@@ -1019,13 +1029,13 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
1019
1029
  except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code
1020
1030
  log.debug("Encountered httpx.HTTPStatusError", exc_info=True)
1021
1031
 
1022
- if retries > 0 and self._should_retry(err.response):
1032
+ if remaining_retries > 0 and self._should_retry(err.response):
1023
1033
  err.response.close()
1024
1034
  return self._retry_request(
1025
1035
  input_options,
1026
1036
  cast_to,
1027
- retries,
1028
- err.response.headers,
1037
+ retries_taken=retries_taken,
1038
+ response_headers=err.response.headers,
1029
1039
  stream=stream,
1030
1040
  stream_cls=stream_cls,
1031
1041
  )
@@ -1044,26 +1054,26 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
1044
1054
  response=response,
1045
1055
  stream=stream,
1046
1056
  stream_cls=stream_cls,
1047
- retries_taken=options.get_max_retries(self.max_retries) - retries,
1057
+ retries_taken=retries_taken,
1048
1058
  )
1049
1059
 
1050
1060
  def _retry_request(
1051
1061
  self,
1052
1062
  options: FinalRequestOptions,
1053
1063
  cast_to: Type[ResponseT],
1054
- remaining_retries: int,
1055
- response_headers: httpx.Headers | None,
1056
1064
  *,
1065
+ retries_taken: int,
1066
+ response_headers: httpx.Headers | None,
1057
1067
  stream: bool,
1058
1068
  stream_cls: type[_StreamT] | None,
1059
1069
  ) -> ResponseT | _StreamT:
1060
- remaining = remaining_retries - 1
1061
- if remaining == 1:
1070
+ remaining_retries = options.get_max_retries(self.max_retries) - retries_taken
1071
+ if remaining_retries == 1:
1062
1072
  log.debug("1 retry left")
1063
1073
  else:
1064
- log.debug("%i retries left", remaining)
1074
+ log.debug("%i retries left", remaining_retries)
1065
1075
 
1066
- timeout = self._calculate_retry_timeout(remaining, options, response_headers)
1076
+ timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers)
1067
1077
  log.info("Retrying request to %s in %f seconds", options.url, timeout)
1068
1078
 
1069
1079
  # In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a
@@ -1073,7 +1083,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
1073
1083
  return self._request(
1074
1084
  options=options,
1075
1085
  cast_to=cast_to,
1076
- remaining_retries=remaining,
1086
+ retries_taken=retries_taken + 1,
1077
1087
  stream=stream,
1078
1088
  stream_cls=stream_cls,
1079
1089
  )
@@ -1491,12 +1501,17 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1491
1501
  stream_cls: type[_AsyncStreamT] | None = None,
1492
1502
  remaining_retries: Optional[int] = None,
1493
1503
  ) -> ResponseT | _AsyncStreamT:
1504
+ if remaining_retries is not None:
1505
+ retries_taken = options.get_max_retries(self.max_retries) - remaining_retries
1506
+ else:
1507
+ retries_taken = 0
1508
+
1494
1509
  return await self._request(
1495
1510
  cast_to=cast_to,
1496
1511
  options=options,
1497
1512
  stream=stream,
1498
1513
  stream_cls=stream_cls,
1499
- remaining_retries=remaining_retries,
1514
+ retries_taken=retries_taken,
1500
1515
  )
1501
1516
 
1502
1517
  async def _request(
@@ -1506,7 +1521,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1506
1521
  *,
1507
1522
  stream: bool,
1508
1523
  stream_cls: type[_AsyncStreamT] | None,
1509
- remaining_retries: int | None,
1524
+ retries_taken: int,
1510
1525
  ) -> ResponseT | _AsyncStreamT:
1511
1526
  if self._platform is None:
1512
1527
  # `get_platform` can make blocking IO calls so we
@@ -1521,8 +1536,8 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1521
1536
  cast_to = self._maybe_override_cast_to(cast_to, options)
1522
1537
  options = await self._prepare_options(options)
1523
1538
 
1524
- retries = self._remaining_retries(remaining_retries, options)
1525
- request = self._build_request(options)
1539
+ remaining_retries = options.get_max_retries(self.max_retries) - retries_taken
1540
+ request = self._build_request(options, retries_taken=retries_taken)
1526
1541
  await self._prepare_request(request)
1527
1542
 
1528
1543
  kwargs: HttpxSendArgs = {}
@@ -1538,11 +1553,11 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1538
1553
  except httpx.TimeoutException as err:
1539
1554
  log.debug("Encountered httpx.TimeoutException", exc_info=True)
1540
1555
 
1541
- if retries > 0:
1556
+ if remaining_retries > 0:
1542
1557
  return await self._retry_request(
1543
1558
  input_options,
1544
1559
  cast_to,
1545
- retries,
1560
+ retries_taken=retries_taken,
1546
1561
  stream=stream,
1547
1562
  stream_cls=stream_cls,
1548
1563
  response_headers=None,
@@ -1553,11 +1568,11 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1553
1568
  except Exception as err:
1554
1569
  log.debug("Encountered Exception", exc_info=True)
1555
1570
 
1556
- if retries > 0:
1571
+ if retries_taken > 0:
1557
1572
  return await self._retry_request(
1558
1573
  input_options,
1559
1574
  cast_to,
1560
- retries,
1575
+ retries_taken=retries_taken,
1561
1576
  stream=stream,
1562
1577
  stream_cls=stream_cls,
1563
1578
  response_headers=None,
@@ -1575,13 +1590,13 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1575
1590
  except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code
1576
1591
  log.debug("Encountered httpx.HTTPStatusError", exc_info=True)
1577
1592
 
1578
- if retries > 0 and self._should_retry(err.response):
1593
+ if remaining_retries > 0 and self._should_retry(err.response):
1579
1594
  await err.response.aclose()
1580
1595
  return await self._retry_request(
1581
1596
  input_options,
1582
1597
  cast_to,
1583
- retries,
1584
- err.response.headers,
1598
+ retries_taken=retries_taken,
1599
+ response_headers=err.response.headers,
1585
1600
  stream=stream,
1586
1601
  stream_cls=stream_cls,
1587
1602
  )
@@ -1600,26 +1615,26 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1600
1615
  response=response,
1601
1616
  stream=stream,
1602
1617
  stream_cls=stream_cls,
1603
- retries_taken=options.get_max_retries(self.max_retries) - retries,
1618
+ retries_taken=retries_taken,
1604
1619
  )
1605
1620
 
1606
1621
  async def _retry_request(
1607
1622
  self,
1608
1623
  options: FinalRequestOptions,
1609
1624
  cast_to: Type[ResponseT],
1610
- remaining_retries: int,
1611
- response_headers: httpx.Headers | None,
1612
1625
  *,
1626
+ retries_taken: int,
1627
+ response_headers: httpx.Headers | None,
1613
1628
  stream: bool,
1614
1629
  stream_cls: type[_AsyncStreamT] | None,
1615
1630
  ) -> ResponseT | _AsyncStreamT:
1616
- remaining = remaining_retries - 1
1617
- if remaining == 1:
1631
+ remaining_retries = options.get_max_retries(self.max_retries) - retries_taken
1632
+ if remaining_retries == 1:
1618
1633
  log.debug("1 retry left")
1619
1634
  else:
1620
- log.debug("%i retries left", remaining)
1635
+ log.debug("%i retries left", remaining_retries)
1621
1636
 
1622
- timeout = self._calculate_retry_timeout(remaining, options, response_headers)
1637
+ timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers)
1623
1638
  log.info("Retrying request to %s in %f seconds", options.url, timeout)
1624
1639
 
1625
1640
  await anyio.sleep(timeout)
@@ -1627,7 +1642,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1627
1642
  return await self._request(
1628
1643
  options=options,
1629
1644
  cast_to=cast_to,
1630
- remaining_retries=remaining,
1645
+ retries_taken=retries_taken + 1,
1631
1646
  stream=stream,
1632
1647
  stream_cls=stream_cls,
1633
1648
  )
@@ -50,6 +50,7 @@ class Payi(SyncAPIClient):
50
50
  ingest: resources.IngestResource
51
51
  categories: resources.CategoriesResource
52
52
  experiences: resources.ExperiencesResource
53
+ csat: resources.CsatResource
53
54
  with_raw_response: PayiWithRawResponse
54
55
  with_streaming_response: PayiWithStreamedResponse
55
56
 
@@ -111,6 +112,7 @@ class Payi(SyncAPIClient):
111
112
  self.ingest = resources.IngestResource(self)
112
113
  self.categories = resources.CategoriesResource(self)
113
114
  self.experiences = resources.ExperiencesResource(self)
115
+ self.csat = resources.CsatResource(self)
114
116
  self.with_raw_response = PayiWithRawResponse(self)
115
117
  self.with_streaming_response = PayiWithStreamedResponse(self)
116
118
 
@@ -224,6 +226,7 @@ class AsyncPayi(AsyncAPIClient):
224
226
  ingest: resources.AsyncIngestResource
225
227
  categories: resources.AsyncCategoriesResource
226
228
  experiences: resources.AsyncExperiencesResource
229
+ csat: resources.AsyncCsatResource
227
230
  with_raw_response: AsyncPayiWithRawResponse
228
231
  with_streaming_response: AsyncPayiWithStreamedResponse
229
232
 
@@ -285,6 +288,7 @@ class AsyncPayi(AsyncAPIClient):
285
288
  self.ingest = resources.AsyncIngestResource(self)
286
289
  self.categories = resources.AsyncCategoriesResource(self)
287
290
  self.experiences = resources.AsyncExperiencesResource(self)
291
+ self.csat = resources.AsyncCsatResource(self)
288
292
  self.with_raw_response = AsyncPayiWithRawResponse(self)
289
293
  self.with_streaming_response = AsyncPayiWithStreamedResponse(self)
290
294
 
@@ -399,6 +403,7 @@ class PayiWithRawResponse:
399
403
  self.ingest = resources.IngestResourceWithRawResponse(client.ingest)
400
404
  self.categories = resources.CategoriesResourceWithRawResponse(client.categories)
401
405
  self.experiences = resources.ExperiencesResourceWithRawResponse(client.experiences)
406
+ self.csat = resources.CsatResourceWithRawResponse(client.csat)
402
407
 
403
408
 
404
409
  class AsyncPayiWithRawResponse:
@@ -407,6 +412,7 @@ class AsyncPayiWithRawResponse:
407
412
  self.ingest = resources.AsyncIngestResourceWithRawResponse(client.ingest)
408
413
  self.categories = resources.AsyncCategoriesResourceWithRawResponse(client.categories)
409
414
  self.experiences = resources.AsyncExperiencesResourceWithRawResponse(client.experiences)
415
+ self.csat = resources.AsyncCsatResourceWithRawResponse(client.csat)
410
416
 
411
417
 
412
418
  class PayiWithStreamedResponse:
@@ -415,6 +421,7 @@ class PayiWithStreamedResponse:
415
421
  self.ingest = resources.IngestResourceWithStreamingResponse(client.ingest)
416
422
  self.categories = resources.CategoriesResourceWithStreamingResponse(client.categories)
417
423
  self.experiences = resources.ExperiencesResourceWithStreamingResponse(client.experiences)
424
+ self.csat = resources.CsatResourceWithStreamingResponse(client.csat)
418
425
 
419
426
 
420
427
  class AsyncPayiWithStreamedResponse:
@@ -423,6 +430,7 @@ class AsyncPayiWithStreamedResponse:
423
430
  self.ingest = resources.AsyncIngestResourceWithStreamingResponse(client.ingest)
424
431
  self.categories = resources.AsyncCategoriesResourceWithStreamingResponse(client.categories)
425
432
  self.experiences = resources.AsyncExperiencesResourceWithStreamingResponse(client.experiences)
433
+ self.csat = resources.AsyncCsatResourceWithStreamingResponse(client.csat)
426
434
 
427
435
 
428
436
  Client = Payi
@@ -136,12 +136,14 @@ def model_dump(
136
136
  exclude: IncEx = None,
137
137
  exclude_unset: bool = False,
138
138
  exclude_defaults: bool = False,
139
+ warnings: bool = True,
139
140
  ) -> dict[str, Any]:
140
141
  if PYDANTIC_V2:
141
142
  return model.model_dump(
142
143
  exclude=exclude,
143
144
  exclude_unset=exclude_unset,
144
145
  exclude_defaults=exclude_defaults,
146
+ warnings=warnings,
145
147
  )
146
148
  return cast(
147
149
  "dict[str, Any]",
@@ -363,12 +363,13 @@ def file_from_path(path: str) -> FileTypes:
363
363
 
364
364
  def get_required_header(headers: HeadersLike, header: str) -> str:
365
365
  lower_header = header.lower()
366
- if isinstance(headers, Mapping):
367
- for k, v in headers.items():
366
+ if is_mapping_t(headers):
367
+ # mypy doesn't understand the type narrowing here
368
+ for k, v in headers.items(): # type: ignore
368
369
  if k.lower() == lower_header and isinstance(v, str):
369
370
  return v
370
371
 
371
- """ to deal with the case where the header looks like Stainless-Event-Id """
372
+ # to deal with the case where the header looks like Stainless-Event-Id
372
373
  intercaps_header = re.sub(r"([^\w])(\w)", lambda pat: pat.group(1) + pat.group(2).upper(), header.capitalize())
373
374
 
374
375
  for normalized_header in [header, lower_header, header.upper(), intercaps_header]:
@@ -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.24" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.26" # x-release-please-version
@@ -1,5 +1,13 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ from .csat import (
4
+ CsatResource,
5
+ AsyncCsatResource,
6
+ CsatResourceWithRawResponse,
7
+ AsyncCsatResourceWithRawResponse,
8
+ CsatResourceWithStreamingResponse,
9
+ AsyncCsatResourceWithStreamingResponse,
10
+ )
3
11
  from .ingest import (
4
12
  IngestResource,
5
13
  AsyncIngestResource,
@@ -58,4 +66,10 @@ __all__ = [
58
66
  "AsyncExperiencesResourceWithRawResponse",
59
67
  "ExperiencesResourceWithStreamingResponse",
60
68
  "AsyncExperiencesResourceWithStreamingResponse",
69
+ "CsatResource",
70
+ "AsyncCsatResource",
71
+ "CsatResourceWithRawResponse",
72
+ "AsyncCsatResourceWithRawResponse",
73
+ "CsatResourceWithStreamingResponse",
74
+ "AsyncCsatResourceWithStreamingResponse",
61
75
  ]