payi 0.1.0a4__tar.gz → 0.1.0a6__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 (92) hide show
  1. {payi-0.1.0a4 → payi-0.1.0a6}/.gitignore +1 -0
  2. payi-0.1.0a6/.release-please-manifest.json +3 -0
  3. {payi-0.1.0a4 → payi-0.1.0a6}/CHANGELOG.md +17 -0
  4. {payi-0.1.0a4 → payi-0.1.0a6}/PKG-INFO +1 -1
  5. {payi-0.1.0a4 → payi-0.1.0a6}/pyproject.toml +1 -1
  6. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_utils/__init__.py +4 -1
  7. payi-0.1.0a6/src/payi/_utils/_reflection.py +42 -0
  8. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_version.py +1 -1
  9. payi-0.1.0a6/src/payi/lib/helpers.py +32 -0
  10. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/resources/ingest.py +40 -8
  11. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/ingest_units_params.py +2 -2
  12. {payi-0.1.0a4 → payi-0.1.0a6}/tests/api_resources/test_ingest.py +4 -4
  13. payi-0.1.0a4/.release-please-manifest.json +0 -3
  14. payi-0.1.0a4/src/payi/_utils/_reflection.py +0 -8
  15. {payi-0.1.0a4 → payi-0.1.0a6}/CONTRIBUTING.md +0 -0
  16. {payi-0.1.0a4 → payi-0.1.0a6}/LICENSE +0 -0
  17. {payi-0.1.0a4 → payi-0.1.0a6}/README.md +0 -0
  18. {payi-0.1.0a4 → payi-0.1.0a6}/SECURITY.md +0 -0
  19. {payi-0.1.0a4 → payi-0.1.0a6}/api.md +0 -0
  20. {payi-0.1.0a4 → payi-0.1.0a6}/bin/check-release-environment +0 -0
  21. {payi-0.1.0a4 → payi-0.1.0a6}/bin/publish-pypi +0 -0
  22. {payi-0.1.0a4 → payi-0.1.0a6}/examples/.keep +0 -0
  23. {payi-0.1.0a4 → payi-0.1.0a6}/mypy.ini +0 -0
  24. {payi-0.1.0a4 → payi-0.1.0a6}/noxfile.py +0 -0
  25. {payi-0.1.0a4 → payi-0.1.0a6}/release-please-config.json +0 -0
  26. {payi-0.1.0a4 → payi-0.1.0a6}/requirements-dev.lock +0 -0
  27. {payi-0.1.0a4 → payi-0.1.0a6}/requirements.lock +0 -0
  28. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/__init__.py +0 -0
  29. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_base_client.py +0 -0
  30. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_client.py +0 -0
  31. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_compat.py +0 -0
  32. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_constants.py +0 -0
  33. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_exceptions.py +0 -0
  34. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_files.py +0 -0
  35. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_models.py +0 -0
  36. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_qs.py +0 -0
  37. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_resource.py +0 -0
  38. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_response.py +0 -0
  39. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_streaming.py +0 -0
  40. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_types.py +0 -0
  41. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_utils/_logs.py +0 -0
  42. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_utils/_proxy.py +0 -0
  43. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_utils/_streams.py +0 -0
  44. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_utils/_sync.py +0 -0
  45. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_utils/_transform.py +0 -0
  46. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_utils/_typing.py +0 -0
  47. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/_utils/_utils.py +0 -0
  48. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/lib/.keep +0 -0
  49. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/py.typed +0 -0
  50. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/resources/__init__.py +0 -0
  51. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/resources/budgets/__init__.py +0 -0
  52. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/resources/budgets/budgets.py +0 -0
  53. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/resources/budgets/tags.py +0 -0
  54. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/__init__.py +0 -0
  55. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budget_create_params.py +0 -0
  56. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budget_history_response.py +0 -0
  57. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budget_list_params.py +0 -0
  58. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budget_response.py +0 -0
  59. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budget_update_params.py +0 -0
  60. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budgets/__init__.py +0 -0
  61. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budgets/budget_tags_response.py +0 -0
  62. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budgets/tag_create_params.py +0 -0
  63. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budgets/tag_create_response.py +0 -0
  64. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budgets/tag_delete_response.py +0 -0
  65. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budgets/tag_list_response.py +0 -0
  66. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budgets/tag_remove_params.py +0 -0
  67. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budgets/tag_remove_response.py +0 -0
  68. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budgets/tag_update_params.py +0 -0
  69. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/budgets/tag_update_response.py +0 -0
  70. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/default_response.py +0 -0
  71. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/paged_budget_list.py +0 -0
  72. {payi-0.1.0a4 → payi-0.1.0a6}/src/payi/types/successful_proxy_result.py +0 -0
  73. {payi-0.1.0a4 → payi-0.1.0a6}/tests/__init__.py +0 -0
  74. {payi-0.1.0a4 → payi-0.1.0a6}/tests/api_resources/__init__.py +0 -0
  75. {payi-0.1.0a4 → payi-0.1.0a6}/tests/api_resources/budgets/__init__.py +0 -0
  76. {payi-0.1.0a4 → payi-0.1.0a6}/tests/api_resources/budgets/test_tags.py +0 -0
  77. {payi-0.1.0a4 → payi-0.1.0a6}/tests/api_resources/test_budgets.py +0 -0
  78. {payi-0.1.0a4 → payi-0.1.0a6}/tests/conftest.py +0 -0
  79. {payi-0.1.0a4 → payi-0.1.0a6}/tests/sample_file.txt +0 -0
  80. {payi-0.1.0a4 → payi-0.1.0a6}/tests/test_client.py +0 -0
  81. {payi-0.1.0a4 → payi-0.1.0a6}/tests/test_deepcopy.py +0 -0
  82. {payi-0.1.0a4 → payi-0.1.0a6}/tests/test_extract_files.py +0 -0
  83. {payi-0.1.0a4 → payi-0.1.0a6}/tests/test_files.py +0 -0
  84. {payi-0.1.0a4 → payi-0.1.0a6}/tests/test_models.py +0 -0
  85. {payi-0.1.0a4 → payi-0.1.0a6}/tests/test_qs.py +0 -0
  86. {payi-0.1.0a4 → payi-0.1.0a6}/tests/test_required_args.py +0 -0
  87. {payi-0.1.0a4 → payi-0.1.0a6}/tests/test_response.py +0 -0
  88. {payi-0.1.0a4 → payi-0.1.0a6}/tests/test_streaming.py +0 -0
  89. {payi-0.1.0a4 → payi-0.1.0a6}/tests/test_transform.py +0 -0
  90. {payi-0.1.0a4 → payi-0.1.0a6}/tests/test_utils/test_proxy.py +0 -0
  91. {payi-0.1.0a4 → payi-0.1.0a6}/tests/test_utils/test_typing.py +0 -0
  92. {payi-0.1.0a4 → payi-0.1.0a6}/tests/utils.py +0 -0
@@ -1,3 +1,4 @@
1
+ .prism.log
1
2
  .vscode
2
3
  _dev
3
4
 
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.0-alpha.6"
3
+ }
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.6 (2024-06-30)
4
+
5
+ Full Changelog: [v0.1.0-alpha.5...v0.1.0-alpha.6](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.5...v0.1.0-alpha.6)
6
+
7
+ ### Features
8
+
9
+ * **api:** update via SDK Studio ([#21](https://github.com/Pay-i/pay-i-python/issues/21)) ([daa4259](https://github.com/Pay-i/pay-i-python/commit/daa4259dc2156dd84843d3264362a6a53ee842c4))
10
+
11
+ ## 0.1.0-alpha.5 (2024-06-28)
12
+
13
+ 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)
14
+
15
+ ### Features
16
+
17
+ * change ingest bugdet_ids and request_tags from str -> list[str] ([bb70818](https://github.com/Pay-i/pay-i-python/commit/bb7081850e14648db2ad753a0aef461cdd7b1940))
18
+ * update types and tests ([02af29a](https://github.com/Pay-i/pay-i-python/commit/02af29aa209c434083c3ea335ccfc80450deda8c))
19
+
3
20
  ## 0.1.0-alpha.4 (2024-06-27)
4
21
 
5
22
  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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: payi
3
- Version: 0.1.0a4
3
+ Version: 0.1.0a6
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "payi"
3
- version = "0.1.0-alpha.4"
3
+ version = "0.1.0-alpha.6"
4
4
  description = "The official Python library for the payi API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -49,4 +49,7 @@ from ._transform import (
49
49
  maybe_transform as maybe_transform,
50
50
  async_maybe_transform as async_maybe_transform,
51
51
  )
52
- from ._reflection import function_has_argument as function_has_argument
52
+ from ._reflection import (
53
+ function_has_argument as function_has_argument,
54
+ assert_signatures_in_sync as assert_signatures_in_sync,
55
+ )
@@ -0,0 +1,42 @@
1
+ from __future__ import annotations
2
+
3
+ import inspect
4
+ from typing import Any, Callable
5
+
6
+
7
+ def function_has_argument(func: Callable[..., Any], arg_name: str) -> bool:
8
+ """Returns whether or not the given function has a specific parameter"""
9
+ sig = inspect.signature(func)
10
+ return arg_name in sig.parameters
11
+
12
+
13
+ def assert_signatures_in_sync(
14
+ source_func: Callable[..., Any],
15
+ check_func: Callable[..., Any],
16
+ *,
17
+ exclude_params: set[str] = set(),
18
+ ) -> None:
19
+ """Ensure that the signature of the second function matches the first."""
20
+
21
+ check_sig = inspect.signature(check_func)
22
+ source_sig = inspect.signature(source_func)
23
+
24
+ errors: list[str] = []
25
+
26
+ for name, source_param in source_sig.parameters.items():
27
+ if name in exclude_params:
28
+ continue
29
+
30
+ custom_param = check_sig.parameters.get(name)
31
+ if not custom_param:
32
+ errors.append(f"the `{name}` param is missing")
33
+ continue
34
+
35
+ if custom_param.annotation != source_param.annotation:
36
+ errors.append(
37
+ f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(source_param.annotation)}"
38
+ )
39
+ continue
40
+
41
+ if errors:
42
+ raise AssertionError(f"{len(errors)} errors encountered when comparing signatures:\n\n" + "\n\n".join(errors))
@@ -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.4" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.6" # x-release-please-version
@@ -0,0 +1,32 @@
1
+ # Step 1: Define the new methods outside of the Payi class definition
2
+ from typing import Dict, List, Union
3
+
4
+
5
+ def create_budget_header_from_ids(budget_ids: List[str]) -> Dict[str, str]:
6
+ if not isinstance(budget_ids, list): # type: ignore
7
+ raise TypeError("budget_ids must be a list")
8
+
9
+ valid_ids = [id.strip() for id in budget_ids if isinstance(id, str) and id.strip()] # type: ignore
10
+
11
+ return {"xProxy-Budget-IDs": ",".join(valid_ids)} if valid_ids else {}
12
+
13
+ def create_request_header_from_tags(request_tags: List[str]) -> Dict[str, str]:
14
+ if not isinstance(request_tags, list): # type: ignore
15
+ raise TypeError("request_tags must be a list")
16
+
17
+ valid_tags = [tag.strip() for tag in request_tags if isinstance(tag, str) and tag.strip()] # type: ignore
18
+
19
+ return {"xProxy-Request-Tags": ",".join(valid_tags)} if valid_tags else {}
20
+
21
+ def create_headers(
22
+ budget_ids: Union[List[str], None] = None,
23
+ request_tags: Union[List[str], None] = None
24
+ ) -> Dict[str, str]:
25
+ headers: Dict[str, str] = {}
26
+
27
+ if budget_ids:
28
+ headers.update(create_budget_header_from_ids(budget_ids))
29
+ if request_tags:
30
+ headers.update(create_request_header_from_tags(request_tags))
31
+
32
+ return headers
@@ -43,8 +43,8 @@ class IngestResource(SyncAPIResource):
43
43
  input: int,
44
44
  output: int,
45
45
  resource: str,
46
- budget_ids: str | NotGiven = NOT_GIVEN,
47
- request_tags: str | NotGiven = NOT_GIVEN,
46
+ budget_ids: list[str] | NotGiven = NOT_GIVEN,
47
+ request_tags: list[str] | NotGiven = NOT_GIVEN,
48
48
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
49
49
  # The extra values given here take precedence over values defined on the client or passed to this method.
50
50
  extra_headers: Headers | None = None,
@@ -64,11 +64,27 @@ class IngestResource(SyncAPIResource):
64
64
 
65
65
  timeout: Override the client-level default timeout for this request, in seconds
66
66
  """
67
+ valid_ids_str: str | NotGiven = NOT_GIVEN
68
+ valid_tags_str: str | NotGiven = NOT_GIVEN
69
+
70
+ if isinstance(budget_ids, NotGiven):
71
+ valid_ids_str = NOT_GIVEN
72
+ else:
73
+ # Proceed with the list comprehension if budget_ids is not NotGiven
74
+ valid_ids = [id.strip() for id in budget_ids if id.strip()]
75
+ valid_ids_str = ",".join(valid_ids) if valid_ids else NOT_GIVEN
76
+ if isinstance(request_tags, NotGiven):
77
+ valid_tags_str = NOT_GIVEN
78
+ else:
79
+ # Proceed with the list comprehension if budget_ids is not NotGiven
80
+ valid_tags = [tag.strip() for tag in request_tags if tag.strip()]
81
+ valid_tags_str = ",".join(valid_tags) if valid_tags else NOT_GIVEN
82
+
67
83
  extra_headers = {
68
84
  **strip_not_given(
69
85
  {
70
- "xProxy-Budget-IDs": budget_ids,
71
- "xProxy-Request-Tags": request_tags,
86
+ "xProxy-Budget-IDs": valid_ids_str,
87
+ "xProxy-Request-Tags": valid_tags_str,
72
88
  }
73
89
  ),
74
90
  **(extra_headers or {}),
@@ -107,8 +123,8 @@ class AsyncIngestResource(AsyncAPIResource):
107
123
  input: int,
108
124
  output: int,
109
125
  resource: str,
110
- budget_ids: str | NotGiven = NOT_GIVEN,
111
- request_tags: str | NotGiven = NOT_GIVEN,
126
+ budget_ids: list[str] | NotGiven = NOT_GIVEN,
127
+ request_tags: list[str] | NotGiven = NOT_GIVEN,
112
128
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
113
129
  # The extra values given here take precedence over values defined on the client or passed to this method.
114
130
  extra_headers: Headers | None = None,
@@ -128,11 +144,27 @@ class AsyncIngestResource(AsyncAPIResource):
128
144
 
129
145
  timeout: Override the client-level default timeout for this request, in seconds
130
146
  """
147
+ valid_ids_str: str | NotGiven = NOT_GIVEN
148
+ valid_tags_str: str | NotGiven = NOT_GIVEN
149
+
150
+ if isinstance(budget_ids, NotGiven):
151
+ valid_ids_str = NOT_GIVEN
152
+ else:
153
+ # Proceed with the list comprehension if budget_ids is not NotGiven
154
+ valid_ids = [id.strip() for id in budget_ids if id.strip()]
155
+ valid_ids_str = ",".join(valid_ids) if valid_ids else NOT_GIVEN
156
+ if isinstance(request_tags, NotGiven):
157
+ valid_tags_str = NOT_GIVEN
158
+ else:
159
+ # Proceed with the list comprehension if budget_ids is not NotGiven
160
+ valid_tags = [tag.strip() for tag in request_tags if tag.strip()]
161
+ valid_tags_str = ",".join(valid_tags) if valid_tags else NOT_GIVEN
162
+
131
163
  extra_headers = {
132
164
  **strip_not_given(
133
165
  {
134
- "xProxy-Budget-IDs": budget_ids,
135
- "xProxy-Request-Tags": request_tags,
166
+ "xProxy-Budget-IDs": valid_ids_str,
167
+ "xProxy-Request-Tags": valid_tags_str,
136
168
  }
137
169
  ),
138
170
  **(extra_headers or {}),
@@ -18,6 +18,6 @@ class IngestUnitsParams(TypedDict, total=False):
18
18
 
19
19
  resource: Required[str]
20
20
 
21
- budget_ids: Annotated[str, PropertyInfo(alias="xProxy-Budget-IDs")]
21
+ budget_ids: Annotated[list[str], PropertyInfo(alias="xProxy-Budget-IDs")]
22
22
 
23
- request_tags: Annotated[str, PropertyInfo(alias="xProxy-Request-Tags")]
23
+ request_tags: Annotated[list[str], PropertyInfo(alias="xProxy-Request-Tags")]
@@ -34,8 +34,8 @@ class TestIngest:
34
34
  input=1,
35
35
  output=1,
36
36
  resource="x",
37
- budget_ids="budgetId1, budgetId_2",
38
- request_tags="requestTag1, request_tag_2",
37
+ budget_ids=["budgetId1", "budgetId_2"],
38
+ request_tags=["requestTag1", "request_tag_2"],
39
39
  )
40
40
  assert_matches_type(SuccessfulProxyResult, ingest, path=["response"])
41
41
 
@@ -90,8 +90,8 @@ class TestAsyncIngest:
90
90
  input=1,
91
91
  output=1,
92
92
  resource="x",
93
- budget_ids="budgetId1, budgetId_2",
94
- request_tags="requestTag1, request_tag_2",
93
+ budget_ids=["budgetId1", "budgetId_2"],
94
+ request_tags=["requestTag1", "request_tag_2"],
95
95
  )
96
96
  assert_matches_type(SuccessfulProxyResult, ingest, path=["response"])
97
97
 
@@ -1,3 +0,0 @@
1
- {
2
- ".": "0.1.0-alpha.4"
3
- }
@@ -1,8 +0,0 @@
1
- import inspect
2
- from typing import Any, Callable
3
-
4
-
5
- def function_has_argument(func: Callable[..., Any], arg_name: str) -> bool:
6
- """Returns whether or not the given function has a specific parameter"""
7
- sig = inspect.signature(func)
8
- return arg_name in sig.parameters
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