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
@@ -0,0 +1,253 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.get_currency_response_200 import GetCurrencyResponse200
9
+ from ...models.get_currency_response_400 import GetCurrencyResponse400
10
+ from ...models.get_currency_response_404 import GetCurrencyResponse404
11
+ from ...models.get_currency_response_502 import GetCurrencyResponse502
12
+ from ...types import UNSET, Response, Unset
13
+
14
+
15
+ def _get_kwargs(
16
+ *,
17
+ from_: str,
18
+ to: str,
19
+ amount: str | Unset = "1",
20
+ ) -> dict[str, Any]:
21
+
22
+ params: dict[str, Any] = {}
23
+
24
+ params["from"] = from_
25
+
26
+ params["to"] = to
27
+
28
+ params["amount"] = amount
29
+
30
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
31
+
32
+ _kwargs: dict[str, Any] = {
33
+ "method": "get",
34
+ "url": "/currency",
35
+ "params": params,
36
+ }
37
+
38
+ return _kwargs
39
+
40
+
41
+ def _parse_response(
42
+ *, client: AuthenticatedClient | Client, response: httpx.Response
43
+ ) -> (
44
+ GetCurrencyResponse200
45
+ | GetCurrencyResponse400
46
+ | GetCurrencyResponse404
47
+ | GetCurrencyResponse502
48
+ | None
49
+ ):
50
+ if response.status_code == 200:
51
+ response_200 = GetCurrencyResponse200.from_dict(response.json())
52
+
53
+ return response_200
54
+
55
+ if response.status_code == 400:
56
+ response_400 = GetCurrencyResponse400.from_dict(response.json())
57
+
58
+ return response_400
59
+
60
+ if response.status_code == 404:
61
+ response_404 = GetCurrencyResponse404.from_dict(response.json())
62
+
63
+ return response_404
64
+
65
+ if response.status_code == 502:
66
+ response_502 = GetCurrencyResponse502.from_dict(response.json())
67
+
68
+ return response_502
69
+
70
+ if client.raise_on_unexpected_status:
71
+ raise errors.UnexpectedStatus(response.status_code, response.content)
72
+ else:
73
+ return None
74
+
75
+
76
+ def _build_response(
77
+ *, client: AuthenticatedClient | Client, response: httpx.Response
78
+ ) -> Response[
79
+ GetCurrencyResponse200
80
+ | GetCurrencyResponse400
81
+ | GetCurrencyResponse404
82
+ | GetCurrencyResponse502
83
+ ]:
84
+ return Response(
85
+ status_code=HTTPStatus(response.status_code),
86
+ content=response.content,
87
+ headers=response.headers,
88
+ parsed=_parse_response(client=client, response=response),
89
+ )
90
+
91
+
92
+ def sync_detailed(
93
+ *,
94
+ client: AuthenticatedClient | Client,
95
+ from_: str,
96
+ to: str,
97
+ amount: str | Unset = "1",
98
+ ) -> Response[
99
+ GetCurrencyResponse200
100
+ | GetCurrencyResponse400
101
+ | GetCurrencyResponse404
102
+ | GetCurrencyResponse502
103
+ ]:
104
+ """Convert currency
105
+
106
+ Convert between currencies using live exchange rates. 1 credit per request. 160+ currencies
107
+ supported.
108
+
109
+ Args:
110
+ from_ (str): Source currency code (ISO 4217) Example: USD.
111
+ to (str): Target currency code (ISO 4217) Example: EUR.
112
+ amount (str | Unset): Amount to convert Default: '1'. Example: 100.
113
+
114
+ Raises:
115
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
116
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
117
+
118
+ Returns:
119
+ Response[GetCurrencyResponse200 | GetCurrencyResponse400 | GetCurrencyResponse404 | GetCurrencyResponse502]
120
+ """
121
+
122
+ kwargs = _get_kwargs(
123
+ from_=from_,
124
+ to=to,
125
+ amount=amount,
126
+ )
127
+
128
+ response = client.get_httpx_client().request(
129
+ **kwargs,
130
+ )
131
+
132
+ return _build_response(client=client, response=response)
133
+
134
+
135
+ def sync(
136
+ *,
137
+ client: AuthenticatedClient | Client,
138
+ from_: str,
139
+ to: str,
140
+ amount: str | Unset = "1",
141
+ ) -> (
142
+ GetCurrencyResponse200
143
+ | GetCurrencyResponse400
144
+ | GetCurrencyResponse404
145
+ | GetCurrencyResponse502
146
+ | None
147
+ ):
148
+ """Convert currency
149
+
150
+ Convert between currencies using live exchange rates. 1 credit per request. 160+ currencies
151
+ supported.
152
+
153
+ Args:
154
+ from_ (str): Source currency code (ISO 4217) Example: USD.
155
+ to (str): Target currency code (ISO 4217) Example: EUR.
156
+ amount (str | Unset): Amount to convert Default: '1'. Example: 100.
157
+
158
+ Raises:
159
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
160
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
161
+
162
+ Returns:
163
+ GetCurrencyResponse200 | GetCurrencyResponse400 | GetCurrencyResponse404 | GetCurrencyResponse502
164
+ """
165
+
166
+ return sync_detailed(
167
+ client=client,
168
+ from_=from_,
169
+ to=to,
170
+ amount=amount,
171
+ ).parsed
172
+
173
+
174
+ async def asyncio_detailed(
175
+ *,
176
+ client: AuthenticatedClient | Client,
177
+ from_: str,
178
+ to: str,
179
+ amount: str | Unset = "1",
180
+ ) -> Response[
181
+ GetCurrencyResponse200
182
+ | GetCurrencyResponse400
183
+ | GetCurrencyResponse404
184
+ | GetCurrencyResponse502
185
+ ]:
186
+ """Convert currency
187
+
188
+ Convert between currencies using live exchange rates. 1 credit per request. 160+ currencies
189
+ supported.
190
+
191
+ Args:
192
+ from_ (str): Source currency code (ISO 4217) Example: USD.
193
+ to (str): Target currency code (ISO 4217) Example: EUR.
194
+ amount (str | Unset): Amount to convert Default: '1'. Example: 100.
195
+
196
+ Raises:
197
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
198
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
199
+
200
+ Returns:
201
+ Response[GetCurrencyResponse200 | GetCurrencyResponse400 | GetCurrencyResponse404 | GetCurrencyResponse502]
202
+ """
203
+
204
+ kwargs = _get_kwargs(
205
+ from_=from_,
206
+ to=to,
207
+ amount=amount,
208
+ )
209
+
210
+ response = await client.get_async_httpx_client().request(**kwargs)
211
+
212
+ return _build_response(client=client, response=response)
213
+
214
+
215
+ async def asyncio(
216
+ *,
217
+ client: AuthenticatedClient | Client,
218
+ from_: str,
219
+ to: str,
220
+ amount: str | Unset = "1",
221
+ ) -> (
222
+ GetCurrencyResponse200
223
+ | GetCurrencyResponse400
224
+ | GetCurrencyResponse404
225
+ | GetCurrencyResponse502
226
+ | None
227
+ ):
228
+ """Convert currency
229
+
230
+ Convert between currencies using live exchange rates. 1 credit per request. 160+ currencies
231
+ supported.
232
+
233
+ Args:
234
+ from_ (str): Source currency code (ISO 4217) Example: USD.
235
+ to (str): Target currency code (ISO 4217) Example: EUR.
236
+ amount (str | Unset): Amount to convert Default: '1'. Example: 100.
237
+
238
+ Raises:
239
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
240
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
241
+
242
+ Returns:
243
+ GetCurrencyResponse200 | GetCurrencyResponse400 | GetCurrencyResponse404 | GetCurrencyResponse502
244
+ """
245
+
246
+ return (
247
+ await asyncio_detailed(
248
+ client=client,
249
+ from_=from_,
250
+ to=to,
251
+ amount=amount,
252
+ )
253
+ ).parsed
@@ -0,0 +1,277 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.get_weather_response_200 import GetWeatherResponse200
9
+ from ...models.get_weather_response_400 import GetWeatherResponse400
10
+ from ...models.get_weather_response_404 import GetWeatherResponse404
11
+ from ...models.get_weather_response_502 import GetWeatherResponse502
12
+ from ...models.get_weather_units import GetWeatherUnits
13
+ from ...types import UNSET, Response, Unset
14
+
15
+
16
+ def _get_kwargs(
17
+ *,
18
+ location: str | Unset = UNSET,
19
+ lat: str | Unset = UNSET,
20
+ lon: str | Unset = UNSET,
21
+ units: GetWeatherUnits | Unset = GetWeatherUnits.METRIC,
22
+ ) -> dict[str, Any]:
23
+
24
+ params: dict[str, Any] = {}
25
+
26
+ params["location"] = location
27
+
28
+ params["lat"] = lat
29
+
30
+ params["lon"] = lon
31
+
32
+ json_units: str | Unset = UNSET
33
+ if not isinstance(units, Unset):
34
+ json_units = units.value
35
+
36
+ params["units"] = json_units
37
+
38
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
39
+
40
+ _kwargs: dict[str, Any] = {
41
+ "method": "get",
42
+ "url": "/weather",
43
+ "params": params,
44
+ }
45
+
46
+ return _kwargs
47
+
48
+
49
+ def _parse_response(
50
+ *, client: AuthenticatedClient | Client, response: httpx.Response
51
+ ) -> (
52
+ GetWeatherResponse200
53
+ | GetWeatherResponse400
54
+ | GetWeatherResponse404
55
+ | GetWeatherResponse502
56
+ | None
57
+ ):
58
+ if response.status_code == 200:
59
+ response_200 = GetWeatherResponse200.from_dict(response.json())
60
+
61
+ return response_200
62
+
63
+ if response.status_code == 400:
64
+ response_400 = GetWeatherResponse400.from_dict(response.json())
65
+
66
+ return response_400
67
+
68
+ if response.status_code == 404:
69
+ response_404 = GetWeatherResponse404.from_dict(response.json())
70
+
71
+ return response_404
72
+
73
+ if response.status_code == 502:
74
+ response_502 = GetWeatherResponse502.from_dict(response.json())
75
+
76
+ return response_502
77
+
78
+ if client.raise_on_unexpected_status:
79
+ raise errors.UnexpectedStatus(response.status_code, response.content)
80
+ else:
81
+ return None
82
+
83
+
84
+ def _build_response(
85
+ *, client: AuthenticatedClient | Client, response: httpx.Response
86
+ ) -> Response[
87
+ GetWeatherResponse200
88
+ | GetWeatherResponse400
89
+ | GetWeatherResponse404
90
+ | GetWeatherResponse502
91
+ ]:
92
+ return Response(
93
+ status_code=HTTPStatus(response.status_code),
94
+ content=response.content,
95
+ headers=response.headers,
96
+ parsed=_parse_response(client=client, response=response),
97
+ )
98
+
99
+
100
+ def sync_detailed(
101
+ *,
102
+ client: AuthenticatedClient | Client,
103
+ location: str | Unset = UNSET,
104
+ lat: str | Unset = UNSET,
105
+ lon: str | Unset = UNSET,
106
+ units: GetWeatherUnits | Unset = GetWeatherUnits.METRIC,
107
+ ) -> Response[
108
+ GetWeatherResponse200
109
+ | GetWeatherResponse400
110
+ | GetWeatherResponse404
111
+ | GetWeatherResponse502
112
+ ]:
113
+ """Get current weather
114
+
115
+ Get current weather for a location. Provide a city name or lat/lon coordinates. Costs 1 credit per
116
+ request.
117
+
118
+ Args:
119
+ location (str | Unset): City name Example: Toronto.
120
+ lat (str | Unset): Latitude Example: 43.65.
121
+ lon (str | Unset): Longitude Example: -79.38.
122
+ units (GetWeatherUnits | Unset): Unit system Default: GetWeatherUnits.METRIC. Example:
123
+ metric.
124
+
125
+ Raises:
126
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
128
+
129
+ Returns:
130
+ Response[GetWeatherResponse200 | GetWeatherResponse400 | GetWeatherResponse404 | GetWeatherResponse502]
131
+ """
132
+
133
+ kwargs = _get_kwargs(
134
+ location=location,
135
+ lat=lat,
136
+ lon=lon,
137
+ units=units,
138
+ )
139
+
140
+ response = client.get_httpx_client().request(
141
+ **kwargs,
142
+ )
143
+
144
+ return _build_response(client=client, response=response)
145
+
146
+
147
+ def sync(
148
+ *,
149
+ client: AuthenticatedClient | Client,
150
+ location: str | Unset = UNSET,
151
+ lat: str | Unset = UNSET,
152
+ lon: str | Unset = UNSET,
153
+ units: GetWeatherUnits | Unset = GetWeatherUnits.METRIC,
154
+ ) -> (
155
+ GetWeatherResponse200
156
+ | GetWeatherResponse400
157
+ | GetWeatherResponse404
158
+ | GetWeatherResponse502
159
+ | None
160
+ ):
161
+ """Get current weather
162
+
163
+ Get current weather for a location. Provide a city name or lat/lon coordinates. Costs 1 credit per
164
+ request.
165
+
166
+ Args:
167
+ location (str | Unset): City name Example: Toronto.
168
+ lat (str | Unset): Latitude Example: 43.65.
169
+ lon (str | Unset): Longitude Example: -79.38.
170
+ units (GetWeatherUnits | Unset): Unit system Default: GetWeatherUnits.METRIC. Example:
171
+ metric.
172
+
173
+ Raises:
174
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
175
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
176
+
177
+ Returns:
178
+ GetWeatherResponse200 | GetWeatherResponse400 | GetWeatherResponse404 | GetWeatherResponse502
179
+ """
180
+
181
+ return sync_detailed(
182
+ client=client,
183
+ location=location,
184
+ lat=lat,
185
+ lon=lon,
186
+ units=units,
187
+ ).parsed
188
+
189
+
190
+ async def asyncio_detailed(
191
+ *,
192
+ client: AuthenticatedClient | Client,
193
+ location: str | Unset = UNSET,
194
+ lat: str | Unset = UNSET,
195
+ lon: str | Unset = UNSET,
196
+ units: GetWeatherUnits | Unset = GetWeatherUnits.METRIC,
197
+ ) -> Response[
198
+ GetWeatherResponse200
199
+ | GetWeatherResponse400
200
+ | GetWeatherResponse404
201
+ | GetWeatherResponse502
202
+ ]:
203
+ """Get current weather
204
+
205
+ Get current weather for a location. Provide a city name or lat/lon coordinates. Costs 1 credit per
206
+ request.
207
+
208
+ Args:
209
+ location (str | Unset): City name Example: Toronto.
210
+ lat (str | Unset): Latitude Example: 43.65.
211
+ lon (str | Unset): Longitude Example: -79.38.
212
+ units (GetWeatherUnits | Unset): Unit system Default: GetWeatherUnits.METRIC. Example:
213
+ metric.
214
+
215
+ Raises:
216
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
217
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
218
+
219
+ Returns:
220
+ Response[GetWeatherResponse200 | GetWeatherResponse400 | GetWeatherResponse404 | GetWeatherResponse502]
221
+ """
222
+
223
+ kwargs = _get_kwargs(
224
+ location=location,
225
+ lat=lat,
226
+ lon=lon,
227
+ units=units,
228
+ )
229
+
230
+ response = await client.get_async_httpx_client().request(**kwargs)
231
+
232
+ return _build_response(client=client, response=response)
233
+
234
+
235
+ async def asyncio(
236
+ *,
237
+ client: AuthenticatedClient | Client,
238
+ location: str | Unset = UNSET,
239
+ lat: str | Unset = UNSET,
240
+ lon: str | Unset = UNSET,
241
+ units: GetWeatherUnits | Unset = GetWeatherUnits.METRIC,
242
+ ) -> (
243
+ GetWeatherResponse200
244
+ | GetWeatherResponse400
245
+ | GetWeatherResponse404
246
+ | GetWeatherResponse502
247
+ | None
248
+ ):
249
+ """Get current weather
250
+
251
+ Get current weather for a location. Provide a city name or lat/lon coordinates. Costs 1 credit per
252
+ request.
253
+
254
+ Args:
255
+ location (str | Unset): City name Example: Toronto.
256
+ lat (str | Unset): Latitude Example: 43.65.
257
+ lon (str | Unset): Longitude Example: -79.38.
258
+ units (GetWeatherUnits | Unset): Unit system Default: GetWeatherUnits.METRIC. Example:
259
+ metric.
260
+
261
+ Raises:
262
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
263
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
264
+
265
+ Returns:
266
+ GetWeatherResponse200 | GetWeatherResponse400 | GetWeatherResponse404 | GetWeatherResponse502
267
+ """
268
+
269
+ return (
270
+ await asyncio_detailed(
271
+ client=client,
272
+ location=location,
273
+ lat=lat,
274
+ lon=lon,
275
+ units=units,
276
+ )
277
+ ).parsed