waldur-api-client 7.7.1__py3-none-any.whl → 7.7.2__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 waldur-api-client might be problematic. Click here for more details.

Files changed (71) hide show
  1. waldur_api_client/api/marketplace_checklists/marketplace_checklists_questions_list.py +31 -32
  2. waldur_api_client/api/marketplace_checklists/marketplace_checklists_retrieve.py +15 -14
  3. waldur_api_client/api/marketplace_checklists_admin/__init__.py +1 -0
  4. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_checklist_questions.py +187 -0
  5. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_create.py +150 -0
  6. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_destroy.py +89 -0
  7. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_list.py +173 -0
  8. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_partial_update.py +164 -0
  9. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_retrieve.py +142 -0
  10. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_update.py +164 -0
  11. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/__init__.py +1 -0
  12. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/marketplace_checklists_admin_question_dependencies_create.py +150 -0
  13. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/marketplace_checklists_admin_question_dependencies_destroy.py +89 -0
  14. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/marketplace_checklists_admin_question_dependencies_list.py +212 -0
  15. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/marketplace_checklists_admin_question_dependencies_partial_update.py +164 -0
  16. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/marketplace_checklists_admin_question_dependencies_retrieve.py +142 -0
  17. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/marketplace_checklists_admin_question_dependencies_update.py +164 -0
  18. waldur_api_client/api/marketplace_checklists_admin_question_options/__init__.py +1 -0
  19. waldur_api_client/api/marketplace_checklists_admin_question_options/marketplace_checklists_admin_question_options_create.py +150 -0
  20. waldur_api_client/api/marketplace_checklists_admin_question_options/marketplace_checklists_admin_question_options_destroy.py +89 -0
  21. waldur_api_client/api/marketplace_checklists_admin_question_options/marketplace_checklists_admin_question_options_list.py +194 -0
  22. waldur_api_client/api/marketplace_checklists_admin_question_options/marketplace_checklists_admin_question_options_partial_update.py +164 -0
  23. waldur_api_client/api/marketplace_checklists_admin_question_options/marketplace_checklists_admin_question_options_retrieve.py +142 -0
  24. waldur_api_client/api/marketplace_checklists_admin_question_options/marketplace_checklists_admin_question_options_update.py +164 -0
  25. waldur_api_client/api/marketplace_checklists_admin_questions/__init__.py +1 -0
  26. waldur_api_client/api/marketplace_checklists_admin_questions/marketplace_checklists_admin_questions_create.py +148 -0
  27. waldur_api_client/api/marketplace_checklists_admin_questions/marketplace_checklists_admin_questions_destroy.py +89 -0
  28. waldur_api_client/api/marketplace_checklists_admin_questions/marketplace_checklists_admin_questions_list.py +192 -0
  29. waldur_api_client/api/marketplace_checklists_admin_questions/marketplace_checklists_admin_questions_partial_update.py +162 -0
  30. waldur_api_client/api/marketplace_checklists_admin_questions/marketplace_checklists_admin_questions_retrieve.py +140 -0
  31. waldur_api_client/api/marketplace_checklists_admin_questions/marketplace_checklists_admin_questions_update.py +162 -0
  32. waldur_api_client/models/__init__.py +36 -2
  33. waldur_api_client/models/answer_list.py +8 -19
  34. waldur_api_client/models/answer_submit.py +7 -13
  35. waldur_api_client/models/answer_submit_request.py +7 -13
  36. waldur_api_client/models/booking_resource.py +18 -0
  37. waldur_api_client/models/booking_resources_list_field_item.py +2 -0
  38. waldur_api_client/models/booking_resources_retrieve_field_item.py +2 -0
  39. waldur_api_client/models/call_resource_template.py +23 -1
  40. waldur_api_client/models/checklist.py +8 -0
  41. waldur_api_client/models/checklist_admin.py +127 -0
  42. waldur_api_client/models/checklist_type_enum.py +10 -0
  43. waldur_api_client/models/create_checklist.py +131 -0
  44. waldur_api_client/models/create_checklist_request.py +90 -0
  45. waldur_api_client/models/marketplace_provider_resources_details_retrieve_field_item.py +2 -0
  46. waldur_api_client/models/marketplace_provider_resources_list_field_item.py +2 -0
  47. waldur_api_client/models/marketplace_provider_resources_retrieve_field_item.py +2 -0
  48. waldur_api_client/models/marketplace_resources_details_retrieve_field_item.py +2 -0
  49. waldur_api_client/models/marketplace_resources_list_field_item.py +2 -0
  50. waldur_api_client/models/marketplace_resources_retrieve_field_item.py +2 -0
  51. waldur_api_client/models/open_stack_port.py +15 -4
  52. waldur_api_client/models/open_stack_router.py +15 -4
  53. waldur_api_client/models/operator_enum.py +12 -0
  54. waldur_api_client/models/patched_create_checklist_request.py +96 -0
  55. waldur_api_client/models/patched_question_admin_request.py +208 -0
  56. waldur_api_client/models/patched_question_dependency_request.py +94 -0
  57. waldur_api_client/models/patched_question_options_admin_request.py +68 -0
  58. waldur_api_client/models/{checklist_question.py → question.py} +29 -16
  59. waldur_api_client/models/question_admin.py +260 -0
  60. waldur_api_client/models/question_admin_request.py +210 -0
  61. waldur_api_client/models/question_dependency.py +127 -0
  62. waldur_api_client/models/question_dependency_request.py +94 -0
  63. waldur_api_client/models/question_options.py +79 -0
  64. waldur_api_client/models/question_options_admin.py +103 -0
  65. waldur_api_client/models/question_options_admin_request.py +78 -0
  66. waldur_api_client/models/question_type_enum.py +15 -0
  67. waldur_api_client/models/resource.py +18 -0
  68. {waldur_api_client-7.7.1.dist-info → waldur_api_client-7.7.2.dist-info}/METADATA +1 -1
  69. {waldur_api_client-7.7.1.dist-info → waldur_api_client-7.7.2.dist-info}/RECORD +71 -25
  70. {waldur_api_client-7.7.1.dist-info → waldur_api_client-7.7.2.dist-info}/LICENSE +0 -0
  71. {waldur_api_client-7.7.1.dist-info → waldur_api_client-7.7.2.dist-info}/WHEEL +0 -0
@@ -48,7 +48,7 @@ class OpenStackRouter:
48
48
  state (Union[Unset, CoreStates]):
49
49
  created (Union[Unset, datetime.datetime]):
50
50
  modified (Union[Unset, datetime.datetime]):
51
- backend_id (Union[Unset, str]):
51
+ backend_id (Union[None, Unset, str]):
52
52
  access_url (Union[None, Unset, str]):
53
53
  tenant (Union[Unset, str]):
54
54
  tenant_name (Union[Unset, str]):
@@ -92,7 +92,7 @@ class OpenStackRouter:
92
92
  state: Union[Unset, CoreStates] = UNSET
93
93
  created: Union[Unset, datetime.datetime] = UNSET
94
94
  modified: Union[Unset, datetime.datetime] = UNSET
95
- backend_id: Union[Unset, str] = UNSET
95
+ backend_id: Union[None, Unset, str] = UNSET
96
96
  access_url: Union[None, Unset, str] = UNSET
97
97
  tenant: Union[Unset, str] = UNSET
98
98
  tenant_name: Union[Unset, str] = UNSET
@@ -176,7 +176,11 @@ class OpenStackRouter:
176
176
  if not isinstance(self.modified, Unset):
177
177
  modified = self.modified.isoformat()
178
178
 
179
- backend_id = self.backend_id
179
+ backend_id: Union[None, Unset, str]
180
+ if isinstance(self.backend_id, Unset):
181
+ backend_id = UNSET
182
+ else:
183
+ backend_id = self.backend_id
180
184
 
181
185
  access_url: Union[None, Unset, str]
182
186
  if isinstance(self.access_url, Unset):
@@ -456,7 +460,14 @@ class OpenStackRouter:
456
460
  else:
457
461
  modified = isoparse(_modified)
458
462
 
459
- backend_id = d.pop("backend_id", UNSET)
463
+ def _parse_backend_id(data: object) -> Union[None, Unset, str]:
464
+ if data is None:
465
+ return data
466
+ if isinstance(data, Unset):
467
+ return data
468
+ return cast(Union[None, Unset, str], data)
469
+
470
+ backend_id = _parse_backend_id(d.pop("backend_id", UNSET))
460
471
 
461
472
  def _parse_access_url(data: object) -> Union[None, Unset, str]:
462
473
  if data is None:
@@ -0,0 +1,12 @@
1
+ from enum import Enum
2
+
3
+
4
+ class OperatorEnum(str, Enum):
5
+ CONTAINS = "contains"
6
+ EQUALS = "equals"
7
+ IN = "in"
8
+ NOT_EQUALS = "not_equals"
9
+ NOT_IN = "not_in"
10
+
11
+ def __str__(self) -> str:
12
+ return str(self.value)
@@ -0,0 +1,96 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar, Union, cast
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ from ..models.checklist_type_enum import ChecklistTypeEnum
8
+ from ..types import UNSET, Unset
9
+
10
+ T = TypeVar("T", bound="PatchedCreateChecklistRequest")
11
+
12
+
13
+ @_attrs_define
14
+ class PatchedCreateChecklistRequest:
15
+ """
16
+ Attributes:
17
+ name (Union[Unset, str]):
18
+ description (Union[Unset, str]):
19
+ roles (Union[Unset, list[str]]):
20
+ checklist_type (Union[Unset, ChecklistTypeEnum]):
21
+ """
22
+
23
+ name: Union[Unset, str] = UNSET
24
+ description: Union[Unset, str] = UNSET
25
+ roles: Union[Unset, list[str]] = UNSET
26
+ checklist_type: Union[Unset, ChecklistTypeEnum] = UNSET
27
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
28
+
29
+ def to_dict(self) -> dict[str, Any]:
30
+ name = self.name
31
+
32
+ description = self.description
33
+
34
+ roles: Union[Unset, list[str]] = UNSET
35
+ if not isinstance(self.roles, Unset):
36
+ roles = self.roles
37
+
38
+ checklist_type: Union[Unset, str] = UNSET
39
+ if not isinstance(self.checklist_type, Unset):
40
+ checklist_type = self.checklist_type.value
41
+
42
+ field_dict: dict[str, Any] = {}
43
+ field_dict.update(self.additional_properties)
44
+ field_dict.update({})
45
+ if name is not UNSET:
46
+ field_dict["name"] = name
47
+ if description is not UNSET:
48
+ field_dict["description"] = description
49
+ if roles is not UNSET:
50
+ field_dict["roles"] = roles
51
+ if checklist_type is not UNSET:
52
+ field_dict["checklist_type"] = checklist_type
53
+
54
+ return field_dict
55
+
56
+ @classmethod
57
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
58
+ d = dict(src_dict)
59
+ name = d.pop("name", UNSET)
60
+
61
+ description = d.pop("description", UNSET)
62
+
63
+ roles = cast(list[str], d.pop("roles", UNSET))
64
+
65
+ _checklist_type = d.pop("checklist_type", UNSET)
66
+ checklist_type: Union[Unset, ChecklistTypeEnum]
67
+ if isinstance(_checklist_type, Unset):
68
+ checklist_type = UNSET
69
+ else:
70
+ checklist_type = ChecklistTypeEnum(_checklist_type)
71
+
72
+ patched_create_checklist_request = cls(
73
+ name=name,
74
+ description=description,
75
+ roles=roles,
76
+ checklist_type=checklist_type,
77
+ )
78
+
79
+ patched_create_checklist_request.additional_properties = d
80
+ return patched_create_checklist_request
81
+
82
+ @property
83
+ def additional_keys(self) -> list[str]:
84
+ return list(self.additional_properties.keys())
85
+
86
+ def __getitem__(self, key: str) -> Any:
87
+ return self.additional_properties[key]
88
+
89
+ def __setitem__(self, key: str, value: Any) -> None:
90
+ self.additional_properties[key] = value
91
+
92
+ def __delitem__(self, key: str) -> None:
93
+ del self.additional_properties[key]
94
+
95
+ def __contains__(self, key: str) -> bool:
96
+ return key in self.additional_properties
@@ -0,0 +1,208 @@
1
+ from collections.abc import Mapping
2
+ from io import BytesIO
3
+ from typing import Any, TypeVar, Union, cast
4
+
5
+ from attrs import define as _attrs_define
6
+ from attrs import field as _attrs_field
7
+
8
+ from .. import types
9
+ from ..models.blank_enum import BlankEnum
10
+ from ..models.operator_enum import OperatorEnum
11
+ from ..models.question_type_enum import QuestionTypeEnum
12
+ from ..types import UNSET, File, Unset
13
+
14
+ T = TypeVar("T", bound="PatchedQuestionAdminRequest")
15
+
16
+
17
+ @_attrs_define
18
+ class PatchedQuestionAdminRequest:
19
+ """
20
+ Attributes:
21
+ description (Union[Unset, str]):
22
+ solution (Union[None, Unset, str]): Guidance shown when answer needs clarification
23
+ image (Union[File, None, Unset]):
24
+ checklist (Union[Unset, str]):
25
+ order (Union[Unset, int]):
26
+ required (Union[Unset, bool]):
27
+ question_type (Union[Unset, QuestionTypeEnum]):
28
+ operator (Union[BlankEnum, OperatorEnum, Unset]):
29
+ review_answer_value (Union[Unset, Any]): Answer value that trigger review.
30
+ always_requires_review (Union[Unset, bool]): This question always requires review regardless of answer
31
+ """
32
+
33
+ description: Union[Unset, str] = UNSET
34
+ solution: Union[None, Unset, str] = UNSET
35
+ image: Union[File, None, Unset] = UNSET
36
+ checklist: Union[Unset, str] = UNSET
37
+ order: Union[Unset, int] = UNSET
38
+ required: Union[Unset, bool] = UNSET
39
+ question_type: Union[Unset, QuestionTypeEnum] = UNSET
40
+ operator: Union[BlankEnum, OperatorEnum, Unset] = UNSET
41
+ review_answer_value: Union[Unset, Any] = UNSET
42
+ always_requires_review: Union[Unset, bool] = UNSET
43
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
44
+
45
+ def to_dict(self) -> dict[str, Any]:
46
+ description = self.description
47
+
48
+ solution: Union[None, Unset, str]
49
+ if isinstance(self.solution, Unset):
50
+ solution = UNSET
51
+ else:
52
+ solution = self.solution
53
+
54
+ image: Union[None, Unset, types.FileTypes]
55
+ if isinstance(self.image, Unset):
56
+ image = UNSET
57
+ elif isinstance(self.image, File):
58
+ image = self.image.to_tuple()
59
+
60
+ else:
61
+ image = self.image
62
+
63
+ checklist = self.checklist
64
+
65
+ order = self.order
66
+
67
+ required = self.required
68
+
69
+ question_type: Union[Unset, str] = UNSET
70
+ if not isinstance(self.question_type, Unset):
71
+ question_type = self.question_type.value
72
+
73
+ operator: Union[Unset, str]
74
+ if isinstance(self.operator, Unset):
75
+ operator = UNSET
76
+ elif isinstance(self.operator, OperatorEnum):
77
+ operator = self.operator.value
78
+ else:
79
+ operator = self.operator.value
80
+
81
+ review_answer_value = self.review_answer_value
82
+
83
+ always_requires_review = self.always_requires_review
84
+
85
+ field_dict: dict[str, Any] = {}
86
+ field_dict.update(self.additional_properties)
87
+ field_dict.update({})
88
+ if description is not UNSET:
89
+ field_dict["description"] = description
90
+ if solution is not UNSET:
91
+ field_dict["solution"] = solution
92
+ if image is not UNSET:
93
+ field_dict["image"] = image
94
+ if checklist is not UNSET:
95
+ field_dict["checklist"] = checklist
96
+ if order is not UNSET:
97
+ field_dict["order"] = order
98
+ if required is not UNSET:
99
+ field_dict["required"] = required
100
+ if question_type is not UNSET:
101
+ field_dict["question_type"] = question_type
102
+ if operator is not UNSET:
103
+ field_dict["operator"] = operator
104
+ if review_answer_value is not UNSET:
105
+ field_dict["review_answer_value"] = review_answer_value
106
+ if always_requires_review is not UNSET:
107
+ field_dict["always_requires_review"] = always_requires_review
108
+
109
+ return field_dict
110
+
111
+ @classmethod
112
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
113
+ d = dict(src_dict)
114
+ description = d.pop("description", UNSET)
115
+
116
+ def _parse_solution(data: object) -> Union[None, Unset, str]:
117
+ if data is None:
118
+ return data
119
+ if isinstance(data, Unset):
120
+ return data
121
+ return cast(Union[None, Unset, str], data)
122
+
123
+ solution = _parse_solution(d.pop("solution", UNSET))
124
+
125
+ def _parse_image(data: object) -> Union[File, None, Unset]:
126
+ if data is None:
127
+ return data
128
+ if isinstance(data, Unset):
129
+ return data
130
+ try:
131
+ if not isinstance(data, bytes):
132
+ raise TypeError()
133
+ image_type_0 = File(payload=BytesIO(data))
134
+
135
+ return image_type_0
136
+ except: # noqa: E722
137
+ pass
138
+ return cast(Union[File, None, Unset], data)
139
+
140
+ image = _parse_image(d.pop("image", UNSET))
141
+
142
+ checklist = d.pop("checklist", UNSET)
143
+
144
+ order = d.pop("order", UNSET)
145
+
146
+ required = d.pop("required", UNSET)
147
+
148
+ _question_type = d.pop("question_type", UNSET)
149
+ question_type: Union[Unset, QuestionTypeEnum]
150
+ if isinstance(_question_type, Unset):
151
+ question_type = UNSET
152
+ else:
153
+ question_type = QuestionTypeEnum(_question_type)
154
+
155
+ def _parse_operator(data: object) -> Union[BlankEnum, OperatorEnum, Unset]:
156
+ if isinstance(data, Unset):
157
+ return data
158
+ try:
159
+ if not isinstance(data, str):
160
+ raise TypeError()
161
+ operator_type_0 = OperatorEnum(data)
162
+
163
+ return operator_type_0
164
+ except: # noqa: E722
165
+ pass
166
+ if not isinstance(data, str):
167
+ raise TypeError()
168
+ operator_type_1 = BlankEnum(data)
169
+
170
+ return operator_type_1
171
+
172
+ operator = _parse_operator(d.pop("operator", UNSET))
173
+
174
+ review_answer_value = d.pop("review_answer_value", UNSET)
175
+
176
+ always_requires_review = d.pop("always_requires_review", UNSET)
177
+
178
+ patched_question_admin_request = cls(
179
+ description=description,
180
+ solution=solution,
181
+ image=image,
182
+ checklist=checklist,
183
+ order=order,
184
+ required=required,
185
+ question_type=question_type,
186
+ operator=operator,
187
+ review_answer_value=review_answer_value,
188
+ always_requires_review=always_requires_review,
189
+ )
190
+
191
+ patched_question_admin_request.additional_properties = d
192
+ return patched_question_admin_request
193
+
194
+ @property
195
+ def additional_keys(self) -> list[str]:
196
+ return list(self.additional_properties.keys())
197
+
198
+ def __getitem__(self, key: str) -> Any:
199
+ return self.additional_properties[key]
200
+
201
+ def __setitem__(self, key: str, value: Any) -> None:
202
+ self.additional_properties[key] = value
203
+
204
+ def __delitem__(self, key: str) -> None:
205
+ del self.additional_properties[key]
206
+
207
+ def __contains__(self, key: str) -> bool:
208
+ return key in self.additional_properties
@@ -0,0 +1,94 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar, Union
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ from ..models.operator_enum import OperatorEnum
8
+ from ..types import UNSET, Unset
9
+
10
+ T = TypeVar("T", bound="PatchedQuestionDependencyRequest")
11
+
12
+
13
+ @_attrs_define
14
+ class PatchedQuestionDependencyRequest:
15
+ """
16
+ Attributes:
17
+ question (Union[Unset, str]):
18
+ depends_on_question (Union[Unset, str]):
19
+ required_answer_value (Union[Unset, Any]): The answer value(s) that make this question visible
20
+ operator (Union[Unset, OperatorEnum]):
21
+ """
22
+
23
+ question: Union[Unset, str] = UNSET
24
+ depends_on_question: Union[Unset, str] = UNSET
25
+ required_answer_value: Union[Unset, Any] = UNSET
26
+ operator: Union[Unset, OperatorEnum] = UNSET
27
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
28
+
29
+ def to_dict(self) -> dict[str, Any]:
30
+ question = self.question
31
+
32
+ depends_on_question = self.depends_on_question
33
+
34
+ required_answer_value = self.required_answer_value
35
+
36
+ operator: Union[Unset, str] = UNSET
37
+ if not isinstance(self.operator, Unset):
38
+ operator = self.operator.value
39
+
40
+ field_dict: dict[str, Any] = {}
41
+ field_dict.update(self.additional_properties)
42
+ field_dict.update({})
43
+ if question is not UNSET:
44
+ field_dict["question"] = question
45
+ if depends_on_question is not UNSET:
46
+ field_dict["depends_on_question"] = depends_on_question
47
+ if required_answer_value is not UNSET:
48
+ field_dict["required_answer_value"] = required_answer_value
49
+ if operator is not UNSET:
50
+ field_dict["operator"] = operator
51
+
52
+ return field_dict
53
+
54
+ @classmethod
55
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
56
+ d = dict(src_dict)
57
+ question = d.pop("question", UNSET)
58
+
59
+ depends_on_question = d.pop("depends_on_question", UNSET)
60
+
61
+ required_answer_value = d.pop("required_answer_value", UNSET)
62
+
63
+ _operator = d.pop("operator", UNSET)
64
+ operator: Union[Unset, OperatorEnum]
65
+ if isinstance(_operator, Unset):
66
+ operator = UNSET
67
+ else:
68
+ operator = OperatorEnum(_operator)
69
+
70
+ patched_question_dependency_request = cls(
71
+ question=question,
72
+ depends_on_question=depends_on_question,
73
+ required_answer_value=required_answer_value,
74
+ operator=operator,
75
+ )
76
+
77
+ patched_question_dependency_request.additional_properties = d
78
+ return patched_question_dependency_request
79
+
80
+ @property
81
+ def additional_keys(self) -> list[str]:
82
+ return list(self.additional_properties.keys())
83
+
84
+ def __getitem__(self, key: str) -> Any:
85
+ return self.additional_properties[key]
86
+
87
+ def __setitem__(self, key: str, value: Any) -> None:
88
+ self.additional_properties[key] = value
89
+
90
+ def __delitem__(self, key: str) -> None:
91
+ del self.additional_properties[key]
92
+
93
+ def __contains__(self, key: str) -> bool:
94
+ return key in self.additional_properties
@@ -0,0 +1,68 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar, Union
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
+ T = TypeVar("T", bound="PatchedQuestionOptionsAdminRequest")
10
+
11
+
12
+ @_attrs_define
13
+ class PatchedQuestionOptionsAdminRequest:
14
+ """
15
+ Attributes:
16
+ label (Union[Unset, str]):
17
+ order (Union[Unset, int]):
18
+ """
19
+
20
+ label: Union[Unset, str] = UNSET
21
+ order: Union[Unset, int] = UNSET
22
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23
+
24
+ def to_dict(self) -> dict[str, Any]:
25
+ label = self.label
26
+
27
+ order = self.order
28
+
29
+ field_dict: dict[str, Any] = {}
30
+ field_dict.update(self.additional_properties)
31
+ field_dict.update({})
32
+ if label is not UNSET:
33
+ field_dict["label"] = label
34
+ if order is not UNSET:
35
+ field_dict["order"] = order
36
+
37
+ return field_dict
38
+
39
+ @classmethod
40
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
41
+ d = dict(src_dict)
42
+ label = d.pop("label", UNSET)
43
+
44
+ order = d.pop("order", UNSET)
45
+
46
+ patched_question_options_admin_request = cls(
47
+ label=label,
48
+ order=order,
49
+ )
50
+
51
+ patched_question_options_admin_request.additional_properties = d
52
+ return patched_question_options_admin_request
53
+
54
+ @property
55
+ def additional_keys(self) -> list[str]:
56
+ return list(self.additional_properties.keys())
57
+
58
+ def __getitem__(self, key: str) -> Any:
59
+ return self.additional_properties[key]
60
+
61
+ def __setitem__(self, key: str, value: Any) -> None:
62
+ self.additional_properties[key] = value
63
+
64
+ def __delitem__(self, key: str) -> None:
65
+ del self.additional_properties[key]
66
+
67
+ def __contains__(self, key: str) -> bool:
68
+ return key in self.additional_properties
@@ -1,5 +1,5 @@
1
1
  from collections.abc import Mapping
2
- from typing import Any, TypeVar, Union, cast
2
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
3
3
  from uuid import UUID
4
4
 
5
5
  from attrs import define as _attrs_define
@@ -7,26 +7,30 @@ from attrs import field as _attrs_field
7
7
 
8
8
  from ..types import UNSET, Unset
9
9
 
10
- T = TypeVar("T", bound="ChecklistQuestion")
10
+ if TYPE_CHECKING:
11
+ from ..models.question_options import QuestionOptions
12
+
13
+
14
+ T = TypeVar("T", bound="Question")
11
15
 
12
16
 
13
17
  @_attrs_define
14
- class ChecklistQuestion:
18
+ class Question:
15
19
  """
16
20
  Attributes:
17
21
  uuid (UUID):
18
22
  category_uuid (UUID):
23
+ question_options (list['QuestionOptions']):
19
24
  description (Union[Unset, str]):
20
- solution (Union[None, Unset, str]): It is shown when incorrect or N/A answer is chosen
21
- correct_answer (Union[Unset, bool]):
25
+ solution (Union[None, Unset, str]): Guidance shown when answer needs clarification
22
26
  image (Union[None, Unset, str]):
23
27
  """
24
28
 
25
29
  uuid: UUID
26
30
  category_uuid: UUID
31
+ question_options: list["QuestionOptions"]
27
32
  description: Union[Unset, str] = UNSET
28
33
  solution: Union[None, Unset, str] = UNSET
29
- correct_answer: Union[Unset, bool] = UNSET
30
34
  image: Union[None, Unset, str] = UNSET
31
35
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
32
36
 
@@ -35,6 +39,11 @@ class ChecklistQuestion:
35
39
 
36
40
  category_uuid = str(self.category_uuid)
37
41
 
42
+ question_options = []
43
+ for question_options_item_data in self.question_options:
44
+ question_options_item = question_options_item_data.to_dict()
45
+ question_options.append(question_options_item)
46
+
38
47
  description = self.description
39
48
 
40
49
  solution: Union[None, Unset, str]
@@ -43,8 +52,6 @@ class ChecklistQuestion:
43
52
  else:
44
53
  solution = self.solution
45
54
 
46
- correct_answer = self.correct_answer
47
-
48
55
  image: Union[None, Unset, str]
49
56
  if isinstance(self.image, Unset):
50
57
  image = UNSET
@@ -57,14 +64,13 @@ class ChecklistQuestion:
57
64
  {
58
65
  "uuid": uuid,
59
66
  "category_uuid": category_uuid,
67
+ "question_options": question_options,
60
68
  }
61
69
  )
62
70
  if description is not UNSET:
63
71
  field_dict["description"] = description
64
72
  if solution is not UNSET:
65
73
  field_dict["solution"] = solution
66
- if correct_answer is not UNSET:
67
- field_dict["correct_answer"] = correct_answer
68
74
  if image is not UNSET:
69
75
  field_dict["image"] = image
70
76
 
@@ -72,11 +78,20 @@ class ChecklistQuestion:
72
78
 
73
79
  @classmethod
74
80
  def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
81
+ from ..models.question_options import QuestionOptions
82
+
75
83
  d = dict(src_dict)
76
84
  uuid = UUID(d.pop("uuid"))
77
85
 
78
86
  category_uuid = UUID(d.pop("category_uuid"))
79
87
 
88
+ question_options = []
89
+ _question_options = d.pop("question_options")
90
+ for question_options_item_data in _question_options:
91
+ question_options_item = QuestionOptions.from_dict(question_options_item_data)
92
+
93
+ question_options.append(question_options_item)
94
+
80
95
  description = d.pop("description", UNSET)
81
96
 
82
97
  def _parse_solution(data: object) -> Union[None, Unset, str]:
@@ -88,8 +103,6 @@ class ChecklistQuestion:
88
103
 
89
104
  solution = _parse_solution(d.pop("solution", UNSET))
90
105
 
91
- correct_answer = d.pop("correct_answer", UNSET)
92
-
93
106
  def _parse_image(data: object) -> Union[None, Unset, str]:
94
107
  if data is None:
95
108
  return data
@@ -99,17 +112,17 @@ class ChecklistQuestion:
99
112
 
100
113
  image = _parse_image(d.pop("image", UNSET))
101
114
 
102
- checklist_question = cls(
115
+ question = cls(
103
116
  uuid=uuid,
104
117
  category_uuid=category_uuid,
118
+ question_options=question_options,
105
119
  description=description,
106
120
  solution=solution,
107
- correct_answer=correct_answer,
108
121
  image=image,
109
122
  )
110
123
 
111
- checklist_question.additional_properties = d
112
- return checklist_question
124
+ question.additional_properties = d
125
+ return question
113
126
 
114
127
  @property
115
128
  def additional_keys(self) -> list[str]: