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.

Files changed (87) hide show
  1. minikai/__init__.py +8 -0
  2. minikai/api/__init__.py +1 -0
  3. minikai/api/groups/__init__.py +1 -0
  4. minikai/api/groups/add_minis_to_group.py +176 -0
  5. minikai/api/groups/add_users_to_group.py +176 -0
  6. minikai/api/groups/create_group.py +160 -0
  7. minikai/api/groups/delete_group.py +95 -0
  8. minikai/api/groups/get_group.py +151 -0
  9. minikai/api/groups/get_group_minis.py +156 -0
  10. minikai/api/groups/get_group_users.py +156 -0
  11. minikai/api/groups/get_groups.py +128 -0
  12. minikai/api/groups/remove_minis_from_group.py +176 -0
  13. minikai/api/groups/remove_users_from_group.py +176 -0
  14. minikai/api/groups/update_group.py +177 -0
  15. minikai/api/minis/__init__.py +1 -0
  16. minikai/api/minis/create_mini.py +160 -0
  17. minikai/api/minis/delete_mini.py +95 -0
  18. minikai/api/minis/get_external_mini.py +164 -0
  19. minikai/api/minis/get_minis.py +128 -0
  20. minikai/api/minis/patch_mini.py +177 -0
  21. minikai/api/minis/update_mini.py +177 -0
  22. minikai/api/records/__init__.py +1 -0
  23. minikai/api/records/add_attachments.py +182 -0
  24. minikai/api/records/add_relations.py +187 -0
  25. minikai/api/records/create_record.py +162 -0
  26. minikai/api/records/delete_record.py +95 -0
  27. minikai/api/records/get_records_by_external.py +230 -0
  28. minikai/api/records/remove_attachments.py +110 -0
  29. minikai/api/records/remove_relations.py +110 -0
  30. minikai/api/records/update_attachments.py +182 -0
  31. minikai/api/records/update_record.py +179 -0
  32. minikai/api/records/update_relations.py +187 -0
  33. minikai/api/users/__init__.py +1 -0
  34. minikai/api/users/delete_api_users_minis.py +102 -0
  35. minikai/api/users/get_api_users_minis.py +156 -0
  36. minikai/api/users/get_users.py +128 -0
  37. minikai/api/users/post_api_users_minis.py +168 -0
  38. minikai/client.py +268 -0
  39. minikai/errors.py +16 -0
  40. minikai/models/__init__.py +89 -0
  41. minikai/models/add_attachments_body.py +98 -0
  42. minikai/models/create_group_command.py +102 -0
  43. minikai/models/create_mini_command.py +120 -0
  44. minikai/models/create_record_command.py +268 -0
  45. minikai/models/create_record_command_tags.py +44 -0
  46. minikai/models/document_file_dto.py +147 -0
  47. minikai/models/form_field.py +112 -0
  48. minikai/models/form_field_dto.py +149 -0
  49. minikai/models/form_field_type.py +16 -0
  50. minikai/models/group_dto.py +124 -0
  51. minikai/models/http_validation_problem_details.py +173 -0
  52. minikai/models/http_validation_problem_details_errors.py +51 -0
  53. minikai/models/json_node.py +119 -0
  54. minikai/models/json_node_options.py +42 -0
  55. minikai/models/mini_dto.py +189 -0
  56. minikai/models/mini_template_dto.py +135 -0
  57. minikai/models/paginated_list_of_record_dto.py +101 -0
  58. minikai/models/patch_mini_command.py +80 -0
  59. minikai/models/problem_details.py +151 -0
  60. minikai/models/record.py +379 -0
  61. minikai/models/record_attachment.py +236 -0
  62. minikai/models/record_attachment_dto.py +236 -0
  63. minikai/models/record_attachment_dto_metadata_type_0.py +44 -0
  64. minikai/models/record_attachment_metadata_type_0.py +44 -0
  65. minikai/models/record_authorization.py +75 -0
  66. minikai/models/record_authorization_dto.py +75 -0
  67. minikai/models/record_dto.py +377 -0
  68. minikai/models/record_dto_tags.py +44 -0
  69. minikai/models/record_relation.py +81 -0
  70. minikai/models/record_relation_dto.py +81 -0
  71. minikai/models/record_tags.py +44 -0
  72. minikai/models/slim_mini_dto.py +168 -0
  73. minikai/models/tool_dto.py +76 -0
  74. minikai/models/update_attachments_body.py +98 -0
  75. minikai/models/update_group_command.py +122 -0
  76. minikai/models/update_mini_command.py +129 -0
  77. minikai/models/update_mini_template_workspaces_command.py +51 -0
  78. minikai/models/update_record_command.py +266 -0
  79. minikai/models/update_record_command_tags.py +44 -0
  80. minikai/models/user_dto.py +182 -0
  81. minikai/models/user_to_mini_dto.py +78 -0
  82. minikai/models/workspace_dto.py +78 -0
  83. minikai/py.typed +1 -0
  84. minikai/types.py +54 -0
  85. minikai-0.1.0.dist-info/METADATA +133 -0
  86. minikai-0.1.0.dist-info/RECORD +87 -0
  87. minikai-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,379 @@
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.json_node import JsonNode
12
+ from ..models.record_attachment import RecordAttachment
13
+ from ..models.record_authorization import RecordAuthorization
14
+ from ..models.record_relation import RecordRelation
15
+ from ..models.record_tags import RecordTags
16
+
17
+
18
+ T = TypeVar("T", bound="Record")
19
+
20
+
21
+ @_attrs_define
22
+ class Record:
23
+ """
24
+ Attributes:
25
+ id (Union[Unset, str]):
26
+ organization_id (Union[Unset, str]):
27
+ title (Union[Unset, str]):
28
+ description (Union[None, Unset, str]):
29
+ created_at (Union[Unset, datetime.datetime]):
30
+ event_date (Union[None, Unset, datetime.datetime]):
31
+ created_by (Union[Unset, str]):
32
+ updated_by (Union[None, Unset, str]):
33
+ searchable (Union[Unset, bool]):
34
+ ttl (Union[None, Unset, int]):
35
+ archived (Union[Unset, bool]):
36
+ schema (Union['JsonNode', None, Unset]):
37
+ content (Union['JsonNode', None, Unset]):
38
+ attachments (Union[Unset, list['RecordAttachment']]):
39
+ authorization (Union[Unset, RecordAuthorization]):
40
+ relations (Union[Unset, list['RecordRelation']]):
41
+ external_uri (Union[None, Unset, str]):
42
+ labels (Union[Unset, list[str]]):
43
+ tags (Union[Unset, RecordTags]):
44
+ field_ts (Union[Unset, int]):
45
+ """
46
+
47
+ id: Union[Unset, str] = UNSET
48
+ organization_id: Union[Unset, str] = UNSET
49
+ title: Union[Unset, str] = UNSET
50
+ description: Union[None, Unset, str] = UNSET
51
+ created_at: Union[Unset, datetime.datetime] = UNSET
52
+ event_date: Union[None, Unset, datetime.datetime] = UNSET
53
+ created_by: Union[Unset, str] = UNSET
54
+ updated_by: Union[None, Unset, str] = UNSET
55
+ searchable: Union[Unset, bool] = UNSET
56
+ ttl: Union[None, Unset, int] = UNSET
57
+ archived: Union[Unset, bool] = UNSET
58
+ schema: Union["JsonNode", None, Unset] = UNSET
59
+ content: Union["JsonNode", None, Unset] = UNSET
60
+ attachments: Union[Unset, list["RecordAttachment"]] = UNSET
61
+ authorization: Union[Unset, "RecordAuthorization"] = UNSET
62
+ relations: Union[Unset, list["RecordRelation"]] = UNSET
63
+ external_uri: Union[None, Unset, str] = UNSET
64
+ labels: Union[Unset, list[str]] = UNSET
65
+ tags: Union[Unset, "RecordTags"] = UNSET
66
+ field_ts: Union[Unset, int] = UNSET
67
+
68
+ def to_dict(self) -> dict[str, Any]:
69
+ from ..models.json_node import JsonNode
70
+
71
+ id = self.id
72
+
73
+ organization_id = self.organization_id
74
+
75
+ title = self.title
76
+
77
+ description: Union[None, Unset, str]
78
+ if isinstance(self.description, Unset):
79
+ description = UNSET
80
+ else:
81
+ description = self.description
82
+
83
+ created_at: Union[Unset, str] = UNSET
84
+ if not isinstance(self.created_at, Unset):
85
+ created_at = self.created_at.isoformat()
86
+
87
+ event_date: Union[None, Unset, str]
88
+ if isinstance(self.event_date, Unset):
89
+ event_date = UNSET
90
+ elif isinstance(self.event_date, datetime.datetime):
91
+ event_date = self.event_date.isoformat()
92
+ else:
93
+ event_date = self.event_date
94
+
95
+ created_by = self.created_by
96
+
97
+ updated_by: Union[None, Unset, str]
98
+ if isinstance(self.updated_by, Unset):
99
+ updated_by = UNSET
100
+ else:
101
+ updated_by = self.updated_by
102
+
103
+ searchable = self.searchable
104
+
105
+ ttl: Union[None, Unset, int]
106
+ if isinstance(self.ttl, Unset):
107
+ ttl = UNSET
108
+ else:
109
+ ttl = self.ttl
110
+
111
+ archived = self.archived
112
+
113
+ schema: Union[None, Unset, dict[str, Any]]
114
+ if isinstance(self.schema, Unset):
115
+ schema = UNSET
116
+ elif isinstance(self.schema, JsonNode):
117
+ schema = self.schema.to_dict()
118
+ else:
119
+ schema = self.schema
120
+
121
+ content: Union[None, Unset, dict[str, Any]]
122
+ if isinstance(self.content, Unset):
123
+ content = UNSET
124
+ elif isinstance(self.content, JsonNode):
125
+ content = self.content.to_dict()
126
+ else:
127
+ content = self.content
128
+
129
+ attachments: Union[Unset, list[dict[str, Any]]] = UNSET
130
+ if not isinstance(self.attachments, Unset):
131
+ attachments = []
132
+ for attachments_item_data in self.attachments:
133
+ attachments_item = attachments_item_data.to_dict()
134
+ attachments.append(attachments_item)
135
+
136
+ authorization: Union[Unset, dict[str, Any]] = UNSET
137
+ if not isinstance(self.authorization, Unset):
138
+ authorization = self.authorization.to_dict()
139
+
140
+ relations: Union[Unset, list[dict[str, Any]]] = UNSET
141
+ if not isinstance(self.relations, Unset):
142
+ relations = []
143
+ for relations_item_data in self.relations:
144
+ relations_item = relations_item_data.to_dict()
145
+ relations.append(relations_item)
146
+
147
+ external_uri: Union[None, Unset, str]
148
+ if isinstance(self.external_uri, Unset):
149
+ external_uri = UNSET
150
+ else:
151
+ external_uri = self.external_uri
152
+
153
+ labels: Union[Unset, list[str]] = UNSET
154
+ if not isinstance(self.labels, Unset):
155
+ labels = self.labels
156
+
157
+ tags: Union[Unset, dict[str, Any]] = UNSET
158
+ if not isinstance(self.tags, Unset):
159
+ tags = self.tags.to_dict()
160
+
161
+ field_ts = self.field_ts
162
+
163
+ field_dict: dict[str, Any] = {}
164
+
165
+ field_dict.update({})
166
+ if id is not UNSET:
167
+ field_dict["id"] = id
168
+ if organization_id is not UNSET:
169
+ field_dict["organizationId"] = organization_id
170
+ if title is not UNSET:
171
+ field_dict["title"] = title
172
+ if description is not UNSET:
173
+ field_dict["description"] = description
174
+ if created_at is not UNSET:
175
+ field_dict["createdAt"] = created_at
176
+ if event_date is not UNSET:
177
+ field_dict["eventDate"] = event_date
178
+ if created_by is not UNSET:
179
+ field_dict["createdBy"] = created_by
180
+ if updated_by is not UNSET:
181
+ field_dict["updatedBy"] = updated_by
182
+ if searchable is not UNSET:
183
+ field_dict["searchable"] = searchable
184
+ if ttl is not UNSET:
185
+ field_dict["ttl"] = ttl
186
+ if archived is not UNSET:
187
+ field_dict["archived"] = archived
188
+ if schema is not UNSET:
189
+ field_dict["schema"] = schema
190
+ if content is not UNSET:
191
+ field_dict["content"] = content
192
+ if attachments is not UNSET:
193
+ field_dict["attachments"] = attachments
194
+ if authorization is not UNSET:
195
+ field_dict["authorization"] = authorization
196
+ if relations is not UNSET:
197
+ field_dict["relations"] = relations
198
+ if external_uri is not UNSET:
199
+ field_dict["externalUri"] = external_uri
200
+ if labels is not UNSET:
201
+ field_dict["labels"] = labels
202
+ if tags is not UNSET:
203
+ field_dict["tags"] = tags
204
+ if field_ts is not UNSET:
205
+ field_dict["_ts"] = field_ts
206
+
207
+ return field_dict
208
+
209
+ @classmethod
210
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
211
+ from ..models.json_node import JsonNode
212
+ from ..models.record_attachment import RecordAttachment
213
+ from ..models.record_authorization import RecordAuthorization
214
+ from ..models.record_relation import RecordRelation
215
+ from ..models.record_tags import RecordTags
216
+
217
+ d = dict(src_dict)
218
+ id = d.pop("id", UNSET)
219
+
220
+ organization_id = d.pop("organizationId", UNSET)
221
+
222
+ title = d.pop("title", UNSET)
223
+
224
+ def _parse_description(data: object) -> Union[None, Unset, str]:
225
+ if data is None:
226
+ return data
227
+ if isinstance(data, Unset):
228
+ return data
229
+ return cast(Union[None, Unset, str], data)
230
+
231
+ description = _parse_description(d.pop("description", UNSET))
232
+
233
+ _created_at = d.pop("createdAt", UNSET)
234
+ created_at: Union[Unset, datetime.datetime]
235
+ if isinstance(_created_at, Unset):
236
+ created_at = UNSET
237
+ else:
238
+ created_at = isoparse(_created_at)
239
+
240
+ def _parse_event_date(data: object) -> Union[None, Unset, datetime.datetime]:
241
+ if data is None:
242
+ return data
243
+ if isinstance(data, Unset):
244
+ return data
245
+ try:
246
+ if not isinstance(data, str):
247
+ raise TypeError()
248
+ event_date_type_0 = isoparse(data)
249
+
250
+ return event_date_type_0
251
+ except: # noqa: E722
252
+ pass
253
+ return cast(Union[None, Unset, datetime.datetime], data)
254
+
255
+ event_date = _parse_event_date(d.pop("eventDate", UNSET))
256
+
257
+ created_by = d.pop("createdBy", UNSET)
258
+
259
+ def _parse_updated_by(data: object) -> Union[None, Unset, str]:
260
+ if data is None:
261
+ return data
262
+ if isinstance(data, Unset):
263
+ return data
264
+ return cast(Union[None, Unset, str], data)
265
+
266
+ updated_by = _parse_updated_by(d.pop("updatedBy", UNSET))
267
+
268
+ searchable = d.pop("searchable", UNSET)
269
+
270
+ def _parse_ttl(data: object) -> Union[None, Unset, int]:
271
+ if data is None:
272
+ return data
273
+ if isinstance(data, Unset):
274
+ return data
275
+ return cast(Union[None, Unset, int], data)
276
+
277
+ ttl = _parse_ttl(d.pop("ttl", UNSET))
278
+
279
+ archived = d.pop("archived", UNSET)
280
+
281
+ def _parse_schema(data: object) -> Union["JsonNode", None, Unset]:
282
+ if data is None:
283
+ return data
284
+ if isinstance(data, Unset):
285
+ return data
286
+ try:
287
+ if not isinstance(data, dict):
288
+ raise TypeError()
289
+ schema_type_0 = JsonNode.from_dict(data)
290
+
291
+ return schema_type_0
292
+ except: # noqa: E722
293
+ pass
294
+ return cast(Union["JsonNode", None, Unset], data)
295
+
296
+ schema = _parse_schema(d.pop("schema", UNSET))
297
+
298
+ def _parse_content(data: object) -> Union["JsonNode", None, Unset]:
299
+ if data is None:
300
+ return data
301
+ if isinstance(data, Unset):
302
+ return data
303
+ try:
304
+ if not isinstance(data, dict):
305
+ raise TypeError()
306
+ content_type_0 = JsonNode.from_dict(data)
307
+
308
+ return content_type_0
309
+ except: # noqa: E722
310
+ pass
311
+ return cast(Union["JsonNode", None, Unset], data)
312
+
313
+ content = _parse_content(d.pop("content", UNSET))
314
+
315
+ attachments = []
316
+ _attachments = d.pop("attachments", UNSET)
317
+ for attachments_item_data in _attachments or []:
318
+ attachments_item = RecordAttachment.from_dict(attachments_item_data)
319
+
320
+ attachments.append(attachments_item)
321
+
322
+ _authorization = d.pop("authorization", UNSET)
323
+ authorization: Union[Unset, RecordAuthorization]
324
+ if isinstance(_authorization, Unset):
325
+ authorization = UNSET
326
+ else:
327
+ authorization = RecordAuthorization.from_dict(_authorization)
328
+
329
+ relations = []
330
+ _relations = d.pop("relations", UNSET)
331
+ for relations_item_data in _relations or []:
332
+ relations_item = RecordRelation.from_dict(relations_item_data)
333
+
334
+ relations.append(relations_item)
335
+
336
+ def _parse_external_uri(data: object) -> Union[None, Unset, str]:
337
+ if data is None:
338
+ return data
339
+ if isinstance(data, Unset):
340
+ return data
341
+ return cast(Union[None, Unset, str], data)
342
+
343
+ external_uri = _parse_external_uri(d.pop("externalUri", UNSET))
344
+
345
+ labels = cast(list[str], d.pop("labels", UNSET))
346
+
347
+ _tags = d.pop("tags", UNSET)
348
+ tags: Union[Unset, RecordTags]
349
+ if isinstance(_tags, Unset):
350
+ tags = UNSET
351
+ else:
352
+ tags = RecordTags.from_dict(_tags)
353
+
354
+ field_ts = d.pop("_ts", UNSET)
355
+
356
+ record = cls(
357
+ id=id,
358
+ organization_id=organization_id,
359
+ title=title,
360
+ description=description,
361
+ created_at=created_at,
362
+ event_date=event_date,
363
+ created_by=created_by,
364
+ updated_by=updated_by,
365
+ searchable=searchable,
366
+ ttl=ttl,
367
+ archived=archived,
368
+ schema=schema,
369
+ content=content,
370
+ attachments=attachments,
371
+ authorization=authorization,
372
+ relations=relations,
373
+ external_uri=external_uri,
374
+ labels=labels,
375
+ tags=tags,
376
+ field_ts=field_ts,
377
+ )
378
+
379
+ return record
@@ -0,0 +1,236 @@
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.record_attachment_metadata_type_0 import RecordAttachmentMetadataType0
12
+
13
+
14
+ T = TypeVar("T", bound="RecordAttachment")
15
+
16
+
17
+ @_attrs_define
18
+ class RecordAttachment:
19
+ """
20
+ Attributes:
21
+ id (Union[Unset, str]):
22
+ file_name (Union[Unset, str]):
23
+ content_type (Union[Unset, str]):
24
+ size (Union[Unset, int]):
25
+ checksum (Union[None, Unset, str]):
26
+ uri (Union[Unset, str]):
27
+ created_at (Union[None, Unset, datetime.datetime]):
28
+ updated_at (Union[None, Unset, datetime.datetime]):
29
+ created_by (Union[None, Unset, str]):
30
+ updated_by (Union[None, Unset, str]):
31
+ metadata (Union['RecordAttachmentMetadataType0', None, Unset]):
32
+ """
33
+
34
+ id: Union[Unset, str] = UNSET
35
+ file_name: Union[Unset, str] = UNSET
36
+ content_type: Union[Unset, str] = UNSET
37
+ size: Union[Unset, int] = UNSET
38
+ checksum: Union[None, Unset, str] = UNSET
39
+ uri: Union[Unset, str] = UNSET
40
+ created_at: Union[None, Unset, datetime.datetime] = UNSET
41
+ updated_at: Union[None, Unset, datetime.datetime] = UNSET
42
+ created_by: Union[None, Unset, str] = UNSET
43
+ updated_by: Union[None, Unset, str] = UNSET
44
+ metadata: Union["RecordAttachmentMetadataType0", None, Unset] = UNSET
45
+
46
+ def to_dict(self) -> dict[str, Any]:
47
+ from ..models.record_attachment_metadata_type_0 import RecordAttachmentMetadataType0
48
+
49
+ id = self.id
50
+
51
+ file_name = self.file_name
52
+
53
+ content_type = self.content_type
54
+
55
+ size = self.size
56
+
57
+ checksum: Union[None, Unset, str]
58
+ if isinstance(self.checksum, Unset):
59
+ checksum = UNSET
60
+ else:
61
+ checksum = self.checksum
62
+
63
+ uri = self.uri
64
+
65
+ created_at: Union[None, Unset, str]
66
+ if isinstance(self.created_at, Unset):
67
+ created_at = UNSET
68
+ elif isinstance(self.created_at, datetime.datetime):
69
+ created_at = self.created_at.isoformat()
70
+ else:
71
+ created_at = self.created_at
72
+
73
+ updated_at: Union[None, Unset, str]
74
+ if isinstance(self.updated_at, Unset):
75
+ updated_at = UNSET
76
+ elif isinstance(self.updated_at, datetime.datetime):
77
+ updated_at = self.updated_at.isoformat()
78
+ else:
79
+ updated_at = self.updated_at
80
+
81
+ created_by: Union[None, Unset, str]
82
+ if isinstance(self.created_by, Unset):
83
+ created_by = UNSET
84
+ else:
85
+ created_by = self.created_by
86
+
87
+ updated_by: Union[None, Unset, str]
88
+ if isinstance(self.updated_by, Unset):
89
+ updated_by = UNSET
90
+ else:
91
+ updated_by = self.updated_by
92
+
93
+ metadata: Union[None, Unset, dict[str, Any]]
94
+ if isinstance(self.metadata, Unset):
95
+ metadata = UNSET
96
+ elif isinstance(self.metadata, RecordAttachmentMetadataType0):
97
+ metadata = self.metadata.to_dict()
98
+ else:
99
+ metadata = self.metadata
100
+
101
+ field_dict: dict[str, Any] = {}
102
+
103
+ field_dict.update({})
104
+ if id is not UNSET:
105
+ field_dict["id"] = id
106
+ if file_name is not UNSET:
107
+ field_dict["fileName"] = file_name
108
+ if content_type is not UNSET:
109
+ field_dict["contentType"] = content_type
110
+ if size is not UNSET:
111
+ field_dict["size"] = size
112
+ if checksum is not UNSET:
113
+ field_dict["checksum"] = checksum
114
+ if uri is not UNSET:
115
+ field_dict["uri"] = uri
116
+ if created_at is not UNSET:
117
+ field_dict["createdAt"] = created_at
118
+ if updated_at is not UNSET:
119
+ field_dict["updatedAt"] = updated_at
120
+ if created_by is not UNSET:
121
+ field_dict["createdBy"] = created_by
122
+ if updated_by is not UNSET:
123
+ field_dict["updatedBy"] = updated_by
124
+ if metadata is not UNSET:
125
+ field_dict["metadata"] = metadata
126
+
127
+ return field_dict
128
+
129
+ @classmethod
130
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
131
+ from ..models.record_attachment_metadata_type_0 import RecordAttachmentMetadataType0
132
+
133
+ d = dict(src_dict)
134
+ id = d.pop("id", UNSET)
135
+
136
+ file_name = d.pop("fileName", UNSET)
137
+
138
+ content_type = d.pop("contentType", UNSET)
139
+
140
+ size = d.pop("size", UNSET)
141
+
142
+ def _parse_checksum(data: object) -> Union[None, Unset, str]:
143
+ if data is None:
144
+ return data
145
+ if isinstance(data, Unset):
146
+ return data
147
+ return cast(Union[None, Unset, str], data)
148
+
149
+ checksum = _parse_checksum(d.pop("checksum", UNSET))
150
+
151
+ uri = d.pop("uri", UNSET)
152
+
153
+ def _parse_created_at(data: object) -> Union[None, Unset, datetime.datetime]:
154
+ if data is None:
155
+ return data
156
+ if isinstance(data, Unset):
157
+ return data
158
+ try:
159
+ if not isinstance(data, str):
160
+ raise TypeError()
161
+ created_at_type_0 = isoparse(data)
162
+
163
+ return created_at_type_0
164
+ except: # noqa: E722
165
+ pass
166
+ return cast(Union[None, Unset, datetime.datetime], data)
167
+
168
+ created_at = _parse_created_at(d.pop("createdAt", UNSET))
169
+
170
+ def _parse_updated_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
+ updated_at_type_0 = isoparse(data)
179
+
180
+ return updated_at_type_0
181
+ except: # noqa: E722
182
+ pass
183
+ return cast(Union[None, Unset, datetime.datetime], data)
184
+
185
+ updated_at = _parse_updated_at(d.pop("updatedAt", UNSET))
186
+
187
+ def _parse_created_by(data: object) -> Union[None, Unset, str]:
188
+ if data is None:
189
+ return data
190
+ if isinstance(data, Unset):
191
+ return data
192
+ return cast(Union[None, Unset, str], data)
193
+
194
+ created_by = _parse_created_by(d.pop("createdBy", UNSET))
195
+
196
+ def _parse_updated_by(data: object) -> Union[None, Unset, str]:
197
+ if data is None:
198
+ return data
199
+ if isinstance(data, Unset):
200
+ return data
201
+ return cast(Union[None, Unset, str], data)
202
+
203
+ updated_by = _parse_updated_by(d.pop("updatedBy", UNSET))
204
+
205
+ def _parse_metadata(data: object) -> Union["RecordAttachmentMetadataType0", 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
+ metadata_type_0 = RecordAttachmentMetadataType0.from_dict(data)
214
+
215
+ return metadata_type_0
216
+ except: # noqa: E722
217
+ pass
218
+ return cast(Union["RecordAttachmentMetadataType0", None, Unset], data)
219
+
220
+ metadata = _parse_metadata(d.pop("metadata", UNSET))
221
+
222
+ record_attachment = cls(
223
+ id=id,
224
+ file_name=file_name,
225
+ content_type=content_type,
226
+ size=size,
227
+ checksum=checksum,
228
+ uri=uri,
229
+ created_at=created_at,
230
+ updated_at=updated_at,
231
+ created_by=created_by,
232
+ updated_by=updated_by,
233
+ metadata=metadata,
234
+ )
235
+
236
+ return record_attachment