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,198 @@
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 typing import cast
11
+ from typing import cast, Union
12
+ from typing import Union
13
+
14
+ if TYPE_CHECKING:
15
+ from ..models.http_validation_problem_details_errors import HttpValidationProblemDetailsErrors
16
+
17
+
18
+
19
+
20
+
21
+ T = TypeVar("T", bound="HttpValidationProblemDetails")
22
+
23
+
24
+
25
+ @_attrs_define
26
+ class HttpValidationProblemDetails:
27
+ """
28
+ Attributes:
29
+ type_ (Union[None, Unset, str]):
30
+ title (Union[None, Unset, str]):
31
+ status (Union[None, Unset, int]):
32
+ detail (Union[None, Unset, str]):
33
+ instance (Union[None, Unset, str]):
34
+ errors (Union[Unset, HttpValidationProblemDetailsErrors]):
35
+ """
36
+
37
+ type_: Union[None, Unset, str] = UNSET
38
+ title: Union[None, Unset, str] = UNSET
39
+ status: Union[None, Unset, int] = UNSET
40
+ detail: Union[None, Unset, str] = UNSET
41
+ instance: Union[None, Unset, str] = UNSET
42
+ errors: Union[Unset, 'HttpValidationProblemDetailsErrors'] = UNSET
43
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
44
+
45
+
46
+
47
+
48
+
49
+ def to_dict(self) -> dict[str, Any]:
50
+ from ..models.http_validation_problem_details_errors import HttpValidationProblemDetailsErrors
51
+ type_: Union[None, Unset, str]
52
+ if isinstance(self.type_, Unset):
53
+ type_ = UNSET
54
+ else:
55
+ type_ = self.type_
56
+
57
+ title: Union[None, Unset, str]
58
+ if isinstance(self.title, Unset):
59
+ title = UNSET
60
+ else:
61
+ title = self.title
62
+
63
+ status: Union[None, Unset, int]
64
+ if isinstance(self.status, Unset):
65
+ status = UNSET
66
+ else:
67
+ status = self.status
68
+
69
+ detail: Union[None, Unset, str]
70
+ if isinstance(self.detail, Unset):
71
+ detail = UNSET
72
+ else:
73
+ detail = self.detail
74
+
75
+ instance: Union[None, Unset, str]
76
+ if isinstance(self.instance, Unset):
77
+ instance = UNSET
78
+ else:
79
+ instance = self.instance
80
+
81
+ errors: Union[Unset, dict[str, Any]] = UNSET
82
+ if not isinstance(self.errors, Unset):
83
+ errors = self.errors.to_dict()
84
+
85
+
86
+ field_dict: dict[str, Any] = {}
87
+ field_dict.update(self.additional_properties)
88
+ field_dict.update({
89
+ })
90
+ if type_ is not UNSET:
91
+ field_dict["type"] = type_
92
+ if title is not UNSET:
93
+ field_dict["title"] = title
94
+ if status is not UNSET:
95
+ field_dict["status"] = status
96
+ if detail is not UNSET:
97
+ field_dict["detail"] = detail
98
+ if instance is not UNSET:
99
+ field_dict["instance"] = instance
100
+ if errors is not UNSET:
101
+ field_dict["errors"] = errors
102
+
103
+ return field_dict
104
+
105
+
106
+
107
+ @classmethod
108
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
109
+ from ..models.http_validation_problem_details_errors import HttpValidationProblemDetailsErrors
110
+ d = dict(src_dict)
111
+ def _parse_type_(data: object) -> Union[None, Unset, str]:
112
+ if data is None:
113
+ return data
114
+ if isinstance(data, Unset):
115
+ return data
116
+ return cast(Union[None, Unset, str], data)
117
+
118
+ type_ = _parse_type_(d.pop("type", UNSET))
119
+
120
+
121
+ def _parse_title(data: object) -> Union[None, Unset, str]:
122
+ if data is None:
123
+ return data
124
+ if isinstance(data, Unset):
125
+ return data
126
+ return cast(Union[None, Unset, str], data)
127
+
128
+ title = _parse_title(d.pop("title", UNSET))
129
+
130
+
131
+ def _parse_status(data: object) -> Union[None, Unset, int]:
132
+ if data is None:
133
+ return data
134
+ if isinstance(data, Unset):
135
+ return data
136
+ return cast(Union[None, Unset, int], data)
137
+
138
+ status = _parse_status(d.pop("status", UNSET))
139
+
140
+
141
+ def _parse_detail(data: object) -> Union[None, Unset, str]:
142
+ if data is None:
143
+ return data
144
+ if isinstance(data, Unset):
145
+ return data
146
+ return cast(Union[None, Unset, str], data)
147
+
148
+ detail = _parse_detail(d.pop("detail", UNSET))
149
+
150
+
151
+ def _parse_instance(data: object) -> Union[None, Unset, str]:
152
+ if data is None:
153
+ return data
154
+ if isinstance(data, Unset):
155
+ return data
156
+ return cast(Union[None, Unset, str], data)
157
+
158
+ instance = _parse_instance(d.pop("instance", UNSET))
159
+
160
+
161
+ _errors = d.pop("errors", UNSET)
162
+ errors: Union[Unset, HttpValidationProblemDetailsErrors]
163
+ if isinstance(_errors, Unset):
164
+ errors = UNSET
165
+ else:
166
+ errors = HttpValidationProblemDetailsErrors.from_dict(_errors)
167
+
168
+
169
+
170
+
171
+ http_validation_problem_details = cls(
172
+ type_=type_,
173
+ title=title,
174
+ status=status,
175
+ detail=detail,
176
+ instance=instance,
177
+ errors=errors,
178
+ )
179
+
180
+
181
+ http_validation_problem_details.additional_properties = d
182
+ return http_validation_problem_details
183
+
184
+ @property
185
+ def additional_keys(self) -> list[str]:
186
+ return list(self.additional_properties.keys())
187
+
188
+ def __getitem__(self, key: str) -> Any:
189
+ return self.additional_properties[key]
190
+
191
+ def __setitem__(self, key: str, value: Any) -> None:
192
+ self.additional_properties[key] = value
193
+
194
+ def __delitem__(self, key: str) -> None:
195
+ del self.additional_properties[key]
196
+
197
+ def __contains__(self, key: str) -> bool:
198
+ return key in self.additional_properties
@@ -0,0 +1,74 @@
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 typing import cast
10
+
11
+
12
+
13
+
14
+
15
+
16
+ T = TypeVar("T", bound="HttpValidationProblemDetailsErrors")
17
+
18
+
19
+
20
+ @_attrs_define
21
+ class HttpValidationProblemDetailsErrors:
22
+ """
23
+ """
24
+
25
+ additional_properties: dict[str, list[str]] = _attrs_field(init=False, factory=dict)
26
+
27
+
28
+
29
+
30
+
31
+ def to_dict(self) -> dict[str, Any]:
32
+
33
+ field_dict: dict[str, Any] = {}
34
+ for prop_name, prop in self.additional_properties.items():
35
+ field_dict[prop_name] = prop
36
+
37
+
38
+
39
+
40
+ return field_dict
41
+
42
+
43
+
44
+ @classmethod
45
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
46
+ d = dict(src_dict)
47
+ http_validation_problem_details_errors = cls(
48
+ )
49
+
50
+
51
+ additional_properties = {}
52
+ for prop_name, prop_dict in d.items():
53
+ additional_property = cast(list[str], prop_dict)
54
+
55
+ additional_properties[prop_name] = additional_property
56
+
57
+ http_validation_problem_details_errors.additional_properties = additional_properties
58
+ return http_validation_problem_details_errors
59
+
60
+ @property
61
+ def additional_keys(self) -> list[str]:
62
+ return list(self.additional_properties.keys())
63
+
64
+ def __getitem__(self, key: str) -> list[str]:
65
+ return self.additional_properties[key]
66
+
67
+ def __setitem__(self, key: str, value: list[str]) -> None:
68
+ self.additional_properties[key] = value
69
+
70
+ def __delitem__(self, key: str) -> None:
71
+ del self.additional_properties[key]
72
+
73
+ def __contains__(self, key: str) -> bool:
74
+ return key in self.additional_properties
@@ -0,0 +1,224 @@
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 typing import cast
11
+ from typing import cast, Union
12
+ from typing import Union
13
+
14
+ if TYPE_CHECKING:
15
+ from ..models.workspace_dto import WorkspaceDto
16
+ from ..models.mini_template_dto import MiniTemplateDto
17
+ from ..models.document_file_dto import DocumentFileDto
18
+
19
+
20
+
21
+
22
+
23
+ T = TypeVar("T", bound="MiniDto")
24
+
25
+
26
+
27
+ @_attrs_define
28
+ class MiniDto:
29
+ """
30
+ Attributes:
31
+ id (Union[Unset, int]):
32
+ name (Union[Unset, str]):
33
+ description (Union[None, Unset, str]):
34
+ instructions (Union[None, Unset, str]):
35
+ template_id (Union[None, Unset, str]):
36
+ template (Union['MiniTemplateDto', None, Unset]):
37
+ workspaces (Union[Unset, list['WorkspaceDto']]):
38
+ document_files (Union[Unset, list['DocumentFileDto']]):
39
+ """
40
+
41
+ id: Union[Unset, int] = UNSET
42
+ name: Union[Unset, str] = UNSET
43
+ description: Union[None, Unset, str] = UNSET
44
+ instructions: Union[None, Unset, str] = UNSET
45
+ template_id: Union[None, Unset, str] = UNSET
46
+ template: Union['MiniTemplateDto', None, Unset] = UNSET
47
+ workspaces: Union[Unset, list['WorkspaceDto']] = UNSET
48
+ document_files: Union[Unset, list['DocumentFileDto']] = UNSET
49
+
50
+
51
+
52
+
53
+
54
+ def to_dict(self) -> dict[str, Any]:
55
+ from ..models.workspace_dto import WorkspaceDto
56
+ from ..models.mini_template_dto import MiniTemplateDto
57
+ from ..models.document_file_dto import DocumentFileDto
58
+ id = self.id
59
+
60
+ name = self.name
61
+
62
+ description: Union[None, Unset, str]
63
+ if isinstance(self.description, Unset):
64
+ description = UNSET
65
+ else:
66
+ description = self.description
67
+
68
+ instructions: Union[None, Unset, str]
69
+ if isinstance(self.instructions, Unset):
70
+ instructions = UNSET
71
+ else:
72
+ instructions = self.instructions
73
+
74
+ template_id: Union[None, Unset, str]
75
+ if isinstance(self.template_id, Unset):
76
+ template_id = UNSET
77
+ else:
78
+ template_id = self.template_id
79
+
80
+ template: Union[None, Unset, dict[str, Any]]
81
+ if isinstance(self.template, Unset):
82
+ template = UNSET
83
+ elif isinstance(self.template, MiniTemplateDto):
84
+ template = self.template.to_dict()
85
+ else:
86
+ template = self.template
87
+
88
+ workspaces: Union[Unset, list[dict[str, Any]]] = UNSET
89
+ if not isinstance(self.workspaces, Unset):
90
+ workspaces = []
91
+ for workspaces_item_data in self.workspaces:
92
+ workspaces_item = workspaces_item_data.to_dict()
93
+ workspaces.append(workspaces_item)
94
+
95
+
96
+
97
+ document_files: Union[Unset, list[dict[str, Any]]] = UNSET
98
+ if not isinstance(self.document_files, Unset):
99
+ document_files = []
100
+ for document_files_item_data in self.document_files:
101
+ document_files_item = document_files_item_data.to_dict()
102
+ document_files.append(document_files_item)
103
+
104
+
105
+
106
+
107
+ field_dict: dict[str, Any] = {}
108
+
109
+ field_dict.update({
110
+ })
111
+ if id is not UNSET:
112
+ field_dict["id"] = id
113
+ if name is not UNSET:
114
+ field_dict["name"] = name
115
+ if description is not UNSET:
116
+ field_dict["description"] = description
117
+ if instructions is not UNSET:
118
+ field_dict["instructions"] = instructions
119
+ if template_id is not UNSET:
120
+ field_dict["templateId"] = template_id
121
+ if template is not UNSET:
122
+ field_dict["template"] = template
123
+ if workspaces is not UNSET:
124
+ field_dict["workspaces"] = workspaces
125
+ if document_files is not UNSET:
126
+ field_dict["documentFiles"] = document_files
127
+
128
+ return field_dict
129
+
130
+
131
+
132
+ @classmethod
133
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
134
+ from ..models.workspace_dto import WorkspaceDto
135
+ from ..models.mini_template_dto import MiniTemplateDto
136
+ from ..models.document_file_dto import DocumentFileDto
137
+ d = dict(src_dict)
138
+ id = d.pop("id", UNSET)
139
+
140
+ name = d.pop("name", UNSET)
141
+
142
+ def _parse_description(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
+ description = _parse_description(d.pop("description", UNSET))
150
+
151
+
152
+ def _parse_instructions(data: object) -> Union[None, Unset, str]:
153
+ if data is None:
154
+ return data
155
+ if isinstance(data, Unset):
156
+ return data
157
+ return cast(Union[None, Unset, str], data)
158
+
159
+ instructions = _parse_instructions(d.pop("instructions", UNSET))
160
+
161
+
162
+ def _parse_template_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
+ template_id = _parse_template_id(d.pop("templateId", UNSET))
170
+
171
+
172
+ def _parse_template(data: object) -> Union['MiniTemplateDto', None, Unset]:
173
+ if data is None:
174
+ return data
175
+ if isinstance(data, Unset):
176
+ return data
177
+ try:
178
+ if not isinstance(data, dict):
179
+ raise TypeError()
180
+ template_type_0 = MiniTemplateDto.from_dict(data)
181
+
182
+
183
+
184
+ return template_type_0
185
+ except: # noqa: E722
186
+ pass
187
+ return cast(Union['MiniTemplateDto', None, Unset], data)
188
+
189
+ template = _parse_template(d.pop("template", UNSET))
190
+
191
+
192
+ workspaces = []
193
+ _workspaces = d.pop("workspaces", UNSET)
194
+ for workspaces_item_data in (_workspaces or []):
195
+ workspaces_item = WorkspaceDto.from_dict(workspaces_item_data)
196
+
197
+
198
+
199
+ workspaces.append(workspaces_item)
200
+
201
+
202
+ document_files = []
203
+ _document_files = d.pop("documentFiles", UNSET)
204
+ for document_files_item_data in (_document_files or []):
205
+ document_files_item = DocumentFileDto.from_dict(document_files_item_data)
206
+
207
+
208
+
209
+ document_files.append(document_files_item)
210
+
211
+
212
+ mini_dto = cls(
213
+ id=id,
214
+ name=name,
215
+ description=description,
216
+ instructions=instructions,
217
+ template_id=template_id,
218
+ template=template,
219
+ workspaces=workspaces,
220
+ document_files=document_files,
221
+ )
222
+
223
+ return mini_dto
224
+
@@ -0,0 +1,167 @@
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 typing import cast
11
+ from typing import cast, Union
12
+ from typing import Union
13
+
14
+ if TYPE_CHECKING:
15
+ from ..models.tool_dto import ToolDto
16
+ from ..models.workspace_dto import WorkspaceDto
17
+
18
+
19
+
20
+
21
+
22
+ T = TypeVar("T", bound="MiniTemplateDto")
23
+
24
+
25
+
26
+ @_attrs_define
27
+ class MiniTemplateDto:
28
+ """
29
+ Attributes:
30
+ id (Union[Unset, str]):
31
+ name (Union[Unset, str]):
32
+ description (Union[None, Unset, str]):
33
+ instructions (Union[None, Unset, str]):
34
+ workspaces (Union[Unset, list['WorkspaceDto']]):
35
+ tools (Union[Unset, list['ToolDto']]):
36
+ """
37
+
38
+ id: Union[Unset, str] = UNSET
39
+ name: Union[Unset, str] = UNSET
40
+ description: Union[None, Unset, str] = UNSET
41
+ instructions: Union[None, Unset, str] = UNSET
42
+ workspaces: Union[Unset, list['WorkspaceDto']] = UNSET
43
+ tools: Union[Unset, list['ToolDto']] = UNSET
44
+
45
+
46
+
47
+
48
+
49
+ def to_dict(self) -> dict[str, Any]:
50
+ from ..models.tool_dto import ToolDto
51
+ from ..models.workspace_dto import WorkspaceDto
52
+ id = self.id
53
+
54
+ name = self.name
55
+
56
+ description: Union[None, Unset, str]
57
+ if isinstance(self.description, Unset):
58
+ description = UNSET
59
+ else:
60
+ description = self.description
61
+
62
+ instructions: Union[None, Unset, str]
63
+ if isinstance(self.instructions, Unset):
64
+ instructions = UNSET
65
+ else:
66
+ instructions = self.instructions
67
+
68
+ workspaces: Union[Unset, list[dict[str, Any]]] = UNSET
69
+ if not isinstance(self.workspaces, Unset):
70
+ workspaces = []
71
+ for workspaces_item_data in self.workspaces:
72
+ workspaces_item = workspaces_item_data.to_dict()
73
+ workspaces.append(workspaces_item)
74
+
75
+
76
+
77
+ tools: Union[Unset, list[dict[str, Any]]] = UNSET
78
+ if not isinstance(self.tools, Unset):
79
+ tools = []
80
+ for tools_item_data in self.tools:
81
+ tools_item = tools_item_data.to_dict()
82
+ tools.append(tools_item)
83
+
84
+
85
+
86
+
87
+ field_dict: dict[str, Any] = {}
88
+
89
+ field_dict.update({
90
+ })
91
+ if id is not UNSET:
92
+ field_dict["id"] = id
93
+ if name is not UNSET:
94
+ field_dict["name"] = name
95
+ if description is not UNSET:
96
+ field_dict["description"] = description
97
+ if instructions is not UNSET:
98
+ field_dict["instructions"] = instructions
99
+ if workspaces is not UNSET:
100
+ field_dict["workspaces"] = workspaces
101
+ if tools is not UNSET:
102
+ field_dict["tools"] = tools
103
+
104
+ return field_dict
105
+
106
+
107
+
108
+ @classmethod
109
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
110
+ from ..models.tool_dto import ToolDto
111
+ from ..models.workspace_dto import WorkspaceDto
112
+ d = dict(src_dict)
113
+ id = d.pop("id", UNSET)
114
+
115
+ name = d.pop("name", UNSET)
116
+
117
+ def _parse_description(data: object) -> Union[None, Unset, str]:
118
+ if data is None:
119
+ return data
120
+ if isinstance(data, Unset):
121
+ return data
122
+ return cast(Union[None, Unset, str], data)
123
+
124
+ description = _parse_description(d.pop("description", UNSET))
125
+
126
+
127
+ def _parse_instructions(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
+ instructions = _parse_instructions(d.pop("instructions", UNSET))
135
+
136
+
137
+ workspaces = []
138
+ _workspaces = d.pop("workspaces", UNSET)
139
+ for workspaces_item_data in (_workspaces or []):
140
+ workspaces_item = WorkspaceDto.from_dict(workspaces_item_data)
141
+
142
+
143
+
144
+ workspaces.append(workspaces_item)
145
+
146
+
147
+ tools = []
148
+ _tools = d.pop("tools", UNSET)
149
+ for tools_item_data in (_tools or []):
150
+ tools_item = ToolDto.from_dict(tools_item_data)
151
+
152
+
153
+
154
+ tools.append(tools_item)
155
+
156
+
157
+ mini_template_dto = cls(
158
+ id=id,
159
+ name=name,
160
+ description=description,
161
+ instructions=instructions,
162
+ workspaces=workspaces,
163
+ tools=tools,
164
+ )
165
+
166
+ return mini_template_dto
167
+