payi 0.1.0a55__py3-none-any.whl → 0.1.0a57__py3-none-any.whl

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 (59) hide show
  1. payi/_client.py +10 -17
  2. payi/_models.py +1 -1
  3. payi/_utils/_transform.py +1 -1
  4. payi/_version.py +1 -1
  5. payi/lib/helpers.py +2 -2
  6. payi/resources/__init__.py +14 -28
  7. payi/resources/categories/resources.py +7 -7
  8. payi/resources/experiences/types/types.py +5 -2
  9. payi/resources/ingest.py +22 -12
  10. payi/resources/limits/limits.py +4 -0
  11. payi/resources/limits/tags.py +12 -0
  12. payi/resources/requests/properties.py +1 -1
  13. payi/resources/use_cases/__init__.py +47 -0
  14. payi/resources/use_cases/properties.py +174 -0
  15. payi/resources/use_cases/types/__init__.py +33 -0
  16. payi/resources/use_cases/types/limit_config.py +275 -0
  17. payi/resources/{billing_models.py → use_cases/types/types.py} +225 -161
  18. payi/resources/{price_modifiers.py → use_cases/use_cases.py} +160 -130
  19. payi/types/__init__.py +6 -9
  20. payi/types/categories/resource_create_params.py +6 -6
  21. payi/types/category_resource_response.py +2 -2
  22. payi/types/experience_instance_response.py +2 -0
  23. payi/types/experiences/__init__.py +0 -1
  24. payi/types/experiences/experience_type.py +8 -14
  25. payi/types/experiences/type_create_params.py +8 -14
  26. payi/types/ingest_event_param.py +10 -0
  27. payi/types/ingest_response.py +2 -0
  28. payi/types/ingest_units_params.py +9 -1
  29. payi/types/limit_list_params.py +6 -1
  30. payi/types/limits/tag_create_params.py +1 -0
  31. payi/types/limits/tag_remove_params.py +1 -0
  32. payi/types/limits/tag_update_params.py +1 -0
  33. payi/types/requests/request_result.py +2 -0
  34. payi/types/shared/__init__.py +4 -0
  35. payi/types/shared/pay_i_common_models_budget_management_create_limit_base.py +18 -0
  36. payi/types/shared_params/__init__.py +5 -0
  37. payi/types/shared_params/pay_i_common_models_budget_management_create_limit_base.py +18 -0
  38. payi/types/use_case_instance_response.py +15 -0
  39. payi/types/use_cases/__init__.py +10 -0
  40. payi/types/use_cases/property_create_params.py +12 -0
  41. payi/types/use_cases/type_create_params.py +22 -0
  42. payi/types/use_cases/type_list_params.py +12 -0
  43. payi/types/{billing_model_list_response.py → use_cases/type_list_response.py} +3 -3
  44. payi/types/use_cases/type_update_params.py +14 -0
  45. payi/types/use_cases/types/__init__.py +5 -0
  46. payi/types/use_cases/types/limit_config_create_params.py +18 -0
  47. payi/types/use_cases/use_case_type.py +24 -0
  48. {payi-0.1.0a55.dist-info → payi-0.1.0a57.dist-info}/METADATA +1 -1
  49. {payi-0.1.0a55.dist-info → payi-0.1.0a57.dist-info}/RECORD +52 -43
  50. payi/types/billing_model.py +0 -31
  51. payi/types/billing_model_create_params.py +0 -22
  52. payi/types/billing_model_update_params.py +0 -22
  53. payi/types/price_modifier.py +0 -26
  54. payi/types/price_modifier_create_params.py +0 -17
  55. payi/types/price_modifier_retrieve_response.py +0 -10
  56. payi/types/price_modifier_update_params.py +0 -17
  57. /payi/types/{experiences → shared}/properties_response.py +0 -0
  58. {payi-0.1.0a55.dist-info → payi-0.1.0a57.dist-info}/WHEEL +0 -0
  59. {payi-0.1.0a55.dist-info → payi-0.1.0a57.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,174 @@
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 Dict
6
+
7
+ import httpx
8
+
9
+ from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10
+ from ..._utils import (
11
+ maybe_transform,
12
+ async_maybe_transform,
13
+ )
14
+ from ..._compat import cached_property
15
+ from ..._resource import SyncAPIResource, AsyncAPIResource
16
+ from ..._response import (
17
+ to_raw_response_wrapper,
18
+ to_streamed_response_wrapper,
19
+ async_to_raw_response_wrapper,
20
+ async_to_streamed_response_wrapper,
21
+ )
22
+ from ..._base_client import make_request_options
23
+ from ...types.use_cases import property_create_params
24
+ from ...types.use_case_instance_response import UseCaseInstanceResponse
25
+
26
+ __all__ = ["PropertiesResource", "AsyncPropertiesResource"]
27
+
28
+
29
+ class PropertiesResource(SyncAPIResource):
30
+ @cached_property
31
+ def with_raw_response(self) -> PropertiesResourceWithRawResponse:
32
+ """
33
+ This property can be used as a prefix for any HTTP method call to return
34
+ the raw response object instead of the parsed content.
35
+
36
+ For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
37
+ """
38
+ return PropertiesResourceWithRawResponse(self)
39
+
40
+ @cached_property
41
+ def with_streaming_response(self) -> PropertiesResourceWithStreamingResponse:
42
+ """
43
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
44
+
45
+ For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
46
+ """
47
+ return PropertiesResourceWithStreamingResponse(self)
48
+
49
+ def create(
50
+ self,
51
+ use_case_id: str,
52
+ *,
53
+ properties: Dict[str, str],
54
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
55
+ # The extra values given here take precedence over values defined on the client or passed to this method.
56
+ extra_headers: Headers | None = None,
57
+ extra_query: Query | None = None,
58
+ extra_body: Body | None = None,
59
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
60
+ ) -> UseCaseInstanceResponse:
61
+ """
62
+ Update Use Case instance properties
63
+
64
+ Args:
65
+ extra_headers: Send extra headers
66
+
67
+ extra_query: Add additional query parameters to the request
68
+
69
+ extra_body: Add additional JSON properties to the request
70
+
71
+ timeout: Override the client-level default timeout for this request, in seconds
72
+ """
73
+ if not use_case_id:
74
+ raise ValueError(f"Expected a non-empty value for `use_case_id` but received {use_case_id!r}")
75
+ return self._post(
76
+ f"/api/v1/use_cases/instances/{use_case_id}/properties",
77
+ body=maybe_transform({"properties": properties}, property_create_params.PropertyCreateParams),
78
+ options=make_request_options(
79
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
80
+ ),
81
+ cast_to=UseCaseInstanceResponse,
82
+ )
83
+
84
+
85
+ class AsyncPropertiesResource(AsyncAPIResource):
86
+ @cached_property
87
+ def with_raw_response(self) -> AsyncPropertiesResourceWithRawResponse:
88
+ """
89
+ This property can be used as a prefix for any HTTP method call to return
90
+ the raw response object instead of the parsed content.
91
+
92
+ For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
93
+ """
94
+ return AsyncPropertiesResourceWithRawResponse(self)
95
+
96
+ @cached_property
97
+ def with_streaming_response(self) -> AsyncPropertiesResourceWithStreamingResponse:
98
+ """
99
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
100
+
101
+ For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
102
+ """
103
+ return AsyncPropertiesResourceWithStreamingResponse(self)
104
+
105
+ async def create(
106
+ self,
107
+ use_case_id: str,
108
+ *,
109
+ properties: Dict[str, str],
110
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
111
+ # The extra values given here take precedence over values defined on the client or passed to this method.
112
+ extra_headers: Headers | None = None,
113
+ extra_query: Query | None = None,
114
+ extra_body: Body | None = None,
115
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
116
+ ) -> UseCaseInstanceResponse:
117
+ """
118
+ Update Use Case instance properties
119
+
120
+ Args:
121
+ extra_headers: Send extra headers
122
+
123
+ extra_query: Add additional query parameters to the request
124
+
125
+ extra_body: Add additional JSON properties to the request
126
+
127
+ timeout: Override the client-level default timeout for this request, in seconds
128
+ """
129
+ if not use_case_id:
130
+ raise ValueError(f"Expected a non-empty value for `use_case_id` but received {use_case_id!r}")
131
+ return await self._post(
132
+ f"/api/v1/use_cases/instances/{use_case_id}/properties",
133
+ body=await async_maybe_transform({"properties": properties}, property_create_params.PropertyCreateParams),
134
+ options=make_request_options(
135
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
136
+ ),
137
+ cast_to=UseCaseInstanceResponse,
138
+ )
139
+
140
+
141
+ class PropertiesResourceWithRawResponse:
142
+ def __init__(self, properties: PropertiesResource) -> None:
143
+ self._properties = properties
144
+
145
+ self.create = to_raw_response_wrapper(
146
+ properties.create,
147
+ )
148
+
149
+
150
+ class AsyncPropertiesResourceWithRawResponse:
151
+ def __init__(self, properties: AsyncPropertiesResource) -> None:
152
+ self._properties = properties
153
+
154
+ self.create = async_to_raw_response_wrapper(
155
+ properties.create,
156
+ )
157
+
158
+
159
+ class PropertiesResourceWithStreamingResponse:
160
+ def __init__(self, properties: PropertiesResource) -> None:
161
+ self._properties = properties
162
+
163
+ self.create = to_streamed_response_wrapper(
164
+ properties.create,
165
+ )
166
+
167
+
168
+ class AsyncPropertiesResourceWithStreamingResponse:
169
+ def __init__(self, properties: AsyncPropertiesResource) -> None:
170
+ self._properties = properties
171
+
172
+ self.create = async_to_streamed_response_wrapper(
173
+ properties.create,
174
+ )
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .types import (
4
+ TypesResource,
5
+ AsyncTypesResource,
6
+ TypesResourceWithRawResponse,
7
+ AsyncTypesResourceWithRawResponse,
8
+ TypesResourceWithStreamingResponse,
9
+ AsyncTypesResourceWithStreamingResponse,
10
+ )
11
+ from .limit_config import (
12
+ LimitConfigResource,
13
+ AsyncLimitConfigResource,
14
+ LimitConfigResourceWithRawResponse,
15
+ AsyncLimitConfigResourceWithRawResponse,
16
+ LimitConfigResourceWithStreamingResponse,
17
+ AsyncLimitConfigResourceWithStreamingResponse,
18
+ )
19
+
20
+ __all__ = [
21
+ "LimitConfigResource",
22
+ "AsyncLimitConfigResource",
23
+ "LimitConfigResourceWithRawResponse",
24
+ "AsyncLimitConfigResourceWithRawResponse",
25
+ "LimitConfigResourceWithStreamingResponse",
26
+ "AsyncLimitConfigResourceWithStreamingResponse",
27
+ "TypesResource",
28
+ "AsyncTypesResource",
29
+ "TypesResourceWithRawResponse",
30
+ "AsyncTypesResourceWithRawResponse",
31
+ "TypesResourceWithStreamingResponse",
32
+ "AsyncTypesResourceWithStreamingResponse",
33
+ ]
@@ -0,0 +1,275 @@
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 List, Optional
6
+ from typing_extensions import Literal
7
+
8
+ import httpx
9
+
10
+ from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
11
+ from ...._utils import (
12
+ maybe_transform,
13
+ async_maybe_transform,
14
+ )
15
+ from ...._compat import cached_property
16
+ from ...._resource import SyncAPIResource, AsyncAPIResource
17
+ from ...._response import (
18
+ to_raw_response_wrapper,
19
+ to_streamed_response_wrapper,
20
+ async_to_raw_response_wrapper,
21
+ async_to_streamed_response_wrapper,
22
+ )
23
+ from ...._base_client import make_request_options
24
+ from ....types.use_cases.types import limit_config_create_params
25
+ from ....types.use_cases.use_case_type import UseCaseType
26
+
27
+ __all__ = ["LimitConfigResource", "AsyncLimitConfigResource"]
28
+
29
+
30
+ class LimitConfigResource(SyncAPIResource):
31
+ @cached_property
32
+ def with_raw_response(self) -> LimitConfigResourceWithRawResponse:
33
+ """
34
+ This property can be used as a prefix for any HTTP method call to return
35
+ the raw response object instead of the parsed content.
36
+
37
+ For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
38
+ """
39
+ return LimitConfigResourceWithRawResponse(self)
40
+
41
+ @cached_property
42
+ def with_streaming_response(self) -> LimitConfigResourceWithStreamingResponse:
43
+ """
44
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
45
+
46
+ For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
47
+ """
48
+ return LimitConfigResourceWithStreamingResponse(self)
49
+
50
+ def create(
51
+ self,
52
+ use_case_name: str,
53
+ *,
54
+ max: float,
55
+ limit_tags: Optional[List[str]] | NotGiven = NOT_GIVEN,
56
+ limit_type: Literal["block", "allow"] | NotGiven = NOT_GIVEN,
57
+ threshold: Optional[float] | NotGiven = NOT_GIVEN,
58
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
59
+ # The extra values given here take precedence over values defined on the client or passed to this method.
60
+ extra_headers: Headers | None = None,
61
+ extra_query: Query | None = None,
62
+ extra_body: Body | None = None,
63
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
64
+ ) -> UseCaseType:
65
+ """
66
+ Create a new Use Case default limit configuration
67
+
68
+ Args:
69
+ extra_headers: Send extra headers
70
+
71
+ extra_query: Add additional query parameters to the request
72
+
73
+ extra_body: Add additional JSON properties to the request
74
+
75
+ timeout: Override the client-level default timeout for this request, in seconds
76
+ """
77
+ if not use_case_name:
78
+ raise ValueError(f"Expected a non-empty value for `use_case_name` but received {use_case_name!r}")
79
+ return self._post(
80
+ f"/api/v1/use_cases/types/{use_case_name}/limit_config",
81
+ body=maybe_transform(
82
+ {
83
+ "max": max,
84
+ "limit_tags": limit_tags,
85
+ "limit_type": limit_type,
86
+ "threshold": threshold,
87
+ },
88
+ limit_config_create_params.LimitConfigCreateParams,
89
+ ),
90
+ options=make_request_options(
91
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
92
+ ),
93
+ cast_to=UseCaseType,
94
+ )
95
+
96
+ def delete(
97
+ self,
98
+ use_case_name: str,
99
+ *,
100
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
101
+ # The extra values given here take precedence over values defined on the client or passed to this method.
102
+ extra_headers: Headers | None = None,
103
+ extra_query: Query | None = None,
104
+ extra_body: Body | None = None,
105
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
106
+ ) -> UseCaseType:
107
+ """
108
+ Delete a Use Case default limit configuration
109
+
110
+ Args:
111
+ extra_headers: Send extra headers
112
+
113
+ extra_query: Add additional query parameters to the request
114
+
115
+ extra_body: Add additional JSON properties to the request
116
+
117
+ timeout: Override the client-level default timeout for this request, in seconds
118
+ """
119
+ if not use_case_name:
120
+ raise ValueError(f"Expected a non-empty value for `use_case_name` but received {use_case_name!r}")
121
+ return self._delete(
122
+ f"/api/v1/use_cases/types/{use_case_name}/limit_config",
123
+ options=make_request_options(
124
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
125
+ ),
126
+ cast_to=UseCaseType,
127
+ )
128
+
129
+
130
+ class AsyncLimitConfigResource(AsyncAPIResource):
131
+ @cached_property
132
+ def with_raw_response(self) -> AsyncLimitConfigResourceWithRawResponse:
133
+ """
134
+ This property can be used as a prefix for any HTTP method call to return
135
+ the raw response object instead of the parsed content.
136
+
137
+ For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
138
+ """
139
+ return AsyncLimitConfigResourceWithRawResponse(self)
140
+
141
+ @cached_property
142
+ def with_streaming_response(self) -> AsyncLimitConfigResourceWithStreamingResponse:
143
+ """
144
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
145
+
146
+ For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
147
+ """
148
+ return AsyncLimitConfigResourceWithStreamingResponse(self)
149
+
150
+ async def create(
151
+ self,
152
+ use_case_name: str,
153
+ *,
154
+ max: float,
155
+ limit_tags: Optional[List[str]] | NotGiven = NOT_GIVEN,
156
+ limit_type: Literal["block", "allow"] | NotGiven = NOT_GIVEN,
157
+ threshold: Optional[float] | NotGiven = NOT_GIVEN,
158
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
159
+ # The extra values given here take precedence over values defined on the client or passed to this method.
160
+ extra_headers: Headers | None = None,
161
+ extra_query: Query | None = None,
162
+ extra_body: Body | None = None,
163
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
164
+ ) -> UseCaseType:
165
+ """
166
+ Create a new Use Case default limit configuration
167
+
168
+ Args:
169
+ extra_headers: Send extra headers
170
+
171
+ extra_query: Add additional query parameters to the request
172
+
173
+ extra_body: Add additional JSON properties to the request
174
+
175
+ timeout: Override the client-level default timeout for this request, in seconds
176
+ """
177
+ if not use_case_name:
178
+ raise ValueError(f"Expected a non-empty value for `use_case_name` but received {use_case_name!r}")
179
+ return await self._post(
180
+ f"/api/v1/use_cases/types/{use_case_name}/limit_config",
181
+ body=await async_maybe_transform(
182
+ {
183
+ "max": max,
184
+ "limit_tags": limit_tags,
185
+ "limit_type": limit_type,
186
+ "threshold": threshold,
187
+ },
188
+ limit_config_create_params.LimitConfigCreateParams,
189
+ ),
190
+ options=make_request_options(
191
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
192
+ ),
193
+ cast_to=UseCaseType,
194
+ )
195
+
196
+ async def delete(
197
+ self,
198
+ use_case_name: str,
199
+ *,
200
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
201
+ # The extra values given here take precedence over values defined on the client or passed to this method.
202
+ extra_headers: Headers | None = None,
203
+ extra_query: Query | None = None,
204
+ extra_body: Body | None = None,
205
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
206
+ ) -> UseCaseType:
207
+ """
208
+ Delete a Use Case default limit configuration
209
+
210
+ Args:
211
+ extra_headers: Send extra headers
212
+
213
+ extra_query: Add additional query parameters to the request
214
+
215
+ extra_body: Add additional JSON properties to the request
216
+
217
+ timeout: Override the client-level default timeout for this request, in seconds
218
+ """
219
+ if not use_case_name:
220
+ raise ValueError(f"Expected a non-empty value for `use_case_name` but received {use_case_name!r}")
221
+ return await self._delete(
222
+ f"/api/v1/use_cases/types/{use_case_name}/limit_config",
223
+ options=make_request_options(
224
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
225
+ ),
226
+ cast_to=UseCaseType,
227
+ )
228
+
229
+
230
+ class LimitConfigResourceWithRawResponse:
231
+ def __init__(self, limit_config: LimitConfigResource) -> None:
232
+ self._limit_config = limit_config
233
+
234
+ self.create = to_raw_response_wrapper(
235
+ limit_config.create,
236
+ )
237
+ self.delete = to_raw_response_wrapper(
238
+ limit_config.delete,
239
+ )
240
+
241
+
242
+ class AsyncLimitConfigResourceWithRawResponse:
243
+ def __init__(self, limit_config: AsyncLimitConfigResource) -> None:
244
+ self._limit_config = limit_config
245
+
246
+ self.create = async_to_raw_response_wrapper(
247
+ limit_config.create,
248
+ )
249
+ self.delete = async_to_raw_response_wrapper(
250
+ limit_config.delete,
251
+ )
252
+
253
+
254
+ class LimitConfigResourceWithStreamingResponse:
255
+ def __init__(self, limit_config: LimitConfigResource) -> None:
256
+ self._limit_config = limit_config
257
+
258
+ self.create = to_streamed_response_wrapper(
259
+ limit_config.create,
260
+ )
261
+ self.delete = to_streamed_response_wrapper(
262
+ limit_config.delete,
263
+ )
264
+
265
+
266
+ class AsyncLimitConfigResourceWithStreamingResponse:
267
+ def __init__(self, limit_config: AsyncLimitConfigResource) -> None:
268
+ self._limit_config = limit_config
269
+
270
+ self.create = async_to_streamed_response_wrapper(
271
+ limit_config.create,
272
+ )
273
+ self.delete = async_to_streamed_response_wrapper(
274
+ limit_config.delete,
275
+ )