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.

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