payi 0.1.0a3__tar.gz → 0.1.0a5__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 (89) hide show
  1. payi-0.1.0a5/.release-please-manifest.json +3 -0
  2. payi-0.1.0a5/CHANGELOG.md +53 -0
  3. payi-0.1.0a5/CONTRIBUTING.md +125 -0
  4. {payi-0.1.0a3 → payi-0.1.0a5}/PKG-INFO +1 -1
  5. payi-0.1.0a5/README.md +321 -0
  6. payi-0.1.0a5/SECURITY.md +27 -0
  7. payi-0.1.0a5/api.md +51 -0
  8. payi-0.1.0a5/bin/check-release-environment +32 -0
  9. payi-0.1.0a5/bin/publish-pypi +9 -0
  10. payi-0.1.0a5/examples/.keep +4 -0
  11. payi-0.1.0a5/mypy.ini +47 -0
  12. payi-0.1.0a5/noxfile.py +9 -0
  13. {payi-0.1.0a3 → payi-0.1.0a5}/pyproject.toml +16 -1
  14. payi-0.1.0a5/release-please-config.json +66 -0
  15. payi-0.1.0a5/requirements-dev.lock +97 -0
  16. payi-0.1.0a5/requirements.lock +44 -0
  17. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_version.py +1 -1
  18. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/resources/ingest.py +48 -12
  19. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/ingest_units_params.py +6 -10
  20. payi-0.1.0a5/tests/__init__.py +1 -0
  21. payi-0.1.0a5/tests/api_resources/__init__.py +1 -0
  22. payi-0.1.0a5/tests/api_resources/budgets/__init__.py +1 -0
  23. payi-0.1.0a5/tests/api_resources/budgets/test_tags.py +432 -0
  24. payi-0.1.0a5/tests/api_resources/test_budgets.py +523 -0
  25. payi-0.1.0a5/tests/api_resources/test_ingest.py +126 -0
  26. payi-0.1.0a5/tests/conftest.py +49 -0
  27. payi-0.1.0a5/tests/sample_file.txt +1 -0
  28. payi-0.1.0a5/tests/test_client.py +1470 -0
  29. payi-0.1.0a5/tests/test_deepcopy.py +59 -0
  30. payi-0.1.0a5/tests/test_extract_files.py +64 -0
  31. payi-0.1.0a5/tests/test_files.py +51 -0
  32. payi-0.1.0a5/tests/test_models.py +829 -0
  33. payi-0.1.0a5/tests/test_qs.py +78 -0
  34. payi-0.1.0a5/tests/test_required_args.py +111 -0
  35. payi-0.1.0a5/tests/test_response.py +194 -0
  36. payi-0.1.0a5/tests/test_streaming.py +248 -0
  37. payi-0.1.0a5/tests/test_transform.py +410 -0
  38. payi-0.1.0a5/tests/test_utils/test_proxy.py +23 -0
  39. payi-0.1.0a5/tests/test_utils/test_typing.py +78 -0
  40. payi-0.1.0a5/tests/utils.py +151 -0
  41. {payi-0.1.0a3 → payi-0.1.0a5}/.gitignore +0 -0
  42. {payi-0.1.0a3 → payi-0.1.0a5}/LICENSE +0 -0
  43. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/__init__.py +0 -0
  44. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_base_client.py +0 -0
  45. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_client.py +0 -0
  46. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_compat.py +0 -0
  47. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_constants.py +0 -0
  48. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_exceptions.py +0 -0
  49. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_files.py +0 -0
  50. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_models.py +0 -0
  51. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_qs.py +0 -0
  52. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_resource.py +0 -0
  53. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_response.py +0 -0
  54. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_streaming.py +0 -0
  55. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_types.py +0 -0
  56. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_utils/__init__.py +0 -0
  57. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_utils/_logs.py +0 -0
  58. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_utils/_proxy.py +0 -0
  59. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_utils/_reflection.py +0 -0
  60. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_utils/_streams.py +0 -0
  61. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_utils/_sync.py +0 -0
  62. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_utils/_transform.py +0 -0
  63. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_utils/_typing.py +0 -0
  64. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/_utils/_utils.py +0 -0
  65. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/lib/.keep +0 -0
  66. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/py.typed +0 -0
  67. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/resources/__init__.py +0 -0
  68. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/resources/budgets/__init__.py +0 -0
  69. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/resources/budgets/budgets.py +0 -0
  70. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/resources/budgets/tags.py +0 -0
  71. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/__init__.py +0 -0
  72. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budget_create_params.py +0 -0
  73. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budget_history_response.py +0 -0
  74. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budget_list_params.py +0 -0
  75. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budget_response.py +0 -0
  76. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budget_update_params.py +0 -0
  77. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budgets/__init__.py +0 -0
  78. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budgets/budget_tags_response.py +0 -0
  79. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budgets/tag_create_params.py +0 -0
  80. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budgets/tag_create_response.py +0 -0
  81. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budgets/tag_delete_response.py +0 -0
  82. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budgets/tag_list_response.py +0 -0
  83. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budgets/tag_remove_params.py +0 -0
  84. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budgets/tag_remove_response.py +0 -0
  85. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budgets/tag_update_params.py +0 -0
  86. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/budgets/tag_update_response.py +0 -0
  87. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/default_response.py +0 -0
  88. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/paged_budget_list.py +0 -0
  89. {payi-0.1.0a3 → payi-0.1.0a5}/src/payi/types/successful_proxy_result.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.0-alpha.5"
3
+ }
@@ -0,0 +1,53 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0-alpha.5 (2024-06-28)
4
+
5
+ Full Changelog: [v0.1.0-alpha.4...v0.1.0-alpha.5](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.4...v0.1.0-alpha.5)
6
+
7
+ ### Features
8
+
9
+ * change ingest bugdet_ids and request_tags from str -> list[str] ([bb70818](https://github.com/Pay-i/pay-i-python/commit/bb7081850e14648db2ad753a0aef461cdd7b1940))
10
+ * update types and tests ([02af29a](https://github.com/Pay-i/pay-i-python/commit/02af29aa209c434083c3ea335ccfc80450deda8c))
11
+
12
+ ## 0.1.0-alpha.4 (2024-06-27)
13
+
14
+ Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)
15
+
16
+ ### Features
17
+
18
+ * **api:** update via SDK Studio ([#13](https://github.com/Pay-i/pay-i-python/issues/13)) ([c35a02e](https://github.com/Pay-i/pay-i-python/commit/c35a02e163c67c320566bc77fb24bb6cdd8b4bf6))
19
+
20
+ ## 0.1.0-alpha.3 (2024-06-27)
21
+
22
+ Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
23
+
24
+ ### Features
25
+
26
+ * fix ([cffc96b](https://github.com/Pay-i/pay-i-python/commit/cffc96b700565b99a9d1b171e7aa820a3a41fb0a))
27
+ * test rename of autogenerated parameter name ([53b0e7d](https://github.com/Pay-i/pay-i-python/commit/53b0e7dd2f37573d9683c4aa0c3a86de6d0e3dea))
28
+
29
+ ## 0.1.0-alpha.2 (2024-06-27)
30
+
31
+ Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
32
+
33
+ ### Features
34
+
35
+ * **api:** update via SDK Studio ([#4](https://github.com/Pay-i/pay-i-python/issues/4)) ([08bb37c](https://github.com/Pay-i/pay-i-python/commit/08bb37c7ab580b1c0d6adf12f3745191e9023455))
36
+
37
+ ## 0.1.0-alpha.1 (2024-06-27)
38
+
39
+ Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/Pay-i/pay-i-python/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
40
+
41
+ ### Features
42
+
43
+ * **api:** update via SDK Studio ([ba34638](https://github.com/Pay-i/pay-i-python/commit/ba3463802b7366b450058f6ccdb13419b3bdbfe1))
44
+ * **api:** update via SDK Studio ([d87c30c](https://github.com/Pay-i/pay-i-python/commit/d87c30c4d5c3d7dee3a4b96596c8df9e319ca690))
45
+ * **api:** update via SDK Studio ([96d12c3](https://github.com/Pay-i/pay-i-python/commit/96d12c3c114642a13469ece184eaec8feee50b1a))
46
+ * **api:** update via SDK Studio ([ba169b1](https://github.com/Pay-i/pay-i-python/commit/ba169b1e70894cb2a2f0497e4781121a334716cd))
47
+
48
+
49
+ ### Chores
50
+
51
+ * go live ([#2](https://github.com/Pay-i/pay-i-python/issues/2)) ([81ba939](https://github.com/Pay-i/pay-i-python/commit/81ba93934fc18d2ac642af4ce1a7772996cb5030))
52
+ * update SDK settings ([8ff0351](https://github.com/Pay-i/pay-i-python/commit/8ff0351ba46df46381eb41cf4eadf655ddb82049))
53
+ * update SDK settings ([441d968](https://github.com/Pay-i/pay-i-python/commit/441d9681112eae338ced67f5186a4a2e371cb99c))
@@ -0,0 +1,125 @@
1
+ ## Setting up the environment
2
+
3
+ ### With Rye
4
+
5
+ We use [Rye](https://rye.astral.sh/) to manage dependencies so we highly recommend [installing it](https://rye.astral.sh/guide/installation/) as it will automatically provision a Python environment with the expected Python version.
6
+
7
+ After installing Rye, you'll just have to run this command:
8
+
9
+ ```sh
10
+ $ rye sync --all-features
11
+ ```
12
+
13
+ You can then run scripts using `rye run python script.py` or by activating the virtual environment:
14
+
15
+ ```sh
16
+ $ rye shell
17
+ # or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
18
+ $ source .venv/bin/activate
19
+
20
+ # now you can omit the `rye run` prefix
21
+ $ python script.py
22
+ ```
23
+
24
+ ### Without Rye
25
+
26
+ Alternatively if you don't want to install `Rye`, you can stick with the standard `pip` setup by ensuring you have the Python version specified in `.python-version`, create a virtual environment however you desire and then install dependencies using this command:
27
+
28
+ ```sh
29
+ $ pip install -r requirements-dev.lock
30
+ ```
31
+
32
+ ## Modifying/Adding code
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.
36
+
37
+ ## Adding and running examples
38
+
39
+ All files in the `examples/` directory are not modified by the Stainless generator and can be freely edited or
40
+ added to.
41
+
42
+ ```bash
43
+ # add an example to examples/<your-example>.py
44
+
45
+ #!/usr/bin/env -S rye run python
46
+
47
+ ```
48
+
49
+ ```
50
+ chmod +x examples/<your-example>.py
51
+ # run the example against your api
52
+ ./examples/<your-example>.py
53
+ ```
54
+
55
+ ## Using the repository from source
56
+
57
+ If you’d like to use the repository from source, you can either install from git or link to a cloned repository:
58
+
59
+ To install via git:
60
+
61
+ ```bash
62
+ pip install git+ssh://git@github.com/Pay-i/pay-i-python.git
63
+ ```
64
+
65
+ Alternatively, you can build from source and install the wheel file:
66
+
67
+ Building this package will create two files in the `dist/` directory, a `.tar.gz` containing the source files and a `.whl` that can be used to install the package efficiently.
68
+
69
+ To create a distributable version of the library, all you have to do is run this command:
70
+
71
+ ```bash
72
+ rye build
73
+ # or
74
+ python -m build
75
+ ```
76
+
77
+ Then to install:
78
+
79
+ ```sh
80
+ pip install ./path-to-wheel-file.whl
81
+ ```
82
+
83
+ ## Running tests
84
+
85
+ Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
86
+
87
+ ```bash
88
+ # you will need npm installed
89
+ npx prism mock path/to/your/openapi.yml
90
+ ```
91
+
92
+ ```bash
93
+ rye run pytest
94
+ ```
95
+
96
+ ## Linting and formatting
97
+
98
+ This repository uses [ruff](https://github.com/astral-sh/ruff) and
99
+ [black](https://github.com/psf/black) to format the code in the repository.
100
+
101
+ To lint:
102
+
103
+ ```bash
104
+ rye run lint
105
+ ```
106
+
107
+ To format and fix all ruff issues automatically:
108
+
109
+ ```bash
110
+ rye run format
111
+ ```
112
+
113
+ ## Publishing and releases
114
+
115
+ Changes made to this repository via the automated release PR pipeline should publish to PyPI automatically. If
116
+ the changes aren't made through the automated pipeline, you may want to make releases manually.
117
+
118
+ ### Publish with a GitHub workflow
119
+
120
+ You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/Pay-i/pay-i-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
121
+
122
+ ### Publish manually
123
+
124
+ If you need to manually release a package, you can run the `bin/publish-pypi` script with a `PYPI_TOKEN` set on
125
+ the environment.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: payi
3
- Version: 0.1.0a3
3
+ Version: 0.1.0a5
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
payi-0.1.0a5/README.md ADDED
@@ -0,0 +1,321 @@
1
+ # Payi Python API library
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/payi.svg)](https://pypi.org/project/payi/)
4
+
5
+ The Payi Python library provides convenient access to the Payi REST API from any Python 3.7+
6
+ application. The library includes type definitions for all request params and response fields,
7
+ and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
8
+
9
+ It is generated with [Stainless](https://www.stainlessapi.com/).
10
+
11
+ ## Documentation
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).
14
+
15
+ ## Installation
16
+
17
+ ```sh
18
+ # install from PyPI
19
+ pip install --pre payi
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ The full API of this library can be found in [api.md](api.md).
25
+
26
+ ```python
27
+ import os
28
+ from payi import Payi
29
+
30
+ client = Payi(
31
+ # This is the default and can be omitted
32
+ payi_api_key=os.environ.get("PAYI_API_KEY"),
33
+ )
34
+
35
+ budget_response = client.budgets.create(
36
+ budget_name="x",
37
+ max=0,
38
+ )
39
+ print(budget_response.request_id)
40
+ ```
41
+
42
+ While you can provide a `payi_api_key` keyword argument,
43
+ we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
44
+ to add `PAYI_API_KEY="My Payi API Key"` to your `.env` file
45
+ so that your Payi API Key is not stored in source control.
46
+
47
+ ## Async usage
48
+
49
+ Simply import `AsyncPayi` instead of `Payi` and use `await` with each API call:
50
+
51
+ ```python
52
+ import os
53
+ import asyncio
54
+ from payi import AsyncPayi
55
+
56
+ client = AsyncPayi(
57
+ # This is the default and can be omitted
58
+ payi_api_key=os.environ.get("PAYI_API_KEY"),
59
+ )
60
+
61
+
62
+ async def main() -> None:
63
+ budget_response = await client.budgets.create(
64
+ budget_name="x",
65
+ max=0,
66
+ )
67
+ print(budget_response.request_id)
68
+
69
+
70
+ asyncio.run(main())
71
+ ```
72
+
73
+ Functionality between the synchronous and asynchronous clients is otherwise identical.
74
+
75
+ ## Using types
76
+
77
+ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
78
+
79
+ - Serializing back into JSON, `model.to_json()`
80
+ - Converting to a dictionary, `model.to_dict()`
81
+
82
+ Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
83
+
84
+ ## Handling errors
85
+
86
+ When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `payi.APIConnectionError` is raised.
87
+
88
+ When the API returns a non-success status code (that is, 4xx or 5xx
89
+ response), a subclass of `payi.APIStatusError` is raised, containing `status_code` and `response` properties.
90
+
91
+ All errors inherit from `payi.APIError`.
92
+
93
+ ```python
94
+ import payi
95
+ from payi import Payi
96
+
97
+ client = Payi()
98
+
99
+ try:
100
+ client.budgets.create(
101
+ budget_name="x",
102
+ max=0,
103
+ )
104
+ except payi.APIConnectionError as e:
105
+ print("The server could not be reached")
106
+ print(e.__cause__) # an underlying Exception, likely raised within httpx.
107
+ except payi.RateLimitError as e:
108
+ print("A 429 status code was received; we should back off a bit.")
109
+ except payi.APIStatusError as e:
110
+ print("Another non-200-range status code was received")
111
+ print(e.status_code)
112
+ print(e.response)
113
+ ```
114
+
115
+ Error codes are as followed:
116
+
117
+ | Status Code | Error Type |
118
+ | ----------- | -------------------------- |
119
+ | 400 | `BadRequestError` |
120
+ | 401 | `AuthenticationError` |
121
+ | 403 | `PermissionDeniedError` |
122
+ | 404 | `NotFoundError` |
123
+ | 422 | `UnprocessableEntityError` |
124
+ | 429 | `RateLimitError` |
125
+ | >=500 | `InternalServerError` |
126
+ | N/A | `APIConnectionError` |
127
+
128
+ ### Retries
129
+
130
+ Certain errors are automatically retried 2 times by default, with a short exponential backoff.
131
+ Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
132
+ 429 Rate Limit, and >=500 Internal errors are all retried by default.
133
+
134
+ You can use the `max_retries` option to configure or disable retry settings:
135
+
136
+ ```python
137
+ from payi import Payi
138
+
139
+ # Configure the default for all requests:
140
+ client = Payi(
141
+ # default is 2
142
+ max_retries=0,
143
+ )
144
+
145
+ # Or, configure per-request:
146
+ client.with_options(max_retries=5).budgets.create(
147
+ budget_name="x",
148
+ max=0,
149
+ )
150
+ ```
151
+
152
+ ### Timeouts
153
+
154
+ By default requests time out after 1 minute. You can configure this with a `timeout` option,
155
+ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
156
+
157
+ ```python
158
+ from payi import Payi
159
+
160
+ # Configure the default for all requests:
161
+ client = Payi(
162
+ # 20 seconds (default is 1 minute)
163
+ timeout=20.0,
164
+ )
165
+
166
+ # More granular control:
167
+ client = Payi(
168
+ timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
169
+ )
170
+
171
+ # Override per-request:
172
+ client.with_options(timeout=5.0).budgets.create(
173
+ budget_name="x",
174
+ max=0,
175
+ )
176
+ ```
177
+
178
+ On timeout, an `APITimeoutError` is thrown.
179
+
180
+ Note that requests that time out are [retried twice by default](#retries).
181
+
182
+ ## Advanced
183
+
184
+ ### Logging
185
+
186
+ We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
187
+
188
+ You can enable logging by setting the environment variable `PAYI_LOG` to `debug`.
189
+
190
+ ```shell
191
+ $ export PAYI_LOG=debug
192
+ ```
193
+
194
+ ### How to tell whether `None` means `null` or missing
195
+
196
+ In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:
197
+
198
+ ```py
199
+ if response.my_field is None:
200
+ if 'my_field' not in response.model_fields_set:
201
+ print('Got json like {}, without a "my_field" key present at all.')
202
+ else:
203
+ print('Got json like {"my_field": null}.')
204
+ ```
205
+
206
+ ### Accessing raw response data (e.g. headers)
207
+
208
+ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
209
+
210
+ ```py
211
+ from payi import Payi
212
+
213
+ client = Payi()
214
+ response = client.budgets.with_raw_response.create(
215
+ budget_name="x",
216
+ max=0,
217
+ )
218
+ print(response.headers.get('X-My-Header'))
219
+
220
+ budget = response.parse() # get the object that `budgets.create()` would have returned
221
+ print(budget.request_id)
222
+ ```
223
+
224
+ These methods return an [`APIResponse`](https://github.com/Pay-i/pay-i-python/tree/main/src/payi/_response.py) object.
225
+
226
+ The async client returns an [`AsyncAPIResponse`](https://github.com/Pay-i/pay-i-python/tree/main/src/payi/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
227
+
228
+ #### `.with_streaming_response`
229
+
230
+ The above interface eagerly reads the full response body when you make the request, which may not always be what you want.
231
+
232
+ To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
233
+
234
+ ```python
235
+ with client.budgets.with_streaming_response.create(
236
+ budget_name="x",
237
+ max=0,
238
+ ) as response:
239
+ print(response.headers.get("X-My-Header"))
240
+
241
+ for line in response.iter_lines():
242
+ print(line)
243
+ ```
244
+
245
+ The context manager is required so that the response will reliably be closed.
246
+
247
+ ### Making custom/undocumented requests
248
+
249
+ This library is typed for convenient access to the documented API.
250
+
251
+ If you need to access undocumented endpoints, params, or response properties, the library can still be used.
252
+
253
+ #### Undocumented endpoints
254
+
255
+ To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
256
+ http verbs. Options on the client will be respected (such as retries) will be respected when making this
257
+ request.
258
+
259
+ ```py
260
+ import httpx
261
+
262
+ response = client.post(
263
+ "/foo",
264
+ cast_to=httpx.Response,
265
+ body={"my_param": True},
266
+ )
267
+
268
+ print(response.headers.get("x-foo"))
269
+ ```
270
+
271
+ #### Undocumented request params
272
+
273
+ If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request
274
+ options.
275
+
276
+ #### Undocumented response properties
277
+
278
+ To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You
279
+ can also get all the extra fields on the Pydantic model as a dict with
280
+ [`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).
281
+
282
+ ### Configuring the HTTP client
283
+
284
+ You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
285
+
286
+ - Support for proxies
287
+ - Custom transports
288
+ - Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
289
+
290
+ ```python
291
+ from payi import Payi, DefaultHttpxClient
292
+
293
+ client = Payi(
294
+ # Or use the `PAYI_BASE_URL` env var
295
+ base_url="http://my.test.server.example.com:8083",
296
+ http_client=DefaultHttpxClient(
297
+ proxies="http://my.test.proxy.example.com",
298
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
299
+ ),
300
+ )
301
+ ```
302
+
303
+ ### Managing HTTP resources
304
+
305
+ 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.
306
+
307
+ ## Versioning
308
+
309
+ 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:
310
+
311
+ 1. Changes that only affect static types, without breaking runtime behavior.
312
+ 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
313
+ 3. Changes that we do not expect to impact the vast majority of users in practice.
314
+
315
+ We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
316
+
317
+ 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.
318
+
319
+ ## Requirements
320
+
321
+ Python 3.7 or higher.
@@ -0,0 +1,27 @@
1
+ # Security Policy
2
+
3
+ ## Reporting Security Issues
4
+
5
+ This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
6
+
7
+ To report a security issue, please contact the Stainless team at security@stainlessapi.com.
8
+
9
+ ## Responsible Disclosure
10
+
11
+ We appreciate the efforts of security researchers and individuals who help us maintain the security of
12
+ SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible
13
+ disclosure practices by allowing us a reasonable amount of time to investigate and address the issue
14
+ before making any information public.
15
+
16
+ ## Reporting Non-SDK Related Security Issues
17
+
18
+ If you encounter security issues that are not directly related to SDKs but pertain to the services
19
+ or products provided by Payi please follow the respective company's security reporting guidelines.
20
+
21
+ ### Payi Terms and Policies
22
+
23
+ Please contact support@payi.com for any questions or concerns regarding security of our services.
24
+
25
+ ---
26
+
27
+ Thank you for helping us keep the SDKs and systems they interact with secure.
payi-0.1.0a5/api.md ADDED
@@ -0,0 +1,51 @@
1
+ # Budgets
2
+
3
+ Types:
4
+
5
+ ```python
6
+ from payi.types import BudgetHistoryResponse, BudgetResponse, DefaultResponse, PagedBudgetList
7
+ ```
8
+
9
+ Methods:
10
+
11
+ - <code title="post /api/v1/budgets">client.budgets.<a href="./src/payi/resources/budgets/budgets.py">create</a>(\*\*<a href="src/payi/types/budget_create_params.py">params</a>) -> <a href="./src/payi/types/budget_response.py">BudgetResponse</a></code>
12
+ - <code title="get /api/v1/budgets/{budget_id}">client.budgets.<a href="./src/payi/resources/budgets/budgets.py">retrieve</a>(budget_id) -> <a href="./src/payi/types/budget_response.py">BudgetResponse</a></code>
13
+ - <code title="put /api/v1/budgets/{budget_id}">client.budgets.<a href="./src/payi/resources/budgets/budgets.py">update</a>(budget_id, \*\*<a href="src/payi/types/budget_update_params.py">params</a>) -> <a href="./src/payi/types/budget_response.py">BudgetResponse</a></code>
14
+ - <code title="get /api/v1/budgets">client.budgets.<a href="./src/payi/resources/budgets/budgets.py">list</a>(\*\*<a href="src/payi/types/budget_list_params.py">params</a>) -> <a href="./src/payi/types/paged_budget_list.py">PagedBudgetList</a></code>
15
+ - <code title="delete /api/v1/budgets/{budget_id}">client.budgets.<a href="./src/payi/resources/budgets/budgets.py">delete</a>(budget_id) -> <a href="./src/payi/types/default_response.py">DefaultResponse</a></code>
16
+ - <code title="post /api/v1/budgets/{budget_id}/reset">client.budgets.<a href="./src/payi/resources/budgets/budgets.py">reset</a>(budget_id) -> <a href="./src/payi/types/budget_history_response.py">BudgetHistoryResponse</a></code>
17
+
18
+ ## Tags
19
+
20
+ Types:
21
+
22
+ ```python
23
+ from payi.types.budgets import (
24
+ BudgetTagsResponse,
25
+ TagCreateResponse,
26
+ TagUpdateResponse,
27
+ TagListResponse,
28
+ TagDeleteResponse,
29
+ TagRemoveResponse,
30
+ )
31
+ ```
32
+
33
+ Methods:
34
+
35
+ - <code title="post /api/v1/budgets/{budget_id}/tags">client.budgets.tags.<a href="./src/payi/resources/budgets/tags.py">create</a>(budget_id, \*\*<a href="src/payi/types/budgets/tag_create_params.py">params</a>) -> <a href="./src/payi/types/budgets/tag_create_response.py">TagCreateResponse</a></code>
36
+ - <code title="put /api/v1/budgets/{budget_id}/tags">client.budgets.tags.<a href="./src/payi/resources/budgets/tags.py">update</a>(budget_id, \*\*<a href="src/payi/types/budgets/tag_update_params.py">params</a>) -> <a href="./src/payi/types/budgets/tag_update_response.py">TagUpdateResponse</a></code>
37
+ - <code title="get /api/v1/budgets/{budget_id}/tags">client.budgets.tags.<a href="./src/payi/resources/budgets/tags.py">list</a>(budget_id) -> <a href="./src/payi/types/budgets/tag_list_response.py">TagListResponse</a></code>
38
+ - <code title="delete /api/v1/budgets/{budget_id}/tags">client.budgets.tags.<a href="./src/payi/resources/budgets/tags.py">delete</a>(budget_id) -> <a href="./src/payi/types/budgets/tag_delete_response.py">TagDeleteResponse</a></code>
39
+ - <code title="patch /api/v1/budgets/{budget_id}/tags/remove">client.budgets.tags.<a href="./src/payi/resources/budgets/tags.py">remove</a>(budget_id, \*\*<a href="src/payi/types/budgets/tag_remove_params.py">params</a>) -> <a href="./src/payi/types/budgets/tag_remove_response.py">TagRemoveResponse</a></code>
40
+
41
+ # Ingest
42
+
43
+ Types:
44
+
45
+ ```python
46
+ from payi.types import SuccessfulProxyResult
47
+ ```
48
+
49
+ Methods:
50
+
51
+ - <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/successful_proxy_result.py">SuccessfulProxyResult</a></code>
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env bash
2
+
3
+ warnings=()
4
+ errors=()
5
+
6
+ if [ -z "${PYPI_TOKEN}" ]; then
7
+ warnings+=("The PAYI_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
8
+ fi
9
+
10
+ lenWarnings=${#warnings[@]}
11
+
12
+ if [[ lenWarnings -gt 0 ]]; then
13
+ echo -e "Found the following warnings in the release environment:\n"
14
+
15
+ for warning in "${warnings[@]}"; do
16
+ echo -e "- $warning\n"
17
+ done
18
+ fi
19
+
20
+ lenErrors=${#errors[@]}
21
+
22
+ if [[ lenErrors -gt 0 ]]; then
23
+ echo -e "Found the following errors in the release environment:\n"
24
+
25
+ for error in "${errors[@]}"; do
26
+ echo -e "- $error\n"
27
+ done
28
+
29
+ exit 1
30
+ fi
31
+
32
+ echo "The environment is ready to push releases!"
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -eux
4
+ mkdir -p dist
5
+ rye build --clean
6
+ # Patching importlib-metadata version until upstream library version is updated
7
+ # https://github.com/pypa/twine/issues/977#issuecomment-2189800841
8
+ "$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1'
9
+ rye publish --yes --token=$PYPI_TOKEN
@@ -0,0 +1,4 @@
1
+ File generated from our OpenAPI spec by Stainless.
2
+
3
+ This directory can be used to store example files demonstrating usage of this SDK.
4
+ It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.