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
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
from collections.abc import Mapping
|
|
3
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
|
4
|
+
|
|
5
|
+
from attrs import define as _attrs_define
|
|
6
|
+
from dateutil.parser import isoparse
|
|
7
|
+
|
|
8
|
+
from ..types import UNSET, Unset
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from ..models.create_record_command_tags import CreateRecordCommandTags
|
|
12
|
+
from ..models.json_node import JsonNode
|
|
13
|
+
from ..models.record_authorization_dto import RecordAuthorizationDto
|
|
14
|
+
from ..models.record_relation_dto import RecordRelationDto
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
T = TypeVar("T", bound="CreateRecordCommand")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@_attrs_define
|
|
21
|
+
class CreateRecordCommand:
|
|
22
|
+
"""
|
|
23
|
+
Attributes:
|
|
24
|
+
title (Union[Unset, str]):
|
|
25
|
+
description (Union[None, Unset, str]):
|
|
26
|
+
mini_id (Union[None, Unset, str]):
|
|
27
|
+
event_date (Union[None, Unset, datetime.datetime]):
|
|
28
|
+
schema (Union['JsonNode', None, Unset]):
|
|
29
|
+
content (Union['JsonNode', None, Unset]):
|
|
30
|
+
relations (Union[Unset, list['RecordRelationDto']]):
|
|
31
|
+
external_uri (Union[None, Unset, str]):
|
|
32
|
+
labels (Union[Unset, list[str]]):
|
|
33
|
+
tags (Union[Unset, CreateRecordCommandTags]):
|
|
34
|
+
authorization (Union[Unset, RecordAuthorizationDto]):
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
title: Union[Unset, str] = UNSET
|
|
38
|
+
description: Union[None, Unset, str] = UNSET
|
|
39
|
+
mini_id: Union[None, Unset, str] = UNSET
|
|
40
|
+
event_date: Union[None, Unset, datetime.datetime] = UNSET
|
|
41
|
+
schema: Union["JsonNode", None, Unset] = UNSET
|
|
42
|
+
content: Union["JsonNode", None, Unset] = UNSET
|
|
43
|
+
relations: Union[Unset, list["RecordRelationDto"]] = UNSET
|
|
44
|
+
external_uri: Union[None, Unset, str] = UNSET
|
|
45
|
+
labels: Union[Unset, list[str]] = UNSET
|
|
46
|
+
tags: Union[Unset, "CreateRecordCommandTags"] = UNSET
|
|
47
|
+
authorization: Union[Unset, "RecordAuthorizationDto"] = UNSET
|
|
48
|
+
|
|
49
|
+
def to_dict(self) -> dict[str, Any]:
|
|
50
|
+
from ..models.json_node import JsonNode
|
|
51
|
+
|
|
52
|
+
title = self.title
|
|
53
|
+
|
|
54
|
+
description: Union[None, Unset, str]
|
|
55
|
+
if isinstance(self.description, Unset):
|
|
56
|
+
description = UNSET
|
|
57
|
+
else:
|
|
58
|
+
description = self.description
|
|
59
|
+
|
|
60
|
+
mini_id: Union[None, Unset, str]
|
|
61
|
+
if isinstance(self.mini_id, Unset):
|
|
62
|
+
mini_id = UNSET
|
|
63
|
+
else:
|
|
64
|
+
mini_id = self.mini_id
|
|
65
|
+
|
|
66
|
+
event_date: Union[None, Unset, str]
|
|
67
|
+
if isinstance(self.event_date, Unset):
|
|
68
|
+
event_date = UNSET
|
|
69
|
+
elif isinstance(self.event_date, datetime.datetime):
|
|
70
|
+
event_date = self.event_date.isoformat()
|
|
71
|
+
else:
|
|
72
|
+
event_date = self.event_date
|
|
73
|
+
|
|
74
|
+
schema: Union[None, Unset, dict[str, Any]]
|
|
75
|
+
if isinstance(self.schema, Unset):
|
|
76
|
+
schema = UNSET
|
|
77
|
+
elif isinstance(self.schema, JsonNode):
|
|
78
|
+
schema = self.schema.to_dict()
|
|
79
|
+
else:
|
|
80
|
+
schema = self.schema
|
|
81
|
+
|
|
82
|
+
content: Union[None, Unset, dict[str, Any]]
|
|
83
|
+
if isinstance(self.content, Unset):
|
|
84
|
+
content = UNSET
|
|
85
|
+
elif isinstance(self.content, JsonNode):
|
|
86
|
+
content = self.content.to_dict()
|
|
87
|
+
else:
|
|
88
|
+
content = self.content
|
|
89
|
+
|
|
90
|
+
relations: Union[Unset, list[dict[str, Any]]] = UNSET
|
|
91
|
+
if not isinstance(self.relations, Unset):
|
|
92
|
+
relations = []
|
|
93
|
+
for relations_item_data in self.relations:
|
|
94
|
+
relations_item = relations_item_data.to_dict()
|
|
95
|
+
relations.append(relations_item)
|
|
96
|
+
|
|
97
|
+
external_uri: Union[None, Unset, str]
|
|
98
|
+
if isinstance(self.external_uri, Unset):
|
|
99
|
+
external_uri = UNSET
|
|
100
|
+
else:
|
|
101
|
+
external_uri = self.external_uri
|
|
102
|
+
|
|
103
|
+
labels: Union[Unset, list[str]] = UNSET
|
|
104
|
+
if not isinstance(self.labels, Unset):
|
|
105
|
+
labels = self.labels
|
|
106
|
+
|
|
107
|
+
tags: Union[Unset, dict[str, Any]] = UNSET
|
|
108
|
+
if not isinstance(self.tags, Unset):
|
|
109
|
+
tags = self.tags.to_dict()
|
|
110
|
+
|
|
111
|
+
authorization: Union[Unset, dict[str, Any]] = UNSET
|
|
112
|
+
if not isinstance(self.authorization, Unset):
|
|
113
|
+
authorization = self.authorization.to_dict()
|
|
114
|
+
|
|
115
|
+
field_dict: dict[str, Any] = {}
|
|
116
|
+
|
|
117
|
+
field_dict.update({})
|
|
118
|
+
if title is not UNSET:
|
|
119
|
+
field_dict["title"] = title
|
|
120
|
+
if description is not UNSET:
|
|
121
|
+
field_dict["description"] = description
|
|
122
|
+
if mini_id is not UNSET:
|
|
123
|
+
field_dict["miniId"] = mini_id
|
|
124
|
+
if event_date is not UNSET:
|
|
125
|
+
field_dict["eventDate"] = event_date
|
|
126
|
+
if schema is not UNSET:
|
|
127
|
+
field_dict["schema"] = schema
|
|
128
|
+
if content is not UNSET:
|
|
129
|
+
field_dict["content"] = content
|
|
130
|
+
if relations is not UNSET:
|
|
131
|
+
field_dict["relations"] = relations
|
|
132
|
+
if external_uri is not UNSET:
|
|
133
|
+
field_dict["externalUri"] = external_uri
|
|
134
|
+
if labels is not UNSET:
|
|
135
|
+
field_dict["labels"] = labels
|
|
136
|
+
if tags is not UNSET:
|
|
137
|
+
field_dict["tags"] = tags
|
|
138
|
+
if authorization is not UNSET:
|
|
139
|
+
field_dict["authorization"] = authorization
|
|
140
|
+
|
|
141
|
+
return field_dict
|
|
142
|
+
|
|
143
|
+
@classmethod
|
|
144
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
145
|
+
from ..models.create_record_command_tags import CreateRecordCommandTags
|
|
146
|
+
from ..models.json_node import JsonNode
|
|
147
|
+
from ..models.record_authorization_dto import RecordAuthorizationDto
|
|
148
|
+
from ..models.record_relation_dto import RecordRelationDto
|
|
149
|
+
|
|
150
|
+
d = dict(src_dict)
|
|
151
|
+
title = d.pop("title", UNSET)
|
|
152
|
+
|
|
153
|
+
def _parse_description(data: object) -> Union[None, Unset, str]:
|
|
154
|
+
if data is None:
|
|
155
|
+
return data
|
|
156
|
+
if isinstance(data, Unset):
|
|
157
|
+
return data
|
|
158
|
+
return cast(Union[None, Unset, str], data)
|
|
159
|
+
|
|
160
|
+
description = _parse_description(d.pop("description", UNSET))
|
|
161
|
+
|
|
162
|
+
def _parse_mini_id(data: object) -> Union[None, Unset, str]:
|
|
163
|
+
if data is None:
|
|
164
|
+
return data
|
|
165
|
+
if isinstance(data, Unset):
|
|
166
|
+
return data
|
|
167
|
+
return cast(Union[None, Unset, str], data)
|
|
168
|
+
|
|
169
|
+
mini_id = _parse_mini_id(d.pop("miniId", UNSET))
|
|
170
|
+
|
|
171
|
+
def _parse_event_date(data: object) -> Union[None, Unset, datetime.datetime]:
|
|
172
|
+
if data is None:
|
|
173
|
+
return data
|
|
174
|
+
if isinstance(data, Unset):
|
|
175
|
+
return data
|
|
176
|
+
try:
|
|
177
|
+
if not isinstance(data, str):
|
|
178
|
+
raise TypeError()
|
|
179
|
+
event_date_type_0 = isoparse(data)
|
|
180
|
+
|
|
181
|
+
return event_date_type_0
|
|
182
|
+
except: # noqa: E722
|
|
183
|
+
pass
|
|
184
|
+
return cast(Union[None, Unset, datetime.datetime], data)
|
|
185
|
+
|
|
186
|
+
event_date = _parse_event_date(d.pop("eventDate", UNSET))
|
|
187
|
+
|
|
188
|
+
def _parse_schema(data: object) -> Union["JsonNode", None, Unset]:
|
|
189
|
+
if data is None:
|
|
190
|
+
return data
|
|
191
|
+
if isinstance(data, Unset):
|
|
192
|
+
return data
|
|
193
|
+
try:
|
|
194
|
+
if not isinstance(data, dict):
|
|
195
|
+
raise TypeError()
|
|
196
|
+
schema_type_0 = JsonNode.from_dict(data)
|
|
197
|
+
|
|
198
|
+
return schema_type_0
|
|
199
|
+
except: # noqa: E722
|
|
200
|
+
pass
|
|
201
|
+
return cast(Union["JsonNode", None, Unset], data)
|
|
202
|
+
|
|
203
|
+
schema = _parse_schema(d.pop("schema", UNSET))
|
|
204
|
+
|
|
205
|
+
def _parse_content(data: object) -> Union["JsonNode", None, Unset]:
|
|
206
|
+
if data is None:
|
|
207
|
+
return data
|
|
208
|
+
if isinstance(data, Unset):
|
|
209
|
+
return data
|
|
210
|
+
try:
|
|
211
|
+
if not isinstance(data, dict):
|
|
212
|
+
raise TypeError()
|
|
213
|
+
content_type_0 = JsonNode.from_dict(data)
|
|
214
|
+
|
|
215
|
+
return content_type_0
|
|
216
|
+
except: # noqa: E722
|
|
217
|
+
pass
|
|
218
|
+
return cast(Union["JsonNode", None, Unset], data)
|
|
219
|
+
|
|
220
|
+
content = _parse_content(d.pop("content", UNSET))
|
|
221
|
+
|
|
222
|
+
relations = []
|
|
223
|
+
_relations = d.pop("relations", UNSET)
|
|
224
|
+
for relations_item_data in _relations or []:
|
|
225
|
+
relations_item = RecordRelationDto.from_dict(relations_item_data)
|
|
226
|
+
|
|
227
|
+
relations.append(relations_item)
|
|
228
|
+
|
|
229
|
+
def _parse_external_uri(data: object) -> Union[None, Unset, str]:
|
|
230
|
+
if data is None:
|
|
231
|
+
return data
|
|
232
|
+
if isinstance(data, Unset):
|
|
233
|
+
return data
|
|
234
|
+
return cast(Union[None, Unset, str], data)
|
|
235
|
+
|
|
236
|
+
external_uri = _parse_external_uri(d.pop("externalUri", UNSET))
|
|
237
|
+
|
|
238
|
+
labels = cast(list[str], d.pop("labels", UNSET))
|
|
239
|
+
|
|
240
|
+
_tags = d.pop("tags", UNSET)
|
|
241
|
+
tags: Union[Unset, CreateRecordCommandTags]
|
|
242
|
+
if isinstance(_tags, Unset):
|
|
243
|
+
tags = UNSET
|
|
244
|
+
else:
|
|
245
|
+
tags = CreateRecordCommandTags.from_dict(_tags)
|
|
246
|
+
|
|
247
|
+
_authorization = d.pop("authorization", UNSET)
|
|
248
|
+
authorization: Union[Unset, RecordAuthorizationDto]
|
|
249
|
+
if isinstance(_authorization, Unset):
|
|
250
|
+
authorization = UNSET
|
|
251
|
+
else:
|
|
252
|
+
authorization = RecordAuthorizationDto.from_dict(_authorization)
|
|
253
|
+
|
|
254
|
+
create_record_command = cls(
|
|
255
|
+
title=title,
|
|
256
|
+
description=description,
|
|
257
|
+
mini_id=mini_id,
|
|
258
|
+
event_date=event_date,
|
|
259
|
+
schema=schema,
|
|
260
|
+
content=content,
|
|
261
|
+
relations=relations,
|
|
262
|
+
external_uri=external_uri,
|
|
263
|
+
labels=labels,
|
|
264
|
+
tags=tags,
|
|
265
|
+
authorization=authorization,
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
return create_record_command
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any, TypeVar
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
T = TypeVar("T", bound="CreateRecordCommandTags")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@_attrs_define
|
|
11
|
+
class CreateRecordCommandTags:
|
|
12
|
+
""" """
|
|
13
|
+
|
|
14
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
15
|
+
|
|
16
|
+
def to_dict(self) -> dict[str, Any]:
|
|
17
|
+
field_dict: dict[str, Any] = {}
|
|
18
|
+
field_dict.update(self.additional_properties)
|
|
19
|
+
|
|
20
|
+
return field_dict
|
|
21
|
+
|
|
22
|
+
@classmethod
|
|
23
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
24
|
+
d = dict(src_dict)
|
|
25
|
+
create_record_command_tags = cls()
|
|
26
|
+
|
|
27
|
+
create_record_command_tags.additional_properties = d
|
|
28
|
+
return create_record_command_tags
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def additional_keys(self) -> list[str]:
|
|
32
|
+
return list(self.additional_properties.keys())
|
|
33
|
+
|
|
34
|
+
def __getitem__(self, key: str) -> Any:
|
|
35
|
+
return self.additional_properties[key]
|
|
36
|
+
|
|
37
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
38
|
+
self.additional_properties[key] = value
|
|
39
|
+
|
|
40
|
+
def __delitem__(self, key: str) -> None:
|
|
41
|
+
del self.additional_properties[key]
|
|
42
|
+
|
|
43
|
+
def __contains__(self, key: str) -> bool:
|
|
44
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,147 @@
|
|
|
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="DocumentFileDto")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@_attrs_define
|
|
12
|
+
class DocumentFileDto:
|
|
13
|
+
"""
|
|
14
|
+
Attributes:
|
|
15
|
+
id (Union[Unset, int]):
|
|
16
|
+
file_id (Union[Unset, str]):
|
|
17
|
+
doc_file_id (Union[Unset, str]):
|
|
18
|
+
name (Union[None, Unset, str]):
|
|
19
|
+
content_type (Union[None, Unset, str]):
|
|
20
|
+
file_extension (Union[None, Unset, str]):
|
|
21
|
+
size (Union[Unset, int]):
|
|
22
|
+
workspace_id (Union[None, Unset, str]):
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
id: Union[Unset, int] = UNSET
|
|
26
|
+
file_id: Union[Unset, str] = UNSET
|
|
27
|
+
doc_file_id: Union[Unset, str] = UNSET
|
|
28
|
+
name: Union[None, Unset, str] = UNSET
|
|
29
|
+
content_type: Union[None, Unset, str] = UNSET
|
|
30
|
+
file_extension: Union[None, Unset, str] = UNSET
|
|
31
|
+
size: Union[Unset, int] = UNSET
|
|
32
|
+
workspace_id: Union[None, Unset, str] = UNSET
|
|
33
|
+
|
|
34
|
+
def to_dict(self) -> dict[str, Any]:
|
|
35
|
+
id = self.id
|
|
36
|
+
|
|
37
|
+
file_id = self.file_id
|
|
38
|
+
|
|
39
|
+
doc_file_id = self.doc_file_id
|
|
40
|
+
|
|
41
|
+
name: Union[None, Unset, str]
|
|
42
|
+
if isinstance(self.name, Unset):
|
|
43
|
+
name = UNSET
|
|
44
|
+
else:
|
|
45
|
+
name = self.name
|
|
46
|
+
|
|
47
|
+
content_type: Union[None, Unset, str]
|
|
48
|
+
if isinstance(self.content_type, Unset):
|
|
49
|
+
content_type = UNSET
|
|
50
|
+
else:
|
|
51
|
+
content_type = self.content_type
|
|
52
|
+
|
|
53
|
+
file_extension: Union[None, Unset, str]
|
|
54
|
+
if isinstance(self.file_extension, Unset):
|
|
55
|
+
file_extension = UNSET
|
|
56
|
+
else:
|
|
57
|
+
file_extension = self.file_extension
|
|
58
|
+
|
|
59
|
+
size = self.size
|
|
60
|
+
|
|
61
|
+
workspace_id: Union[None, Unset, str]
|
|
62
|
+
if isinstance(self.workspace_id, Unset):
|
|
63
|
+
workspace_id = UNSET
|
|
64
|
+
else:
|
|
65
|
+
workspace_id = self.workspace_id
|
|
66
|
+
|
|
67
|
+
field_dict: dict[str, Any] = {}
|
|
68
|
+
|
|
69
|
+
field_dict.update({})
|
|
70
|
+
if id is not UNSET:
|
|
71
|
+
field_dict["id"] = id
|
|
72
|
+
if file_id is not UNSET:
|
|
73
|
+
field_dict["fileId"] = file_id
|
|
74
|
+
if doc_file_id is not UNSET:
|
|
75
|
+
field_dict["docFileId"] = doc_file_id
|
|
76
|
+
if name is not UNSET:
|
|
77
|
+
field_dict["name"] = name
|
|
78
|
+
if content_type is not UNSET:
|
|
79
|
+
field_dict["contentType"] = content_type
|
|
80
|
+
if file_extension is not UNSET:
|
|
81
|
+
field_dict["fileExtension"] = file_extension
|
|
82
|
+
if size is not UNSET:
|
|
83
|
+
field_dict["size"] = size
|
|
84
|
+
if workspace_id is not UNSET:
|
|
85
|
+
field_dict["workspaceId"] = workspace_id
|
|
86
|
+
|
|
87
|
+
return field_dict
|
|
88
|
+
|
|
89
|
+
@classmethod
|
|
90
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
91
|
+
d = dict(src_dict)
|
|
92
|
+
id = d.pop("id", UNSET)
|
|
93
|
+
|
|
94
|
+
file_id = d.pop("fileId", UNSET)
|
|
95
|
+
|
|
96
|
+
doc_file_id = d.pop("docFileId", UNSET)
|
|
97
|
+
|
|
98
|
+
def _parse_name(data: object) -> Union[None, Unset, str]:
|
|
99
|
+
if data is None:
|
|
100
|
+
return data
|
|
101
|
+
if isinstance(data, Unset):
|
|
102
|
+
return data
|
|
103
|
+
return cast(Union[None, Unset, str], data)
|
|
104
|
+
|
|
105
|
+
name = _parse_name(d.pop("name", UNSET))
|
|
106
|
+
|
|
107
|
+
def _parse_content_type(data: object) -> Union[None, Unset, str]:
|
|
108
|
+
if data is None:
|
|
109
|
+
return data
|
|
110
|
+
if isinstance(data, Unset):
|
|
111
|
+
return data
|
|
112
|
+
return cast(Union[None, Unset, str], data)
|
|
113
|
+
|
|
114
|
+
content_type = _parse_content_type(d.pop("contentType", UNSET))
|
|
115
|
+
|
|
116
|
+
def _parse_file_extension(data: object) -> Union[None, Unset, str]:
|
|
117
|
+
if data is None:
|
|
118
|
+
return data
|
|
119
|
+
if isinstance(data, Unset):
|
|
120
|
+
return data
|
|
121
|
+
return cast(Union[None, Unset, str], data)
|
|
122
|
+
|
|
123
|
+
file_extension = _parse_file_extension(d.pop("fileExtension", UNSET))
|
|
124
|
+
|
|
125
|
+
size = d.pop("size", UNSET)
|
|
126
|
+
|
|
127
|
+
def _parse_workspace_id(data: object) -> Union[None, Unset, str]:
|
|
128
|
+
if data is None:
|
|
129
|
+
return data
|
|
130
|
+
if isinstance(data, Unset):
|
|
131
|
+
return data
|
|
132
|
+
return cast(Union[None, Unset, str], data)
|
|
133
|
+
|
|
134
|
+
workspace_id = _parse_workspace_id(d.pop("workspaceId", UNSET))
|
|
135
|
+
|
|
136
|
+
document_file_dto = cls(
|
|
137
|
+
id=id,
|
|
138
|
+
file_id=file_id,
|
|
139
|
+
doc_file_id=doc_file_id,
|
|
140
|
+
name=name,
|
|
141
|
+
content_type=content_type,
|
|
142
|
+
file_extension=file_extension,
|
|
143
|
+
size=size,
|
|
144
|
+
workspace_id=workspace_id,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
return document_file_dto
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
from collections.abc import Mapping
|
|
3
|
+
from typing import Any, TypeVar, Union, cast
|
|
4
|
+
|
|
5
|
+
from attrs import define as _attrs_define
|
|
6
|
+
from dateutil.parser import isoparse
|
|
7
|
+
|
|
8
|
+
from ..types import UNSET, Unset
|
|
9
|
+
|
|
10
|
+
T = TypeVar("T", bound="FormField")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@_attrs_define
|
|
14
|
+
class FormField:
|
|
15
|
+
"""
|
|
16
|
+
Attributes:
|
|
17
|
+
key (Union[Unset, str]):
|
|
18
|
+
value_string (Union[None, Unset, str]):
|
|
19
|
+
value_number (Union[None, Unset, float]):
|
|
20
|
+
value_date (Union[None, Unset, datetime.datetime]):
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
key: Union[Unset, str] = UNSET
|
|
24
|
+
value_string: Union[None, Unset, str] = UNSET
|
|
25
|
+
value_number: Union[None, Unset, float] = UNSET
|
|
26
|
+
value_date: Union[None, Unset, datetime.datetime] = UNSET
|
|
27
|
+
|
|
28
|
+
def to_dict(self) -> dict[str, Any]:
|
|
29
|
+
key = self.key
|
|
30
|
+
|
|
31
|
+
value_string: Union[None, Unset, str]
|
|
32
|
+
if isinstance(self.value_string, Unset):
|
|
33
|
+
value_string = UNSET
|
|
34
|
+
else:
|
|
35
|
+
value_string = self.value_string
|
|
36
|
+
|
|
37
|
+
value_number: Union[None, Unset, float]
|
|
38
|
+
if isinstance(self.value_number, Unset):
|
|
39
|
+
value_number = UNSET
|
|
40
|
+
else:
|
|
41
|
+
value_number = self.value_number
|
|
42
|
+
|
|
43
|
+
value_date: Union[None, Unset, str]
|
|
44
|
+
if isinstance(self.value_date, Unset):
|
|
45
|
+
value_date = UNSET
|
|
46
|
+
elif isinstance(self.value_date, datetime.datetime):
|
|
47
|
+
value_date = self.value_date.isoformat()
|
|
48
|
+
else:
|
|
49
|
+
value_date = self.value_date
|
|
50
|
+
|
|
51
|
+
field_dict: dict[str, Any] = {}
|
|
52
|
+
|
|
53
|
+
field_dict.update({})
|
|
54
|
+
if key is not UNSET:
|
|
55
|
+
field_dict["key"] = key
|
|
56
|
+
if value_string is not UNSET:
|
|
57
|
+
field_dict["valueString"] = value_string
|
|
58
|
+
if value_number is not UNSET:
|
|
59
|
+
field_dict["valueNumber"] = value_number
|
|
60
|
+
if value_date is not UNSET:
|
|
61
|
+
field_dict["valueDate"] = value_date
|
|
62
|
+
|
|
63
|
+
return field_dict
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
67
|
+
d = dict(src_dict)
|
|
68
|
+
key = d.pop("key", UNSET)
|
|
69
|
+
|
|
70
|
+
def _parse_value_string(data: object) -> Union[None, Unset, str]:
|
|
71
|
+
if data is None:
|
|
72
|
+
return data
|
|
73
|
+
if isinstance(data, Unset):
|
|
74
|
+
return data
|
|
75
|
+
return cast(Union[None, Unset, str], data)
|
|
76
|
+
|
|
77
|
+
value_string = _parse_value_string(d.pop("valueString", UNSET))
|
|
78
|
+
|
|
79
|
+
def _parse_value_number(data: object) -> Union[None, Unset, float]:
|
|
80
|
+
if data is None:
|
|
81
|
+
return data
|
|
82
|
+
if isinstance(data, Unset):
|
|
83
|
+
return data
|
|
84
|
+
return cast(Union[None, Unset, float], data)
|
|
85
|
+
|
|
86
|
+
value_number = _parse_value_number(d.pop("valueNumber", UNSET))
|
|
87
|
+
|
|
88
|
+
def _parse_value_date(data: object) -> Union[None, Unset, datetime.datetime]:
|
|
89
|
+
if data is None:
|
|
90
|
+
return data
|
|
91
|
+
if isinstance(data, Unset):
|
|
92
|
+
return data
|
|
93
|
+
try:
|
|
94
|
+
if not isinstance(data, str):
|
|
95
|
+
raise TypeError()
|
|
96
|
+
value_date_type_0 = isoparse(data)
|
|
97
|
+
|
|
98
|
+
return value_date_type_0
|
|
99
|
+
except: # noqa: E722
|
|
100
|
+
pass
|
|
101
|
+
return cast(Union[None, Unset, datetime.datetime], data)
|
|
102
|
+
|
|
103
|
+
value_date = _parse_value_date(d.pop("valueDate", UNSET))
|
|
104
|
+
|
|
105
|
+
form_field = cls(
|
|
106
|
+
key=key,
|
|
107
|
+
value_string=value_string,
|
|
108
|
+
value_number=value_number,
|
|
109
|
+
value_date=value_date,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
return form_field
|