waldur-api-client 7.6.8__py3-none-any.whl → 7.7.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of waldur-api-client might be problematic. Click here for more details.

Files changed (91) hide show
  1. waldur_api_client/api/broadcast_messages/broadcast_messages_schedule.py +89 -0
  2. waldur_api_client/api/call_proposal_project_role_mappings/call_proposal_project_role_mappings_create.py +152 -0
  3. waldur_api_client/api/call_proposal_project_role_mappings/call_proposal_project_role_mappings_destroy.py +89 -0
  4. waldur_api_client/api/call_proposal_project_role_mappings/call_proposal_project_role_mappings_list.py +194 -0
  5. waldur_api_client/api/call_proposal_project_role_mappings/call_proposal_project_role_mappings_partial_update.py +166 -0
  6. waldur_api_client/api/call_proposal_project_role_mappings/call_proposal_project_role_mappings_retrieve.py +144 -0
  7. waldur_api_client/api/call_proposal_project_role_mappings/call_proposal_project_role_mappings_update.py +166 -0
  8. waldur_api_client/api/invoices/invoices_list.py +0 -30
  9. waldur_api_client/api/invoices/invoices_stats_list.py +0 -30
  10. waldur_api_client/api/marketplace_maintenance_announcement_offerings/__init__.py +1 -0
  11. waldur_api_client/api/marketplace_maintenance_announcement_offerings/marketplace_maintenance_announcement_offerings_create.py +152 -0
  12. waldur_api_client/api/marketplace_maintenance_announcement_offerings/marketplace_maintenance_announcement_offerings_destroy.py +89 -0
  13. waldur_api_client/api/marketplace_maintenance_announcement_offerings/marketplace_maintenance_announcement_offerings_list.py +175 -0
  14. waldur_api_client/api/marketplace_maintenance_announcement_offerings/marketplace_maintenance_announcement_offerings_partial_update.py +166 -0
  15. waldur_api_client/api/marketplace_maintenance_announcement_offerings/marketplace_maintenance_announcement_offerings_retrieve.py +144 -0
  16. waldur_api_client/api/marketplace_maintenance_announcement_offerings/marketplace_maintenance_announcement_offerings_update.py +166 -0
  17. waldur_api_client/api/marketplace_maintenance_announcement_template_offerings/__init__.py +1 -0
  18. waldur_api_client/api/marketplace_maintenance_announcement_template_offerings/marketplace_maintenance_announcement_template_offerings_create.py +152 -0
  19. waldur_api_client/api/marketplace_maintenance_announcement_template_offerings/marketplace_maintenance_announcement_template_offerings_destroy.py +89 -0
  20. waldur_api_client/api/marketplace_maintenance_announcement_template_offerings/marketplace_maintenance_announcement_template_offerings_list.py +175 -0
  21. waldur_api_client/api/marketplace_maintenance_announcement_template_offerings/marketplace_maintenance_announcement_template_offerings_partial_update.py +168 -0
  22. waldur_api_client/api/marketplace_maintenance_announcement_template_offerings/marketplace_maintenance_announcement_template_offerings_retrieve.py +144 -0
  23. waldur_api_client/api/marketplace_maintenance_announcement_template_offerings/marketplace_maintenance_announcement_template_offerings_update.py +166 -0
  24. waldur_api_client/api/marketplace_maintenance_announcements/__init__.py +1 -0
  25. waldur_api_client/api/{autoprovisioning_rule_plans/autoprovisioning_rule_plans_create.py → marketplace_maintenance_announcements/marketplace_maintenance_announcements_create.py} +25 -23
  26. waldur_api_client/api/marketplace_maintenance_announcements/marketplace_maintenance_announcements_destroy.py +89 -0
  27. waldur_api_client/api/{autoprovisioning_rule_plans/autoprovisioning_rule_plans_list.py → marketplace_maintenance_announcements/marketplace_maintenance_announcements_list.py} +15 -13
  28. waldur_api_client/api/{autoprovisioning_rule_plans/autoprovisioning_rule_plans_partial_update.py → marketplace_maintenance_announcements/marketplace_maintenance_announcements_partial_update.py} +25 -23
  29. waldur_api_client/api/{autoprovisioning_rule_plans/autoprovisioning_rule_plans_retrieve.py → marketplace_maintenance_announcements/marketplace_maintenance_announcements_retrieve.py} +15 -13
  30. waldur_api_client/api/{autoprovisioning_rule_plans/autoprovisioning_rule_plans_update.py → marketplace_maintenance_announcements/marketplace_maintenance_announcements_update.py} +25 -23
  31. waldur_api_client/api/marketplace_maintenance_announcements_template/__init__.py +1 -0
  32. waldur_api_client/api/marketplace_maintenance_announcements_template/marketplace_maintenance_announcements_template_create.py +152 -0
  33. waldur_api_client/api/marketplace_maintenance_announcements_template/marketplace_maintenance_announcements_template_destroy.py +89 -0
  34. waldur_api_client/api/marketplace_maintenance_announcements_template/marketplace_maintenance_announcements_template_list.py +175 -0
  35. waldur_api_client/api/marketplace_maintenance_announcements_template/marketplace_maintenance_announcements_template_partial_update.py +166 -0
  36. waldur_api_client/api/marketplace_maintenance_announcements_template/marketplace_maintenance_announcements_template_retrieve.py +144 -0
  37. waldur_api_client/api/marketplace_maintenance_announcements_template/marketplace_maintenance_announcements_template_update.py +166 -0
  38. waldur_api_client/api/{autoprovisioning_rule_plans/autoprovisioning_rule_plans_destroy.py → marketplace_plans/marketplace_plans_destroy.py} +1 -1
  39. waldur_api_client/api/marketplace_provider_offerings/marketplace_provider_offerings_update_offering_component.py +6 -6
  40. waldur_api_client/api/openstack_volume_types/openstack_volume_types_names_retrieve.py +118 -0
  41. waldur_api_client/models/__init__.py +52 -18
  42. waldur_api_client/models/constance_settings.py +22 -0
  43. waldur_api_client/models/constance_settings_request.py +22 -0
  44. waldur_api_client/models/event_types_enum.py +1 -0
  45. waldur_api_client/models/impact_level_enum.py +11 -0
  46. waldur_api_client/models/maintenance_announcement.py +225 -0
  47. waldur_api_client/models/maintenance_announcement_offering.py +112 -0
  48. waldur_api_client/models/maintenance_announcement_offering_request.py +95 -0
  49. waldur_api_client/models/maintenance_announcement_offering_template.py +112 -0
  50. waldur_api_client/models/maintenance_announcement_offering_template_request.py +95 -0
  51. waldur_api_client/models/maintenance_announcement_request.py +113 -0
  52. waldur_api_client/models/maintenance_announcement_state_enum.py +12 -0
  53. waldur_api_client/models/maintenance_announcement_template.py +134 -0
  54. waldur_api_client/models/maintenance_announcement_template_request.py +95 -0
  55. waldur_api_client/models/maintenance_type_enum.py +12 -0
  56. waldur_api_client/models/merged_plugin_options.py +1 -1
  57. waldur_api_client/models/merged_plugin_options_request.py +1 -1
  58. waldur_api_client/models/offering_component.py +15 -4
  59. waldur_api_client/models/patched_maintenance_announcement_offering_request.py +94 -0
  60. waldur_api_client/models/patched_maintenance_announcement_offering_template_request.py +94 -0
  61. waldur_api_client/models/patched_maintenance_announcement_request.py +128 -0
  62. waldur_api_client/models/patched_maintenance_announcement_template_request.py +94 -0
  63. waldur_api_client/models/patched_proposal_project_role_mapping_request.py +88 -0
  64. waldur_api_client/models/patched_protected_call_request.py +0 -17
  65. waldur_api_client/models/patched_rule_request.py +90 -1
  66. waldur_api_client/models/{patched_rule_plans_request_limits.py → patched_rule_request_plan_attributes.py} +5 -5
  67. waldur_api_client/models/patched_rule_request_plan_limits.py +44 -0
  68. waldur_api_client/models/proposal_project_role_mapping.py +122 -0
  69. waldur_api_client/models/proposal_project_role_mapping_request.py +89 -0
  70. waldur_api_client/models/proposal_protected_calls_list_field_item.py +0 -3
  71. waldur_api_client/models/proposal_protected_calls_retrieve_field_item.py +0 -3
  72. waldur_api_client/models/protected_call.py +0 -34
  73. waldur_api_client/models/protected_call_request.py +0 -17
  74. waldur_api_client/models/provider_offering_details.py +1 -1
  75. waldur_api_client/models/public_offering_details.py +1 -1
  76. waldur_api_client/models/rule.py +99 -7
  77. waldur_api_client/models/{rule_plans_attributes.py → rule_plan_attributes.py} +5 -5
  78. waldur_api_client/models/{rule_plans_limits.py → rule_plan_limits.py} +5 -5
  79. waldur_api_client/models/rule_request.py +89 -1
  80. waldur_api_client/models/{rule_plans_request_attributes.py → rule_request_plan_attributes.py} +5 -5
  81. waldur_api_client/models/{rule_plans_request_limits.py → rule_request_plan_limits.py} +5 -5
  82. waldur_api_client/models/update_offering_component_request.py +274 -0
  83. {waldur_api_client-7.6.8.dist-info → waldur_api_client-7.7.0.dist-info}/METADATA +1 -1
  84. {waldur_api_client-7.6.8.dist-info → waldur_api_client-7.7.0.dist-info}/RECORD +87 -40
  85. waldur_api_client/models/patched_rule_plans_request.py +0 -108
  86. waldur_api_client/models/patched_rule_plans_request_attributes.py +0 -44
  87. waldur_api_client/models/rule_plans.py +0 -126
  88. waldur_api_client/models/rule_plans_request.py +0 -109
  89. /waldur_api_client/api/{autoprovisioning_rule_plans → call_proposal_project_role_mappings}/__init__.py +0 -0
  90. {waldur_api_client-7.6.8.dist-info → waldur_api_client-7.7.0.dist-info}/LICENSE +0 -0
  91. {waldur_api_client-7.6.8.dist-info → waldur_api_client-7.7.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,89 @@
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 ...types import Response
10
+
11
+
12
+ def _get_kwargs(
13
+ uuid: UUID,
14
+ ) -> dict[str, Any]:
15
+ _kwargs: dict[str, Any] = {
16
+ "method": "delete",
17
+ "url": f"/api/marketplace-maintenance-announcements-template/{uuid}/",
18
+ }
19
+
20
+ return _kwargs
21
+
22
+
23
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Any:
24
+ if response.status_code == 204:
25
+ return None
26
+ raise errors.UnexpectedStatus(response.status_code, response.content)
27
+
28
+
29
+ def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
30
+ return Response(
31
+ status_code=HTTPStatus(response.status_code),
32
+ content=response.content,
33
+ headers=response.headers,
34
+ parsed=_parse_response(client=client, response=response),
35
+ )
36
+
37
+
38
+ def sync_detailed(
39
+ uuid: UUID,
40
+ *,
41
+ client: AuthenticatedClient,
42
+ ) -> Response[Any]:
43
+ """
44
+ Args:
45
+ uuid (UUID):
46
+
47
+ Raises:
48
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
49
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
50
+
51
+ Returns:
52
+ Response[Any]
53
+ """
54
+
55
+ kwargs = _get_kwargs(
56
+ uuid=uuid,
57
+ )
58
+
59
+ response = client.get_httpx_client().request(
60
+ **kwargs,
61
+ )
62
+
63
+ return _build_response(client=client, response=response)
64
+
65
+
66
+ async def asyncio_detailed(
67
+ uuid: UUID,
68
+ *,
69
+ client: AuthenticatedClient,
70
+ ) -> Response[Any]:
71
+ """
72
+ Args:
73
+ uuid (UUID):
74
+
75
+ Raises:
76
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
77
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
78
+
79
+ Returns:
80
+ Response[Any]
81
+ """
82
+
83
+ kwargs = _get_kwargs(
84
+ uuid=uuid,
85
+ )
86
+
87
+ response = await client.get_async_httpx_client().request(**kwargs)
88
+
89
+ return _build_response(client=client, response=response)
@@ -0,0 +1,175 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.maintenance_announcement_template import MaintenanceAnnouncementTemplate
9
+ from ...types import UNSET, Response, Unset
10
+
11
+
12
+ def _get_kwargs(
13
+ *,
14
+ page: Union[Unset, int] = UNSET,
15
+ page_size: Union[Unset, int] = UNSET,
16
+ ) -> dict[str, Any]:
17
+ params: dict[str, Any] = {}
18
+
19
+ params["page"] = page
20
+
21
+ params["page_size"] = page_size
22
+
23
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
24
+
25
+ _kwargs: dict[str, Any] = {
26
+ "method": "get",
27
+ "url": "/api/marketplace-maintenance-announcements-template/",
28
+ "params": params,
29
+ }
30
+
31
+ return _kwargs
32
+
33
+
34
+ def _parse_response(
35
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
36
+ ) -> list["MaintenanceAnnouncementTemplate"]:
37
+ if response.status_code == 200:
38
+ response_200 = []
39
+ _response_200 = response.json()
40
+ for response_200_item_data in _response_200:
41
+ response_200_item = MaintenanceAnnouncementTemplate.from_dict(response_200_item_data)
42
+
43
+ response_200.append(response_200_item)
44
+
45
+ return response_200
46
+ raise errors.UnexpectedStatus(response.status_code, response.content)
47
+
48
+
49
+ def _build_response(
50
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
51
+ ) -> Response[list["MaintenanceAnnouncementTemplate"]]:
52
+ return Response(
53
+ status_code=HTTPStatus(response.status_code),
54
+ content=response.content,
55
+ headers=response.headers,
56
+ parsed=_parse_response(client=client, response=response),
57
+ )
58
+
59
+
60
+ def sync_detailed(
61
+ *,
62
+ client: AuthenticatedClient,
63
+ page: Union[Unset, int] = UNSET,
64
+ page_size: Union[Unset, int] = UNSET,
65
+ ) -> Response[list["MaintenanceAnnouncementTemplate"]]:
66
+ """Mixin to optimize HEAD requests for DRF views bypassing serializer processing
67
+
68
+ Args:
69
+ page (Union[Unset, int]):
70
+ page_size (Union[Unset, int]):
71
+
72
+ Raises:
73
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
74
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
75
+
76
+ Returns:
77
+ Response[list['MaintenanceAnnouncementTemplate']]
78
+ """
79
+
80
+ kwargs = _get_kwargs(
81
+ page=page,
82
+ page_size=page_size,
83
+ )
84
+
85
+ response = client.get_httpx_client().request(
86
+ **kwargs,
87
+ )
88
+
89
+ return _build_response(client=client, response=response)
90
+
91
+
92
+ def sync(
93
+ *,
94
+ client: AuthenticatedClient,
95
+ page: Union[Unset, int] = UNSET,
96
+ page_size: Union[Unset, int] = UNSET,
97
+ ) -> list["MaintenanceAnnouncementTemplate"]:
98
+ """Mixin to optimize HEAD requests for DRF views bypassing serializer processing
99
+
100
+ Args:
101
+ page (Union[Unset, int]):
102
+ page_size (Union[Unset, int]):
103
+
104
+ Raises:
105
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
106
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
107
+
108
+ Returns:
109
+ list['MaintenanceAnnouncementTemplate']
110
+ """
111
+
112
+ return sync_detailed(
113
+ client=client,
114
+ page=page,
115
+ page_size=page_size,
116
+ ).parsed
117
+
118
+
119
+ async def asyncio_detailed(
120
+ *,
121
+ client: AuthenticatedClient,
122
+ page: Union[Unset, int] = UNSET,
123
+ page_size: Union[Unset, int] = UNSET,
124
+ ) -> Response[list["MaintenanceAnnouncementTemplate"]]:
125
+ """Mixin to optimize HEAD requests for DRF views bypassing serializer processing
126
+
127
+ Args:
128
+ page (Union[Unset, int]):
129
+ page_size (Union[Unset, int]):
130
+
131
+ Raises:
132
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
133
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
134
+
135
+ Returns:
136
+ Response[list['MaintenanceAnnouncementTemplate']]
137
+ """
138
+
139
+ kwargs = _get_kwargs(
140
+ page=page,
141
+ page_size=page_size,
142
+ )
143
+
144
+ response = await client.get_async_httpx_client().request(**kwargs)
145
+
146
+ return _build_response(client=client, response=response)
147
+
148
+
149
+ async def asyncio(
150
+ *,
151
+ client: AuthenticatedClient,
152
+ page: Union[Unset, int] = UNSET,
153
+ page_size: Union[Unset, int] = UNSET,
154
+ ) -> list["MaintenanceAnnouncementTemplate"]:
155
+ """Mixin to optimize HEAD requests for DRF views bypassing serializer processing
156
+
157
+ Args:
158
+ page (Union[Unset, int]):
159
+ page_size (Union[Unset, int]):
160
+
161
+ Raises:
162
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
163
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
164
+
165
+ Returns:
166
+ list['MaintenanceAnnouncementTemplate']
167
+ """
168
+
169
+ return (
170
+ await asyncio_detailed(
171
+ client=client,
172
+ page=page,
173
+ page_size=page_size,
174
+ )
175
+ ).parsed
@@ -0,0 +1,166 @@
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.maintenance_announcement_template import MaintenanceAnnouncementTemplate
10
+ from ...models.patched_maintenance_announcement_template_request import PatchedMaintenanceAnnouncementTemplateRequest
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ uuid: UUID,
16
+ *,
17
+ body: PatchedMaintenanceAnnouncementTemplateRequest,
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "patch",
23
+ "url": f"/api/marketplace-maintenance-announcements-template/{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(
35
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
36
+ ) -> MaintenanceAnnouncementTemplate:
37
+ if response.status_code == 200:
38
+ response_200 = MaintenanceAnnouncementTemplate.from_dict(response.json())
39
+
40
+ return response_200
41
+ raise errors.UnexpectedStatus(response.status_code, response.content)
42
+
43
+
44
+ def _build_response(
45
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
46
+ ) -> Response[MaintenanceAnnouncementTemplate]:
47
+ return Response(
48
+ status_code=HTTPStatus(response.status_code),
49
+ content=response.content,
50
+ headers=response.headers,
51
+ parsed=_parse_response(client=client, response=response),
52
+ )
53
+
54
+
55
+ def sync_detailed(
56
+ uuid: UUID,
57
+ *,
58
+ client: AuthenticatedClient,
59
+ body: PatchedMaintenanceAnnouncementTemplateRequest,
60
+ ) -> Response[MaintenanceAnnouncementTemplate]:
61
+ """
62
+ Args:
63
+ uuid (UUID):
64
+ body (PatchedMaintenanceAnnouncementTemplateRequest):
65
+
66
+ Raises:
67
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
68
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
69
+
70
+ Returns:
71
+ Response[MaintenanceAnnouncementTemplate]
72
+ """
73
+
74
+ kwargs = _get_kwargs(
75
+ uuid=uuid,
76
+ body=body,
77
+ )
78
+
79
+ response = client.get_httpx_client().request(
80
+ **kwargs,
81
+ )
82
+
83
+ return _build_response(client=client, response=response)
84
+
85
+
86
+ def sync(
87
+ uuid: UUID,
88
+ *,
89
+ client: AuthenticatedClient,
90
+ body: PatchedMaintenanceAnnouncementTemplateRequest,
91
+ ) -> MaintenanceAnnouncementTemplate:
92
+ """
93
+ Args:
94
+ uuid (UUID):
95
+ body (PatchedMaintenanceAnnouncementTemplateRequest):
96
+
97
+ Raises:
98
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
99
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
100
+
101
+ Returns:
102
+ MaintenanceAnnouncementTemplate
103
+ """
104
+
105
+ return sync_detailed(
106
+ uuid=uuid,
107
+ client=client,
108
+ body=body,
109
+ ).parsed
110
+
111
+
112
+ async def asyncio_detailed(
113
+ uuid: UUID,
114
+ *,
115
+ client: AuthenticatedClient,
116
+ body: PatchedMaintenanceAnnouncementTemplateRequest,
117
+ ) -> Response[MaintenanceAnnouncementTemplate]:
118
+ """
119
+ Args:
120
+ uuid (UUID):
121
+ body (PatchedMaintenanceAnnouncementTemplateRequest):
122
+
123
+ Raises:
124
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
125
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
126
+
127
+ Returns:
128
+ Response[MaintenanceAnnouncementTemplate]
129
+ """
130
+
131
+ kwargs = _get_kwargs(
132
+ uuid=uuid,
133
+ body=body,
134
+ )
135
+
136
+ response = await client.get_async_httpx_client().request(**kwargs)
137
+
138
+ return _build_response(client=client, response=response)
139
+
140
+
141
+ async def asyncio(
142
+ uuid: UUID,
143
+ *,
144
+ client: AuthenticatedClient,
145
+ body: PatchedMaintenanceAnnouncementTemplateRequest,
146
+ ) -> MaintenanceAnnouncementTemplate:
147
+ """
148
+ Args:
149
+ uuid (UUID):
150
+ body (PatchedMaintenanceAnnouncementTemplateRequest):
151
+
152
+ Raises:
153
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
154
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
155
+
156
+ Returns:
157
+ MaintenanceAnnouncementTemplate
158
+ """
159
+
160
+ return (
161
+ await asyncio_detailed(
162
+ uuid=uuid,
163
+ client=client,
164
+ body=body,
165
+ )
166
+ ).parsed
@@ -0,0 +1,144 @@
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.maintenance_announcement_template import MaintenanceAnnouncementTemplate
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-maintenance-announcements-template/{uuid}/",
19
+ }
20
+
21
+ return _kwargs
22
+
23
+
24
+ def _parse_response(
25
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
26
+ ) -> MaintenanceAnnouncementTemplate:
27
+ if response.status_code == 200:
28
+ response_200 = MaintenanceAnnouncementTemplate.from_dict(response.json())
29
+
30
+ return response_200
31
+ raise errors.UnexpectedStatus(response.status_code, response.content)
32
+
33
+
34
+ def _build_response(
35
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
36
+ ) -> Response[MaintenanceAnnouncementTemplate]:
37
+ return Response(
38
+ status_code=HTTPStatus(response.status_code),
39
+ content=response.content,
40
+ headers=response.headers,
41
+ parsed=_parse_response(client=client, response=response),
42
+ )
43
+
44
+
45
+ def sync_detailed(
46
+ uuid: UUID,
47
+ *,
48
+ client: AuthenticatedClient,
49
+ ) -> Response[MaintenanceAnnouncementTemplate]:
50
+ """
51
+ Args:
52
+ uuid (UUID):
53
+
54
+ Raises:
55
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
56
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
57
+
58
+ Returns:
59
+ Response[MaintenanceAnnouncementTemplate]
60
+ """
61
+
62
+ kwargs = _get_kwargs(
63
+ uuid=uuid,
64
+ )
65
+
66
+ response = client.get_httpx_client().request(
67
+ **kwargs,
68
+ )
69
+
70
+ return _build_response(client=client, response=response)
71
+
72
+
73
+ def sync(
74
+ uuid: UUID,
75
+ *,
76
+ client: AuthenticatedClient,
77
+ ) -> MaintenanceAnnouncementTemplate:
78
+ """
79
+ Args:
80
+ uuid (UUID):
81
+
82
+ Raises:
83
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
84
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
85
+
86
+ Returns:
87
+ MaintenanceAnnouncementTemplate
88
+ """
89
+
90
+ return sync_detailed(
91
+ uuid=uuid,
92
+ client=client,
93
+ ).parsed
94
+
95
+
96
+ async def asyncio_detailed(
97
+ uuid: UUID,
98
+ *,
99
+ client: AuthenticatedClient,
100
+ ) -> Response[MaintenanceAnnouncementTemplate]:
101
+ """
102
+ Args:
103
+ uuid (UUID):
104
+
105
+ Raises:
106
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
107
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
108
+
109
+ Returns:
110
+ Response[MaintenanceAnnouncementTemplate]
111
+ """
112
+
113
+ kwargs = _get_kwargs(
114
+ uuid=uuid,
115
+ )
116
+
117
+ response = await client.get_async_httpx_client().request(**kwargs)
118
+
119
+ return _build_response(client=client, response=response)
120
+
121
+
122
+ async def asyncio(
123
+ uuid: UUID,
124
+ *,
125
+ client: AuthenticatedClient,
126
+ ) -> MaintenanceAnnouncementTemplate:
127
+ """
128
+ Args:
129
+ uuid (UUID):
130
+
131
+ Raises:
132
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
133
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
134
+
135
+ Returns:
136
+ MaintenanceAnnouncementTemplate
137
+ """
138
+
139
+ return (
140
+ await asyncio_detailed(
141
+ uuid=uuid,
142
+ client=client,
143
+ )
144
+ ).parsed