cliV1 0.0.7__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.7.dist-info/METADATA +212 -0
- cliv1-0.0.7.dist-info/RECORD +92 -0
- cliv1-0.0.7.dist-info/WHEEL +4 -0
- cliv1-0.0.7.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,218 @@
|
|
|
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: no third-party request or response type reaches the public
|
|
5
|
+
surface, and a caller can supply their own transport by satisfying :class:`HttpClient` or
|
|
6
|
+
:class:`AsyncHttpClient`.
|
|
7
|
+
|
|
8
|
+
There is no response *dataclass* here at all. A result carries the head as fields of its own, and a
|
|
9
|
+
body that has been read is ``bytes`` -- handed to a decode step or to an error mapper beside the
|
|
10
|
+
status it switches on. So the vocabulary at this boundary is three things: a request, a response
|
|
11
|
+
whose body is still on the wire, and the bytes that come off it.
|
|
12
|
+
|
|
13
|
+
The request and response shapes live here; the body shapes a request can carry live in
|
|
14
|
+
``bodies.py``, beside the factories that build them, and reach a transport through
|
|
15
|
+
:attr:`HttpRequest.body`."""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
from collections.abc import AsyncIterator, Iterator, Mapping
|
|
20
|
+
from dataclasses import dataclass
|
|
21
|
+
from typing import Literal, Protocol, TypeAlias
|
|
22
|
+
|
|
23
|
+
from ._internal.redaction import redact_url
|
|
24
|
+
from .bodies import RequestBody
|
|
25
|
+
|
|
26
|
+
HttpMethod: TypeAlias = Literal["GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS", "TRACE", "PATCH"]
|
|
27
|
+
"""The request methods an API operation can declare: RFC 9110 §9.3's set less ``CONNECT``, plus RFC 5789's ``PATCH``.
|
|
28
|
+
|
|
29
|
+
A ``Literal`` rather than ``str``, so a misspelt or lowercased verb at an emitted call site is a build
|
|
30
|
+
failure, and so a retry policy can only ever nominate a verb a request can carry."""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass(frozen=True, slots=True)
|
|
34
|
+
class HttpRequest:
|
|
35
|
+
"""An outbound request, fully resolved and ready for a transport to send; ``headers`` already
|
|
36
|
+
carry the body's own label."""
|
|
37
|
+
|
|
38
|
+
method: HttpMethod
|
|
39
|
+
url: str
|
|
40
|
+
headers: Mapping[str, str]
|
|
41
|
+
|
|
42
|
+
body: RequestBody | None = None
|
|
43
|
+
timeout: float | None = None
|
|
44
|
+
"""Seconds to wait, or ``None`` to leave the transport's own timeout in force."""
|
|
45
|
+
|
|
46
|
+
def __repr__(self) -> str:
|
|
47
|
+
# Identify by method and URL, unknown query values masked. ``headers`` holds the rendered
|
|
48
|
+
# credential and ``body`` a form-encoded ``client_secret``, so neither reaches the string form;
|
|
49
|
+
# the query string holds a query-placed api key, so it goes through the one printable-URL
|
|
50
|
+
# rule with its defaults -- keys kept, a known-safe value kept, everything else ``REDACTED``,
|
|
51
|
+
# since a repr reads no options. This is also the type that crosses the ``HttpClient`` seam,
|
|
52
|
+
# which is where a logging transport would print it. The fields stay readable.
|
|
53
|
+
return f"{type(self).__name__}(method={self.method!r}, url={redact_url(self.url)!r})"
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class HttpResponse(Protocol):
|
|
57
|
+
"""A response whose head has arrived and whose body has not been read.
|
|
58
|
+
|
|
59
|
+
The status and headers are facts as soon as this exists, which is what lets a streamed call
|
|
60
|
+
still yield a ``Success`` or a ``Failure``: only the payload is deferred, never the outcome.
|
|
61
|
+
It holds a connection until it is closed. Header names MUST be lowercased, the same rule the
|
|
62
|
+
request side applies in ``_internal/headers.py``.
|
|
63
|
+
|
|
64
|
+
``read`` is the seam the error path and every buffered decoder take, not a convenience over
|
|
65
|
+
``iter_bytes``: it must both buffer the whole body *and* release the connection, so a body
|
|
66
|
+
survives the close that frees the socket. Neither it nor ``iter_bytes`` may raise
|
|
67
|
+
:class:`~.exceptions.TransportError`: that type is ``send``'s alone, and the retry loop reads it
|
|
68
|
+
as "no response arrived". A body that fails once the head is in raises the library's own
|
|
69
|
+
exception, which propagates in both response modes -- re-sending would repeat work the server
|
|
70
|
+
has already done.
|
|
71
|
+
|
|
72
|
+
``iter_bytes`` re-chunks to ``chunk_size`` bytes when given an ``int``; given ``None`` it MUST yield
|
|
73
|
+
each chunk as the network delivered it, buffering nothing of its own -- a latency-bound consumer such
|
|
74
|
+
as an event stream reads it that way, since a fixed size would hold a twenty-byte event back until
|
|
75
|
+
enough followed it.
|
|
76
|
+
|
|
77
|
+
``close`` MUST be idempotent. The runtime closes twice on one path: a buffered decoder releases
|
|
78
|
+
the body in its own ``finally``, and a decoder that raises is then closed again by the seam that
|
|
79
|
+
called it -- the belt that keeps a failed decode from stranding a socket."""
|
|
80
|
+
|
|
81
|
+
@property
|
|
82
|
+
def url(self) -> str:
|
|
83
|
+
"""The URL this response came from.
|
|
84
|
+
|
|
85
|
+
Carried on the response rather than passed alongside it, because the payloads that outlive
|
|
86
|
+
the call are the only readers and have no other way to name themselves once abandoned. It
|
|
87
|
+
is the URL the request asked for: the SDK never follows redirects."""
|
|
88
|
+
...
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def status_code(self) -> int: ...
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def headers(self) -> Mapping[str, str]: ...
|
|
95
|
+
|
|
96
|
+
def iter_bytes(self, chunk_size: int | None) -> Iterator[bytes]: ...
|
|
97
|
+
|
|
98
|
+
def read(self) -> bytes: ...
|
|
99
|
+
|
|
100
|
+
def close(self) -> None: ...
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class AsyncHttpResponse(Protocol):
|
|
104
|
+
"""The awaited twin. ``aclose`` rather than ``close``, matching the SDK's async client.
|
|
105
|
+
|
|
106
|
+
``url``, ``status_code`` and ``headers`` stay synchronous properties -- the head has already
|
|
107
|
+
arrived. Header names MUST be lowercased, the same rule the request side applies, and ``aread``
|
|
108
|
+
carries ``read``'s obligations: buffer the whole body, release the connection, and raise no
|
|
109
|
+
:class:`~.exceptions.TransportError` -- that type is ``send``'s alone. ``aclose`` carries
|
|
110
|
+
``close``'s -- it MUST be idempotent, for the same double-close path. ``aiter_bytes``
|
|
111
|
+
carries ``iter_bytes``'s ``chunk_size`` contract, ``None`` included."""
|
|
112
|
+
|
|
113
|
+
@property
|
|
114
|
+
def url(self) -> str:
|
|
115
|
+
"""The URL this response came from; see :attr:`HttpResponse.url`."""
|
|
116
|
+
...
|
|
117
|
+
|
|
118
|
+
@property
|
|
119
|
+
def status_code(self) -> int: ...
|
|
120
|
+
|
|
121
|
+
@property
|
|
122
|
+
def headers(self) -> Mapping[str, str]: ...
|
|
123
|
+
|
|
124
|
+
def aiter_bytes(self, chunk_size: int | None) -> AsyncIterator[bytes]: ...
|
|
125
|
+
|
|
126
|
+
async def aread(self) -> bytes: ...
|
|
127
|
+
|
|
128
|
+
async def aclose(self) -> None: ...
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class HttpClient(Protocol):
|
|
132
|
+
"""Sync transport contract.
|
|
133
|
+
|
|
134
|
+
There is **one** request seam. ``send`` returns as soon as the response head has arrived and
|
|
135
|
+
never reads the body; who reads it, and when the connection is released, is the decoder's
|
|
136
|
+
business (ADR-0063). A transport that buffered would be answering a question nobody asked --
|
|
137
|
+
and, underneath, the library this one wraps reaches a streamed response first in either case.
|
|
138
|
+
|
|
139
|
+
Implementations:
|
|
140
|
+
- MUST NOT mutate the incoming :class:`HttpRequest`.
|
|
141
|
+
- MUST honour ``request.timeout`` when it is set, and fall back to their own configured
|
|
142
|
+
timeout when it is ``None``.
|
|
143
|
+
- MUST lowercase the header names on the returned response: HTTP/1.1 treats them
|
|
144
|
+
case-insensitively and HTTP/2 requires lowercase, so a caller's lookup needs no case
|
|
145
|
+
handling -- the same rule, for the same reason, as the request side in
|
|
146
|
+
``_internal/headers.py``.
|
|
147
|
+
- MUST send ``request.headers`` as given and spell no header of its own: a body's label -- its
|
|
148
|
+
media type as ``Content-Type``, and a raw body's name as ``Content-Disposition`` -- is already
|
|
149
|
+
among them, folded under the parameter layers when the request was built, so a caller's
|
|
150
|
+
``extra_headers`` has already won. The one label a transport writes is a multipart body's,
|
|
151
|
+
whose boundary exists only once its encoder has minted it.
|
|
152
|
+
- MUST raise :class:`~.exceptions.TransportError` (``from <sdk>.core import TransportError``)
|
|
153
|
+
when a request produces no response at all -- a refused connection, a dropped one, a protocol
|
|
154
|
+
failure, a timeout -- or the retry loop never sees the failure, and MUST confine it to
|
|
155
|
+
this method: the returned response never raises one (see :class:`HttpResponse`). That is what lets the retry
|
|
156
|
+
loop and a caller both act on one shape whichever library moves the bytes; a loop that caught
|
|
157
|
+
the library's own exception would have to import it to say so. The library's exception belongs
|
|
158
|
+
on ``__cause__``, not swallowed.
|
|
159
|
+
- SHOULD be idempotent for ``close()``."""
|
|
160
|
+
|
|
161
|
+
def send(self, request: HttpRequest) -> HttpResponse:
|
|
162
|
+
"""Execute a request and return its response with the body unread.
|
|
163
|
+
|
|
164
|
+
Returns once the response head has arrived; the connection stays checked out until the
|
|
165
|
+
returned response is closed.
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
request: The request to send, which MUST NOT be mutated.
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
The response head, its body pending, its header names lowercased.
|
|
172
|
+
|
|
173
|
+
Raises:
|
|
174
|
+
TransportError: If the request produced no response. A failure *after* the head has
|
|
175
|
+
arrived belongs to the returned response, not here."""
|
|
176
|
+
...
|
|
177
|
+
|
|
178
|
+
def close(self) -> None:
|
|
179
|
+
"""Release underlying resources (connections, pools). Should be idempotent."""
|
|
180
|
+
...
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class AsyncHttpClient(Protocol):
|
|
184
|
+
"""Async transport contract -- the same shape as :class:`HttpClient`, awaited.
|
|
185
|
+
|
|
186
|
+
The same obligations apply, including honouring ``request.timeout``, lowercasing the
|
|
187
|
+
response's header names, leaving the body unread, and translating a failed send into
|
|
188
|
+
:class:`~.exceptions.TransportError`. ``aclose`` rather than ``close`` matches the shipped
|
|
189
|
+
transport's HTTP library and the SDK's own async client.
|
|
190
|
+
|
|
191
|
+
One obligation is this side's alone:
|
|
192
|
+
|
|
193
|
+
- Implementations MUST resolve an async :attr:`MultipartFile.content` themselves. A multipart
|
|
194
|
+
encoder pulls every part from a synchronous chunk generator, so an awaitable ``read`` cannot
|
|
195
|
+
be driven from inside one; the shipped transport drains such a part to a temp file before
|
|
196
|
+
encoding, which keeps it bounded rather than resident and leaves it sized. A raw
|
|
197
|
+
:class:`BinaryBody` needs no such pre-pass -- its async arms stream natively."""
|
|
198
|
+
|
|
199
|
+
async def send(self, request: HttpRequest) -> AsyncHttpResponse:
|
|
200
|
+
"""Execute a request and return its response with the body unread.
|
|
201
|
+
|
|
202
|
+
Returns once the response head has arrived; the connection stays checked out until the
|
|
203
|
+
returned response is closed.
|
|
204
|
+
|
|
205
|
+
Args:
|
|
206
|
+
request: The request to send, which MUST NOT be mutated.
|
|
207
|
+
|
|
208
|
+
Returns:
|
|
209
|
+
The response head, its body pending, its header names lowercased.
|
|
210
|
+
|
|
211
|
+
Raises:
|
|
212
|
+
TransportError: If the request produced no response. A failure *after* the head has
|
|
213
|
+
arrived belongs to the returned response, not here."""
|
|
214
|
+
...
|
|
215
|
+
|
|
216
|
+
async def aclose(self) -> None:
|
|
217
|
+
"""Release underlying resources (connections, pools). Should be idempotent."""
|
|
218
|
+
...
|
|
@@ -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, RawError
|
|
7
|
+
|
|
8
|
+
AddPetErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _AddPetError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> AddPetErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400 | 422:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
DeleteOrderErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _DeleteOrderError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> DeleteOrderErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
DeletePetErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _DeletePetError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> DeletePetErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
DeleteUserErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _DeleteUserError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> DeleteUserErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
FindPetsByStatusErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _FindPetsByStatusError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> FindPetsByStatusErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
FindPetsByTagsErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _FindPetsByTagsError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> FindPetsByTagsErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
GetOrderByIdErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _GetOrderByIdError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> GetOrderByIdErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
GetPetByIdErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _GetPetByIdError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> GetPetByIdErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
GetUserByNameErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _GetUserByNameError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> GetUserByNameErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
LoginUserErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _LoginUserError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> LoginUserErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
PlaceOrderErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _PlaceOrderError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> PlaceOrderErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400 | 422:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
UpdatePetErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _UpdatePetError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> UpdatePetErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400 | 404 | 422:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
UpdatePetWithFormErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _UpdatePetWithFormError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> UpdatePetWithFormErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
UpdateUserErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _UpdateUserError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> UpdateUserErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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, RawError
|
|
7
|
+
|
|
8
|
+
UploadFileErrorBody: TypeAlias = RawError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class _UploadFileError:
|
|
13
|
+
def map(self, status_code: int, content: bytes) -> UploadFileErrorBody:
|
|
14
|
+
match status_code:
|
|
15
|
+
case 400 | 404:
|
|
16
|
+
return RawError(status_code, content)
|
|
17
|
+
case _:
|
|
18
|
+
return RawError(status_code, content)
|
|
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_model import TagModel, TagModelDict
|
|
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
|
+
"TagModel",
|
|
20
|
+
"TagModelDict",
|
|
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]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing_extensions import NotRequired, TypedDict
|
|
4
|
+
|
|
5
|
+
from ..core import UNSET, Optional, SdkBaseModel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Category(SdkBaseModel):
|
|
9
|
+
id: Optional[int] = UNSET
|
|
10
|
+
name: Optional[str] = UNSET
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CategoryDict(TypedDict):
|
|
14
|
+
id: NotRequired[int]
|
|
15
|
+
name: NotRequired[str]
|