waldur-api-client 7.7.0__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 (83) hide show
  1. waldur_api_client/api/autoprovisioning_rules/autoprovisioning_rules_create.py +8 -4
  2. waldur_api_client/api/autoprovisioning_rules/autoprovisioning_rules_destroy.py +4 -2
  3. waldur_api_client/api/autoprovisioning_rules/autoprovisioning_rules_list.py +4 -4
  4. waldur_api_client/api/autoprovisioning_rules/autoprovisioning_rules_partial_update.py +8 -4
  5. waldur_api_client/api/autoprovisioning_rules/autoprovisioning_rules_retrieve.py +8 -4
  6. waldur_api_client/api/autoprovisioning_rules/autoprovisioning_rules_update.py +8 -4
  7. waldur_api_client/api/marketplace_checklists/marketplace_checklists_questions_list.py +31 -32
  8. waldur_api_client/api/marketplace_checklists/marketplace_checklists_retrieve.py +15 -14
  9. waldur_api_client/api/marketplace_checklists_admin/__init__.py +1 -0
  10. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_checklist_questions.py +187 -0
  11. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_create.py +150 -0
  12. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_destroy.py +89 -0
  13. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_list.py +173 -0
  14. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_partial_update.py +164 -0
  15. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_retrieve.py +142 -0
  16. waldur_api_client/api/marketplace_checklists_admin/marketplace_checklists_admin_update.py +164 -0
  17. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/__init__.py +1 -0
  18. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/marketplace_checklists_admin_question_dependencies_create.py +150 -0
  19. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/marketplace_checklists_admin_question_dependencies_destroy.py +89 -0
  20. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/marketplace_checklists_admin_question_dependencies_list.py +212 -0
  21. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/marketplace_checklists_admin_question_dependencies_partial_update.py +164 -0
  22. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/marketplace_checklists_admin_question_dependencies_retrieve.py +142 -0
  23. waldur_api_client/api/marketplace_checklists_admin_question_dependencies/marketplace_checklists_admin_question_dependencies_update.py +164 -0
  24. waldur_api_client/api/marketplace_checklists_admin_question_options/__init__.py +1 -0
  25. waldur_api_client/api/marketplace_checklists_admin_question_options/marketplace_checklists_admin_question_options_create.py +150 -0
  26. waldur_api_client/api/marketplace_checklists_admin_question_options/marketplace_checklists_admin_question_options_destroy.py +89 -0
  27. waldur_api_client/api/marketplace_checklists_admin_question_options/marketplace_checklists_admin_question_options_list.py +194 -0
  28. waldur_api_client/api/marketplace_checklists_admin_question_options/marketplace_checklists_admin_question_options_partial_update.py +164 -0
  29. waldur_api_client/api/marketplace_checklists_admin_question_options/marketplace_checklists_admin_question_options_retrieve.py +142 -0
  30. waldur_api_client/api/marketplace_checklists_admin_question_options/marketplace_checklists_admin_question_options_update.py +164 -0
  31. waldur_api_client/api/marketplace_checklists_admin_questions/__init__.py +1 -0
  32. waldur_api_client/api/marketplace_checklists_admin_questions/marketplace_checklists_admin_questions_create.py +148 -0
  33. waldur_api_client/api/marketplace_checklists_admin_questions/marketplace_checklists_admin_questions_destroy.py +89 -0
  34. waldur_api_client/api/marketplace_checklists_admin_questions/marketplace_checklists_admin_questions_list.py +192 -0
  35. waldur_api_client/api/marketplace_checklists_admin_questions/marketplace_checklists_admin_questions_partial_update.py +162 -0
  36. waldur_api_client/api/marketplace_checklists_admin_questions/marketplace_checklists_admin_questions_retrieve.py +140 -0
  37. waldur_api_client/api/marketplace_checklists_admin_questions/marketplace_checklists_admin_questions_update.py +162 -0
  38. waldur_api_client/models/__init__.py +36 -2
  39. waldur_api_client/models/answer_list.py +8 -19
  40. waldur_api_client/models/answer_submit.py +7 -13
  41. waldur_api_client/models/answer_submit_request.py +7 -13
  42. waldur_api_client/models/booking_resource.py +18 -0
  43. waldur_api_client/models/booking_resources_list_field_item.py +2 -0
  44. waldur_api_client/models/booking_resources_retrieve_field_item.py +2 -0
  45. waldur_api_client/models/call_resource_template.py +23 -1
  46. waldur_api_client/models/checklist.py +8 -0
  47. waldur_api_client/models/checklist_admin.py +127 -0
  48. waldur_api_client/models/checklist_type_enum.py +10 -0
  49. waldur_api_client/models/create_checklist.py +131 -0
  50. waldur_api_client/models/create_checklist_request.py +90 -0
  51. waldur_api_client/models/group_invitation.py +16 -5
  52. waldur_api_client/models/group_invitation_request.py +16 -5
  53. waldur_api_client/models/marketplace_provider_resources_details_retrieve_field_item.py +2 -0
  54. waldur_api_client/models/marketplace_provider_resources_list_field_item.py +2 -0
  55. waldur_api_client/models/marketplace_provider_resources_retrieve_field_item.py +2 -0
  56. waldur_api_client/models/marketplace_resources_details_retrieve_field_item.py +2 -0
  57. waldur_api_client/models/marketplace_resources_list_field_item.py +2 -0
  58. waldur_api_client/models/marketplace_resources_retrieve_field_item.py +2 -0
  59. waldur_api_client/models/open_stack_floating_ip.py +21 -0
  60. waldur_api_client/models/open_stack_port.py +15 -4
  61. waldur_api_client/models/open_stack_router.py +15 -4
  62. waldur_api_client/models/openstack_floating_ips_list_field_item.py +1 -0
  63. waldur_api_client/models/openstack_floating_ips_retrieve_field_item.py +1 -0
  64. waldur_api_client/models/operator_enum.py +12 -0
  65. waldur_api_client/models/patched_create_checklist_request.py +96 -0
  66. waldur_api_client/models/patched_question_admin_request.py +208 -0
  67. waldur_api_client/models/patched_question_dependency_request.py +94 -0
  68. waldur_api_client/models/patched_question_options_admin_request.py +68 -0
  69. waldur_api_client/models/{checklist_question.py → question.py} +29 -16
  70. waldur_api_client/models/question_admin.py +260 -0
  71. waldur_api_client/models/question_admin_request.py +210 -0
  72. waldur_api_client/models/question_dependency.py +127 -0
  73. waldur_api_client/models/question_dependency_request.py +94 -0
  74. waldur_api_client/models/question_options.py +79 -0
  75. waldur_api_client/models/question_options_admin.py +103 -0
  76. waldur_api_client/models/question_options_admin_request.py +78 -0
  77. waldur_api_client/models/question_type_enum.py +15 -0
  78. waldur_api_client/models/resource.py +18 -0
  79. waldur_api_client/models/rule.py +46 -6
  80. {waldur_api_client-7.7.0.dist-info → waldur_api_client-7.7.2.dist-info}/METADATA +1 -1
  81. {waldur_api_client-7.7.0.dist-info → waldur_api_client-7.7.2.dist-info}/RECORD +83 -37
  82. {waldur_api_client-7.7.0.dist-info → waldur_api_client-7.7.2.dist-info}/LICENSE +0 -0
  83. {waldur_api_client-7.7.0.dist-info → waldur_api_client-7.7.2.dist-info}/WHEEL +0 -0
@@ -0,0 +1,192 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.question_admin import QuestionAdmin
10
+ from ...types import UNSET, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ checklist_uuid: Union[Unset, UUID] = UNSET,
16
+ page: Union[Unset, int] = UNSET,
17
+ page_size: Union[Unset, int] = UNSET,
18
+ ) -> dict[str, Any]:
19
+ params: dict[str, Any] = {}
20
+
21
+ json_checklist_uuid: Union[Unset, str] = UNSET
22
+ if not isinstance(checklist_uuid, Unset):
23
+ json_checklist_uuid = str(checklist_uuid)
24
+ params["checklist_uuid"] = json_checklist_uuid
25
+
26
+ params["page"] = page
27
+
28
+ params["page_size"] = page_size
29
+
30
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
31
+
32
+ _kwargs: dict[str, Any] = {
33
+ "method": "get",
34
+ "url": "/api/marketplace-checklists-admin-questions/",
35
+ "params": params,
36
+ }
37
+
38
+ return _kwargs
39
+
40
+
41
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> list["QuestionAdmin"]:
42
+ if response.status_code == 200:
43
+ response_200 = []
44
+ _response_200 = response.json()
45
+ for response_200_item_data in _response_200:
46
+ response_200_item = QuestionAdmin.from_dict(response_200_item_data)
47
+
48
+ response_200.append(response_200_item)
49
+
50
+ return response_200
51
+ raise errors.UnexpectedStatus(response.status_code, response.content)
52
+
53
+
54
+ def _build_response(
55
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
56
+ ) -> Response[list["QuestionAdmin"]]:
57
+ return Response(
58
+ status_code=HTTPStatus(response.status_code),
59
+ content=response.content,
60
+ headers=response.headers,
61
+ parsed=_parse_response(client=client, response=response),
62
+ )
63
+
64
+
65
+ def sync_detailed(
66
+ *,
67
+ client: AuthenticatedClient,
68
+ checklist_uuid: Union[Unset, UUID] = UNSET,
69
+ page: Union[Unset, int] = UNSET,
70
+ page_size: Union[Unset, int] = UNSET,
71
+ ) -> Response[list["QuestionAdmin"]]:
72
+ """Mixin to optimize HEAD requests for DRF views bypassing serializer processing
73
+
74
+ Args:
75
+ checklist_uuid (Union[Unset, UUID]):
76
+ page (Union[Unset, int]):
77
+ page_size (Union[Unset, int]):
78
+
79
+ Raises:
80
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
81
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
82
+
83
+ Returns:
84
+ Response[list['QuestionAdmin']]
85
+ """
86
+
87
+ kwargs = _get_kwargs(
88
+ checklist_uuid=checklist_uuid,
89
+ page=page,
90
+ page_size=page_size,
91
+ )
92
+
93
+ response = client.get_httpx_client().request(
94
+ **kwargs,
95
+ )
96
+
97
+ return _build_response(client=client, response=response)
98
+
99
+
100
+ def sync(
101
+ *,
102
+ client: AuthenticatedClient,
103
+ checklist_uuid: Union[Unset, UUID] = UNSET,
104
+ page: Union[Unset, int] = UNSET,
105
+ page_size: Union[Unset, int] = UNSET,
106
+ ) -> list["QuestionAdmin"]:
107
+ """Mixin to optimize HEAD requests for DRF views bypassing serializer processing
108
+
109
+ Args:
110
+ checklist_uuid (Union[Unset, UUID]):
111
+ page (Union[Unset, int]):
112
+ page_size (Union[Unset, int]):
113
+
114
+ Raises:
115
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
116
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
117
+
118
+ Returns:
119
+ list['QuestionAdmin']
120
+ """
121
+
122
+ return sync_detailed(
123
+ client=client,
124
+ checklist_uuid=checklist_uuid,
125
+ page=page,
126
+ page_size=page_size,
127
+ ).parsed
128
+
129
+
130
+ async def asyncio_detailed(
131
+ *,
132
+ client: AuthenticatedClient,
133
+ checklist_uuid: Union[Unset, UUID] = UNSET,
134
+ page: Union[Unset, int] = UNSET,
135
+ page_size: Union[Unset, int] = UNSET,
136
+ ) -> Response[list["QuestionAdmin"]]:
137
+ """Mixin to optimize HEAD requests for DRF views bypassing serializer processing
138
+
139
+ Args:
140
+ checklist_uuid (Union[Unset, UUID]):
141
+ page (Union[Unset, int]):
142
+ page_size (Union[Unset, int]):
143
+
144
+ Raises:
145
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
146
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
147
+
148
+ Returns:
149
+ Response[list['QuestionAdmin']]
150
+ """
151
+
152
+ kwargs = _get_kwargs(
153
+ checklist_uuid=checklist_uuid,
154
+ page=page,
155
+ page_size=page_size,
156
+ )
157
+
158
+ response = await client.get_async_httpx_client().request(**kwargs)
159
+
160
+ return _build_response(client=client, response=response)
161
+
162
+
163
+ async def asyncio(
164
+ *,
165
+ client: AuthenticatedClient,
166
+ checklist_uuid: Union[Unset, UUID] = UNSET,
167
+ page: Union[Unset, int] = UNSET,
168
+ page_size: Union[Unset, int] = UNSET,
169
+ ) -> list["QuestionAdmin"]:
170
+ """Mixin to optimize HEAD requests for DRF views bypassing serializer processing
171
+
172
+ Args:
173
+ checklist_uuid (Union[Unset, UUID]):
174
+ page (Union[Unset, int]):
175
+ page_size (Union[Unset, int]):
176
+
177
+ Raises:
178
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
179
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
180
+
181
+ Returns:
182
+ list['QuestionAdmin']
183
+ """
184
+
185
+ return (
186
+ await asyncio_detailed(
187
+ client=client,
188
+ checklist_uuid=checklist_uuid,
189
+ page=page,
190
+ page_size=page_size,
191
+ )
192
+ ).parsed
@@ -0,0 +1,162 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.patched_question_admin_request import PatchedQuestionAdminRequest
10
+ from ...models.question_admin import QuestionAdmin
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ uuid: UUID,
16
+ *,
17
+ body: PatchedQuestionAdminRequest,
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "patch",
23
+ "url": f"/api/marketplace-checklists-admin-questions/{uuid}/",
24
+ }
25
+
26
+ _kwargs["json"] = body.to_dict()
27
+
28
+ headers["Content-Type"] = "application/json"
29
+
30
+ _kwargs["headers"] = headers
31
+ return _kwargs
32
+
33
+
34
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> QuestionAdmin:
35
+ if response.status_code == 200:
36
+ response_200 = QuestionAdmin.from_dict(response.json())
37
+
38
+ return response_200
39
+ raise errors.UnexpectedStatus(response.status_code, response.content)
40
+
41
+
42
+ def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[QuestionAdmin]:
43
+ return Response(
44
+ status_code=HTTPStatus(response.status_code),
45
+ content=response.content,
46
+ headers=response.headers,
47
+ parsed=_parse_response(client=client, response=response),
48
+ )
49
+
50
+
51
+ def sync_detailed(
52
+ uuid: UUID,
53
+ *,
54
+ client: AuthenticatedClient,
55
+ body: PatchedQuestionAdminRequest,
56
+ ) -> Response[QuestionAdmin]:
57
+ """
58
+ Args:
59
+ uuid (UUID):
60
+ body (PatchedQuestionAdminRequest):
61
+
62
+ Raises:
63
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
64
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
65
+
66
+ Returns:
67
+ Response[QuestionAdmin]
68
+ """
69
+
70
+ kwargs = _get_kwargs(
71
+ uuid=uuid,
72
+ body=body,
73
+ )
74
+
75
+ response = client.get_httpx_client().request(
76
+ **kwargs,
77
+ )
78
+
79
+ return _build_response(client=client, response=response)
80
+
81
+
82
+ def sync(
83
+ uuid: UUID,
84
+ *,
85
+ client: AuthenticatedClient,
86
+ body: PatchedQuestionAdminRequest,
87
+ ) -> QuestionAdmin:
88
+ """
89
+ Args:
90
+ uuid (UUID):
91
+ body (PatchedQuestionAdminRequest):
92
+
93
+ Raises:
94
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
95
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
96
+
97
+ Returns:
98
+ QuestionAdmin
99
+ """
100
+
101
+ return sync_detailed(
102
+ uuid=uuid,
103
+ client=client,
104
+ body=body,
105
+ ).parsed
106
+
107
+
108
+ async def asyncio_detailed(
109
+ uuid: UUID,
110
+ *,
111
+ client: AuthenticatedClient,
112
+ body: PatchedQuestionAdminRequest,
113
+ ) -> Response[QuestionAdmin]:
114
+ """
115
+ Args:
116
+ uuid (UUID):
117
+ body (PatchedQuestionAdminRequest):
118
+
119
+ Raises:
120
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
121
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
122
+
123
+ Returns:
124
+ Response[QuestionAdmin]
125
+ """
126
+
127
+ kwargs = _get_kwargs(
128
+ uuid=uuid,
129
+ body=body,
130
+ )
131
+
132
+ response = await client.get_async_httpx_client().request(**kwargs)
133
+
134
+ return _build_response(client=client, response=response)
135
+
136
+
137
+ async def asyncio(
138
+ uuid: UUID,
139
+ *,
140
+ client: AuthenticatedClient,
141
+ body: PatchedQuestionAdminRequest,
142
+ ) -> QuestionAdmin:
143
+ """
144
+ Args:
145
+ uuid (UUID):
146
+ body (PatchedQuestionAdminRequest):
147
+
148
+ Raises:
149
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
150
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
151
+
152
+ Returns:
153
+ QuestionAdmin
154
+ """
155
+
156
+ return (
157
+ await asyncio_detailed(
158
+ uuid=uuid,
159
+ client=client,
160
+ body=body,
161
+ )
162
+ ).parsed
@@ -0,0 +1,140 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.question_admin import QuestionAdmin
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ uuid: UUID,
15
+ ) -> dict[str, Any]:
16
+ _kwargs: dict[str, Any] = {
17
+ "method": "get",
18
+ "url": f"/api/marketplace-checklists-admin-questions/{uuid}/",
19
+ }
20
+
21
+ return _kwargs
22
+
23
+
24
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> QuestionAdmin:
25
+ if response.status_code == 200:
26
+ response_200 = QuestionAdmin.from_dict(response.json())
27
+
28
+ return response_200
29
+ raise errors.UnexpectedStatus(response.status_code, response.content)
30
+
31
+
32
+ def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[QuestionAdmin]:
33
+ return Response(
34
+ status_code=HTTPStatus(response.status_code),
35
+ content=response.content,
36
+ headers=response.headers,
37
+ parsed=_parse_response(client=client, response=response),
38
+ )
39
+
40
+
41
+ def sync_detailed(
42
+ uuid: UUID,
43
+ *,
44
+ client: AuthenticatedClient,
45
+ ) -> Response[QuestionAdmin]:
46
+ """
47
+ Args:
48
+ uuid (UUID):
49
+
50
+ Raises:
51
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
52
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
53
+
54
+ Returns:
55
+ Response[QuestionAdmin]
56
+ """
57
+
58
+ kwargs = _get_kwargs(
59
+ uuid=uuid,
60
+ )
61
+
62
+ response = client.get_httpx_client().request(
63
+ **kwargs,
64
+ )
65
+
66
+ return _build_response(client=client, response=response)
67
+
68
+
69
+ def sync(
70
+ uuid: UUID,
71
+ *,
72
+ client: AuthenticatedClient,
73
+ ) -> QuestionAdmin:
74
+ """
75
+ Args:
76
+ uuid (UUID):
77
+
78
+ Raises:
79
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
80
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
81
+
82
+ Returns:
83
+ QuestionAdmin
84
+ """
85
+
86
+ return sync_detailed(
87
+ uuid=uuid,
88
+ client=client,
89
+ ).parsed
90
+
91
+
92
+ async def asyncio_detailed(
93
+ uuid: UUID,
94
+ *,
95
+ client: AuthenticatedClient,
96
+ ) -> Response[QuestionAdmin]:
97
+ """
98
+ Args:
99
+ uuid (UUID):
100
+
101
+ Raises:
102
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
103
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
104
+
105
+ Returns:
106
+ Response[QuestionAdmin]
107
+ """
108
+
109
+ kwargs = _get_kwargs(
110
+ uuid=uuid,
111
+ )
112
+
113
+ response = await client.get_async_httpx_client().request(**kwargs)
114
+
115
+ return _build_response(client=client, response=response)
116
+
117
+
118
+ async def asyncio(
119
+ uuid: UUID,
120
+ *,
121
+ client: AuthenticatedClient,
122
+ ) -> QuestionAdmin:
123
+ """
124
+ Args:
125
+ uuid (UUID):
126
+
127
+ Raises:
128
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
129
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
130
+
131
+ Returns:
132
+ QuestionAdmin
133
+ """
134
+
135
+ return (
136
+ await asyncio_detailed(
137
+ uuid=uuid,
138
+ client=client,
139
+ )
140
+ ).parsed
@@ -0,0 +1,162 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.question_admin import QuestionAdmin
10
+ from ...models.question_admin_request import QuestionAdminRequest
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ uuid: UUID,
16
+ *,
17
+ body: QuestionAdminRequest,
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "put",
23
+ "url": f"/api/marketplace-checklists-admin-questions/{uuid}/",
24
+ }
25
+
26
+ _kwargs["json"] = body.to_dict()
27
+
28
+ headers["Content-Type"] = "application/json"
29
+
30
+ _kwargs["headers"] = headers
31
+ return _kwargs
32
+
33
+
34
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> QuestionAdmin:
35
+ if response.status_code == 200:
36
+ response_200 = QuestionAdmin.from_dict(response.json())
37
+
38
+ return response_200
39
+ raise errors.UnexpectedStatus(response.status_code, response.content)
40
+
41
+
42
+ def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[QuestionAdmin]:
43
+ return Response(
44
+ status_code=HTTPStatus(response.status_code),
45
+ content=response.content,
46
+ headers=response.headers,
47
+ parsed=_parse_response(client=client, response=response),
48
+ )
49
+
50
+
51
+ def sync_detailed(
52
+ uuid: UUID,
53
+ *,
54
+ client: AuthenticatedClient,
55
+ body: QuestionAdminRequest,
56
+ ) -> Response[QuestionAdmin]:
57
+ """
58
+ Args:
59
+ uuid (UUID):
60
+ body (QuestionAdminRequest):
61
+
62
+ Raises:
63
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
64
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
65
+
66
+ Returns:
67
+ Response[QuestionAdmin]
68
+ """
69
+
70
+ kwargs = _get_kwargs(
71
+ uuid=uuid,
72
+ body=body,
73
+ )
74
+
75
+ response = client.get_httpx_client().request(
76
+ **kwargs,
77
+ )
78
+
79
+ return _build_response(client=client, response=response)
80
+
81
+
82
+ def sync(
83
+ uuid: UUID,
84
+ *,
85
+ client: AuthenticatedClient,
86
+ body: QuestionAdminRequest,
87
+ ) -> QuestionAdmin:
88
+ """
89
+ Args:
90
+ uuid (UUID):
91
+ body (QuestionAdminRequest):
92
+
93
+ Raises:
94
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
95
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
96
+
97
+ Returns:
98
+ QuestionAdmin
99
+ """
100
+
101
+ return sync_detailed(
102
+ uuid=uuid,
103
+ client=client,
104
+ body=body,
105
+ ).parsed
106
+
107
+
108
+ async def asyncio_detailed(
109
+ uuid: UUID,
110
+ *,
111
+ client: AuthenticatedClient,
112
+ body: QuestionAdminRequest,
113
+ ) -> Response[QuestionAdmin]:
114
+ """
115
+ Args:
116
+ uuid (UUID):
117
+ body (QuestionAdminRequest):
118
+
119
+ Raises:
120
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
121
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
122
+
123
+ Returns:
124
+ Response[QuestionAdmin]
125
+ """
126
+
127
+ kwargs = _get_kwargs(
128
+ uuid=uuid,
129
+ body=body,
130
+ )
131
+
132
+ response = await client.get_async_httpx_client().request(**kwargs)
133
+
134
+ return _build_response(client=client, response=response)
135
+
136
+
137
+ async def asyncio(
138
+ uuid: UUID,
139
+ *,
140
+ client: AuthenticatedClient,
141
+ body: QuestionAdminRequest,
142
+ ) -> QuestionAdmin:
143
+ """
144
+ Args:
145
+ uuid (UUID):
146
+ body (QuestionAdminRequest):
147
+
148
+ Raises:
149
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
150
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
151
+
152
+ Returns:
153
+ QuestionAdmin
154
+ """
155
+
156
+ return (
157
+ await asyncio_detailed(
158
+ uuid=uuid,
159
+ client=client,
160
+ body=body,
161
+ )
162
+ ).parsed