minikai 0.1.0__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 +176 -0
- minikai/api/groups/add_users_to_group.py +176 -0
- minikai/api/groups/create_group.py +160 -0
- minikai/api/groups/delete_group.py +95 -0
- minikai/api/groups/get_group.py +151 -0
- minikai/api/groups/get_group_minis.py +156 -0
- minikai/api/groups/get_group_users.py +156 -0
- minikai/api/groups/get_groups.py +128 -0
- minikai/api/groups/remove_minis_from_group.py +176 -0
- minikai/api/groups/remove_users_from_group.py +176 -0
- minikai/api/groups/update_group.py +177 -0
- minikai/api/minis/__init__.py +1 -0
- minikai/api/minis/create_mini.py +160 -0
- minikai/api/minis/delete_mini.py +95 -0
- minikai/api/minis/get_external_mini.py +164 -0
- minikai/api/minis/get_minis.py +128 -0
- minikai/api/minis/patch_mini.py +177 -0
- minikai/api/minis/update_mini.py +177 -0
- minikai/api/records/__init__.py +1 -0
- minikai/api/records/add_attachments.py +182 -0
- minikai/api/records/add_relations.py +187 -0
- minikai/api/records/create_record.py +162 -0
- minikai/api/records/delete_record.py +95 -0
- minikai/api/records/get_records_by_external.py +230 -0
- minikai/api/records/remove_attachments.py +110 -0
- minikai/api/records/remove_relations.py +110 -0
- minikai/api/records/update_attachments.py +182 -0
- minikai/api/records/update_record.py +179 -0
- minikai/api/records/update_relations.py +187 -0
- minikai/api/users/__init__.py +1 -0
- minikai/api/users/delete_api_users_minis.py +102 -0
- minikai/api/users/get_api_users_minis.py +156 -0
- minikai/api/users/get_users.py +128 -0
- minikai/api/users/post_api_users_minis.py +168 -0
- minikai/client.py +268 -0
- minikai/errors.py +16 -0
- minikai/models/__init__.py +89 -0
- minikai/models/add_attachments_body.py +98 -0
- minikai/models/create_group_command.py +102 -0
- minikai/models/create_mini_command.py +120 -0
- minikai/models/create_record_command.py +268 -0
- minikai/models/create_record_command_tags.py +44 -0
- minikai/models/document_file_dto.py +147 -0
- minikai/models/form_field.py +112 -0
- minikai/models/form_field_dto.py +149 -0
- minikai/models/form_field_type.py +16 -0
- minikai/models/group_dto.py +124 -0
- minikai/models/http_validation_problem_details.py +173 -0
- minikai/models/http_validation_problem_details_errors.py +51 -0
- minikai/models/json_node.py +119 -0
- minikai/models/json_node_options.py +42 -0
- minikai/models/mini_dto.py +189 -0
- minikai/models/mini_template_dto.py +135 -0
- minikai/models/paginated_list_of_record_dto.py +101 -0
- minikai/models/patch_mini_command.py +80 -0
- minikai/models/problem_details.py +151 -0
- minikai/models/record.py +379 -0
- minikai/models/record_attachment.py +236 -0
- minikai/models/record_attachment_dto.py +236 -0
- minikai/models/record_attachment_dto_metadata_type_0.py +44 -0
- minikai/models/record_attachment_metadata_type_0.py +44 -0
- minikai/models/record_authorization.py +75 -0
- minikai/models/record_authorization_dto.py +75 -0
- minikai/models/record_dto.py +377 -0
- minikai/models/record_dto_tags.py +44 -0
- minikai/models/record_relation.py +81 -0
- minikai/models/record_relation_dto.py +81 -0
- minikai/models/record_tags.py +44 -0
- minikai/models/slim_mini_dto.py +168 -0
- minikai/models/tool_dto.py +76 -0
- minikai/models/update_attachments_body.py +98 -0
- minikai/models/update_group_command.py +122 -0
- minikai/models/update_mini_command.py +129 -0
- minikai/models/update_mini_template_workspaces_command.py +51 -0
- minikai/models/update_record_command.py +266 -0
- minikai/models/update_record_command_tags.py +44 -0
- minikai/models/user_dto.py +182 -0
- minikai/models/user_to_mini_dto.py +78 -0
- minikai/models/workspace_dto.py +78 -0
- minikai/py.typed +1 -0
- minikai/types.py +54 -0
- minikai-0.1.0.dist-info/METADATA +133 -0
- minikai-0.1.0.dist-info/RECORD +87 -0
- minikai-0.1.0.dist-info/WHEEL +4 -0
minikai/client.py
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import ssl
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
from attrs import define, evolve, field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@define
|
|
9
|
+
class Client:
|
|
10
|
+
"""A class for keeping track of data related to the API
|
|
11
|
+
|
|
12
|
+
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
|
13
|
+
|
|
14
|
+
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
|
15
|
+
|
|
16
|
+
``cookies``: A dictionary of cookies to be sent with every request
|
|
17
|
+
|
|
18
|
+
``headers``: A dictionary of headers to be sent with every request
|
|
19
|
+
|
|
20
|
+
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
|
21
|
+
httpx.TimeoutException if this is exceeded.
|
|
22
|
+
|
|
23
|
+
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
|
24
|
+
but can be set to False for testing purposes.
|
|
25
|
+
|
|
26
|
+
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
|
27
|
+
|
|
28
|
+
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Attributes:
|
|
32
|
+
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
|
33
|
+
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
|
34
|
+
argument to the constructor.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
|
38
|
+
_base_url: str = field(alias="base_url")
|
|
39
|
+
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
|
40
|
+
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
|
41
|
+
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
|
42
|
+
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
|
43
|
+
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
|
44
|
+
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
|
45
|
+
_client: Optional[httpx.Client] = field(default=None, init=False)
|
|
46
|
+
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
|
47
|
+
|
|
48
|
+
def with_headers(self, headers: dict[str, str]) -> "Client":
|
|
49
|
+
"""Get a new client matching this one with additional headers"""
|
|
50
|
+
if self._client is not None:
|
|
51
|
+
self._client.headers.update(headers)
|
|
52
|
+
if self._async_client is not None:
|
|
53
|
+
self._async_client.headers.update(headers)
|
|
54
|
+
return evolve(self, headers={**self._headers, **headers})
|
|
55
|
+
|
|
56
|
+
def with_cookies(self, cookies: dict[str, str]) -> "Client":
|
|
57
|
+
"""Get a new client matching this one with additional cookies"""
|
|
58
|
+
if self._client is not None:
|
|
59
|
+
self._client.cookies.update(cookies)
|
|
60
|
+
if self._async_client is not None:
|
|
61
|
+
self._async_client.cookies.update(cookies)
|
|
62
|
+
return evolve(self, cookies={**self._cookies, **cookies})
|
|
63
|
+
|
|
64
|
+
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
|
|
65
|
+
"""Get a new client matching this one with a new timeout (in seconds)"""
|
|
66
|
+
if self._client is not None:
|
|
67
|
+
self._client.timeout = timeout
|
|
68
|
+
if self._async_client is not None:
|
|
69
|
+
self._async_client.timeout = timeout
|
|
70
|
+
return evolve(self, timeout=timeout)
|
|
71
|
+
|
|
72
|
+
def set_httpx_client(self, client: httpx.Client) -> "Client":
|
|
73
|
+
"""Manually set the underlying httpx.Client
|
|
74
|
+
|
|
75
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
76
|
+
"""
|
|
77
|
+
self._client = client
|
|
78
|
+
return self
|
|
79
|
+
|
|
80
|
+
def get_httpx_client(self) -> httpx.Client:
|
|
81
|
+
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
|
82
|
+
if self._client is None:
|
|
83
|
+
self._client = httpx.Client(
|
|
84
|
+
base_url=self._base_url,
|
|
85
|
+
cookies=self._cookies,
|
|
86
|
+
headers=self._headers,
|
|
87
|
+
timeout=self._timeout,
|
|
88
|
+
verify=self._verify_ssl,
|
|
89
|
+
follow_redirects=self._follow_redirects,
|
|
90
|
+
**self._httpx_args,
|
|
91
|
+
)
|
|
92
|
+
return self._client
|
|
93
|
+
|
|
94
|
+
def __enter__(self) -> "Client":
|
|
95
|
+
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
|
96
|
+
self.get_httpx_client().__enter__()
|
|
97
|
+
return self
|
|
98
|
+
|
|
99
|
+
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
|
100
|
+
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
|
101
|
+
self.get_httpx_client().__exit__(*args, **kwargs)
|
|
102
|
+
|
|
103
|
+
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
|
|
104
|
+
"""Manually the underlying httpx.AsyncClient
|
|
105
|
+
|
|
106
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
107
|
+
"""
|
|
108
|
+
self._async_client = async_client
|
|
109
|
+
return self
|
|
110
|
+
|
|
111
|
+
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
|
112
|
+
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
|
113
|
+
if self._async_client is None:
|
|
114
|
+
self._async_client = httpx.AsyncClient(
|
|
115
|
+
base_url=self._base_url,
|
|
116
|
+
cookies=self._cookies,
|
|
117
|
+
headers=self._headers,
|
|
118
|
+
timeout=self._timeout,
|
|
119
|
+
verify=self._verify_ssl,
|
|
120
|
+
follow_redirects=self._follow_redirects,
|
|
121
|
+
**self._httpx_args,
|
|
122
|
+
)
|
|
123
|
+
return self._async_client
|
|
124
|
+
|
|
125
|
+
async def __aenter__(self) -> "Client":
|
|
126
|
+
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
|
127
|
+
await self.get_async_httpx_client().__aenter__()
|
|
128
|
+
return self
|
|
129
|
+
|
|
130
|
+
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
|
131
|
+
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
|
132
|
+
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@define
|
|
136
|
+
class AuthenticatedClient:
|
|
137
|
+
"""A Client which has been authenticated for use on secured endpoints
|
|
138
|
+
|
|
139
|
+
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
|
140
|
+
|
|
141
|
+
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
|
142
|
+
|
|
143
|
+
``cookies``: A dictionary of cookies to be sent with every request
|
|
144
|
+
|
|
145
|
+
``headers``: A dictionary of headers to be sent with every request
|
|
146
|
+
|
|
147
|
+
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
|
148
|
+
httpx.TimeoutException if this is exceeded.
|
|
149
|
+
|
|
150
|
+
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
|
151
|
+
but can be set to False for testing purposes.
|
|
152
|
+
|
|
153
|
+
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
|
154
|
+
|
|
155
|
+
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
Attributes:
|
|
159
|
+
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
|
160
|
+
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
|
161
|
+
argument to the constructor.
|
|
162
|
+
token: The token to use for authentication
|
|
163
|
+
prefix: The prefix to use for the Authorization header
|
|
164
|
+
auth_header_name: The name of the Authorization header
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
|
168
|
+
_base_url: str = field(alias="base_url")
|
|
169
|
+
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
|
170
|
+
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
|
171
|
+
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
|
172
|
+
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
|
173
|
+
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
|
174
|
+
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
|
175
|
+
_client: Optional[httpx.Client] = field(default=None, init=False)
|
|
176
|
+
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
|
177
|
+
|
|
178
|
+
token: str
|
|
179
|
+
prefix: str = "Bearer"
|
|
180
|
+
auth_header_name: str = "Authorization"
|
|
181
|
+
|
|
182
|
+
def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
|
|
183
|
+
"""Get a new client matching this one with additional headers"""
|
|
184
|
+
if self._client is not None:
|
|
185
|
+
self._client.headers.update(headers)
|
|
186
|
+
if self._async_client is not None:
|
|
187
|
+
self._async_client.headers.update(headers)
|
|
188
|
+
return evolve(self, headers={**self._headers, **headers})
|
|
189
|
+
|
|
190
|
+
def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
|
|
191
|
+
"""Get a new client matching this one with additional cookies"""
|
|
192
|
+
if self._client is not None:
|
|
193
|
+
self._client.cookies.update(cookies)
|
|
194
|
+
if self._async_client is not None:
|
|
195
|
+
self._async_client.cookies.update(cookies)
|
|
196
|
+
return evolve(self, cookies={**self._cookies, **cookies})
|
|
197
|
+
|
|
198
|
+
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
|
|
199
|
+
"""Get a new client matching this one with a new timeout (in seconds)"""
|
|
200
|
+
if self._client is not None:
|
|
201
|
+
self._client.timeout = timeout
|
|
202
|
+
if self._async_client is not None:
|
|
203
|
+
self._async_client.timeout = timeout
|
|
204
|
+
return evolve(self, timeout=timeout)
|
|
205
|
+
|
|
206
|
+
def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
|
|
207
|
+
"""Manually set the underlying httpx.Client
|
|
208
|
+
|
|
209
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
210
|
+
"""
|
|
211
|
+
self._client = client
|
|
212
|
+
return self
|
|
213
|
+
|
|
214
|
+
def get_httpx_client(self) -> httpx.Client:
|
|
215
|
+
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
|
216
|
+
if self._client is None:
|
|
217
|
+
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
|
218
|
+
self._client = httpx.Client(
|
|
219
|
+
base_url=self._base_url,
|
|
220
|
+
cookies=self._cookies,
|
|
221
|
+
headers=self._headers,
|
|
222
|
+
timeout=self._timeout,
|
|
223
|
+
verify=self._verify_ssl,
|
|
224
|
+
follow_redirects=self._follow_redirects,
|
|
225
|
+
**self._httpx_args,
|
|
226
|
+
)
|
|
227
|
+
return self._client
|
|
228
|
+
|
|
229
|
+
def __enter__(self) -> "AuthenticatedClient":
|
|
230
|
+
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
|
231
|
+
self.get_httpx_client().__enter__()
|
|
232
|
+
return self
|
|
233
|
+
|
|
234
|
+
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
|
235
|
+
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
|
236
|
+
self.get_httpx_client().__exit__(*args, **kwargs)
|
|
237
|
+
|
|
238
|
+
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
|
|
239
|
+
"""Manually the underlying httpx.AsyncClient
|
|
240
|
+
|
|
241
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
242
|
+
"""
|
|
243
|
+
self._async_client = async_client
|
|
244
|
+
return self
|
|
245
|
+
|
|
246
|
+
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
|
247
|
+
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
|
248
|
+
if self._async_client is None:
|
|
249
|
+
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
|
250
|
+
self._async_client = httpx.AsyncClient(
|
|
251
|
+
base_url=self._base_url,
|
|
252
|
+
cookies=self._cookies,
|
|
253
|
+
headers=self._headers,
|
|
254
|
+
timeout=self._timeout,
|
|
255
|
+
verify=self._verify_ssl,
|
|
256
|
+
follow_redirects=self._follow_redirects,
|
|
257
|
+
**self._httpx_args,
|
|
258
|
+
)
|
|
259
|
+
return self._async_client
|
|
260
|
+
|
|
261
|
+
async def __aenter__(self) -> "AuthenticatedClient":
|
|
262
|
+
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
|
263
|
+
await self.get_async_httpx_client().__aenter__()
|
|
264
|
+
return self
|
|
265
|
+
|
|
266
|
+
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
|
267
|
+
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
|
268
|
+
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
minikai/errors.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Contains shared errors types that can be raised from API functions"""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class UnexpectedStatus(Exception):
|
|
5
|
+
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
|
|
6
|
+
|
|
7
|
+
def __init__(self, status_code: int, content: bytes):
|
|
8
|
+
self.status_code = status_code
|
|
9
|
+
self.content = content
|
|
10
|
+
|
|
11
|
+
super().__init__(
|
|
12
|
+
f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
__all__ = ["UnexpectedStatus"]
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""Contains all the data models used in inputs/outputs"""
|
|
2
|
+
|
|
3
|
+
from .add_attachments_body import AddAttachmentsBody
|
|
4
|
+
from .create_group_command import CreateGroupCommand
|
|
5
|
+
from .create_mini_command import CreateMiniCommand
|
|
6
|
+
from .create_record_command import CreateRecordCommand
|
|
7
|
+
from .create_record_command_tags import CreateRecordCommandTags
|
|
8
|
+
from .document_file_dto import DocumentFileDto
|
|
9
|
+
from .form_field import FormField
|
|
10
|
+
from .form_field_dto import FormFieldDto
|
|
11
|
+
from .form_field_type import FormFieldType
|
|
12
|
+
from .group_dto import GroupDto
|
|
13
|
+
from .http_validation_problem_details import HttpValidationProblemDetails
|
|
14
|
+
from .http_validation_problem_details_errors import HttpValidationProblemDetailsErrors
|
|
15
|
+
from .json_node import JsonNode
|
|
16
|
+
from .json_node_options import JsonNodeOptions
|
|
17
|
+
from .mini_dto import MiniDto
|
|
18
|
+
from .mini_template_dto import MiniTemplateDto
|
|
19
|
+
from .paginated_list_of_record_dto import PaginatedListOfRecordDto
|
|
20
|
+
from .patch_mini_command import PatchMiniCommand
|
|
21
|
+
from .problem_details import ProblemDetails
|
|
22
|
+
from .record import Record
|
|
23
|
+
from .record_attachment import RecordAttachment
|
|
24
|
+
from .record_attachment_dto import RecordAttachmentDto
|
|
25
|
+
from .record_attachment_dto_metadata_type_0 import RecordAttachmentDtoMetadataType0
|
|
26
|
+
from .record_attachment_metadata_type_0 import RecordAttachmentMetadataType0
|
|
27
|
+
from .record_authorization import RecordAuthorization
|
|
28
|
+
from .record_authorization_dto import RecordAuthorizationDto
|
|
29
|
+
from .record_dto import RecordDto
|
|
30
|
+
from .record_dto_tags import RecordDtoTags
|
|
31
|
+
from .record_relation import RecordRelation
|
|
32
|
+
from .record_relation_dto import RecordRelationDto
|
|
33
|
+
from .record_tags import RecordTags
|
|
34
|
+
from .slim_mini_dto import SlimMiniDto
|
|
35
|
+
from .tool_dto import ToolDto
|
|
36
|
+
from .update_attachments_body import UpdateAttachmentsBody
|
|
37
|
+
from .update_group_command import UpdateGroupCommand
|
|
38
|
+
from .update_mini_command import UpdateMiniCommand
|
|
39
|
+
from .update_mini_template_workspaces_command import UpdateMiniTemplateWorkspacesCommand
|
|
40
|
+
from .update_record_command import UpdateRecordCommand
|
|
41
|
+
from .update_record_command_tags import UpdateRecordCommandTags
|
|
42
|
+
from .user_dto import UserDto
|
|
43
|
+
from .user_to_mini_dto import UserToMiniDto
|
|
44
|
+
from .workspace_dto import WorkspaceDto
|
|
45
|
+
|
|
46
|
+
__all__ = (
|
|
47
|
+
"AddAttachmentsBody",
|
|
48
|
+
"CreateGroupCommand",
|
|
49
|
+
"CreateMiniCommand",
|
|
50
|
+
"CreateRecordCommand",
|
|
51
|
+
"CreateRecordCommandTags",
|
|
52
|
+
"DocumentFileDto",
|
|
53
|
+
"FormField",
|
|
54
|
+
"FormFieldDto",
|
|
55
|
+
"FormFieldType",
|
|
56
|
+
"GroupDto",
|
|
57
|
+
"HttpValidationProblemDetails",
|
|
58
|
+
"HttpValidationProblemDetailsErrors",
|
|
59
|
+
"JsonNode",
|
|
60
|
+
"JsonNodeOptions",
|
|
61
|
+
"MiniDto",
|
|
62
|
+
"MiniTemplateDto",
|
|
63
|
+
"PaginatedListOfRecordDto",
|
|
64
|
+
"PatchMiniCommand",
|
|
65
|
+
"ProblemDetails",
|
|
66
|
+
"Record",
|
|
67
|
+
"RecordAttachment",
|
|
68
|
+
"RecordAttachmentDto",
|
|
69
|
+
"RecordAttachmentDtoMetadataType0",
|
|
70
|
+
"RecordAttachmentMetadataType0",
|
|
71
|
+
"RecordAuthorization",
|
|
72
|
+
"RecordAuthorizationDto",
|
|
73
|
+
"RecordDto",
|
|
74
|
+
"RecordDtoTags",
|
|
75
|
+
"RecordRelation",
|
|
76
|
+
"RecordRelationDto",
|
|
77
|
+
"RecordTags",
|
|
78
|
+
"SlimMiniDto",
|
|
79
|
+
"ToolDto",
|
|
80
|
+
"UpdateAttachmentsBody",
|
|
81
|
+
"UpdateGroupCommand",
|
|
82
|
+
"UpdateMiniCommand",
|
|
83
|
+
"UpdateMiniTemplateWorkspacesCommand",
|
|
84
|
+
"UpdateRecordCommand",
|
|
85
|
+
"UpdateRecordCommandTags",
|
|
86
|
+
"UserDto",
|
|
87
|
+
"UserToMiniDto",
|
|
88
|
+
"WorkspaceDto",
|
|
89
|
+
)
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
from .. import types
|
|
8
|
+
from ..types import UNSET, Unset
|
|
9
|
+
|
|
10
|
+
T = TypeVar("T", bound="AddAttachmentsBody")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@_attrs_define
|
|
14
|
+
class AddAttachmentsBody:
|
|
15
|
+
"""
|
|
16
|
+
Attributes:
|
|
17
|
+
files (Union[None, Unset, list[Any]]):
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
files: Union[None, Unset, list[Any]] = UNSET
|
|
21
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
22
|
+
|
|
23
|
+
def to_dict(self) -> dict[str, Any]:
|
|
24
|
+
files: Union[None, Unset, list[Any]]
|
|
25
|
+
if isinstance(self.files, Unset):
|
|
26
|
+
files = UNSET
|
|
27
|
+
elif isinstance(self.files, list):
|
|
28
|
+
files = self.files
|
|
29
|
+
|
|
30
|
+
else:
|
|
31
|
+
files = self.files
|
|
32
|
+
|
|
33
|
+
field_dict: dict[str, Any] = {}
|
|
34
|
+
field_dict.update(self.additional_properties)
|
|
35
|
+
field_dict.update({})
|
|
36
|
+
if files is not UNSET:
|
|
37
|
+
field_dict["files"] = files
|
|
38
|
+
|
|
39
|
+
return field_dict
|
|
40
|
+
|
|
41
|
+
def to_multipart(self) -> types.RequestFiles:
|
|
42
|
+
files: types.RequestFiles = []
|
|
43
|
+
|
|
44
|
+
if not isinstance(self.files, Unset):
|
|
45
|
+
if isinstance(self.files, list):
|
|
46
|
+
for files_type_0_item_element in self.files:
|
|
47
|
+
files.append(("files", (None, str(files_type_0_item_element).encode(), "text/plain")))
|
|
48
|
+
else:
|
|
49
|
+
files.append(("files", (None, str(self.files).encode(), "text/plain")))
|
|
50
|
+
|
|
51
|
+
for prop_name, prop in self.additional_properties.items():
|
|
52
|
+
files.append((prop_name, (None, str(prop).encode(), "text/plain")))
|
|
53
|
+
|
|
54
|
+
return files
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
58
|
+
d = dict(src_dict)
|
|
59
|
+
|
|
60
|
+
def _parse_files(data: object) -> Union[None, Unset, list[Any]]:
|
|
61
|
+
if data is None:
|
|
62
|
+
return data
|
|
63
|
+
if isinstance(data, Unset):
|
|
64
|
+
return data
|
|
65
|
+
try:
|
|
66
|
+
if not isinstance(data, list):
|
|
67
|
+
raise TypeError()
|
|
68
|
+
files_type_0 = cast(list[Any], data)
|
|
69
|
+
|
|
70
|
+
return files_type_0
|
|
71
|
+
except: # noqa: E722
|
|
72
|
+
pass
|
|
73
|
+
return cast(Union[None, Unset, list[Any]], data)
|
|
74
|
+
|
|
75
|
+
files = _parse_files(d.pop("files", UNSET))
|
|
76
|
+
|
|
77
|
+
add_attachments_body = cls(
|
|
78
|
+
files=files,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
add_attachments_body.additional_properties = d
|
|
82
|
+
return add_attachments_body
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def additional_keys(self) -> list[str]:
|
|
86
|
+
return list(self.additional_properties.keys())
|
|
87
|
+
|
|
88
|
+
def __getitem__(self, key: str) -> Any:
|
|
89
|
+
return self.additional_properties[key]
|
|
90
|
+
|
|
91
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
92
|
+
self.additional_properties[key] = value
|
|
93
|
+
|
|
94
|
+
def __delitem__(self, key: str) -> None:
|
|
95
|
+
del self.additional_properties[key]
|
|
96
|
+
|
|
97
|
+
def __contains__(self, key: str) -> bool:
|
|
98
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
|
|
6
|
+
from ..types import UNSET, Unset
|
|
7
|
+
|
|
8
|
+
T = TypeVar("T", bound="CreateGroupCommand")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@_attrs_define
|
|
12
|
+
class CreateGroupCommand:
|
|
13
|
+
"""
|
|
14
|
+
Attributes:
|
|
15
|
+
name (Union[Unset, str]):
|
|
16
|
+
user_ids (Union[None, Unset, list[str]]):
|
|
17
|
+
mini_ids (Union[None, Unset, list[int]]):
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
name: Union[Unset, str] = UNSET
|
|
21
|
+
user_ids: Union[None, Unset, list[str]] = UNSET
|
|
22
|
+
mini_ids: Union[None, Unset, list[int]] = UNSET
|
|
23
|
+
|
|
24
|
+
def to_dict(self) -> dict[str, Any]:
|
|
25
|
+
name = self.name
|
|
26
|
+
|
|
27
|
+
user_ids: Union[None, Unset, list[str]]
|
|
28
|
+
if isinstance(self.user_ids, Unset):
|
|
29
|
+
user_ids = UNSET
|
|
30
|
+
elif isinstance(self.user_ids, list):
|
|
31
|
+
user_ids = self.user_ids
|
|
32
|
+
|
|
33
|
+
else:
|
|
34
|
+
user_ids = self.user_ids
|
|
35
|
+
|
|
36
|
+
mini_ids: Union[None, Unset, list[int]]
|
|
37
|
+
if isinstance(self.mini_ids, Unset):
|
|
38
|
+
mini_ids = UNSET
|
|
39
|
+
elif isinstance(self.mini_ids, list):
|
|
40
|
+
mini_ids = self.mini_ids
|
|
41
|
+
|
|
42
|
+
else:
|
|
43
|
+
mini_ids = self.mini_ids
|
|
44
|
+
|
|
45
|
+
field_dict: dict[str, Any] = {}
|
|
46
|
+
|
|
47
|
+
field_dict.update({})
|
|
48
|
+
if name is not UNSET:
|
|
49
|
+
field_dict["name"] = name
|
|
50
|
+
if user_ids is not UNSET:
|
|
51
|
+
field_dict["userIds"] = user_ids
|
|
52
|
+
if mini_ids is not UNSET:
|
|
53
|
+
field_dict["miniIds"] = mini_ids
|
|
54
|
+
|
|
55
|
+
return field_dict
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
59
|
+
d = dict(src_dict)
|
|
60
|
+
name = d.pop("name", UNSET)
|
|
61
|
+
|
|
62
|
+
def _parse_user_ids(data: object) -> Union[None, Unset, list[str]]:
|
|
63
|
+
if data is None:
|
|
64
|
+
return data
|
|
65
|
+
if isinstance(data, Unset):
|
|
66
|
+
return data
|
|
67
|
+
try:
|
|
68
|
+
if not isinstance(data, list):
|
|
69
|
+
raise TypeError()
|
|
70
|
+
user_ids_type_0 = cast(list[str], data)
|
|
71
|
+
|
|
72
|
+
return user_ids_type_0
|
|
73
|
+
except: # noqa: E722
|
|
74
|
+
pass
|
|
75
|
+
return cast(Union[None, Unset, list[str]], data)
|
|
76
|
+
|
|
77
|
+
user_ids = _parse_user_ids(d.pop("userIds", UNSET))
|
|
78
|
+
|
|
79
|
+
def _parse_mini_ids(data: object) -> Union[None, Unset, list[int]]:
|
|
80
|
+
if data is None:
|
|
81
|
+
return data
|
|
82
|
+
if isinstance(data, Unset):
|
|
83
|
+
return data
|
|
84
|
+
try:
|
|
85
|
+
if not isinstance(data, list):
|
|
86
|
+
raise TypeError()
|
|
87
|
+
mini_ids_type_0 = cast(list[int], data)
|
|
88
|
+
|
|
89
|
+
return mini_ids_type_0
|
|
90
|
+
except: # noqa: E722
|
|
91
|
+
pass
|
|
92
|
+
return cast(Union[None, Unset, list[int]], data)
|
|
93
|
+
|
|
94
|
+
mini_ids = _parse_mini_ids(d.pop("miniIds", UNSET))
|
|
95
|
+
|
|
96
|
+
create_group_command = cls(
|
|
97
|
+
name=name,
|
|
98
|
+
user_ids=user_ids,
|
|
99
|
+
mini_ids=mini_ids,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
return create_group_command
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
|
|
6
|
+
from ..types import UNSET, Unset
|
|
7
|
+
|
|
8
|
+
T = TypeVar("T", bound="CreateMiniCommand")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@_attrs_define
|
|
12
|
+
class CreateMiniCommand:
|
|
13
|
+
"""
|
|
14
|
+
Attributes:
|
|
15
|
+
name (Union[Unset, str]):
|
|
16
|
+
description (Union[None, Unset, str]):
|
|
17
|
+
template_id (Union[None, Unset, str]):
|
|
18
|
+
external_id (Union[None, Unset, str]):
|
|
19
|
+
external_source (Union[None, Unset, str]):
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
name: Union[Unset, str] = UNSET
|
|
23
|
+
description: Union[None, Unset, str] = UNSET
|
|
24
|
+
template_id: Union[None, Unset, str] = UNSET
|
|
25
|
+
external_id: Union[None, Unset, str] = UNSET
|
|
26
|
+
external_source: Union[None, Unset, str] = UNSET
|
|
27
|
+
|
|
28
|
+
def to_dict(self) -> dict[str, Any]:
|
|
29
|
+
name = self.name
|
|
30
|
+
|
|
31
|
+
description: Union[None, Unset, str]
|
|
32
|
+
if isinstance(self.description, Unset):
|
|
33
|
+
description = UNSET
|
|
34
|
+
else:
|
|
35
|
+
description = self.description
|
|
36
|
+
|
|
37
|
+
template_id: Union[None, Unset, str]
|
|
38
|
+
if isinstance(self.template_id, Unset):
|
|
39
|
+
template_id = UNSET
|
|
40
|
+
else:
|
|
41
|
+
template_id = self.template_id
|
|
42
|
+
|
|
43
|
+
external_id: Union[None, Unset, str]
|
|
44
|
+
if isinstance(self.external_id, Unset):
|
|
45
|
+
external_id = UNSET
|
|
46
|
+
else:
|
|
47
|
+
external_id = self.external_id
|
|
48
|
+
|
|
49
|
+
external_source: Union[None, Unset, str]
|
|
50
|
+
if isinstance(self.external_source, Unset):
|
|
51
|
+
external_source = UNSET
|
|
52
|
+
else:
|
|
53
|
+
external_source = self.external_source
|
|
54
|
+
|
|
55
|
+
field_dict: dict[str, Any] = {}
|
|
56
|
+
|
|
57
|
+
field_dict.update({})
|
|
58
|
+
if name is not UNSET:
|
|
59
|
+
field_dict["name"] = name
|
|
60
|
+
if description is not UNSET:
|
|
61
|
+
field_dict["description"] = description
|
|
62
|
+
if template_id is not UNSET:
|
|
63
|
+
field_dict["templateId"] = template_id
|
|
64
|
+
if external_id is not UNSET:
|
|
65
|
+
field_dict["externalId"] = external_id
|
|
66
|
+
if external_source is not UNSET:
|
|
67
|
+
field_dict["externalSource"] = external_source
|
|
68
|
+
|
|
69
|
+
return field_dict
|
|
70
|
+
|
|
71
|
+
@classmethod
|
|
72
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
73
|
+
d = dict(src_dict)
|
|
74
|
+
name = d.pop("name", UNSET)
|
|
75
|
+
|
|
76
|
+
def _parse_description(data: object) -> Union[None, Unset, str]:
|
|
77
|
+
if data is None:
|
|
78
|
+
return data
|
|
79
|
+
if isinstance(data, Unset):
|
|
80
|
+
return data
|
|
81
|
+
return cast(Union[None, Unset, str], data)
|
|
82
|
+
|
|
83
|
+
description = _parse_description(d.pop("description", UNSET))
|
|
84
|
+
|
|
85
|
+
def _parse_template_id(data: object) -> Union[None, Unset, str]:
|
|
86
|
+
if data is None:
|
|
87
|
+
return data
|
|
88
|
+
if isinstance(data, Unset):
|
|
89
|
+
return data
|
|
90
|
+
return cast(Union[None, Unset, str], data)
|
|
91
|
+
|
|
92
|
+
template_id = _parse_template_id(d.pop("templateId", UNSET))
|
|
93
|
+
|
|
94
|
+
def _parse_external_id(data: object) -> Union[None, Unset, str]:
|
|
95
|
+
if data is None:
|
|
96
|
+
return data
|
|
97
|
+
if isinstance(data, Unset):
|
|
98
|
+
return data
|
|
99
|
+
return cast(Union[None, Unset, str], data)
|
|
100
|
+
|
|
101
|
+
external_id = _parse_external_id(d.pop("externalId", UNSET))
|
|
102
|
+
|
|
103
|
+
def _parse_external_source(data: object) -> Union[None, Unset, str]:
|
|
104
|
+
if data is None:
|
|
105
|
+
return data
|
|
106
|
+
if isinstance(data, Unset):
|
|
107
|
+
return data
|
|
108
|
+
return cast(Union[None, Unset, str], data)
|
|
109
|
+
|
|
110
|
+
external_source = _parse_external_source(d.pop("externalSource", UNSET))
|
|
111
|
+
|
|
112
|
+
create_mini_command = cls(
|
|
113
|
+
name=name,
|
|
114
|
+
description=description,
|
|
115
|
+
template_id=template_id,
|
|
116
|
+
external_id=external_id,
|
|
117
|
+
external_source=external_source,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
return create_mini_command
|