cliV1 0.0.6__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.
- cliv1-0.0.6.dist-info/METADATA +212 -0
- cliv1-0.0.6.dist-info/RECORD +92 -0
- cliv1-0.0.6.dist-info/WHEEL +4 -0
- cliv1-0.0.6.dist-info/licenses/LICENSE +21 -0
- swagger_petstore_open_api_3_1_0/__init__.py +15 -0
- swagger_petstore_open_api_3_1_0/apis/__init__.py +5 -0
- swagger_petstore_open_api_3_1_0/apis/pet_api.py +922 -0
- swagger_petstore_open_api_3_1_0/apis/store.py +432 -0
- swagger_petstore_open_api_3_1_0/apis/user_api.py +829 -0
- swagger_petstore_open_api_3_1_0/async_client.py +87 -0
- swagger_petstore_open_api_3_1_0/auth.py +17 -0
- swagger_petstore_open_api_3_1_0/base_client.py +27 -0
- swagger_petstore_open_api_3_1_0/client.py +85 -0
- swagger_petstore_open_api_3_1_0/core/__init__.py +395 -0
- swagger_petstore_open_api_3_1_0/core/_internal/__init__.py +9 -0
- swagger_petstore_open_api_3_1_0/core/_internal/content_disposition.py +154 -0
- swagger_petstore_open_api_3_1_0/core/_internal/flattening.py +104 -0
- swagger_petstore_open_api_3_1_0/core/_internal/headers.py +243 -0
- swagger_petstore_open_api_3_1_0/core/_internal/redaction.py +208 -0
- swagger_petstore_open_api_3_1_0/core/_internal/sse_parser.py +124 -0
- swagger_petstore_open_api_3_1_0/core/_internal/subscripts.py +50 -0
- swagger_petstore_open_api_3_1_0/core/_internal/urls.py +172 -0
- swagger_petstore_open_api_3_1_0/core/_internal/wire.py +201 -0
- swagger_petstore_open_api_3_1_0/core/adapters.py +177 -0
- swagger_petstore_open_api_3_1_0/core/auth/__init__.py +70 -0
- swagger_petstore_open_api_3_1_0/core/auth/composition.py +175 -0
- swagger_petstore_open_api_3_1_0/core/auth/models.py +216 -0
- swagger_petstore_open_api_3_1_0/core/auth/protocols.py +103 -0
- swagger_petstore_open_api_3_1_0/core/auth/schemes/__init__.py +94 -0
- swagger_petstore_open_api_3_1_0/core/auth/schemes/api_key_auth.py +53 -0
- swagger_petstore_open_api_3_1_0/core/auth/schemes/basic_auth.py +73 -0
- swagger_petstore_open_api_3_1_0/core/auth/schemes/bearer_auth.py +21 -0
- swagger_petstore_open_api_3_1_0/core/auth/schemes/oauth2_authorization_code.py +395 -0
- swagger_petstore_open_api_3_1_0/core/auth/schemes/oauth2_client_credentials.py +130 -0
- swagger_petstore_open_api_3_1_0/core/auth/schemes/oauth2_password.py +145 -0
- swagger_petstore_open_api_3_1_0/core/auth/schemes/oauth2_schemes.py +300 -0
- swagger_petstore_open_api_3_1_0/core/base_raw_response.py +49 -0
- swagger_petstore_open_api_3_1_0/core/bodies.py +590 -0
- swagger_petstore_open_api_3_1_0/core/converters/__init__.py +68 -0
- swagger_petstore_open_api_3_1_0/core/converters/date_time.py +237 -0
- swagger_petstore_open_api_3_1_0/core/converters/encoded_bytes.py +273 -0
- swagger_petstore_open_api_3_1_0/core/converters/open_enum.py +35 -0
- swagger_petstore_open_api_3_1_0/core/decoding.py +498 -0
- swagger_petstore_open_api_3_1_0/core/discriminators.py +129 -0
- swagger_petstore_open_api_3_1_0/core/event_streams.py +225 -0
- swagger_petstore_open_api_3_1_0/core/exceptions.py +78 -0
- swagger_petstore_open_api_3_1_0/core/file_responses.py +337 -0
- swagger_petstore_open_api_3_1_0/core/files.py +174 -0
- swagger_petstore_open_api_3_1_0/core/httpx2_transport.py +748 -0
- swagger_petstore_open_api_3_1_0/core/logging.py +472 -0
- swagger_petstore_open_api_3_1_0/core/models.py +143 -0
- swagger_petstore_open_api_3_1_0/core/optionality.py +144 -0
- swagger_petstore_open_api_3_1_0/core/pagination.py +452 -0
- swagger_petstore_open_api_3_1_0/core/paginator.py +55 -0
- swagger_petstore_open_api_3_1_0/core/params.py +157 -0
- swagger_petstore_open_api_3_1_0/core/raw_client.py +480 -0
- swagger_petstore_open_api_3_1_0/core/request_options.py +172 -0
- swagger_petstore_open_api_3_1_0/core/results.py +178 -0
- swagger_petstore_open_api_3_1_0/core/retries.py +237 -0
- swagger_petstore_open_api_3_1_0/core/runtime_env.py +43 -0
- swagger_petstore_open_api_3_1_0/core/servers.py +33 -0
- swagger_petstore_open_api_3_1_0/core/transport.py +218 -0
- swagger_petstore_open_api_3_1_0/errors/__init__.py +48 -0
- swagger_petstore_open_api_3_1_0/errors/add_pet_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/delete_order_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/delete_pet_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/delete_user_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/find_pets_by_status_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/find_pets_by_tags_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/get_order_by_id_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/get_pet_by_id_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/get_user_by_name_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/login_user_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/place_order_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/update_pet_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/update_pet_with_form_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/update_user_error.py +21 -0
- swagger_petstore_open_api_3_1_0/errors/upload_file_error.py +21 -0
- swagger_petstore_open_api_3_1_0/models/__init__.py +23 -0
- swagger_petstore_open_api_3_1_0/models/api_response.py +18 -0
- swagger_petstore_open_api_3_1_0/models/category.py +15 -0
- swagger_petstore_open_api_3_1_0/models/enums/__init__.py +4 -0
- swagger_petstore_open_api_3_1_0/models/enums/order_status.py +17 -0
- swagger_petstore_open_api_3_1_0/models/enums/pet_status.py +17 -0
- swagger_petstore_open_api_3_1_0/models/order.py +27 -0
- swagger_petstore_open_api_3_1_0/models/pet.py +28 -0
- swagger_petstore_open_api_3_1_0/models/tag_model.py +15 -0
- swagger_petstore_open_api_3_1_0/models/user.py +29 -0
- swagger_petstore_open_api_3_1_0/py.typed +0 -0
- swagger_petstore_open_api_3_1_0/server/__init__.py +21 -0
- swagger_petstore_open_api_3_1_0/server/server.py +17 -0
- swagger_petstore_open_api_3_1_0/server/server_config.py +52 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from uuid import UUID, uuid4
|
|
4
|
+
|
|
5
|
+
from ..auth import AsyncAuthSchemes, AuthSchemes
|
|
6
|
+
from ..core import (
|
|
7
|
+
ApiResult,
|
|
8
|
+
AsyncRawClient,
|
|
9
|
+
RawClient,
|
|
10
|
+
RawError,
|
|
11
|
+
RequestOptionsOrDict,
|
|
12
|
+
RFC3339DateTime,
|
|
13
|
+
SecuredRawResponse,
|
|
14
|
+
async_empty_response,
|
|
15
|
+
async_json_decoder,
|
|
16
|
+
empty_response,
|
|
17
|
+
form_body,
|
|
18
|
+
json_decoder,
|
|
19
|
+
param,
|
|
20
|
+
raw_error_response,
|
|
21
|
+
unwrap,
|
|
22
|
+
)
|
|
23
|
+
from ..errors.delete_order_error import DeleteOrderErrorBody, delete_order_error_mapper
|
|
24
|
+
from ..errors.get_order_by_id_error import GetOrderByIdErrorBody, get_order_by_id_error_mapper
|
|
25
|
+
from ..errors.place_order_error import PlaceOrderErrorBody, place_order_error_mapper
|
|
26
|
+
from ..models.enums.order_status import OrderStatusOrStr
|
|
27
|
+
from ..models.order import Order
|
|
28
|
+
from ..server.server import Server
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Store:
|
|
32
|
+
def __init__(self, client: RawClient, server: Server, auth: AuthSchemes) -> None:
|
|
33
|
+
self._with_raw_response = StoreWithRawResponse(client, server, auth)
|
|
34
|
+
|
|
35
|
+
def delete_order(self, order_id: int, *, request_options: RequestOptionsOrDict | None = None) -> None:
|
|
36
|
+
"""For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API
|
|
37
|
+
errors.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
order_id: ID of the order that needs to be deleted
|
|
41
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
42
|
+
count and statuses.
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
order deleted
|
|
46
|
+
|
|
47
|
+
Raises:
|
|
48
|
+
ApiError: Invalid ID supplied Order not found ``error`` is ``RawError``."""
|
|
49
|
+
return unwrap(self._with_raw_response.delete_order(order_id, request_options=request_options))
|
|
50
|
+
|
|
51
|
+
def get_inventory(self, *, request_options: RequestOptionsOrDict | None = None) -> dict[str, int]:
|
|
52
|
+
"""Returns a map of status codes to quantities.
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
56
|
+
count and statuses.
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
successful operation
|
|
60
|
+
|
|
61
|
+
Raises:
|
|
62
|
+
ApiError: If the API responds with an error status code. ``error`` is ``RawError``."""
|
|
63
|
+
return unwrap(self._with_raw_response.get_inventory(request_options=request_options))
|
|
64
|
+
|
|
65
|
+
def get_order_by_id(self, order_id: int, *, request_options: RequestOptionsOrDict | None = None) -> Order:
|
|
66
|
+
"""For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
order_id: ID of order that needs to be fetched
|
|
70
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
71
|
+
count and statuses.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
successful operation
|
|
75
|
+
|
|
76
|
+
Raises:
|
|
77
|
+
ApiError: Invalid ID supplied Order not found ``error`` is ``RawError``."""
|
|
78
|
+
return unwrap(self._with_raw_response.get_order_by_id(order_id, request_options=request_options))
|
|
79
|
+
|
|
80
|
+
def place_order(
|
|
81
|
+
self,
|
|
82
|
+
*,
|
|
83
|
+
id_: int | None = None,
|
|
84
|
+
pet_id: int | None = None,
|
|
85
|
+
quantity: int | None = None,
|
|
86
|
+
ship_date: RFC3339DateTime | None = None,
|
|
87
|
+
status: OrderStatusOrStr | None = None,
|
|
88
|
+
complete: bool | None = None,
|
|
89
|
+
request_options: RequestOptionsOrDict | None = None,
|
|
90
|
+
) -> Order:
|
|
91
|
+
"""Place a new order in the store.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
id_: Value sent with the request.
|
|
95
|
+
pet_id: Value sent with the request.
|
|
96
|
+
quantity: Value sent with the request.
|
|
97
|
+
ship_date: Value sent with the request.
|
|
98
|
+
status: Order Status
|
|
99
|
+
complete: Value sent with the request.
|
|
100
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
101
|
+
count and statuses.
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
successful operation
|
|
105
|
+
|
|
106
|
+
Raises:
|
|
107
|
+
ApiError: Invalid input Validation exception ``error`` is ``RawError``."""
|
|
108
|
+
return unwrap(
|
|
109
|
+
self._with_raw_response.place_order(
|
|
110
|
+
id_=id_,
|
|
111
|
+
pet_id=pet_id,
|
|
112
|
+
quantity=quantity,
|
|
113
|
+
ship_date=ship_date,
|
|
114
|
+
status=status,
|
|
115
|
+
complete=complete,
|
|
116
|
+
request_options=request_options,
|
|
117
|
+
),
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
@property
|
|
121
|
+
def with_raw_response(self) -> StoreWithRawResponse:
|
|
122
|
+
return self._with_raw_response
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class AsyncStore:
|
|
126
|
+
def __init__(self, client: AsyncRawClient, server: Server, auth: AsyncAuthSchemes) -> None:
|
|
127
|
+
self._with_raw_response = AsyncStoreWithRawResponse(client, server, auth)
|
|
128
|
+
|
|
129
|
+
async def delete_order(self, order_id: int, *, request_options: RequestOptionsOrDict | None = None) -> None:
|
|
130
|
+
"""For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API
|
|
131
|
+
errors.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
order_id: ID of the order that needs to be deleted
|
|
135
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
136
|
+
count and statuses.
|
|
137
|
+
|
|
138
|
+
Returns:
|
|
139
|
+
order deleted
|
|
140
|
+
|
|
141
|
+
Raises:
|
|
142
|
+
ApiError: Invalid ID supplied Order not found ``error`` is ``RawError``."""
|
|
143
|
+
return unwrap(await self._with_raw_response.delete_order(order_id, request_options=request_options))
|
|
144
|
+
|
|
145
|
+
async def get_inventory(self, *, request_options: RequestOptionsOrDict | None = None) -> dict[str, int]:
|
|
146
|
+
"""Returns a map of status codes to quantities.
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
150
|
+
count and statuses.
|
|
151
|
+
|
|
152
|
+
Returns:
|
|
153
|
+
successful operation
|
|
154
|
+
|
|
155
|
+
Raises:
|
|
156
|
+
ApiError: If the API responds with an error status code. ``error`` is ``RawError``."""
|
|
157
|
+
return unwrap(await self._with_raw_response.get_inventory(request_options=request_options))
|
|
158
|
+
|
|
159
|
+
async def get_order_by_id(self, order_id: int, *, request_options: RequestOptionsOrDict | None = None) -> Order:
|
|
160
|
+
"""For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
order_id: ID of order that needs to be fetched
|
|
164
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
165
|
+
count and statuses.
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
successful operation
|
|
169
|
+
|
|
170
|
+
Raises:
|
|
171
|
+
ApiError: Invalid ID supplied Order not found ``error`` is ``RawError``."""
|
|
172
|
+
return unwrap(await self._with_raw_response.get_order_by_id(order_id, request_options=request_options))
|
|
173
|
+
|
|
174
|
+
async def place_order(
|
|
175
|
+
self,
|
|
176
|
+
*,
|
|
177
|
+
id_: int | None = None,
|
|
178
|
+
pet_id: int | None = None,
|
|
179
|
+
quantity: int | None = None,
|
|
180
|
+
ship_date: RFC3339DateTime | None = None,
|
|
181
|
+
status: OrderStatusOrStr | None = None,
|
|
182
|
+
complete: bool | None = None,
|
|
183
|
+
request_options: RequestOptionsOrDict | None = None,
|
|
184
|
+
) -> Order:
|
|
185
|
+
"""Place a new order in the store.
|
|
186
|
+
|
|
187
|
+
Args:
|
|
188
|
+
id_: Value sent with the request.
|
|
189
|
+
pet_id: Value sent with the request.
|
|
190
|
+
quantity: Value sent with the request.
|
|
191
|
+
ship_date: Value sent with the request.
|
|
192
|
+
status: Order Status
|
|
193
|
+
complete: Value sent with the request.
|
|
194
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
195
|
+
count and statuses.
|
|
196
|
+
|
|
197
|
+
Returns:
|
|
198
|
+
successful operation
|
|
199
|
+
|
|
200
|
+
Raises:
|
|
201
|
+
ApiError: Invalid input Validation exception ``error`` is ``RawError``."""
|
|
202
|
+
return unwrap(
|
|
203
|
+
await self._with_raw_response.place_order(
|
|
204
|
+
id_=id_,
|
|
205
|
+
pet_id=pet_id,
|
|
206
|
+
quantity=quantity,
|
|
207
|
+
ship_date=ship_date,
|
|
208
|
+
status=status,
|
|
209
|
+
complete=complete,
|
|
210
|
+
request_options=request_options,
|
|
211
|
+
),
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
@property
|
|
215
|
+
def with_raw_response(self) -> AsyncStoreWithRawResponse:
|
|
216
|
+
return self._with_raw_response
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
class StoreWithRawResponse(SecuredRawResponse[RawClient, Server, AuthSchemes]):
|
|
220
|
+
def delete_order(
|
|
221
|
+
self, order_id: int, *, request_options: RequestOptionsOrDict | None = None
|
|
222
|
+
) -> ApiResult[None, DeleteOrderErrorBody]:
|
|
223
|
+
"""For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API
|
|
224
|
+
errors.
|
|
225
|
+
|
|
226
|
+
Args:
|
|
227
|
+
order_id: ID of the order that needs to be deleted
|
|
228
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
229
|
+
count and statuses.
|
|
230
|
+
|
|
231
|
+
Returns:
|
|
232
|
+
An ``ApiResult`` holding the deserialized response or the error body."""
|
|
233
|
+
return self._client.execute(
|
|
234
|
+
http_method="DELETE",
|
|
235
|
+
url_template=self._server.default("/store/order/{orderId}"),
|
|
236
|
+
path_params=[param[int]("orderId", order_id)],
|
|
237
|
+
headers=[param[UUID]("Idempotency-Key", uuid4())],
|
|
238
|
+
decoder=empty_response,
|
|
239
|
+
error_mapper=delete_order_error_mapper,
|
|
240
|
+
request_options=request_options,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
def get_inventory(
|
|
244
|
+
self, *, request_options: RequestOptionsOrDict | None = None
|
|
245
|
+
) -> ApiResult[dict[str, int], RawError]:
|
|
246
|
+
"""Returns a map of status codes to quantities.
|
|
247
|
+
|
|
248
|
+
Args:
|
|
249
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
250
|
+
count and statuses.
|
|
251
|
+
|
|
252
|
+
Returns:
|
|
253
|
+
An ``ApiResult`` holding the deserialized response or the error body."""
|
|
254
|
+
return self._client.execute(
|
|
255
|
+
http_method="GET",
|
|
256
|
+
url_template=self._server.default("/store/inventory"),
|
|
257
|
+
auth_scheme=self._auth.api_key,
|
|
258
|
+
decoder=json_decoder[dict[str, int]],
|
|
259
|
+
error_mapper=raw_error_response,
|
|
260
|
+
request_options=request_options,
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
def get_order_by_id(
|
|
264
|
+
self, order_id: int, *, request_options: RequestOptionsOrDict | None = None
|
|
265
|
+
) -> ApiResult[Order, GetOrderByIdErrorBody]:
|
|
266
|
+
"""For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
|
|
267
|
+
|
|
268
|
+
Args:
|
|
269
|
+
order_id: ID of order that needs to be fetched
|
|
270
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
271
|
+
count and statuses.
|
|
272
|
+
|
|
273
|
+
Returns:
|
|
274
|
+
An ``ApiResult`` holding the deserialized response or the error body."""
|
|
275
|
+
return self._client.execute(
|
|
276
|
+
http_method="GET",
|
|
277
|
+
url_template=self._server.default("/store/order/{orderId}"),
|
|
278
|
+
path_params=[param[int]("orderId", order_id)],
|
|
279
|
+
decoder=json_decoder[Order],
|
|
280
|
+
error_mapper=get_order_by_id_error_mapper,
|
|
281
|
+
request_options=request_options,
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
def place_order(
|
|
285
|
+
self,
|
|
286
|
+
*,
|
|
287
|
+
id_: int | None = None,
|
|
288
|
+
pet_id: int | None = None,
|
|
289
|
+
quantity: int | None = None,
|
|
290
|
+
ship_date: RFC3339DateTime | None = None,
|
|
291
|
+
status: OrderStatusOrStr | None = None,
|
|
292
|
+
complete: bool | None = None,
|
|
293
|
+
request_options: RequestOptionsOrDict | None = None,
|
|
294
|
+
) -> ApiResult[Order, PlaceOrderErrorBody]:
|
|
295
|
+
"""Place a new order in the store.
|
|
296
|
+
|
|
297
|
+
Args:
|
|
298
|
+
id_: Value sent with the request.
|
|
299
|
+
pet_id: Value sent with the request.
|
|
300
|
+
quantity: Value sent with the request.
|
|
301
|
+
ship_date: Value sent with the request.
|
|
302
|
+
status: Order Status
|
|
303
|
+
complete: Value sent with the request.
|
|
304
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
305
|
+
count and statuses.
|
|
306
|
+
|
|
307
|
+
Returns:
|
|
308
|
+
An ``ApiResult`` holding the deserialized response or the error body."""
|
|
309
|
+
return self._client.execute(
|
|
310
|
+
http_method="POST",
|
|
311
|
+
url_template=self._server.default("/store/order"),
|
|
312
|
+
headers=[param[UUID]("Idempotency-Key", uuid4())],
|
|
313
|
+
body=form_body(
|
|
314
|
+
param[int | None]("id", id_),
|
|
315
|
+
param[int | None]("petId", pet_id),
|
|
316
|
+
param[int | None]("quantity", quantity),
|
|
317
|
+
param[RFC3339DateTime | None]("shipDate", ship_date),
|
|
318
|
+
param[OrderStatusOrStr | None]("status", status),
|
|
319
|
+
param[bool | None]("complete", complete),
|
|
320
|
+
),
|
|
321
|
+
decoder=json_decoder[Order],
|
|
322
|
+
error_mapper=place_order_error_mapper,
|
|
323
|
+
request_options=request_options,
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
class AsyncStoreWithRawResponse(SecuredRawResponse[AsyncRawClient, Server, AsyncAuthSchemes]):
|
|
328
|
+
async def delete_order(
|
|
329
|
+
self, order_id: int, *, request_options: RequestOptionsOrDict | None = None
|
|
330
|
+
) -> ApiResult[None, DeleteOrderErrorBody]:
|
|
331
|
+
"""For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API
|
|
332
|
+
errors.
|
|
333
|
+
|
|
334
|
+
Args:
|
|
335
|
+
order_id: ID of the order that needs to be deleted
|
|
336
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
337
|
+
count and statuses.
|
|
338
|
+
|
|
339
|
+
Returns:
|
|
340
|
+
An ``ApiResult`` holding the deserialized response or the error body."""
|
|
341
|
+
return await self._client.execute(
|
|
342
|
+
http_method="DELETE",
|
|
343
|
+
url_template=self._server.default("/store/order/{orderId}"),
|
|
344
|
+
path_params=[param[int]("orderId", order_id)],
|
|
345
|
+
headers=[param[UUID]("Idempotency-Key", uuid4())],
|
|
346
|
+
decoder=async_empty_response,
|
|
347
|
+
error_mapper=delete_order_error_mapper,
|
|
348
|
+
request_options=request_options,
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
async def get_inventory(
|
|
352
|
+
self, *, request_options: RequestOptionsOrDict | None = None
|
|
353
|
+
) -> ApiResult[dict[str, int], RawError]:
|
|
354
|
+
"""Returns a map of status codes to quantities.
|
|
355
|
+
|
|
356
|
+
Args:
|
|
357
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
358
|
+
count and statuses.
|
|
359
|
+
|
|
360
|
+
Returns:
|
|
361
|
+
An ``ApiResult`` holding the deserialized response or the error body."""
|
|
362
|
+
return await self._client.execute(
|
|
363
|
+
http_method="GET",
|
|
364
|
+
url_template=self._server.default("/store/inventory"),
|
|
365
|
+
auth_scheme=self._auth.api_key,
|
|
366
|
+
decoder=async_json_decoder[dict[str, int]],
|
|
367
|
+
error_mapper=raw_error_response,
|
|
368
|
+
request_options=request_options,
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
async def get_order_by_id(
|
|
372
|
+
self, order_id: int, *, request_options: RequestOptionsOrDict | None = None
|
|
373
|
+
) -> ApiResult[Order, GetOrderByIdErrorBody]:
|
|
374
|
+
"""For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
|
|
375
|
+
|
|
376
|
+
Args:
|
|
377
|
+
order_id: ID of order that needs to be fetched
|
|
378
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
379
|
+
count and statuses.
|
|
380
|
+
|
|
381
|
+
Returns:
|
|
382
|
+
An ``ApiResult`` holding the deserialized response or the error body."""
|
|
383
|
+
return await self._client.execute(
|
|
384
|
+
http_method="GET",
|
|
385
|
+
url_template=self._server.default("/store/order/{orderId}"),
|
|
386
|
+
path_params=[param[int]("orderId", order_id)],
|
|
387
|
+
decoder=async_json_decoder[Order],
|
|
388
|
+
error_mapper=get_order_by_id_error_mapper,
|
|
389
|
+
request_options=request_options,
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
async def place_order(
|
|
393
|
+
self,
|
|
394
|
+
*,
|
|
395
|
+
id_: int | None = None,
|
|
396
|
+
pet_id: int | None = None,
|
|
397
|
+
quantity: int | None = None,
|
|
398
|
+
ship_date: RFC3339DateTime | None = None,
|
|
399
|
+
status: OrderStatusOrStr | None = None,
|
|
400
|
+
complete: bool | None = None,
|
|
401
|
+
request_options: RequestOptionsOrDict | None = None,
|
|
402
|
+
) -> ApiResult[Order, PlaceOrderErrorBody]:
|
|
403
|
+
"""Place a new order in the store.
|
|
404
|
+
|
|
405
|
+
Args:
|
|
406
|
+
id_: Value sent with the request.
|
|
407
|
+
pet_id: Value sent with the request.
|
|
408
|
+
quantity: Value sent with the request.
|
|
409
|
+
ship_date: Value sent with the request.
|
|
410
|
+
status: Order Status
|
|
411
|
+
complete: Value sent with the request.
|
|
412
|
+
request_options: Per-call overrides for this one request, such as a timeout, extra headers, or its retry
|
|
413
|
+
count and statuses.
|
|
414
|
+
|
|
415
|
+
Returns:
|
|
416
|
+
An ``ApiResult`` holding the deserialized response or the error body."""
|
|
417
|
+
return await self._client.execute(
|
|
418
|
+
http_method="POST",
|
|
419
|
+
url_template=self._server.default("/store/order"),
|
|
420
|
+
headers=[param[UUID]("Idempotency-Key", uuid4())],
|
|
421
|
+
body=form_body(
|
|
422
|
+
param[int | None]("id", id_),
|
|
423
|
+
param[int | None]("petId", pet_id),
|
|
424
|
+
param[int | None]("quantity", quantity),
|
|
425
|
+
param[RFC3339DateTime | None]("shipDate", ship_date),
|
|
426
|
+
param[OrderStatusOrStr | None]("status", status),
|
|
427
|
+
param[bool | None]("complete", complete),
|
|
428
|
+
),
|
|
429
|
+
decoder=async_json_decoder[Order],
|
|
430
|
+
error_mapper=place_order_error_mapper,
|
|
431
|
+
request_options=request_options,
|
|
432
|
+
)
|