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
minikai/models/record.py
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
from ..types import UNSET, Unset
|
|
8
|
+
|
|
9
|
+
from ..types import UNSET, Unset
|
|
10
|
+
from dateutil.parser import isoparse
|
|
11
|
+
from typing import cast
|
|
12
|
+
from typing import cast, Union
|
|
13
|
+
from typing import Union
|
|
14
|
+
import datetime
|
|
15
|
+
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from ..models.record_authorization import RecordAuthorization
|
|
18
|
+
from ..models.record_attachment import RecordAttachment
|
|
19
|
+
from ..models.record_relation import RecordRelation
|
|
20
|
+
from ..models.record_tag import RecordTag
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
T = TypeVar("T", bound="Record")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@_attrs_define
|
|
31
|
+
class Record:
|
|
32
|
+
"""
|
|
33
|
+
Attributes:
|
|
34
|
+
id (Union[Unset, str]):
|
|
35
|
+
organization_id (Union[Unset, str]):
|
|
36
|
+
title (Union[Unset, str]):
|
|
37
|
+
description (Union[None, Unset, str]):
|
|
38
|
+
created_at (Union[Unset, datetime.datetime]):
|
|
39
|
+
updated_at (Union[Unset, datetime.datetime]):
|
|
40
|
+
event_date (Union[None, Unset, datetime.datetime]):
|
|
41
|
+
created_by (Union[Unset, str]):
|
|
42
|
+
updated_by (Union[None, Unset, str]):
|
|
43
|
+
searchable (Union[Unset, bool]):
|
|
44
|
+
ttl (Union[None, Unset, int]):
|
|
45
|
+
archived (Union[Unset, bool]):
|
|
46
|
+
schema (Union[Unset, Any]):
|
|
47
|
+
content (Union[Unset, Any]):
|
|
48
|
+
content_text (Union[None, Unset, str]):
|
|
49
|
+
attachments (Union[Unset, list['RecordAttachment']]):
|
|
50
|
+
authorization (Union[Unset, RecordAuthorization]):
|
|
51
|
+
relations (Union[Unset, list['RecordRelation']]):
|
|
52
|
+
external_uri (Union[None, Unset, str]):
|
|
53
|
+
labels (Union[Unset, list[str]]):
|
|
54
|
+
tags (Union[Unset, list['RecordTag']]):
|
|
55
|
+
field_etag (Union[None, Unset, str]):
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
id: Union[Unset, str] = UNSET
|
|
59
|
+
organization_id: Union[Unset, str] = UNSET
|
|
60
|
+
title: Union[Unset, str] = UNSET
|
|
61
|
+
description: Union[None, Unset, str] = UNSET
|
|
62
|
+
created_at: Union[Unset, datetime.datetime] = UNSET
|
|
63
|
+
updated_at: Union[Unset, datetime.datetime] = UNSET
|
|
64
|
+
event_date: Union[None, Unset, datetime.datetime] = UNSET
|
|
65
|
+
created_by: Union[Unset, str] = UNSET
|
|
66
|
+
updated_by: Union[None, Unset, str] = UNSET
|
|
67
|
+
searchable: Union[Unset, bool] = UNSET
|
|
68
|
+
ttl: Union[None, Unset, int] = UNSET
|
|
69
|
+
archived: Union[Unset, bool] = UNSET
|
|
70
|
+
schema: Union[Unset, Any] = UNSET
|
|
71
|
+
content: Union[Unset, Any] = UNSET
|
|
72
|
+
content_text: Union[None, Unset, str] = UNSET
|
|
73
|
+
attachments: Union[Unset, list['RecordAttachment']] = UNSET
|
|
74
|
+
authorization: Union[Unset, 'RecordAuthorization'] = UNSET
|
|
75
|
+
relations: Union[Unset, list['RecordRelation']] = UNSET
|
|
76
|
+
external_uri: Union[None, Unset, str] = UNSET
|
|
77
|
+
labels: Union[Unset, list[str]] = UNSET
|
|
78
|
+
tags: Union[Unset, list['RecordTag']] = UNSET
|
|
79
|
+
field_etag: Union[None, Unset, str] = UNSET
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def to_dict(self) -> dict[str, Any]:
|
|
86
|
+
from ..models.record_authorization import RecordAuthorization
|
|
87
|
+
from ..models.record_attachment import RecordAttachment
|
|
88
|
+
from ..models.record_relation import RecordRelation
|
|
89
|
+
from ..models.record_tag import RecordTag
|
|
90
|
+
id = self.id
|
|
91
|
+
|
|
92
|
+
organization_id = self.organization_id
|
|
93
|
+
|
|
94
|
+
title = self.title
|
|
95
|
+
|
|
96
|
+
description: Union[None, Unset, str]
|
|
97
|
+
if isinstance(self.description, Unset):
|
|
98
|
+
description = UNSET
|
|
99
|
+
else:
|
|
100
|
+
description = self.description
|
|
101
|
+
|
|
102
|
+
created_at: Union[Unset, str] = UNSET
|
|
103
|
+
if not isinstance(self.created_at, Unset):
|
|
104
|
+
created_at = self.created_at.isoformat()
|
|
105
|
+
|
|
106
|
+
updated_at: Union[Unset, str] = UNSET
|
|
107
|
+
if not isinstance(self.updated_at, Unset):
|
|
108
|
+
updated_at = self.updated_at.isoformat()
|
|
109
|
+
|
|
110
|
+
event_date: Union[None, Unset, str]
|
|
111
|
+
if isinstance(self.event_date, Unset):
|
|
112
|
+
event_date = UNSET
|
|
113
|
+
elif isinstance(self.event_date, datetime.datetime):
|
|
114
|
+
event_date = self.event_date.isoformat()
|
|
115
|
+
else:
|
|
116
|
+
event_date = self.event_date
|
|
117
|
+
|
|
118
|
+
created_by = self.created_by
|
|
119
|
+
|
|
120
|
+
updated_by: Union[None, Unset, str]
|
|
121
|
+
if isinstance(self.updated_by, Unset):
|
|
122
|
+
updated_by = UNSET
|
|
123
|
+
else:
|
|
124
|
+
updated_by = self.updated_by
|
|
125
|
+
|
|
126
|
+
searchable = self.searchable
|
|
127
|
+
|
|
128
|
+
ttl: Union[None, Unset, int]
|
|
129
|
+
if isinstance(self.ttl, Unset):
|
|
130
|
+
ttl = UNSET
|
|
131
|
+
else:
|
|
132
|
+
ttl = self.ttl
|
|
133
|
+
|
|
134
|
+
archived = self.archived
|
|
135
|
+
|
|
136
|
+
schema = self.schema
|
|
137
|
+
|
|
138
|
+
content = self.content
|
|
139
|
+
|
|
140
|
+
content_text: Union[None, Unset, str]
|
|
141
|
+
if isinstance(self.content_text, Unset):
|
|
142
|
+
content_text = UNSET
|
|
143
|
+
else:
|
|
144
|
+
content_text = self.content_text
|
|
145
|
+
|
|
146
|
+
attachments: Union[Unset, list[dict[str, Any]]] = UNSET
|
|
147
|
+
if not isinstance(self.attachments, Unset):
|
|
148
|
+
attachments = []
|
|
149
|
+
for attachments_item_data in self.attachments:
|
|
150
|
+
attachments_item = attachments_item_data.to_dict()
|
|
151
|
+
attachments.append(attachments_item)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
authorization: Union[Unset, dict[str, Any]] = UNSET
|
|
156
|
+
if not isinstance(self.authorization, Unset):
|
|
157
|
+
authorization = self.authorization.to_dict()
|
|
158
|
+
|
|
159
|
+
relations: Union[Unset, list[dict[str, Any]]] = UNSET
|
|
160
|
+
if not isinstance(self.relations, Unset):
|
|
161
|
+
relations = []
|
|
162
|
+
for relations_item_data in self.relations:
|
|
163
|
+
relations_item = relations_item_data.to_dict()
|
|
164
|
+
relations.append(relations_item)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
external_uri: Union[None, Unset, str]
|
|
169
|
+
if isinstance(self.external_uri, Unset):
|
|
170
|
+
external_uri = UNSET
|
|
171
|
+
else:
|
|
172
|
+
external_uri = self.external_uri
|
|
173
|
+
|
|
174
|
+
labels: Union[Unset, list[str]] = UNSET
|
|
175
|
+
if not isinstance(self.labels, Unset):
|
|
176
|
+
labels = self.labels
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
tags: Union[Unset, list[dict[str, Any]]] = UNSET
|
|
181
|
+
if not isinstance(self.tags, Unset):
|
|
182
|
+
tags = []
|
|
183
|
+
for tags_item_data in self.tags:
|
|
184
|
+
tags_item = tags_item_data.to_dict()
|
|
185
|
+
tags.append(tags_item)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
field_etag: Union[None, Unset, str]
|
|
190
|
+
if isinstance(self.field_etag, Unset):
|
|
191
|
+
field_etag = UNSET
|
|
192
|
+
else:
|
|
193
|
+
field_etag = self.field_etag
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
field_dict: dict[str, Any] = {}
|
|
197
|
+
|
|
198
|
+
field_dict.update({
|
|
199
|
+
})
|
|
200
|
+
if id is not UNSET:
|
|
201
|
+
field_dict["id"] = id
|
|
202
|
+
if organization_id is not UNSET:
|
|
203
|
+
field_dict["organizationId"] = organization_id
|
|
204
|
+
if title is not UNSET:
|
|
205
|
+
field_dict["title"] = title
|
|
206
|
+
if description is not UNSET:
|
|
207
|
+
field_dict["description"] = description
|
|
208
|
+
if created_at is not UNSET:
|
|
209
|
+
field_dict["createdAt"] = created_at
|
|
210
|
+
if updated_at is not UNSET:
|
|
211
|
+
field_dict["updatedAt"] = updated_at
|
|
212
|
+
if event_date is not UNSET:
|
|
213
|
+
field_dict["eventDate"] = event_date
|
|
214
|
+
if created_by is not UNSET:
|
|
215
|
+
field_dict["createdBy"] = created_by
|
|
216
|
+
if updated_by is not UNSET:
|
|
217
|
+
field_dict["updatedBy"] = updated_by
|
|
218
|
+
if searchable is not UNSET:
|
|
219
|
+
field_dict["searchable"] = searchable
|
|
220
|
+
if ttl is not UNSET:
|
|
221
|
+
field_dict["ttl"] = ttl
|
|
222
|
+
if archived is not UNSET:
|
|
223
|
+
field_dict["archived"] = archived
|
|
224
|
+
if schema is not UNSET:
|
|
225
|
+
field_dict["schema"] = schema
|
|
226
|
+
if content is not UNSET:
|
|
227
|
+
field_dict["content"] = content
|
|
228
|
+
if content_text is not UNSET:
|
|
229
|
+
field_dict["contentText"] = content_text
|
|
230
|
+
if attachments is not UNSET:
|
|
231
|
+
field_dict["attachments"] = attachments
|
|
232
|
+
if authorization is not UNSET:
|
|
233
|
+
field_dict["authorization"] = authorization
|
|
234
|
+
if relations is not UNSET:
|
|
235
|
+
field_dict["relations"] = relations
|
|
236
|
+
if external_uri is not UNSET:
|
|
237
|
+
field_dict["externalUri"] = external_uri
|
|
238
|
+
if labels is not UNSET:
|
|
239
|
+
field_dict["labels"] = labels
|
|
240
|
+
if tags is not UNSET:
|
|
241
|
+
field_dict["tags"] = tags
|
|
242
|
+
if field_etag is not UNSET:
|
|
243
|
+
field_dict["_etag"] = field_etag
|
|
244
|
+
|
|
245
|
+
return field_dict
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
@classmethod
|
|
250
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
251
|
+
from ..models.record_authorization import RecordAuthorization
|
|
252
|
+
from ..models.record_attachment import RecordAttachment
|
|
253
|
+
from ..models.record_relation import RecordRelation
|
|
254
|
+
from ..models.record_tag import RecordTag
|
|
255
|
+
d = dict(src_dict)
|
|
256
|
+
id = d.pop("id", UNSET)
|
|
257
|
+
|
|
258
|
+
organization_id = d.pop("organizationId", UNSET)
|
|
259
|
+
|
|
260
|
+
title = d.pop("title", UNSET)
|
|
261
|
+
|
|
262
|
+
def _parse_description(data: object) -> Union[None, Unset, str]:
|
|
263
|
+
if data is None:
|
|
264
|
+
return data
|
|
265
|
+
if isinstance(data, Unset):
|
|
266
|
+
return data
|
|
267
|
+
return cast(Union[None, Unset, str], data)
|
|
268
|
+
|
|
269
|
+
description = _parse_description(d.pop("description", UNSET))
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
_created_at = d.pop("createdAt", UNSET)
|
|
273
|
+
created_at: Union[Unset, datetime.datetime]
|
|
274
|
+
if isinstance(_created_at, Unset):
|
|
275
|
+
created_at = UNSET
|
|
276
|
+
else:
|
|
277
|
+
created_at = isoparse(_created_at)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
_updated_at = d.pop("updatedAt", UNSET)
|
|
283
|
+
updated_at: Union[Unset, datetime.datetime]
|
|
284
|
+
if isinstance(_updated_at, Unset):
|
|
285
|
+
updated_at = UNSET
|
|
286
|
+
else:
|
|
287
|
+
updated_at = isoparse(_updated_at)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def _parse_event_date(data: object) -> Union[None, Unset, datetime.datetime]:
|
|
293
|
+
if data is None:
|
|
294
|
+
return data
|
|
295
|
+
if isinstance(data, Unset):
|
|
296
|
+
return data
|
|
297
|
+
try:
|
|
298
|
+
if not isinstance(data, str):
|
|
299
|
+
raise TypeError()
|
|
300
|
+
event_date_type_0 = isoparse(data)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
return event_date_type_0
|
|
305
|
+
except: # noqa: E722
|
|
306
|
+
pass
|
|
307
|
+
return cast(Union[None, Unset, datetime.datetime], data)
|
|
308
|
+
|
|
309
|
+
event_date = _parse_event_date(d.pop("eventDate", UNSET))
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
created_by = d.pop("createdBy", UNSET)
|
|
313
|
+
|
|
314
|
+
def _parse_updated_by(data: object) -> Union[None, Unset, str]:
|
|
315
|
+
if data is None:
|
|
316
|
+
return data
|
|
317
|
+
if isinstance(data, Unset):
|
|
318
|
+
return data
|
|
319
|
+
return cast(Union[None, Unset, str], data)
|
|
320
|
+
|
|
321
|
+
updated_by = _parse_updated_by(d.pop("updatedBy", UNSET))
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
searchable = d.pop("searchable", UNSET)
|
|
325
|
+
|
|
326
|
+
def _parse_ttl(data: object) -> Union[None, Unset, int]:
|
|
327
|
+
if data is None:
|
|
328
|
+
return data
|
|
329
|
+
if isinstance(data, Unset):
|
|
330
|
+
return data
|
|
331
|
+
return cast(Union[None, Unset, int], data)
|
|
332
|
+
|
|
333
|
+
ttl = _parse_ttl(d.pop("ttl", UNSET))
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
archived = d.pop("archived", UNSET)
|
|
337
|
+
|
|
338
|
+
schema = d.pop("schema", UNSET)
|
|
339
|
+
|
|
340
|
+
content = d.pop("content", UNSET)
|
|
341
|
+
|
|
342
|
+
def _parse_content_text(data: object) -> Union[None, Unset, str]:
|
|
343
|
+
if data is None:
|
|
344
|
+
return data
|
|
345
|
+
if isinstance(data, Unset):
|
|
346
|
+
return data
|
|
347
|
+
return cast(Union[None, Unset, str], data)
|
|
348
|
+
|
|
349
|
+
content_text = _parse_content_text(d.pop("contentText", UNSET))
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
attachments = []
|
|
353
|
+
_attachments = d.pop("attachments", UNSET)
|
|
354
|
+
for attachments_item_data in (_attachments or []):
|
|
355
|
+
attachments_item = RecordAttachment.from_dict(attachments_item_data)
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
attachments.append(attachments_item)
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
_authorization = d.pop("authorization", UNSET)
|
|
363
|
+
authorization: Union[Unset, RecordAuthorization]
|
|
364
|
+
if isinstance(_authorization, Unset):
|
|
365
|
+
authorization = UNSET
|
|
366
|
+
else:
|
|
367
|
+
authorization = RecordAuthorization.from_dict(_authorization)
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
relations = []
|
|
373
|
+
_relations = d.pop("relations", UNSET)
|
|
374
|
+
for relations_item_data in (_relations or []):
|
|
375
|
+
relations_item = RecordRelation.from_dict(relations_item_data)
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
relations.append(relations_item)
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
def _parse_external_uri(data: object) -> Union[None, Unset, str]:
|
|
383
|
+
if data is None:
|
|
384
|
+
return data
|
|
385
|
+
if isinstance(data, Unset):
|
|
386
|
+
return data
|
|
387
|
+
return cast(Union[None, Unset, str], data)
|
|
388
|
+
|
|
389
|
+
external_uri = _parse_external_uri(d.pop("externalUri", UNSET))
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
labels = cast(list[str], d.pop("labels", UNSET))
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
tags = []
|
|
396
|
+
_tags = d.pop("tags", UNSET)
|
|
397
|
+
for tags_item_data in (_tags or []):
|
|
398
|
+
tags_item = RecordTag.from_dict(tags_item_data)
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
tags.append(tags_item)
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
def _parse_field_etag(data: object) -> Union[None, Unset, str]:
|
|
406
|
+
if data is None:
|
|
407
|
+
return data
|
|
408
|
+
if isinstance(data, Unset):
|
|
409
|
+
return data
|
|
410
|
+
return cast(Union[None, Unset, str], data)
|
|
411
|
+
|
|
412
|
+
field_etag = _parse_field_etag(d.pop("_etag", UNSET))
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
record = cls(
|
|
416
|
+
id=id,
|
|
417
|
+
organization_id=organization_id,
|
|
418
|
+
title=title,
|
|
419
|
+
description=description,
|
|
420
|
+
created_at=created_at,
|
|
421
|
+
updated_at=updated_at,
|
|
422
|
+
event_date=event_date,
|
|
423
|
+
created_by=created_by,
|
|
424
|
+
updated_by=updated_by,
|
|
425
|
+
searchable=searchable,
|
|
426
|
+
ttl=ttl,
|
|
427
|
+
archived=archived,
|
|
428
|
+
schema=schema,
|
|
429
|
+
content=content,
|
|
430
|
+
content_text=content_text,
|
|
431
|
+
attachments=attachments,
|
|
432
|
+
authorization=authorization,
|
|
433
|
+
relations=relations,
|
|
434
|
+
external_uri=external_uri,
|
|
435
|
+
labels=labels,
|
|
436
|
+
tags=tags,
|
|
437
|
+
field_etag=field_etag,
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
return record
|
|
441
|
+
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
from ..types import UNSET, Unset
|
|
8
|
+
|
|
9
|
+
from ..types import UNSET, Unset
|
|
10
|
+
from dateutil.parser import isoparse
|
|
11
|
+
from typing import cast
|
|
12
|
+
from typing import cast, Union
|
|
13
|
+
from typing import Union
|
|
14
|
+
import datetime
|
|
15
|
+
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from ..models.record_attachment_metadata_type_0 import RecordAttachmentMetadataType0
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
T = TypeVar("T", bound="RecordAttachment")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@_attrs_define
|
|
28
|
+
class RecordAttachment:
|
|
29
|
+
"""
|
|
30
|
+
Attributes:
|
|
31
|
+
id (Union[Unset, str]):
|
|
32
|
+
file_name (Union[Unset, str]):
|
|
33
|
+
content_type (Union[Unset, str]):
|
|
34
|
+
size (Union[Unset, int]):
|
|
35
|
+
checksum (Union[None, Unset, str]):
|
|
36
|
+
uri (Union[Unset, str]):
|
|
37
|
+
created_at (Union[None, Unset, datetime.datetime]):
|
|
38
|
+
updated_at (Union[None, Unset, datetime.datetime]):
|
|
39
|
+
created_by (Union[None, Unset, str]):
|
|
40
|
+
updated_by (Union[None, Unset, str]):
|
|
41
|
+
metadata (Union['RecordAttachmentMetadataType0', None, Unset]):
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
id: Union[Unset, str] = UNSET
|
|
45
|
+
file_name: Union[Unset, str] = UNSET
|
|
46
|
+
content_type: Union[Unset, str] = UNSET
|
|
47
|
+
size: Union[Unset, int] = UNSET
|
|
48
|
+
checksum: Union[None, Unset, str] = UNSET
|
|
49
|
+
uri: Union[Unset, str] = UNSET
|
|
50
|
+
created_at: Union[None, Unset, datetime.datetime] = UNSET
|
|
51
|
+
updated_at: Union[None, Unset, datetime.datetime] = UNSET
|
|
52
|
+
created_by: Union[None, Unset, str] = UNSET
|
|
53
|
+
updated_by: Union[None, Unset, str] = UNSET
|
|
54
|
+
metadata: Union['RecordAttachmentMetadataType0', None, Unset] = UNSET
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def to_dict(self) -> dict[str, Any]:
|
|
61
|
+
from ..models.record_attachment_metadata_type_0 import RecordAttachmentMetadataType0
|
|
62
|
+
id = self.id
|
|
63
|
+
|
|
64
|
+
file_name = self.file_name
|
|
65
|
+
|
|
66
|
+
content_type = self.content_type
|
|
67
|
+
|
|
68
|
+
size = self.size
|
|
69
|
+
|
|
70
|
+
checksum: Union[None, Unset, str]
|
|
71
|
+
if isinstance(self.checksum, Unset):
|
|
72
|
+
checksum = UNSET
|
|
73
|
+
else:
|
|
74
|
+
checksum = self.checksum
|
|
75
|
+
|
|
76
|
+
uri = self.uri
|
|
77
|
+
|
|
78
|
+
created_at: Union[None, Unset, str]
|
|
79
|
+
if isinstance(self.created_at, Unset):
|
|
80
|
+
created_at = UNSET
|
|
81
|
+
elif isinstance(self.created_at, datetime.datetime):
|
|
82
|
+
created_at = self.created_at.isoformat()
|
|
83
|
+
else:
|
|
84
|
+
created_at = self.created_at
|
|
85
|
+
|
|
86
|
+
updated_at: Union[None, Unset, str]
|
|
87
|
+
if isinstance(self.updated_at, Unset):
|
|
88
|
+
updated_at = UNSET
|
|
89
|
+
elif isinstance(self.updated_at, datetime.datetime):
|
|
90
|
+
updated_at = self.updated_at.isoformat()
|
|
91
|
+
else:
|
|
92
|
+
updated_at = self.updated_at
|
|
93
|
+
|
|
94
|
+
created_by: Union[None, Unset, str]
|
|
95
|
+
if isinstance(self.created_by, Unset):
|
|
96
|
+
created_by = UNSET
|
|
97
|
+
else:
|
|
98
|
+
created_by = self.created_by
|
|
99
|
+
|
|
100
|
+
updated_by: Union[None, Unset, str]
|
|
101
|
+
if isinstance(self.updated_by, Unset):
|
|
102
|
+
updated_by = UNSET
|
|
103
|
+
else:
|
|
104
|
+
updated_by = self.updated_by
|
|
105
|
+
|
|
106
|
+
metadata: Union[None, Unset, dict[str, Any]]
|
|
107
|
+
if isinstance(self.metadata, Unset):
|
|
108
|
+
metadata = UNSET
|
|
109
|
+
elif isinstance(self.metadata, RecordAttachmentMetadataType0):
|
|
110
|
+
metadata = self.metadata.to_dict()
|
|
111
|
+
else:
|
|
112
|
+
metadata = self.metadata
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
field_dict: dict[str, Any] = {}
|
|
116
|
+
|
|
117
|
+
field_dict.update({
|
|
118
|
+
})
|
|
119
|
+
if id is not UNSET:
|
|
120
|
+
field_dict["id"] = id
|
|
121
|
+
if file_name is not UNSET:
|
|
122
|
+
field_dict["fileName"] = file_name
|
|
123
|
+
if content_type is not UNSET:
|
|
124
|
+
field_dict["contentType"] = content_type
|
|
125
|
+
if size is not UNSET:
|
|
126
|
+
field_dict["size"] = size
|
|
127
|
+
if checksum is not UNSET:
|
|
128
|
+
field_dict["checksum"] = checksum
|
|
129
|
+
if uri is not UNSET:
|
|
130
|
+
field_dict["uri"] = uri
|
|
131
|
+
if created_at is not UNSET:
|
|
132
|
+
field_dict["createdAt"] = created_at
|
|
133
|
+
if updated_at is not UNSET:
|
|
134
|
+
field_dict["updatedAt"] = updated_at
|
|
135
|
+
if created_by is not UNSET:
|
|
136
|
+
field_dict["createdBy"] = created_by
|
|
137
|
+
if updated_by is not UNSET:
|
|
138
|
+
field_dict["updatedBy"] = updated_by
|
|
139
|
+
if metadata is not UNSET:
|
|
140
|
+
field_dict["metadata"] = metadata
|
|
141
|
+
|
|
142
|
+
return field_dict
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
@classmethod
|
|
147
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
148
|
+
from ..models.record_attachment_metadata_type_0 import RecordAttachmentMetadataType0
|
|
149
|
+
d = dict(src_dict)
|
|
150
|
+
id = d.pop("id", UNSET)
|
|
151
|
+
|
|
152
|
+
file_name = d.pop("fileName", UNSET)
|
|
153
|
+
|
|
154
|
+
content_type = d.pop("contentType", UNSET)
|
|
155
|
+
|
|
156
|
+
size = d.pop("size", UNSET)
|
|
157
|
+
|
|
158
|
+
def _parse_checksum(data: object) -> Union[None, Unset, str]:
|
|
159
|
+
if data is None:
|
|
160
|
+
return data
|
|
161
|
+
if isinstance(data, Unset):
|
|
162
|
+
return data
|
|
163
|
+
return cast(Union[None, Unset, str], data)
|
|
164
|
+
|
|
165
|
+
checksum = _parse_checksum(d.pop("checksum", UNSET))
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
uri = d.pop("uri", UNSET)
|
|
169
|
+
|
|
170
|
+
def _parse_created_at(data: object) -> Union[None, Unset, datetime.datetime]:
|
|
171
|
+
if data is None:
|
|
172
|
+
return data
|
|
173
|
+
if isinstance(data, Unset):
|
|
174
|
+
return data
|
|
175
|
+
try:
|
|
176
|
+
if not isinstance(data, str):
|
|
177
|
+
raise TypeError()
|
|
178
|
+
created_at_type_0 = isoparse(data)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
return created_at_type_0
|
|
183
|
+
except: # noqa: E722
|
|
184
|
+
pass
|
|
185
|
+
return cast(Union[None, Unset, datetime.datetime], data)
|
|
186
|
+
|
|
187
|
+
created_at = _parse_created_at(d.pop("createdAt", UNSET))
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def _parse_updated_at(data: object) -> Union[None, Unset, datetime.datetime]:
|
|
191
|
+
if data is None:
|
|
192
|
+
return data
|
|
193
|
+
if isinstance(data, Unset):
|
|
194
|
+
return data
|
|
195
|
+
try:
|
|
196
|
+
if not isinstance(data, str):
|
|
197
|
+
raise TypeError()
|
|
198
|
+
updated_at_type_0 = isoparse(data)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
return updated_at_type_0
|
|
203
|
+
except: # noqa: E722
|
|
204
|
+
pass
|
|
205
|
+
return cast(Union[None, Unset, datetime.datetime], data)
|
|
206
|
+
|
|
207
|
+
updated_at = _parse_updated_at(d.pop("updatedAt", UNSET))
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def _parse_created_by(data: object) -> Union[None, Unset, str]:
|
|
211
|
+
if data is None:
|
|
212
|
+
return data
|
|
213
|
+
if isinstance(data, Unset):
|
|
214
|
+
return data
|
|
215
|
+
return cast(Union[None, Unset, str], data)
|
|
216
|
+
|
|
217
|
+
created_by = _parse_created_by(d.pop("createdBy", UNSET))
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def _parse_updated_by(data: object) -> Union[None, Unset, str]:
|
|
221
|
+
if data is None:
|
|
222
|
+
return data
|
|
223
|
+
if isinstance(data, Unset):
|
|
224
|
+
return data
|
|
225
|
+
return cast(Union[None, Unset, str], data)
|
|
226
|
+
|
|
227
|
+
updated_by = _parse_updated_by(d.pop("updatedBy", UNSET))
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def _parse_metadata(data: object) -> Union['RecordAttachmentMetadataType0', None, Unset]:
|
|
231
|
+
if data is None:
|
|
232
|
+
return data
|
|
233
|
+
if isinstance(data, Unset):
|
|
234
|
+
return data
|
|
235
|
+
try:
|
|
236
|
+
if not isinstance(data, dict):
|
|
237
|
+
raise TypeError()
|
|
238
|
+
metadata_type_0 = RecordAttachmentMetadataType0.from_dict(data)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
return metadata_type_0
|
|
243
|
+
except: # noqa: E722
|
|
244
|
+
pass
|
|
245
|
+
return cast(Union['RecordAttachmentMetadataType0', None, Unset], data)
|
|
246
|
+
|
|
247
|
+
metadata = _parse_metadata(d.pop("metadata", UNSET))
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
record_attachment = cls(
|
|
251
|
+
id=id,
|
|
252
|
+
file_name=file_name,
|
|
253
|
+
content_type=content_type,
|
|
254
|
+
size=size,
|
|
255
|
+
checksum=checksum,
|
|
256
|
+
uri=uri,
|
|
257
|
+
created_at=created_at,
|
|
258
|
+
updated_at=updated_at,
|
|
259
|
+
created_by=created_by,
|
|
260
|
+
updated_by=updated_by,
|
|
261
|
+
metadata=metadata,
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
return record_attachment
|
|
265
|
+
|