cliV1 0.1.1__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.1.1.dist-info/METADATA +156 -0
- cliv1-0.1.1.dist-info/RECORD +83 -0
- cliv1-0.1.1.dist-info/WHEEL +4 -0
- cliv1-0.1.1.dist-info/licenses/LICENSE +21 -0
- swagger_petstore_open_api_3_0/__init__.py +15 -0
- swagger_petstore_open_api_3_0/apis/__init__.py +5 -0
- swagger_petstore_open_api_3_0/apis/pet_api.py +881 -0
- swagger_petstore_open_api_3_0/apis/store.py +411 -0
- swagger_petstore_open_api_3_0/apis/user_api.py +792 -0
- swagger_petstore_open_api_3_0/async_client.py +79 -0
- swagger_petstore_open_api_3_0/auth.py +17 -0
- swagger_petstore_open_api_3_0/base_client.py +18 -0
- swagger_petstore_open_api_3_0/client.py +77 -0
- swagger_petstore_open_api_3_0/core/__init__.py +342 -0
- swagger_petstore_open_api_3_0/core/_internal/__init__.py +7 -0
- swagger_petstore_open_api_3_0/core/_internal/content_disposition.py +154 -0
- swagger_petstore_open_api_3_0/core/_internal/flattening.py +139 -0
- swagger_petstore_open_api_3_0/core/_internal/headers.py +144 -0
- swagger_petstore_open_api_3_0/core/_internal/urls.py +166 -0
- swagger_petstore_open_api_3_0/core/_internal/wire.py +173 -0
- swagger_petstore_open_api_3_0/core/adapters.py +177 -0
- swagger_petstore_open_api_3_0/core/auth/__init__.py +70 -0
- swagger_petstore_open_api_3_0/core/auth/composition.py +175 -0
- swagger_petstore_open_api_3_0/core/auth/models.py +217 -0
- swagger_petstore_open_api_3_0/core/auth/protocols.py +103 -0
- swagger_petstore_open_api_3_0/core/auth/schemes/__init__.py +94 -0
- swagger_petstore_open_api_3_0/core/auth/schemes/api_key_auth.py +53 -0
- swagger_petstore_open_api_3_0/core/auth/schemes/basic_auth.py +73 -0
- swagger_petstore_open_api_3_0/core/auth/schemes/bearer_auth.py +21 -0
- swagger_petstore_open_api_3_0/core/auth/schemes/oauth2_authorization_code.py +393 -0
- swagger_petstore_open_api_3_0/core/auth/schemes/oauth2_client_credentials.py +127 -0
- swagger_petstore_open_api_3_0/core/auth/schemes/oauth2_password.py +142 -0
- swagger_petstore_open_api_3_0/core/auth/schemes/oauth2_schemes.py +300 -0
- swagger_petstore_open_api_3_0/core/base_raw_response.py +49 -0
- swagger_petstore_open_api_3_0/core/bodies.py +563 -0
- swagger_petstore_open_api_3_0/core/converters/__init__.py +68 -0
- swagger_petstore_open_api_3_0/core/converters/date_time.py +237 -0
- swagger_petstore_open_api_3_0/core/converters/encoded_bytes.py +271 -0
- swagger_petstore_open_api_3_0/core/converters/open_enum.py +35 -0
- swagger_petstore_open_api_3_0/core/decoding.py +263 -0
- swagger_petstore_open_api_3_0/core/exceptions.py +41 -0
- swagger_petstore_open_api_3_0/core/file_responses.py +324 -0
- swagger_petstore_open_api_3_0/core/files.py +173 -0
- swagger_petstore_open_api_3_0/core/httpx_transport.py +766 -0
- swagger_petstore_open_api_3_0/core/models.py +143 -0
- swagger_petstore_open_api_3_0/core/optionality.py +130 -0
- swagger_petstore_open_api_3_0/core/params.py +161 -0
- swagger_petstore_open_api_3_0/core/raw_client.py +388 -0
- swagger_petstore_open_api_3_0/core/request_options.py +94 -0
- swagger_petstore_open_api_3_0/core/results.py +110 -0
- swagger_petstore_open_api_3_0/core/runtime_env.py +43 -0
- swagger_petstore_open_api_3_0/core/servers.py +33 -0
- swagger_petstore_open_api_3_0/core/transport.py +248 -0
- swagger_petstore_open_api_3_0/errors/__init__.py +48 -0
- swagger_petstore_open_api_3_0/errors/add_pet_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/delete_order_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/delete_pet_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/delete_user_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/find_pets_by_status_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/find_pets_by_tags_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/get_order_by_id_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/get_pet_by_id_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/get_user_by_name_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/login_user_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/place_order_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/update_pet_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/update_pet_with_form_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/update_user_error.py +21 -0
- swagger_petstore_open_api_3_0/errors/upload_file_error.py +21 -0
- swagger_petstore_open_api_3_0/models/__init__.py +23 -0
- swagger_petstore_open_api_3_0/models/api_response.py +18 -0
- swagger_petstore_open_api_3_0/models/category.py +15 -0
- swagger_petstore_open_api_3_0/models/enums/__init__.py +4 -0
- swagger_petstore_open_api_3_0/models/enums/order_status.py +17 -0
- swagger_petstore_open_api_3_0/models/enums/pet_status.py +17 -0
- swagger_petstore_open_api_3_0/models/order.py +27 -0
- swagger_petstore_open_api_3_0/models/pet.py +28 -0
- swagger_petstore_open_api_3_0/models/tag.py +15 -0
- swagger_petstore_open_api_3_0/models/user.py +29 -0
- swagger_petstore_open_api_3_0/py.typed +0 -0
- swagger_petstore_open_api_3_0/server/__init__.py +21 -0
- swagger_petstore_open_api_3_0/server/server.py +17 -0
- swagger_petstore_open_api_3_0/server/server_config.py +52 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"""The HTTP boundary: what a request and a response are, and what a transport must provide.
|
|
2
|
+
|
|
3
|
+
The two protocols are the seam between the SDK and whatever HTTP library actually moves bytes.
|
|
4
|
+
Keeping them SDK-owned is deliberate: ``ApiResult.response`` hands an :class:`HttpResponse` back to
|
|
5
|
+
callers, so no third-party request/response type reaches the public surface, and a caller can supply
|
|
6
|
+
their own transport by satisfying :class:`HttpClient` or :class:`AsyncHttpClient`.
|
|
7
|
+
|
|
8
|
+
The request and response shapes live here; the body shapes a request can carry live in
|
|
9
|
+
``bodies.py``, beside the factories that build them, and reach a transport through
|
|
10
|
+
:attr:`HttpRequest.body`."""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import json
|
|
15
|
+
from collections.abc import AsyncIterator, Iterator, Mapping
|
|
16
|
+
from dataclasses import dataclass
|
|
17
|
+
from typing import Any, Protocol
|
|
18
|
+
|
|
19
|
+
from .bodies import RequestBody
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(frozen=True, slots=True)
|
|
23
|
+
class HttpRequest:
|
|
24
|
+
"""An outbound request, fully resolved and ready for a transport to send."""
|
|
25
|
+
|
|
26
|
+
method: str
|
|
27
|
+
url: str
|
|
28
|
+
headers: Mapping[str, str]
|
|
29
|
+
|
|
30
|
+
body: RequestBody | None = None
|
|
31
|
+
timeout: float | None = None
|
|
32
|
+
"""Seconds to wait, or ``None`` to leave the transport's own timeout in force."""
|
|
33
|
+
|
|
34
|
+
def __repr__(self) -> str:
|
|
35
|
+
# Identify by method and path only. ``headers`` holds the rendered credential, the query
|
|
36
|
+
# string holds a query-placed api key, and ``body`` holds a form-encoded ``client_secret``
|
|
37
|
+
# -- so none of the three reaches the string form. This is also the type that crosses the
|
|
38
|
+
# ``HttpClient`` seam, which is where a logging transport would print it. The fields stay
|
|
39
|
+
# readable: this is a string form, not redaction.
|
|
40
|
+
path, _, _ = self.url.partition("?")
|
|
41
|
+
return f"{type(self).__name__}(method={self.method!r}, url={path!r})"
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass(frozen=True, slots=True)
|
|
45
|
+
class HttpResponse:
|
|
46
|
+
"""A buffered response. ``content`` is the raw body; decoding is the caller's choice.
|
|
47
|
+
|
|
48
|
+
On the success branch of a *streamed* call ``content`` is empty, deliberately: the body is the
|
|
49
|
+
payload there, carried unread by the streamed response instead of buffered here.
|
|
50
|
+
|
|
51
|
+
It carries no copy of the request. A retained :class:`HttpRequest` would hold three things for
|
|
52
|
+
as long as any ``ApiResult`` referencing it is alive: an unbounded body (a file upload's bytes),
|
|
53
|
+
the rendered credential on ``headers``, and a query-placed api key inside ``url``. Nothing in
|
|
54
|
+
the runtime reads it, and a test that needs to see what was sent observes it at the transport
|
|
55
|
+
seam, where it is the request itself rather than a copy."""
|
|
56
|
+
|
|
57
|
+
status_code: int
|
|
58
|
+
headers: Mapping[str, str]
|
|
59
|
+
"""Header names lowercased, per the transports' obligation -- look keys up in lowercase."""
|
|
60
|
+
|
|
61
|
+
content: bytes = b""
|
|
62
|
+
|
|
63
|
+
def text(self, encoding: str = "utf-8", errors: str = "replace") -> str:
|
|
64
|
+
"""Decode the body as text, mirroring :meth:`bytes.decode`.
|
|
65
|
+
|
|
66
|
+
Undecodable bytes are replaced by default, because the caller this serves is a diagnostic
|
|
67
|
+
one -- rendering an error body into a log line, where raising would lose the little
|
|
68
|
+
information there is. The payload path passes ``errors="strict"`` instead, so a body that
|
|
69
|
+
is not what it claims raises rather than arriving with ``\\ufffd`` standing in for it.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
encoding: Character encoding to decode with.
|
|
73
|
+
errors: How to handle undecodable bytes, as ``bytes.decode`` takes it.
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
The body decoded as text.
|
|
77
|
+
|
|
78
|
+
Raises:
|
|
79
|
+
UnicodeDecodeError: Only when ``errors="strict"`` is passed."""
|
|
80
|
+
return self.content.decode(encoding, errors=errors)
|
|
81
|
+
|
|
82
|
+
def json(self) -> Any:
|
|
83
|
+
"""Parse the body as JSON, or raise ``ValueError``.
|
|
84
|
+
|
|
85
|
+
Parsed from ``content`` rather than from :meth:`text`, so RFC 8259 encoding detection
|
|
86
|
+
applies (UTF-8/16/32, BOM-tolerant) and an undecodable byte is a failure rather than a
|
|
87
|
+
replacement character smuggled into a successful payload.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
Whatever the body parses to -- an object, array or scalar.
|
|
91
|
+
|
|
92
|
+
Raises:
|
|
93
|
+
ValueError: If the body is not valid JSON, or is not decodable at all."""
|
|
94
|
+
try:
|
|
95
|
+
return json.loads(self.content)
|
|
96
|
+
except (json.JSONDecodeError, UnicodeDecodeError) as e:
|
|
97
|
+
raise ValueError("Response body is not valid JSON") from e
|
|
98
|
+
|
|
99
|
+
def __repr__(self) -> str:
|
|
100
|
+
# ``RawError``'s posture, applied at the type that holds the data rather than at one of its
|
|
101
|
+
# holders: ``headers`` may carry ``set-cookie``, ``content`` is the (undecoded, possibly
|
|
102
|
+
# large, binary, or sensitive) body, and ``request`` carries the rendered credential. Fixing
|
|
103
|
+
# it here is what keeps ``Success`` and ``Failure`` free of a repr of their own -- their
|
|
104
|
+
# generated one delegates to this. ``content_length`` is the *buffered* length, so it is 0
|
|
105
|
+
# on the streamed success path, where the field it reports is empty by design.
|
|
106
|
+
return f"{type(self).__name__}(status_code={self.status_code}, content_length={len(self.content)})"
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class StreamedResponse(Protocol):
|
|
110
|
+
"""A response whose head has arrived and whose body has not been read.
|
|
111
|
+
|
|
112
|
+
The status and headers are facts as soon as this exists, which is what lets a streamed call
|
|
113
|
+
still yield a ``Success`` or a ``Failure``: only the payload is deferred, never the outcome.
|
|
114
|
+
It holds a connection until it is closed. Header names MUST be lowercased, exactly as on
|
|
115
|
+
:class:`HttpResponse`.
|
|
116
|
+
|
|
117
|
+
``read`` is the error path's seam, not a convenience over ``iter_bytes``: it must both buffer
|
|
118
|
+
the whole body *and* release the connection, so an error body survives the close that frees
|
|
119
|
+
the socket."""
|
|
120
|
+
|
|
121
|
+
@property
|
|
122
|
+
def status_code(self) -> int: ...
|
|
123
|
+
|
|
124
|
+
@property
|
|
125
|
+
def headers(self) -> Mapping[str, str]: ...
|
|
126
|
+
|
|
127
|
+
def iter_bytes(self, chunk_size: int) -> Iterator[bytes]: ...
|
|
128
|
+
|
|
129
|
+
def read(self) -> bytes: ...
|
|
130
|
+
|
|
131
|
+
def close(self) -> None: ...
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class AsyncStreamedResponse(Protocol):
|
|
135
|
+
"""The awaited twin. ``aclose`` rather than ``close``, matching the SDK's async client.
|
|
136
|
+
|
|
137
|
+
``status_code`` and ``headers`` stay synchronous properties -- the head has already arrived.
|
|
138
|
+
Header names MUST be lowercased, exactly as on :class:`HttpResponse`, and ``aread`` carries
|
|
139
|
+
``read``'s obligation: buffer the whole body and release the connection."""
|
|
140
|
+
|
|
141
|
+
@property
|
|
142
|
+
def status_code(self) -> int: ...
|
|
143
|
+
|
|
144
|
+
@property
|
|
145
|
+
def headers(self) -> Mapping[str, str]: ...
|
|
146
|
+
|
|
147
|
+
def aiter_bytes(self, chunk_size: int) -> AsyncIterator[bytes]: ...
|
|
148
|
+
|
|
149
|
+
async def aread(self) -> bytes: ...
|
|
150
|
+
|
|
151
|
+
async def aclose(self) -> None: ...
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class HttpClient(Protocol):
|
|
155
|
+
"""Sync transport contract.
|
|
156
|
+
|
|
157
|
+
The contract deliberately carries **two** request seams: ``send`` returns a buffered response,
|
|
158
|
+
and ``stream`` returns one whose body has not been read. A caller-supplied transport must
|
|
159
|
+
implement both -- the accepted cost, stated in ADR-0046, of keeping streamed downloads on the
|
|
160
|
+
same ``ApiResult`` surface as everything else.
|
|
161
|
+
|
|
162
|
+
Implementations:
|
|
163
|
+
- MUST NOT mutate the incoming :class:`HttpRequest`.
|
|
164
|
+
- MUST honour ``request.timeout`` when it is set, and fall back to their own configured
|
|
165
|
+
timeout when it is ``None``.
|
|
166
|
+
- MUST lowercase the header names on the returned :class:`HttpResponse`: HTTP/1.1 treats them
|
|
167
|
+
case-insensitively and HTTP/2 requires lowercase, so a caller's lookup needs no case
|
|
168
|
+
handling -- the same rule, for the same reason, as the request side in
|
|
169
|
+
``_internal/headers.py``. A :class:`StreamedResponse`'s ``headers`` carry the same
|
|
170
|
+
obligation.
|
|
171
|
+
- MUST label a body from what the body carries, and spell nothing of its own: a
|
|
172
|
+
:class:`BinaryBody`'s ``media_type`` as ``Content-Type`` and, where it names one, its
|
|
173
|
+
``filename`` as ``Content-Disposition``. Both merge **underneath** ``request.headers``, so a
|
|
174
|
+
caller's ``extra_headers`` still wins. The shipped transport renders the disposition through
|
|
175
|
+
``_internal/content_disposition.py``; a custom one owning that rendering is the cost it
|
|
176
|
+
already carries for the media type.
|
|
177
|
+
- SHOULD be idempotent for ``close()``.
|
|
178
|
+
- MAY raise their underlying library's exceptions."""
|
|
179
|
+
|
|
180
|
+
def send(self, request: HttpRequest) -> HttpResponse:
|
|
181
|
+
"""Execute a request and return a buffered response.
|
|
182
|
+
|
|
183
|
+
Args:
|
|
184
|
+
request: The request to send, which MUST NOT be mutated.
|
|
185
|
+
|
|
186
|
+
Returns:
|
|
187
|
+
The response, fully buffered, with its header names lowercased."""
|
|
188
|
+
...
|
|
189
|
+
|
|
190
|
+
def stream(self, request: HttpRequest) -> StreamedResponse:
|
|
191
|
+
"""Execute a request and return its response with the body unread.
|
|
192
|
+
|
|
193
|
+
Returns once the response head has arrived; the connection stays checked out until the
|
|
194
|
+
returned response is closed.
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
request: The request to send, which MUST NOT be mutated.
|
|
198
|
+
|
|
199
|
+
Returns:
|
|
200
|
+
The response head, its body pending, its header names lowercased."""
|
|
201
|
+
...
|
|
202
|
+
|
|
203
|
+
def close(self) -> None:
|
|
204
|
+
"""Release underlying resources (connections, pools). Should be idempotent."""
|
|
205
|
+
...
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class AsyncHttpClient(Protocol):
|
|
209
|
+
"""Async transport contract -- the same shape as :class:`HttpClient`, awaited.
|
|
210
|
+
|
|
211
|
+
The same obligations apply, including honouring ``request.timeout``, lowercasing the
|
|
212
|
+
response's header names, and carrying both request seams. ``aclose`` rather than ``close``
|
|
213
|
+
matches httpx and the SDK's own async client.
|
|
214
|
+
|
|
215
|
+
One obligation is this side's alone:
|
|
216
|
+
|
|
217
|
+
- Implementations MUST resolve an async :attr:`MultipartFile.content` themselves. A multipart
|
|
218
|
+
encoder pulls every part from a synchronous chunk generator, so an awaitable ``read`` cannot
|
|
219
|
+
be driven from inside one; the shipped transport drains such a part to a temp file before
|
|
220
|
+
encoding, which keeps it bounded rather than resident and leaves it sized. A raw
|
|
221
|
+
:class:`BinaryBody` needs no such pre-pass -- its async arms stream natively."""
|
|
222
|
+
|
|
223
|
+
async def send(self, request: HttpRequest) -> HttpResponse:
|
|
224
|
+
"""Execute a request and return a buffered response.
|
|
225
|
+
|
|
226
|
+
Args:
|
|
227
|
+
request: The request to send, which MUST NOT be mutated.
|
|
228
|
+
|
|
229
|
+
Returns:
|
|
230
|
+
The response, fully buffered, with its header names lowercased."""
|
|
231
|
+
...
|
|
232
|
+
|
|
233
|
+
async def stream(self, request: HttpRequest) -> AsyncStreamedResponse:
|
|
234
|
+
"""Execute a request and return its response with the body unread.
|
|
235
|
+
|
|
236
|
+
Returns once the response head has arrived; the connection stays checked out until the
|
|
237
|
+
returned response is closed.
|
|
238
|
+
|
|
239
|
+
Args:
|
|
240
|
+
request: The request to send, which MUST NOT be mutated.
|
|
241
|
+
|
|
242
|
+
Returns:
|
|
243
|
+
The response head, its body pending, its header names lowercased."""
|
|
244
|
+
...
|
|
245
|
+
|
|
246
|
+
async def aclose(self) -> None:
|
|
247
|
+
"""Release underlying resources (connections, pools). Should be idempotent."""
|
|
248
|
+
...
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from .add_pet_error import AddPetErrorBody, add_pet_error_mapper
|
|
2
|
+
from .delete_order_error import DeleteOrderErrorBody, delete_order_error_mapper
|
|
3
|
+
from .delete_pet_error import DeletePetErrorBody, delete_pet_error_mapper
|
|
4
|
+
from .delete_user_error import DeleteUserErrorBody, delete_user_error_mapper
|
|
5
|
+
from .find_pets_by_status_error import FindPetsByStatusErrorBody, find_pets_by_status_error_mapper
|
|
6
|
+
from .find_pets_by_tags_error import FindPetsByTagsErrorBody, find_pets_by_tags_error_mapper
|
|
7
|
+
from .get_order_by_id_error import GetOrderByIdErrorBody, get_order_by_id_error_mapper
|
|
8
|
+
from .get_pet_by_id_error import GetPetByIdErrorBody, get_pet_by_id_error_mapper
|
|
9
|
+
from .get_user_by_name_error import GetUserByNameErrorBody, get_user_by_name_error_mapper
|
|
10
|
+
from .login_user_error import LoginUserErrorBody, login_user_error_mapper
|
|
11
|
+
from .place_order_error import PlaceOrderErrorBody, place_order_error_mapper
|
|
12
|
+
from .update_pet_error import UpdatePetErrorBody, update_pet_error_mapper
|
|
13
|
+
from .update_pet_with_form_error import UpdatePetWithFormErrorBody, update_pet_with_form_error_mapper
|
|
14
|
+
from .update_user_error import UpdateUserErrorBody, update_user_error_mapper
|
|
15
|
+
from .upload_file_error import UploadFileErrorBody, upload_file_error_mapper
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"AddPetErrorBody",
|
|
19
|
+
"DeleteOrderErrorBody",
|
|
20
|
+
"DeletePetErrorBody",
|
|
21
|
+
"DeleteUserErrorBody",
|
|
22
|
+
"FindPetsByStatusErrorBody",
|
|
23
|
+
"FindPetsByTagsErrorBody",
|
|
24
|
+
"GetOrderByIdErrorBody",
|
|
25
|
+
"GetPetByIdErrorBody",
|
|
26
|
+
"GetUserByNameErrorBody",
|
|
27
|
+
"LoginUserErrorBody",
|
|
28
|
+
"PlaceOrderErrorBody",
|
|
29
|
+
"UpdatePetErrorBody",
|
|
30
|
+
"UpdatePetWithFormErrorBody",
|
|
31
|
+
"UpdateUserErrorBody",
|
|
32
|
+
"UploadFileErrorBody",
|
|
33
|
+
"add_pet_error_mapper",
|
|
34
|
+
"delete_order_error_mapper",
|
|
35
|
+
"delete_pet_error_mapper",
|
|
36
|
+
"delete_user_error_mapper",
|
|
37
|
+
"find_pets_by_status_error_mapper",
|
|
38
|
+
"find_pets_by_tags_error_mapper",
|
|
39
|
+
"get_order_by_id_error_mapper",
|
|
40
|
+
"get_pet_by_id_error_mapper",
|
|
41
|
+
"get_user_by_name_error_mapper",
|
|
42
|
+
"login_user_error_mapper",
|
|
43
|
+
"place_order_error_mapper",
|
|
44
|
+
"update_pet_error_mapper",
|
|
45
|
+
"update_pet_with_form_error_mapper",
|
|
46
|
+
"update_user_error_mapper",
|
|
47
|
+
"upload_file_error_mapper",
|
|
48
|
+
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
AddPetErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _AddPetError:
|
|
13
|
+
def map(self, response: HttpResponse) -> AddPetErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400 | 422:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
add_pet_error_mapper: Final[ErrorMapper[AddPetErrorBody]] = _AddPetError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
DeleteOrderErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _DeleteOrderError:
|
|
13
|
+
def map(self, response: HttpResponse) -> DeleteOrderErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
delete_order_error_mapper: Final[ErrorMapper[DeleteOrderErrorBody]] = _DeleteOrderError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
DeletePetErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _DeletePetError:
|
|
13
|
+
def map(self, response: HttpResponse) -> DeletePetErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
delete_pet_error_mapper: Final[ErrorMapper[DeletePetErrorBody]] = _DeletePetError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
DeleteUserErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _DeleteUserError:
|
|
13
|
+
def map(self, response: HttpResponse) -> DeleteUserErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
delete_user_error_mapper: Final[ErrorMapper[DeleteUserErrorBody]] = _DeleteUserError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
FindPetsByStatusErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _FindPetsByStatusError:
|
|
13
|
+
def map(self, response: HttpResponse) -> FindPetsByStatusErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
find_pets_by_status_error_mapper: Final[ErrorMapper[FindPetsByStatusErrorBody]] = _FindPetsByStatusError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
FindPetsByTagsErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _FindPetsByTagsError:
|
|
13
|
+
def map(self, response: HttpResponse) -> FindPetsByTagsErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
find_pets_by_tags_error_mapper: Final[ErrorMapper[FindPetsByTagsErrorBody]] = _FindPetsByTagsError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
GetOrderByIdErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _GetOrderByIdError:
|
|
13
|
+
def map(self, response: HttpResponse) -> GetOrderByIdErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
get_order_by_id_error_mapper: Final[ErrorMapper[GetOrderByIdErrorBody]] = _GetOrderByIdError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
GetPetByIdErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _GetPetByIdError:
|
|
13
|
+
def map(self, response: HttpResponse) -> GetPetByIdErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
get_pet_by_id_error_mapper: Final[ErrorMapper[GetPetByIdErrorBody]] = _GetPetByIdError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
GetUserByNameErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _GetUserByNameError:
|
|
13
|
+
def map(self, response: HttpResponse) -> GetUserByNameErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
get_user_by_name_error_mapper: Final[ErrorMapper[GetUserByNameErrorBody]] = _GetUserByNameError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
LoginUserErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _LoginUserError:
|
|
13
|
+
def map(self, response: HttpResponse) -> LoginUserErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
login_user_error_mapper: Final[ErrorMapper[LoginUserErrorBody]] = _LoginUserError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
PlaceOrderErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _PlaceOrderError:
|
|
13
|
+
def map(self, response: HttpResponse) -> PlaceOrderErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400 | 422:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
place_order_error_mapper: Final[ErrorMapper[PlaceOrderErrorBody]] = _PlaceOrderError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
UpdatePetErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _UpdatePetError:
|
|
13
|
+
def map(self, response: HttpResponse) -> UpdatePetErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400 | 404 | 422:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
update_pet_error_mapper: Final[ErrorMapper[UpdatePetErrorBody]] = _UpdatePetError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
UpdatePetWithFormErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _UpdatePetWithFormError:
|
|
13
|
+
def map(self, response: HttpResponse) -> UpdatePetWithFormErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
update_pet_with_form_error_mapper: Final[ErrorMapper[UpdatePetWithFormErrorBody]] = _UpdatePetWithFormError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
UpdateUserErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _UpdateUserError:
|
|
13
|
+
def map(self, response: HttpResponse) -> UpdateUserErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
update_user_error_mapper: Final[ErrorMapper[UpdateUserErrorBody]] = _UpdateUserError()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..core import ErrorMapper, HttpResponse, RawError
|
|
7
|
+
|
|
8
|
+
UploadFileErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _UploadFileError:
|
|
13
|
+
def map(self, response: HttpResponse) -> UploadFileErrorBody:
|
|
14
|
+
match response.status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(response)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(response)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
upload_file_error_mapper: Final[ErrorMapper[UploadFileErrorBody]] = _UploadFileError()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from . import enums
|
|
2
|
+
from .api_response import ApiResponse, ApiResponseDict
|
|
3
|
+
from .category import Category, CategoryDict
|
|
4
|
+
from .order import Order, OrderDict
|
|
5
|
+
from .pet import Pet, PetDict
|
|
6
|
+
from .tag import Tag, TagDict
|
|
7
|
+
from .user import User, UserDict
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"enums",
|
|
11
|
+
"ApiResponse",
|
|
12
|
+
"ApiResponseDict",
|
|
13
|
+
"Category",
|
|
14
|
+
"CategoryDict",
|
|
15
|
+
"Order",
|
|
16
|
+
"OrderDict",
|
|
17
|
+
"Pet",
|
|
18
|
+
"PetDict",
|
|
19
|
+
"Tag",
|
|
20
|
+
"TagDict",
|
|
21
|
+
"User",
|
|
22
|
+
"UserDict",
|
|
23
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
from typing_extensions import NotRequired, TypedDict
|
|
5
|
+
|
|
6
|
+
from ..core import UNSET, Optional, SdkBaseModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ApiResponse(SdkBaseModel):
|
|
10
|
+
code: Optional[int] = UNSET
|
|
11
|
+
type_: Optional[str] = Field(default=UNSET, alias="type")
|
|
12
|
+
message: Optional[str] = UNSET
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ApiResponseDict(TypedDict):
|
|
16
|
+
code: NotRequired[int]
|
|
17
|
+
type_: NotRequired[str]
|
|
18
|
+
message: NotRequired[str]
|