payi 0.1.0a31__tar.gz → 0.1.0a33__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.
- payi-0.1.0a33/.release-please-manifest.json +3 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/CHANGELOG.md +30 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/PKG-INFO +19 -7
- {payi-0.1.0a31 → payi-0.1.0a33}/README.md +14 -3
- {payi-0.1.0a31 → payi-0.1.0a33}/pyproject.toml +2 -2
- {payi-0.1.0a31 → payi-0.1.0a33}/requirements-dev.lock +3 -3
- {payi-0.1.0a31 → payi-0.1.0a33}/requirements.lock +2 -2
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/__init__.py +2 -1
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_client.py +63 -68
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_models.py +3 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_response.py +10 -10
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_types.py +2 -4
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_utils/__init__.py +1 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_utils/_typing.py +30 -1
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_version.py +1 -1
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/test_client.py +4 -4
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/test_models.py +17 -1
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/utils.py +4 -0
- payi-0.1.0a31/.release-please-manifest.json +0 -3
- {payi-0.1.0a31 → payi-0.1.0a33}/.gitignore +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/CONTRIBUTING.md +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/LICENSE +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/SECURITY.md +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/api.md +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/bin/check-release-environment +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/bin/publish-pypi +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/examples/.keep +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/mypy.ini +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/noxfile.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/release-please-config.json +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_base_client.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_compat.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_constants.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_exceptions.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_files.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_qs.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_resource.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_streaming.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_utils/_logs.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_utils/_proxy.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_utils/_reflection.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_utils/_streams.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_utils/_sync.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_utils/_transform.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/_utils/_utils.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/lib/.keep +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/lib/helpers.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/py.typed +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/billing_models.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/budgets/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/budgets/budgets.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/budgets/tags.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/categories/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/categories/categories.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/categories/resources.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/experiences/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/experiences/csat.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/experiences/experiences.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/experiences/properties.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/experiences/types.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/ingest.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/price_modifiers.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/requests/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/requests/properties.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/resources/requests/requests.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/billing_model.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/billing_model_create_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/billing_model_list_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/billing_model_update_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budget_create_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budget_history_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budget_list_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budget_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budget_update_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budgets/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budgets/budget_tags.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budgets/tag_create_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budgets/tag_create_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budgets/tag_delete_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budgets/tag_list_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budgets/tag_remove_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budgets/tag_remove_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budgets/tag_update_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/budgets/tag_update_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/bulk_ingest_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/categories/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/categories/resource_create_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/categories/resource_list_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/category_delete_resource_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/category_delete_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/category_list_resources_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/category_list_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/category_resource_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/category_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/cost_data.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/cost_details.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/default_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/experience_instance_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/experiences/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/experiences/csat_create_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/experiences/csat_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/experiences/experience_type.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/experiences/properties_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/experiences/property_create_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/experiences/type_create_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/experiences/type_list_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/experiences/type_list_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/experiences/type_update_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/ingest_bulk_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/ingest_event_param.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/ingest_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/ingest_units_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/paged_budget_list.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/price_modifier.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/price_modifier_create_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/price_modifier_retrieve_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/price_modifier_update_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/requests/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/requests/property_create_params.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/requests_data.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/src/payi/types/total_cost_data.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/budgets/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/budgets/test_tags.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/categories/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/categories/test_resources.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/experiences/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/experiences/test_csat.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/experiences/test_properties.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/experiences/test_types.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/requests/__init__.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/requests/test_properties.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/test_billing_models.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/test_budgets.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/test_categories.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/test_experiences.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/test_ingest.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/api_resources/test_price_modifiers.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/conftest.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/sample_file.txt +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/test_deepcopy.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/test_extract_files.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/test_files.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/test_qs.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/test_required_args.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/test_response.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/test_streaming.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/test_transform.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/test_utils/test_proxy.py +0 -0
- {payi-0.1.0a31 → payi-0.1.0a33}/tests/test_utils/test_typing.py +0 -0
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.33 (2024-12-18)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.1.0-alpha.32...v0.1.0-alpha.33](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.32...v0.1.0-alpha.33)
|
|
6
|
+
|
|
7
|
+
### Chores
|
|
8
|
+
|
|
9
|
+
* **internal:** add support for TypeAliasType ([#159](https://github.com/Pay-i/pay-i-python/issues/159)) ([8ea8180](https://github.com/Pay-i/pay-i-python/commit/8ea81803464331a9d431871b3965716e7dd751cc))
|
|
10
|
+
* **internal:** bump pyright ([#157](https://github.com/Pay-i/pay-i-python/issues/157)) ([9e0676b](https://github.com/Pay-i/pay-i-python/commit/9e0676bcdb4f9c8518632a480650667b9aba27f7))
|
|
11
|
+
* **internal:** codegen related update ([#160](https://github.com/Pay-i/pay-i-python/issues/160)) ([5141606](https://github.com/Pay-i/pay-i-python/commit/5141606ed39b82cff8e7c70416a01adab04c0944))
|
|
12
|
+
* **internal:** fix some typos ([#162](https://github.com/Pay-i/pay-i-python/issues/162)) ([5ef33a3](https://github.com/Pay-i/pay-i-python/commit/5ef33a34129c147183ddc746373dd99721741b4c))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Documentation
|
|
16
|
+
|
|
17
|
+
* **readme:** example snippet for client context manager ([#161](https://github.com/Pay-i/pay-i-python/issues/161)) ([bcbbfa5](https://github.com/Pay-i/pay-i-python/commit/bcbbfa5ce1d75ab4d8cc9a7b2b2d85ae69a13277))
|
|
18
|
+
|
|
19
|
+
## 0.1.0-alpha.32 (2024-12-10)
|
|
20
|
+
|
|
21
|
+
Full Changelog: [v0.1.0-alpha.31...v0.1.0-alpha.32](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.31...v0.1.0-alpha.32)
|
|
22
|
+
|
|
23
|
+
### Chores
|
|
24
|
+
|
|
25
|
+
* **internal:** bump pydantic dependency ([#154](https://github.com/Pay-i/pay-i-python/issues/154)) ([c2187c5](https://github.com/Pay-i/pay-i-python/commit/c2187c501a445cf1fbeff1d3ca97508c30232236))
|
|
26
|
+
* make the `Omit` type public ([#152](https://github.com/Pay-i/pay-i-python/issues/152)) ([def0371](https://github.com/Pay-i/pay-i-python/commit/def0371c51b545d0109ca8473aa4242a35094e3c))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Documentation
|
|
30
|
+
|
|
31
|
+
* **readme:** fix http client proxies example ([#155](https://github.com/Pay-i/pay-i-python/issues/155)) ([7eb2bf7](https://github.com/Pay-i/pay-i-python/commit/7eb2bf7e1147968cf5ed67c28a1c155694b69e28))
|
|
32
|
+
|
|
3
33
|
## 0.1.0-alpha.31 (2024-12-03)
|
|
4
34
|
|
|
5
35
|
Full Changelog: [v0.1.0-alpha.30...v0.1.0-alpha.31](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.30...v0.1.0-alpha.31)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: payi
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.0a33
|
|
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
|
|
7
7
|
Author-email: Payi <support@payi.com>
|
|
8
|
-
License: Apache-2.0
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
9
10
|
Classifier: Intended Audience :: Developers
|
|
10
11
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
12
|
Classifier: Operating System :: MacOS
|
|
@@ -26,7 +27,7 @@ Requires-Dist: distro<2,>=1.7.0
|
|
|
26
27
|
Requires-Dist: httpx<1,>=0.23.0
|
|
27
28
|
Requires-Dist: pydantic<3,>=1.9.0
|
|
28
29
|
Requires-Dist: sniffio
|
|
29
|
-
Requires-Dist: typing-extensions<5,>=4.
|
|
30
|
+
Requires-Dist: typing-extensions<5,>=4.10
|
|
30
31
|
Description-Content-Type: text/markdown
|
|
31
32
|
|
|
32
33
|
# Payi Python API library
|
|
@@ -314,18 +315,19 @@ can also get all the extra fields on the Pydantic model as a dict with
|
|
|
314
315
|
|
|
315
316
|
You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
|
|
316
317
|
|
|
317
|
-
- Support for proxies
|
|
318
|
-
- Custom transports
|
|
318
|
+
- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
|
|
319
|
+
- Custom [transports](https://www.python-httpx.org/advanced/transports/)
|
|
319
320
|
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
|
|
320
321
|
|
|
321
322
|
```python
|
|
323
|
+
import httpx
|
|
322
324
|
from payi import Payi, DefaultHttpxClient
|
|
323
325
|
|
|
324
326
|
client = Payi(
|
|
325
327
|
# Or use the `PAYI_BASE_URL` env var
|
|
326
328
|
base_url="http://my.test.server.example.com:8083",
|
|
327
329
|
http_client=DefaultHttpxClient(
|
|
328
|
-
|
|
330
|
+
proxy="http://my.test.proxy.example.com",
|
|
329
331
|
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
330
332
|
),
|
|
331
333
|
)
|
|
@@ -341,6 +343,16 @@ client.with_options(http_client=DefaultHttpxClient(...))
|
|
|
341
343
|
|
|
342
344
|
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.
|
|
343
345
|
|
|
346
|
+
```py
|
|
347
|
+
from payi import Payi
|
|
348
|
+
|
|
349
|
+
with Payi() as client:
|
|
350
|
+
# make requests here
|
|
351
|
+
...
|
|
352
|
+
|
|
353
|
+
# HTTP client is now closed
|
|
354
|
+
```
|
|
355
|
+
|
|
344
356
|
## Versioning
|
|
345
357
|
|
|
346
358
|
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:
|
|
@@ -283,18 +283,19 @@ can also get all the extra fields on the Pydantic model as a dict with
|
|
|
283
283
|
|
|
284
284
|
You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
|
|
285
285
|
|
|
286
|
-
- Support for proxies
|
|
287
|
-
- Custom transports
|
|
286
|
+
- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
|
|
287
|
+
- Custom [transports](https://www.python-httpx.org/advanced/transports/)
|
|
288
288
|
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
|
|
289
289
|
|
|
290
290
|
```python
|
|
291
|
+
import httpx
|
|
291
292
|
from payi import Payi, DefaultHttpxClient
|
|
292
293
|
|
|
293
294
|
client = Payi(
|
|
294
295
|
# Or use the `PAYI_BASE_URL` env var
|
|
295
296
|
base_url="http://my.test.server.example.com:8083",
|
|
296
297
|
http_client=DefaultHttpxClient(
|
|
297
|
-
|
|
298
|
+
proxy="http://my.test.proxy.example.com",
|
|
298
299
|
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
299
300
|
),
|
|
300
301
|
)
|
|
@@ -310,6 +311,16 @@ client.with_options(http_client=DefaultHttpxClient(...))
|
|
|
310
311
|
|
|
311
312
|
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.
|
|
312
313
|
|
|
314
|
+
```py
|
|
315
|
+
from payi import Payi
|
|
316
|
+
|
|
317
|
+
with Payi() as client:
|
|
318
|
+
# make requests here
|
|
319
|
+
...
|
|
320
|
+
|
|
321
|
+
# HTTP client is now closed
|
|
322
|
+
```
|
|
323
|
+
|
|
313
324
|
## Versioning
|
|
314
325
|
|
|
315
326
|
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:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "payi"
|
|
3
|
-
version = "0.1.0-alpha.
|
|
3
|
+
version = "0.1.0-alpha.33"
|
|
4
4
|
description = "The official Python library for the payi API"
|
|
5
5
|
dynamic = ["readme"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -10,7 +10,7 @@ authors = [
|
|
|
10
10
|
dependencies = [
|
|
11
11
|
"httpx>=0.23.0, <1",
|
|
12
12
|
"pydantic>=1.9.0, <3",
|
|
13
|
-
"typing-extensions>=4.
|
|
13
|
+
"typing-extensions>=4.10, <5",
|
|
14
14
|
"anyio>=3.5.0, <5",
|
|
15
15
|
"distro>=1.7.0, <2",
|
|
16
16
|
"sniffio",
|
|
@@ -62,13 +62,13 @@ platformdirs==3.11.0
|
|
|
62
62
|
# via virtualenv
|
|
63
63
|
pluggy==1.5.0
|
|
64
64
|
# via pytest
|
|
65
|
-
pydantic==2.
|
|
65
|
+
pydantic==2.10.3
|
|
66
66
|
# via payi
|
|
67
|
-
pydantic-core==2.
|
|
67
|
+
pydantic-core==2.27.1
|
|
68
68
|
# via pydantic
|
|
69
69
|
pygments==2.18.0
|
|
70
70
|
# via rich
|
|
71
|
-
pyright==1.1.
|
|
71
|
+
pyright==1.1.390
|
|
72
72
|
pytest==8.3.3
|
|
73
73
|
# via pytest-asyncio
|
|
74
74
|
pytest-asyncio==0.24.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
from . import types
|
|
4
|
-
from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes
|
|
4
|
+
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
|
|
5
5
|
from ._utils import file_from_path
|
|
6
6
|
from ._client import Payi, Client, Stream, Timeout, AsyncPayi, Transport, AsyncClient, AsyncStream, RequestOptions
|
|
7
7
|
from ._models import BaseModel
|
|
@@ -36,6 +36,7 @@ __all__ = [
|
|
|
36
36
|
"ProxiesTypes",
|
|
37
37
|
"NotGiven",
|
|
38
38
|
"NOT_GIVEN",
|
|
39
|
+
"Omit",
|
|
39
40
|
"PayiError",
|
|
40
41
|
"APIError",
|
|
41
42
|
"APIStatusError",
|
|
@@ -8,7 +8,7 @@ from typing_extensions import Self, override
|
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
10
10
|
|
|
11
|
-
from . import
|
|
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.budgets import budgets
|
|
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:
|
|
50
|
-
ingest:
|
|
51
|
-
categories:
|
|
52
|
-
experiences:
|
|
53
|
-
billing_models:
|
|
54
|
-
price_modifiers:
|
|
55
|
-
requests:
|
|
44
|
+
budgets: budgets.BudgetsResource
|
|
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 =
|
|
114
|
-
self.ingest =
|
|
115
|
-
self.categories =
|
|
116
|
-
self.experiences =
|
|
117
|
-
self.billing_models =
|
|
118
|
-
self.price_modifiers =
|
|
119
|
-
self.requests =
|
|
108
|
+
self.budgets = budgets.BudgetsResource(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:
|
|
230
|
-
ingest:
|
|
231
|
-
categories:
|
|
232
|
-
experiences:
|
|
233
|
-
billing_models:
|
|
234
|
-
price_modifiers:
|
|
235
|
-
requests:
|
|
224
|
+
budgets: budgets.AsyncBudgetsResource
|
|
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 =
|
|
294
|
-
self.ingest =
|
|
295
|
-
self.categories =
|
|
296
|
-
self.experiences =
|
|
297
|
-
self.billing_models =
|
|
298
|
-
self.price_modifiers =
|
|
299
|
-
self.requests =
|
|
288
|
+
self.budgets = budgets.AsyncBudgetsResource(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 =
|
|
411
|
-
self.ingest =
|
|
412
|
-
self.categories =
|
|
413
|
-
self.experiences =
|
|
414
|
-
self.billing_models =
|
|
415
|
-
self.price_modifiers =
|
|
416
|
-
self.requests =
|
|
405
|
+
self.budgets = budgets.BudgetsResourceWithRawResponse(client.budgets)
|
|
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 =
|
|
422
|
-
self.ingest =
|
|
423
|
-
self.categories =
|
|
424
|
-
self.experiences =
|
|
425
|
-
self.billing_models =
|
|
426
|
-
self.price_modifiers =
|
|
427
|
-
self.requests =
|
|
416
|
+
self.budgets = budgets.AsyncBudgetsResourceWithRawResponse(client.budgets)
|
|
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 =
|
|
433
|
-
self.ingest =
|
|
434
|
-
self.categories =
|
|
435
|
-
self.experiences =
|
|
436
|
-
self.billing_models =
|
|
437
|
-
self.price_modifiers =
|
|
438
|
-
self.requests =
|
|
427
|
+
self.budgets = budgets.BudgetsResourceWithStreamingResponse(client.budgets)
|
|
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 =
|
|
444
|
-
self.ingest =
|
|
445
|
-
self.categories =
|
|
446
|
-
self.experiences =
|
|
447
|
-
self.billing_models =
|
|
448
|
-
self.price_modifiers =
|
|
449
|
-
self.requests =
|
|
438
|
+
self.budgets = budgets.AsyncBudgetsResourceWithStreamingResponse(client.budgets)
|
|
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
|
|
@@ -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_):
|
|
@@ -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
|
|
131
|
-
|
|
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=
|
|
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
|
|
|
@@ -192,10 +192,8 @@ ResponseT = TypeVar(
|
|
|
192
192
|
StrBytesIntFloat = Union[str, bytes, int, float]
|
|
193
193
|
|
|
194
194
|
# Note: copied from Pydantic
|
|
195
|
-
# https://github.com/pydantic/pydantic/blob/
|
|
196
|
-
IncEx: TypeAlias = Union[
|
|
197
|
-
Set[int], Set[str], Mapping[int, Union["IncEx", Literal[True]]], Mapping[str, Union["IncEx", Literal[True]]]
|
|
198
|
-
]
|
|
195
|
+
# https://github.com/pydantic/pydantic/blob/6f31f8f68ef011f84357330186f603ff295312fd/pydantic/main.py#L79
|
|
196
|
+
IncEx: TypeAlias = Union[Set[int], Set[str], Mapping[int, Union["IncEx", bool]], Mapping[str, Union["IncEx", bool]]]
|
|
199
197
|
|
|
200
198
|
PostParser = Callable[[Any], Any]
|
|
201
199
|
|
|
@@ -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
|
)
|
|
@@ -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
|
|
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):
|
|
@@ -342,11 +342,11 @@ class TestPayi:
|
|
|
342
342
|
FinalRequestOptions(
|
|
343
343
|
method="get",
|
|
344
344
|
url="/foo",
|
|
345
|
-
params={"foo": "baz", "query_param": "
|
|
345
|
+
params={"foo": "baz", "query_param": "overridden"},
|
|
346
346
|
)
|
|
347
347
|
)
|
|
348
348
|
url = httpx.URL(request.url)
|
|
349
|
-
assert dict(url.params) == {"foo": "baz", "query_param": "
|
|
349
|
+
assert dict(url.params) == {"foo": "baz", "query_param": "overridden"}
|
|
350
350
|
|
|
351
351
|
def test_request_extra_json(self) -> None:
|
|
352
352
|
request = self.client._build_request(
|
|
@@ -1106,11 +1106,11 @@ class TestAsyncPayi:
|
|
|
1106
1106
|
FinalRequestOptions(
|
|
1107
1107
|
method="get",
|
|
1108
1108
|
url="/foo",
|
|
1109
|
-
params={"foo": "baz", "query_param": "
|
|
1109
|
+
params={"foo": "baz", "query_param": "overridden"},
|
|
1110
1110
|
)
|
|
1111
1111
|
)
|
|
1112
1112
|
url = httpx.URL(request.url)
|
|
1113
|
-
assert dict(url.params) == {"foo": "baz", "query_param": "
|
|
1113
|
+
assert dict(url.params) == {"foo": "baz", "query_param": "overridden"}
|
|
1114
1114
|
|
|
1115
1115
|
def test_request_extra_json(self) -> None:
|
|
1116
1116
|
request = self.client._build_request(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from typing import Any, Dict, List, Union, Optional, cast
|
|
3
3
|
from datetime import datetime, timezone
|
|
4
|
-
from typing_extensions import Literal, Annotated
|
|
4
|
+
from typing_extensions import Literal, Annotated, TypeAliasType
|
|
5
5
|
|
|
6
6
|
import pytest
|
|
7
7
|
import pydantic
|
|
@@ -828,3 +828,19 @@ def test_discriminated_unions_invalid_data_uses_cache() -> None:
|
|
|
828
828
|
# if the discriminator details object stays the same between invocations then
|
|
829
829
|
# we hit the cache
|
|
830
830
|
assert UnionType.__discriminator__ is discriminator
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1")
|
|
834
|
+
def test_type_alias_type() -> None:
|
|
835
|
+
Alias = TypeAliasType("Alias", str)
|
|
836
|
+
|
|
837
|
+
class Model(BaseModel):
|
|
838
|
+
alias: Alias
|
|
839
|
+
union: Union[int, Alias]
|
|
840
|
+
|
|
841
|
+
m = construct_type(value={"alias": "foo", "union": "bar"}, type_=Model)
|
|
842
|
+
assert isinstance(m, Model)
|
|
843
|
+
assert isinstance(m.alias, str)
|
|
844
|
+
assert m.alias == "foo"
|
|
845
|
+
assert isinstance(m.union, str)
|
|
846
|
+
assert m.union == "bar"
|
|
@@ -16,6 +16,7 @@ from payi._utils import (
|
|
|
16
16
|
is_union_type,
|
|
17
17
|
extract_type_arg,
|
|
18
18
|
is_annotated_type,
|
|
19
|
+
is_type_alias_type,
|
|
19
20
|
)
|
|
20
21
|
from payi._compat import PYDANTIC_V2, field_outer_type, get_model_fields
|
|
21
22
|
from payi._models import BaseModel
|
|
@@ -51,6 +52,9 @@ def assert_matches_type(
|
|
|
51
52
|
path: list[str],
|
|
52
53
|
allow_none: bool = False,
|
|
53
54
|
) -> None:
|
|
55
|
+
if is_type_alias_type(type_):
|
|
56
|
+
type_ = type_.__value__
|
|
57
|
+
|
|
54
58
|
# unwrap `Annotated[T, ...]` -> `T`
|
|
55
59
|
if is_annotated_type(type_):
|
|
56
60
|
type_ = extract_type_arg(type_, 0)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|