mapleflow 0.8.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.
Files changed (71) hide show
  1. mapleflow/__init__.py +8 -0
  2. mapleflow/api/__init__.py +1 -0
  3. mapleflow/api/ai/__init__.py +1 -0
  4. mapleflow/api/ai/post_ai_chat.py +195 -0
  5. mapleflow/api/ai/post_ai_embeddings.py +191 -0
  6. mapleflow/api/ai/post_ai_images.py +195 -0
  7. mapleflow/api/ai/post_ai_speech.py +191 -0
  8. mapleflow/api/ai/post_ai_transcribe.py +189 -0
  9. mapleflow/api/images/__init__.py +1 -0
  10. mapleflow/api/images/post_images_bg_remove.py +235 -0
  11. mapleflow/api/utility/__init__.py +1 -0
  12. mapleflow/api/utility/get_currency.py +253 -0
  13. mapleflow/api/utility/get_weather.py +277 -0
  14. mapleflow/api/utility/post_translate.py +206 -0
  15. mapleflow/api/verify/__init__.py +1 -0
  16. mapleflow/api/verify/post_verify_face.py +190 -0
  17. mapleflow/api/verify/post_verify_labels.py +190 -0
  18. mapleflow/client.py +282 -0
  19. mapleflow/errors.py +16 -0
  20. mapleflow/models/__init__.py +99 -0
  21. mapleflow/models/get_currency_response_200.py +81 -0
  22. mapleflow/models/get_currency_response_400.py +81 -0
  23. mapleflow/models/get_currency_response_404.py +81 -0
  24. mapleflow/models/get_currency_response_502.py +81 -0
  25. mapleflow/models/get_weather_response_200.py +81 -0
  26. mapleflow/models/get_weather_response_400.py +81 -0
  27. mapleflow/models/get_weather_response_404.py +81 -0
  28. mapleflow/models/get_weather_response_502.py +81 -0
  29. mapleflow/models/get_weather_units.py +9 -0
  30. mapleflow/models/post_ai_chat_body.py +104 -0
  31. mapleflow/models/post_ai_chat_body_messages_item.py +69 -0
  32. mapleflow/models/post_ai_chat_body_model.py +9 -0
  33. mapleflow/models/post_ai_chat_response_200.py +72 -0
  34. mapleflow/models/post_ai_chat_response_400.py +69 -0
  35. mapleflow/models/post_ai_embeddings_body.py +98 -0
  36. mapleflow/models/post_ai_embeddings_body_model.py +8 -0
  37. mapleflow/models/post_ai_embeddings_response_200.py +72 -0
  38. mapleflow/models/post_ai_embeddings_response_400.py +69 -0
  39. mapleflow/models/post_ai_images_body.py +90 -0
  40. mapleflow/models/post_ai_images_body_model.py +9 -0
  41. mapleflow/models/post_ai_images_response_200.py +72 -0
  42. mapleflow/models/post_ai_images_response_400.py +69 -0
  43. mapleflow/models/post_ai_speech_body.py +80 -0
  44. mapleflow/models/post_ai_speech_body_model.py +8 -0
  45. mapleflow/models/post_ai_speech_response_200.py +72 -0
  46. mapleflow/models/post_ai_speech_response_400.py +69 -0
  47. mapleflow/models/post_ai_transcribe_body.py +81 -0
  48. mapleflow/models/post_ai_transcribe_response_200.py +72 -0
  49. mapleflow/models/post_ai_transcribe_response_400.py +69 -0
  50. mapleflow/models/post_images_bg_remove_files_body.py +93 -0
  51. mapleflow/models/post_images_bg_remove_json_body.py +70 -0
  52. mapleflow/models/post_images_bg_remove_response_200.py +72 -0
  53. mapleflow/models/post_images_bg_remove_response_400.py +69 -0
  54. mapleflow/models/post_images_bg_remove_response_502.py +69 -0
  55. mapleflow/models/post_images_bg_remove_response_504.py +69 -0
  56. mapleflow/models/post_translate_body.py +89 -0
  57. mapleflow/models/post_translate_response_200.py +81 -0
  58. mapleflow/models/post_translate_response_400.py +81 -0
  59. mapleflow/models/post_translate_response_402.py +81 -0
  60. mapleflow/models/post_verify_face_files_body.py +100 -0
  61. mapleflow/models/post_verify_face_json_body.py +69 -0
  62. mapleflow/models/post_verify_face_response_200.py +72 -0
  63. mapleflow/models/post_verify_face_response_400.py +69 -0
  64. mapleflow/models/post_verify_labels_files_body.py +81 -0
  65. mapleflow/models/post_verify_labels_json_body.py +61 -0
  66. mapleflow/models/post_verify_labels_response_200.py +72 -0
  67. mapleflow/models/post_verify_labels_response_400.py +69 -0
  68. mapleflow/types.py +54 -0
  69. mapleflow-0.8.1.dist-info/METADATA +54 -0
  70. mapleflow-0.8.1.dist-info/RECORD +71 -0
  71. mapleflow-0.8.1.dist-info/WHEEL +4 -0
mapleflow/client.py ADDED
@@ -0,0 +1,282 @@
1
+ import ssl
2
+ from typing import Any
3
+
4
+ import httpx
5
+ from attrs import define, evolve, field
6
+
7
+
8
+ @define
9
+ class Client:
10
+ """A class for keeping track of data related to the API
11
+
12
+ The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
13
+
14
+ ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
15
+
16
+ ``cookies``: A dictionary of cookies to be sent with every request
17
+
18
+ ``headers``: A dictionary of headers to be sent with every request
19
+
20
+ ``timeout``: The maximum amount of a time a request can take. API functions will raise
21
+ httpx.TimeoutException if this is exceeded.
22
+
23
+ ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
24
+ but can be set to False for testing purposes.
25
+
26
+ ``follow_redirects``: Whether or not to follow redirects. Default value is False.
27
+
28
+ ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
29
+
30
+
31
+ Attributes:
32
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
33
+ status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
34
+ argument to the constructor.
35
+ """
36
+
37
+ raise_on_unexpected_status: bool = field(default=False, kw_only=True)
38
+ _base_url: str = field(alias="base_url")
39
+ _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
40
+ _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
41
+ _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
42
+ _verify_ssl: str | bool | ssl.SSLContext = field(
43
+ default=True, kw_only=True, alias="verify_ssl"
44
+ )
45
+ _follow_redirects: bool = field(
46
+ default=False, kw_only=True, alias="follow_redirects"
47
+ )
48
+ _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
49
+ _client: httpx.Client | None = field(default=None, init=False)
50
+ _async_client: httpx.AsyncClient | None = field(default=None, init=False)
51
+
52
+ def with_headers(self, headers: dict[str, str]) -> "Client":
53
+ """Get a new client matching this one with additional headers"""
54
+ if self._client is not None:
55
+ self._client.headers.update(headers)
56
+ if self._async_client is not None:
57
+ self._async_client.headers.update(headers)
58
+ return evolve(self, headers={**self._headers, **headers})
59
+
60
+ def with_cookies(self, cookies: dict[str, str]) -> "Client":
61
+ """Get a new client matching this one with additional cookies"""
62
+ if self._client is not None:
63
+ self._client.cookies.update(cookies)
64
+ if self._async_client is not None:
65
+ self._async_client.cookies.update(cookies)
66
+ return evolve(self, cookies={**self._cookies, **cookies})
67
+
68
+ def with_timeout(self, timeout: httpx.Timeout) -> "Client":
69
+ """Get a new client matching this one with a new timeout configuration"""
70
+ if self._client is not None:
71
+ self._client.timeout = timeout
72
+ if self._async_client is not None:
73
+ self._async_client.timeout = timeout
74
+ return evolve(self, timeout=timeout)
75
+
76
+ def set_httpx_client(self, client: httpx.Client) -> "Client":
77
+ """Manually set the underlying httpx.Client
78
+
79
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
80
+ """
81
+ self._client = client
82
+ return self
83
+
84
+ def get_httpx_client(self) -> httpx.Client:
85
+ """Get the underlying httpx.Client, constructing a new one if not previously set"""
86
+ if self._client is None:
87
+ self._client = httpx.Client(
88
+ base_url=self._base_url,
89
+ cookies=self._cookies,
90
+ headers=self._headers,
91
+ timeout=self._timeout,
92
+ verify=self._verify_ssl,
93
+ follow_redirects=self._follow_redirects,
94
+ **self._httpx_args,
95
+ )
96
+ return self._client
97
+
98
+ def __enter__(self) -> "Client":
99
+ """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
100
+ self.get_httpx_client().__enter__()
101
+ return self
102
+
103
+ def __exit__(self, *args: Any, **kwargs: Any) -> None:
104
+ """Exit a context manager for internal httpx.Client (see httpx docs)"""
105
+ self.get_httpx_client().__exit__(*args, **kwargs)
106
+
107
+ def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
108
+ """Manually set the underlying httpx.AsyncClient
109
+
110
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
111
+ """
112
+ self._async_client = async_client
113
+ return self
114
+
115
+ def get_async_httpx_client(self) -> httpx.AsyncClient:
116
+ """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
117
+ if self._async_client is None:
118
+ self._async_client = httpx.AsyncClient(
119
+ base_url=self._base_url,
120
+ cookies=self._cookies,
121
+ headers=self._headers,
122
+ timeout=self._timeout,
123
+ verify=self._verify_ssl,
124
+ follow_redirects=self._follow_redirects,
125
+ **self._httpx_args,
126
+ )
127
+ return self._async_client
128
+
129
+ async def __aenter__(self) -> "Client":
130
+ """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
131
+ await self.get_async_httpx_client().__aenter__()
132
+ return self
133
+
134
+ async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
135
+ """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
136
+ await self.get_async_httpx_client().__aexit__(*args, **kwargs)
137
+
138
+
139
+ @define
140
+ class AuthenticatedClient:
141
+ """A Client which has been authenticated for use on secured endpoints
142
+
143
+ The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
144
+
145
+ ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
146
+
147
+ ``cookies``: A dictionary of cookies to be sent with every request
148
+
149
+ ``headers``: A dictionary of headers to be sent with every request
150
+
151
+ ``timeout``: The maximum amount of a time a request can take. API functions will raise
152
+ httpx.TimeoutException if this is exceeded.
153
+
154
+ ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
155
+ but can be set to False for testing purposes.
156
+
157
+ ``follow_redirects``: Whether or not to follow redirects. Default value is False.
158
+
159
+ ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
160
+
161
+
162
+ Attributes:
163
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
164
+ status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
165
+ argument to the constructor.
166
+ token: The token to use for authentication
167
+ prefix: The prefix to use for the Authorization header
168
+ auth_header_name: The name of the Authorization header
169
+ """
170
+
171
+ raise_on_unexpected_status: bool = field(default=False, kw_only=True)
172
+ _base_url: str = field(alias="base_url")
173
+ _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
174
+ _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
175
+ _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
176
+ _verify_ssl: str | bool | ssl.SSLContext = field(
177
+ default=True, kw_only=True, alias="verify_ssl"
178
+ )
179
+ _follow_redirects: bool = field(
180
+ default=False, kw_only=True, alias="follow_redirects"
181
+ )
182
+ _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
183
+ _client: httpx.Client | None = field(default=None, init=False)
184
+ _async_client: httpx.AsyncClient | None = field(default=None, init=False)
185
+
186
+ token: str
187
+ prefix: str = "Bearer"
188
+ auth_header_name: str = "Authorization"
189
+
190
+ def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
191
+ """Get a new client matching this one with additional headers"""
192
+ if self._client is not None:
193
+ self._client.headers.update(headers)
194
+ if self._async_client is not None:
195
+ self._async_client.headers.update(headers)
196
+ return evolve(self, headers={**self._headers, **headers})
197
+
198
+ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
199
+ """Get a new client matching this one with additional cookies"""
200
+ if self._client is not None:
201
+ self._client.cookies.update(cookies)
202
+ if self._async_client is not None:
203
+ self._async_client.cookies.update(cookies)
204
+ return evolve(self, cookies={**self._cookies, **cookies})
205
+
206
+ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
207
+ """Get a new client matching this one with a new timeout configuration"""
208
+ if self._client is not None:
209
+ self._client.timeout = timeout
210
+ if self._async_client is not None:
211
+ self._async_client.timeout = timeout
212
+ return evolve(self, timeout=timeout)
213
+
214
+ def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
215
+ """Manually set the underlying httpx.Client
216
+
217
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
218
+ """
219
+ self._client = client
220
+ return self
221
+
222
+ def get_httpx_client(self) -> httpx.Client:
223
+ """Get the underlying httpx.Client, constructing a new one if not previously set"""
224
+ if self._client is None:
225
+ self._headers[self.auth_header_name] = (
226
+ f"{self.prefix} {self.token}" if self.prefix else self.token
227
+ )
228
+ self._client = httpx.Client(
229
+ base_url=self._base_url,
230
+ cookies=self._cookies,
231
+ headers=self._headers,
232
+ timeout=self._timeout,
233
+ verify=self._verify_ssl,
234
+ follow_redirects=self._follow_redirects,
235
+ **self._httpx_args,
236
+ )
237
+ return self._client
238
+
239
+ def __enter__(self) -> "AuthenticatedClient":
240
+ """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
241
+ self.get_httpx_client().__enter__()
242
+ return self
243
+
244
+ def __exit__(self, *args: Any, **kwargs: Any) -> None:
245
+ """Exit a context manager for internal httpx.Client (see httpx docs)"""
246
+ self.get_httpx_client().__exit__(*args, **kwargs)
247
+
248
+ def set_async_httpx_client(
249
+ self, async_client: httpx.AsyncClient
250
+ ) -> "AuthenticatedClient":
251
+ """Manually set the underlying httpx.AsyncClient
252
+
253
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
254
+ """
255
+ self._async_client = async_client
256
+ return self
257
+
258
+ def get_async_httpx_client(self) -> httpx.AsyncClient:
259
+ """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
260
+ if self._async_client is None:
261
+ self._headers[self.auth_header_name] = (
262
+ f"{self.prefix} {self.token}" if self.prefix else self.token
263
+ )
264
+ self._async_client = httpx.AsyncClient(
265
+ base_url=self._base_url,
266
+ cookies=self._cookies,
267
+ headers=self._headers,
268
+ timeout=self._timeout,
269
+ verify=self._verify_ssl,
270
+ follow_redirects=self._follow_redirects,
271
+ **self._httpx_args,
272
+ )
273
+ return self._async_client
274
+
275
+ async def __aenter__(self) -> "AuthenticatedClient":
276
+ """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
277
+ await self.get_async_httpx_client().__aenter__()
278
+ return self
279
+
280
+ async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
281
+ """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
282
+ await self.get_async_httpx_client().__aexit__(*args, **kwargs)
mapleflow/errors.py ADDED
@@ -0,0 +1,16 @@
1
+ """Contains shared errors types that can be raised from API functions"""
2
+
3
+
4
+ class UnexpectedStatus(Exception):
5
+ """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
6
+
7
+ def __init__(self, status_code: int, content: bytes):
8
+ self.status_code = status_code
9
+ self.content = content
10
+
11
+ super().__init__(
12
+ f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
13
+ )
14
+
15
+
16
+ __all__ = ["UnexpectedStatus"]
@@ -0,0 +1,99 @@
1
+ """Contains all the data models used in inputs/outputs"""
2
+
3
+ from .get_currency_response_200 import GetCurrencyResponse200
4
+ from .get_currency_response_400 import GetCurrencyResponse400
5
+ from .get_currency_response_404 import GetCurrencyResponse404
6
+ from .get_currency_response_502 import GetCurrencyResponse502
7
+ from .get_weather_response_200 import GetWeatherResponse200
8
+ from .get_weather_response_400 import GetWeatherResponse400
9
+ from .get_weather_response_404 import GetWeatherResponse404
10
+ from .get_weather_response_502 import GetWeatherResponse502
11
+ from .get_weather_units import GetWeatherUnits
12
+ from .post_ai_chat_body import PostAiChatBody
13
+ from .post_ai_chat_body_messages_item import PostAiChatBodyMessagesItem
14
+ from .post_ai_chat_body_model import PostAiChatBodyModel
15
+ from .post_ai_chat_response_200 import PostAiChatResponse200
16
+ from .post_ai_chat_response_400 import PostAiChatResponse400
17
+ from .post_ai_embeddings_body import PostAiEmbeddingsBody
18
+ from .post_ai_embeddings_body_model import PostAiEmbeddingsBodyModel
19
+ from .post_ai_embeddings_response_200 import PostAiEmbeddingsResponse200
20
+ from .post_ai_embeddings_response_400 import PostAiEmbeddingsResponse400
21
+ from .post_ai_images_body import PostAiImagesBody
22
+ from .post_ai_images_body_model import PostAiImagesBodyModel
23
+ from .post_ai_images_response_200 import PostAiImagesResponse200
24
+ from .post_ai_images_response_400 import PostAiImagesResponse400
25
+ from .post_ai_speech_body import PostAiSpeechBody
26
+ from .post_ai_speech_body_model import PostAiSpeechBodyModel
27
+ from .post_ai_speech_response_200 import PostAiSpeechResponse200
28
+ from .post_ai_speech_response_400 import PostAiSpeechResponse400
29
+ from .post_ai_transcribe_body import PostAiTranscribeBody
30
+ from .post_ai_transcribe_response_200 import PostAiTranscribeResponse200
31
+ from .post_ai_transcribe_response_400 import PostAiTranscribeResponse400
32
+ from .post_images_bg_remove_files_body import PostImagesBgRemoveFilesBody
33
+ from .post_images_bg_remove_json_body import PostImagesBgRemoveJsonBody
34
+ from .post_images_bg_remove_response_200 import PostImagesBgRemoveResponse200
35
+ from .post_images_bg_remove_response_400 import PostImagesBgRemoveResponse400
36
+ from .post_images_bg_remove_response_502 import PostImagesBgRemoveResponse502
37
+ from .post_images_bg_remove_response_504 import PostImagesBgRemoveResponse504
38
+ from .post_translate_body import PostTranslateBody
39
+ from .post_translate_response_200 import PostTranslateResponse200
40
+ from .post_translate_response_400 import PostTranslateResponse400
41
+ from .post_translate_response_402 import PostTranslateResponse402
42
+ from .post_verify_face_files_body import PostVerifyFaceFilesBody
43
+ from .post_verify_face_json_body import PostVerifyFaceJsonBody
44
+ from .post_verify_face_response_200 import PostVerifyFaceResponse200
45
+ from .post_verify_face_response_400 import PostVerifyFaceResponse400
46
+ from .post_verify_labels_files_body import PostVerifyLabelsFilesBody
47
+ from .post_verify_labels_json_body import PostVerifyLabelsJsonBody
48
+ from .post_verify_labels_response_200 import PostVerifyLabelsResponse200
49
+ from .post_verify_labels_response_400 import PostVerifyLabelsResponse400
50
+
51
+ __all__ = (
52
+ "GetCurrencyResponse200",
53
+ "GetCurrencyResponse400",
54
+ "GetCurrencyResponse404",
55
+ "GetCurrencyResponse502",
56
+ "GetWeatherResponse200",
57
+ "GetWeatherResponse400",
58
+ "GetWeatherResponse404",
59
+ "GetWeatherResponse502",
60
+ "GetWeatherUnits",
61
+ "PostAiChatBody",
62
+ "PostAiChatBodyMessagesItem",
63
+ "PostAiChatBodyModel",
64
+ "PostAiChatResponse200",
65
+ "PostAiChatResponse400",
66
+ "PostAiEmbeddingsBody",
67
+ "PostAiEmbeddingsBodyModel",
68
+ "PostAiEmbeddingsResponse200",
69
+ "PostAiEmbeddingsResponse400",
70
+ "PostAiImagesBody",
71
+ "PostAiImagesBodyModel",
72
+ "PostAiImagesResponse200",
73
+ "PostAiImagesResponse400",
74
+ "PostAiSpeechBody",
75
+ "PostAiSpeechBodyModel",
76
+ "PostAiSpeechResponse200",
77
+ "PostAiSpeechResponse400",
78
+ "PostAiTranscribeBody",
79
+ "PostAiTranscribeResponse200",
80
+ "PostAiTranscribeResponse400",
81
+ "PostImagesBgRemoveFilesBody",
82
+ "PostImagesBgRemoveJsonBody",
83
+ "PostImagesBgRemoveResponse200",
84
+ "PostImagesBgRemoveResponse400",
85
+ "PostImagesBgRemoveResponse502",
86
+ "PostImagesBgRemoveResponse504",
87
+ "PostTranslateBody",
88
+ "PostTranslateResponse200",
89
+ "PostTranslateResponse400",
90
+ "PostTranslateResponse402",
91
+ "PostVerifyFaceFilesBody",
92
+ "PostVerifyFaceJsonBody",
93
+ "PostVerifyFaceResponse200",
94
+ "PostVerifyFaceResponse400",
95
+ "PostVerifyLabelsFilesBody",
96
+ "PostVerifyLabelsJsonBody",
97
+ "PostVerifyLabelsResponse200",
98
+ "PostVerifyLabelsResponse400",
99
+ )
@@ -0,0 +1,81 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ T = TypeVar("T", bound="GetCurrencyResponse200")
12
+
13
+
14
+ @_attrs_define
15
+ class GetCurrencyResponse200:
16
+ """
17
+ Attributes:
18
+ success (bool):
19
+ data (Any | Unset):
20
+ error (str | Unset):
21
+ """
22
+
23
+ success: bool
24
+ data: Any | Unset = UNSET
25
+ error: str | Unset = UNSET
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ success = self.success
30
+
31
+ data = self.data
32
+
33
+ error = self.error
34
+
35
+ field_dict: dict[str, Any] = {}
36
+ field_dict.update(self.additional_properties)
37
+ field_dict.update(
38
+ {
39
+ "success": success,
40
+ }
41
+ )
42
+ if data is not UNSET:
43
+ field_dict["data"] = data
44
+ if error is not UNSET:
45
+ field_dict["error"] = error
46
+
47
+ return field_dict
48
+
49
+ @classmethod
50
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
51
+ d = dict(src_dict)
52
+ success = d.pop("success")
53
+
54
+ data = d.pop("data", UNSET)
55
+
56
+ error = d.pop("error", UNSET)
57
+
58
+ get_currency_response_200 = cls(
59
+ success=success,
60
+ data=data,
61
+ error=error,
62
+ )
63
+
64
+ get_currency_response_200.additional_properties = d
65
+ return get_currency_response_200
66
+
67
+ @property
68
+ def additional_keys(self) -> list[str]:
69
+ return list(self.additional_properties.keys())
70
+
71
+ def __getitem__(self, key: str) -> Any:
72
+ return self.additional_properties[key]
73
+
74
+ def __setitem__(self, key: str, value: Any) -> None:
75
+ self.additional_properties[key] = value
76
+
77
+ def __delitem__(self, key: str) -> None:
78
+ del self.additional_properties[key]
79
+
80
+ def __contains__(self, key: str) -> bool:
81
+ return key in self.additional_properties
@@ -0,0 +1,81 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ T = TypeVar("T", bound="GetCurrencyResponse400")
12
+
13
+
14
+ @_attrs_define
15
+ class GetCurrencyResponse400:
16
+ """
17
+ Attributes:
18
+ success (bool):
19
+ data (Any | Unset):
20
+ error (str | Unset):
21
+ """
22
+
23
+ success: bool
24
+ data: Any | Unset = UNSET
25
+ error: str | Unset = UNSET
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ success = self.success
30
+
31
+ data = self.data
32
+
33
+ error = self.error
34
+
35
+ field_dict: dict[str, Any] = {}
36
+ field_dict.update(self.additional_properties)
37
+ field_dict.update(
38
+ {
39
+ "success": success,
40
+ }
41
+ )
42
+ if data is not UNSET:
43
+ field_dict["data"] = data
44
+ if error is not UNSET:
45
+ field_dict["error"] = error
46
+
47
+ return field_dict
48
+
49
+ @classmethod
50
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
51
+ d = dict(src_dict)
52
+ success = d.pop("success")
53
+
54
+ data = d.pop("data", UNSET)
55
+
56
+ error = d.pop("error", UNSET)
57
+
58
+ get_currency_response_400 = cls(
59
+ success=success,
60
+ data=data,
61
+ error=error,
62
+ )
63
+
64
+ get_currency_response_400.additional_properties = d
65
+ return get_currency_response_400
66
+
67
+ @property
68
+ def additional_keys(self) -> list[str]:
69
+ return list(self.additional_properties.keys())
70
+
71
+ def __getitem__(self, key: str) -> Any:
72
+ return self.additional_properties[key]
73
+
74
+ def __setitem__(self, key: str, value: Any) -> None:
75
+ self.additional_properties[key] = value
76
+
77
+ def __delitem__(self, key: str) -> None:
78
+ del self.additional_properties[key]
79
+
80
+ def __contains__(self, key: str) -> bool:
81
+ return key in self.additional_properties
@@ -0,0 +1,81 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ T = TypeVar("T", bound="GetCurrencyResponse404")
12
+
13
+
14
+ @_attrs_define
15
+ class GetCurrencyResponse404:
16
+ """
17
+ Attributes:
18
+ success (bool):
19
+ data (Any | Unset):
20
+ error (str | Unset):
21
+ """
22
+
23
+ success: bool
24
+ data: Any | Unset = UNSET
25
+ error: str | Unset = UNSET
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ success = self.success
30
+
31
+ data = self.data
32
+
33
+ error = self.error
34
+
35
+ field_dict: dict[str, Any] = {}
36
+ field_dict.update(self.additional_properties)
37
+ field_dict.update(
38
+ {
39
+ "success": success,
40
+ }
41
+ )
42
+ if data is not UNSET:
43
+ field_dict["data"] = data
44
+ if error is not UNSET:
45
+ field_dict["error"] = error
46
+
47
+ return field_dict
48
+
49
+ @classmethod
50
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
51
+ d = dict(src_dict)
52
+ success = d.pop("success")
53
+
54
+ data = d.pop("data", UNSET)
55
+
56
+ error = d.pop("error", UNSET)
57
+
58
+ get_currency_response_404 = cls(
59
+ success=success,
60
+ data=data,
61
+ error=error,
62
+ )
63
+
64
+ get_currency_response_404.additional_properties = d
65
+ return get_currency_response_404
66
+
67
+ @property
68
+ def additional_keys(self) -> list[str]:
69
+ return list(self.additional_properties.keys())
70
+
71
+ def __getitem__(self, key: str) -> Any:
72
+ return self.additional_properties[key]
73
+
74
+ def __setitem__(self, key: str, value: Any) -> None:
75
+ self.additional_properties[key] = value
76
+
77
+ def __delitem__(self, key: str) -> None:
78
+ del self.additional_properties[key]
79
+
80
+ def __contains__(self, key: str) -> bool:
81
+ return key in self.additional_properties