payi 0.1.0a26__py3-none-any.whl → 0.1.0a28__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.
- payi/_base_client.py +9 -2
- payi/_client.py +16 -0
- payi/_compat.py +5 -3
- payi/_models.py +11 -8
- payi/_response.py +3 -0
- payi/_types.py +4 -2
- payi/_utils/__init__.py +1 -0
- payi/_utils/_transform.py +12 -2
- payi/_utils/_utils.py +17 -0
- payi/_version.py +1 -1
- payi/resources/__init__.py +28 -0
- payi/resources/billing_models.py +492 -0
- payi/resources/budgets/budgets.py +4 -4
- payi/resources/categories/resources.py +5 -9
- payi/resources/ingest.py +19 -10
- payi/resources/price_modifiers.py +353 -0
- payi/types/__init__.py +8 -0
- payi/types/billing_model.py +29 -0
- payi/types/billing_model_create_params.py +20 -0
- payi/types/billing_model_list_response.py +10 -0
- payi/types/billing_model_update_params.py +20 -0
- payi/types/budget_create_params.py +2 -2
- payi/types/budget_response.py +2 -2
- payi/types/categories/resource_create_params.py +9 -5
- payi/types/category_resource_response.py +9 -5
- payi/types/cost_data.py +0 -1
- payi/types/csat.py +0 -1
- payi/types/experience_instance.py +0 -1
- payi/types/experiences/experience_type.py +0 -1
- payi/types/ingest_event_param.py +12 -6
- payi/types/ingest_response.py +7 -1
- payi/types/ingest_units_params.py +11 -6
- payi/types/paged_budget_list.py +2 -2
- payi/types/price_modifier.py +26 -0
- payi/types/price_modifier_create_params.py +17 -0
- payi/types/price_modifier_retrieve_response.py +10 -0
- payi/types/price_modifier_update_params.py +17 -0
- payi/types/requests_data.py +2 -1
- payi/types/total_cost_data.py +0 -1
- {payi-0.1.0a26.dist-info → payi-0.1.0a28.dist-info}/METADATA +11 -11
- {payi-0.1.0a26.dist-info → payi-0.1.0a28.dist-info}/RECORD +43 -37
- {payi-0.1.0a26.dist-info → payi-0.1.0a28.dist-info}/WHEEL +1 -1
- payi/types/evaluations/__init__.py +0 -6
- payi/types/evaluations/experience_create_params.py +0 -14
- payi/types/evaluations/request_create_params.py +0 -14
- payi/types/shared/__init__.py +0 -2
- {payi-0.1.0a26.dist-info → payi-0.1.0a28.dist-info}/licenses/LICENSE +0 -0
payi/resources/ingest.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Union, Iterable, Optional
|
|
5
|
+
from typing import Dict, Union, Iterable, Optional
|
|
6
6
|
from datetime import datetime
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
@@ -89,14 +89,14 @@ class IngestResource(SyncAPIResource):
|
|
|
89
89
|
self,
|
|
90
90
|
*,
|
|
91
91
|
category: str,
|
|
92
|
-
input: int,
|
|
93
|
-
output: int,
|
|
94
92
|
resource: str,
|
|
93
|
+
units: Dict[str, ingest_units_params.Units],
|
|
95
94
|
event_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
96
95
|
provisioned_resource_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
97
96
|
budget_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
|
|
98
97
|
request_tags: Union[list[str], None] | NotGiven = NOT_GIVEN,
|
|
99
98
|
experience_id: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
99
|
+
experience_name: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
100
100
|
user_id: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
101
101
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
102
102
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -123,6 +123,8 @@ class IngestResource(SyncAPIResource):
|
|
|
123
123
|
|
|
124
124
|
request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
|
|
125
125
|
|
|
126
|
+
experience_name (str, optional): The experience name
|
|
127
|
+
|
|
126
128
|
experience_id (str, optional): The experience instance id
|
|
127
129
|
|
|
128
130
|
user_id (str, optional): The user id
|
|
@@ -156,6 +158,9 @@ class IngestResource(SyncAPIResource):
|
|
|
156
158
|
valid_tags = [tag.strip() for tag in request_tags if tag.strip()]
|
|
157
159
|
valid_tags_str = ",".join(valid_tags) if valid_tags else NOT_GIVEN
|
|
158
160
|
|
|
161
|
+
if experience_name is None or isinstance(experience_name, NotGiven):
|
|
162
|
+
experience_name = NOT_GIVEN
|
|
163
|
+
|
|
159
164
|
if experience_id is None or isinstance(experience_id, NotGiven):
|
|
160
165
|
experience_id = NOT_GIVEN
|
|
161
166
|
|
|
@@ -168,6 +173,7 @@ class IngestResource(SyncAPIResource):
|
|
|
168
173
|
"xProxy-Budget-IDs": valid_ids_str,
|
|
169
174
|
"xProxy-Request-Tags": valid_tags_str,
|
|
170
175
|
"xProxy-Experience-Id": experience_id,
|
|
176
|
+
"xProxy-Experience-Name": experience_name,
|
|
171
177
|
"xProxy-User-ID": user_id,
|
|
172
178
|
}
|
|
173
179
|
),
|
|
@@ -178,9 +184,8 @@ class IngestResource(SyncAPIResource):
|
|
|
178
184
|
body=maybe_transform(
|
|
179
185
|
{
|
|
180
186
|
"category": category,
|
|
181
|
-
"input": input,
|
|
182
|
-
"output": output,
|
|
183
187
|
"resource": resource,
|
|
188
|
+
"units": units,
|
|
184
189
|
"event_timestamp": event_timestamp,
|
|
185
190
|
"provisioned_resource_name": provisioned_resource_name,
|
|
186
191
|
},
|
|
@@ -251,16 +256,15 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
251
256
|
self,
|
|
252
257
|
*,
|
|
253
258
|
category: str,
|
|
254
|
-
input: int,
|
|
255
|
-
output: int,
|
|
256
259
|
resource: str,
|
|
260
|
+
units: Dict[str, ingest_units_params.Units],
|
|
257
261
|
event_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
258
262
|
provisioned_resource_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
259
263
|
budget_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
|
|
260
264
|
request_tags: Union[list[str], None] | NotGiven = NOT_GIVEN,
|
|
265
|
+
experience_name: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
261
266
|
experience_id: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
262
267
|
user_id: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
263
|
-
|
|
264
268
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
265
269
|
extra_headers: Headers | None = None,
|
|
266
270
|
extra_query: Query | None = None,
|
|
@@ -285,6 +289,8 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
285
289
|
|
|
286
290
|
request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
|
|
287
291
|
|
|
292
|
+
experience_name (str, optional): The experience name
|
|
293
|
+
|
|
288
294
|
experience_id (str, optional): The experience instance id
|
|
289
295
|
|
|
290
296
|
user_id (str, optional): The user id
|
|
@@ -318,6 +324,9 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
318
324
|
valid_tags = [tag.strip() for tag in request_tags if tag.strip()]
|
|
319
325
|
valid_tags_str = ",".join(valid_tags) if valid_tags else NOT_GIVEN
|
|
320
326
|
|
|
327
|
+
if experience_name is None or isinstance(experience_name, NotGiven):
|
|
328
|
+
experience_name = NOT_GIVEN
|
|
329
|
+
|
|
321
330
|
if experience_id is None or isinstance(experience_id, NotGiven):
|
|
322
331
|
experience_id = NOT_GIVEN
|
|
323
332
|
|
|
@@ -329,6 +338,7 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
329
338
|
{
|
|
330
339
|
"xProxy-Budget-IDs": valid_ids_str,
|
|
331
340
|
"xProxy-Request-Tags": valid_tags_str,
|
|
341
|
+
"xProxy-Experience-Name": experience_name,
|
|
332
342
|
"xProxy-Experience-Id": experience_id,
|
|
333
343
|
"xProxy-User-ID": user_id,
|
|
334
344
|
}
|
|
@@ -340,9 +350,8 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
340
350
|
body=await async_maybe_transform(
|
|
341
351
|
{
|
|
342
352
|
"category": category,
|
|
343
|
-
"input": input,
|
|
344
|
-
"output": output,
|
|
345
353
|
"resource": resource,
|
|
354
|
+
"units": units,
|
|
346
355
|
"event_timestamp": event_timestamp,
|
|
347
356
|
"provisioned_resource_name": provisioned_resource_name,
|
|
348
357
|
},
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ..types import price_modifier_create_params, price_modifier_update_params
|
|
8
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
9
|
+
from .._utils import (
|
|
10
|
+
maybe_transform,
|
|
11
|
+
async_maybe_transform,
|
|
12
|
+
)
|
|
13
|
+
from .._compat import cached_property
|
|
14
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
from .._response import (
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
async_to_raw_response_wrapper,
|
|
19
|
+
async_to_streamed_response_wrapper,
|
|
20
|
+
)
|
|
21
|
+
from .._base_client import make_request_options
|
|
22
|
+
from ..types.price_modifier import PriceModifier
|
|
23
|
+
from ..types.price_modifier_retrieve_response import PriceModifierRetrieveResponse
|
|
24
|
+
|
|
25
|
+
__all__ = ["PriceModifiersResource", "AsyncPriceModifiersResource"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class PriceModifiersResource(SyncAPIResource):
|
|
29
|
+
@cached_property
|
|
30
|
+
def with_raw_response(self) -> PriceModifiersResourceWithRawResponse:
|
|
31
|
+
"""
|
|
32
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
33
|
+
the raw response object instead of the parsed content.
|
|
34
|
+
|
|
35
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
36
|
+
"""
|
|
37
|
+
return PriceModifiersResourceWithRawResponse(self)
|
|
38
|
+
|
|
39
|
+
@cached_property
|
|
40
|
+
def with_streaming_response(self) -> PriceModifiersResourceWithStreamingResponse:
|
|
41
|
+
"""
|
|
42
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
43
|
+
|
|
44
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
|
|
45
|
+
"""
|
|
46
|
+
return PriceModifiersResourceWithStreamingResponse(self)
|
|
47
|
+
|
|
48
|
+
def create(
|
|
49
|
+
self,
|
|
50
|
+
*,
|
|
51
|
+
billing_model_id: str,
|
|
52
|
+
category: str,
|
|
53
|
+
price_modifier: float,
|
|
54
|
+
resource: str,
|
|
55
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
56
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
57
|
+
extra_headers: Headers | None = None,
|
|
58
|
+
extra_query: Query | None = None,
|
|
59
|
+
extra_body: Body | None = None,
|
|
60
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
61
|
+
) -> PriceModifier:
|
|
62
|
+
"""
|
|
63
|
+
Args:
|
|
64
|
+
extra_headers: Send extra headers
|
|
65
|
+
|
|
66
|
+
extra_query: Add additional query parameters to the request
|
|
67
|
+
|
|
68
|
+
extra_body: Add additional JSON properties to the request
|
|
69
|
+
|
|
70
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
71
|
+
"""
|
|
72
|
+
return self._post(
|
|
73
|
+
"/api/v1/price-modifier",
|
|
74
|
+
body=maybe_transform(
|
|
75
|
+
{
|
|
76
|
+
"billing_model_id": billing_model_id,
|
|
77
|
+
"category": category,
|
|
78
|
+
"price_modifier": price_modifier,
|
|
79
|
+
"resource": resource,
|
|
80
|
+
},
|
|
81
|
+
price_modifier_create_params.PriceModifierCreateParams,
|
|
82
|
+
),
|
|
83
|
+
options=make_request_options(
|
|
84
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
85
|
+
),
|
|
86
|
+
cast_to=PriceModifier,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
def retrieve(
|
|
90
|
+
self,
|
|
91
|
+
billing_model_id: str,
|
|
92
|
+
*,
|
|
93
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
94
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
95
|
+
extra_headers: Headers | None = None,
|
|
96
|
+
extra_query: Query | None = None,
|
|
97
|
+
extra_body: Body | None = None,
|
|
98
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
99
|
+
) -> PriceModifierRetrieveResponse:
|
|
100
|
+
"""
|
|
101
|
+
Args:
|
|
102
|
+
extra_headers: Send extra headers
|
|
103
|
+
|
|
104
|
+
extra_query: Add additional query parameters to the request
|
|
105
|
+
|
|
106
|
+
extra_body: Add additional JSON properties to the request
|
|
107
|
+
|
|
108
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
109
|
+
"""
|
|
110
|
+
if not billing_model_id:
|
|
111
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
112
|
+
return self._get(
|
|
113
|
+
f"/api/v1/price-modifier/{billing_model_id}",
|
|
114
|
+
options=make_request_options(
|
|
115
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
116
|
+
),
|
|
117
|
+
cast_to=PriceModifierRetrieveResponse,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
def update(
|
|
121
|
+
self,
|
|
122
|
+
*,
|
|
123
|
+
billing_model_id: str,
|
|
124
|
+
category: str,
|
|
125
|
+
price_modifier: float,
|
|
126
|
+
resource: str,
|
|
127
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
128
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
129
|
+
extra_headers: Headers | None = None,
|
|
130
|
+
extra_query: Query | None = None,
|
|
131
|
+
extra_body: Body | None = None,
|
|
132
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
133
|
+
) -> PriceModifier:
|
|
134
|
+
"""
|
|
135
|
+
Args:
|
|
136
|
+
extra_headers: Send extra headers
|
|
137
|
+
|
|
138
|
+
extra_query: Add additional query parameters to the request
|
|
139
|
+
|
|
140
|
+
extra_body: Add additional JSON properties to the request
|
|
141
|
+
|
|
142
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
143
|
+
"""
|
|
144
|
+
return self._put(
|
|
145
|
+
"/api/v1/price-modifier",
|
|
146
|
+
body=maybe_transform(
|
|
147
|
+
{
|
|
148
|
+
"billing_model_id": billing_model_id,
|
|
149
|
+
"category": category,
|
|
150
|
+
"price_modifier": price_modifier,
|
|
151
|
+
"resource": resource,
|
|
152
|
+
},
|
|
153
|
+
price_modifier_update_params.PriceModifierUpdateParams,
|
|
154
|
+
),
|
|
155
|
+
options=make_request_options(
|
|
156
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
157
|
+
),
|
|
158
|
+
cast_to=PriceModifier,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class AsyncPriceModifiersResource(AsyncAPIResource):
|
|
163
|
+
@cached_property
|
|
164
|
+
def with_raw_response(self) -> AsyncPriceModifiersResourceWithRawResponse:
|
|
165
|
+
"""
|
|
166
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
167
|
+
the raw response object instead of the parsed content.
|
|
168
|
+
|
|
169
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
170
|
+
"""
|
|
171
|
+
return AsyncPriceModifiersResourceWithRawResponse(self)
|
|
172
|
+
|
|
173
|
+
@cached_property
|
|
174
|
+
def with_streaming_response(self) -> AsyncPriceModifiersResourceWithStreamingResponse:
|
|
175
|
+
"""
|
|
176
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
177
|
+
|
|
178
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
|
|
179
|
+
"""
|
|
180
|
+
return AsyncPriceModifiersResourceWithStreamingResponse(self)
|
|
181
|
+
|
|
182
|
+
async def create(
|
|
183
|
+
self,
|
|
184
|
+
*,
|
|
185
|
+
billing_model_id: str,
|
|
186
|
+
category: str,
|
|
187
|
+
price_modifier: float,
|
|
188
|
+
resource: str,
|
|
189
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
190
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
191
|
+
extra_headers: Headers | None = None,
|
|
192
|
+
extra_query: Query | None = None,
|
|
193
|
+
extra_body: Body | None = None,
|
|
194
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
195
|
+
) -> PriceModifier:
|
|
196
|
+
"""
|
|
197
|
+
Args:
|
|
198
|
+
extra_headers: Send extra headers
|
|
199
|
+
|
|
200
|
+
extra_query: Add additional query parameters to the request
|
|
201
|
+
|
|
202
|
+
extra_body: Add additional JSON properties to the request
|
|
203
|
+
|
|
204
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
205
|
+
"""
|
|
206
|
+
return await self._post(
|
|
207
|
+
"/api/v1/price-modifier",
|
|
208
|
+
body=await async_maybe_transform(
|
|
209
|
+
{
|
|
210
|
+
"billing_model_id": billing_model_id,
|
|
211
|
+
"category": category,
|
|
212
|
+
"price_modifier": price_modifier,
|
|
213
|
+
"resource": resource,
|
|
214
|
+
},
|
|
215
|
+
price_modifier_create_params.PriceModifierCreateParams,
|
|
216
|
+
),
|
|
217
|
+
options=make_request_options(
|
|
218
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
219
|
+
),
|
|
220
|
+
cast_to=PriceModifier,
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
async def retrieve(
|
|
224
|
+
self,
|
|
225
|
+
billing_model_id: str,
|
|
226
|
+
*,
|
|
227
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
228
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
229
|
+
extra_headers: Headers | None = None,
|
|
230
|
+
extra_query: Query | None = None,
|
|
231
|
+
extra_body: Body | None = None,
|
|
232
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
233
|
+
) -> PriceModifierRetrieveResponse:
|
|
234
|
+
"""
|
|
235
|
+
Args:
|
|
236
|
+
extra_headers: Send extra headers
|
|
237
|
+
|
|
238
|
+
extra_query: Add additional query parameters to the request
|
|
239
|
+
|
|
240
|
+
extra_body: Add additional JSON properties to the request
|
|
241
|
+
|
|
242
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
243
|
+
"""
|
|
244
|
+
if not billing_model_id:
|
|
245
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
246
|
+
return await self._get(
|
|
247
|
+
f"/api/v1/price-modifier/{billing_model_id}",
|
|
248
|
+
options=make_request_options(
|
|
249
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
250
|
+
),
|
|
251
|
+
cast_to=PriceModifierRetrieveResponse,
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
async def update(
|
|
255
|
+
self,
|
|
256
|
+
*,
|
|
257
|
+
billing_model_id: str,
|
|
258
|
+
category: str,
|
|
259
|
+
price_modifier: float,
|
|
260
|
+
resource: str,
|
|
261
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
262
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
263
|
+
extra_headers: Headers | None = None,
|
|
264
|
+
extra_query: Query | None = None,
|
|
265
|
+
extra_body: Body | None = None,
|
|
266
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
267
|
+
) -> PriceModifier:
|
|
268
|
+
"""
|
|
269
|
+
Args:
|
|
270
|
+
extra_headers: Send extra headers
|
|
271
|
+
|
|
272
|
+
extra_query: Add additional query parameters to the request
|
|
273
|
+
|
|
274
|
+
extra_body: Add additional JSON properties to the request
|
|
275
|
+
|
|
276
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
277
|
+
"""
|
|
278
|
+
return await self._put(
|
|
279
|
+
"/api/v1/price-modifier",
|
|
280
|
+
body=await async_maybe_transform(
|
|
281
|
+
{
|
|
282
|
+
"billing_model_id": billing_model_id,
|
|
283
|
+
"category": category,
|
|
284
|
+
"price_modifier": price_modifier,
|
|
285
|
+
"resource": resource,
|
|
286
|
+
},
|
|
287
|
+
price_modifier_update_params.PriceModifierUpdateParams,
|
|
288
|
+
),
|
|
289
|
+
options=make_request_options(
|
|
290
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
291
|
+
),
|
|
292
|
+
cast_to=PriceModifier,
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class PriceModifiersResourceWithRawResponse:
|
|
297
|
+
def __init__(self, price_modifiers: PriceModifiersResource) -> None:
|
|
298
|
+
self._price_modifiers = price_modifiers
|
|
299
|
+
|
|
300
|
+
self.create = to_raw_response_wrapper(
|
|
301
|
+
price_modifiers.create,
|
|
302
|
+
)
|
|
303
|
+
self.retrieve = to_raw_response_wrapper(
|
|
304
|
+
price_modifiers.retrieve,
|
|
305
|
+
)
|
|
306
|
+
self.update = to_raw_response_wrapper(
|
|
307
|
+
price_modifiers.update,
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
class AsyncPriceModifiersResourceWithRawResponse:
|
|
312
|
+
def __init__(self, price_modifiers: AsyncPriceModifiersResource) -> None:
|
|
313
|
+
self._price_modifiers = price_modifiers
|
|
314
|
+
|
|
315
|
+
self.create = async_to_raw_response_wrapper(
|
|
316
|
+
price_modifiers.create,
|
|
317
|
+
)
|
|
318
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
319
|
+
price_modifiers.retrieve,
|
|
320
|
+
)
|
|
321
|
+
self.update = async_to_raw_response_wrapper(
|
|
322
|
+
price_modifiers.update,
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
class PriceModifiersResourceWithStreamingResponse:
|
|
327
|
+
def __init__(self, price_modifiers: PriceModifiersResource) -> None:
|
|
328
|
+
self._price_modifiers = price_modifiers
|
|
329
|
+
|
|
330
|
+
self.create = to_streamed_response_wrapper(
|
|
331
|
+
price_modifiers.create,
|
|
332
|
+
)
|
|
333
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
334
|
+
price_modifiers.retrieve,
|
|
335
|
+
)
|
|
336
|
+
self.update = to_streamed_response_wrapper(
|
|
337
|
+
price_modifiers.update,
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
class AsyncPriceModifiersResourceWithStreamingResponse:
|
|
342
|
+
def __init__(self, price_modifiers: AsyncPriceModifiersResource) -> None:
|
|
343
|
+
self._price_modifiers = price_modifiers
|
|
344
|
+
|
|
345
|
+
self.create = async_to_streamed_response_wrapper(
|
|
346
|
+
price_modifiers.create,
|
|
347
|
+
)
|
|
348
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
349
|
+
price_modifiers.retrieve,
|
|
350
|
+
)
|
|
351
|
+
self.update = async_to_streamed_response_wrapper(
|
|
352
|
+
price_modifiers.update,
|
|
353
|
+
)
|
payi/types/__init__.py
CHANGED
|
@@ -5,7 +5,9 @@ from __future__ import annotations
|
|
|
5
5
|
from .csat import Csat as Csat
|
|
6
6
|
from .cost_data import CostData as CostData
|
|
7
7
|
from .cost_details import CostDetails as CostDetails
|
|
8
|
+
from .billing_model import BillingModel as BillingModel
|
|
8
9
|
from .requests_data import RequestsData as RequestsData
|
|
10
|
+
from .price_modifier import PriceModifier as PriceModifier
|
|
9
11
|
from .budget_response import BudgetResponse as BudgetResponse
|
|
10
12
|
from .ingest_response import IngestResponse as IngestResponse
|
|
11
13
|
from .total_cost_data import TotalCostData as TotalCostData
|
|
@@ -25,5 +27,11 @@ from .category_list_response import CategoryListResponse as CategoryListResponse
|
|
|
25
27
|
from .budget_history_response import BudgetHistoryResponse as BudgetHistoryResponse
|
|
26
28
|
from .category_delete_response import CategoryDeleteResponse as CategoryDeleteResponse
|
|
27
29
|
from .category_resource_response import CategoryResourceResponse as CategoryResourceResponse
|
|
30
|
+
from .billing_model_create_params import BillingModelCreateParams as BillingModelCreateParams
|
|
31
|
+
from .billing_model_list_response import BillingModelListResponse as BillingModelListResponse
|
|
32
|
+
from .billing_model_update_params import BillingModelUpdateParams as BillingModelUpdateParams
|
|
33
|
+
from .price_modifier_create_params import PriceModifierCreateParams as PriceModifierCreateParams
|
|
34
|
+
from .price_modifier_update_params import PriceModifierUpdateParams as PriceModifierUpdateParams
|
|
28
35
|
from .category_list_resources_response import CategoryListResourcesResponse as CategoryListResourcesResponse
|
|
36
|
+
from .price_modifier_retrieve_response import PriceModifierRetrieveResponse as PriceModifierRetrieveResponse
|
|
29
37
|
from .category_delete_resource_response import CategoryDeleteResourceResponse as CategoryDeleteResourceResponse
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from typing_extensions import Literal
|
|
6
|
+
|
|
7
|
+
from .._models import BaseModel
|
|
8
|
+
|
|
9
|
+
__all__ = ["BillingModel"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BillingModel(BaseModel):
|
|
13
|
+
billing_model_id: Optional[str] = None
|
|
14
|
+
|
|
15
|
+
created_on: datetime
|
|
16
|
+
|
|
17
|
+
default: bool
|
|
18
|
+
|
|
19
|
+
name: str
|
|
20
|
+
|
|
21
|
+
type: Literal["costplus"]
|
|
22
|
+
|
|
23
|
+
updated_on: datetime
|
|
24
|
+
|
|
25
|
+
prepaid_amount: Optional[float] = None
|
|
26
|
+
|
|
27
|
+
prepaid_max: Optional[float] = None
|
|
28
|
+
|
|
29
|
+
threshold: Optional[float] = None
|
|
@@ -0,0 +1,20 @@
|
|
|
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 Optional
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
__all__ = ["BillingModelCreateParams"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class BillingModelCreateParams(TypedDict, total=False):
|
|
12
|
+
name: Required[str]
|
|
13
|
+
|
|
14
|
+
type: Required[Literal["costplus"]]
|
|
15
|
+
|
|
16
|
+
prepaid_amount: Optional[float]
|
|
17
|
+
|
|
18
|
+
prepaid_max: Optional[float]
|
|
19
|
+
|
|
20
|
+
threshold: Optional[float]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
from typing_extensions import TypeAlias
|
|
5
|
+
|
|
6
|
+
from .billing_model import BillingModel
|
|
7
|
+
|
|
8
|
+
__all__ = ["BillingModelListResponse"]
|
|
9
|
+
|
|
10
|
+
BillingModelListResponse: TypeAlias = List[BillingModel]
|
|
@@ -0,0 +1,20 @@
|
|
|
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 Optional
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
__all__ = ["BillingModelUpdateParams"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class BillingModelUpdateParams(TypedDict, total=False):
|
|
12
|
+
type: Required[Literal["costplus"]]
|
|
13
|
+
|
|
14
|
+
name: Optional[str]
|
|
15
|
+
|
|
16
|
+
prepaid_amount: Optional[float]
|
|
17
|
+
|
|
18
|
+
prepaid_max: Optional[float]
|
|
19
|
+
|
|
20
|
+
threshold: Optional[float]
|
payi/types/budget_response.py
CHANGED
|
@@ -21,8 +21,6 @@ class Budget(BaseModel):
|
|
|
21
21
|
|
|
22
22
|
budget_response_type: Literal["block", "allow"]
|
|
23
23
|
|
|
24
|
-
budget_type: Literal["conservative", "liberal"]
|
|
25
|
-
|
|
26
24
|
budget_update_timestamp: datetime
|
|
27
25
|
|
|
28
26
|
currency: Literal["usd"]
|
|
@@ -33,6 +31,8 @@ class Budget(BaseModel):
|
|
|
33
31
|
|
|
34
32
|
budget_tags: Optional[List[str]] = None
|
|
35
33
|
|
|
34
|
+
threshold: Optional[float] = None
|
|
35
|
+
|
|
36
36
|
|
|
37
37
|
class BudgetResponse(BaseModel):
|
|
38
38
|
budget: Budget
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Union
|
|
5
|
+
from typing import Dict, Union
|
|
6
6
|
from datetime import datetime
|
|
7
7
|
from typing_extensions import Required, Annotated, TypedDict
|
|
8
8
|
|
|
9
9
|
from ..._utils import PropertyInfo
|
|
10
10
|
|
|
11
|
-
__all__ = ["ResourceCreateParams"]
|
|
11
|
+
__all__ = ["ResourceCreateParams", "Units"]
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class ResourceCreateParams(TypedDict, total=False):
|
|
15
15
|
category: Required[str]
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
units: Required[Dict[str, Units]]
|
|
18
18
|
|
|
19
19
|
max_input_units: int
|
|
20
20
|
|
|
@@ -22,6 +22,10 @@ class ResourceCreateParams(TypedDict, total=False):
|
|
|
22
22
|
|
|
23
23
|
max_total_units: int
|
|
24
24
|
|
|
25
|
-
output_price: float
|
|
26
|
-
|
|
27
25
|
start_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Units(TypedDict, total=False):
|
|
29
|
+
input_price: Required[float]
|
|
30
|
+
|
|
31
|
+
output_price: Required[float]
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
from typing import Optional
|
|
3
|
+
from typing import Dict, Optional
|
|
4
4
|
from datetime import datetime
|
|
5
5
|
|
|
6
6
|
from .._models import BaseModel
|
|
7
7
|
|
|
8
|
-
__all__ = ["CategoryResourceResponse"]
|
|
8
|
+
__all__ = ["CategoryResourceResponse", "Units"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Units(BaseModel):
|
|
12
|
+
input_price: float
|
|
13
|
+
|
|
14
|
+
output_price: float
|
|
9
15
|
|
|
10
16
|
|
|
11
17
|
class CategoryResourceResponse(BaseModel):
|
|
@@ -17,12 +23,10 @@ class CategoryResourceResponse(BaseModel):
|
|
|
17
23
|
|
|
18
24
|
start_timestamp: datetime
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
units: Dict[str, Units]
|
|
21
27
|
|
|
22
28
|
max_input_units: Optional[int] = None
|
|
23
29
|
|
|
24
30
|
max_output_units: Optional[int] = None
|
|
25
31
|
|
|
26
32
|
max_total_units: Optional[int] = None
|
|
27
|
-
|
|
28
|
-
output_price: Optional[float] = None
|