payi 0.1.0a26__py3-none-any.whl → 0.1.0a27__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/_response.py +3 -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.0a27.dist-info}/METADATA +5 -1
- {payi-0.1.0a26.dist-info → payi-0.1.0a27.dist-info}/RECORD +37 -27
- {payi-0.1.0a26.dist-info → payi-0.1.0a27.dist-info}/WHEEL +0 -0
- {payi-0.1.0a26.dist-info → payi-0.1.0a27.dist-info}/licenses/LICENSE +0 -0
payi/_base_client.py
CHANGED
|
@@ -143,6 +143,12 @@ class PageInfo:
|
|
|
143
143
|
self.url = url
|
|
144
144
|
self.params = params
|
|
145
145
|
|
|
146
|
+
@override
|
|
147
|
+
def __repr__(self) -> str:
|
|
148
|
+
if self.url:
|
|
149
|
+
return f"{self.__class__.__name__}(url={self.url})"
|
|
150
|
+
return f"{self.__class__.__name__}(params={self.params})"
|
|
151
|
+
|
|
146
152
|
|
|
147
153
|
class BasePage(GenericModel, Generic[_T]):
|
|
148
154
|
"""
|
|
@@ -689,7 +695,8 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
689
695
|
if retry_after is not None and 0 < retry_after <= 60:
|
|
690
696
|
return retry_after
|
|
691
697
|
|
|
692
|
-
|
|
698
|
+
# Also cap retry count to 1000 to avoid any potential overflows with `pow`
|
|
699
|
+
nb_retries = min(max_retries - remaining_retries, 1000)
|
|
693
700
|
|
|
694
701
|
# Apply exponential backoff, but not more than the max.
|
|
695
702
|
sleep_seconds = min(INITIAL_RETRY_DELAY * pow(2.0, nb_retries), MAX_RETRY_DELAY)
|
|
@@ -1568,7 +1575,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1568
1575
|
except Exception as err:
|
|
1569
1576
|
log.debug("Encountered Exception", exc_info=True)
|
|
1570
1577
|
|
|
1571
|
-
if
|
|
1578
|
+
if remaining_retries > 0:
|
|
1572
1579
|
return await self._retry_request(
|
|
1573
1580
|
input_options,
|
|
1574
1581
|
cast_to,
|
payi/_client.py
CHANGED
|
@@ -51,6 +51,8 @@ class Payi(SyncAPIClient):
|
|
|
51
51
|
categories: resources.CategoriesResource
|
|
52
52
|
experiences: resources.ExperiencesResource
|
|
53
53
|
csat: resources.CsatResource
|
|
54
|
+
billing_models: resources.BillingModelsResource
|
|
55
|
+
price_modifiers: resources.PriceModifiersResource
|
|
54
56
|
with_raw_response: PayiWithRawResponse
|
|
55
57
|
with_streaming_response: PayiWithStreamedResponse
|
|
56
58
|
|
|
@@ -113,6 +115,8 @@ class Payi(SyncAPIClient):
|
|
|
113
115
|
self.categories = resources.CategoriesResource(self)
|
|
114
116
|
self.experiences = resources.ExperiencesResource(self)
|
|
115
117
|
self.csat = resources.CsatResource(self)
|
|
118
|
+
self.billing_models = resources.BillingModelsResource(self)
|
|
119
|
+
self.price_modifiers = resources.PriceModifiersResource(self)
|
|
116
120
|
self.with_raw_response = PayiWithRawResponse(self)
|
|
117
121
|
self.with_streaming_response = PayiWithStreamedResponse(self)
|
|
118
122
|
|
|
@@ -227,6 +231,8 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
227
231
|
categories: resources.AsyncCategoriesResource
|
|
228
232
|
experiences: resources.AsyncExperiencesResource
|
|
229
233
|
csat: resources.AsyncCsatResource
|
|
234
|
+
billing_models: resources.AsyncBillingModelsResource
|
|
235
|
+
price_modifiers: resources.AsyncPriceModifiersResource
|
|
230
236
|
with_raw_response: AsyncPayiWithRawResponse
|
|
231
237
|
with_streaming_response: AsyncPayiWithStreamedResponse
|
|
232
238
|
|
|
@@ -289,6 +295,8 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
289
295
|
self.categories = resources.AsyncCategoriesResource(self)
|
|
290
296
|
self.experiences = resources.AsyncExperiencesResource(self)
|
|
291
297
|
self.csat = resources.AsyncCsatResource(self)
|
|
298
|
+
self.billing_models = resources.AsyncBillingModelsResource(self)
|
|
299
|
+
self.price_modifiers = resources.AsyncPriceModifiersResource(self)
|
|
292
300
|
self.with_raw_response = AsyncPayiWithRawResponse(self)
|
|
293
301
|
self.with_streaming_response = AsyncPayiWithStreamedResponse(self)
|
|
294
302
|
|
|
@@ -404,6 +412,8 @@ class PayiWithRawResponse:
|
|
|
404
412
|
self.categories = resources.CategoriesResourceWithRawResponse(client.categories)
|
|
405
413
|
self.experiences = resources.ExperiencesResourceWithRawResponse(client.experiences)
|
|
406
414
|
self.csat = resources.CsatResourceWithRawResponse(client.csat)
|
|
415
|
+
self.billing_models = resources.BillingModelsResourceWithRawResponse(client.billing_models)
|
|
416
|
+
self.price_modifiers = resources.PriceModifiersResourceWithRawResponse(client.price_modifiers)
|
|
407
417
|
|
|
408
418
|
|
|
409
419
|
class AsyncPayiWithRawResponse:
|
|
@@ -413,6 +423,8 @@ class AsyncPayiWithRawResponse:
|
|
|
413
423
|
self.categories = resources.AsyncCategoriesResourceWithRawResponse(client.categories)
|
|
414
424
|
self.experiences = resources.AsyncExperiencesResourceWithRawResponse(client.experiences)
|
|
415
425
|
self.csat = resources.AsyncCsatResourceWithRawResponse(client.csat)
|
|
426
|
+
self.billing_models = resources.AsyncBillingModelsResourceWithRawResponse(client.billing_models)
|
|
427
|
+
self.price_modifiers = resources.AsyncPriceModifiersResourceWithRawResponse(client.price_modifiers)
|
|
416
428
|
|
|
417
429
|
|
|
418
430
|
class PayiWithStreamedResponse:
|
|
@@ -422,6 +434,8 @@ class PayiWithStreamedResponse:
|
|
|
422
434
|
self.categories = resources.CategoriesResourceWithStreamingResponse(client.categories)
|
|
423
435
|
self.experiences = resources.ExperiencesResourceWithStreamingResponse(client.experiences)
|
|
424
436
|
self.csat = resources.CsatResourceWithStreamingResponse(client.csat)
|
|
437
|
+
self.billing_models = resources.BillingModelsResourceWithStreamingResponse(client.billing_models)
|
|
438
|
+
self.price_modifiers = resources.PriceModifiersResourceWithStreamingResponse(client.price_modifiers)
|
|
425
439
|
|
|
426
440
|
|
|
427
441
|
class AsyncPayiWithStreamedResponse:
|
|
@@ -431,6 +445,8 @@ class AsyncPayiWithStreamedResponse:
|
|
|
431
445
|
self.categories = resources.AsyncCategoriesResourceWithStreamingResponse(client.categories)
|
|
432
446
|
self.experiences = resources.AsyncExperiencesResourceWithStreamingResponse(client.experiences)
|
|
433
447
|
self.csat = resources.AsyncCsatResourceWithStreamingResponse(client.csat)
|
|
448
|
+
self.billing_models = resources.AsyncBillingModelsResourceWithStreamingResponse(client.billing_models)
|
|
449
|
+
self.price_modifiers = resources.AsyncPriceModifiersResourceWithStreamingResponse(client.price_modifiers)
|
|
434
450
|
|
|
435
451
|
|
|
436
452
|
Client = Payi
|
payi/_response.py
CHANGED
|
@@ -192,6 +192,9 @@ class BaseAPIResponse(Generic[R]):
|
|
|
192
192
|
if cast_to == float:
|
|
193
193
|
return cast(R, float(response.text))
|
|
194
194
|
|
|
195
|
+
if cast_to == bool:
|
|
196
|
+
return cast(R, response.text.lower() == "true")
|
|
197
|
+
|
|
195
198
|
origin = get_origin(cast_to) or cast_to
|
|
196
199
|
|
|
197
200
|
if origin == APIResponse:
|
payi/_version.py
CHANGED
payi/resources/__init__.py
CHANGED
|
@@ -40,6 +40,22 @@ from .experiences import (
|
|
|
40
40
|
ExperiencesResourceWithStreamingResponse,
|
|
41
41
|
AsyncExperiencesResourceWithStreamingResponse,
|
|
42
42
|
)
|
|
43
|
+
from .billing_models import (
|
|
44
|
+
BillingModelsResource,
|
|
45
|
+
AsyncBillingModelsResource,
|
|
46
|
+
BillingModelsResourceWithRawResponse,
|
|
47
|
+
AsyncBillingModelsResourceWithRawResponse,
|
|
48
|
+
BillingModelsResourceWithStreamingResponse,
|
|
49
|
+
AsyncBillingModelsResourceWithStreamingResponse,
|
|
50
|
+
)
|
|
51
|
+
from .price_modifiers import (
|
|
52
|
+
PriceModifiersResource,
|
|
53
|
+
AsyncPriceModifiersResource,
|
|
54
|
+
PriceModifiersResourceWithRawResponse,
|
|
55
|
+
AsyncPriceModifiersResourceWithRawResponse,
|
|
56
|
+
PriceModifiersResourceWithStreamingResponse,
|
|
57
|
+
AsyncPriceModifiersResourceWithStreamingResponse,
|
|
58
|
+
)
|
|
43
59
|
|
|
44
60
|
__all__ = [
|
|
45
61
|
"BudgetsResource",
|
|
@@ -72,4 +88,16 @@ __all__ = [
|
|
|
72
88
|
"AsyncCsatResourceWithRawResponse",
|
|
73
89
|
"CsatResourceWithStreamingResponse",
|
|
74
90
|
"AsyncCsatResourceWithStreamingResponse",
|
|
91
|
+
"BillingModelsResource",
|
|
92
|
+
"AsyncBillingModelsResource",
|
|
93
|
+
"BillingModelsResourceWithRawResponse",
|
|
94
|
+
"AsyncBillingModelsResourceWithRawResponse",
|
|
95
|
+
"BillingModelsResourceWithStreamingResponse",
|
|
96
|
+
"AsyncBillingModelsResourceWithStreamingResponse",
|
|
97
|
+
"PriceModifiersResource",
|
|
98
|
+
"AsyncPriceModifiersResource",
|
|
99
|
+
"PriceModifiersResourceWithRawResponse",
|
|
100
|
+
"AsyncPriceModifiersResourceWithRawResponse",
|
|
101
|
+
"PriceModifiersResourceWithStreamingResponse",
|
|
102
|
+
"AsyncPriceModifiersResourceWithStreamingResponse",
|
|
75
103
|
]
|
|
@@ -0,0 +1,492 @@
|
|
|
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
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..types import billing_model_create_params, billing_model_update_params
|
|
11
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
12
|
+
from .._utils import (
|
|
13
|
+
maybe_transform,
|
|
14
|
+
async_maybe_transform,
|
|
15
|
+
)
|
|
16
|
+
from .._compat import cached_property
|
|
17
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
18
|
+
from .._response import (
|
|
19
|
+
to_raw_response_wrapper,
|
|
20
|
+
to_streamed_response_wrapper,
|
|
21
|
+
async_to_raw_response_wrapper,
|
|
22
|
+
async_to_streamed_response_wrapper,
|
|
23
|
+
)
|
|
24
|
+
from .._base_client import make_request_options
|
|
25
|
+
from ..types.billing_model import BillingModel
|
|
26
|
+
from ..types.billing_model_list_response import BillingModelListResponse
|
|
27
|
+
|
|
28
|
+
__all__ = ["BillingModelsResource", "AsyncBillingModelsResource"]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class BillingModelsResource(SyncAPIResource):
|
|
32
|
+
@cached_property
|
|
33
|
+
def with_raw_response(self) -> BillingModelsResourceWithRawResponse:
|
|
34
|
+
"""
|
|
35
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
36
|
+
the raw response object instead of the parsed content.
|
|
37
|
+
|
|
38
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
39
|
+
"""
|
|
40
|
+
return BillingModelsResourceWithRawResponse(self)
|
|
41
|
+
|
|
42
|
+
@cached_property
|
|
43
|
+
def with_streaming_response(self) -> BillingModelsResourceWithStreamingResponse:
|
|
44
|
+
"""
|
|
45
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
46
|
+
|
|
47
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
|
|
48
|
+
"""
|
|
49
|
+
return BillingModelsResourceWithStreamingResponse(self)
|
|
50
|
+
|
|
51
|
+
def create(
|
|
52
|
+
self,
|
|
53
|
+
*,
|
|
54
|
+
name: str,
|
|
55
|
+
type: Literal["costplus"],
|
|
56
|
+
prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
|
|
57
|
+
prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
|
|
58
|
+
threshold: Optional[float] | NotGiven = NOT_GIVEN,
|
|
59
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
60
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
61
|
+
extra_headers: Headers | None = None,
|
|
62
|
+
extra_query: Query | None = None,
|
|
63
|
+
extra_body: Body | None = None,
|
|
64
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
65
|
+
) -> BillingModel:
|
|
66
|
+
"""
|
|
67
|
+
Args:
|
|
68
|
+
extra_headers: Send extra headers
|
|
69
|
+
|
|
70
|
+
extra_query: Add additional query parameters to the request
|
|
71
|
+
|
|
72
|
+
extra_body: Add additional JSON properties to the request
|
|
73
|
+
|
|
74
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
75
|
+
"""
|
|
76
|
+
return self._post(
|
|
77
|
+
"/api/v1/billing-model",
|
|
78
|
+
body=maybe_transform(
|
|
79
|
+
{
|
|
80
|
+
"name": name,
|
|
81
|
+
"type": type,
|
|
82
|
+
"prepaid_amount": prepaid_amount,
|
|
83
|
+
"prepaid_max": prepaid_max,
|
|
84
|
+
"threshold": threshold,
|
|
85
|
+
},
|
|
86
|
+
billing_model_create_params.BillingModelCreateParams,
|
|
87
|
+
),
|
|
88
|
+
options=make_request_options(
|
|
89
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
90
|
+
),
|
|
91
|
+
cast_to=BillingModel,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
def retrieve(
|
|
95
|
+
self,
|
|
96
|
+
billing_model_id: str,
|
|
97
|
+
*,
|
|
98
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
99
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
100
|
+
extra_headers: Headers | None = None,
|
|
101
|
+
extra_query: Query | None = None,
|
|
102
|
+
extra_body: Body | None = None,
|
|
103
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
104
|
+
) -> BillingModel:
|
|
105
|
+
"""
|
|
106
|
+
Args:
|
|
107
|
+
extra_headers: Send extra headers
|
|
108
|
+
|
|
109
|
+
extra_query: Add additional query parameters to the request
|
|
110
|
+
|
|
111
|
+
extra_body: Add additional JSON properties to the request
|
|
112
|
+
|
|
113
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
114
|
+
"""
|
|
115
|
+
if not billing_model_id:
|
|
116
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
117
|
+
return self._get(
|
|
118
|
+
f"/api/v1/billing-model/{billing_model_id}",
|
|
119
|
+
options=make_request_options(
|
|
120
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
121
|
+
),
|
|
122
|
+
cast_to=BillingModel,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
def update(
|
|
126
|
+
self,
|
|
127
|
+
billing_model_id: str,
|
|
128
|
+
*,
|
|
129
|
+
type: Literal["costplus"],
|
|
130
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
131
|
+
prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
|
|
132
|
+
prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
|
|
133
|
+
threshold: Optional[float] | NotGiven = NOT_GIVEN,
|
|
134
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
135
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
136
|
+
extra_headers: Headers | None = None,
|
|
137
|
+
extra_query: Query | None = None,
|
|
138
|
+
extra_body: Body | None = None,
|
|
139
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
140
|
+
) -> BillingModel:
|
|
141
|
+
"""
|
|
142
|
+
Args:
|
|
143
|
+
extra_headers: Send extra headers
|
|
144
|
+
|
|
145
|
+
extra_query: Add additional query parameters to the request
|
|
146
|
+
|
|
147
|
+
extra_body: Add additional JSON properties to the request
|
|
148
|
+
|
|
149
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
150
|
+
"""
|
|
151
|
+
if not billing_model_id:
|
|
152
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
153
|
+
return self._put(
|
|
154
|
+
f"/api/v1/billing-model/{billing_model_id}",
|
|
155
|
+
body=maybe_transform(
|
|
156
|
+
{
|
|
157
|
+
"type": type,
|
|
158
|
+
"name": name,
|
|
159
|
+
"prepaid_amount": prepaid_amount,
|
|
160
|
+
"prepaid_max": prepaid_max,
|
|
161
|
+
"threshold": threshold,
|
|
162
|
+
},
|
|
163
|
+
billing_model_update_params.BillingModelUpdateParams,
|
|
164
|
+
),
|
|
165
|
+
options=make_request_options(
|
|
166
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
167
|
+
),
|
|
168
|
+
cast_to=BillingModel,
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
def list(
|
|
172
|
+
self,
|
|
173
|
+
*,
|
|
174
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
175
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
176
|
+
extra_headers: Headers | None = None,
|
|
177
|
+
extra_query: Query | None = None,
|
|
178
|
+
extra_body: Body | None = None,
|
|
179
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
180
|
+
) -> BillingModelListResponse:
|
|
181
|
+
return self._get(
|
|
182
|
+
"/api/v1/billing-model",
|
|
183
|
+
options=make_request_options(
|
|
184
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
185
|
+
),
|
|
186
|
+
cast_to=BillingModelListResponse,
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
def set_default(
|
|
190
|
+
self,
|
|
191
|
+
billing_model_id: str,
|
|
192
|
+
*,
|
|
193
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
194
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
195
|
+
extra_headers: Headers | None = None,
|
|
196
|
+
extra_query: Query | None = None,
|
|
197
|
+
extra_body: Body | None = None,
|
|
198
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
199
|
+
) -> BillingModel:
|
|
200
|
+
"""
|
|
201
|
+
Args:
|
|
202
|
+
extra_headers: Send extra headers
|
|
203
|
+
|
|
204
|
+
extra_query: Add additional query parameters to the request
|
|
205
|
+
|
|
206
|
+
extra_body: Add additional JSON properties to the request
|
|
207
|
+
|
|
208
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
209
|
+
"""
|
|
210
|
+
if not billing_model_id:
|
|
211
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
212
|
+
return self._put(
|
|
213
|
+
f"/api/v1/billing-model/{billing_model_id}/default",
|
|
214
|
+
options=make_request_options(
|
|
215
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
216
|
+
),
|
|
217
|
+
cast_to=BillingModel,
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
class AsyncBillingModelsResource(AsyncAPIResource):
|
|
222
|
+
@cached_property
|
|
223
|
+
def with_raw_response(self) -> AsyncBillingModelsResourceWithRawResponse:
|
|
224
|
+
"""
|
|
225
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
226
|
+
the raw response object instead of the parsed content.
|
|
227
|
+
|
|
228
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
229
|
+
"""
|
|
230
|
+
return AsyncBillingModelsResourceWithRawResponse(self)
|
|
231
|
+
|
|
232
|
+
@cached_property
|
|
233
|
+
def with_streaming_response(self) -> AsyncBillingModelsResourceWithStreamingResponse:
|
|
234
|
+
"""
|
|
235
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
236
|
+
|
|
237
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
|
|
238
|
+
"""
|
|
239
|
+
return AsyncBillingModelsResourceWithStreamingResponse(self)
|
|
240
|
+
|
|
241
|
+
async def create(
|
|
242
|
+
self,
|
|
243
|
+
*,
|
|
244
|
+
name: str,
|
|
245
|
+
type: Literal["costplus"],
|
|
246
|
+
prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
|
|
247
|
+
prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
|
|
248
|
+
threshold: Optional[float] | NotGiven = NOT_GIVEN,
|
|
249
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
250
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
251
|
+
extra_headers: Headers | None = None,
|
|
252
|
+
extra_query: Query | None = None,
|
|
253
|
+
extra_body: Body | None = None,
|
|
254
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
255
|
+
) -> BillingModel:
|
|
256
|
+
"""
|
|
257
|
+
Args:
|
|
258
|
+
extra_headers: Send extra headers
|
|
259
|
+
|
|
260
|
+
extra_query: Add additional query parameters to the request
|
|
261
|
+
|
|
262
|
+
extra_body: Add additional JSON properties to the request
|
|
263
|
+
|
|
264
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
265
|
+
"""
|
|
266
|
+
return await self._post(
|
|
267
|
+
"/api/v1/billing-model",
|
|
268
|
+
body=await async_maybe_transform(
|
|
269
|
+
{
|
|
270
|
+
"name": name,
|
|
271
|
+
"type": type,
|
|
272
|
+
"prepaid_amount": prepaid_amount,
|
|
273
|
+
"prepaid_max": prepaid_max,
|
|
274
|
+
"threshold": threshold,
|
|
275
|
+
},
|
|
276
|
+
billing_model_create_params.BillingModelCreateParams,
|
|
277
|
+
),
|
|
278
|
+
options=make_request_options(
|
|
279
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
280
|
+
),
|
|
281
|
+
cast_to=BillingModel,
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
async def retrieve(
|
|
285
|
+
self,
|
|
286
|
+
billing_model_id: str,
|
|
287
|
+
*,
|
|
288
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
289
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
290
|
+
extra_headers: Headers | None = None,
|
|
291
|
+
extra_query: Query | None = None,
|
|
292
|
+
extra_body: Body | None = None,
|
|
293
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
294
|
+
) -> BillingModel:
|
|
295
|
+
"""
|
|
296
|
+
Args:
|
|
297
|
+
extra_headers: Send extra headers
|
|
298
|
+
|
|
299
|
+
extra_query: Add additional query parameters to the request
|
|
300
|
+
|
|
301
|
+
extra_body: Add additional JSON properties to the request
|
|
302
|
+
|
|
303
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
304
|
+
"""
|
|
305
|
+
if not billing_model_id:
|
|
306
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
307
|
+
return await self._get(
|
|
308
|
+
f"/api/v1/billing-model/{billing_model_id}",
|
|
309
|
+
options=make_request_options(
|
|
310
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
311
|
+
),
|
|
312
|
+
cast_to=BillingModel,
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
async def update(
|
|
316
|
+
self,
|
|
317
|
+
billing_model_id: str,
|
|
318
|
+
*,
|
|
319
|
+
type: Literal["costplus"],
|
|
320
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
321
|
+
prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
|
|
322
|
+
prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
|
|
323
|
+
threshold: Optional[float] | NotGiven = NOT_GIVEN,
|
|
324
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
325
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
326
|
+
extra_headers: Headers | None = None,
|
|
327
|
+
extra_query: Query | None = None,
|
|
328
|
+
extra_body: Body | None = None,
|
|
329
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
330
|
+
) -> BillingModel:
|
|
331
|
+
"""
|
|
332
|
+
Args:
|
|
333
|
+
extra_headers: Send extra headers
|
|
334
|
+
|
|
335
|
+
extra_query: Add additional query parameters to the request
|
|
336
|
+
|
|
337
|
+
extra_body: Add additional JSON properties to the request
|
|
338
|
+
|
|
339
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
340
|
+
"""
|
|
341
|
+
if not billing_model_id:
|
|
342
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
343
|
+
return await self._put(
|
|
344
|
+
f"/api/v1/billing-model/{billing_model_id}",
|
|
345
|
+
body=await async_maybe_transform(
|
|
346
|
+
{
|
|
347
|
+
"type": type,
|
|
348
|
+
"name": name,
|
|
349
|
+
"prepaid_amount": prepaid_amount,
|
|
350
|
+
"prepaid_max": prepaid_max,
|
|
351
|
+
"threshold": threshold,
|
|
352
|
+
},
|
|
353
|
+
billing_model_update_params.BillingModelUpdateParams,
|
|
354
|
+
),
|
|
355
|
+
options=make_request_options(
|
|
356
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
357
|
+
),
|
|
358
|
+
cast_to=BillingModel,
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
async def list(
|
|
362
|
+
self,
|
|
363
|
+
*,
|
|
364
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
365
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
366
|
+
extra_headers: Headers | None = None,
|
|
367
|
+
extra_query: Query | None = None,
|
|
368
|
+
extra_body: Body | None = None,
|
|
369
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
370
|
+
) -> BillingModelListResponse:
|
|
371
|
+
return await self._get(
|
|
372
|
+
"/api/v1/billing-model",
|
|
373
|
+
options=make_request_options(
|
|
374
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
375
|
+
),
|
|
376
|
+
cast_to=BillingModelListResponse,
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
async def set_default(
|
|
380
|
+
self,
|
|
381
|
+
billing_model_id: str,
|
|
382
|
+
*,
|
|
383
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
384
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
385
|
+
extra_headers: Headers | None = None,
|
|
386
|
+
extra_query: Query | None = None,
|
|
387
|
+
extra_body: Body | None = None,
|
|
388
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
389
|
+
) -> BillingModel:
|
|
390
|
+
"""
|
|
391
|
+
Args:
|
|
392
|
+
extra_headers: Send extra headers
|
|
393
|
+
|
|
394
|
+
extra_query: Add additional query parameters to the request
|
|
395
|
+
|
|
396
|
+
extra_body: Add additional JSON properties to the request
|
|
397
|
+
|
|
398
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
399
|
+
"""
|
|
400
|
+
if not billing_model_id:
|
|
401
|
+
raise ValueError(f"Expected a non-empty value for `billing_model_id` but received {billing_model_id!r}")
|
|
402
|
+
return await self._put(
|
|
403
|
+
f"/api/v1/billing-model/{billing_model_id}/default",
|
|
404
|
+
options=make_request_options(
|
|
405
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
406
|
+
),
|
|
407
|
+
cast_to=BillingModel,
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
class BillingModelsResourceWithRawResponse:
|
|
412
|
+
def __init__(self, billing_models: BillingModelsResource) -> None:
|
|
413
|
+
self._billing_models = billing_models
|
|
414
|
+
|
|
415
|
+
self.create = to_raw_response_wrapper(
|
|
416
|
+
billing_models.create,
|
|
417
|
+
)
|
|
418
|
+
self.retrieve = to_raw_response_wrapper(
|
|
419
|
+
billing_models.retrieve,
|
|
420
|
+
)
|
|
421
|
+
self.update = to_raw_response_wrapper(
|
|
422
|
+
billing_models.update,
|
|
423
|
+
)
|
|
424
|
+
self.list = to_raw_response_wrapper(
|
|
425
|
+
billing_models.list,
|
|
426
|
+
)
|
|
427
|
+
self.set_default = to_raw_response_wrapper(
|
|
428
|
+
billing_models.set_default,
|
|
429
|
+
)
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
class AsyncBillingModelsResourceWithRawResponse:
|
|
433
|
+
def __init__(self, billing_models: AsyncBillingModelsResource) -> None:
|
|
434
|
+
self._billing_models = billing_models
|
|
435
|
+
|
|
436
|
+
self.create = async_to_raw_response_wrapper(
|
|
437
|
+
billing_models.create,
|
|
438
|
+
)
|
|
439
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
440
|
+
billing_models.retrieve,
|
|
441
|
+
)
|
|
442
|
+
self.update = async_to_raw_response_wrapper(
|
|
443
|
+
billing_models.update,
|
|
444
|
+
)
|
|
445
|
+
self.list = async_to_raw_response_wrapper(
|
|
446
|
+
billing_models.list,
|
|
447
|
+
)
|
|
448
|
+
self.set_default = async_to_raw_response_wrapper(
|
|
449
|
+
billing_models.set_default,
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
class BillingModelsResourceWithStreamingResponse:
|
|
454
|
+
def __init__(self, billing_models: BillingModelsResource) -> None:
|
|
455
|
+
self._billing_models = billing_models
|
|
456
|
+
|
|
457
|
+
self.create = to_streamed_response_wrapper(
|
|
458
|
+
billing_models.create,
|
|
459
|
+
)
|
|
460
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
461
|
+
billing_models.retrieve,
|
|
462
|
+
)
|
|
463
|
+
self.update = to_streamed_response_wrapper(
|
|
464
|
+
billing_models.update,
|
|
465
|
+
)
|
|
466
|
+
self.list = to_streamed_response_wrapper(
|
|
467
|
+
billing_models.list,
|
|
468
|
+
)
|
|
469
|
+
self.set_default = to_streamed_response_wrapper(
|
|
470
|
+
billing_models.set_default,
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
class AsyncBillingModelsResourceWithStreamingResponse:
|
|
475
|
+
def __init__(self, billing_models: AsyncBillingModelsResource) -> None:
|
|
476
|
+
self._billing_models = billing_models
|
|
477
|
+
|
|
478
|
+
self.create = async_to_streamed_response_wrapper(
|
|
479
|
+
billing_models.create,
|
|
480
|
+
)
|
|
481
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
482
|
+
billing_models.retrieve,
|
|
483
|
+
)
|
|
484
|
+
self.update = async_to_streamed_response_wrapper(
|
|
485
|
+
billing_models.update,
|
|
486
|
+
)
|
|
487
|
+
self.list = async_to_streamed_response_wrapper(
|
|
488
|
+
billing_models.list,
|
|
489
|
+
)
|
|
490
|
+
self.set_default = async_to_streamed_response_wrapper(
|
|
491
|
+
billing_models.set_default,
|
|
492
|
+
)
|