cliV1 0.0.8__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 (87) hide show
  1. cliv1-0.0.8.dist-info/METADATA +168 -0
  2. cliv1-0.0.8.dist-info/RECORD +87 -0
  3. cliv1-0.0.8.dist-info/WHEEL +4 -0
  4. cliv1-0.0.8.dist-info/licenses/LICENSE +21 -0
  5. swagger_petstore_open_api_3_0/__init__.py +15 -0
  6. swagger_petstore_open_api_3_0/apis/__init__.py +5 -0
  7. swagger_petstore_open_api_3_0/apis/pet_api.py +883 -0
  8. swagger_petstore_open_api_3_0/apis/store.py +413 -0
  9. swagger_petstore_open_api_3_0/apis/user_api.py +794 -0
  10. swagger_petstore_open_api_3_0/async_client.py +79 -0
  11. swagger_petstore_open_api_3_0/auth.py +17 -0
  12. swagger_petstore_open_api_3_0/base_client.py +18 -0
  13. swagger_petstore_open_api_3_0/client.py +77 -0
  14. swagger_petstore_open_api_3_0/core/__init__.py +358 -0
  15. swagger_petstore_open_api_3_0/core/_internal/__init__.py +9 -0
  16. swagger_petstore_open_api_3_0/core/_internal/content_disposition.py +154 -0
  17. swagger_petstore_open_api_3_0/core/_internal/flattening.py +139 -0
  18. swagger_petstore_open_api_3_0/core/_internal/headers.py +144 -0
  19. swagger_petstore_open_api_3_0/core/_internal/sse_parser.py +124 -0
  20. swagger_petstore_open_api_3_0/core/_internal/subscripts.py +50 -0
  21. swagger_petstore_open_api_3_0/core/_internal/urls.py +186 -0
  22. swagger_petstore_open_api_3_0/core/_internal/wire.py +198 -0
  23. swagger_petstore_open_api_3_0/core/adapters.py +177 -0
  24. swagger_petstore_open_api_3_0/core/auth/__init__.py +70 -0
  25. swagger_petstore_open_api_3_0/core/auth/composition.py +175 -0
  26. swagger_petstore_open_api_3_0/core/auth/models.py +216 -0
  27. swagger_petstore_open_api_3_0/core/auth/protocols.py +103 -0
  28. swagger_petstore_open_api_3_0/core/auth/schemes/__init__.py +94 -0
  29. swagger_petstore_open_api_3_0/core/auth/schemes/api_key_auth.py +53 -0
  30. swagger_petstore_open_api_3_0/core/auth/schemes/basic_auth.py +73 -0
  31. swagger_petstore_open_api_3_0/core/auth/schemes/bearer_auth.py +21 -0
  32. swagger_petstore_open_api_3_0/core/auth/schemes/oauth2_authorization_code.py +393 -0
  33. swagger_petstore_open_api_3_0/core/auth/schemes/oauth2_client_credentials.py +127 -0
  34. swagger_petstore_open_api_3_0/core/auth/schemes/oauth2_password.py +142 -0
  35. swagger_petstore_open_api_3_0/core/auth/schemes/oauth2_schemes.py +300 -0
  36. swagger_petstore_open_api_3_0/core/base_raw_response.py +49 -0
  37. swagger_petstore_open_api_3_0/core/bodies.py +550 -0
  38. swagger_petstore_open_api_3_0/core/converters/__init__.py +68 -0
  39. swagger_petstore_open_api_3_0/core/converters/date_time.py +237 -0
  40. swagger_petstore_open_api_3_0/core/converters/encoded_bytes.py +273 -0
  41. swagger_petstore_open_api_3_0/core/converters/open_enum.py +35 -0
  42. swagger_petstore_open_api_3_0/core/decoding.py +498 -0
  43. swagger_petstore_open_api_3_0/core/discriminators.py +129 -0
  44. swagger_petstore_open_api_3_0/core/event_streams.py +225 -0
  45. swagger_petstore_open_api_3_0/core/exceptions.py +38 -0
  46. swagger_petstore_open_api_3_0/core/file_responses.py +335 -0
  47. swagger_petstore_open_api_3_0/core/files.py +173 -0
  48. swagger_petstore_open_api_3_0/core/httpx_transport.py +748 -0
  49. swagger_petstore_open_api_3_0/core/models.py +143 -0
  50. swagger_petstore_open_api_3_0/core/optionality.py +130 -0
  51. swagger_petstore_open_api_3_0/core/params.py +157 -0
  52. swagger_petstore_open_api_3_0/core/raw_client.py +338 -0
  53. swagger_petstore_open_api_3_0/core/request_options.py +94 -0
  54. swagger_petstore_open_api_3_0/core/results.py +123 -0
  55. swagger_petstore_open_api_3_0/core/runtime_env.py +43 -0
  56. swagger_petstore_open_api_3_0/core/servers.py +33 -0
  57. swagger_petstore_open_api_3_0/core/transport.py +191 -0
  58. swagger_petstore_open_api_3_0/errors/__init__.py +48 -0
  59. swagger_petstore_open_api_3_0/errors/add_pet_error.py +21 -0
  60. swagger_petstore_open_api_3_0/errors/delete_order_error.py +21 -0
  61. swagger_petstore_open_api_3_0/errors/delete_pet_error.py +21 -0
  62. swagger_petstore_open_api_3_0/errors/delete_user_error.py +21 -0
  63. swagger_petstore_open_api_3_0/errors/find_pets_by_status_error.py +21 -0
  64. swagger_petstore_open_api_3_0/errors/find_pets_by_tags_error.py +21 -0
  65. swagger_petstore_open_api_3_0/errors/get_order_by_id_error.py +21 -0
  66. swagger_petstore_open_api_3_0/errors/get_pet_by_id_error.py +21 -0
  67. swagger_petstore_open_api_3_0/errors/get_user_by_name_error.py +21 -0
  68. swagger_petstore_open_api_3_0/errors/login_user_error.py +21 -0
  69. swagger_petstore_open_api_3_0/errors/place_order_error.py +21 -0
  70. swagger_petstore_open_api_3_0/errors/update_pet_error.py +21 -0
  71. swagger_petstore_open_api_3_0/errors/update_pet_with_form_error.py +21 -0
  72. swagger_petstore_open_api_3_0/errors/update_user_error.py +21 -0
  73. swagger_petstore_open_api_3_0/errors/upload_file_error.py +21 -0
  74. swagger_petstore_open_api_3_0/models/__init__.py +23 -0
  75. swagger_petstore_open_api_3_0/models/api_response.py +18 -0
  76. swagger_petstore_open_api_3_0/models/category.py +15 -0
  77. swagger_petstore_open_api_3_0/models/enums/__init__.py +4 -0
  78. swagger_petstore_open_api_3_0/models/enums/order_status.py +17 -0
  79. swagger_petstore_open_api_3_0/models/enums/pet_status.py +17 -0
  80. swagger_petstore_open_api_3_0/models/order.py +27 -0
  81. swagger_petstore_open_api_3_0/models/pet.py +28 -0
  82. swagger_petstore_open_api_3_0/models/tag_model.py +15 -0
  83. swagger_petstore_open_api_3_0/models/user.py +29 -0
  84. swagger_petstore_open_api_3_0/py.typed +0 -0
  85. swagger_petstore_open_api_3_0/server/__init__.py +21 -0
  86. swagger_petstore_open_api_3_0/server/server.py +17 -0
  87. swagger_petstore_open_api_3_0/server/server_config.py +52 -0
@@ -0,0 +1,883 @@
1
+ from __future__ import annotations
2
+
3
+ from uuid import UUID, uuid4
4
+
5
+ from ..auth import AsyncAuthSchemes, AuthSchemes
6
+ from ..core import (
7
+ AnySchemes,
8
+ ApiResult,
9
+ AsyncAnySchemes,
10
+ AsyncFileInput,
11
+ AsyncRawClient,
12
+ FileInput,
13
+ RawClient,
14
+ RequestOptionsOrDict,
15
+ SecuredRawResponse,
16
+ async_empty_response,
17
+ async_json_decoder,
18
+ binary_body,
19
+ empty_response,
20
+ form_body,
21
+ json_decoder,
22
+ param,
23
+ )
24
+ from ..errors.add_pet_error import AddPetErrorBody, add_pet_error_mapper
25
+ from ..errors.delete_pet_error import DeletePetErrorBody, delete_pet_error_mapper
26
+ from ..errors.find_pets_by_status_error import FindPetsByStatusErrorBody, find_pets_by_status_error_mapper
27
+ from ..errors.find_pets_by_tags_error import FindPetsByTagsErrorBody, find_pets_by_tags_error_mapper
28
+ from ..errors.get_pet_by_id_error import GetPetByIdErrorBody, get_pet_by_id_error_mapper
29
+ from ..errors.update_pet_error import UpdatePetErrorBody, update_pet_error_mapper
30
+ from ..errors.update_pet_with_form_error import UpdatePetWithFormErrorBody, update_pet_with_form_error_mapper
31
+ from ..errors.upload_file_error import UploadFileErrorBody, upload_file_error_mapper
32
+ from ..models.api_response import ApiResponse
33
+ from ..models.category import Category, CategoryDict
34
+ from ..models.enums.pet_status import PetStatusOrStr
35
+ from ..models.pet import Pet
36
+ from ..models.tag_model import TagModel, TagModelDict
37
+ from ..server.server import Server
38
+
39
+
40
+ class PetApi:
41
+ def __init__(self, client: RawClient, server: Server, auth: AuthSchemes) -> None:
42
+ self._with_raw_response = PetApiWithRawResponse(client, server, auth)
43
+
44
+ def add_pet(
45
+ self,
46
+ name: str,
47
+ photo_urls: list[str],
48
+ *,
49
+ id_: int | None = None,
50
+ category: Category | CategoryDict | None = None,
51
+ tags: list[TagModel | TagModelDict] | None = None,
52
+ status: PetStatusOrStr | None = None,
53
+ request_options: RequestOptionsOrDict | None = None,
54
+ ) -> Pet:
55
+ """Add a new pet to the store.
56
+
57
+ Args:
58
+ name: Value sent with the request.
59
+ photo_urls: Value sent with the request.
60
+ id_: Value sent with the request.
61
+ category: Value sent with the request.
62
+ tags: Value sent with the request.
63
+ status: pet status in the store
64
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
65
+
66
+ Returns:
67
+ Successful operation
68
+
69
+ Raises:
70
+ ApiError: Invalid input Validation exception ``error`` is ``RawError``."""
71
+ return self._with_raw_response.add_pet(
72
+ name, photo_urls, id_=id_, category=category, tags=tags, status=status, request_options=request_options
73
+ ).unwrap()
74
+
75
+ def delete_pet(
76
+ self, pet_id: int, *, api_key: str | None = None, request_options: RequestOptionsOrDict | None = None
77
+ ) -> None:
78
+ """Delete a pet.
79
+
80
+ Args:
81
+ pet_id: Pet id to delete
82
+ api_key: Value sent with the request.
83
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
84
+
85
+ Returns:
86
+ Pet deleted
87
+
88
+ Raises:
89
+ ApiError: Invalid pet value ``error`` is ``RawError``."""
90
+ return self._with_raw_response.delete_pet(pet_id, api_key=api_key, request_options=request_options).unwrap()
91
+
92
+ def find_pets_by_status(
93
+ self, *, status: PetStatusOrStr | None = None, request_options: RequestOptionsOrDict | None = None
94
+ ) -> list[Pet]:
95
+ """Multiple status values can be provided with comma separated strings.
96
+
97
+ Args:
98
+ status: Status values that need to be considered for filter
99
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
100
+
101
+ Returns:
102
+ successful operation
103
+
104
+ Raises:
105
+ ApiError: Invalid status value ``error`` is ``RawError``."""
106
+ return self._with_raw_response.find_pets_by_status(status=status, request_options=request_options).unwrap()
107
+
108
+ def find_pets_by_tags(
109
+ self, *, tags: list[str] | None = None, request_options: RequestOptionsOrDict | None = None
110
+ ) -> list[Pet]:
111
+ """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
112
+
113
+ Args:
114
+ tags: Tags to filter by
115
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
116
+
117
+ Returns:
118
+ successful operation
119
+
120
+ Raises:
121
+ ApiError: Invalid tag value ``error`` is ``RawError``."""
122
+ return self._with_raw_response.find_pets_by_tags(tags=tags, request_options=request_options).unwrap()
123
+
124
+ def get_pet_by_id(self, pet_id: int, *, request_options: RequestOptionsOrDict | None = None) -> Pet:
125
+ """Returns a single pet.
126
+
127
+ Args:
128
+ pet_id: ID of pet to return
129
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
130
+
131
+ Returns:
132
+ successful operation
133
+
134
+ Raises:
135
+ ApiError: Invalid ID supplied Pet not found ``error`` is ``RawError``."""
136
+ return self._with_raw_response.get_pet_by_id(pet_id, request_options=request_options).unwrap()
137
+
138
+ def update_pet(
139
+ self,
140
+ name: str,
141
+ photo_urls: list[str],
142
+ *,
143
+ id_: int | None = None,
144
+ category: Category | CategoryDict | None = None,
145
+ tags: list[TagModel | TagModelDict] | None = None,
146
+ status: PetStatusOrStr | None = None,
147
+ request_options: RequestOptionsOrDict | None = None,
148
+ ) -> Pet:
149
+ """Update an existing pet by Id.
150
+
151
+ Args:
152
+ name: Value sent with the request.
153
+ photo_urls: Value sent with the request.
154
+ id_: Value sent with the request.
155
+ category: Value sent with the request.
156
+ tags: Value sent with the request.
157
+ status: pet status in the store
158
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
159
+
160
+ Returns:
161
+ Successful operation
162
+
163
+ Raises:
164
+ ApiError: Invalid ID supplied Pet not found Validation exception ``error`` is ``RawError``."""
165
+ return self._with_raw_response.update_pet(
166
+ name, photo_urls, id_=id_, category=category, tags=tags, status=status, request_options=request_options
167
+ ).unwrap()
168
+
169
+ def update_pet_with_form(
170
+ self,
171
+ pet_id: int,
172
+ *,
173
+ name: str | None = None,
174
+ status: str | None = None,
175
+ request_options: RequestOptionsOrDict | None = None,
176
+ ) -> Pet:
177
+ """Updates a pet resource based on the form data.
178
+
179
+ Args:
180
+ pet_id: ID of pet that needs to be updated
181
+ name: Name of pet that needs to be updated
182
+ status: Status of pet that needs to be updated
183
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
184
+
185
+ Returns:
186
+ successful operation
187
+
188
+ Raises:
189
+ ApiError: Invalid input ``error`` is ``RawError``."""
190
+ return self._with_raw_response.update_pet_with_form(
191
+ pet_id, name=name, status=status, request_options=request_options
192
+ ).unwrap()
193
+
194
+ def upload_file(
195
+ self,
196
+ pet_id: int,
197
+ *,
198
+ additional_metadata: str | None = None,
199
+ body: FileInput | None = None,
200
+ request_options: RequestOptionsOrDict | None = None,
201
+ ) -> ApiResponse:
202
+ """Upload image of the pet.
203
+
204
+ Args:
205
+ pet_id: ID of pet to update
206
+ additional_metadata: Additional Metadata
207
+ body: The request body.
208
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
209
+
210
+ Returns:
211
+ successful operation
212
+
213
+ Raises:
214
+ ApiError: No file uploaded Pet not found ``error`` is ``RawError``."""
215
+ return self._with_raw_response.upload_file(
216
+ pet_id, additional_metadata=additional_metadata, body=body, request_options=request_options
217
+ ).unwrap()
218
+
219
+ @property
220
+ def with_raw_response(self) -> PetApiWithRawResponse:
221
+ return self._with_raw_response
222
+
223
+
224
+ class AsyncPetApi:
225
+ def __init__(self, client: AsyncRawClient, server: Server, auth: AsyncAuthSchemes) -> None:
226
+ self._with_raw_response = AsyncPetApiWithRawResponse(client, server, auth)
227
+
228
+ async def add_pet(
229
+ self,
230
+ name: str,
231
+ photo_urls: list[str],
232
+ *,
233
+ id_: int | None = None,
234
+ category: Category | CategoryDict | None = None,
235
+ tags: list[TagModel | TagModelDict] | None = None,
236
+ status: PetStatusOrStr | None = None,
237
+ request_options: RequestOptionsOrDict | None = None,
238
+ ) -> Pet:
239
+ """Add a new pet to the store.
240
+
241
+ Args:
242
+ name: Value sent with the request.
243
+ photo_urls: Value sent with the request.
244
+ id_: Value sent with the request.
245
+ category: Value sent with the request.
246
+ tags: Value sent with the request.
247
+ status: pet status in the store
248
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
249
+
250
+ Returns:
251
+ Successful operation
252
+
253
+ Raises:
254
+ ApiError: Invalid input Validation exception ``error`` is ``RawError``."""
255
+ return (
256
+ await self._with_raw_response.add_pet(
257
+ name, photo_urls, id_=id_, category=category, tags=tags, status=status, request_options=request_options
258
+ )
259
+ ).unwrap()
260
+
261
+ async def delete_pet(
262
+ self, pet_id: int, *, api_key: str | None = None, request_options: RequestOptionsOrDict | None = None
263
+ ) -> None:
264
+ """Delete a pet.
265
+
266
+ Args:
267
+ pet_id: Pet id to delete
268
+ api_key: Value sent with the request.
269
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
270
+
271
+ Returns:
272
+ Pet deleted
273
+
274
+ Raises:
275
+ ApiError: Invalid pet value ``error`` is ``RawError``."""
276
+ return (
277
+ await self._with_raw_response.delete_pet(pet_id, api_key=api_key, request_options=request_options)
278
+ ).unwrap()
279
+
280
+ async def find_pets_by_status(
281
+ self, *, status: PetStatusOrStr | None = None, request_options: RequestOptionsOrDict | None = None
282
+ ) -> list[Pet]:
283
+ """Multiple status values can be provided with comma separated strings.
284
+
285
+ Args:
286
+ status: Status values that need to be considered for filter
287
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
288
+
289
+ Returns:
290
+ successful operation
291
+
292
+ Raises:
293
+ ApiError: Invalid status value ``error`` is ``RawError``."""
294
+ return (
295
+ await self._with_raw_response.find_pets_by_status(status=status, request_options=request_options)
296
+ ).unwrap()
297
+
298
+ async def find_pets_by_tags(
299
+ self, *, tags: list[str] | None = None, request_options: RequestOptionsOrDict | None = None
300
+ ) -> list[Pet]:
301
+ """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
302
+
303
+ Args:
304
+ tags: Tags to filter by
305
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
306
+
307
+ Returns:
308
+ successful operation
309
+
310
+ Raises:
311
+ ApiError: Invalid tag value ``error`` is ``RawError``."""
312
+ return (await self._with_raw_response.find_pets_by_tags(tags=tags, request_options=request_options)).unwrap()
313
+
314
+ async def get_pet_by_id(self, pet_id: int, *, request_options: RequestOptionsOrDict | None = None) -> Pet:
315
+ """Returns a single pet.
316
+
317
+ Args:
318
+ pet_id: ID of pet to return
319
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
320
+
321
+ Returns:
322
+ successful operation
323
+
324
+ Raises:
325
+ ApiError: Invalid ID supplied Pet not found ``error`` is ``RawError``."""
326
+ return (await self._with_raw_response.get_pet_by_id(pet_id, request_options=request_options)).unwrap()
327
+
328
+ async def update_pet(
329
+ self,
330
+ name: str,
331
+ photo_urls: list[str],
332
+ *,
333
+ id_: int | None = None,
334
+ category: Category | CategoryDict | None = None,
335
+ tags: list[TagModel | TagModelDict] | None = None,
336
+ status: PetStatusOrStr | None = None,
337
+ request_options: RequestOptionsOrDict | None = None,
338
+ ) -> Pet:
339
+ """Update an existing pet by Id.
340
+
341
+ Args:
342
+ name: Value sent with the request.
343
+ photo_urls: Value sent with the request.
344
+ id_: Value sent with the request.
345
+ category: Value sent with the request.
346
+ tags: Value sent with the request.
347
+ status: pet status in the store
348
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
349
+
350
+ Returns:
351
+ Successful operation
352
+
353
+ Raises:
354
+ ApiError: Invalid ID supplied Pet not found Validation exception ``error`` is ``RawError``."""
355
+ return (
356
+ await self._with_raw_response.update_pet(
357
+ name, photo_urls, id_=id_, category=category, tags=tags, status=status, request_options=request_options
358
+ )
359
+ ).unwrap()
360
+
361
+ async def update_pet_with_form(
362
+ self,
363
+ pet_id: int,
364
+ *,
365
+ name: str | None = None,
366
+ status: str | None = None,
367
+ request_options: RequestOptionsOrDict | None = None,
368
+ ) -> Pet:
369
+ """Updates a pet resource based on the form data.
370
+
371
+ Args:
372
+ pet_id: ID of pet that needs to be updated
373
+ name: Name of pet that needs to be updated
374
+ status: Status of pet that needs to be updated
375
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
376
+
377
+ Returns:
378
+ successful operation
379
+
380
+ Raises:
381
+ ApiError: Invalid input ``error`` is ``RawError``."""
382
+ return (
383
+ await self._with_raw_response.update_pet_with_form(
384
+ pet_id, name=name, status=status, request_options=request_options
385
+ )
386
+ ).unwrap()
387
+
388
+ async def upload_file(
389
+ self,
390
+ pet_id: int,
391
+ *,
392
+ additional_metadata: str | None = None,
393
+ body: AsyncFileInput | None = None,
394
+ request_options: RequestOptionsOrDict | None = None,
395
+ ) -> ApiResponse:
396
+ """Upload image of the pet.
397
+
398
+ Args:
399
+ pet_id: ID of pet to update
400
+ additional_metadata: Additional Metadata
401
+ body: The request body.
402
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
403
+
404
+ Returns:
405
+ successful operation
406
+
407
+ Raises:
408
+ ApiError: No file uploaded Pet not found ``error`` is ``RawError``."""
409
+ return (
410
+ await self._with_raw_response.upload_file(
411
+ pet_id, additional_metadata=additional_metadata, body=body, request_options=request_options
412
+ )
413
+ ).unwrap()
414
+
415
+ @property
416
+ def with_raw_response(self) -> AsyncPetApiWithRawResponse:
417
+ return self._with_raw_response
418
+
419
+
420
+ class PetApiWithRawResponse(SecuredRawResponse[RawClient, Server, AuthSchemes]):
421
+ def add_pet(
422
+ self,
423
+ name: str,
424
+ photo_urls: list[str],
425
+ *,
426
+ id_: int | None = None,
427
+ category: Category | CategoryDict | None = None,
428
+ tags: list[TagModel | TagModelDict] | None = None,
429
+ status: PetStatusOrStr | None = None,
430
+ request_options: RequestOptionsOrDict | None = None,
431
+ ) -> ApiResult[Pet, AddPetErrorBody]:
432
+ """Add a new pet to the store.
433
+
434
+ Args:
435
+ name: Value sent with the request.
436
+ photo_urls: Value sent with the request.
437
+ id_: Value sent with the request.
438
+ category: Value sent with the request.
439
+ tags: Value sent with the request.
440
+ status: pet status in the store
441
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
442
+
443
+ Returns:
444
+ An ``ApiResult`` holding the deserialized response or the error body."""
445
+ return self._client.execute(
446
+ http_method="POST",
447
+ url_template=self._server.default("/pet"),
448
+ headers=[param[UUID]("Idempotency-Key", uuid4())],
449
+ body=form_body(
450
+ param[str]("name", name),
451
+ param[list[str]]("photoUrls", photo_urls),
452
+ param[int | None]("id", id_),
453
+ param[Category | CategoryDict | None]("category", category),
454
+ param[list[TagModel | TagModelDict] | None]("tags", tags),
455
+ param[PetStatusOrStr | None]("status", status),
456
+ ),
457
+ auth_scheme=self._auth.petstore_auth,
458
+ decoder=json_decoder[Pet],
459
+ error_mapper=add_pet_error_mapper,
460
+ request_options=request_options,
461
+ )
462
+
463
+ def delete_pet(
464
+ self, pet_id: int, *, api_key: str | None = None, request_options: RequestOptionsOrDict | None = None
465
+ ) -> ApiResult[None, DeletePetErrorBody]:
466
+ """Delete a pet.
467
+
468
+ Args:
469
+ pet_id: Pet id to delete
470
+ api_key: Value sent with the request.
471
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
472
+
473
+ Returns:
474
+ An ``ApiResult`` holding the deserialized response or the error body."""
475
+ return self._client.execute(
476
+ http_method="DELETE",
477
+ url_template=self._server.default("/pet/{petId}"),
478
+ path_params=[param[int]("petId", pet_id)],
479
+ headers=[param[str | None]("api_key", api_key), param[UUID]("Idempotency-Key", uuid4())],
480
+ auth_scheme=self._auth.petstore_auth,
481
+ decoder=empty_response,
482
+ error_mapper=delete_pet_error_mapper,
483
+ request_options=request_options,
484
+ )
485
+
486
+ def find_pets_by_status(
487
+ self, *, status: PetStatusOrStr | None = None, request_options: RequestOptionsOrDict | None = None
488
+ ) -> ApiResult[list[Pet], FindPetsByStatusErrorBody]:
489
+ """Multiple status values can be provided with comma separated strings.
490
+
491
+ Args:
492
+ status: Status values that need to be considered for filter
493
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
494
+
495
+ Returns:
496
+ An ``ApiResult`` holding the deserialized response or the error body."""
497
+ return self._client.execute(
498
+ http_method="GET",
499
+ url_template=self._server.default("/pet/findByStatus"),
500
+ query_params=[param[PetStatusOrStr | None]("status", status)],
501
+ auth_scheme=self._auth.petstore_auth,
502
+ decoder=json_decoder[list[Pet]],
503
+ error_mapper=find_pets_by_status_error_mapper,
504
+ request_options=request_options,
505
+ )
506
+
507
+ def find_pets_by_tags(
508
+ self, *, tags: list[str] | None = None, request_options: RequestOptionsOrDict | None = None
509
+ ) -> ApiResult[list[Pet], FindPetsByTagsErrorBody]:
510
+ """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
511
+
512
+ Args:
513
+ tags: Tags to filter by
514
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
515
+
516
+ Returns:
517
+ An ``ApiResult`` holding the deserialized response or the error body."""
518
+ return self._client.execute(
519
+ http_method="GET",
520
+ url_template=self._server.default("/pet/findByTags"),
521
+ query_params=[param[list[str] | None]("tags", tags)],
522
+ auth_scheme=self._auth.petstore_auth,
523
+ decoder=json_decoder[list[Pet]],
524
+ error_mapper=find_pets_by_tags_error_mapper,
525
+ request_options=request_options,
526
+ )
527
+
528
+ def get_pet_by_id(
529
+ self, pet_id: int, *, request_options: RequestOptionsOrDict | None = None
530
+ ) -> ApiResult[Pet, GetPetByIdErrorBody]:
531
+ """Returns a single pet.
532
+
533
+ Args:
534
+ pet_id: ID of pet to return
535
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
536
+
537
+ Returns:
538
+ An ``ApiResult`` holding the deserialized response or the error body."""
539
+ return self._client.execute(
540
+ http_method="GET",
541
+ url_template=self._server.default("/pet/{petId}"),
542
+ path_params=[param[int]("petId", pet_id)],
543
+ auth_scheme=AnySchemes(self._auth.api_key, self._auth.petstore_auth),
544
+ decoder=json_decoder[Pet],
545
+ error_mapper=get_pet_by_id_error_mapper,
546
+ request_options=request_options,
547
+ )
548
+
549
+ def update_pet(
550
+ self,
551
+ name: str,
552
+ photo_urls: list[str],
553
+ *,
554
+ id_: int | None = None,
555
+ category: Category | CategoryDict | None = None,
556
+ tags: list[TagModel | TagModelDict] | None = None,
557
+ status: PetStatusOrStr | None = None,
558
+ request_options: RequestOptionsOrDict | None = None,
559
+ ) -> ApiResult[Pet, UpdatePetErrorBody]:
560
+ """Update an existing pet by Id.
561
+
562
+ Args:
563
+ name: Value sent with the request.
564
+ photo_urls: Value sent with the request.
565
+ id_: Value sent with the request.
566
+ category: Value sent with the request.
567
+ tags: Value sent with the request.
568
+ status: pet status in the store
569
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
570
+
571
+ Returns:
572
+ An ``ApiResult`` holding the deserialized response or the error body."""
573
+ return self._client.execute(
574
+ http_method="PUT",
575
+ url_template=self._server.default("/pet"),
576
+ headers=[param[UUID]("Idempotency-Key", uuid4())],
577
+ body=form_body(
578
+ param[str]("name", name),
579
+ param[list[str]]("photoUrls", photo_urls),
580
+ param[int | None]("id", id_),
581
+ param[Category | CategoryDict | None]("category", category),
582
+ param[list[TagModel | TagModelDict] | None]("tags", tags),
583
+ param[PetStatusOrStr | None]("status", status),
584
+ ),
585
+ auth_scheme=self._auth.petstore_auth,
586
+ decoder=json_decoder[Pet],
587
+ error_mapper=update_pet_error_mapper,
588
+ request_options=request_options,
589
+ )
590
+
591
+ def update_pet_with_form(
592
+ self,
593
+ pet_id: int,
594
+ *,
595
+ name: str | None = None,
596
+ status: str | None = None,
597
+ request_options: RequestOptionsOrDict | None = None,
598
+ ) -> ApiResult[Pet, UpdatePetWithFormErrorBody]:
599
+ """Updates a pet resource based on the form data.
600
+
601
+ Args:
602
+ pet_id: ID of pet that needs to be updated
603
+ name: Name of pet that needs to be updated
604
+ status: Status of pet that needs to be updated
605
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
606
+
607
+ Returns:
608
+ An ``ApiResult`` holding the deserialized response or the error body."""
609
+ return self._client.execute(
610
+ http_method="POST",
611
+ url_template=self._server.default("/pet/{petId}"),
612
+ path_params=[param[int]("petId", pet_id)],
613
+ query_params=[param[str | None]("name", name), param[str | None]("status", status)],
614
+ headers=[param[UUID]("Idempotency-Key", uuid4())],
615
+ auth_scheme=self._auth.petstore_auth,
616
+ decoder=json_decoder[Pet],
617
+ error_mapper=update_pet_with_form_error_mapper,
618
+ request_options=request_options,
619
+ )
620
+
621
+ def upload_file(
622
+ self,
623
+ pet_id: int,
624
+ *,
625
+ additional_metadata: str | None = None,
626
+ body: FileInput | None = None,
627
+ request_options: RequestOptionsOrDict | None = None,
628
+ ) -> ApiResult[ApiResponse, UploadFileErrorBody]:
629
+ """Upload image of the pet.
630
+
631
+ Args:
632
+ pet_id: ID of pet to update
633
+ additional_metadata: Additional Metadata
634
+ body: The request body.
635
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
636
+
637
+ Returns:
638
+ An ``ApiResult`` holding the deserialized response or the error body."""
639
+ return self._client.execute(
640
+ http_method="POST",
641
+ url_template=self._server.default("/pet/{petId}/uploadImage"),
642
+ path_params=[param[int]("petId", pet_id)],
643
+ query_params=[param[str | None]("additionalMetadata", additional_metadata)],
644
+ headers=[param[UUID]("Idempotency-Key", uuid4())],
645
+ body=binary_body(body),
646
+ auth_scheme=self._auth.petstore_auth,
647
+ decoder=json_decoder[ApiResponse],
648
+ error_mapper=upload_file_error_mapper,
649
+ request_options=request_options,
650
+ )
651
+
652
+
653
+ class AsyncPetApiWithRawResponse(SecuredRawResponse[AsyncRawClient, Server, AsyncAuthSchemes]):
654
+ async def add_pet(
655
+ self,
656
+ name: str,
657
+ photo_urls: list[str],
658
+ *,
659
+ id_: int | None = None,
660
+ category: Category | CategoryDict | None = None,
661
+ tags: list[TagModel | TagModelDict] | None = None,
662
+ status: PetStatusOrStr | None = None,
663
+ request_options: RequestOptionsOrDict | None = None,
664
+ ) -> ApiResult[Pet, AddPetErrorBody]:
665
+ """Add a new pet to the store.
666
+
667
+ Args:
668
+ name: Value sent with the request.
669
+ photo_urls: Value sent with the request.
670
+ id_: Value sent with the request.
671
+ category: Value sent with the request.
672
+ tags: Value sent with the request.
673
+ status: pet status in the store
674
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
675
+
676
+ Returns:
677
+ An ``ApiResult`` holding the deserialized response or the error body."""
678
+ return await self._client.execute(
679
+ http_method="POST",
680
+ url_template=self._server.default("/pet"),
681
+ headers=[param[UUID]("Idempotency-Key", uuid4())],
682
+ body=form_body(
683
+ param[str]("name", name),
684
+ param[list[str]]("photoUrls", photo_urls),
685
+ param[int | None]("id", id_),
686
+ param[Category | CategoryDict | None]("category", category),
687
+ param[list[TagModel | TagModelDict] | None]("tags", tags),
688
+ param[PetStatusOrStr | None]("status", status),
689
+ ),
690
+ auth_scheme=self._auth.petstore_auth,
691
+ decoder=async_json_decoder[Pet],
692
+ error_mapper=add_pet_error_mapper,
693
+ request_options=request_options,
694
+ )
695
+
696
+ async def delete_pet(
697
+ self, pet_id: int, *, api_key: str | None = None, request_options: RequestOptionsOrDict | None = None
698
+ ) -> ApiResult[None, DeletePetErrorBody]:
699
+ """Delete a pet.
700
+
701
+ Args:
702
+ pet_id: Pet id to delete
703
+ api_key: Value sent with the request.
704
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
705
+
706
+ Returns:
707
+ An ``ApiResult`` holding the deserialized response or the error body."""
708
+ return await self._client.execute(
709
+ http_method="DELETE",
710
+ url_template=self._server.default("/pet/{petId}"),
711
+ path_params=[param[int]("petId", pet_id)],
712
+ headers=[param[str | None]("api_key", api_key), param[UUID]("Idempotency-Key", uuid4())],
713
+ auth_scheme=self._auth.petstore_auth,
714
+ decoder=async_empty_response,
715
+ error_mapper=delete_pet_error_mapper,
716
+ request_options=request_options,
717
+ )
718
+
719
+ async def find_pets_by_status(
720
+ self, *, status: PetStatusOrStr | None = None, request_options: RequestOptionsOrDict | None = None
721
+ ) -> ApiResult[list[Pet], FindPetsByStatusErrorBody]:
722
+ """Multiple status values can be provided with comma separated strings.
723
+
724
+ Args:
725
+ status: Status values that need to be considered for filter
726
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
727
+
728
+ Returns:
729
+ An ``ApiResult`` holding the deserialized response or the error body."""
730
+ return await self._client.execute(
731
+ http_method="GET",
732
+ url_template=self._server.default("/pet/findByStatus"),
733
+ query_params=[param[PetStatusOrStr | None]("status", status)],
734
+ auth_scheme=self._auth.petstore_auth,
735
+ decoder=async_json_decoder[list[Pet]],
736
+ error_mapper=find_pets_by_status_error_mapper,
737
+ request_options=request_options,
738
+ )
739
+
740
+ async def find_pets_by_tags(
741
+ self, *, tags: list[str] | None = None, request_options: RequestOptionsOrDict | None = None
742
+ ) -> ApiResult[list[Pet], FindPetsByTagsErrorBody]:
743
+ """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
744
+
745
+ Args:
746
+ tags: Tags to filter by
747
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
748
+
749
+ Returns:
750
+ An ``ApiResult`` holding the deserialized response or the error body."""
751
+ return await self._client.execute(
752
+ http_method="GET",
753
+ url_template=self._server.default("/pet/findByTags"),
754
+ query_params=[param[list[str] | None]("tags", tags)],
755
+ auth_scheme=self._auth.petstore_auth,
756
+ decoder=async_json_decoder[list[Pet]],
757
+ error_mapper=find_pets_by_tags_error_mapper,
758
+ request_options=request_options,
759
+ )
760
+
761
+ async def get_pet_by_id(
762
+ self, pet_id: int, *, request_options: RequestOptionsOrDict | None = None
763
+ ) -> ApiResult[Pet, GetPetByIdErrorBody]:
764
+ """Returns a single pet.
765
+
766
+ Args:
767
+ pet_id: ID of pet to return
768
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
769
+
770
+ Returns:
771
+ An ``ApiResult`` holding the deserialized response or the error body."""
772
+ return await self._client.execute(
773
+ http_method="GET",
774
+ url_template=self._server.default("/pet/{petId}"),
775
+ path_params=[param[int]("petId", pet_id)],
776
+ auth_scheme=AsyncAnySchemes(self._auth.api_key, self._auth.petstore_auth),
777
+ decoder=async_json_decoder[Pet],
778
+ error_mapper=get_pet_by_id_error_mapper,
779
+ request_options=request_options,
780
+ )
781
+
782
+ async def update_pet(
783
+ self,
784
+ name: str,
785
+ photo_urls: list[str],
786
+ *,
787
+ id_: int | None = None,
788
+ category: Category | CategoryDict | None = None,
789
+ tags: list[TagModel | TagModelDict] | None = None,
790
+ status: PetStatusOrStr | None = None,
791
+ request_options: RequestOptionsOrDict | None = None,
792
+ ) -> ApiResult[Pet, UpdatePetErrorBody]:
793
+ """Update an existing pet by Id.
794
+
795
+ Args:
796
+ name: Value sent with the request.
797
+ photo_urls: Value sent with the request.
798
+ id_: Value sent with the request.
799
+ category: Value sent with the request.
800
+ tags: Value sent with the request.
801
+ status: pet status in the store
802
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
803
+
804
+ Returns:
805
+ An ``ApiResult`` holding the deserialized response or the error body."""
806
+ return await self._client.execute(
807
+ http_method="PUT",
808
+ url_template=self._server.default("/pet"),
809
+ headers=[param[UUID]("Idempotency-Key", uuid4())],
810
+ body=form_body(
811
+ param[str]("name", name),
812
+ param[list[str]]("photoUrls", photo_urls),
813
+ param[int | None]("id", id_),
814
+ param[Category | CategoryDict | None]("category", category),
815
+ param[list[TagModel | TagModelDict] | None]("tags", tags),
816
+ param[PetStatusOrStr | None]("status", status),
817
+ ),
818
+ auth_scheme=self._auth.petstore_auth,
819
+ decoder=async_json_decoder[Pet],
820
+ error_mapper=update_pet_error_mapper,
821
+ request_options=request_options,
822
+ )
823
+
824
+ async def update_pet_with_form(
825
+ self,
826
+ pet_id: int,
827
+ *,
828
+ name: str | None = None,
829
+ status: str | None = None,
830
+ request_options: RequestOptionsOrDict | None = None,
831
+ ) -> ApiResult[Pet, UpdatePetWithFormErrorBody]:
832
+ """Updates a pet resource based on the form data.
833
+
834
+ Args:
835
+ pet_id: ID of pet that needs to be updated
836
+ name: Name of pet that needs to be updated
837
+ status: Status of pet that needs to be updated
838
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
839
+
840
+ Returns:
841
+ An ``ApiResult`` holding the deserialized response or the error body."""
842
+ return await self._client.execute(
843
+ http_method="POST",
844
+ url_template=self._server.default("/pet/{petId}"),
845
+ path_params=[param[int]("petId", pet_id)],
846
+ query_params=[param[str | None]("name", name), param[str | None]("status", status)],
847
+ headers=[param[UUID]("Idempotency-Key", uuid4())],
848
+ auth_scheme=self._auth.petstore_auth,
849
+ decoder=async_json_decoder[Pet],
850
+ error_mapper=update_pet_with_form_error_mapper,
851
+ request_options=request_options,
852
+ )
853
+
854
+ async def upload_file(
855
+ self,
856
+ pet_id: int,
857
+ *,
858
+ additional_metadata: str | None = None,
859
+ body: AsyncFileInput | None = None,
860
+ request_options: RequestOptionsOrDict | None = None,
861
+ ) -> ApiResult[ApiResponse, UploadFileErrorBody]:
862
+ """Upload image of the pet.
863
+
864
+ Args:
865
+ pet_id: ID of pet to update
866
+ additional_metadata: Additional Metadata
867
+ body: The request body.
868
+ request_options: Per-call overrides for this one request, such as a timeout or extra headers.
869
+
870
+ Returns:
871
+ An ``ApiResult`` holding the deserialized response or the error body."""
872
+ return await self._client.execute(
873
+ http_method="POST",
874
+ url_template=self._server.default("/pet/{petId}/uploadImage"),
875
+ path_params=[param[int]("petId", pet_id)],
876
+ query_params=[param[str | None]("additionalMetadata", additional_metadata)],
877
+ headers=[param[UUID]("Idempotency-Key", uuid4())],
878
+ body=binary_body(body),
879
+ auth_scheme=self._auth.petstore_auth,
880
+ decoder=async_json_decoder[ApiResponse],
881
+ error_mapper=upload_file_error_mapper,
882
+ request_options=request_options,
883
+ )