minikai 0.1.1__py3-none-any.whl → 0.1.3__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.
Potentially problematic release.
This version of minikai might be problematic. Click here for more details.
- minikai/__init__.py +1 -1
- minikai/api/__init__.py +1 -1
- minikai/api/groups/__init__.py +1 -1
- minikai/api/groups/add_minis_to_group.py +53 -33
- minikai/api/groups/add_users_to_group.py +53 -33
- minikai/api/groups/create_group.py +45 -27
- minikai/api/groups/delete_group.py +29 -9
- minikai/api/groups/get_group.py +47 -28
- minikai/api/groups/get_group_minis.py +52 -33
- minikai/api/groups/get_group_users.py +52 -33
- minikai/api/groups/get_groups.py +56 -34
- minikai/api/groups/remove_minis_from_group.py +53 -33
- minikai/api/groups/remove_users_from_group.py +53 -33
- minikai/api/groups/update_group.py +51 -33
- minikai/api/minis/__init__.py +1 -1
- minikai/api/minis/create_mini.py +45 -27
- minikai/api/minis/delete_mini.py +29 -9
- minikai/api/minis/get_external_mini.py +52 -33
- minikai/api/minis/get_minis.py +56 -34
- minikai/api/minis/patch_mini.py +51 -33
- minikai/api/minis/update_mini.py +51 -33
- minikai/api/records/__init__.py +1 -1
- minikai/api/records/add_attachments.py +59 -38
- minikai/api/records/add_relations.py +65 -43
- minikai/api/records/create_record.py +48 -28
- minikai/api/records/delete_record.py +29 -9
- minikai/api/records/download_attachment.py +119 -0
- minikai/api/records/get_records_by_external.py +68 -45
- minikai/api/records/remove_attachments.py +33 -11
- minikai/api/records/remove_relations.py +33 -11
- minikai/api/records/update_attachments.py +59 -38
- minikai/api/records/update_record.py +53 -33
- minikai/api/records/update_relations.py +65 -43
- minikai/api/users/__init__.py +1 -1
- minikai/api/users/delete_api_users_minis.py +31 -11
- minikai/api/users/get_api_users_minis.py +52 -33
- minikai/api/users/get_users.py +56 -34
- minikai/api/users/post_api_users_minis.py +52 -33
- minikai/client.py +6 -3
- minikai/errors.py +1 -3
- minikai/models/__init__.py +7 -3
- minikai/models/add_attachments_body.py +45 -13
- minikai/models/create_group_command.py +35 -10
- minikai/models/create_mini_command.py +34 -10
- minikai/models/create_record_command.py +87 -41
- minikai/models/create_record_command_tags.py +22 -3
- minikai/models/cursor_paginated_list_of_record_dto.py +122 -0
- minikai/models/document_file_dto.py +37 -13
- minikai/models/document_file_metadata_dto.py +27 -7
- minikai/models/form_field.py +38 -12
- minikai/models/form_field_dto.py +48 -16
- minikai/models/form_field_type.py +2 -8
- minikai/models/group_dto.py +50 -19
- minikai/models/http_validation_problem_details.py +41 -16
- minikai/models/http_validation_problem_details_errors.py +26 -3
- minikai/models/json_node.py +49 -24
- minikai/models/json_node_options.py +26 -7
- minikai/models/mini_dto.py +62 -27
- minikai/models/mini_template_dto.py +50 -18
- minikai/models/paginated_list_of_record_dto.py +39 -16
- minikai/models/patch_mini_command.py +30 -8
- minikai/models/problem_details.py +34 -11
- minikai/models/record.py +143 -61
- minikai/models/record_attachment.py +56 -27
- minikai/models/record_attachment_dto.py +56 -27
- minikai/models/record_attachment_dto_metadata_type_0.py +22 -3
- minikai/models/record_attachment_metadata_type_0.py +22 -3
- minikai/models/record_authorization.py +41 -9
- minikai/models/record_authorization_dto.py +41 -9
- minikai/models/record_dto.py +113 -54
- minikai/models/record_dto_tags.py +22 -3
- minikai/models/record_relation.py +35 -11
- minikai/models/record_relation_dto.py +35 -11
- minikai/models/record_tag.py +159 -0
- minikai/models/record_tag_dto.py +68 -0
- minikai/models/slim_mini_dto.py +51 -22
- minikai/models/tool_dto.py +29 -10
- minikai/models/update_attachments_body.py +45 -13
- minikai/models/update_group_command.py +37 -11
- minikai/models/update_mini_command.py +35 -11
- minikai/models/update_mini_template_workspaces_command.py +30 -7
- minikai/models/update_record_command.py +87 -42
- minikai/models/update_record_command_tags.py +22 -3
- minikai/models/user_dto.py +50 -17
- minikai/models/user_to_mini_dto.py +30 -9
- minikai/models/workspace_dto.py +30 -9
- minikai/types.py +5 -6
- {minikai-0.1.1.dist-info → minikai-0.1.3.dist-info}/METADATA +1 -1
- minikai-0.1.3.dist-info/RECORD +91 -0
- minikai/models/record_tags.py +0 -44
- minikai-0.1.1.dist-info/RECORD +0 -88
- {minikai-0.1.1.dist-info → minikai-0.1.3.dist-info}/WHEEL +0 -0
|
@@ -1,25 +1,36 @@
|
|
|
1
1
|
from http import HTTPStatus
|
|
2
|
-
from typing import Any, Optional, Union
|
|
2
|
+
from typing import Any, Optional, Union, cast
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
|
|
6
|
-
from ... import errors
|
|
7
6
|
from ...client import AuthenticatedClient, Client
|
|
8
|
-
from ...types import Response
|
|
7
|
+
from ...types import Response, UNSET
|
|
8
|
+
from ... import errors
|
|
9
|
+
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
def _get_kwargs(
|
|
12
14
|
user_id: str,
|
|
13
15
|
mini_id: int,
|
|
16
|
+
|
|
14
17
|
) -> dict[str, Any]:
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
15
24
|
_kwargs: dict[str, Any] = {
|
|
16
25
|
"method": "delete",
|
|
17
|
-
"url":
|
|
26
|
+
"url": "/api/Users/{user_id}/minis/{mini_id}".format(user_id=user_id,mini_id=mini_id,),
|
|
18
27
|
}
|
|
19
28
|
|
|
29
|
+
|
|
20
30
|
return _kwargs
|
|
21
31
|
|
|
22
32
|
|
|
33
|
+
|
|
23
34
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
|
24
35
|
if response.status_code == 204:
|
|
25
36
|
return None
|
|
@@ -47,8 +58,9 @@ def sync_detailed(
|
|
|
47
58
|
mini_id: int,
|
|
48
59
|
*,
|
|
49
60
|
client: Union[AuthenticatedClient, Client],
|
|
61
|
+
|
|
50
62
|
) -> Response[Any]:
|
|
51
|
-
"""
|
|
63
|
+
"""
|
|
52
64
|
Args:
|
|
53
65
|
user_id (str):
|
|
54
66
|
mini_id (int):
|
|
@@ -59,11 +71,13 @@ def sync_detailed(
|
|
|
59
71
|
|
|
60
72
|
Returns:
|
|
61
73
|
Response[Any]
|
|
62
|
-
|
|
74
|
+
"""
|
|
75
|
+
|
|
63
76
|
|
|
64
77
|
kwargs = _get_kwargs(
|
|
65
78
|
user_id=user_id,
|
|
66
|
-
|
|
79
|
+
mini_id=mini_id,
|
|
80
|
+
|
|
67
81
|
)
|
|
68
82
|
|
|
69
83
|
response = client.get_httpx_client().request(
|
|
@@ -78,8 +92,9 @@ async def asyncio_detailed(
|
|
|
78
92
|
mini_id: int,
|
|
79
93
|
*,
|
|
80
94
|
client: Union[AuthenticatedClient, Client],
|
|
95
|
+
|
|
81
96
|
) -> Response[Any]:
|
|
82
|
-
"""
|
|
97
|
+
"""
|
|
83
98
|
Args:
|
|
84
99
|
user_id (str):
|
|
85
100
|
mini_id (int):
|
|
@@ -90,13 +105,18 @@ async def asyncio_detailed(
|
|
|
90
105
|
|
|
91
106
|
Returns:
|
|
92
107
|
Response[Any]
|
|
93
|
-
|
|
108
|
+
"""
|
|
109
|
+
|
|
94
110
|
|
|
95
111
|
kwargs = _get_kwargs(
|
|
96
112
|
user_id=user_id,
|
|
97
|
-
|
|
113
|
+
mini_id=mini_id,
|
|
114
|
+
|
|
98
115
|
)
|
|
99
116
|
|
|
100
|
-
response = await client.get_async_httpx_client().request(
|
|
117
|
+
response = await client.get_async_httpx_client().request(
|
|
118
|
+
**kwargs
|
|
119
|
+
)
|
|
101
120
|
|
|
102
121
|
return _build_response(client=client, response=response)
|
|
122
|
+
|
|
@@ -3,32 +3,44 @@ from typing import Any, Optional, Union, cast
|
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
|
|
6
|
-
from ... import errors
|
|
7
6
|
from ...client import AuthenticatedClient, Client
|
|
7
|
+
from ...types import Response, UNSET
|
|
8
|
+
from ... import errors
|
|
9
|
+
|
|
8
10
|
from ...models.user_to_mini_dto import UserToMiniDto
|
|
9
|
-
from
|
|
11
|
+
from typing import cast
|
|
12
|
+
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
def _get_kwargs(
|
|
13
16
|
user_id: str,
|
|
17
|
+
|
|
14
18
|
) -> dict[str, Any]:
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
15
25
|
_kwargs: dict[str, Any] = {
|
|
16
26
|
"method": "get",
|
|
17
|
-
"url":
|
|
27
|
+
"url": "/api/Users/{user_id}/minis".format(user_id=user_id,),
|
|
18
28
|
}
|
|
19
29
|
|
|
30
|
+
|
|
20
31
|
return _kwargs
|
|
21
32
|
|
|
22
33
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
) -> Optional[Union[Any, list["UserToMiniDto"]]]:
|
|
34
|
+
|
|
35
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, list['UserToMiniDto']]]:
|
|
26
36
|
if response.status_code == 200:
|
|
27
37
|
response_200 = []
|
|
28
38
|
_response_200 = response.json()
|
|
29
|
-
for response_200_item_data in _response_200:
|
|
39
|
+
for response_200_item_data in (_response_200):
|
|
30
40
|
response_200_item = UserToMiniDto.from_dict(response_200_item_data)
|
|
31
41
|
|
|
42
|
+
|
|
43
|
+
|
|
32
44
|
response_200.append(response_200_item)
|
|
33
45
|
|
|
34
46
|
return response_200
|
|
@@ -43,9 +55,7 @@ def _parse_response(
|
|
|
43
55
|
return None
|
|
44
56
|
|
|
45
57
|
|
|
46
|
-
def _build_response(
|
|
47
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
48
|
-
) -> Response[Union[Any, list["UserToMiniDto"]]]:
|
|
58
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, list['UserToMiniDto']]]:
|
|
49
59
|
return Response(
|
|
50
60
|
status_code=HTTPStatus(response.status_code),
|
|
51
61
|
content=response.content,
|
|
@@ -58,8 +68,9 @@ def sync_detailed(
|
|
|
58
68
|
user_id: str,
|
|
59
69
|
*,
|
|
60
70
|
client: Union[AuthenticatedClient, Client],
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
|
|
72
|
+
) -> Response[Union[Any, list['UserToMiniDto']]]:
|
|
73
|
+
"""
|
|
63
74
|
Args:
|
|
64
75
|
user_id (str):
|
|
65
76
|
|
|
@@ -69,10 +80,12 @@ def sync_detailed(
|
|
|
69
80
|
|
|
70
81
|
Returns:
|
|
71
82
|
Response[Union[Any, list['UserToMiniDto']]]
|
|
72
|
-
|
|
83
|
+
"""
|
|
84
|
+
|
|
73
85
|
|
|
74
86
|
kwargs = _get_kwargs(
|
|
75
87
|
user_id=user_id,
|
|
88
|
+
|
|
76
89
|
)
|
|
77
90
|
|
|
78
91
|
response = client.get_httpx_client().request(
|
|
@@ -81,13 +94,13 @@ def sync_detailed(
|
|
|
81
94
|
|
|
82
95
|
return _build_response(client=client, response=response)
|
|
83
96
|
|
|
84
|
-
|
|
85
97
|
def sync(
|
|
86
98
|
user_id: str,
|
|
87
99
|
*,
|
|
88
100
|
client: Union[AuthenticatedClient, Client],
|
|
89
|
-
|
|
90
|
-
|
|
101
|
+
|
|
102
|
+
) -> Optional[Union[Any, list['UserToMiniDto']]]:
|
|
103
|
+
"""
|
|
91
104
|
Args:
|
|
92
105
|
user_id (str):
|
|
93
106
|
|
|
@@ -97,20 +110,22 @@ def sync(
|
|
|
97
110
|
|
|
98
111
|
Returns:
|
|
99
112
|
Union[Any, list['UserToMiniDto']]
|
|
100
|
-
|
|
113
|
+
"""
|
|
114
|
+
|
|
101
115
|
|
|
102
116
|
return sync_detailed(
|
|
103
117
|
user_id=user_id,
|
|
104
|
-
|
|
105
|
-
).parsed
|
|
118
|
+
client=client,
|
|
106
119
|
|
|
120
|
+
).parsed
|
|
107
121
|
|
|
108
122
|
async def asyncio_detailed(
|
|
109
123
|
user_id: str,
|
|
110
124
|
*,
|
|
111
125
|
client: Union[AuthenticatedClient, Client],
|
|
112
|
-
|
|
113
|
-
|
|
126
|
+
|
|
127
|
+
) -> Response[Union[Any, list['UserToMiniDto']]]:
|
|
128
|
+
"""
|
|
114
129
|
Args:
|
|
115
130
|
user_id (str):
|
|
116
131
|
|
|
@@ -120,23 +135,27 @@ async def asyncio_detailed(
|
|
|
120
135
|
|
|
121
136
|
Returns:
|
|
122
137
|
Response[Union[Any, list['UserToMiniDto']]]
|
|
123
|
-
|
|
138
|
+
"""
|
|
139
|
+
|
|
124
140
|
|
|
125
141
|
kwargs = _get_kwargs(
|
|
126
142
|
user_id=user_id,
|
|
143
|
+
|
|
127
144
|
)
|
|
128
145
|
|
|
129
|
-
response = await client.get_async_httpx_client().request(
|
|
146
|
+
response = await client.get_async_httpx_client().request(
|
|
147
|
+
**kwargs
|
|
148
|
+
)
|
|
130
149
|
|
|
131
150
|
return _build_response(client=client, response=response)
|
|
132
151
|
|
|
133
|
-
|
|
134
152
|
async def asyncio(
|
|
135
153
|
user_id: str,
|
|
136
154
|
*,
|
|
137
155
|
client: Union[AuthenticatedClient, Client],
|
|
138
|
-
|
|
139
|
-
|
|
156
|
+
|
|
157
|
+
) -> Optional[Union[Any, list['UserToMiniDto']]]:
|
|
158
|
+
"""
|
|
140
159
|
Args:
|
|
141
160
|
user_id (str):
|
|
142
161
|
|
|
@@ -146,11 +165,11 @@ async def asyncio(
|
|
|
146
165
|
|
|
147
166
|
Returns:
|
|
148
167
|
Union[Any, list['UserToMiniDto']]
|
|
149
|
-
|
|
168
|
+
"""
|
|
150
169
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
).parsed
|
|
170
|
+
|
|
171
|
+
return (await asyncio_detailed(
|
|
172
|
+
user_id=user_id,
|
|
173
|
+
client=client,
|
|
174
|
+
|
|
175
|
+
)).parsed
|
minikai/api/users/get_users.py
CHANGED
|
@@ -1,32 +1,45 @@
|
|
|
1
1
|
from http import HTTPStatus
|
|
2
|
-
from typing import Any, Optional, Union
|
|
2
|
+
from typing import Any, Optional, Union, cast
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
|
|
6
|
-
from ... import errors
|
|
7
6
|
from ...client import AuthenticatedClient, Client
|
|
7
|
+
from ...types import Response, UNSET
|
|
8
|
+
from ... import errors
|
|
9
|
+
|
|
8
10
|
from ...models.user_dto import UserDto
|
|
9
|
-
from
|
|
11
|
+
from typing import cast
|
|
12
|
+
|
|
10
13
|
|
|
11
14
|
|
|
12
|
-
def _get_kwargs(
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
13
24
|
_kwargs: dict[str, Any] = {
|
|
14
25
|
"method": "get",
|
|
15
26
|
"url": "/api/Users",
|
|
16
27
|
}
|
|
17
28
|
|
|
29
|
+
|
|
18
30
|
return _kwargs
|
|
19
31
|
|
|
20
32
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
) -> Optional[list["UserDto"]]:
|
|
33
|
+
|
|
34
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[list['UserDto']]:
|
|
24
35
|
if response.status_code == 200:
|
|
25
36
|
response_200 = []
|
|
26
37
|
_response_200 = response.json()
|
|
27
|
-
for response_200_item_data in _response_200:
|
|
38
|
+
for response_200_item_data in (_response_200):
|
|
28
39
|
response_200_item = UserDto.from_dict(response_200_item_data)
|
|
29
40
|
|
|
41
|
+
|
|
42
|
+
|
|
30
43
|
response_200.append(response_200_item)
|
|
31
44
|
|
|
32
45
|
return response_200
|
|
@@ -37,9 +50,7 @@ def _parse_response(
|
|
|
37
50
|
return None
|
|
38
51
|
|
|
39
52
|
|
|
40
|
-
def _build_response(
|
|
41
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
42
|
-
) -> Response[list["UserDto"]]:
|
|
53
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[list['UserDto']]:
|
|
43
54
|
return Response(
|
|
44
55
|
status_code=HTTPStatus(response.status_code),
|
|
45
56
|
content=response.content,
|
|
@@ -51,17 +62,21 @@ def _build_response(
|
|
|
51
62
|
def sync_detailed(
|
|
52
63
|
*,
|
|
53
64
|
client: Union[AuthenticatedClient, Client],
|
|
54
|
-
|
|
55
|
-
|
|
65
|
+
|
|
66
|
+
) -> Response[list['UserDto']]:
|
|
67
|
+
"""
|
|
56
68
|
Raises:
|
|
57
69
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
58
70
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
59
71
|
|
|
60
72
|
Returns:
|
|
61
73
|
Response[list['UserDto']]
|
|
62
|
-
|
|
74
|
+
"""
|
|
63
75
|
|
|
64
|
-
|
|
76
|
+
|
|
77
|
+
kwargs = _get_kwargs(
|
|
78
|
+
|
|
79
|
+
)
|
|
65
80
|
|
|
66
81
|
response = client.get_httpx_client().request(
|
|
67
82
|
**kwargs,
|
|
@@ -69,60 +84,67 @@ def sync_detailed(
|
|
|
69
84
|
|
|
70
85
|
return _build_response(client=client, response=response)
|
|
71
86
|
|
|
72
|
-
|
|
73
87
|
def sync(
|
|
74
88
|
*,
|
|
75
89
|
client: Union[AuthenticatedClient, Client],
|
|
76
|
-
|
|
77
|
-
|
|
90
|
+
|
|
91
|
+
) -> Optional[list['UserDto']]:
|
|
92
|
+
"""
|
|
78
93
|
Raises:
|
|
79
94
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
80
95
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
81
96
|
|
|
82
97
|
Returns:
|
|
83
98
|
list['UserDto']
|
|
84
|
-
|
|
99
|
+
"""
|
|
100
|
+
|
|
85
101
|
|
|
86
102
|
return sync_detailed(
|
|
87
103
|
client=client,
|
|
88
|
-
).parsed
|
|
89
104
|
|
|
105
|
+
).parsed
|
|
90
106
|
|
|
91
107
|
async def asyncio_detailed(
|
|
92
108
|
*,
|
|
93
109
|
client: Union[AuthenticatedClient, Client],
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
|
|
111
|
+
) -> Response[list['UserDto']]:
|
|
112
|
+
"""
|
|
96
113
|
Raises:
|
|
97
114
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
98
115
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
99
116
|
|
|
100
117
|
Returns:
|
|
101
118
|
Response[list['UserDto']]
|
|
102
|
-
|
|
119
|
+
"""
|
|
103
120
|
|
|
104
|
-
kwargs = _get_kwargs()
|
|
105
121
|
|
|
106
|
-
|
|
122
|
+
kwargs = _get_kwargs(
|
|
123
|
+
|
|
124
|
+
)
|
|
107
125
|
|
|
108
|
-
|
|
126
|
+
response = await client.get_async_httpx_client().request(
|
|
127
|
+
**kwargs
|
|
128
|
+
)
|
|
109
129
|
|
|
130
|
+
return _build_response(client=client, response=response)
|
|
110
131
|
|
|
111
132
|
async def asyncio(
|
|
112
133
|
*,
|
|
113
134
|
client: Union[AuthenticatedClient, Client],
|
|
114
|
-
|
|
115
|
-
|
|
135
|
+
|
|
136
|
+
) -> Optional[list['UserDto']]:
|
|
137
|
+
"""
|
|
116
138
|
Raises:
|
|
117
139
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
118
140
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
119
141
|
|
|
120
142
|
Returns:
|
|
121
143
|
list['UserDto']
|
|
122
|
-
|
|
144
|
+
"""
|
|
123
145
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
).parsed
|
|
146
|
+
|
|
147
|
+
return (await asyncio_detailed(
|
|
148
|
+
client=client,
|
|
149
|
+
|
|
150
|
+
)).parsed
|
|
@@ -3,27 +3,37 @@ from typing import Any, Optional, Union, cast
|
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
|
|
6
|
-
from ... import errors
|
|
7
6
|
from ...client import AuthenticatedClient, Client
|
|
7
|
+
from ...types import Response, UNSET
|
|
8
|
+
from ... import errors
|
|
9
|
+
|
|
8
10
|
from ...models.http_validation_problem_details import HttpValidationProblemDetails
|
|
9
|
-
from
|
|
11
|
+
from typing import cast
|
|
12
|
+
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
def _get_kwargs(
|
|
13
16
|
user_id: str,
|
|
14
17
|
mini_id: int,
|
|
18
|
+
|
|
15
19
|
) -> dict[str, Any]:
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
16
26
|
_kwargs: dict[str, Any] = {
|
|
17
27
|
"method": "post",
|
|
18
|
-
"url":
|
|
28
|
+
"url": "/api/Users/{user_id}/minis/{mini_id}".format(user_id=user_id,mini_id=mini_id,),
|
|
19
29
|
}
|
|
20
30
|
|
|
31
|
+
|
|
21
32
|
return _kwargs
|
|
22
33
|
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
) -> Optional[Union[Any, HttpValidationProblemDetails]]:
|
|
35
|
+
|
|
36
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, HttpValidationProblemDetails]]:
|
|
27
37
|
if response.status_code == 204:
|
|
28
38
|
response_204 = cast(Any, None)
|
|
29
39
|
return response_204
|
|
@@ -31,6 +41,8 @@ def _parse_response(
|
|
|
31
41
|
if response.status_code == 400:
|
|
32
42
|
response_400 = HttpValidationProblemDetails.from_dict(response.json())
|
|
33
43
|
|
|
44
|
+
|
|
45
|
+
|
|
34
46
|
return response_400
|
|
35
47
|
|
|
36
48
|
if response.status_code == 404:
|
|
@@ -43,9 +55,7 @@ def _parse_response(
|
|
|
43
55
|
return None
|
|
44
56
|
|
|
45
57
|
|
|
46
|
-
def _build_response(
|
|
47
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
48
|
-
) -> Response[Union[Any, HttpValidationProblemDetails]]:
|
|
58
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, HttpValidationProblemDetails]]:
|
|
49
59
|
return Response(
|
|
50
60
|
status_code=HTTPStatus(response.status_code),
|
|
51
61
|
content=response.content,
|
|
@@ -59,8 +69,9 @@ def sync_detailed(
|
|
|
59
69
|
mini_id: int,
|
|
60
70
|
*,
|
|
61
71
|
client: Union[AuthenticatedClient, Client],
|
|
72
|
+
|
|
62
73
|
) -> Response[Union[Any, HttpValidationProblemDetails]]:
|
|
63
|
-
"""
|
|
74
|
+
"""
|
|
64
75
|
Args:
|
|
65
76
|
user_id (str):
|
|
66
77
|
mini_id (int):
|
|
@@ -71,11 +82,13 @@ def sync_detailed(
|
|
|
71
82
|
|
|
72
83
|
Returns:
|
|
73
84
|
Response[Union[Any, HttpValidationProblemDetails]]
|
|
74
|
-
|
|
85
|
+
"""
|
|
86
|
+
|
|
75
87
|
|
|
76
88
|
kwargs = _get_kwargs(
|
|
77
89
|
user_id=user_id,
|
|
78
|
-
|
|
90
|
+
mini_id=mini_id,
|
|
91
|
+
|
|
79
92
|
)
|
|
80
93
|
|
|
81
94
|
response = client.get_httpx_client().request(
|
|
@@ -84,14 +97,14 @@ def sync_detailed(
|
|
|
84
97
|
|
|
85
98
|
return _build_response(client=client, response=response)
|
|
86
99
|
|
|
87
|
-
|
|
88
100
|
def sync(
|
|
89
101
|
user_id: str,
|
|
90
102
|
mini_id: int,
|
|
91
103
|
*,
|
|
92
104
|
client: Union[AuthenticatedClient, Client],
|
|
105
|
+
|
|
93
106
|
) -> Optional[Union[Any, HttpValidationProblemDetails]]:
|
|
94
|
-
"""
|
|
107
|
+
"""
|
|
95
108
|
Args:
|
|
96
109
|
user_id (str):
|
|
97
110
|
mini_id (int):
|
|
@@ -102,22 +115,24 @@ def sync(
|
|
|
102
115
|
|
|
103
116
|
Returns:
|
|
104
117
|
Union[Any, HttpValidationProblemDetails]
|
|
105
|
-
|
|
118
|
+
"""
|
|
119
|
+
|
|
106
120
|
|
|
107
121
|
return sync_detailed(
|
|
108
122
|
user_id=user_id,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
).parsed
|
|
123
|
+
mini_id=mini_id,
|
|
124
|
+
client=client,
|
|
112
125
|
|
|
126
|
+
).parsed
|
|
113
127
|
|
|
114
128
|
async def asyncio_detailed(
|
|
115
129
|
user_id: str,
|
|
116
130
|
mini_id: int,
|
|
117
131
|
*,
|
|
118
132
|
client: Union[AuthenticatedClient, Client],
|
|
133
|
+
|
|
119
134
|
) -> Response[Union[Any, HttpValidationProblemDetails]]:
|
|
120
|
-
"""
|
|
135
|
+
"""
|
|
121
136
|
Args:
|
|
122
137
|
user_id (str):
|
|
123
138
|
mini_id (int):
|
|
@@ -128,25 +143,29 @@ async def asyncio_detailed(
|
|
|
128
143
|
|
|
129
144
|
Returns:
|
|
130
145
|
Response[Union[Any, HttpValidationProblemDetails]]
|
|
131
|
-
|
|
146
|
+
"""
|
|
147
|
+
|
|
132
148
|
|
|
133
149
|
kwargs = _get_kwargs(
|
|
134
150
|
user_id=user_id,
|
|
135
|
-
|
|
151
|
+
mini_id=mini_id,
|
|
152
|
+
|
|
136
153
|
)
|
|
137
154
|
|
|
138
|
-
response = await client.get_async_httpx_client().request(
|
|
155
|
+
response = await client.get_async_httpx_client().request(
|
|
156
|
+
**kwargs
|
|
157
|
+
)
|
|
139
158
|
|
|
140
159
|
return _build_response(client=client, response=response)
|
|
141
160
|
|
|
142
|
-
|
|
143
161
|
async def asyncio(
|
|
144
162
|
user_id: str,
|
|
145
163
|
mini_id: int,
|
|
146
164
|
*,
|
|
147
165
|
client: Union[AuthenticatedClient, Client],
|
|
166
|
+
|
|
148
167
|
) -> Optional[Union[Any, HttpValidationProblemDetails]]:
|
|
149
|
-
"""
|
|
168
|
+
"""
|
|
150
169
|
Args:
|
|
151
170
|
user_id (str):
|
|
152
171
|
mini_id (int):
|
|
@@ -157,12 +176,12 @@ async def asyncio(
|
|
|
157
176
|
|
|
158
177
|
Returns:
|
|
159
178
|
Union[Any, HttpValidationProblemDetails]
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
).parsed
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
return (await asyncio_detailed(
|
|
183
|
+
user_id=user_id,
|
|
184
|
+
mini_id=mini_id,
|
|
185
|
+
client=client,
|
|
186
|
+
|
|
187
|
+
)).parsed
|
minikai/client.py
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import ssl
|
|
2
|
-
from typing import Any,
|
|
2
|
+
from typing import Any, Union, Optional
|
|
3
3
|
|
|
4
|
+
from attrs import define, field, evolve
|
|
4
5
|
import httpx
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
@define
|
|
@@ -33,7 +36,6 @@ class Client:
|
|
|
33
36
|
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
|
34
37
|
argument to the constructor.
|
|
35
38
|
"""
|
|
36
|
-
|
|
37
39
|
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
|
38
40
|
_base_url: str = field(alias="base_url")
|
|
39
41
|
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
|
@@ -266,3 +268,4 @@ class AuthenticatedClient:
|
|
|
266
268
|
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
|
267
269
|
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
|
268
270
|
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
|
271
|
+
|
minikai/errors.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
"""Contains shared errors types that can be raised from API functions"""
|
|
2
|
-
|
|
1
|
+
""" Contains shared errors types that can be raised from API functions """
|
|
3
2
|
|
|
4
3
|
class UnexpectedStatus(Exception):
|
|
5
4
|
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
|
|
@@ -12,5 +11,4 @@ class UnexpectedStatus(Exception):
|
|
|
12
11
|
f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
|
|
13
12
|
)
|
|
14
13
|
|
|
15
|
-
|
|
16
14
|
__all__ = ["UnexpectedStatus"]
|