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.
- mapleflow/__init__.py +8 -0
- mapleflow/api/__init__.py +1 -0
- mapleflow/api/ai/__init__.py +1 -0
- mapleflow/api/ai/post_ai_chat.py +195 -0
- mapleflow/api/ai/post_ai_embeddings.py +191 -0
- mapleflow/api/ai/post_ai_images.py +195 -0
- mapleflow/api/ai/post_ai_speech.py +191 -0
- mapleflow/api/ai/post_ai_transcribe.py +189 -0
- mapleflow/api/images/__init__.py +1 -0
- mapleflow/api/images/post_images_bg_remove.py +235 -0
- mapleflow/api/utility/__init__.py +1 -0
- mapleflow/api/utility/get_currency.py +253 -0
- mapleflow/api/utility/get_weather.py +277 -0
- mapleflow/api/utility/post_translate.py +206 -0
- mapleflow/api/verify/__init__.py +1 -0
- mapleflow/api/verify/post_verify_face.py +190 -0
- mapleflow/api/verify/post_verify_labels.py +190 -0
- mapleflow/client.py +282 -0
- mapleflow/errors.py +16 -0
- mapleflow/models/__init__.py +99 -0
- mapleflow/models/get_currency_response_200.py +81 -0
- mapleflow/models/get_currency_response_400.py +81 -0
- mapleflow/models/get_currency_response_404.py +81 -0
- mapleflow/models/get_currency_response_502.py +81 -0
- mapleflow/models/get_weather_response_200.py +81 -0
- mapleflow/models/get_weather_response_400.py +81 -0
- mapleflow/models/get_weather_response_404.py +81 -0
- mapleflow/models/get_weather_response_502.py +81 -0
- mapleflow/models/get_weather_units.py +9 -0
- mapleflow/models/post_ai_chat_body.py +104 -0
- mapleflow/models/post_ai_chat_body_messages_item.py +69 -0
- mapleflow/models/post_ai_chat_body_model.py +9 -0
- mapleflow/models/post_ai_chat_response_200.py +72 -0
- mapleflow/models/post_ai_chat_response_400.py +69 -0
- mapleflow/models/post_ai_embeddings_body.py +98 -0
- mapleflow/models/post_ai_embeddings_body_model.py +8 -0
- mapleflow/models/post_ai_embeddings_response_200.py +72 -0
- mapleflow/models/post_ai_embeddings_response_400.py +69 -0
- mapleflow/models/post_ai_images_body.py +90 -0
- mapleflow/models/post_ai_images_body_model.py +9 -0
- mapleflow/models/post_ai_images_response_200.py +72 -0
- mapleflow/models/post_ai_images_response_400.py +69 -0
- mapleflow/models/post_ai_speech_body.py +80 -0
- mapleflow/models/post_ai_speech_body_model.py +8 -0
- mapleflow/models/post_ai_speech_response_200.py +72 -0
- mapleflow/models/post_ai_speech_response_400.py +69 -0
- mapleflow/models/post_ai_transcribe_body.py +81 -0
- mapleflow/models/post_ai_transcribe_response_200.py +72 -0
- mapleflow/models/post_ai_transcribe_response_400.py +69 -0
- mapleflow/models/post_images_bg_remove_files_body.py +93 -0
- mapleflow/models/post_images_bg_remove_json_body.py +70 -0
- mapleflow/models/post_images_bg_remove_response_200.py +72 -0
- mapleflow/models/post_images_bg_remove_response_400.py +69 -0
- mapleflow/models/post_images_bg_remove_response_502.py +69 -0
- mapleflow/models/post_images_bg_remove_response_504.py +69 -0
- mapleflow/models/post_translate_body.py +89 -0
- mapleflow/models/post_translate_response_200.py +81 -0
- mapleflow/models/post_translate_response_400.py +81 -0
- mapleflow/models/post_translate_response_402.py +81 -0
- mapleflow/models/post_verify_face_files_body.py +100 -0
- mapleflow/models/post_verify_face_json_body.py +69 -0
- mapleflow/models/post_verify_face_response_200.py +72 -0
- mapleflow/models/post_verify_face_response_400.py +69 -0
- mapleflow/models/post_verify_labels_files_body.py +81 -0
- mapleflow/models/post_verify_labels_json_body.py +61 -0
- mapleflow/models/post_verify_labels_response_200.py +72 -0
- mapleflow/models/post_verify_labels_response_400.py +69 -0
- mapleflow/types.py +54 -0
- mapleflow-0.8.1.dist-info/METADATA +54 -0
- mapleflow-0.8.1.dist-info/RECORD +71 -0
- mapleflow-0.8.1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,206 @@
|
|
|
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.post_translate_body import PostTranslateBody
|
|
9
|
+
from ...models.post_translate_response_200 import PostTranslateResponse200
|
|
10
|
+
from ...models.post_translate_response_400 import PostTranslateResponse400
|
|
11
|
+
from ...models.post_translate_response_402 import PostTranslateResponse402
|
|
12
|
+
from ...types import UNSET, Response, Unset
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
*,
|
|
17
|
+
body: PostTranslateBody | Unset = UNSET,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
headers: dict[str, Any] = {}
|
|
20
|
+
|
|
21
|
+
_kwargs: dict[str, Any] = {
|
|
22
|
+
"method": "post",
|
|
23
|
+
"url": "/translate",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if not isinstance(body, Unset):
|
|
27
|
+
_kwargs["json"] = body.to_dict()
|
|
28
|
+
|
|
29
|
+
headers["Content-Type"] = "application/json"
|
|
30
|
+
|
|
31
|
+
_kwargs["headers"] = headers
|
|
32
|
+
return _kwargs
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _parse_response(
|
|
36
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
37
|
+
) -> (
|
|
38
|
+
PostTranslateResponse200
|
|
39
|
+
| PostTranslateResponse400
|
|
40
|
+
| PostTranslateResponse402
|
|
41
|
+
| None
|
|
42
|
+
):
|
|
43
|
+
if response.status_code == 200:
|
|
44
|
+
response_200 = PostTranslateResponse200.from_dict(response.json())
|
|
45
|
+
|
|
46
|
+
return response_200
|
|
47
|
+
|
|
48
|
+
if response.status_code == 400:
|
|
49
|
+
response_400 = PostTranslateResponse400.from_dict(response.json())
|
|
50
|
+
|
|
51
|
+
return response_400
|
|
52
|
+
|
|
53
|
+
if response.status_code == 402:
|
|
54
|
+
response_402 = PostTranslateResponse402.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_402
|
|
57
|
+
|
|
58
|
+
if client.raise_on_unexpected_status:
|
|
59
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
60
|
+
else:
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _build_response(
|
|
65
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
66
|
+
) -> Response[
|
|
67
|
+
PostTranslateResponse200 | PostTranslateResponse400 | PostTranslateResponse402
|
|
68
|
+
]:
|
|
69
|
+
return Response(
|
|
70
|
+
status_code=HTTPStatus(response.status_code),
|
|
71
|
+
content=response.content,
|
|
72
|
+
headers=response.headers,
|
|
73
|
+
parsed=_parse_response(client=client, response=response),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def sync_detailed(
|
|
78
|
+
*,
|
|
79
|
+
client: AuthenticatedClient | Client,
|
|
80
|
+
body: PostTranslateBody | Unset = UNSET,
|
|
81
|
+
) -> Response[
|
|
82
|
+
PostTranslateResponse200 | PostTranslateResponse400 | PostTranslateResponse402
|
|
83
|
+
]:
|
|
84
|
+
"""Translate text
|
|
85
|
+
|
|
86
|
+
Translate text between languages. Pricing: 1 credit per 300 characters (rounded up, minimum 1
|
|
87
|
+
credit). Supports 75+ languages with auto-detection.
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
body (PostTranslateBody | Unset):
|
|
91
|
+
|
|
92
|
+
Raises:
|
|
93
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
94
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
Response[PostTranslateResponse200 | PostTranslateResponse400 | PostTranslateResponse402]
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
kwargs = _get_kwargs(
|
|
101
|
+
body=body,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
response = client.get_httpx_client().request(
|
|
105
|
+
**kwargs,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
return _build_response(client=client, response=response)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def sync(
|
|
112
|
+
*,
|
|
113
|
+
client: AuthenticatedClient | Client,
|
|
114
|
+
body: PostTranslateBody | Unset = UNSET,
|
|
115
|
+
) -> (
|
|
116
|
+
PostTranslateResponse200
|
|
117
|
+
| PostTranslateResponse400
|
|
118
|
+
| PostTranslateResponse402
|
|
119
|
+
| None
|
|
120
|
+
):
|
|
121
|
+
"""Translate text
|
|
122
|
+
|
|
123
|
+
Translate text between languages. Pricing: 1 credit per 300 characters (rounded up, minimum 1
|
|
124
|
+
credit). Supports 75+ languages with auto-detection.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
body (PostTranslateBody | Unset):
|
|
128
|
+
|
|
129
|
+
Raises:
|
|
130
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
131
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
PostTranslateResponse200 | PostTranslateResponse400 | PostTranslateResponse402
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
return sync_detailed(
|
|
138
|
+
client=client,
|
|
139
|
+
body=body,
|
|
140
|
+
).parsed
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
async def asyncio_detailed(
|
|
144
|
+
*,
|
|
145
|
+
client: AuthenticatedClient | Client,
|
|
146
|
+
body: PostTranslateBody | Unset = UNSET,
|
|
147
|
+
) -> Response[
|
|
148
|
+
PostTranslateResponse200 | PostTranslateResponse400 | PostTranslateResponse402
|
|
149
|
+
]:
|
|
150
|
+
"""Translate text
|
|
151
|
+
|
|
152
|
+
Translate text between languages. Pricing: 1 credit per 300 characters (rounded up, minimum 1
|
|
153
|
+
credit). Supports 75+ languages with auto-detection.
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
body (PostTranslateBody | Unset):
|
|
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
|
+
Response[PostTranslateResponse200 | PostTranslateResponse400 | PostTranslateResponse402]
|
|
164
|
+
"""
|
|
165
|
+
|
|
166
|
+
kwargs = _get_kwargs(
|
|
167
|
+
body=body,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
171
|
+
|
|
172
|
+
return _build_response(client=client, response=response)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
async def asyncio(
|
|
176
|
+
*,
|
|
177
|
+
client: AuthenticatedClient | Client,
|
|
178
|
+
body: PostTranslateBody | Unset = UNSET,
|
|
179
|
+
) -> (
|
|
180
|
+
PostTranslateResponse200
|
|
181
|
+
| PostTranslateResponse400
|
|
182
|
+
| PostTranslateResponse402
|
|
183
|
+
| None
|
|
184
|
+
):
|
|
185
|
+
"""Translate text
|
|
186
|
+
|
|
187
|
+
Translate text between languages. Pricing: 1 credit per 300 characters (rounded up, minimum 1
|
|
188
|
+
credit). Supports 75+ languages with auto-detection.
|
|
189
|
+
|
|
190
|
+
Args:
|
|
191
|
+
body (PostTranslateBody | Unset):
|
|
192
|
+
|
|
193
|
+
Raises:
|
|
194
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
195
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
196
|
+
|
|
197
|
+
Returns:
|
|
198
|
+
PostTranslateResponse200 | PostTranslateResponse400 | PostTranslateResponse402
|
|
199
|
+
"""
|
|
200
|
+
|
|
201
|
+
return (
|
|
202
|
+
await asyncio_detailed(
|
|
203
|
+
client=client,
|
|
204
|
+
body=body,
|
|
205
|
+
)
|
|
206
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,190 @@
|
|
|
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.post_verify_face_files_body import PostVerifyFaceFilesBody
|
|
9
|
+
from ...models.post_verify_face_json_body import PostVerifyFaceJsonBody
|
|
10
|
+
from ...models.post_verify_face_response_200 import PostVerifyFaceResponse200
|
|
11
|
+
from ...models.post_verify_face_response_400 import PostVerifyFaceResponse400
|
|
12
|
+
from ...types import UNSET, Response, Unset
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
*,
|
|
17
|
+
body: PostVerifyFaceFilesBody | PostVerifyFaceJsonBody | Unset = UNSET,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
headers: dict[str, Any] = {}
|
|
20
|
+
|
|
21
|
+
_kwargs: dict[str, Any] = {
|
|
22
|
+
"method": "post",
|
|
23
|
+
"url": "/verify/face",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if isinstance(body, PostVerifyFaceFilesBody):
|
|
27
|
+
if not isinstance(body, Unset):
|
|
28
|
+
_kwargs["files"] = body.to_multipart()
|
|
29
|
+
|
|
30
|
+
headers["Content-Type"] = "multipart/form-data"
|
|
31
|
+
if isinstance(body, PostVerifyFaceJsonBody):
|
|
32
|
+
if not isinstance(body, Unset):
|
|
33
|
+
_kwargs["json"] = body.to_dict()
|
|
34
|
+
|
|
35
|
+
headers["Content-Type"] = "application/json"
|
|
36
|
+
|
|
37
|
+
_kwargs["headers"] = headers
|
|
38
|
+
return _kwargs
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _parse_response(
|
|
42
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
43
|
+
) -> PostVerifyFaceResponse200 | PostVerifyFaceResponse400 | None:
|
|
44
|
+
if response.status_code == 200:
|
|
45
|
+
response_200 = PostVerifyFaceResponse200.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_200
|
|
48
|
+
|
|
49
|
+
if response.status_code == 400:
|
|
50
|
+
response_400 = PostVerifyFaceResponse400.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_400
|
|
53
|
+
|
|
54
|
+
if client.raise_on_unexpected_status:
|
|
55
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
56
|
+
else:
|
|
57
|
+
return None
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _build_response(
|
|
61
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
62
|
+
) -> Response[PostVerifyFaceResponse200 | PostVerifyFaceResponse400]:
|
|
63
|
+
return Response(
|
|
64
|
+
status_code=HTTPStatus(response.status_code),
|
|
65
|
+
content=response.content,
|
|
66
|
+
headers=response.headers,
|
|
67
|
+
parsed=_parse_response(client=client, response=response),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def sync_detailed(
|
|
72
|
+
*,
|
|
73
|
+
client: AuthenticatedClient | Client,
|
|
74
|
+
body: PostVerifyFaceFilesBody | PostVerifyFaceJsonBody | Unset = UNSET,
|
|
75
|
+
) -> Response[PostVerifyFaceResponse200 | PostVerifyFaceResponse400]:
|
|
76
|
+
"""Compare two faces
|
|
77
|
+
|
|
78
|
+
Compare two faces and return similarity score. Accepts multipart (image1, image2 files) or JSON
|
|
79
|
+
(base64 strings). 2 credits per call.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
body (PostVerifyFaceFilesBody | Unset):
|
|
83
|
+
body (PostVerifyFaceJsonBody | Unset):
|
|
84
|
+
|
|
85
|
+
Raises:
|
|
86
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
87
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
Response[PostVerifyFaceResponse200 | PostVerifyFaceResponse400]
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
kwargs = _get_kwargs(
|
|
94
|
+
body=body,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
response = client.get_httpx_client().request(
|
|
98
|
+
**kwargs,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
return _build_response(client=client, response=response)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def sync(
|
|
105
|
+
*,
|
|
106
|
+
client: AuthenticatedClient | Client,
|
|
107
|
+
body: PostVerifyFaceFilesBody | PostVerifyFaceJsonBody | Unset = UNSET,
|
|
108
|
+
) -> PostVerifyFaceResponse200 | PostVerifyFaceResponse400 | None:
|
|
109
|
+
"""Compare two faces
|
|
110
|
+
|
|
111
|
+
Compare two faces and return similarity score. Accepts multipart (image1, image2 files) or JSON
|
|
112
|
+
(base64 strings). 2 credits per call.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
body (PostVerifyFaceFilesBody | Unset):
|
|
116
|
+
body (PostVerifyFaceJsonBody | Unset):
|
|
117
|
+
|
|
118
|
+
Raises:
|
|
119
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
120
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
PostVerifyFaceResponse200 | PostVerifyFaceResponse400
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
return sync_detailed(
|
|
127
|
+
client=client,
|
|
128
|
+
body=body,
|
|
129
|
+
).parsed
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
async def asyncio_detailed(
|
|
133
|
+
*,
|
|
134
|
+
client: AuthenticatedClient | Client,
|
|
135
|
+
body: PostVerifyFaceFilesBody | PostVerifyFaceJsonBody | Unset = UNSET,
|
|
136
|
+
) -> Response[PostVerifyFaceResponse200 | PostVerifyFaceResponse400]:
|
|
137
|
+
"""Compare two faces
|
|
138
|
+
|
|
139
|
+
Compare two faces and return similarity score. Accepts multipart (image1, image2 files) or JSON
|
|
140
|
+
(base64 strings). 2 credits per call.
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
body (PostVerifyFaceFilesBody | Unset):
|
|
144
|
+
body (PostVerifyFaceJsonBody | Unset):
|
|
145
|
+
|
|
146
|
+
Raises:
|
|
147
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
148
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
Response[PostVerifyFaceResponse200 | PostVerifyFaceResponse400]
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
kwargs = _get_kwargs(
|
|
155
|
+
body=body,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
159
|
+
|
|
160
|
+
return _build_response(client=client, response=response)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
async def asyncio(
|
|
164
|
+
*,
|
|
165
|
+
client: AuthenticatedClient | Client,
|
|
166
|
+
body: PostVerifyFaceFilesBody | PostVerifyFaceJsonBody | Unset = UNSET,
|
|
167
|
+
) -> PostVerifyFaceResponse200 | PostVerifyFaceResponse400 | None:
|
|
168
|
+
"""Compare two faces
|
|
169
|
+
|
|
170
|
+
Compare two faces and return similarity score. Accepts multipart (image1, image2 files) or JSON
|
|
171
|
+
(base64 strings). 2 credits per call.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
body (PostVerifyFaceFilesBody | Unset):
|
|
175
|
+
body (PostVerifyFaceJsonBody | Unset):
|
|
176
|
+
|
|
177
|
+
Raises:
|
|
178
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
179
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
180
|
+
|
|
181
|
+
Returns:
|
|
182
|
+
PostVerifyFaceResponse200 | PostVerifyFaceResponse400
|
|
183
|
+
"""
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
await asyncio_detailed(
|
|
187
|
+
client=client,
|
|
188
|
+
body=body,
|
|
189
|
+
)
|
|
190
|
+
).parsed
|
|
@@ -0,0 +1,190 @@
|
|
|
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.post_verify_labels_files_body import PostVerifyLabelsFilesBody
|
|
9
|
+
from ...models.post_verify_labels_json_body import PostVerifyLabelsJsonBody
|
|
10
|
+
from ...models.post_verify_labels_response_200 import PostVerifyLabelsResponse200
|
|
11
|
+
from ...models.post_verify_labels_response_400 import PostVerifyLabelsResponse400
|
|
12
|
+
from ...types import UNSET, Response, Unset
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
*,
|
|
17
|
+
body: PostVerifyLabelsFilesBody | PostVerifyLabelsJsonBody | Unset = UNSET,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
headers: dict[str, Any] = {}
|
|
20
|
+
|
|
21
|
+
_kwargs: dict[str, Any] = {
|
|
22
|
+
"method": "post",
|
|
23
|
+
"url": "/verify/labels",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if isinstance(body, PostVerifyLabelsFilesBody):
|
|
27
|
+
if not isinstance(body, Unset):
|
|
28
|
+
_kwargs["files"] = body.to_multipart()
|
|
29
|
+
|
|
30
|
+
headers["Content-Type"] = "multipart/form-data"
|
|
31
|
+
if isinstance(body, PostVerifyLabelsJsonBody):
|
|
32
|
+
if not isinstance(body, Unset):
|
|
33
|
+
_kwargs["json"] = body.to_dict()
|
|
34
|
+
|
|
35
|
+
headers["Content-Type"] = "application/json"
|
|
36
|
+
|
|
37
|
+
_kwargs["headers"] = headers
|
|
38
|
+
return _kwargs
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _parse_response(
|
|
42
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
43
|
+
) -> PostVerifyLabelsResponse200 | PostVerifyLabelsResponse400 | None:
|
|
44
|
+
if response.status_code == 200:
|
|
45
|
+
response_200 = PostVerifyLabelsResponse200.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_200
|
|
48
|
+
|
|
49
|
+
if response.status_code == 400:
|
|
50
|
+
response_400 = PostVerifyLabelsResponse400.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_400
|
|
53
|
+
|
|
54
|
+
if client.raise_on_unexpected_status:
|
|
55
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
56
|
+
else:
|
|
57
|
+
return None
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _build_response(
|
|
61
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
62
|
+
) -> Response[PostVerifyLabelsResponse200 | PostVerifyLabelsResponse400]:
|
|
63
|
+
return Response(
|
|
64
|
+
status_code=HTTPStatus(response.status_code),
|
|
65
|
+
content=response.content,
|
|
66
|
+
headers=response.headers,
|
|
67
|
+
parsed=_parse_response(client=client, response=response),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def sync_detailed(
|
|
72
|
+
*,
|
|
73
|
+
client: AuthenticatedClient | Client,
|
|
74
|
+
body: PostVerifyLabelsFilesBody | PostVerifyLabelsJsonBody | Unset = UNSET,
|
|
75
|
+
) -> Response[PostVerifyLabelsResponse200 | PostVerifyLabelsResponse400]:
|
|
76
|
+
"""Detect image labels
|
|
77
|
+
|
|
78
|
+
Detect objects and scenes in an image. Accepts multipart (image file) or JSON (base64 string). 2
|
|
79
|
+
credits per call.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
body (PostVerifyLabelsFilesBody | Unset):
|
|
83
|
+
body (PostVerifyLabelsJsonBody | Unset):
|
|
84
|
+
|
|
85
|
+
Raises:
|
|
86
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
87
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
Response[PostVerifyLabelsResponse200 | PostVerifyLabelsResponse400]
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
kwargs = _get_kwargs(
|
|
94
|
+
body=body,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
response = client.get_httpx_client().request(
|
|
98
|
+
**kwargs,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
return _build_response(client=client, response=response)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def sync(
|
|
105
|
+
*,
|
|
106
|
+
client: AuthenticatedClient | Client,
|
|
107
|
+
body: PostVerifyLabelsFilesBody | PostVerifyLabelsJsonBody | Unset = UNSET,
|
|
108
|
+
) -> PostVerifyLabelsResponse200 | PostVerifyLabelsResponse400 | None:
|
|
109
|
+
"""Detect image labels
|
|
110
|
+
|
|
111
|
+
Detect objects and scenes in an image. Accepts multipart (image file) or JSON (base64 string). 2
|
|
112
|
+
credits per call.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
body (PostVerifyLabelsFilesBody | Unset):
|
|
116
|
+
body (PostVerifyLabelsJsonBody | Unset):
|
|
117
|
+
|
|
118
|
+
Raises:
|
|
119
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
120
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
PostVerifyLabelsResponse200 | PostVerifyLabelsResponse400
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
return sync_detailed(
|
|
127
|
+
client=client,
|
|
128
|
+
body=body,
|
|
129
|
+
).parsed
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
async def asyncio_detailed(
|
|
133
|
+
*,
|
|
134
|
+
client: AuthenticatedClient | Client,
|
|
135
|
+
body: PostVerifyLabelsFilesBody | PostVerifyLabelsJsonBody | Unset = UNSET,
|
|
136
|
+
) -> Response[PostVerifyLabelsResponse200 | PostVerifyLabelsResponse400]:
|
|
137
|
+
"""Detect image labels
|
|
138
|
+
|
|
139
|
+
Detect objects and scenes in an image. Accepts multipart (image file) or JSON (base64 string). 2
|
|
140
|
+
credits per call.
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
body (PostVerifyLabelsFilesBody | Unset):
|
|
144
|
+
body (PostVerifyLabelsJsonBody | Unset):
|
|
145
|
+
|
|
146
|
+
Raises:
|
|
147
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
148
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
Response[PostVerifyLabelsResponse200 | PostVerifyLabelsResponse400]
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
kwargs = _get_kwargs(
|
|
155
|
+
body=body,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
159
|
+
|
|
160
|
+
return _build_response(client=client, response=response)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
async def asyncio(
|
|
164
|
+
*,
|
|
165
|
+
client: AuthenticatedClient | Client,
|
|
166
|
+
body: PostVerifyLabelsFilesBody | PostVerifyLabelsJsonBody | Unset = UNSET,
|
|
167
|
+
) -> PostVerifyLabelsResponse200 | PostVerifyLabelsResponse400 | None:
|
|
168
|
+
"""Detect image labels
|
|
169
|
+
|
|
170
|
+
Detect objects and scenes in an image. Accepts multipart (image file) or JSON (base64 string). 2
|
|
171
|
+
credits per call.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
body (PostVerifyLabelsFilesBody | Unset):
|
|
175
|
+
body (PostVerifyLabelsJsonBody | Unset):
|
|
176
|
+
|
|
177
|
+
Raises:
|
|
178
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
179
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
180
|
+
|
|
181
|
+
Returns:
|
|
182
|
+
PostVerifyLabelsResponse200 | PostVerifyLabelsResponse400
|
|
183
|
+
"""
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
await asyncio_detailed(
|
|
187
|
+
client=client,
|
|
188
|
+
body=body,
|
|
189
|
+
)
|
|
190
|
+
).parsed
|