payi 0.1.0a14__tar.gz → 0.1.0a15__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 (114) hide show
  1. payi-0.1.0a15/.release-please-manifest.json +3 -0
  2. {payi-0.1.0a14 → payi-0.1.0a15}/CHANGELOG.md +10 -0
  3. {payi-0.1.0a14 → payi-0.1.0a15}/PKG-INFO +1 -1
  4. {payi-0.1.0a14 → payi-0.1.0a15}/api.md +4 -2
  5. {payi-0.1.0a14 → payi-0.1.0a15}/pyproject.toml +1 -1
  6. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_version.py +1 -1
  7. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/resources/budgets/budgets.py +2 -2
  8. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/resources/categories/resources.py +4 -4
  9. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/resources/ingest.py +102 -8
  10. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/__init__.py +5 -1
  11. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budget_create_params.py +1 -1
  12. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budget_history_response.py +3 -26
  13. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budget_response.py +3 -26
  14. payi-0.1.0a15/src/payi/types/bulk_ingest_response.py +44 -0
  15. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/categories/resource_create_params.py +2 -2
  16. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/category_resource_response.py +2 -2
  17. payi-0.1.0a15/src/payi/types/ingest_bulk_params.py +14 -0
  18. payi-0.1.0a14/src/payi/types/proxy_result.py → payi-0.1.0a15/src/payi/types/ingest_response.py +15 -6
  19. payi-0.1.0a15/src/payi/types/ingest_units_param.py +23 -0
  20. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/paged_budget_list.py +3 -26
  21. payi-0.1.0a15/src/payi/types/total_cost_data.py +31 -0
  22. {payi-0.1.0a14 → payi-0.1.0a15}/tests/api_resources/categories/test_resources.py +2 -12
  23. {payi-0.1.0a14 → payi-0.1.0a15}/tests/api_resources/test_budgets.py +2 -2
  24. payi-0.1.0a15/tests/api_resources/test_ingest.py +363 -0
  25. payi-0.1.0a14/.release-please-manifest.json +0 -3
  26. payi-0.1.0a14/tests/api_resources/test_ingest.py +0 -129
  27. {payi-0.1.0a14 → payi-0.1.0a15}/.gitignore +0 -0
  28. {payi-0.1.0a14 → payi-0.1.0a15}/CONTRIBUTING.md +0 -0
  29. {payi-0.1.0a14 → payi-0.1.0a15}/LICENSE +0 -0
  30. {payi-0.1.0a14 → payi-0.1.0a15}/README.md +0 -0
  31. {payi-0.1.0a14 → payi-0.1.0a15}/SECURITY.md +0 -0
  32. {payi-0.1.0a14 → payi-0.1.0a15}/bin/check-release-environment +0 -0
  33. {payi-0.1.0a14 → payi-0.1.0a15}/bin/publish-pypi +0 -0
  34. {payi-0.1.0a14 → payi-0.1.0a15}/examples/.keep +0 -0
  35. {payi-0.1.0a14 → payi-0.1.0a15}/mypy.ini +0 -0
  36. {payi-0.1.0a14 → payi-0.1.0a15}/noxfile.py +0 -0
  37. {payi-0.1.0a14 → payi-0.1.0a15}/release-please-config.json +0 -0
  38. {payi-0.1.0a14 → payi-0.1.0a15}/requirements-dev.lock +0 -0
  39. {payi-0.1.0a14 → payi-0.1.0a15}/requirements.lock +0 -0
  40. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/__init__.py +0 -0
  41. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_base_client.py +0 -0
  42. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_client.py +0 -0
  43. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_compat.py +0 -0
  44. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_constants.py +0 -0
  45. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_exceptions.py +0 -0
  46. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_files.py +0 -0
  47. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_models.py +0 -0
  48. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_qs.py +0 -0
  49. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_resource.py +0 -0
  50. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_response.py +0 -0
  51. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_streaming.py +0 -0
  52. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_types.py +0 -0
  53. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_utils/__init__.py +0 -0
  54. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_utils/_logs.py +0 -0
  55. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_utils/_proxy.py +0 -0
  56. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_utils/_reflection.py +0 -0
  57. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_utils/_streams.py +0 -0
  58. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_utils/_sync.py +0 -0
  59. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_utils/_transform.py +0 -0
  60. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_utils/_typing.py +0 -0
  61. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/_utils/_utils.py +0 -0
  62. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/lib/.keep +0 -0
  63. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/lib/helpers.py +0 -0
  64. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/py.typed +0 -0
  65. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/resources/__init__.py +0 -0
  66. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/resources/budgets/__init__.py +0 -0
  67. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/resources/budgets/tags.py +0 -0
  68. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/resources/categories/__init__.py +0 -0
  69. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/resources/categories/categories.py +0 -0
  70. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budget_list_params.py +0 -0
  71. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budget_update_params.py +0 -0
  72. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budgets/__init__.py +0 -0
  73. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budgets/budget_tags.py +0 -0
  74. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budgets/tag_create_params.py +0 -0
  75. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budgets/tag_create_response.py +0 -0
  76. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budgets/tag_delete_response.py +0 -0
  77. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budgets/tag_list_response.py +0 -0
  78. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budgets/tag_remove_params.py +0 -0
  79. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budgets/tag_remove_response.py +0 -0
  80. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budgets/tag_update_params.py +0 -0
  81. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/budgets/tag_update_response.py +0 -0
  82. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/categories/__init__.py +0 -0
  83. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/categories/resource_list_response.py +0 -0
  84. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/category_delete_resource_response.py +0 -0
  85. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/category_delete_response.py +0 -0
  86. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/category_list_resources_response.py +0 -0
  87. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/category_list_response.py +0 -0
  88. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/category_response.py +0 -0
  89. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/cost_data.py +0 -0
  90. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/cost_details.py +0 -0
  91. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/default_response.py +0 -0
  92. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/ingest_units_params.py +0 -0
  93. {payi-0.1.0a14 → payi-0.1.0a15}/src/payi/types/requests_data.py +0 -0
  94. {payi-0.1.0a14 → payi-0.1.0a15}/tests/__init__.py +0 -0
  95. {payi-0.1.0a14 → payi-0.1.0a15}/tests/api_resources/__init__.py +0 -0
  96. {payi-0.1.0a14 → payi-0.1.0a15}/tests/api_resources/budgets/__init__.py +0 -0
  97. {payi-0.1.0a14 → payi-0.1.0a15}/tests/api_resources/budgets/test_tags.py +0 -0
  98. {payi-0.1.0a14 → payi-0.1.0a15}/tests/api_resources/categories/__init__.py +0 -0
  99. {payi-0.1.0a14 → payi-0.1.0a15}/tests/api_resources/test_categories.py +0 -0
  100. {payi-0.1.0a14 → payi-0.1.0a15}/tests/conftest.py +0 -0
  101. {payi-0.1.0a14 → payi-0.1.0a15}/tests/sample_file.txt +0 -0
  102. {payi-0.1.0a14 → payi-0.1.0a15}/tests/test_client.py +0 -0
  103. {payi-0.1.0a14 → payi-0.1.0a15}/tests/test_deepcopy.py +0 -0
  104. {payi-0.1.0a14 → payi-0.1.0a15}/tests/test_extract_files.py +0 -0
  105. {payi-0.1.0a14 → payi-0.1.0a15}/tests/test_files.py +0 -0
  106. {payi-0.1.0a14 → payi-0.1.0a15}/tests/test_models.py +0 -0
  107. {payi-0.1.0a14 → payi-0.1.0a15}/tests/test_qs.py +0 -0
  108. {payi-0.1.0a14 → payi-0.1.0a15}/tests/test_required_args.py +0 -0
  109. {payi-0.1.0a14 → payi-0.1.0a15}/tests/test_response.py +0 -0
  110. {payi-0.1.0a14 → payi-0.1.0a15}/tests/test_streaming.py +0 -0
  111. {payi-0.1.0a14 → payi-0.1.0a15}/tests/test_transform.py +0 -0
  112. {payi-0.1.0a14 → payi-0.1.0a15}/tests/test_utils/test_proxy.py +0 -0
  113. {payi-0.1.0a14 → payi-0.1.0a15}/tests/test_utils/test_typing.py +0 -0
  114. {payi-0.1.0a14 → payi-0.1.0a15}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.0-alpha.15"
3
+ }
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.15 (2024-08-06)
4
+
5
+ Full Changelog: [v0.1.0-alpha.14...v0.1.0-alpha.15](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.14...v0.1.0-alpha.15)
6
+
7
+ ### Features
8
+
9
+ * **api:** update via SDK Studio ([#63](https://github.com/Pay-i/pay-i-python/issues/63)) ([a38f132](https://github.com/Pay-i/pay-i-python/commit/a38f132cdbbbcac2c235c71cd758c38631b12a57))
10
+ * **api:** update via SDK Studio ([#65](https://github.com/Pay-i/pay-i-python/issues/65)) ([d32f303](https://github.com/Pay-i/pay-i-python/commit/d32f3032d3cb5854617e65e9766447d8ea08f41c))
11
+ * **api:** update via SDK Studio ([#66](https://github.com/Pay-i/pay-i-python/issues/66)) ([990a0cb](https://github.com/Pay-i/pay-i-python/commit/990a0cbcfb381f6f72530d869a7beaae6f9fed2d))
12
+
3
13
  ## 0.1.0-alpha.14 (2024-07-30)
4
14
 
5
15
  Full Changelog: [v0.1.0-alpha.13...v0.1.0-alpha.14](https://github.com/Pay-i/pay-i-python/compare/v0.1.0-alpha.13...v0.1.0-alpha.14)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: payi
3
- Version: 0.1.0a14
3
+ Version: 0.1.0a15
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
@@ -11,6 +11,7 @@ from payi.types import (
11
11
  DefaultResponse,
12
12
  PagedBudgetList,
13
13
  RequestsData,
14
+ TotalCostData,
14
15
  )
15
16
  ```
16
17
 
@@ -51,12 +52,13 @@ Methods:
51
52
  Types:
52
53
 
53
54
  ```python
54
- from payi.types import ProxyResult
55
+ from payi.types import BulkIngestResponse, IngestResponse, IngestUnits
55
56
  ```
56
57
 
57
58
  Methods:
58
59
 
59
- - <code title="post /api/v1/ingest">client.ingest.<a href="./src/payi/resources/ingest.py">units</a>(\*\*<a href="src/payi/types/ingest_units_params.py">params</a>) -> <a href="./src/payi/types/proxy_result.py">ProxyResult</a></code>
60
+ - <code title="post /api/v1/ingest/bulk">client.ingest.<a href="./src/payi/resources/ingest.py">bulk</a>(\*\*<a href="src/payi/types/ingest_bulk_params.py">params</a>) -> <a href="./src/payi/types/bulk_ingest_response.py">BulkIngestResponse</a></code>
61
+ - <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/ingest_response.py">IngestResponse</a></code>
60
62
 
61
63
  # Categories
62
64
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "payi"
3
- version = "0.1.0-alpha.14"
3
+ version = "0.1.0-alpha.15"
4
4
  description = "The official Python library for the payi API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -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.14" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.15" # x-release-please-version
@@ -57,7 +57,7 @@ class BudgetsResource(SyncAPIResource):
57
57
  budget_name: str,
58
58
  max: float,
59
59
  base_cost_estimate: Literal["max"] | NotGiven = NOT_GIVEN,
60
- billing_model_id: Optional[int] | NotGiven = NOT_GIVEN,
60
+ billing_model_id: Optional[str] | NotGiven = NOT_GIVEN,
61
61
  budget_response_type: Literal["block", "allow"] | NotGiven = NOT_GIVEN,
62
62
  budget_tags: Optional[List[str]] | NotGiven = NOT_GIVEN,
63
63
  budget_type: Literal["conservative", "liberal"] | NotGiven = NOT_GIVEN,
@@ -309,7 +309,7 @@ class AsyncBudgetsResource(AsyncAPIResource):
309
309
  budget_name: str,
310
310
  max: float,
311
311
  base_cost_estimate: Literal["max"] | NotGiven = NOT_GIVEN,
312
- billing_model_id: Optional[int] | NotGiven = NOT_GIVEN,
312
+ billing_model_id: Optional[str] | NotGiven = NOT_GIVEN,
313
313
  budget_response_type: Literal["block", "allow"] | NotGiven = NOT_GIVEN,
314
314
  budget_tags: Optional[List[str]] | NotGiven = NOT_GIVEN,
315
315
  budget_type: Literal["conservative", "liberal"] | NotGiven = NOT_GIVEN,
@@ -42,11 +42,11 @@ class ResourcesResource(SyncAPIResource):
42
42
  resource: str,
43
43
  *,
44
44
  category: str,
45
- start_timestamp: Union[str, datetime],
46
45
  input_price: float | NotGiven = NOT_GIVEN,
47
46
  max_input_units: int | NotGiven = NOT_GIVEN,
48
47
  max_output_units: int | NotGiven = NOT_GIVEN,
49
48
  output_price: float | NotGiven = NOT_GIVEN,
49
+ start_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
50
50
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
51
51
  # The extra values given here take precedence over values defined on the client or passed to this method.
52
52
  extra_headers: Headers | None = None,
@@ -74,11 +74,11 @@ class ResourcesResource(SyncAPIResource):
74
74
  f"/api/v1/categories/{category}/resources/{resource}",
75
75
  body=maybe_transform(
76
76
  {
77
- "start_timestamp": start_timestamp,
78
77
  "input_price": input_price,
79
78
  "max_input_units": max_input_units,
80
79
  "max_output_units": max_output_units,
81
80
  "output_price": output_price,
81
+ "start_timestamp": start_timestamp,
82
82
  },
83
83
  resource_create_params.ResourceCreateParams,
84
84
  ),
@@ -217,11 +217,11 @@ class AsyncResourcesResource(AsyncAPIResource):
217
217
  resource: str,
218
218
  *,
219
219
  category: str,
220
- start_timestamp: Union[str, datetime],
221
220
  input_price: float | NotGiven = NOT_GIVEN,
222
221
  max_input_units: int | NotGiven = NOT_GIVEN,
223
222
  max_output_units: int | NotGiven = NOT_GIVEN,
224
223
  output_price: float | NotGiven = NOT_GIVEN,
224
+ start_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
225
225
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
226
226
  # The extra values given here take precedence over values defined on the client or passed to this method.
227
227
  extra_headers: Headers | None = None,
@@ -249,11 +249,11 @@ class AsyncResourcesResource(AsyncAPIResource):
249
249
  f"/api/v1/categories/{category}/resources/{resource}",
250
250
  body=await async_maybe_transform(
251
251
  {
252
- "start_timestamp": start_timestamp,
253
252
  "input_price": input_price,
254
253
  "max_input_units": max_input_units,
255
254
  "max_output_units": max_output_units,
256
255
  "output_price": output_price,
256
+ "start_timestamp": start_timestamp,
257
257
  },
258
258
  resource_create_params.ResourceCreateParams,
259
259
  ),
@@ -2,12 +2,12 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Union
5
+ from typing import Dict, Union, Iterable, cast
6
6
  from datetime import datetime
7
7
 
8
8
  import httpx
9
9
 
10
- from ..types import ingest_units_params
10
+ from ..types import ingest_bulk_params, ingest_units_params
11
11
  from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
12
12
  from .._utils import (
13
13
  maybe_transform,
@@ -23,7 +23,9 @@ from .._response import (
23
23
  async_to_streamed_response_wrapper,
24
24
  )
25
25
  from .._base_client import make_request_options
26
- from ..types.proxy_result import ProxyResult
26
+ from ..types.ingest_response import IngestResponse
27
+ from ..types.ingest_units_param import IngestUnitsParam
28
+ from ..types.bulk_ingest_response import BulkIngestResponse
27
29
 
28
30
  __all__ = ["IngestResource", "AsyncIngestResource"]
29
31
 
@@ -37,6 +39,46 @@ class IngestResource(SyncAPIResource):
37
39
  def with_streaming_response(self) -> IngestResourceWithStreamingResponse:
38
40
  return IngestResourceWithStreamingResponse(self)
39
41
 
42
+ def bulk(
43
+ self,
44
+ *,
45
+ items: Iterable[IngestUnitsParam],
46
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
47
+ # The extra values given here take precedence over values defined on the client or passed to this method.
48
+ extra_headers: Headers | None = None,
49
+ extra_query: Query | None = None,
50
+ extra_body: Body | None = None,
51
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
52
+ ) -> BulkIngestResponse:
53
+ """
54
+ Bulk Ingest
55
+
56
+ Args:
57
+
58
+ items (Iterable[IngestUnitsParams]): The items to ingest
59
+
60
+ extra_headers: Send extra headers
61
+
62
+ extra_query: Add additional query parameters to the request
63
+
64
+ extra_body: Add additional JSON properties to the request
65
+
66
+ timeout: Override the client-level default timeout for this request, in seconds
67
+ """
68
+ return self._post(
69
+ "/api/v1/ingest/bulk",
70
+ body=cast(Dict[str, object], maybe_transform(
71
+ {
72
+ "items": items,
73
+ },
74
+ ingest_bulk_params.IngestBulkParams)
75
+ )["items"],
76
+ options=make_request_options(
77
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
78
+ ),
79
+ cast_to=BulkIngestResponse,
80
+ )
81
+
40
82
  def units(
41
83
  self,
42
84
  *,
@@ -53,7 +95,7 @@ class IngestResource(SyncAPIResource):
53
95
  extra_query: Query | None = None,
54
96
  extra_body: Body | None = None,
55
97
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
56
- ) -> ProxyResult:
98
+ ) -> IngestResponse:
57
99
  """
58
100
  Ingest a request
59
101
 
@@ -66,7 +108,7 @@ class IngestResource(SyncAPIResource):
66
108
 
67
109
  output (int): The number of output units
68
110
 
69
- event_timestamp: (datetime, None): The timestamp of the event. Defaults to None.
111
+ event_timestamp: (str, datetime, None): The timestamp of the event. Defaults to None.
70
112
 
71
113
  budget_ids (list[str], optional): The budget IDs to associate with the request. Defaults to None.
72
114
 
@@ -125,7 +167,7 @@ class IngestResource(SyncAPIResource):
125
167
  options=make_request_options(
126
168
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
127
169
  ),
128
- cast_to=ProxyResult,
170
+ cast_to=IngestResponse,
129
171
  )
130
172
 
131
173
 
@@ -138,6 +180,46 @@ class AsyncIngestResource(AsyncAPIResource):
138
180
  def with_streaming_response(self) -> AsyncIngestResourceWithStreamingResponse:
139
181
  return AsyncIngestResourceWithStreamingResponse(self)
140
182
 
183
+ async def bulk(
184
+ self,
185
+ *,
186
+ items: Iterable[IngestUnitsParam],
187
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
188
+ # The extra values given here take precedence over values defined on the client or passed to this method.
189
+ extra_headers: Headers | None = None,
190
+ extra_query: Query | None = None,
191
+ extra_body: Body | None = None,
192
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
193
+ ) -> BulkIngestResponse:
194
+ """
195
+ Bulk Ingest
196
+
197
+ Args:
198
+ items (Iterable[IngestUnitsParams]): The items to ingest
199
+
200
+ extra_headers: Send extra headers
201
+
202
+ extra_query: Add additional query parameters to the request
203
+
204
+ extra_body: Add additional JSON properties to the request
205
+
206
+ timeout: Override the client-level default timeout for this request, in seconds
207
+ """
208
+ return await self._post(
209
+ "/api/v1/ingest/bulk",
210
+ body= cast(Dict[str, object],
211
+ await async_maybe_transform(
212
+ {
213
+ "items": items,
214
+ },
215
+ ingest_bulk_params.IngestBulkParams)
216
+ )["items"],
217
+ options=make_request_options(
218
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
219
+ ),
220
+ cast_to=BulkIngestResponse,
221
+ )
222
+
141
223
  async def units(
142
224
  self,
143
225
  *,
@@ -154,7 +236,7 @@ class AsyncIngestResource(AsyncAPIResource):
154
236
  extra_query: Query | None = None,
155
237
  extra_body: Body | None = None,
156
238
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
157
- ) -> ProxyResult:
239
+ ) -> IngestResponse:
158
240
  """
159
241
  Ingest a request
160
242
 
@@ -226,7 +308,7 @@ class AsyncIngestResource(AsyncAPIResource):
226
308
  options=make_request_options(
227
309
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
228
310
  ),
229
- cast_to=ProxyResult,
311
+ cast_to=IngestResponse,
230
312
  )
231
313
 
232
314
 
@@ -234,6 +316,9 @@ class IngestResourceWithRawResponse:
234
316
  def __init__(self, ingest: IngestResource) -> None:
235
317
  self._ingest = ingest
236
318
 
319
+ self.bulk = to_raw_response_wrapper(
320
+ ingest.bulk,
321
+ )
237
322
  self.units = to_raw_response_wrapper(
238
323
  ingest.units,
239
324
  )
@@ -243,6 +328,9 @@ class AsyncIngestResourceWithRawResponse:
243
328
  def __init__(self, ingest: AsyncIngestResource) -> None:
244
329
  self._ingest = ingest
245
330
 
331
+ self.bulk = async_to_raw_response_wrapper(
332
+ ingest.bulk,
333
+ )
246
334
  self.units = async_to_raw_response_wrapper(
247
335
  ingest.units,
248
336
  )
@@ -252,6 +340,9 @@ class IngestResourceWithStreamingResponse:
252
340
  def __init__(self, ingest: IngestResource) -> None:
253
341
  self._ingest = ingest
254
342
 
343
+ self.bulk = to_streamed_response_wrapper(
344
+ ingest.bulk,
345
+ )
255
346
  self.units = to_streamed_response_wrapper(
256
347
  ingest.units,
257
348
  )
@@ -261,6 +352,9 @@ class AsyncIngestResourceWithStreamingResponse:
261
352
  def __init__(self, ingest: AsyncIngestResource) -> None:
262
353
  self._ingest = ingest
263
354
 
355
+ self.bulk = async_to_streamed_response_wrapper(
356
+ ingest.bulk,
357
+ )
264
358
  self.units = async_to_streamed_response_wrapper(
265
359
  ingest.units,
266
360
  )
@@ -4,16 +4,20 @@ from __future__ import annotations
4
4
 
5
5
  from .cost_data import CostData as CostData
6
6
  from .cost_details import CostDetails as CostDetails
7
- from .proxy_result import ProxyResult as ProxyResult
8
7
  from .requests_data import RequestsData as RequestsData
9
8
  from .budget_response import BudgetResponse as BudgetResponse
9
+ from .ingest_response import IngestResponse as IngestResponse
10
+ from .total_cost_data import TotalCostData as TotalCostData
10
11
  from .default_response import DefaultResponse as DefaultResponse
11
12
  from .category_response import CategoryResponse as CategoryResponse
12
13
  from .paged_budget_list import PagedBudgetList as PagedBudgetList
13
14
  from .budget_list_params import BudgetListParams as BudgetListParams
15
+ from .ingest_bulk_params import IngestBulkParams as IngestBulkParams
16
+ from .ingest_units_param import IngestUnitsParam as IngestUnitsParam
14
17
  from .ingest_units_params import IngestUnitsParams as IngestUnitsParams
15
18
  from .budget_create_params import BudgetCreateParams as BudgetCreateParams
16
19
  from .budget_update_params import BudgetUpdateParams as BudgetUpdateParams
20
+ from .bulk_ingest_response import BulkIngestResponse as BulkIngestResponse
17
21
  from .category_list_response import CategoryListResponse as CategoryListResponse
18
22
  from .budget_history_response import BudgetHistoryResponse as BudgetHistoryResponse
19
23
  from .category_delete_response import CategoryDeleteResponse as CategoryDeleteResponse
@@ -15,7 +15,7 @@ class BudgetCreateParams(TypedDict, total=False):
15
15
 
16
16
  base_cost_estimate: Literal["max"]
17
17
 
18
- billing_model_id: Optional[int]
18
+ billing_model_id: Optional[str]
19
19
 
20
20
  budget_response_type: Literal["block", "allow"]
21
21
 
@@ -5,32 +5,9 @@ from datetime import datetime
5
5
  from typing_extensions import Literal
6
6
 
7
7
  from .._models import BaseModel
8
- from .cost_data import CostData
9
- from .requests_data import RequestsData
8
+ from .total_cost_data import TotalCostData
10
9
 
11
- __all__ = ["BudgetHistoryResponse", "BudgetHistory", "BudgetHistoryTotals", "BudgetHistoryTotalsBudgetTransactions"]
12
-
13
-
14
- class BudgetHistoryTotalsBudgetTransactions(BaseModel):
15
- blocked: int
16
-
17
- blocked_external: int
18
-
19
- exceeded: int
20
-
21
- successful: int
22
-
23
- error: Optional[int] = None
24
-
25
- total: Optional[int] = None
26
-
27
-
28
- class BudgetHistoryTotals(BaseModel):
29
- cost: CostData
30
-
31
- requests: RequestsData
32
-
33
- budget_transactions: Optional[BudgetHistoryTotalsBudgetTransactions] = None
10
+ __all__ = ["BudgetHistoryResponse", "BudgetHistory"]
34
11
 
35
12
 
36
13
  class BudgetHistory(BaseModel):
@@ -50,7 +27,7 @@ class BudgetHistory(BaseModel):
50
27
 
51
28
  max: Optional[float] = None
52
29
 
53
- totals: Optional[BudgetHistoryTotals] = None
30
+ totals: Optional[TotalCostData] = None
54
31
 
55
32
 
56
33
  class BudgetHistoryResponse(BaseModel):
@@ -5,32 +5,9 @@ from datetime import datetime
5
5
  from typing_extensions import Literal
6
6
 
7
7
  from .._models import BaseModel
8
- from .cost_data import CostData
9
- from .requests_data import RequestsData
8
+ from .total_cost_data import TotalCostData
10
9
 
11
- __all__ = ["BudgetResponse", "Budget", "BudgetTotals", "BudgetTotalsBudgetTransactions"]
12
-
13
-
14
- class BudgetTotalsBudgetTransactions(BaseModel):
15
- blocked: int
16
-
17
- blocked_external: int
18
-
19
- exceeded: int
20
-
21
- successful: int
22
-
23
- error: Optional[int] = None
24
-
25
- total: Optional[int] = None
26
-
27
-
28
- class BudgetTotals(BaseModel):
29
- cost: CostData
30
-
31
- requests: RequestsData
32
-
33
- budget_transactions: Optional[BudgetTotalsBudgetTransactions] = None
10
+ __all__ = ["BudgetResponse", "Budget"]
34
11
 
35
12
 
36
13
  class Budget(BaseModel):
@@ -52,7 +29,7 @@ class Budget(BaseModel):
52
29
 
53
30
  max: float
54
31
 
55
- totals: BudgetTotals
32
+ totals: TotalCostData
56
33
 
57
34
  budget_tags: Optional[List[str]] = None
58
35
 
@@ -0,0 +1,44 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+ from datetime import datetime
5
+
6
+ from pydantic import Field as FieldInfo
7
+
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["BulkIngestResponse", "Error", "ErrorXproxyResult", "ErrorXproxyResultXproxyError"]
11
+
12
+
13
+ class ErrorXproxyResultXproxyError(BaseModel):
14
+ code: Optional[str] = None
15
+
16
+ message: Optional[str] = None
17
+
18
+
19
+ class ErrorXproxyResult(BaseModel):
20
+ message: str
21
+
22
+ status_code: int = FieldInfo(alias="statusCode")
23
+
24
+ xproxy_error: Optional[ErrorXproxyResultXproxyError] = None
25
+
26
+
27
+ class Error(BaseModel):
28
+ item_index: Optional[int] = None
29
+
30
+ xproxy_result: Optional[ErrorXproxyResult] = None
31
+
32
+
33
+ class BulkIngestResponse(BaseModel):
34
+ ingest_count: int
35
+
36
+ ingest_timestamp: datetime
37
+
38
+ request_id: str
39
+
40
+ error_count: Optional[int] = None
41
+
42
+ errors: Optional[List[Error]] = None
43
+
44
+ total_count: Optional[int] = None
@@ -14,8 +14,6 @@ __all__ = ["ResourceCreateParams"]
14
14
  class ResourceCreateParams(TypedDict, total=False):
15
15
  category: Required[str]
16
16
 
17
- start_timestamp: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]]
18
-
19
17
  input_price: float
20
18
 
21
19
  max_input_units: int
@@ -23,3 +21,5 @@ class ResourceCreateParams(TypedDict, total=False):
23
21
  max_output_units: int
24
22
 
25
23
  output_price: float
24
+
25
+ start_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
@@ -13,8 +13,6 @@ class CategoryResourceResponse(BaseModel):
13
13
 
14
14
  resource: str
15
15
 
16
- start_timestamp: datetime
17
-
18
16
  input_price: Optional[float] = None
19
17
 
20
18
  max_input_units: Optional[int] = None
@@ -22,3 +20,5 @@ class CategoryResourceResponse(BaseModel):
22
20
  max_output_units: Optional[int] = None
23
21
 
24
22
  output_price: Optional[float] = None
23
+
24
+ start_timestamp: Optional[datetime] = None
@@ -0,0 +1,14 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Iterable
6
+ from typing_extensions import Required, TypedDict
7
+
8
+ from .ingest_units_param import IngestUnitsParam
9
+
10
+ __all__ = ["IngestBulkParams"]
11
+
12
+
13
+ class IngestBulkParams(TypedDict, total=False):
14
+ items: Required[Iterable[IngestUnitsParam]]
@@ -1,19 +1,20 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  from typing import Dict, List, Optional
4
+ from datetime import datetime
4
5
  from typing_extensions import Literal
5
6
 
6
7
  from .._models import BaseModel
7
8
  from .cost_details import CostDetails
8
9
 
9
- __all__ = ["ProxyResult", "Budgets", "Cost"]
10
+ __all__ = ["IngestResponse", "XproxyResult", "XproxyResultBudgets", "XproxyResultCost"]
10
11
 
11
12
 
12
- class Budgets(BaseModel):
13
+ class XproxyResultBudgets(BaseModel):
13
14
  state: Optional[Literal["ok", "blocked", "blocked_external", "exceeded", "failed"]] = None
14
15
 
15
16
 
16
- class Cost(BaseModel):
17
+ class XproxyResultCost(BaseModel):
17
18
  currency: Optional[Literal["usd"]] = None
18
19
 
19
20
  input: Optional[CostDetails] = None
@@ -23,11 +24,19 @@ class Cost(BaseModel):
23
24
  total: Optional[CostDetails] = None
24
25
 
25
26
 
26
- class ProxyResult(BaseModel):
27
- budgets: Optional[Dict[str, Budgets]] = None
27
+ class XproxyResult(BaseModel):
28
+ budgets: Optional[Dict[str, XproxyResultBudgets]] = None
28
29
 
29
- cost: Optional[Cost] = None
30
+ cost: Optional[XproxyResultCost] = None
30
31
 
31
32
  request_id: Optional[str] = None
32
33
 
33
34
  request_tags: Optional[List[str]] = None
35
+
36
+
37
+ class IngestResponse(BaseModel):
38
+ ingest_timestamp: datetime
39
+
40
+ request_id: str
41
+
42
+ xproxy_result: XproxyResult
@@ -0,0 +1,23 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Union
6
+ from datetime import datetime
7
+ from typing_extensions import Required, Annotated, TypedDict
8
+
9
+ from .._utils import PropertyInfo
10
+
11
+ __all__ = ["IngestUnitsParam"]
12
+
13
+
14
+ class IngestUnitsParam(TypedDict, total=False):
15
+ category: Required[str]
16
+
17
+ input: Required[int]
18
+
19
+ output: Required[int]
20
+
21
+ resource: Required[str]
22
+
23
+ event_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
@@ -7,32 +7,9 @@ from typing_extensions import Literal
7
7
  from pydantic import Field as FieldInfo
8
8
 
9
9
  from .._models import BaseModel
10
- from .cost_data import CostData
11
- from .requests_data import RequestsData
10
+ from .total_cost_data import TotalCostData
12
11
 
13
- __all__ = ["PagedBudgetList", "Item", "ItemTotals", "ItemTotalsBudgetTransactions"]
14
-
15
-
16
- class ItemTotalsBudgetTransactions(BaseModel):
17
- blocked: int
18
-
19
- blocked_external: int
20
-
21
- exceeded: int
22
-
23
- successful: int
24
-
25
- error: Optional[int] = None
26
-
27
- total: Optional[int] = None
28
-
29
-
30
- class ItemTotals(BaseModel):
31
- cost: CostData
32
-
33
- requests: RequestsData
34
-
35
- budget_transactions: Optional[ItemTotalsBudgetTransactions] = None
12
+ __all__ = ["PagedBudgetList", "Item"]
36
13
 
37
14
 
38
15
  class Item(BaseModel):
@@ -54,7 +31,7 @@ class Item(BaseModel):
54
31
 
55
32
  max: float
56
33
 
57
- totals: ItemTotals
34
+ totals: TotalCostData
58
35
 
59
36
  budget_tags: Optional[List[str]] = None
60
37