payi 0.1.0a13__py3-none-any.whl → 0.1.0a15__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.
Files changed (36) hide show
  1. payi/_base_client.py +6 -6
  2. payi/_client.py +8 -0
  3. payi/_compat.py +3 -3
  4. payi/_models.py +9 -0
  5. payi/_version.py +1 -1
  6. payi/resources/__init__.py +14 -0
  7. payi/resources/budgets/budgets.py +12 -4
  8. payi/resources/categories/__init__.py +33 -0
  9. payi/resources/categories/categories.py +388 -0
  10. payi/resources/categories/resources.py +450 -0
  11. payi/resources/ingest.py +152 -21
  12. payi/types/__init__.py +11 -1
  13. payi/types/budget_create_params.py +4 -0
  14. payi/types/budget_history_response.py +3 -75
  15. payi/types/budget_response.py +3 -26
  16. payi/types/budget_update_params.py +4 -3
  17. payi/types/bulk_ingest_response.py +44 -0
  18. payi/types/categories/__init__.py +6 -0
  19. payi/types/categories/resource_create_params.py +25 -0
  20. payi/types/categories/resource_list_response.py +9 -0
  21. payi/types/category_delete_resource_response.py +9 -0
  22. payi/types/category_delete_response.py +9 -0
  23. payi/types/category_list_resources_response.py +9 -0
  24. payi/types/category_list_response.py +9 -0
  25. payi/types/category_resource_response.py +24 -0
  26. payi/types/category_response.py +15 -0
  27. payi/types/ingest_bulk_params.py +14 -0
  28. payi/types/{proxy_result.py → ingest_response.py} +15 -6
  29. payi/types/ingest_units_param.py +23 -0
  30. payi/types/ingest_units_params.py +6 -2
  31. payi/types/paged_budget_list.py +3 -26
  32. payi/types/total_cost_data.py +31 -0
  33. {payi-0.1.0a13.dist-info → payi-0.1.0a15.dist-info}/METADATA +8 -2
  34. {payi-0.1.0a13.dist-info → payi-0.1.0a15.dist-info}/RECORD +36 -20
  35. {payi-0.1.0a13.dist-info → payi-0.1.0a15.dist-info}/WHEEL +0 -0
  36. {payi-0.1.0a13.dist-info → payi-0.1.0a15.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,450 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Union
6
+ from datetime import datetime
7
+
8
+ import httpx
9
+
10
+ from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
11
+ from ..._utils import (
12
+ maybe_transform,
13
+ async_maybe_transform,
14
+ )
15
+ from ..._compat import cached_property
16
+ from ..._resource import SyncAPIResource, AsyncAPIResource
17
+ from ..._response import (
18
+ to_raw_response_wrapper,
19
+ to_streamed_response_wrapper,
20
+ async_to_raw_response_wrapper,
21
+ async_to_streamed_response_wrapper,
22
+ )
23
+ from ..._base_client import make_request_options
24
+ from ...types.categories import resource_create_params
25
+ from ...types.category_resource_response import CategoryResourceResponse
26
+ from ...types.categories.resource_list_response import ResourceListResponse
27
+
28
+ __all__ = ["ResourcesResource", "AsyncResourcesResource"]
29
+
30
+
31
+ class ResourcesResource(SyncAPIResource):
32
+ @cached_property
33
+ def with_raw_response(self) -> ResourcesResourceWithRawResponse:
34
+ return ResourcesResourceWithRawResponse(self)
35
+
36
+ @cached_property
37
+ def with_streaming_response(self) -> ResourcesResourceWithStreamingResponse:
38
+ return ResourcesResourceWithStreamingResponse(self)
39
+
40
+ def create(
41
+ self,
42
+ resource: str,
43
+ *,
44
+ category: str,
45
+ input_price: float | NotGiven = NOT_GIVEN,
46
+ max_input_units: int | NotGiven = NOT_GIVEN,
47
+ max_output_units: int | NotGiven = NOT_GIVEN,
48
+ output_price: float | NotGiven = NOT_GIVEN,
49
+ start_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
50
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
51
+ # The extra values given here take precedence over values defined on the client or passed to this method.
52
+ extra_headers: Headers | None = None,
53
+ extra_query: Query | None = None,
54
+ extra_body: Body | None = None,
55
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
56
+ ) -> CategoryResourceResponse:
57
+ """
58
+ Create a Resource
59
+
60
+ Args:
61
+ extra_headers: Send extra headers
62
+
63
+ extra_query: Add additional query parameters to the request
64
+
65
+ extra_body: Add additional JSON properties to the request
66
+
67
+ timeout: Override the client-level default timeout for this request, in seconds
68
+ """
69
+ if not category:
70
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
71
+ if not resource:
72
+ raise ValueError(f"Expected a non-empty value for `resource` but received {resource!r}")
73
+ return self._post(
74
+ f"/api/v1/categories/{category}/resources/{resource}",
75
+ body=maybe_transform(
76
+ {
77
+ "input_price": input_price,
78
+ "max_input_units": max_input_units,
79
+ "max_output_units": max_output_units,
80
+ "output_price": output_price,
81
+ "start_timestamp": start_timestamp,
82
+ },
83
+ resource_create_params.ResourceCreateParams,
84
+ ),
85
+ options=make_request_options(
86
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
87
+ ),
88
+ cast_to=CategoryResourceResponse,
89
+ )
90
+
91
+ def retrieve(
92
+ self,
93
+ start_timestamp: Union[str, datetime],
94
+ *,
95
+ category: str,
96
+ resource: str,
97
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
98
+ # The extra values given here take precedence over values defined on the client or passed to this method.
99
+ extra_headers: Headers | None = None,
100
+ extra_query: Query | None = None,
101
+ extra_body: Body | None = None,
102
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
103
+ ) -> CategoryResourceResponse:
104
+ """
105
+ Get a Resource's version details
106
+
107
+ Args:
108
+ extra_headers: Send extra headers
109
+
110
+ extra_query: Add additional query parameters to the request
111
+
112
+ extra_body: Add additional JSON properties to the request
113
+
114
+ timeout: Override the client-level default timeout for this request, in seconds
115
+ """
116
+ if not category:
117
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
118
+ if not resource:
119
+ raise ValueError(f"Expected a non-empty value for `resource` but received {resource!r}")
120
+ if not start_timestamp:
121
+ raise ValueError(f"Expected a non-empty value for `start_timestamp` but received {start_timestamp!r}")
122
+ return self._get(
123
+ f"/api/v1/categories/{category}/resources/{resource}/{start_timestamp}",
124
+ options=make_request_options(
125
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
126
+ ),
127
+ cast_to=CategoryResourceResponse,
128
+ )
129
+
130
+ def list(
131
+ self,
132
+ resource: str,
133
+ *,
134
+ category: str,
135
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
136
+ # The extra values given here take precedence over values defined on the client or passed to this method.
137
+ extra_headers: Headers | None = None,
138
+ extra_query: Query | None = None,
139
+ extra_body: Body | None = None,
140
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
141
+ ) -> ResourceListResponse:
142
+ """
143
+ Get a list of versions of a Resource
144
+
145
+ Args:
146
+ extra_headers: Send extra headers
147
+
148
+ extra_query: Add additional query parameters to the request
149
+
150
+ extra_body: Add additional JSON properties to the request
151
+
152
+ timeout: Override the client-level default timeout for this request, in seconds
153
+ """
154
+ if not category:
155
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
156
+ if not resource:
157
+ raise ValueError(f"Expected a non-empty value for `resource` but received {resource!r}")
158
+ return self._get(
159
+ f"/api/v1/categories/{category}/resources/{resource}",
160
+ options=make_request_options(
161
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
162
+ ),
163
+ cast_to=ResourceListResponse,
164
+ )
165
+
166
+ def delete(
167
+ self,
168
+ start_timestamp: Union[str, datetime],
169
+ *,
170
+ category: str,
171
+ resource: str,
172
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
173
+ # The extra values given here take precedence over values defined on the client or passed to this method.
174
+ extra_headers: Headers | None = None,
175
+ extra_query: Query | None = None,
176
+ extra_body: Body | None = None,
177
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
178
+ ) -> CategoryResourceResponse:
179
+ """
180
+ Delete a version of the Resource
181
+
182
+ Args:
183
+ extra_headers: Send extra headers
184
+
185
+ extra_query: Add additional query parameters to the request
186
+
187
+ extra_body: Add additional JSON properties to the request
188
+
189
+ timeout: Override the client-level default timeout for this request, in seconds
190
+ """
191
+ if not category:
192
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
193
+ if not resource:
194
+ raise ValueError(f"Expected a non-empty value for `resource` but received {resource!r}")
195
+ if not start_timestamp:
196
+ raise ValueError(f"Expected a non-empty value for `start_timestamp` but received {start_timestamp!r}")
197
+ return self._delete(
198
+ f"/api/v1/categories/{category}/resources/{resource}/{start_timestamp}",
199
+ options=make_request_options(
200
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
201
+ ),
202
+ cast_to=CategoryResourceResponse,
203
+ )
204
+
205
+
206
+ class AsyncResourcesResource(AsyncAPIResource):
207
+ @cached_property
208
+ def with_raw_response(self) -> AsyncResourcesResourceWithRawResponse:
209
+ return AsyncResourcesResourceWithRawResponse(self)
210
+
211
+ @cached_property
212
+ def with_streaming_response(self) -> AsyncResourcesResourceWithStreamingResponse:
213
+ return AsyncResourcesResourceWithStreamingResponse(self)
214
+
215
+ async def create(
216
+ self,
217
+ resource: str,
218
+ *,
219
+ category: str,
220
+ input_price: float | NotGiven = NOT_GIVEN,
221
+ max_input_units: int | NotGiven = NOT_GIVEN,
222
+ max_output_units: int | NotGiven = NOT_GIVEN,
223
+ output_price: float | NotGiven = NOT_GIVEN,
224
+ start_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
225
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
226
+ # The extra values given here take precedence over values defined on the client or passed to this method.
227
+ extra_headers: Headers | None = None,
228
+ extra_query: Query | None = None,
229
+ extra_body: Body | None = None,
230
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
231
+ ) -> CategoryResourceResponse:
232
+ """
233
+ Create a Resource
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 category:
245
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
246
+ if not resource:
247
+ raise ValueError(f"Expected a non-empty value for `resource` but received {resource!r}")
248
+ return await self._post(
249
+ f"/api/v1/categories/{category}/resources/{resource}",
250
+ body=await async_maybe_transform(
251
+ {
252
+ "input_price": input_price,
253
+ "max_input_units": max_input_units,
254
+ "max_output_units": max_output_units,
255
+ "output_price": output_price,
256
+ "start_timestamp": start_timestamp,
257
+ },
258
+ resource_create_params.ResourceCreateParams,
259
+ ),
260
+ options=make_request_options(
261
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
262
+ ),
263
+ cast_to=CategoryResourceResponse,
264
+ )
265
+
266
+ async def retrieve(
267
+ self,
268
+ start_timestamp: Union[str, datetime],
269
+ *,
270
+ category: str,
271
+ resource: str,
272
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
273
+ # The extra values given here take precedence over values defined on the client or passed to this method.
274
+ extra_headers: Headers | None = None,
275
+ extra_query: Query | None = None,
276
+ extra_body: Body | None = None,
277
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
278
+ ) -> CategoryResourceResponse:
279
+ """
280
+ Get a Resource's version details
281
+
282
+ Args:
283
+ extra_headers: Send extra headers
284
+
285
+ extra_query: Add additional query parameters to the request
286
+
287
+ extra_body: Add additional JSON properties to the request
288
+
289
+ timeout: Override the client-level default timeout for this request, in seconds
290
+ """
291
+ if not category:
292
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
293
+ if not resource:
294
+ raise ValueError(f"Expected a non-empty value for `resource` but received {resource!r}")
295
+ if not start_timestamp:
296
+ raise ValueError(f"Expected a non-empty value for `start_timestamp` but received {start_timestamp!r}")
297
+ return await self._get(
298
+ f"/api/v1/categories/{category}/resources/{resource}/{start_timestamp}",
299
+ options=make_request_options(
300
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
301
+ ),
302
+ cast_to=CategoryResourceResponse,
303
+ )
304
+
305
+ async def list(
306
+ self,
307
+ resource: str,
308
+ *,
309
+ category: str,
310
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
311
+ # The extra values given here take precedence over values defined on the client or passed to this method.
312
+ extra_headers: Headers | None = None,
313
+ extra_query: Query | None = None,
314
+ extra_body: Body | None = None,
315
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
316
+ ) -> ResourceListResponse:
317
+ """
318
+ Get a list of versions of a Resource
319
+
320
+ Args:
321
+ extra_headers: Send extra headers
322
+
323
+ extra_query: Add additional query parameters to the request
324
+
325
+ extra_body: Add additional JSON properties to the request
326
+
327
+ timeout: Override the client-level default timeout for this request, in seconds
328
+ """
329
+ if not category:
330
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
331
+ if not resource:
332
+ raise ValueError(f"Expected a non-empty value for `resource` but received {resource!r}")
333
+ return await self._get(
334
+ f"/api/v1/categories/{category}/resources/{resource}",
335
+ options=make_request_options(
336
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
337
+ ),
338
+ cast_to=ResourceListResponse,
339
+ )
340
+
341
+ async def delete(
342
+ self,
343
+ start_timestamp: Union[str, datetime],
344
+ *,
345
+ category: str,
346
+ resource: str,
347
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
348
+ # The extra values given here take precedence over values defined on the client or passed to this method.
349
+ extra_headers: Headers | None = None,
350
+ extra_query: Query | None = None,
351
+ extra_body: Body | None = None,
352
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
353
+ ) -> CategoryResourceResponse:
354
+ """
355
+ Delete a version of the Resource
356
+
357
+ Args:
358
+ extra_headers: Send extra headers
359
+
360
+ extra_query: Add additional query parameters to the request
361
+
362
+ extra_body: Add additional JSON properties to the request
363
+
364
+ timeout: Override the client-level default timeout for this request, in seconds
365
+ """
366
+ if not category:
367
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
368
+ if not resource:
369
+ raise ValueError(f"Expected a non-empty value for `resource` but received {resource!r}")
370
+ if not start_timestamp:
371
+ raise ValueError(f"Expected a non-empty value for `start_timestamp` but received {start_timestamp!r}")
372
+ return await self._delete(
373
+ f"/api/v1/categories/{category}/resources/{resource}/{start_timestamp}",
374
+ options=make_request_options(
375
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
376
+ ),
377
+ cast_to=CategoryResourceResponse,
378
+ )
379
+
380
+
381
+ class ResourcesResourceWithRawResponse:
382
+ def __init__(self, resources: ResourcesResource) -> None:
383
+ self._resources = resources
384
+
385
+ self.create = to_raw_response_wrapper(
386
+ resources.create,
387
+ )
388
+ self.retrieve = to_raw_response_wrapper(
389
+ resources.retrieve,
390
+ )
391
+ self.list = to_raw_response_wrapper(
392
+ resources.list,
393
+ )
394
+ self.delete = to_raw_response_wrapper(
395
+ resources.delete,
396
+ )
397
+
398
+
399
+ class AsyncResourcesResourceWithRawResponse:
400
+ def __init__(self, resources: AsyncResourcesResource) -> None:
401
+ self._resources = resources
402
+
403
+ self.create = async_to_raw_response_wrapper(
404
+ resources.create,
405
+ )
406
+ self.retrieve = async_to_raw_response_wrapper(
407
+ resources.retrieve,
408
+ )
409
+ self.list = async_to_raw_response_wrapper(
410
+ resources.list,
411
+ )
412
+ self.delete = async_to_raw_response_wrapper(
413
+ resources.delete,
414
+ )
415
+
416
+
417
+ class ResourcesResourceWithStreamingResponse:
418
+ def __init__(self, resources: ResourcesResource) -> None:
419
+ self._resources = resources
420
+
421
+ self.create = to_streamed_response_wrapper(
422
+ resources.create,
423
+ )
424
+ self.retrieve = to_streamed_response_wrapper(
425
+ resources.retrieve,
426
+ )
427
+ self.list = to_streamed_response_wrapper(
428
+ resources.list,
429
+ )
430
+ self.delete = to_streamed_response_wrapper(
431
+ resources.delete,
432
+ )
433
+
434
+
435
+ class AsyncResourcesResourceWithStreamingResponse:
436
+ def __init__(self, resources: AsyncResourcesResource) -> None:
437
+ self._resources = resources
438
+
439
+ self.create = async_to_streamed_response_wrapper(
440
+ resources.create,
441
+ )
442
+ self.retrieve = async_to_streamed_response_wrapper(
443
+ resources.retrieve,
444
+ )
445
+ self.list = async_to_streamed_response_wrapper(
446
+ resources.list,
447
+ )
448
+ self.delete = async_to_streamed_response_wrapper(
449
+ resources.delete,
450
+ )