payi 0.1.0a12__py3-none-any.whl → 0.1.0a14__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.

@@ -0,0 +1,388 @@
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 NOT_GIVEN, Body, Query, Headers, NotGiven
8
+ from ..._compat import cached_property
9
+ from .resources import (
10
+ ResourcesResource,
11
+ AsyncResourcesResource,
12
+ ResourcesResourceWithRawResponse,
13
+ AsyncResourcesResourceWithRawResponse,
14
+ ResourcesResourceWithStreamingResponse,
15
+ AsyncResourcesResourceWithStreamingResponse,
16
+ )
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.category_list_response import CategoryListResponse
26
+ from ...types.category_delete_response import CategoryDeleteResponse
27
+ from ...types.category_list_resources_response import CategoryListResourcesResponse
28
+ from ...types.category_delete_resource_response import CategoryDeleteResourceResponse
29
+
30
+ __all__ = ["CategoriesResource", "AsyncCategoriesResource"]
31
+
32
+
33
+ class CategoriesResource(SyncAPIResource):
34
+ @cached_property
35
+ def resources(self) -> ResourcesResource:
36
+ return ResourcesResource(self._client)
37
+
38
+ @cached_property
39
+ def with_raw_response(self) -> CategoriesResourceWithRawResponse:
40
+ return CategoriesResourceWithRawResponse(self)
41
+
42
+ @cached_property
43
+ def with_streaming_response(self) -> CategoriesResourceWithStreamingResponse:
44
+ return CategoriesResourceWithStreamingResponse(self)
45
+
46
+ def list(
47
+ self,
48
+ *,
49
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
50
+ # The extra values given here take precedence over values defined on the client or passed to this method.
51
+ extra_headers: Headers | None = None,
52
+ extra_query: Query | None = None,
53
+ extra_body: Body | None = None,
54
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
55
+ ) -> CategoryListResponse:
56
+ """Get all Categories"""
57
+ return self._get(
58
+ "/api/v1/categories",
59
+ options=make_request_options(
60
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
61
+ ),
62
+ cast_to=CategoryListResponse,
63
+ )
64
+
65
+ def delete(
66
+ self,
67
+ category: str,
68
+ *,
69
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
70
+ # The extra values given here take precedence over values defined on the client or passed to this method.
71
+ extra_headers: Headers | None = None,
72
+ extra_query: Query | None = None,
73
+ extra_body: Body | None = None,
74
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
75
+ ) -> CategoryDeleteResponse:
76
+ """
77
+ Delete a Category and all of its Resources
78
+
79
+ Args:
80
+ extra_headers: Send extra headers
81
+
82
+ extra_query: Add additional query parameters to the request
83
+
84
+ extra_body: Add additional JSON properties to the request
85
+
86
+ timeout: Override the client-level default timeout for this request, in seconds
87
+ """
88
+ if not category:
89
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
90
+ return self._delete(
91
+ f"/api/v1/categories/{category}",
92
+ options=make_request_options(
93
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
94
+ ),
95
+ cast_to=CategoryDeleteResponse,
96
+ )
97
+
98
+ def delete_resource(
99
+ self,
100
+ resource: str,
101
+ *,
102
+ category: str,
103
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
104
+ # The extra values given here take precedence over values defined on the client or passed to this method.
105
+ extra_headers: Headers | None = None,
106
+ extra_query: Query | None = None,
107
+ extra_body: Body | None = None,
108
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
109
+ ) -> CategoryDeleteResourceResponse:
110
+ """
111
+ Delete all versions of Resource from a Category
112
+
113
+ Args:
114
+ extra_headers: Send extra headers
115
+
116
+ extra_query: Add additional query parameters to the request
117
+
118
+ extra_body: Add additional JSON properties to the request
119
+
120
+ timeout: Override the client-level default timeout for this request, in seconds
121
+ """
122
+ if not category:
123
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
124
+ if not resource:
125
+ raise ValueError(f"Expected a non-empty value for `resource` but received {resource!r}")
126
+ return self._delete(
127
+ f"/api/v1/categories/{category}/resources/{resource}",
128
+ options=make_request_options(
129
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
130
+ ),
131
+ cast_to=CategoryDeleteResourceResponse,
132
+ )
133
+
134
+ def list_resources(
135
+ self,
136
+ category: str,
137
+ *,
138
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
139
+ # The extra values given here take precedence over values defined on the client or passed to this method.
140
+ extra_headers: Headers | None = None,
141
+ extra_query: Query | None = None,
142
+ extra_body: Body | None = None,
143
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
144
+ ) -> CategoryListResourcesResponse:
145
+ """
146
+ Get all Resources for a Category
147
+
148
+ Args:
149
+ extra_headers: Send extra headers
150
+
151
+ extra_query: Add additional query parameters to the request
152
+
153
+ extra_body: Add additional JSON properties to the request
154
+
155
+ timeout: Override the client-level default timeout for this request, in seconds
156
+ """
157
+ if not category:
158
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
159
+ return self._get(
160
+ f"/api/v1/categories/{category}/resources",
161
+ options=make_request_options(
162
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
163
+ ),
164
+ cast_to=CategoryListResourcesResponse,
165
+ )
166
+
167
+
168
+ class AsyncCategoriesResource(AsyncAPIResource):
169
+ @cached_property
170
+ def resources(self) -> AsyncResourcesResource:
171
+ return AsyncResourcesResource(self._client)
172
+
173
+ @cached_property
174
+ def with_raw_response(self) -> AsyncCategoriesResourceWithRawResponse:
175
+ return AsyncCategoriesResourceWithRawResponse(self)
176
+
177
+ @cached_property
178
+ def with_streaming_response(self) -> AsyncCategoriesResourceWithStreamingResponse:
179
+ return AsyncCategoriesResourceWithStreamingResponse(self)
180
+
181
+ async def list(
182
+ self,
183
+ *,
184
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
185
+ # The extra values given here take precedence over values defined on the client or passed to this method.
186
+ extra_headers: Headers | None = None,
187
+ extra_query: Query | None = None,
188
+ extra_body: Body | None = None,
189
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
190
+ ) -> CategoryListResponse:
191
+ """Get all Categories"""
192
+ return await self._get(
193
+ "/api/v1/categories",
194
+ options=make_request_options(
195
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
196
+ ),
197
+ cast_to=CategoryListResponse,
198
+ )
199
+
200
+ async def delete(
201
+ self,
202
+ category: str,
203
+ *,
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
+ ) -> CategoryDeleteResponse:
211
+ """
212
+ Delete a Category and all of its Resources
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
+ if not category:
224
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
225
+ return await self._delete(
226
+ f"/api/v1/categories/{category}",
227
+ options=make_request_options(
228
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
229
+ ),
230
+ cast_to=CategoryDeleteResponse,
231
+ )
232
+
233
+ async def delete_resource(
234
+ self,
235
+ resource: str,
236
+ *,
237
+ category: str,
238
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
239
+ # The extra values given here take precedence over values defined on the client or passed to this method.
240
+ extra_headers: Headers | None = None,
241
+ extra_query: Query | None = None,
242
+ extra_body: Body | None = None,
243
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
244
+ ) -> CategoryDeleteResourceResponse:
245
+ """
246
+ Delete all versions of Resource from a Category
247
+
248
+ Args:
249
+ extra_headers: Send extra headers
250
+
251
+ extra_query: Add additional query parameters to the request
252
+
253
+ extra_body: Add additional JSON properties to the request
254
+
255
+ timeout: Override the client-level default timeout for this request, in seconds
256
+ """
257
+ if not category:
258
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
259
+ if not resource:
260
+ raise ValueError(f"Expected a non-empty value for `resource` but received {resource!r}")
261
+ return await self._delete(
262
+ f"/api/v1/categories/{category}/resources/{resource}",
263
+ options=make_request_options(
264
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
265
+ ),
266
+ cast_to=CategoryDeleteResourceResponse,
267
+ )
268
+
269
+ async def list_resources(
270
+ self,
271
+ category: str,
272
+ *,
273
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
274
+ # The extra values given here take precedence over values defined on the client or passed to this method.
275
+ extra_headers: Headers | None = None,
276
+ extra_query: Query | None = None,
277
+ extra_body: Body | None = None,
278
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
279
+ ) -> CategoryListResourcesResponse:
280
+ """
281
+ Get all Resources for a Category
282
+
283
+ Args:
284
+ extra_headers: Send extra headers
285
+
286
+ extra_query: Add additional query parameters to the request
287
+
288
+ extra_body: Add additional JSON properties to the request
289
+
290
+ timeout: Override the client-level default timeout for this request, in seconds
291
+ """
292
+ if not category:
293
+ raise ValueError(f"Expected a non-empty value for `category` but received {category!r}")
294
+ return await self._get(
295
+ f"/api/v1/categories/{category}/resources",
296
+ options=make_request_options(
297
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
298
+ ),
299
+ cast_to=CategoryListResourcesResponse,
300
+ )
301
+
302
+
303
+ class CategoriesResourceWithRawResponse:
304
+ def __init__(self, categories: CategoriesResource) -> None:
305
+ self._categories = categories
306
+
307
+ self.list = to_raw_response_wrapper(
308
+ categories.list,
309
+ )
310
+ self.delete = to_raw_response_wrapper(
311
+ categories.delete,
312
+ )
313
+ self.delete_resource = to_raw_response_wrapper(
314
+ categories.delete_resource,
315
+ )
316
+ self.list_resources = to_raw_response_wrapper(
317
+ categories.list_resources,
318
+ )
319
+
320
+ @cached_property
321
+ def resources(self) -> ResourcesResourceWithRawResponse:
322
+ return ResourcesResourceWithRawResponse(self._categories.resources)
323
+
324
+
325
+ class AsyncCategoriesResourceWithRawResponse:
326
+ def __init__(self, categories: AsyncCategoriesResource) -> None:
327
+ self._categories = categories
328
+
329
+ self.list = async_to_raw_response_wrapper(
330
+ categories.list,
331
+ )
332
+ self.delete = async_to_raw_response_wrapper(
333
+ categories.delete,
334
+ )
335
+ self.delete_resource = async_to_raw_response_wrapper(
336
+ categories.delete_resource,
337
+ )
338
+ self.list_resources = async_to_raw_response_wrapper(
339
+ categories.list_resources,
340
+ )
341
+
342
+ @cached_property
343
+ def resources(self) -> AsyncResourcesResourceWithRawResponse:
344
+ return AsyncResourcesResourceWithRawResponse(self._categories.resources)
345
+
346
+
347
+ class CategoriesResourceWithStreamingResponse:
348
+ def __init__(self, categories: CategoriesResource) -> None:
349
+ self._categories = categories
350
+
351
+ self.list = to_streamed_response_wrapper(
352
+ categories.list,
353
+ )
354
+ self.delete = to_streamed_response_wrapper(
355
+ categories.delete,
356
+ )
357
+ self.delete_resource = to_streamed_response_wrapper(
358
+ categories.delete_resource,
359
+ )
360
+ self.list_resources = to_streamed_response_wrapper(
361
+ categories.list_resources,
362
+ )
363
+
364
+ @cached_property
365
+ def resources(self) -> ResourcesResourceWithStreamingResponse:
366
+ return ResourcesResourceWithStreamingResponse(self._categories.resources)
367
+
368
+
369
+ class AsyncCategoriesResourceWithStreamingResponse:
370
+ def __init__(self, categories: AsyncCategoriesResource) -> None:
371
+ self._categories = categories
372
+
373
+ self.list = async_to_streamed_response_wrapper(
374
+ categories.list,
375
+ )
376
+ self.delete = async_to_streamed_response_wrapper(
377
+ categories.delete,
378
+ )
379
+ self.delete_resource = async_to_streamed_response_wrapper(
380
+ categories.delete_resource,
381
+ )
382
+ self.list_resources = async_to_streamed_response_wrapper(
383
+ categories.list_resources,
384
+ )
385
+
386
+ @cached_property
387
+ def resources(self) -> AsyncResourcesResourceWithStreamingResponse:
388
+ return AsyncResourcesResourceWithStreamingResponse(self._categories.resources)