mixpeek 0.6.1__py3-none-any.whl → 0.6.2__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.
- mixpeek/__init__.py +18 -13
- mixpeek/base_client.py +39 -12
- mixpeek/core/client_wrapper.py +1 -1
- mixpeek/embed/__init__.py +2 -0
- mixpeek/embed/client.py +350 -0
- mixpeek/environment.py +7 -0
- mixpeek/extract/__init__.py +2 -0
- mixpeek/extract/client.py +347 -0
- mixpeek/generators/client.py +2 -4
- mixpeek/parse/client.py +10 -248
- mixpeek/pipelines/client.py +45 -123
- mixpeek/storage/client.py +0 -4
- mixpeek/types/__init__.py +12 -12
- mixpeek/types/{configs_request.py → api_key.py} +4 -4
- mixpeek/types/connection.py +1 -1
- mixpeek/types/{destination_schema.py → destination.py} +3 -3
- mixpeek/types/field_type.py +1 -1
- mixpeek/types/model.py +2 -1
- mixpeek/types/models.py +5 -0
- mixpeek/types/{field_schema.py → source.py} +3 -4
- mixpeek/types/{source_schema.py → source_destination_mapping.py} +6 -5
- mixpeek/types/{pipeline_response.py → user.py} +7 -10
- mixpeek/users/__init__.py +2 -0
- mixpeek/users/client.py +308 -0
- mixpeek/workflows/client.py +122 -4
- {mixpeek-0.6.1.dist-info → mixpeek-0.6.2.dist-info}/METADATA +1 -1
- {mixpeek-0.6.1.dist-info → mixpeek-0.6.2.dist-info}/RECORD +29 -22
- mixpeek/types/embedding_request.py +0 -32
- {mixpeek-0.6.1.dist-info → mixpeek-0.6.2.dist-info}/LICENSE +0 -0
- {mixpeek-0.6.1.dist-info → mixpeek-0.6.2.dist-info}/WHEEL +0 -0
mixpeek/types/__init__.py
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
|
+
from .api_key import ApiKey
|
3
4
|
from .audio_params import AudioParams
|
4
|
-
from .configs_request import ConfigsRequest
|
5
5
|
from .configs_response import ConfigsResponse
|
6
6
|
from .connection import Connection
|
7
7
|
from .connection_engine import ConnectionEngine
|
8
8
|
from .csv_params import CsvParams
|
9
|
-
from .
|
10
|
-
from .embedding_request import EmbeddingRequest
|
9
|
+
from .destination import Destination
|
11
10
|
from .embedding_response import EmbeddingResponse
|
12
11
|
from .error_message import ErrorMessage
|
13
12
|
from .error_response import ErrorResponse
|
14
|
-
from .field_schema import FieldSchema
|
15
13
|
from .field_type import FieldType
|
16
14
|
from .generation_response import GenerationResponse
|
17
15
|
from .html_params import HtmlParams
|
@@ -21,13 +19,15 @@ from .message import Message
|
|
21
19
|
from .metadata import Metadata
|
22
20
|
from .modality import Modality
|
23
21
|
from .model import Model
|
22
|
+
from .models import Models
|
24
23
|
from .pdf_params import PdfParams
|
25
|
-
from .pipeline_response import PipelineResponse
|
26
24
|
from .ppt_params import PptParams
|
27
25
|
from .pptx_params import PptxParams
|
28
26
|
from .settings import Settings
|
29
|
-
from .
|
27
|
+
from .source import Source
|
28
|
+
from .source_destination_mapping import SourceDestinationMapping
|
30
29
|
from .txt_params import TxtParams
|
30
|
+
from .user import User
|
31
31
|
from .validation_error import ValidationError
|
32
32
|
from .validation_error_loc_item import ValidationErrorLocItem
|
33
33
|
from .video_params import VideoParams
|
@@ -36,18 +36,16 @@ from .workflow_settings import WorkflowSettings
|
|
36
36
|
from .xlsx_params import XlsxParams
|
37
37
|
|
38
38
|
__all__ = [
|
39
|
+
"ApiKey",
|
39
40
|
"AudioParams",
|
40
|
-
"ConfigsRequest",
|
41
41
|
"ConfigsResponse",
|
42
42
|
"Connection",
|
43
43
|
"ConnectionEngine",
|
44
44
|
"CsvParams",
|
45
|
-
"
|
46
|
-
"EmbeddingRequest",
|
45
|
+
"Destination",
|
47
46
|
"EmbeddingResponse",
|
48
47
|
"ErrorMessage",
|
49
48
|
"ErrorResponse",
|
50
|
-
"FieldSchema",
|
51
49
|
"FieldType",
|
52
50
|
"GenerationResponse",
|
53
51
|
"HtmlParams",
|
@@ -57,13 +55,15 @@ __all__ = [
|
|
57
55
|
"Metadata",
|
58
56
|
"Modality",
|
59
57
|
"Model",
|
58
|
+
"Models",
|
60
59
|
"PdfParams",
|
61
|
-
"PipelineResponse",
|
62
60
|
"PptParams",
|
63
61
|
"PptxParams",
|
64
62
|
"Settings",
|
65
|
-
"
|
63
|
+
"Source",
|
64
|
+
"SourceDestinationMapping",
|
66
65
|
"TxtParams",
|
66
|
+
"User",
|
67
67
|
"ValidationError",
|
68
68
|
"ValidationErrorLocItem",
|
69
69
|
"VideoParams",
|
@@ -4,7 +4,6 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
-
from .modality import Modality
|
8
7
|
|
9
8
|
try:
|
10
9
|
import pydantic.v1 as pydantic # type: ignore
|
@@ -12,9 +11,10 @@ except ImportError:
|
|
12
11
|
import pydantic # type: ignore
|
13
12
|
|
14
13
|
|
15
|
-
class
|
16
|
-
|
17
|
-
|
14
|
+
class ApiKey(pydantic.BaseModel):
|
15
|
+
key: typing.Optional[str] = None
|
16
|
+
name: typing.Optional[str] = None
|
17
|
+
created_at: typing.Optional[dt.datetime] = None
|
18
18
|
|
19
19
|
def json(self, **kwargs: typing.Any) -> str:
|
20
20
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
mixpeek/types/connection.py
CHANGED
@@ -18,7 +18,7 @@ class Connection(pydantic.BaseModel):
|
|
18
18
|
port: typing.Optional[int] = None
|
19
19
|
database: str
|
20
20
|
username: str
|
21
|
-
password:
|
21
|
+
password: str
|
22
22
|
extra_params: typing.Optional[typing.Dict[str, typing.Any]] = None
|
23
23
|
|
24
24
|
def json(self, **kwargs: typing.Any) -> str:
|
@@ -11,10 +11,10 @@ except ImportError:
|
|
11
11
|
import pydantic # type: ignore
|
12
12
|
|
13
13
|
|
14
|
-
class
|
14
|
+
class Destination(pydantic.BaseModel):
|
15
15
|
collection: str
|
16
|
-
|
17
|
-
|
16
|
+
field: str
|
17
|
+
embedding: str
|
18
18
|
|
19
19
|
def json(self, **kwargs: typing.Any) -> str:
|
20
20
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
mixpeek/types/field_type.py
CHANGED
mixpeek/types/model.py
CHANGED
@@ -4,6 +4,7 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from .models import Models
|
7
8
|
|
8
9
|
try:
|
9
10
|
import pydantic.v1 as pydantic # type: ignore
|
@@ -13,7 +14,7 @@ except ImportError:
|
|
13
14
|
|
14
15
|
class Model(pydantic.BaseModel):
|
15
16
|
provider: str
|
16
|
-
model:
|
17
|
+
model: Models
|
17
18
|
|
18
19
|
def json(self, **kwargs: typing.Any) -> str:
|
19
20
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
mixpeek/types/models.py
ADDED
@@ -12,11 +12,10 @@ except ImportError:
|
|
12
12
|
import pydantic # type: ignore
|
13
13
|
|
14
14
|
|
15
|
-
class
|
16
|
-
|
15
|
+
class Source(pydantic.BaseModel):
|
16
|
+
field: str
|
17
17
|
type: FieldType
|
18
|
-
|
19
|
-
settings: typing.Optional[typing.Dict[str, typing.Any]] = None
|
18
|
+
settings: typing.Dict[str, typing.Any]
|
20
19
|
|
21
20
|
def json(self, **kwargs: typing.Any) -> str:
|
22
21
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
@@ -4,7 +4,8 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
-
from .
|
7
|
+
from .destination import Destination
|
8
|
+
from .source import Source
|
8
9
|
|
9
10
|
try:
|
10
11
|
import pydantic.v1 as pydantic # type: ignore
|
@@ -12,10 +13,10 @@ except ImportError:
|
|
12
13
|
import pydantic # type: ignore
|
13
14
|
|
14
15
|
|
15
|
-
class
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
class SourceDestinationMapping(pydantic.BaseModel):
|
17
|
+
embedding_model: str
|
18
|
+
source: Source
|
19
|
+
destination: Destination
|
19
20
|
|
20
21
|
def json(self, **kwargs: typing.Any) -> str:
|
21
22
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
@@ -4,9 +4,8 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from .api_key import ApiKey
|
7
8
|
from .connection import Connection
|
8
|
-
from .destination_schema import DestinationSchema
|
9
|
-
from .source_schema import SourceSchema
|
10
9
|
|
11
10
|
try:
|
12
11
|
import pydantic.v1 as pydantic # type: ignore
|
@@ -14,15 +13,13 @@ except ImportError:
|
|
14
13
|
import pydantic # type: ignore
|
15
14
|
|
16
15
|
|
17
|
-
class
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
connection: Connection
|
23
|
-
source: SourceSchema
|
24
|
-
destination: DestinationSchema
|
16
|
+
class User(pydantic.BaseModel):
|
17
|
+
user_id: typing.Optional[str] = None
|
18
|
+
email: str
|
19
|
+
api_keys: typing.Optional[typing.List[ApiKey]] = None
|
20
|
+
index_ids: typing.Optional[typing.List[str]] = None
|
25
21
|
metadata: typing.Optional[typing.Dict[str, typing.Any]] = None
|
22
|
+
connections: typing.Optional[typing.List[Connection]] = None
|
26
23
|
|
27
24
|
def json(self, **kwargs: typing.Any) -> str:
|
28
25
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
mixpeek/users/client.py
ADDED
@@ -0,0 +1,308 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
import urllib.parse
|
5
|
+
from json.decoder import JSONDecodeError
|
6
|
+
|
7
|
+
from ..core.api_error import ApiError
|
8
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
10
|
+
from ..core.remove_none_from_dict import remove_none_from_dict
|
11
|
+
from ..core.request_options import RequestOptions
|
12
|
+
from ..errors.bad_request_error import BadRequestError
|
13
|
+
from ..errors.forbidden_error import ForbiddenError
|
14
|
+
from ..errors.internal_server_error import InternalServerError
|
15
|
+
from ..errors.not_found_error import NotFoundError
|
16
|
+
from ..errors.unauthorized_error import UnauthorizedError
|
17
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
18
|
+
from ..types.api_key import ApiKey
|
19
|
+
from ..types.connection import Connection
|
20
|
+
from ..types.error_response import ErrorResponse
|
21
|
+
from ..types.http_validation_error import HttpValidationError
|
22
|
+
from ..types.user import User
|
23
|
+
|
24
|
+
try:
|
25
|
+
import pydantic.v1 as pydantic # type: ignore
|
26
|
+
except ImportError:
|
27
|
+
import pydantic # type: ignore
|
28
|
+
|
29
|
+
# this is used as the default value for optional parameters
|
30
|
+
OMIT = typing.cast(typing.Any, ...)
|
31
|
+
|
32
|
+
|
33
|
+
class UsersClient:
|
34
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
35
|
+
self._client_wrapper = client_wrapper
|
36
|
+
|
37
|
+
def get_user_users_get(self, *, request_options: typing.Optional[RequestOptions] = None) -> User:
|
38
|
+
"""
|
39
|
+
Parameters:
|
40
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
41
|
+
---
|
42
|
+
from mixpeek.client import Mixpeek
|
43
|
+
|
44
|
+
client = Mixpeek(
|
45
|
+
authorization="YOUR_AUTHORIZATION",
|
46
|
+
index_id="YOUR_INDEX_ID",
|
47
|
+
api_key="YOUR_API_KEY",
|
48
|
+
)
|
49
|
+
client.users.get_user_users_get()
|
50
|
+
"""
|
51
|
+
_response = self._client_wrapper.httpx_client.request(
|
52
|
+
"GET",
|
53
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "users"),
|
54
|
+
params=jsonable_encoder(
|
55
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
56
|
+
),
|
57
|
+
headers=jsonable_encoder(
|
58
|
+
remove_none_from_dict(
|
59
|
+
{
|
60
|
+
**self._client_wrapper.get_headers(),
|
61
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
62
|
+
}
|
63
|
+
)
|
64
|
+
),
|
65
|
+
timeout=request_options.get("timeout_in_seconds")
|
66
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
67
|
+
else self._client_wrapper.get_timeout(),
|
68
|
+
retries=0,
|
69
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
70
|
+
)
|
71
|
+
if 200 <= _response.status_code < 300:
|
72
|
+
return pydantic.parse_obj_as(User, _response.json()) # type: ignore
|
73
|
+
if _response.status_code == 400:
|
74
|
+
raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
75
|
+
if _response.status_code == 401:
|
76
|
+
raise UnauthorizedError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
77
|
+
if _response.status_code == 403:
|
78
|
+
raise ForbiddenError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
79
|
+
if _response.status_code == 404:
|
80
|
+
raise NotFoundError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
81
|
+
if _response.status_code == 422:
|
82
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
83
|
+
if _response.status_code == 500:
|
84
|
+
raise InternalServerError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
85
|
+
try:
|
86
|
+
_response_json = _response.json()
|
87
|
+
except JSONDecodeError:
|
88
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
89
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
90
|
+
|
91
|
+
def update_user_users_put(
|
92
|
+
self,
|
93
|
+
*,
|
94
|
+
api_keys: typing.Optional[typing.Sequence[ApiKey]] = OMIT,
|
95
|
+
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
96
|
+
connections: typing.Optional[typing.Sequence[Connection]] = OMIT,
|
97
|
+
request_options: typing.Optional[RequestOptions] = None,
|
98
|
+
) -> User:
|
99
|
+
"""
|
100
|
+
Parameters:
|
101
|
+
- api_keys: typing.Optional[typing.Sequence[ApiKey]].
|
102
|
+
|
103
|
+
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
|
104
|
+
|
105
|
+
- connections: typing.Optional[typing.Sequence[Connection]].
|
106
|
+
|
107
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
108
|
+
---
|
109
|
+
from mixpeek.client import Mixpeek
|
110
|
+
|
111
|
+
client = Mixpeek(
|
112
|
+
authorization="YOUR_AUTHORIZATION",
|
113
|
+
index_id="YOUR_INDEX_ID",
|
114
|
+
api_key="YOUR_API_KEY",
|
115
|
+
)
|
116
|
+
client.users.update_user_users_put()
|
117
|
+
"""
|
118
|
+
_request: typing.Dict[str, typing.Any] = {}
|
119
|
+
if api_keys is not OMIT:
|
120
|
+
_request["api_keys"] = api_keys
|
121
|
+
if metadata is not OMIT:
|
122
|
+
_request["metadata"] = metadata
|
123
|
+
if connections is not OMIT:
|
124
|
+
_request["connections"] = connections
|
125
|
+
_response = self._client_wrapper.httpx_client.request(
|
126
|
+
"PUT",
|
127
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "users"),
|
128
|
+
params=jsonable_encoder(
|
129
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
130
|
+
),
|
131
|
+
json=jsonable_encoder(_request)
|
132
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
133
|
+
else {
|
134
|
+
**jsonable_encoder(_request),
|
135
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
136
|
+
},
|
137
|
+
headers=jsonable_encoder(
|
138
|
+
remove_none_from_dict(
|
139
|
+
{
|
140
|
+
**self._client_wrapper.get_headers(),
|
141
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
142
|
+
}
|
143
|
+
)
|
144
|
+
),
|
145
|
+
timeout=request_options.get("timeout_in_seconds")
|
146
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
147
|
+
else self._client_wrapper.get_timeout(),
|
148
|
+
retries=0,
|
149
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
150
|
+
)
|
151
|
+
if 200 <= _response.status_code < 300:
|
152
|
+
return pydantic.parse_obj_as(User, _response.json()) # type: ignore
|
153
|
+
if _response.status_code == 400:
|
154
|
+
raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
155
|
+
if _response.status_code == 401:
|
156
|
+
raise UnauthorizedError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
157
|
+
if _response.status_code == 403:
|
158
|
+
raise ForbiddenError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
159
|
+
if _response.status_code == 404:
|
160
|
+
raise NotFoundError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
161
|
+
if _response.status_code == 422:
|
162
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
163
|
+
if _response.status_code == 500:
|
164
|
+
raise InternalServerError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
165
|
+
try:
|
166
|
+
_response_json = _response.json()
|
167
|
+
except JSONDecodeError:
|
168
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
169
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
170
|
+
|
171
|
+
|
172
|
+
class AsyncUsersClient:
|
173
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
174
|
+
self._client_wrapper = client_wrapper
|
175
|
+
|
176
|
+
async def get_user_users_get(self, *, request_options: typing.Optional[RequestOptions] = None) -> User:
|
177
|
+
"""
|
178
|
+
Parameters:
|
179
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
180
|
+
---
|
181
|
+
from mixpeek.client import AsyncMixpeek
|
182
|
+
|
183
|
+
client = AsyncMixpeek(
|
184
|
+
authorization="YOUR_AUTHORIZATION",
|
185
|
+
index_id="YOUR_INDEX_ID",
|
186
|
+
api_key="YOUR_API_KEY",
|
187
|
+
)
|
188
|
+
await client.users.get_user_users_get()
|
189
|
+
"""
|
190
|
+
_response = await self._client_wrapper.httpx_client.request(
|
191
|
+
"GET",
|
192
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "users"),
|
193
|
+
params=jsonable_encoder(
|
194
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
195
|
+
),
|
196
|
+
headers=jsonable_encoder(
|
197
|
+
remove_none_from_dict(
|
198
|
+
{
|
199
|
+
**self._client_wrapper.get_headers(),
|
200
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
201
|
+
}
|
202
|
+
)
|
203
|
+
),
|
204
|
+
timeout=request_options.get("timeout_in_seconds")
|
205
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
206
|
+
else self._client_wrapper.get_timeout(),
|
207
|
+
retries=0,
|
208
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
209
|
+
)
|
210
|
+
if 200 <= _response.status_code < 300:
|
211
|
+
return pydantic.parse_obj_as(User, _response.json()) # type: ignore
|
212
|
+
if _response.status_code == 400:
|
213
|
+
raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
214
|
+
if _response.status_code == 401:
|
215
|
+
raise UnauthorizedError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
216
|
+
if _response.status_code == 403:
|
217
|
+
raise ForbiddenError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
218
|
+
if _response.status_code == 404:
|
219
|
+
raise NotFoundError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
220
|
+
if _response.status_code == 422:
|
221
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
222
|
+
if _response.status_code == 500:
|
223
|
+
raise InternalServerError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
224
|
+
try:
|
225
|
+
_response_json = _response.json()
|
226
|
+
except JSONDecodeError:
|
227
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
228
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
229
|
+
|
230
|
+
async def update_user_users_put(
|
231
|
+
self,
|
232
|
+
*,
|
233
|
+
api_keys: typing.Optional[typing.Sequence[ApiKey]] = OMIT,
|
234
|
+
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
235
|
+
connections: typing.Optional[typing.Sequence[Connection]] = OMIT,
|
236
|
+
request_options: typing.Optional[RequestOptions] = None,
|
237
|
+
) -> User:
|
238
|
+
"""
|
239
|
+
Parameters:
|
240
|
+
- api_keys: typing.Optional[typing.Sequence[ApiKey]].
|
241
|
+
|
242
|
+
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
|
243
|
+
|
244
|
+
- connections: typing.Optional[typing.Sequence[Connection]].
|
245
|
+
|
246
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
247
|
+
---
|
248
|
+
from mixpeek.client import AsyncMixpeek
|
249
|
+
|
250
|
+
client = AsyncMixpeek(
|
251
|
+
authorization="YOUR_AUTHORIZATION",
|
252
|
+
index_id="YOUR_INDEX_ID",
|
253
|
+
api_key="YOUR_API_KEY",
|
254
|
+
)
|
255
|
+
await client.users.update_user_users_put()
|
256
|
+
"""
|
257
|
+
_request: typing.Dict[str, typing.Any] = {}
|
258
|
+
if api_keys is not OMIT:
|
259
|
+
_request["api_keys"] = api_keys
|
260
|
+
if metadata is not OMIT:
|
261
|
+
_request["metadata"] = metadata
|
262
|
+
if connections is not OMIT:
|
263
|
+
_request["connections"] = connections
|
264
|
+
_response = await self._client_wrapper.httpx_client.request(
|
265
|
+
"PUT",
|
266
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "users"),
|
267
|
+
params=jsonable_encoder(
|
268
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
269
|
+
),
|
270
|
+
json=jsonable_encoder(_request)
|
271
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
272
|
+
else {
|
273
|
+
**jsonable_encoder(_request),
|
274
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
275
|
+
},
|
276
|
+
headers=jsonable_encoder(
|
277
|
+
remove_none_from_dict(
|
278
|
+
{
|
279
|
+
**self._client_wrapper.get_headers(),
|
280
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
281
|
+
}
|
282
|
+
)
|
283
|
+
),
|
284
|
+
timeout=request_options.get("timeout_in_seconds")
|
285
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
286
|
+
else self._client_wrapper.get_timeout(),
|
287
|
+
retries=0,
|
288
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
289
|
+
)
|
290
|
+
if 200 <= _response.status_code < 300:
|
291
|
+
return pydantic.parse_obj_as(User, _response.json()) # type: ignore
|
292
|
+
if _response.status_code == 400:
|
293
|
+
raise BadRequestError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
294
|
+
if _response.status_code == 401:
|
295
|
+
raise UnauthorizedError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
296
|
+
if _response.status_code == 403:
|
297
|
+
raise ForbiddenError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
298
|
+
if _response.status_code == 404:
|
299
|
+
raise NotFoundError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
300
|
+
if _response.status_code == 422:
|
301
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
302
|
+
if _response.status_code == 500:
|
303
|
+
raise InternalServerError(pydantic.parse_obj_as(ErrorResponse, _response.json())) # type: ignore
|
304
|
+
try:
|
305
|
+
_response_json = _response.json()
|
306
|
+
except JSONDecodeError:
|
307
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
308
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|