minikai 0.1.7__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 +8 -0
- minikai/api/__init__.py +1 -0
- minikai/api/groups/__init__.py +1 -0
- minikai/api/groups/add_minis_to_group.py +196 -0
- minikai/api/groups/add_users_to_group.py +196 -0
- minikai/api/groups/create_group.py +178 -0
- minikai/api/groups/delete_group.py +115 -0
- minikai/api/groups/get_group.py +170 -0
- minikai/api/groups/get_group_minis.py +175 -0
- minikai/api/groups/get_group_users.py +175 -0
- minikai/api/groups/get_groups.py +150 -0
- minikai/api/groups/remove_minis_from_group.py +196 -0
- minikai/api/groups/remove_users_from_group.py +196 -0
- minikai/api/groups/update_group.py +195 -0
- minikai/api/minis/__init__.py +1 -0
- minikai/api/minis/create_mini.py +178 -0
- minikai/api/minis/delete_mini.py +115 -0
- minikai/api/minis/get_external_mini.py +183 -0
- minikai/api/minis/get_minis.py +150 -0
- minikai/api/minis/patch_mini.py +195 -0
- minikai/api/minis/update_mini.py +195 -0
- minikai/api/records/__init__.py +1 -0
- minikai/api/records/add_attachments.py +203 -0
- minikai/api/records/add_relations.py +209 -0
- minikai/api/records/create_record.py +182 -0
- minikai/api/records/delete_record.py +115 -0
- minikai/api/records/download_attachment.py +119 -0
- minikai/api/records/get_created_by.py +202 -0
- minikai/api/records/get_labels.py +194 -0
- minikai/api/records/get_records_by_external.py +248 -0
- minikai/api/records/get_states.py +194 -0
- minikai/api/records/get_updated_by.py +202 -0
- minikai/api/records/remove_attachments.py +132 -0
- minikai/api/records/remove_relations.py +132 -0
- minikai/api/records/update_attachments.py +203 -0
- minikai/api/records/update_record.py +199 -0
- minikai/api/records/update_relations.py +209 -0
- minikai/api/records/upsert_records_by_external_uri.py +182 -0
- minikai/api/users/__init__.py +1 -0
- minikai/api/users/delete_api_users_minis.py +122 -0
- minikai/api/users/get_api_users_minis.py +175 -0
- minikai/api/users/get_users.py +150 -0
- minikai/api/users/post_api_users_minis.py +187 -0
- minikai/client.py +271 -0
- minikai/errors.py +14 -0
- minikai/models/__init__.py +103 -0
- minikai/models/add_attachments_body.py +140 -0
- minikai/models/batch_upsert_result.py +124 -0
- minikai/models/create_group_command.py +127 -0
- minikai/models/create_mini_command.py +144 -0
- minikai/models/create_record_command.py +263 -0
- minikai/models/create_record_command_tags.py +63 -0
- minikai/models/cursor_paginated_list_of_record_dto.py +122 -0
- minikai/models/document_file_dto.py +171 -0
- minikai/models/document_file_metadata_dto.py +72 -0
- minikai/models/failed_upsert_item.py +83 -0
- minikai/models/form_field.py +138 -0
- minikai/models/form_field_dto.py +181 -0
- minikai/models/form_field_type.py +10 -0
- minikai/models/group_dto.py +155 -0
- minikai/models/http_validation_problem_details.py +198 -0
- minikai/models/http_validation_problem_details_errors.py +74 -0
- minikai/models/mini_dto.py +224 -0
- minikai/models/mini_template_dto.py +167 -0
- minikai/models/paginated_list_of_record_dto.py +124 -0
- minikai/models/patch_mini_command.py +102 -0
- minikai/models/problem_details.py +174 -0
- minikai/models/record.py +441 -0
- minikai/models/record_attachment.py +265 -0
- minikai/models/record_attachment_dto.py +265 -0
- minikai/models/record_attachment_dto_metadata_type_0.py +63 -0
- minikai/models/record_attachment_metadata_type_0.py +63 -0
- minikai/models/record_authorization.py +107 -0
- minikai/models/record_authorization_dto.py +107 -0
- minikai/models/record_dto.py +385 -0
- minikai/models/record_dto_tags.py +63 -0
- minikai/models/record_relation.py +105 -0
- minikai/models/record_relation_dto.py +105 -0
- minikai/models/record_state.py +10 -0
- minikai/models/record_tag.py +159 -0
- minikai/models/record_tag_dto.py +68 -0
- minikai/models/slim_mini_dto.py +197 -0
- minikai/models/tool_dto.py +95 -0
- minikai/models/update_attachments_body.py +140 -0
- minikai/models/update_group_command.py +148 -0
- minikai/models/update_mini_command.py +153 -0
- minikai/models/update_mini_template_workspaces_command.py +74 -0
- minikai/models/update_record_command.py +274 -0
- minikai/models/update_record_command_tags.py +63 -0
- minikai/models/upsert_record_dto.py +275 -0
- minikai/models/upsert_record_dto_tags.py +63 -0
- minikai/models/upsert_records_by_external_uri_command.py +79 -0
- minikai/models/user_dto.py +215 -0
- minikai/models/user_to_mini_dto.py +99 -0
- minikai/models/workspace_dto.py +99 -0
- minikai/py.typed +1 -0
- minikai/types.py +53 -0
- minikai-0.1.7.dist-info/METADATA +133 -0
- minikai-0.1.7.dist-info/RECORD +100 -0
- minikai-0.1.7.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ...client import AuthenticatedClient, Client
|
|
7
|
+
from ...types import Response, UNSET
|
|
8
|
+
from ... import errors
|
|
9
|
+
|
|
10
|
+
from ...models.http_validation_problem_details import HttpValidationProblemDetails
|
|
11
|
+
from ...models.record_attachment import RecordAttachment
|
|
12
|
+
from ...models.update_attachments_body import UpdateAttachmentsBody
|
|
13
|
+
from typing import cast
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
record_id: str,
|
|
19
|
+
*,
|
|
20
|
+
body: UpdateAttachmentsBody,
|
|
21
|
+
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
headers: dict[str, Any] = {}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
_kwargs: dict[str, Any] = {
|
|
31
|
+
"method": "put",
|
|
32
|
+
"url": "/api/Records/{record_id}/attachments".format(record_id=record_id,),
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_kwargs["files"] = body.to_multipart()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
_kwargs["headers"] = headers
|
|
40
|
+
return _kwargs
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]]:
|
|
45
|
+
if response.status_code == 200:
|
|
46
|
+
response_200 = []
|
|
47
|
+
_response_200 = response.json()
|
|
48
|
+
for response_200_item_data in (_response_200):
|
|
49
|
+
response_200_item = RecordAttachment.from_dict(response_200_item_data)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
response_200.append(response_200_item)
|
|
54
|
+
|
|
55
|
+
return response_200
|
|
56
|
+
|
|
57
|
+
if response.status_code == 400:
|
|
58
|
+
response_400 = HttpValidationProblemDetails.from_dict(response.json())
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
return response_400
|
|
63
|
+
|
|
64
|
+
if response.status_code == 404:
|
|
65
|
+
response_404 = cast(Any, None)
|
|
66
|
+
return response_404
|
|
67
|
+
|
|
68
|
+
if client.raise_on_unexpected_status:
|
|
69
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
70
|
+
else:
|
|
71
|
+
return None
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]]:
|
|
75
|
+
return Response(
|
|
76
|
+
status_code=HTTPStatus(response.status_code),
|
|
77
|
+
content=response.content,
|
|
78
|
+
headers=response.headers,
|
|
79
|
+
parsed=_parse_response(client=client, response=response),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def sync_detailed(
|
|
84
|
+
record_id: str,
|
|
85
|
+
*,
|
|
86
|
+
client: Union[AuthenticatedClient, Client],
|
|
87
|
+
body: UpdateAttachmentsBody,
|
|
88
|
+
|
|
89
|
+
) -> Response[Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]]:
|
|
90
|
+
"""
|
|
91
|
+
Args:
|
|
92
|
+
record_id (str):
|
|
93
|
+
body (UpdateAttachmentsBody):
|
|
94
|
+
|
|
95
|
+
Raises:
|
|
96
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
97
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
Response[Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]]
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
kwargs = _get_kwargs(
|
|
105
|
+
record_id=record_id,
|
|
106
|
+
body=body,
|
|
107
|
+
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
response = client.get_httpx_client().request(
|
|
111
|
+
**kwargs,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
return _build_response(client=client, response=response)
|
|
115
|
+
|
|
116
|
+
def sync(
|
|
117
|
+
record_id: str,
|
|
118
|
+
*,
|
|
119
|
+
client: Union[AuthenticatedClient, Client],
|
|
120
|
+
body: UpdateAttachmentsBody,
|
|
121
|
+
|
|
122
|
+
) -> Optional[Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]]:
|
|
123
|
+
"""
|
|
124
|
+
Args:
|
|
125
|
+
record_id (str):
|
|
126
|
+
body (UpdateAttachmentsBody):
|
|
127
|
+
|
|
128
|
+
Raises:
|
|
129
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
130
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
131
|
+
|
|
132
|
+
Returns:
|
|
133
|
+
Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]
|
|
134
|
+
"""
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
return sync_detailed(
|
|
138
|
+
record_id=record_id,
|
|
139
|
+
client=client,
|
|
140
|
+
body=body,
|
|
141
|
+
|
|
142
|
+
).parsed
|
|
143
|
+
|
|
144
|
+
async def asyncio_detailed(
|
|
145
|
+
record_id: str,
|
|
146
|
+
*,
|
|
147
|
+
client: Union[AuthenticatedClient, Client],
|
|
148
|
+
body: UpdateAttachmentsBody,
|
|
149
|
+
|
|
150
|
+
) -> Response[Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]]:
|
|
151
|
+
"""
|
|
152
|
+
Args:
|
|
153
|
+
record_id (str):
|
|
154
|
+
body (UpdateAttachmentsBody):
|
|
155
|
+
|
|
156
|
+
Raises:
|
|
157
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
158
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
159
|
+
|
|
160
|
+
Returns:
|
|
161
|
+
Response[Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]]
|
|
162
|
+
"""
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
kwargs = _get_kwargs(
|
|
166
|
+
record_id=record_id,
|
|
167
|
+
body=body,
|
|
168
|
+
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
response = await client.get_async_httpx_client().request(
|
|
172
|
+
**kwargs
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
return _build_response(client=client, response=response)
|
|
176
|
+
|
|
177
|
+
async def asyncio(
|
|
178
|
+
record_id: str,
|
|
179
|
+
*,
|
|
180
|
+
client: Union[AuthenticatedClient, Client],
|
|
181
|
+
body: UpdateAttachmentsBody,
|
|
182
|
+
|
|
183
|
+
) -> Optional[Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]]:
|
|
184
|
+
"""
|
|
185
|
+
Args:
|
|
186
|
+
record_id (str):
|
|
187
|
+
body (UpdateAttachmentsBody):
|
|
188
|
+
|
|
189
|
+
Raises:
|
|
190
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
191
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
192
|
+
|
|
193
|
+
Returns:
|
|
194
|
+
Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]
|
|
195
|
+
"""
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
return (await asyncio_detailed(
|
|
199
|
+
record_id=record_id,
|
|
200
|
+
client=client,
|
|
201
|
+
body=body,
|
|
202
|
+
|
|
203
|
+
)).parsed
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ...client import AuthenticatedClient, Client
|
|
7
|
+
from ...types import Response, UNSET
|
|
8
|
+
from ... import errors
|
|
9
|
+
|
|
10
|
+
from ...models.http_validation_problem_details import HttpValidationProblemDetails
|
|
11
|
+
from ...models.record import Record
|
|
12
|
+
from ...models.update_record_command import UpdateRecordCommand
|
|
13
|
+
from typing import cast
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
record_id: str,
|
|
19
|
+
*,
|
|
20
|
+
body: UpdateRecordCommand,
|
|
21
|
+
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
headers: dict[str, Any] = {}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
_kwargs: dict[str, Any] = {
|
|
31
|
+
"method": "put",
|
|
32
|
+
"url": "/api/Records/{record_id}".format(record_id=record_id,),
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_kwargs["json"] = body.to_dict()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
headers["Content-Type"] = "application/json"
|
|
39
|
+
|
|
40
|
+
_kwargs["headers"] = headers
|
|
41
|
+
return _kwargs
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, HttpValidationProblemDetails, Record]]:
|
|
46
|
+
if response.status_code == 200:
|
|
47
|
+
response_200 = Record.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
return response_200
|
|
52
|
+
|
|
53
|
+
if response.status_code == 400:
|
|
54
|
+
response_400 = HttpValidationProblemDetails.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
return response_400
|
|
59
|
+
|
|
60
|
+
if response.status_code == 404:
|
|
61
|
+
response_404 = cast(Any, None)
|
|
62
|
+
return response_404
|
|
63
|
+
|
|
64
|
+
if client.raise_on_unexpected_status:
|
|
65
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
66
|
+
else:
|
|
67
|
+
return None
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, HttpValidationProblemDetails, Record]]:
|
|
71
|
+
return Response(
|
|
72
|
+
status_code=HTTPStatus(response.status_code),
|
|
73
|
+
content=response.content,
|
|
74
|
+
headers=response.headers,
|
|
75
|
+
parsed=_parse_response(client=client, response=response),
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def sync_detailed(
|
|
80
|
+
record_id: str,
|
|
81
|
+
*,
|
|
82
|
+
client: Union[AuthenticatedClient, Client],
|
|
83
|
+
body: UpdateRecordCommand,
|
|
84
|
+
|
|
85
|
+
) -> Response[Union[Any, HttpValidationProblemDetails, Record]]:
|
|
86
|
+
"""
|
|
87
|
+
Args:
|
|
88
|
+
record_id (str):
|
|
89
|
+
body (UpdateRecordCommand):
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Response[Union[Any, HttpValidationProblemDetails, Record]]
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
kwargs = _get_kwargs(
|
|
101
|
+
record_id=record_id,
|
|
102
|
+
body=body,
|
|
103
|
+
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
response = client.get_httpx_client().request(
|
|
107
|
+
**kwargs,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return _build_response(client=client, response=response)
|
|
111
|
+
|
|
112
|
+
def sync(
|
|
113
|
+
record_id: str,
|
|
114
|
+
*,
|
|
115
|
+
client: Union[AuthenticatedClient, Client],
|
|
116
|
+
body: UpdateRecordCommand,
|
|
117
|
+
|
|
118
|
+
) -> Optional[Union[Any, HttpValidationProblemDetails, Record]]:
|
|
119
|
+
"""
|
|
120
|
+
Args:
|
|
121
|
+
record_id (str):
|
|
122
|
+
body (UpdateRecordCommand):
|
|
123
|
+
|
|
124
|
+
Raises:
|
|
125
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
126
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
Union[Any, HttpValidationProblemDetails, Record]
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
return sync_detailed(
|
|
134
|
+
record_id=record_id,
|
|
135
|
+
client=client,
|
|
136
|
+
body=body,
|
|
137
|
+
|
|
138
|
+
).parsed
|
|
139
|
+
|
|
140
|
+
async def asyncio_detailed(
|
|
141
|
+
record_id: str,
|
|
142
|
+
*,
|
|
143
|
+
client: Union[AuthenticatedClient, Client],
|
|
144
|
+
body: UpdateRecordCommand,
|
|
145
|
+
|
|
146
|
+
) -> Response[Union[Any, HttpValidationProblemDetails, Record]]:
|
|
147
|
+
"""
|
|
148
|
+
Args:
|
|
149
|
+
record_id (str):
|
|
150
|
+
body (UpdateRecordCommand):
|
|
151
|
+
|
|
152
|
+
Raises:
|
|
153
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
154
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
Response[Union[Any, HttpValidationProblemDetails, Record]]
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
kwargs = _get_kwargs(
|
|
162
|
+
record_id=record_id,
|
|
163
|
+
body=body,
|
|
164
|
+
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
response = await client.get_async_httpx_client().request(
|
|
168
|
+
**kwargs
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
return _build_response(client=client, response=response)
|
|
172
|
+
|
|
173
|
+
async def asyncio(
|
|
174
|
+
record_id: str,
|
|
175
|
+
*,
|
|
176
|
+
client: Union[AuthenticatedClient, Client],
|
|
177
|
+
body: UpdateRecordCommand,
|
|
178
|
+
|
|
179
|
+
) -> Optional[Union[Any, HttpValidationProblemDetails, Record]]:
|
|
180
|
+
"""
|
|
181
|
+
Args:
|
|
182
|
+
record_id (str):
|
|
183
|
+
body (UpdateRecordCommand):
|
|
184
|
+
|
|
185
|
+
Raises:
|
|
186
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
187
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
188
|
+
|
|
189
|
+
Returns:
|
|
190
|
+
Union[Any, HttpValidationProblemDetails, Record]
|
|
191
|
+
"""
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
return (await asyncio_detailed(
|
|
195
|
+
record_id=record_id,
|
|
196
|
+
client=client,
|
|
197
|
+
body=body,
|
|
198
|
+
|
|
199
|
+
)).parsed
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ...client import AuthenticatedClient, Client
|
|
7
|
+
from ...types import Response, UNSET
|
|
8
|
+
from ... import errors
|
|
9
|
+
|
|
10
|
+
from ...models.http_validation_problem_details import HttpValidationProblemDetails
|
|
11
|
+
from ...models.record_relation import RecordRelation
|
|
12
|
+
from ...models.record_relation_dto import RecordRelationDto
|
|
13
|
+
from typing import cast
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
record_id: str,
|
|
19
|
+
*,
|
|
20
|
+
body: list['RecordRelationDto'],
|
|
21
|
+
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
headers: dict[str, Any] = {}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
_kwargs: dict[str, Any] = {
|
|
31
|
+
"method": "put",
|
|
32
|
+
"url": "/api/Records/{record_id}/relations".format(record_id=record_id,),
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_kwargs["json"] = []
|
|
36
|
+
for body_item_data in body:
|
|
37
|
+
body_item = body_item_data.to_dict()
|
|
38
|
+
_kwargs["json"].append(body_item)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
headers["Content-Type"] = "application/json"
|
|
44
|
+
|
|
45
|
+
_kwargs["headers"] = headers
|
|
46
|
+
return _kwargs
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, HttpValidationProblemDetails, list['RecordRelation']]]:
|
|
51
|
+
if response.status_code == 200:
|
|
52
|
+
response_200 = []
|
|
53
|
+
_response_200 = response.json()
|
|
54
|
+
for response_200_item_data in (_response_200):
|
|
55
|
+
response_200_item = RecordRelation.from_dict(response_200_item_data)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
response_200.append(response_200_item)
|
|
60
|
+
|
|
61
|
+
return response_200
|
|
62
|
+
|
|
63
|
+
if response.status_code == 400:
|
|
64
|
+
response_400 = HttpValidationProblemDetails.from_dict(response.json())
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
return response_400
|
|
69
|
+
|
|
70
|
+
if response.status_code == 404:
|
|
71
|
+
response_404 = cast(Any, None)
|
|
72
|
+
return response_404
|
|
73
|
+
|
|
74
|
+
if client.raise_on_unexpected_status:
|
|
75
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
76
|
+
else:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, HttpValidationProblemDetails, list['RecordRelation']]]:
|
|
81
|
+
return Response(
|
|
82
|
+
status_code=HTTPStatus(response.status_code),
|
|
83
|
+
content=response.content,
|
|
84
|
+
headers=response.headers,
|
|
85
|
+
parsed=_parse_response(client=client, response=response),
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def sync_detailed(
|
|
90
|
+
record_id: str,
|
|
91
|
+
*,
|
|
92
|
+
client: Union[AuthenticatedClient, Client],
|
|
93
|
+
body: list['RecordRelationDto'],
|
|
94
|
+
|
|
95
|
+
) -> Response[Union[Any, HttpValidationProblemDetails, list['RecordRelation']]]:
|
|
96
|
+
"""
|
|
97
|
+
Args:
|
|
98
|
+
record_id (str):
|
|
99
|
+
body (list['RecordRelationDto']):
|
|
100
|
+
|
|
101
|
+
Raises:
|
|
102
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
103
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
Response[Union[Any, HttpValidationProblemDetails, list['RecordRelation']]]
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
kwargs = _get_kwargs(
|
|
111
|
+
record_id=record_id,
|
|
112
|
+
body=body,
|
|
113
|
+
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
response = client.get_httpx_client().request(
|
|
117
|
+
**kwargs,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
return _build_response(client=client, response=response)
|
|
121
|
+
|
|
122
|
+
def sync(
|
|
123
|
+
record_id: str,
|
|
124
|
+
*,
|
|
125
|
+
client: Union[AuthenticatedClient, Client],
|
|
126
|
+
body: list['RecordRelationDto'],
|
|
127
|
+
|
|
128
|
+
) -> Optional[Union[Any, HttpValidationProblemDetails, list['RecordRelation']]]:
|
|
129
|
+
"""
|
|
130
|
+
Args:
|
|
131
|
+
record_id (str):
|
|
132
|
+
body (list['RecordRelationDto']):
|
|
133
|
+
|
|
134
|
+
Raises:
|
|
135
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
136
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
137
|
+
|
|
138
|
+
Returns:
|
|
139
|
+
Union[Any, HttpValidationProblemDetails, list['RecordRelation']]
|
|
140
|
+
"""
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
return sync_detailed(
|
|
144
|
+
record_id=record_id,
|
|
145
|
+
client=client,
|
|
146
|
+
body=body,
|
|
147
|
+
|
|
148
|
+
).parsed
|
|
149
|
+
|
|
150
|
+
async def asyncio_detailed(
|
|
151
|
+
record_id: str,
|
|
152
|
+
*,
|
|
153
|
+
client: Union[AuthenticatedClient, Client],
|
|
154
|
+
body: list['RecordRelationDto'],
|
|
155
|
+
|
|
156
|
+
) -> Response[Union[Any, HttpValidationProblemDetails, list['RecordRelation']]]:
|
|
157
|
+
"""
|
|
158
|
+
Args:
|
|
159
|
+
record_id (str):
|
|
160
|
+
body (list['RecordRelationDto']):
|
|
161
|
+
|
|
162
|
+
Raises:
|
|
163
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
164
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
165
|
+
|
|
166
|
+
Returns:
|
|
167
|
+
Response[Union[Any, HttpValidationProblemDetails, list['RecordRelation']]]
|
|
168
|
+
"""
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
kwargs = _get_kwargs(
|
|
172
|
+
record_id=record_id,
|
|
173
|
+
body=body,
|
|
174
|
+
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
response = await client.get_async_httpx_client().request(
|
|
178
|
+
**kwargs
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
return _build_response(client=client, response=response)
|
|
182
|
+
|
|
183
|
+
async def asyncio(
|
|
184
|
+
record_id: str,
|
|
185
|
+
*,
|
|
186
|
+
client: Union[AuthenticatedClient, Client],
|
|
187
|
+
body: list['RecordRelationDto'],
|
|
188
|
+
|
|
189
|
+
) -> Optional[Union[Any, HttpValidationProblemDetails, list['RecordRelation']]]:
|
|
190
|
+
"""
|
|
191
|
+
Args:
|
|
192
|
+
record_id (str):
|
|
193
|
+
body (list['RecordRelationDto']):
|
|
194
|
+
|
|
195
|
+
Raises:
|
|
196
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
197
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
198
|
+
|
|
199
|
+
Returns:
|
|
200
|
+
Union[Any, HttpValidationProblemDetails, list['RecordRelation']]
|
|
201
|
+
"""
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
return (await asyncio_detailed(
|
|
205
|
+
record_id=record_id,
|
|
206
|
+
client=client,
|
|
207
|
+
body=body,
|
|
208
|
+
|
|
209
|
+
)).parsed
|