payi 0.1.0a1__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/__init__.py +83 -0
- payi/_base_client.py +2006 -0
- payi/_client.py +414 -0
- payi/_compat.py +222 -0
- payi/_constants.py +14 -0
- payi/_exceptions.py +108 -0
- payi/_files.py +127 -0
- payi/_models.py +739 -0
- payi/_qs.py +150 -0
- payi/_resource.py +43 -0
- payi/_response.py +820 -0
- payi/_streaming.py +333 -0
- payi/_types.py +220 -0
- payi/_utils/__init__.py +52 -0
- payi/_utils/_logs.py +25 -0
- payi/_utils/_proxy.py +63 -0
- payi/_utils/_reflection.py +8 -0
- payi/_utils/_streams.py +12 -0
- payi/_utils/_sync.py +81 -0
- payi/_utils/_transform.py +382 -0
- payi/_utils/_typing.py +120 -0
- payi/_utils/_utils.py +402 -0
- payi/_version.py +4 -0
- payi/lib/.keep +4 -0
- payi/py.typed +0 -0
- payi/resources/__init__.py +33 -0
- payi/resources/budgets/__init__.py +33 -0
- payi/resources/budgets/budgets.py +717 -0
- payi/resources/budgets/tags.py +529 -0
- payi/resources/ingest_requests.py +187 -0
- payi/types/__init__.py +13 -0
- payi/types/budget_create_params.py +26 -0
- payi/types/budget_history_response.py +110 -0
- payi/types/budget_list_params.py +25 -0
- payi/types/budget_response.py +98 -0
- payi/types/budget_update_params.py +17 -0
- payi/types/budgets/__init__.py +13 -0
- payi/types/budgets/budget_tags_response.py +18 -0
- payi/types/budgets/tag_create_params.py +16 -0
- payi/types/budgets/tag_create_response.py +9 -0
- payi/types/budgets/tag_delete_response.py +9 -0
- payi/types/budgets/tag_list_response.py +9 -0
- payi/types/budgets/tag_remove_params.py +16 -0
- payi/types/budgets/tag_remove_response.py +9 -0
- payi/types/budgets/tag_update_params.py +16 -0
- payi/types/budgets/tag_update_response.py +9 -0
- payi/types/default_response.py +13 -0
- payi/types/ingest_request_create_params.py +27 -0
- payi/types/paged_budget_list.py +110 -0
- payi/types/successful_proxy_result.py +43 -0
- payi-0.1.0a1.dist-info/METADATA +355 -0
- payi-0.1.0a1.dist-info/RECORD +54 -0
- payi-0.1.0a1.dist-info/WHEEL +4 -0
- payi-0.1.0a1.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,717 @@
|
|
|
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 .tags import (
|
|
11
|
+
TagsResource,
|
|
12
|
+
AsyncTagsResource,
|
|
13
|
+
TagsResourceWithRawResponse,
|
|
14
|
+
AsyncTagsResourceWithRawResponse,
|
|
15
|
+
TagsResourceWithStreamingResponse,
|
|
16
|
+
AsyncTagsResourceWithStreamingResponse,
|
|
17
|
+
)
|
|
18
|
+
from ...types import budget_list_params, budget_create_params, budget_update_params
|
|
19
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
20
|
+
from ..._utils import (
|
|
21
|
+
maybe_transform,
|
|
22
|
+
strip_not_given,
|
|
23
|
+
async_maybe_transform,
|
|
24
|
+
)
|
|
25
|
+
from ..._compat import cached_property
|
|
26
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
27
|
+
from ..._response import (
|
|
28
|
+
to_raw_response_wrapper,
|
|
29
|
+
to_streamed_response_wrapper,
|
|
30
|
+
async_to_raw_response_wrapper,
|
|
31
|
+
async_to_streamed_response_wrapper,
|
|
32
|
+
)
|
|
33
|
+
from ..._base_client import (
|
|
34
|
+
make_request_options,
|
|
35
|
+
)
|
|
36
|
+
from ...types.budget_response import BudgetResponse
|
|
37
|
+
from ...types.default_response import DefaultResponse
|
|
38
|
+
from ...types.paged_budget_list import PagedBudgetList
|
|
39
|
+
from ...types.budget_history_response import BudgetHistoryResponse
|
|
40
|
+
|
|
41
|
+
__all__ = ["BudgetsResource", "AsyncBudgetsResource"]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class BudgetsResource(SyncAPIResource):
|
|
45
|
+
@cached_property
|
|
46
|
+
def tags(self) -> TagsResource:
|
|
47
|
+
return TagsResource(self._client)
|
|
48
|
+
|
|
49
|
+
@cached_property
|
|
50
|
+
def with_raw_response(self) -> BudgetsResourceWithRawResponse:
|
|
51
|
+
return BudgetsResourceWithRawResponse(self)
|
|
52
|
+
|
|
53
|
+
@cached_property
|
|
54
|
+
def with_streaming_response(self) -> BudgetsResourceWithStreamingResponse:
|
|
55
|
+
return BudgetsResourceWithStreamingResponse(self)
|
|
56
|
+
|
|
57
|
+
def create(
|
|
58
|
+
self,
|
|
59
|
+
*,
|
|
60
|
+
budget_name: str,
|
|
61
|
+
max: float,
|
|
62
|
+
base_cost_estimate: Literal["Max"] | NotGiven = NOT_GIVEN,
|
|
63
|
+
budget_response_type: Literal["Block", "Allow"] | NotGiven = NOT_GIVEN,
|
|
64
|
+
budget_tags: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
65
|
+
budget_type: Literal["Conservative", "Liberal"] | NotGiven = NOT_GIVEN,
|
|
66
|
+
x_proxy_application_key: str | NotGiven = NOT_GIVEN,
|
|
67
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
68
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
69
|
+
extra_headers: Headers | None = None,
|
|
70
|
+
extra_query: Query | None = None,
|
|
71
|
+
extra_body: Body | None = None,
|
|
72
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
73
|
+
) -> BudgetResponse:
|
|
74
|
+
"""
|
|
75
|
+
Create a Budget
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
extra_headers: Send extra headers
|
|
79
|
+
|
|
80
|
+
extra_query: Add additional query parameters to the request
|
|
81
|
+
|
|
82
|
+
extra_body: Add additional JSON properties to the request
|
|
83
|
+
|
|
84
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
85
|
+
"""
|
|
86
|
+
extra_headers = {
|
|
87
|
+
**strip_not_given({"xProxy-Application-Key": x_proxy_application_key}),
|
|
88
|
+
**(extra_headers or {}),
|
|
89
|
+
}
|
|
90
|
+
return self._post(
|
|
91
|
+
"/api/v1/budgets",
|
|
92
|
+
body=maybe_transform(
|
|
93
|
+
{
|
|
94
|
+
"budget_name": budget_name,
|
|
95
|
+
"max": max,
|
|
96
|
+
"base_cost_estimate": base_cost_estimate,
|
|
97
|
+
"budget_response_type": budget_response_type,
|
|
98
|
+
"budget_tags": budget_tags,
|
|
99
|
+
"budget_type": budget_type,
|
|
100
|
+
},
|
|
101
|
+
budget_create_params.BudgetCreateParams,
|
|
102
|
+
),
|
|
103
|
+
options=make_request_options(
|
|
104
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
105
|
+
),
|
|
106
|
+
cast_to=BudgetResponse,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
def retrieve(
|
|
110
|
+
self,
|
|
111
|
+
budget_id: str,
|
|
112
|
+
*,
|
|
113
|
+
x_proxy_application_key: str | NotGiven = NOT_GIVEN,
|
|
114
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
115
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
116
|
+
extra_headers: Headers | None = None,
|
|
117
|
+
extra_query: Query | None = None,
|
|
118
|
+
extra_body: Body | None = None,
|
|
119
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
120
|
+
) -> BudgetResponse:
|
|
121
|
+
"""
|
|
122
|
+
Get a Budget's details
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
extra_headers: Send extra headers
|
|
126
|
+
|
|
127
|
+
extra_query: Add additional query parameters to the request
|
|
128
|
+
|
|
129
|
+
extra_body: Add additional JSON properties to the request
|
|
130
|
+
|
|
131
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
132
|
+
"""
|
|
133
|
+
if not budget_id:
|
|
134
|
+
raise ValueError(f"Expected a non-empty value for `budget_id` but received {budget_id!r}")
|
|
135
|
+
extra_headers = {
|
|
136
|
+
**strip_not_given({"xProxy-Application-Key": x_proxy_application_key}),
|
|
137
|
+
**(extra_headers or {}),
|
|
138
|
+
}
|
|
139
|
+
return self._get(
|
|
140
|
+
f"/api/v1/budgets/{budget_id}",
|
|
141
|
+
options=make_request_options(
|
|
142
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
143
|
+
),
|
|
144
|
+
cast_to=BudgetResponse,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
def update(
|
|
148
|
+
self,
|
|
149
|
+
budget_id: str,
|
|
150
|
+
*,
|
|
151
|
+
budget_name: str,
|
|
152
|
+
max: float | NotGiven = NOT_GIVEN,
|
|
153
|
+
x_proxy_application_key: str | NotGiven = NOT_GIVEN,
|
|
154
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
155
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
156
|
+
extra_headers: Headers | None = None,
|
|
157
|
+
extra_query: Query | None = None,
|
|
158
|
+
extra_body: Body | None = None,
|
|
159
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
160
|
+
) -> BudgetResponse:
|
|
161
|
+
"""
|
|
162
|
+
Update a Budget
|
|
163
|
+
|
|
164
|
+
Args:
|
|
165
|
+
extra_headers: Send extra headers
|
|
166
|
+
|
|
167
|
+
extra_query: Add additional query parameters to the request
|
|
168
|
+
|
|
169
|
+
extra_body: Add additional JSON properties to the request
|
|
170
|
+
|
|
171
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
172
|
+
"""
|
|
173
|
+
if not budget_id:
|
|
174
|
+
raise ValueError(f"Expected a non-empty value for `budget_id` but received {budget_id!r}")
|
|
175
|
+
extra_headers = {
|
|
176
|
+
**strip_not_given({"xProxy-Application-Key": x_proxy_application_key}),
|
|
177
|
+
**(extra_headers or {}),
|
|
178
|
+
}
|
|
179
|
+
return self._put(
|
|
180
|
+
f"/api/v1/budgets/{budget_id}",
|
|
181
|
+
body=maybe_transform(
|
|
182
|
+
{
|
|
183
|
+
"budget_name": budget_name,
|
|
184
|
+
"max": max,
|
|
185
|
+
},
|
|
186
|
+
budget_update_params.BudgetUpdateParams,
|
|
187
|
+
),
|
|
188
|
+
options=make_request_options(
|
|
189
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
190
|
+
),
|
|
191
|
+
cast_to=BudgetResponse,
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
def list(
|
|
195
|
+
self,
|
|
196
|
+
*,
|
|
197
|
+
budget_name: str | NotGiven = NOT_GIVEN,
|
|
198
|
+
page_number: int | NotGiven = NOT_GIVEN,
|
|
199
|
+
page_size: int | NotGiven = NOT_GIVEN,
|
|
200
|
+
sort_ascending: bool | NotGiven = NOT_GIVEN,
|
|
201
|
+
sort_by: str | NotGiven = NOT_GIVEN,
|
|
202
|
+
tags: str | NotGiven = NOT_GIVEN,
|
|
203
|
+
x_proxy_application_key: str | NotGiven = NOT_GIVEN,
|
|
204
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
205
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
206
|
+
extra_headers: Headers | None = None,
|
|
207
|
+
extra_query: Query | None = None,
|
|
208
|
+
extra_body: Body | None = None,
|
|
209
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
210
|
+
) -> PagedBudgetList:
|
|
211
|
+
"""
|
|
212
|
+
Get all Budgets
|
|
213
|
+
|
|
214
|
+
Args:
|
|
215
|
+
extra_headers: Send extra headers
|
|
216
|
+
|
|
217
|
+
extra_query: Add additional query parameters to the request
|
|
218
|
+
|
|
219
|
+
extra_body: Add additional JSON properties to the request
|
|
220
|
+
|
|
221
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
222
|
+
"""
|
|
223
|
+
extra_headers = {
|
|
224
|
+
**strip_not_given({"xProxy-Application-Key": x_proxy_application_key}),
|
|
225
|
+
**(extra_headers or {}),
|
|
226
|
+
}
|
|
227
|
+
return self._get(
|
|
228
|
+
"/api/v1/budgets",
|
|
229
|
+
options=make_request_options(
|
|
230
|
+
extra_headers=extra_headers,
|
|
231
|
+
extra_query=extra_query,
|
|
232
|
+
extra_body=extra_body,
|
|
233
|
+
timeout=timeout,
|
|
234
|
+
query=maybe_transform(
|
|
235
|
+
{
|
|
236
|
+
"budget_name": budget_name,
|
|
237
|
+
"page_number": page_number,
|
|
238
|
+
"page_size": page_size,
|
|
239
|
+
"sort_ascending": sort_ascending,
|
|
240
|
+
"sort_by": sort_by,
|
|
241
|
+
"tags": tags,
|
|
242
|
+
},
|
|
243
|
+
budget_list_params.BudgetListParams,
|
|
244
|
+
),
|
|
245
|
+
),
|
|
246
|
+
cast_to=PagedBudgetList,
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
def delete(
|
|
250
|
+
self,
|
|
251
|
+
budget_id: str,
|
|
252
|
+
*,
|
|
253
|
+
x_proxy_application_key: str | NotGiven = NOT_GIVEN,
|
|
254
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
255
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
256
|
+
extra_headers: Headers | None = None,
|
|
257
|
+
extra_query: Query | None = None,
|
|
258
|
+
extra_body: Body | None = None,
|
|
259
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
260
|
+
) -> DefaultResponse:
|
|
261
|
+
"""
|
|
262
|
+
Delete a Budget
|
|
263
|
+
|
|
264
|
+
Args:
|
|
265
|
+
extra_headers: Send extra headers
|
|
266
|
+
|
|
267
|
+
extra_query: Add additional query parameters to the request
|
|
268
|
+
|
|
269
|
+
extra_body: Add additional JSON properties to the request
|
|
270
|
+
|
|
271
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
272
|
+
"""
|
|
273
|
+
if not budget_id:
|
|
274
|
+
raise ValueError(f"Expected a non-empty value for `budget_id` but received {budget_id!r}")
|
|
275
|
+
extra_headers = {
|
|
276
|
+
**strip_not_given({"xProxy-Application-Key": x_proxy_application_key}),
|
|
277
|
+
**(extra_headers or {}),
|
|
278
|
+
}
|
|
279
|
+
return self._delete(
|
|
280
|
+
f"/api/v1/budgets/{budget_id}",
|
|
281
|
+
options=make_request_options(
|
|
282
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
283
|
+
),
|
|
284
|
+
cast_to=DefaultResponse,
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
def reset(
|
|
288
|
+
self,
|
|
289
|
+
budget_id: str,
|
|
290
|
+
*,
|
|
291
|
+
x_proxy_application_key: str | NotGiven = NOT_GIVEN,
|
|
292
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
293
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
294
|
+
extra_headers: Headers | None = None,
|
|
295
|
+
extra_query: Query | None = None,
|
|
296
|
+
extra_body: Body | None = None,
|
|
297
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
298
|
+
) -> BudgetHistoryResponse:
|
|
299
|
+
"""
|
|
300
|
+
Reset the Budget
|
|
301
|
+
|
|
302
|
+
Args:
|
|
303
|
+
extra_headers: Send extra headers
|
|
304
|
+
|
|
305
|
+
extra_query: Add additional query parameters to the request
|
|
306
|
+
|
|
307
|
+
extra_body: Add additional JSON properties to the request
|
|
308
|
+
|
|
309
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
310
|
+
"""
|
|
311
|
+
if not budget_id:
|
|
312
|
+
raise ValueError(f"Expected a non-empty value for `budget_id` but received {budget_id!r}")
|
|
313
|
+
extra_headers = {
|
|
314
|
+
**strip_not_given({"xProxy-Application-Key": x_proxy_application_key}),
|
|
315
|
+
**(extra_headers or {}),
|
|
316
|
+
}
|
|
317
|
+
return self._post(
|
|
318
|
+
f"/api/v1/budgets/{budget_id}/reset",
|
|
319
|
+
options=make_request_options(
|
|
320
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
321
|
+
),
|
|
322
|
+
cast_to=BudgetHistoryResponse,
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
class AsyncBudgetsResource(AsyncAPIResource):
|
|
327
|
+
@cached_property
|
|
328
|
+
def tags(self) -> AsyncTagsResource:
|
|
329
|
+
return AsyncTagsResource(self._client)
|
|
330
|
+
|
|
331
|
+
@cached_property
|
|
332
|
+
def with_raw_response(self) -> AsyncBudgetsResourceWithRawResponse:
|
|
333
|
+
return AsyncBudgetsResourceWithRawResponse(self)
|
|
334
|
+
|
|
335
|
+
@cached_property
|
|
336
|
+
def with_streaming_response(self) -> AsyncBudgetsResourceWithStreamingResponse:
|
|
337
|
+
return AsyncBudgetsResourceWithStreamingResponse(self)
|
|
338
|
+
|
|
339
|
+
async def create(
|
|
340
|
+
self,
|
|
341
|
+
*,
|
|
342
|
+
budget_name: str,
|
|
343
|
+
max: float,
|
|
344
|
+
base_cost_estimate: Literal["Max"] | NotGiven = NOT_GIVEN,
|
|
345
|
+
budget_response_type: Literal["Block", "Allow"] | NotGiven = NOT_GIVEN,
|
|
346
|
+
budget_tags: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
347
|
+
budget_type: Literal["Conservative", "Liberal"] | NotGiven = NOT_GIVEN,
|
|
348
|
+
x_proxy_application_key: str | NotGiven = NOT_GIVEN,
|
|
349
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
350
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
351
|
+
extra_headers: Headers | None = None,
|
|
352
|
+
extra_query: Query | None = None,
|
|
353
|
+
extra_body: Body | None = None,
|
|
354
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
355
|
+
) -> BudgetResponse:
|
|
356
|
+
"""
|
|
357
|
+
Create a Budget
|
|
358
|
+
|
|
359
|
+
Args:
|
|
360
|
+
extra_headers: Send extra headers
|
|
361
|
+
|
|
362
|
+
extra_query: Add additional query parameters to the request
|
|
363
|
+
|
|
364
|
+
extra_body: Add additional JSON properties to the request
|
|
365
|
+
|
|
366
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
367
|
+
"""
|
|
368
|
+
extra_headers = {
|
|
369
|
+
**strip_not_given({"xProxy-Application-Key": x_proxy_application_key}),
|
|
370
|
+
**(extra_headers or {}),
|
|
371
|
+
}
|
|
372
|
+
return await self._post(
|
|
373
|
+
"/api/v1/budgets",
|
|
374
|
+
body=await async_maybe_transform(
|
|
375
|
+
{
|
|
376
|
+
"budget_name": budget_name,
|
|
377
|
+
"max": max,
|
|
378
|
+
"base_cost_estimate": base_cost_estimate,
|
|
379
|
+
"budget_response_type": budget_response_type,
|
|
380
|
+
"budget_tags": budget_tags,
|
|
381
|
+
"budget_type": budget_type,
|
|
382
|
+
},
|
|
383
|
+
budget_create_params.BudgetCreateParams,
|
|
384
|
+
),
|
|
385
|
+
options=make_request_options(
|
|
386
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
387
|
+
),
|
|
388
|
+
cast_to=BudgetResponse,
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
async def retrieve(
|
|
392
|
+
self,
|
|
393
|
+
budget_id: str,
|
|
394
|
+
*,
|
|
395
|
+
x_proxy_application_key: str | NotGiven = NOT_GIVEN,
|
|
396
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
397
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
398
|
+
extra_headers: Headers | None = None,
|
|
399
|
+
extra_query: Query | None = None,
|
|
400
|
+
extra_body: Body | None = None,
|
|
401
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
402
|
+
) -> BudgetResponse:
|
|
403
|
+
"""
|
|
404
|
+
Get a Budget's details
|
|
405
|
+
|
|
406
|
+
Args:
|
|
407
|
+
extra_headers: Send extra headers
|
|
408
|
+
|
|
409
|
+
extra_query: Add additional query parameters to the request
|
|
410
|
+
|
|
411
|
+
extra_body: Add additional JSON properties to the request
|
|
412
|
+
|
|
413
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
414
|
+
"""
|
|
415
|
+
if not budget_id:
|
|
416
|
+
raise ValueError(f"Expected a non-empty value for `budget_id` but received {budget_id!r}")
|
|
417
|
+
extra_headers = {
|
|
418
|
+
**strip_not_given({"xProxy-Application-Key": x_proxy_application_key}),
|
|
419
|
+
**(extra_headers or {}),
|
|
420
|
+
}
|
|
421
|
+
return await self._get(
|
|
422
|
+
f"/api/v1/budgets/{budget_id}",
|
|
423
|
+
options=make_request_options(
|
|
424
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
425
|
+
),
|
|
426
|
+
cast_to=BudgetResponse,
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
async def update(
|
|
430
|
+
self,
|
|
431
|
+
budget_id: str,
|
|
432
|
+
*,
|
|
433
|
+
budget_name: str,
|
|
434
|
+
max: float | NotGiven = NOT_GIVEN,
|
|
435
|
+
x_proxy_application_key: str | NotGiven = NOT_GIVEN,
|
|
436
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
437
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
438
|
+
extra_headers: Headers | None = None,
|
|
439
|
+
extra_query: Query | None = None,
|
|
440
|
+
extra_body: Body | None = None,
|
|
441
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
442
|
+
) -> BudgetResponse:
|
|
443
|
+
"""
|
|
444
|
+
Update a Budget
|
|
445
|
+
|
|
446
|
+
Args:
|
|
447
|
+
extra_headers: Send extra headers
|
|
448
|
+
|
|
449
|
+
extra_query: Add additional query parameters to the request
|
|
450
|
+
|
|
451
|
+
extra_body: Add additional JSON properties to the request
|
|
452
|
+
|
|
453
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
454
|
+
"""
|
|
455
|
+
if not budget_id:
|
|
456
|
+
raise ValueError(f"Expected a non-empty value for `budget_id` but received {budget_id!r}")
|
|
457
|
+
extra_headers = {
|
|
458
|
+
**strip_not_given({"xProxy-Application-Key": x_proxy_application_key}),
|
|
459
|
+
**(extra_headers or {}),
|
|
460
|
+
}
|
|
461
|
+
return await self._put(
|
|
462
|
+
f"/api/v1/budgets/{budget_id}",
|
|
463
|
+
body=await async_maybe_transform(
|
|
464
|
+
{
|
|
465
|
+
"budget_name": budget_name,
|
|
466
|
+
"max": max,
|
|
467
|
+
},
|
|
468
|
+
budget_update_params.BudgetUpdateParams,
|
|
469
|
+
),
|
|
470
|
+
options=make_request_options(
|
|
471
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
472
|
+
),
|
|
473
|
+
cast_to=BudgetResponse,
|
|
474
|
+
)
|
|
475
|
+
|
|
476
|
+
async def list(
|
|
477
|
+
self,
|
|
478
|
+
*,
|
|
479
|
+
budget_name: str | NotGiven = NOT_GIVEN,
|
|
480
|
+
page_number: int | NotGiven = NOT_GIVEN,
|
|
481
|
+
page_size: int | NotGiven = NOT_GIVEN,
|
|
482
|
+
sort_ascending: bool | NotGiven = NOT_GIVEN,
|
|
483
|
+
sort_by: str | NotGiven = NOT_GIVEN,
|
|
484
|
+
tags: str | NotGiven = NOT_GIVEN,
|
|
485
|
+
x_proxy_application_key: str | NotGiven = NOT_GIVEN,
|
|
486
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
487
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
488
|
+
extra_headers: Headers | None = None,
|
|
489
|
+
extra_query: Query | None = None,
|
|
490
|
+
extra_body: Body | None = None,
|
|
491
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
492
|
+
) -> PagedBudgetList:
|
|
493
|
+
"""
|
|
494
|
+
Get all Budgets
|
|
495
|
+
|
|
496
|
+
Args:
|
|
497
|
+
extra_headers: Send extra headers
|
|
498
|
+
|
|
499
|
+
extra_query: Add additional query parameters to the request
|
|
500
|
+
|
|
501
|
+
extra_body: Add additional JSON properties to the request
|
|
502
|
+
|
|
503
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
504
|
+
"""
|
|
505
|
+
extra_headers = {
|
|
506
|
+
**strip_not_given({"xProxy-Application-Key": x_proxy_application_key}),
|
|
507
|
+
**(extra_headers or {}),
|
|
508
|
+
}
|
|
509
|
+
return await self._get(
|
|
510
|
+
"/api/v1/budgets",
|
|
511
|
+
options=make_request_options(
|
|
512
|
+
extra_headers=extra_headers,
|
|
513
|
+
extra_query=extra_query,
|
|
514
|
+
extra_body=extra_body,
|
|
515
|
+
timeout=timeout,
|
|
516
|
+
query=await async_maybe_transform(
|
|
517
|
+
{
|
|
518
|
+
"budget_name": budget_name,
|
|
519
|
+
"page_number": page_number,
|
|
520
|
+
"page_size": page_size,
|
|
521
|
+
"sort_ascending": sort_ascending,
|
|
522
|
+
"sort_by": sort_by,
|
|
523
|
+
"tags": tags,
|
|
524
|
+
},
|
|
525
|
+
budget_list_params.BudgetListParams,
|
|
526
|
+
),
|
|
527
|
+
),
|
|
528
|
+
cast_to=PagedBudgetList,
|
|
529
|
+
)
|
|
530
|
+
|
|
531
|
+
async def delete(
|
|
532
|
+
self,
|
|
533
|
+
budget_id: str,
|
|
534
|
+
*,
|
|
535
|
+
x_proxy_application_key: str | NotGiven = NOT_GIVEN,
|
|
536
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
537
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
538
|
+
extra_headers: Headers | None = None,
|
|
539
|
+
extra_query: Query | None = None,
|
|
540
|
+
extra_body: Body | None = None,
|
|
541
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
542
|
+
) -> DefaultResponse:
|
|
543
|
+
"""
|
|
544
|
+
Delete a Budget
|
|
545
|
+
|
|
546
|
+
Args:
|
|
547
|
+
extra_headers: Send extra headers
|
|
548
|
+
|
|
549
|
+
extra_query: Add additional query parameters to the request
|
|
550
|
+
|
|
551
|
+
extra_body: Add additional JSON properties to the request
|
|
552
|
+
|
|
553
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
554
|
+
"""
|
|
555
|
+
if not budget_id:
|
|
556
|
+
raise ValueError(f"Expected a non-empty value for `budget_id` but received {budget_id!r}")
|
|
557
|
+
extra_headers = {
|
|
558
|
+
**strip_not_given({"xProxy-Application-Key": x_proxy_application_key}),
|
|
559
|
+
**(extra_headers or {}),
|
|
560
|
+
}
|
|
561
|
+
return await self._delete(
|
|
562
|
+
f"/api/v1/budgets/{budget_id}",
|
|
563
|
+
options=make_request_options(
|
|
564
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
565
|
+
),
|
|
566
|
+
cast_to=DefaultResponse,
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
async def reset(
|
|
570
|
+
self,
|
|
571
|
+
budget_id: str,
|
|
572
|
+
*,
|
|
573
|
+
x_proxy_application_key: str | NotGiven = NOT_GIVEN,
|
|
574
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
575
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
576
|
+
extra_headers: Headers | None = None,
|
|
577
|
+
extra_query: Query | None = None,
|
|
578
|
+
extra_body: Body | None = None,
|
|
579
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
580
|
+
) -> BudgetHistoryResponse:
|
|
581
|
+
"""
|
|
582
|
+
Reset the Budget
|
|
583
|
+
|
|
584
|
+
Args:
|
|
585
|
+
extra_headers: Send extra headers
|
|
586
|
+
|
|
587
|
+
extra_query: Add additional query parameters to the request
|
|
588
|
+
|
|
589
|
+
extra_body: Add additional JSON properties to the request
|
|
590
|
+
|
|
591
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
592
|
+
"""
|
|
593
|
+
if not budget_id:
|
|
594
|
+
raise ValueError(f"Expected a non-empty value for `budget_id` but received {budget_id!r}")
|
|
595
|
+
extra_headers = {
|
|
596
|
+
**strip_not_given({"xProxy-Application-Key": x_proxy_application_key}),
|
|
597
|
+
**(extra_headers or {}),
|
|
598
|
+
}
|
|
599
|
+
return await self._post(
|
|
600
|
+
f"/api/v1/budgets/{budget_id}/reset",
|
|
601
|
+
options=make_request_options(
|
|
602
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
603
|
+
),
|
|
604
|
+
cast_to=BudgetHistoryResponse,
|
|
605
|
+
)
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
class BudgetsResourceWithRawResponse:
|
|
609
|
+
def __init__(self, budgets: BudgetsResource) -> None:
|
|
610
|
+
self._budgets = budgets
|
|
611
|
+
|
|
612
|
+
self.create = to_raw_response_wrapper(
|
|
613
|
+
budgets.create,
|
|
614
|
+
)
|
|
615
|
+
self.retrieve = to_raw_response_wrapper(
|
|
616
|
+
budgets.retrieve,
|
|
617
|
+
)
|
|
618
|
+
self.update = to_raw_response_wrapper(
|
|
619
|
+
budgets.update,
|
|
620
|
+
)
|
|
621
|
+
self.list = to_raw_response_wrapper(
|
|
622
|
+
budgets.list,
|
|
623
|
+
)
|
|
624
|
+
self.delete = to_raw_response_wrapper(
|
|
625
|
+
budgets.delete,
|
|
626
|
+
)
|
|
627
|
+
self.reset = to_raw_response_wrapper(
|
|
628
|
+
budgets.reset,
|
|
629
|
+
)
|
|
630
|
+
|
|
631
|
+
@cached_property
|
|
632
|
+
def tags(self) -> TagsResourceWithRawResponse:
|
|
633
|
+
return TagsResourceWithRawResponse(self._budgets.tags)
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
class AsyncBudgetsResourceWithRawResponse:
|
|
637
|
+
def __init__(self, budgets: AsyncBudgetsResource) -> None:
|
|
638
|
+
self._budgets = budgets
|
|
639
|
+
|
|
640
|
+
self.create = async_to_raw_response_wrapper(
|
|
641
|
+
budgets.create,
|
|
642
|
+
)
|
|
643
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
644
|
+
budgets.retrieve,
|
|
645
|
+
)
|
|
646
|
+
self.update = async_to_raw_response_wrapper(
|
|
647
|
+
budgets.update,
|
|
648
|
+
)
|
|
649
|
+
self.list = async_to_raw_response_wrapper(
|
|
650
|
+
budgets.list,
|
|
651
|
+
)
|
|
652
|
+
self.delete = async_to_raw_response_wrapper(
|
|
653
|
+
budgets.delete,
|
|
654
|
+
)
|
|
655
|
+
self.reset = async_to_raw_response_wrapper(
|
|
656
|
+
budgets.reset,
|
|
657
|
+
)
|
|
658
|
+
|
|
659
|
+
@cached_property
|
|
660
|
+
def tags(self) -> AsyncTagsResourceWithRawResponse:
|
|
661
|
+
return AsyncTagsResourceWithRawResponse(self._budgets.tags)
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
class BudgetsResourceWithStreamingResponse:
|
|
665
|
+
def __init__(self, budgets: BudgetsResource) -> None:
|
|
666
|
+
self._budgets = budgets
|
|
667
|
+
|
|
668
|
+
self.create = to_streamed_response_wrapper(
|
|
669
|
+
budgets.create,
|
|
670
|
+
)
|
|
671
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
672
|
+
budgets.retrieve,
|
|
673
|
+
)
|
|
674
|
+
self.update = to_streamed_response_wrapper(
|
|
675
|
+
budgets.update,
|
|
676
|
+
)
|
|
677
|
+
self.list = to_streamed_response_wrapper(
|
|
678
|
+
budgets.list,
|
|
679
|
+
)
|
|
680
|
+
self.delete = to_streamed_response_wrapper(
|
|
681
|
+
budgets.delete,
|
|
682
|
+
)
|
|
683
|
+
self.reset = to_streamed_response_wrapper(
|
|
684
|
+
budgets.reset,
|
|
685
|
+
)
|
|
686
|
+
|
|
687
|
+
@cached_property
|
|
688
|
+
def tags(self) -> TagsResourceWithStreamingResponse:
|
|
689
|
+
return TagsResourceWithStreamingResponse(self._budgets.tags)
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
class AsyncBudgetsResourceWithStreamingResponse:
|
|
693
|
+
def __init__(self, budgets: AsyncBudgetsResource) -> None:
|
|
694
|
+
self._budgets = budgets
|
|
695
|
+
|
|
696
|
+
self.create = async_to_streamed_response_wrapper(
|
|
697
|
+
budgets.create,
|
|
698
|
+
)
|
|
699
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
700
|
+
budgets.retrieve,
|
|
701
|
+
)
|
|
702
|
+
self.update = async_to_streamed_response_wrapper(
|
|
703
|
+
budgets.update,
|
|
704
|
+
)
|
|
705
|
+
self.list = async_to_streamed_response_wrapper(
|
|
706
|
+
budgets.list,
|
|
707
|
+
)
|
|
708
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
709
|
+
budgets.delete,
|
|
710
|
+
)
|
|
711
|
+
self.reset = async_to_streamed_response_wrapper(
|
|
712
|
+
budgets.reset,
|
|
713
|
+
)
|
|
714
|
+
|
|
715
|
+
@cached_property
|
|
716
|
+
def tags(self) -> AsyncTagsResourceWithStreamingResponse:
|
|
717
|
+
return AsyncTagsResourceWithStreamingResponse(self._budgets.tags)
|