payi 0.1.0a13__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.

payi/_base_client.py CHANGED
@@ -879,9 +879,9 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
879
879
  def _prepare_options(
880
880
  self,
881
881
  options: FinalRequestOptions, # noqa: ARG002
882
- ) -> None:
882
+ ) -> FinalRequestOptions:
883
883
  """Hook for mutating the given options"""
884
- return None
884
+ return options
885
885
 
886
886
  def _prepare_request(
887
887
  self,
@@ -961,7 +961,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
961
961
  input_options = model_copy(options)
962
962
 
963
963
  cast_to = self._maybe_override_cast_to(cast_to, options)
964
- self._prepare_options(options)
964
+ options = self._prepare_options(options)
965
965
 
966
966
  retries = self._remaining_retries(remaining_retries, options)
967
967
  request = self._build_request(options)
@@ -1442,9 +1442,9 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1442
1442
  async def _prepare_options(
1443
1443
  self,
1444
1444
  options: FinalRequestOptions, # noqa: ARG002
1445
- ) -> None:
1445
+ ) -> FinalRequestOptions:
1446
1446
  """Hook for mutating the given options"""
1447
- return None
1447
+ return options
1448
1448
 
1449
1449
  async def _prepare_request(
1450
1450
  self,
@@ -1529,7 +1529,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1529
1529
  input_options = model_copy(options)
1530
1530
 
1531
1531
  cast_to = self._maybe_override_cast_to(cast_to, options)
1532
- await self._prepare_options(options)
1532
+ options = await self._prepare_options(options)
1533
1533
 
1534
1534
  retries = self._remaining_retries(remaining_retries, options)
1535
1535
  request = self._build_request(options)
payi/_client.py CHANGED
@@ -48,6 +48,7 @@ __all__ = [
48
48
  class Payi(SyncAPIClient):
49
49
  budgets: resources.BudgetsResource
50
50
  ingest: resources.IngestResource
51
+ categories: resources.CategoriesResource
51
52
  with_raw_response: PayiWithRawResponse
52
53
  with_streaming_response: PayiWithStreamedResponse
53
54
 
@@ -107,6 +108,7 @@ class Payi(SyncAPIClient):
107
108
 
108
109
  self.budgets = resources.BudgetsResource(self)
109
110
  self.ingest = resources.IngestResource(self)
111
+ self.categories = resources.CategoriesResource(self)
110
112
  self.with_raw_response = PayiWithRawResponse(self)
111
113
  self.with_streaming_response = PayiWithStreamedResponse(self)
112
114
 
@@ -218,6 +220,7 @@ class Payi(SyncAPIClient):
218
220
  class AsyncPayi(AsyncAPIClient):
219
221
  budgets: resources.AsyncBudgetsResource
220
222
  ingest: resources.AsyncIngestResource
223
+ categories: resources.AsyncCategoriesResource
221
224
  with_raw_response: AsyncPayiWithRawResponse
222
225
  with_streaming_response: AsyncPayiWithStreamedResponse
223
226
 
@@ -277,6 +280,7 @@ class AsyncPayi(AsyncAPIClient):
277
280
 
278
281
  self.budgets = resources.AsyncBudgetsResource(self)
279
282
  self.ingest = resources.AsyncIngestResource(self)
283
+ self.categories = resources.AsyncCategoriesResource(self)
280
284
  self.with_raw_response = AsyncPayiWithRawResponse(self)
281
285
  self.with_streaming_response = AsyncPayiWithStreamedResponse(self)
282
286
 
@@ -389,24 +393,28 @@ class PayiWithRawResponse:
389
393
  def __init__(self, client: Payi) -> None:
390
394
  self.budgets = resources.BudgetsResourceWithRawResponse(client.budgets)
391
395
  self.ingest = resources.IngestResourceWithRawResponse(client.ingest)
396
+ self.categories = resources.CategoriesResourceWithRawResponse(client.categories)
392
397
 
393
398
 
394
399
  class AsyncPayiWithRawResponse:
395
400
  def __init__(self, client: AsyncPayi) -> None:
396
401
  self.budgets = resources.AsyncBudgetsResourceWithRawResponse(client.budgets)
397
402
  self.ingest = resources.AsyncIngestResourceWithRawResponse(client.ingest)
403
+ self.categories = resources.AsyncCategoriesResourceWithRawResponse(client.categories)
398
404
 
399
405
 
400
406
  class PayiWithStreamedResponse:
401
407
  def __init__(self, client: Payi) -> None:
402
408
  self.budgets = resources.BudgetsResourceWithStreamingResponse(client.budgets)
403
409
  self.ingest = resources.IngestResourceWithStreamingResponse(client.ingest)
410
+ self.categories = resources.CategoriesResourceWithStreamingResponse(client.categories)
404
411
 
405
412
 
406
413
  class AsyncPayiWithStreamedResponse:
407
414
  def __init__(self, client: AsyncPayi) -> None:
408
415
  self.budgets = resources.AsyncBudgetsResourceWithStreamingResponse(client.budgets)
409
416
  self.ingest = resources.AsyncIngestResourceWithStreamingResponse(client.ingest)
417
+ self.categories = resources.AsyncCategoriesResourceWithStreamingResponse(client.categories)
410
418
 
411
419
 
412
420
  Client = Payi
payi/_compat.py CHANGED
@@ -118,10 +118,10 @@ def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]:
118
118
  return model.__fields__ # type: ignore
119
119
 
120
120
 
121
- def model_copy(model: _ModelT) -> _ModelT:
121
+ def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT:
122
122
  if PYDANTIC_V2:
123
- return model.model_copy()
124
- return model.copy() # type: ignore
123
+ return model.model_copy(deep=deep)
124
+ return model.copy(deep=deep) # type: ignore
125
125
 
126
126
 
127
127
  def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str:
payi/_models.py CHANGED
@@ -406,6 +406,15 @@ def build(
406
406
  return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs))
407
407
 
408
408
 
409
+ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T:
410
+ """Loose coercion to the expected type with construction of nested values.
411
+
412
+ Note: the returned value from this function is not guaranteed to match the
413
+ given type.
414
+ """
415
+ return cast(_T, construct_type(value=value, type_=type_))
416
+
417
+
409
418
  def construct_type(*, value: object, type_: object) -> object:
410
419
  """Loose coercion to the expected type with construction of nested values.
411
420
 
payi/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "payi"
4
- __version__ = "0.1.0-alpha.13" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.14" # x-release-please-version
@@ -16,6 +16,14 @@ from .budgets import (
16
16
  BudgetsResourceWithStreamingResponse,
17
17
  AsyncBudgetsResourceWithStreamingResponse,
18
18
  )
19
+ from .categories import (
20
+ CategoriesResource,
21
+ AsyncCategoriesResource,
22
+ CategoriesResourceWithRawResponse,
23
+ AsyncCategoriesResourceWithRawResponse,
24
+ CategoriesResourceWithStreamingResponse,
25
+ AsyncCategoriesResourceWithStreamingResponse,
26
+ )
19
27
 
20
28
  __all__ = [
21
29
  "BudgetsResource",
@@ -30,4 +38,10 @@ __all__ = [
30
38
  "AsyncIngestResourceWithRawResponse",
31
39
  "IngestResourceWithStreamingResponse",
32
40
  "AsyncIngestResourceWithStreamingResponse",
41
+ "CategoriesResource",
42
+ "AsyncCategoriesResource",
43
+ "CategoriesResourceWithRawResponse",
44
+ "AsyncCategoriesResourceWithRawResponse",
45
+ "CategoriesResourceWithStreamingResponse",
46
+ "AsyncCategoriesResourceWithStreamingResponse",
33
47
  ]
@@ -57,9 +57,11 @@ class BudgetsResource(SyncAPIResource):
57
57
  budget_name: str,
58
58
  max: float,
59
59
  base_cost_estimate: Literal["max"] | NotGiven = NOT_GIVEN,
60
+ billing_model_id: Optional[int] | NotGiven = NOT_GIVEN,
60
61
  budget_response_type: Literal["block", "allow"] | NotGiven = NOT_GIVEN,
61
62
  budget_tags: Optional[List[str]] | NotGiven = NOT_GIVEN,
62
63
  budget_type: Literal["conservative", "liberal"] | NotGiven = NOT_GIVEN,
64
+ cost_basis: Literal["base", "billed"] | NotGiven = NOT_GIVEN,
63
65
  currency: Literal["usd"] | NotGiven = NOT_GIVEN,
64
66
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
65
67
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -90,9 +92,11 @@ class BudgetsResource(SyncAPIResource):
90
92
  "budget_name": budget_name,
91
93
  "max": max,
92
94
  "base_cost_estimate": base_cost_estimate,
95
+ "billing_model_id": billing_model_id,
93
96
  "budget_response_type": budget_response_type,
94
97
  "budget_tags": budget_tags,
95
98
  "budget_type": budget_type,
99
+ "cost_basis": cost_basis,
96
100
  "currency": currency,
97
101
  },
98
102
  budget_create_params.BudgetCreateParams,
@@ -138,8 +142,8 @@ class BudgetsResource(SyncAPIResource):
138
142
  self,
139
143
  budget_id: str,
140
144
  *,
141
- budget_name: str,
142
- max: float | NotGiven = NOT_GIVEN,
145
+ budget_name: Optional[str] | NotGiven = NOT_GIVEN,
146
+ max: Optional[float] | NotGiven = NOT_GIVEN,
143
147
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
144
148
  # The extra values given here take precedence over values defined on the client or passed to this method.
145
149
  extra_headers: Headers | None = None,
@@ -305,9 +309,11 @@ class AsyncBudgetsResource(AsyncAPIResource):
305
309
  budget_name: str,
306
310
  max: float,
307
311
  base_cost_estimate: Literal["max"] | NotGiven = NOT_GIVEN,
312
+ billing_model_id: Optional[int] | NotGiven = NOT_GIVEN,
308
313
  budget_response_type: Literal["block", "allow"] | NotGiven = NOT_GIVEN,
309
314
  budget_tags: Optional[List[str]] | NotGiven = NOT_GIVEN,
310
315
  budget_type: Literal["conservative", "liberal"] | NotGiven = NOT_GIVEN,
316
+ cost_basis: Literal["base", "billed"] | NotGiven = NOT_GIVEN,
311
317
  currency: Literal["usd"] | NotGiven = NOT_GIVEN,
312
318
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
313
319
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -335,9 +341,11 @@ class AsyncBudgetsResource(AsyncAPIResource):
335
341
  "budget_name": budget_name,
336
342
  "max": max,
337
343
  "base_cost_estimate": base_cost_estimate,
344
+ "billing_model_id": billing_model_id,
338
345
  "budget_response_type": budget_response_type,
339
346
  "budget_tags": budget_tags,
340
347
  "budget_type": budget_type,
348
+ "cost_basis": cost_basis,
341
349
  "currency": currency,
342
350
  },
343
351
  budget_create_params.BudgetCreateParams,
@@ -385,8 +393,8 @@ class AsyncBudgetsResource(AsyncAPIResource):
385
393
  self,
386
394
  budget_id: str,
387
395
  *,
388
- budget_name: str,
389
- max: float | NotGiven = NOT_GIVEN,
396
+ budget_name: Optional[str] | NotGiven = NOT_GIVEN,
397
+ max: Optional[float] | NotGiven = NOT_GIVEN,
390
398
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
391
399
  # The extra values given here take precedence over values defined on the client or passed to this method.
392
400
  extra_headers: Headers | None = None,
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .resources import (
4
+ ResourcesResource,
5
+ AsyncResourcesResource,
6
+ ResourcesResourceWithRawResponse,
7
+ AsyncResourcesResourceWithRawResponse,
8
+ ResourcesResourceWithStreamingResponse,
9
+ AsyncResourcesResourceWithStreamingResponse,
10
+ )
11
+ from .categories import (
12
+ CategoriesResource,
13
+ AsyncCategoriesResource,
14
+ CategoriesResourceWithRawResponse,
15
+ AsyncCategoriesResourceWithRawResponse,
16
+ CategoriesResourceWithStreamingResponse,
17
+ AsyncCategoriesResourceWithStreamingResponse,
18
+ )
19
+
20
+ __all__ = [
21
+ "ResourcesResource",
22
+ "AsyncResourcesResource",
23
+ "ResourcesResourceWithRawResponse",
24
+ "AsyncResourcesResourceWithRawResponse",
25
+ "ResourcesResourceWithStreamingResponse",
26
+ "AsyncResourcesResourceWithStreamingResponse",
27
+ "CategoriesResource",
28
+ "AsyncCategoriesResource",
29
+ "CategoriesResourceWithRawResponse",
30
+ "AsyncCategoriesResourceWithRawResponse",
31
+ "CategoriesResourceWithStreamingResponse",
32
+ "AsyncCategoriesResourceWithStreamingResponse",
33
+ ]
@@ -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)