waldur-api-client 7.8.3__py3-none-any.whl → 7.8.4__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 (118) hide show
  1. waldur_api_client/api/booking_resources/booking_resources_count.py +18 -0
  2. waldur_api_client/api/booking_resources/booking_resources_list.py +18 -0
  3. waldur_api_client/api/marketplace_offering_users/marketplace_offering_users_checklist_template_count.py +125 -0
  4. waldur_api_client/api/marketplace_offering_users/marketplace_offering_users_checklist_template_retrieve.py +126 -0
  5. waldur_api_client/api/marketplace_provider_offerings/marketplace_provider_offerings_tos_stats_retrieve.py +146 -0
  6. waldur_api_client/api/marketplace_provider_resources/marketplace_provider_resources_count.py +18 -0
  7. waldur_api_client/api/marketplace_provider_resources/marketplace_provider_resources_list.py +18 -0
  8. waldur_api_client/api/marketplace_provider_resources/marketplace_provider_resources_update_options.py +168 -0
  9. waldur_api_client/api/marketplace_resources/marketplace_resources_count.py +18 -0
  10. waldur_api_client/api/marketplace_resources/marketplace_resources_list.py +18 -0
  11. waldur_api_client/api/marketplace_resources/marketplace_resources_renew.py +166 -0
  12. waldur_api_client/api/marketplace_service_providers/service_provider_checklists_summary.py +189 -0
  13. waldur_api_client/api/onboarding/__init__.py +1 -0
  14. waldur_api_client/api/onboarding/onboarding_supported_countries_retrieve.py +74 -0
  15. waldur_api_client/api/onboarding_justifications/__init__.py +1 -0
  16. waldur_api_client/api/onboarding_justifications/onboarding_justifications_attach_document.py +211 -0
  17. waldur_api_client/api/onboarding_justifications/onboarding_justifications_count.py +172 -0
  18. waldur_api_client/api/onboarding_justifications/onboarding_justifications_create.py +150 -0
  19. waldur_api_client/api/onboarding_justifications/onboarding_justifications_create_justification.py +154 -0
  20. waldur_api_client/api/onboarding_justifications/onboarding_justifications_destroy.py +89 -0
  21. waldur_api_client/api/onboarding_justifications/onboarding_justifications_list.py +175 -0
  22. waldur_api_client/api/onboarding_justifications/onboarding_justifications_partial_update.py +164 -0
  23. waldur_api_client/api/onboarding_justifications/onboarding_justifications_retrieve.py +142 -0
  24. waldur_api_client/api/onboarding_justifications/onboarding_justifications_update.py +164 -0
  25. waldur_api_client/api/onboarding_verifications/__init__.py +1 -0
  26. waldur_api_client/api/onboarding_verifications/onboarding_verifications_count.py +172 -0
  27. waldur_api_client/api/onboarding_verifications/onboarding_verifications_create.py +150 -0
  28. waldur_api_client/api/onboarding_verifications/onboarding_verifications_create_customer.py +144 -0
  29. waldur_api_client/api/onboarding_verifications/onboarding_verifications_destroy.py +89 -0
  30. waldur_api_client/api/onboarding_verifications/onboarding_verifications_list.py +175 -0
  31. waldur_api_client/api/onboarding_verifications/onboarding_verifications_partial_update.py +164 -0
  32. waldur_api_client/api/onboarding_verifications/onboarding_verifications_retrieve.py +142 -0
  33. waldur_api_client/api/onboarding_verifications/onboarding_verifications_update.py +164 -0
  34. waldur_api_client/api/onboarding_verifications/onboarding_verifications_validate_company.py +154 -0
  35. waldur_api_client/api/openstack_network_rbac_policies/openstack_network_rbac_policies_count.py +33 -0
  36. waldur_api_client/api/openstack_network_rbac_policies/openstack_network_rbac_policies_create.py +154 -0
  37. waldur_api_client/api/openstack_network_rbac_policies/openstack_network_rbac_policies_destroy.py +91 -0
  38. waldur_api_client/api/openstack_network_rbac_policies/openstack_network_rbac_policies_list.py +33 -0
  39. waldur_api_client/api/openstack_network_rbac_policies/openstack_network_rbac_policies_partial_update.py +164 -0
  40. waldur_api_client/api/openstack_network_rbac_policies/openstack_network_rbac_policies_update.py +164 -0
  41. waldur_api_client/api/openstack_networks/openstack_networks_rbac_policy_create.py +24 -22
  42. waldur_api_client/api/projects/projects_checklist_template_count.py +125 -0
  43. waldur_api_client/api/projects/projects_checklist_template_retrieve.py +126 -0
  44. waldur_api_client/api/proposal_proposals/proposal_proposals_checklist_template_count.py +125 -0
  45. waldur_api_client/api/proposal_proposals/proposal_proposals_checklist_template_retrieve.py +126 -0
  46. waldur_api_client/api/proposal_protected_calls/proposal_protected_calls_offerings_list.py +15 -0
  47. waldur_api_client/models/__init__.py +62 -4
  48. waldur_api_client/models/booking_resource.py +4 -11
  49. waldur_api_client/models/call_round.py +4 -4
  50. waldur_api_client/models/checklist_template.py +99 -0
  51. waldur_api_client/models/checklist_template_checklist.py +44 -0
  52. waldur_api_client/models/constance_settings.py +45 -0
  53. waldur_api_client/models/constance_settings_request.py +45 -0
  54. waldur_api_client/models/constance_settings_request_form.py +45 -0
  55. waldur_api_client/models/constance_settings_request_multipart.py +85 -0
  56. waldur_api_client/models/customer.py +9 -0
  57. waldur_api_client/models/customers_list_field_item.py +1 -0
  58. waldur_api_client/models/customers_retrieve_field_item.py +1 -0
  59. waldur_api_client/models/deprecated_network_rbac_policy.py +137 -0
  60. waldur_api_client/models/deprecated_network_rbac_policy_request.py +78 -0
  61. waldur_api_client/models/event_types_enum.py +1 -0
  62. waldur_api_client/models/marketplace_service_providers_projects_list_field_item.py +1 -0
  63. waldur_api_client/models/merged_plugin_options.py +18 -0
  64. waldur_api_client/models/merged_plugin_options_request.py +18 -0
  65. waldur_api_client/models/nested_round.py +5 -5
  66. waldur_api_client/models/network_rbac_policy_request.py +8 -0
  67. waldur_api_client/models/notification.py +9 -9
  68. waldur_api_client/models/{notification_context_fields.py → notification_context_schema.py} +6 -6
  69. waldur_api_client/models/notification_template_detail_serializers.py +9 -3
  70. waldur_api_client/models/offering_component.py +79 -0
  71. waldur_api_client/models/offering_component_request.py +80 -0
  72. waldur_api_client/models/onboarding_company_validation_request_request.py +88 -0
  73. waldur_api_client/models/onboarding_justification.py +183 -0
  74. waldur_api_client/models/onboarding_justification_create_request.py +68 -0
  75. waldur_api_client/models/onboarding_justification_documentation.py +108 -0
  76. waldur_api_client/models/onboarding_justification_documentation_request.py +84 -0
  77. waldur_api_client/models/onboarding_justification_documentation_request_form.py +84 -0
  78. waldur_api_client/models/onboarding_justification_documentation_request_multipart.py +98 -0
  79. waldur_api_client/models/onboarding_justification_request.py +75 -0
  80. waldur_api_client/models/onboarding_verification.py +250 -0
  81. waldur_api_client/models/onboarding_verification_request.py +128 -0
  82. waldur_api_client/models/onboarding_verification_status_enum.py +12 -0
  83. waldur_api_client/models/open_stack_create_floating_ip_request.py +20 -1
  84. waldur_api_client/models/order_create.py +4 -4
  85. waldur_api_client/models/order_details.py +4 -11
  86. waldur_api_client/models/patched_network_rbac_policy_request.py +85 -0
  87. waldur_api_client/models/patched_onboarding_justification_request.py +77 -0
  88. waldur_api_client/models/patched_onboarding_verification_request.py +128 -0
  89. waldur_api_client/models/patched_project_credit_request.py +13 -0
  90. waldur_api_client/models/patched_project_request.py +1 -2
  91. waldur_api_client/models/patched_project_request_form.py +1 -2
  92. waldur_api_client/models/patched_project_request_multipart.py +1 -2
  93. waldur_api_client/models/project.py +10 -2
  94. waldur_api_client/models/project_credit.py +13 -0
  95. waldur_api_client/models/project_credit_request.py +13 -0
  96. waldur_api_client/models/project_request.py +1 -2
  97. waldur_api_client/models/project_request_form.py +1 -2
  98. waldur_api_client/models/project_request_multipart.py +1 -2
  99. waldur_api_client/models/projects_list_field_item.py +1 -0
  100. waldur_api_client/models/projects_retrieve_field_item.py +1 -0
  101. waldur_api_client/models/protected_round.py +4 -4
  102. waldur_api_client/models/question.py +102 -0
  103. waldur_api_client/models/question_options.py +79 -0
  104. waldur_api_client/models/resource.py +4 -11
  105. waldur_api_client/models/resource_renew_request.py +83 -0
  106. waldur_api_client/models/resource_renew_request_limits.py +44 -0
  107. waldur_api_client/models/{status_enum.py → round_status.py} +1 -1
  108. waldur_api_client/models/service_provider_checklist_summary.py +98 -0
  109. waldur_api_client/models/time_series_to_s_data.py +69 -0
  110. waldur_api_client/models/to_s_consent_dashboard.py +155 -0
  111. waldur_api_client/models/update_offering_component_request.py +79 -0
  112. waldur_api_client/models/validation_decision_enum.py +10 -0
  113. waldur_api_client/models/validation_method_enum.py +8 -0
  114. waldur_api_client/models/version_adoption.py +67 -0
  115. {waldur_api_client-7.8.3.dist-info → waldur_api_client-7.8.4.dist-info}/METADATA +1 -1
  116. {waldur_api_client-7.8.3.dist-info → waldur_api_client-7.8.4.dist-info}/RECORD +118 -54
  117. {waldur_api_client-7.8.3.dist-info → waldur_api_client-7.8.4.dist-info}/WHEEL +0 -0
  118. {waldur_api_client-7.8.3.dist-info → waldur_api_client-7.8.4.dist-info}/licenses/LICENSE +0 -0
@@ -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.order_uuid import OrderUUID
10
+ from ...models.resource_renew_request import ResourceRenewRequest
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ uuid: UUID,
16
+ *,
17
+ body: ResourceRenewRequest,
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "post",
23
+ "url": f"/api/marketplace-resources/{uuid}/renew/",
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) -> OrderUUID:
35
+ if response.status_code == 200:
36
+ response_200 = OrderUUID.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[OrderUUID]:
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: ResourceRenewRequest,
56
+ ) -> Response[OrderUUID]:
57
+ """Create a renewal order for a prepaid resource.
58
+
59
+ Args:
60
+ uuid (UUID):
61
+ body (ResourceRenewRequest):
62
+
63
+ Raises:
64
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
65
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
66
+
67
+ Returns:
68
+ Response[OrderUUID]
69
+ """
70
+
71
+ kwargs = _get_kwargs(
72
+ uuid=uuid,
73
+ body=body,
74
+ )
75
+
76
+ response = client.get_httpx_client().request(
77
+ **kwargs,
78
+ )
79
+
80
+ return _build_response(client=client, response=response)
81
+
82
+
83
+ def sync(
84
+ uuid: UUID,
85
+ *,
86
+ client: AuthenticatedClient,
87
+ body: ResourceRenewRequest,
88
+ ) -> OrderUUID:
89
+ """Create a renewal order for a prepaid resource.
90
+
91
+ Args:
92
+ uuid (UUID):
93
+ body (ResourceRenewRequest):
94
+
95
+ Raises:
96
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
97
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
98
+
99
+ Returns:
100
+ OrderUUID
101
+ """
102
+
103
+ return sync_detailed(
104
+ uuid=uuid,
105
+ client=client,
106
+ body=body,
107
+ ).parsed
108
+
109
+
110
+ async def asyncio_detailed(
111
+ uuid: UUID,
112
+ *,
113
+ client: AuthenticatedClient,
114
+ body: ResourceRenewRequest,
115
+ ) -> Response[OrderUUID]:
116
+ """Create a renewal order for a prepaid resource.
117
+
118
+ Args:
119
+ uuid (UUID):
120
+ body (ResourceRenewRequest):
121
+
122
+ Raises:
123
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
124
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
125
+
126
+ Returns:
127
+ Response[OrderUUID]
128
+ """
129
+
130
+ kwargs = _get_kwargs(
131
+ uuid=uuid,
132
+ body=body,
133
+ )
134
+
135
+ response = await client.get_async_httpx_client().request(**kwargs)
136
+
137
+ return _build_response(client=client, response=response)
138
+
139
+
140
+ async def asyncio(
141
+ uuid: UUID,
142
+ *,
143
+ client: AuthenticatedClient,
144
+ body: ResourceRenewRequest,
145
+ ) -> OrderUUID:
146
+ """Create a renewal order for a prepaid resource.
147
+
148
+ Args:
149
+ uuid (UUID):
150
+ body (ResourceRenewRequest):
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
+ OrderUUID
158
+ """
159
+
160
+ return (
161
+ await asyncio_detailed(
162
+ uuid=uuid,
163
+ client=client,
164
+ body=body,
165
+ )
166
+ ).parsed
@@ -0,0 +1,189 @@
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.service_provider_checklist_summary import ServiceProviderChecklistSummary
10
+ from ...types import UNSET, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ service_provider_uuid: UUID,
15
+ *,
16
+ page: Union[Unset, int] = UNSET,
17
+ page_size: Union[Unset, int] = UNSET,
18
+ ) -> dict[str, Any]:
19
+ params: dict[str, Any] = {}
20
+
21
+ params["page"] = page
22
+
23
+ params["page_size"] = page_size
24
+
25
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
26
+
27
+ _kwargs: dict[str, Any] = {
28
+ "method": "get",
29
+ "url": f"/api/marketplace-service-providers/{service_provider_uuid}/compliance/checklists_summary/",
30
+ "params": params,
31
+ }
32
+
33
+ return _kwargs
34
+
35
+
36
+ def _parse_response(
37
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
38
+ ) -> list["ServiceProviderChecklistSummary"]:
39
+ if response.status_code == 200:
40
+ response_200 = []
41
+ _response_200 = response.json()
42
+ for response_200_item_data in _response_200:
43
+ response_200_item = ServiceProviderChecklistSummary.from_dict(response_200_item_data)
44
+
45
+ response_200.append(response_200_item)
46
+
47
+ return response_200
48
+ raise errors.UnexpectedStatus(response.status_code, response.content)
49
+
50
+
51
+ def _build_response(
52
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
53
+ ) -> Response[list["ServiceProviderChecklistSummary"]]:
54
+ return Response(
55
+ status_code=HTTPStatus(response.status_code),
56
+ content=response.content,
57
+ headers=response.headers,
58
+ parsed=_parse_response(client=client, response=response),
59
+ )
60
+
61
+
62
+ def sync_detailed(
63
+ service_provider_uuid: UUID,
64
+ *,
65
+ client: AuthenticatedClient,
66
+ page: Union[Unset, int] = UNSET,
67
+ page_size: Union[Unset, int] = UNSET,
68
+ ) -> Response[list["ServiceProviderChecklistSummary"]]:
69
+ """Get summary of all compliance checklists used by this service provider with usage counts.
70
+
71
+ Args:
72
+ service_provider_uuid (UUID):
73
+ page (Union[Unset, int]):
74
+ page_size (Union[Unset, int]):
75
+
76
+ Raises:
77
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
78
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
79
+
80
+ Returns:
81
+ Response[list['ServiceProviderChecklistSummary']]
82
+ """
83
+
84
+ kwargs = _get_kwargs(
85
+ service_provider_uuid=service_provider_uuid,
86
+ page=page,
87
+ page_size=page_size,
88
+ )
89
+
90
+ response = client.get_httpx_client().request(
91
+ **kwargs,
92
+ )
93
+
94
+ return _build_response(client=client, response=response)
95
+
96
+
97
+ def sync(
98
+ service_provider_uuid: UUID,
99
+ *,
100
+ client: AuthenticatedClient,
101
+ page: Union[Unset, int] = UNSET,
102
+ page_size: Union[Unset, int] = UNSET,
103
+ ) -> list["ServiceProviderChecklistSummary"]:
104
+ """Get summary of all compliance checklists used by this service provider with usage counts.
105
+
106
+ Args:
107
+ service_provider_uuid (UUID):
108
+ page (Union[Unset, int]):
109
+ page_size (Union[Unset, int]):
110
+
111
+ Raises:
112
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
113
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
114
+
115
+ Returns:
116
+ list['ServiceProviderChecklistSummary']
117
+ """
118
+
119
+ return sync_detailed(
120
+ service_provider_uuid=service_provider_uuid,
121
+ client=client,
122
+ page=page,
123
+ page_size=page_size,
124
+ ).parsed
125
+
126
+
127
+ async def asyncio_detailed(
128
+ service_provider_uuid: UUID,
129
+ *,
130
+ client: AuthenticatedClient,
131
+ page: Union[Unset, int] = UNSET,
132
+ page_size: Union[Unset, int] = UNSET,
133
+ ) -> Response[list["ServiceProviderChecklistSummary"]]:
134
+ """Get summary of all compliance checklists used by this service provider with usage counts.
135
+
136
+ Args:
137
+ service_provider_uuid (UUID):
138
+ page (Union[Unset, int]):
139
+ page_size (Union[Unset, int]):
140
+
141
+ Raises:
142
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
143
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
144
+
145
+ Returns:
146
+ Response[list['ServiceProviderChecklistSummary']]
147
+ """
148
+
149
+ kwargs = _get_kwargs(
150
+ service_provider_uuid=service_provider_uuid,
151
+ page=page,
152
+ page_size=page_size,
153
+ )
154
+
155
+ response = await client.get_async_httpx_client().request(**kwargs)
156
+
157
+ return _build_response(client=client, response=response)
158
+
159
+
160
+ async def asyncio(
161
+ service_provider_uuid: UUID,
162
+ *,
163
+ client: AuthenticatedClient,
164
+ page: Union[Unset, int] = UNSET,
165
+ page_size: Union[Unset, int] = UNSET,
166
+ ) -> list["ServiceProviderChecklistSummary"]:
167
+ """Get summary of all compliance checklists used by this service provider with usage counts.
168
+
169
+ Args:
170
+ service_provider_uuid (UUID):
171
+ page (Union[Unset, int]):
172
+ page_size (Union[Unset, int]):
173
+
174
+ Raises:
175
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
176
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
177
+
178
+ Returns:
179
+ list['ServiceProviderChecklistSummary']
180
+ """
181
+
182
+ return (
183
+ await asyncio_detailed(
184
+ service_provider_uuid=service_provider_uuid,
185
+ client=client,
186
+ page=page,
187
+ page_size=page_size,
188
+ )
189
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,74 @@
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 ...types import Response
9
+
10
+
11
+ def _get_kwargs() -> dict[str, Any]:
12
+ _kwargs: dict[str, Any] = {
13
+ "method": "get",
14
+ "url": "/api/onboarding/supported-countries/",
15
+ }
16
+
17
+ return _kwargs
18
+
19
+
20
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Any:
21
+ raise errors.UnexpectedStatus(response.status_code, response.content)
22
+
23
+
24
+ def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
25
+ return Response(
26
+ status_code=HTTPStatus(response.status_code),
27
+ content=response.content,
28
+ headers=response.headers,
29
+ parsed=_parse_response(client=client, response=response),
30
+ )
31
+
32
+
33
+ def sync_detailed(
34
+ *,
35
+ client: AuthenticatedClient,
36
+ ) -> Response[Any]:
37
+ """Return list of supported countries for validation.
38
+
39
+ Raises:
40
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
41
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
42
+
43
+ Returns:
44
+ Response[Any]
45
+ """
46
+
47
+ kwargs = _get_kwargs()
48
+
49
+ response = client.get_httpx_client().request(
50
+ **kwargs,
51
+ )
52
+
53
+ return _build_response(client=client, response=response)
54
+
55
+
56
+ async def asyncio_detailed(
57
+ *,
58
+ client: AuthenticatedClient,
59
+ ) -> Response[Any]:
60
+ """Return list of supported countries for validation.
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[Any]
68
+ """
69
+
70
+ kwargs = _get_kwargs()
71
+
72
+ response = await client.get_async_httpx_client().request(**kwargs)
73
+
74
+ return _build_response(client=client, response=response)
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,211 @@
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.onboarding_justification_documentation import OnboardingJustificationDocumentation
10
+ from ...models.onboarding_justification_documentation_request import OnboardingJustificationDocumentationRequest
11
+ from ...models.onboarding_justification_documentation_request_form import (
12
+ OnboardingJustificationDocumentationRequestForm,
13
+ )
14
+ from ...models.onboarding_justification_documentation_request_multipart import (
15
+ OnboardingJustificationDocumentationRequestMultipart,
16
+ )
17
+ from ...types import Response
18
+
19
+
20
+ def _get_kwargs(
21
+ uuid: UUID,
22
+ *,
23
+ body: Union[
24
+ OnboardingJustificationDocumentationRequest,
25
+ OnboardingJustificationDocumentationRequestForm,
26
+ OnboardingJustificationDocumentationRequestMultipart,
27
+ ],
28
+ ) -> dict[str, Any]:
29
+ headers: dict[str, Any] = {}
30
+
31
+ _kwargs: dict[str, Any] = {
32
+ "method": "post",
33
+ "url": f"/api/onboarding-justifications/{uuid}/attach_document/",
34
+ }
35
+
36
+ if isinstance(body, OnboardingJustificationDocumentationRequest):
37
+ _kwargs["json"] = body.to_dict()
38
+
39
+ headers["Content-Type"] = "application/json"
40
+ if isinstance(body, OnboardingJustificationDocumentationRequestForm):
41
+ _kwargs["data"] = body.to_dict()
42
+
43
+ headers["Content-Type"] = "application/x-www-form-urlencoded"
44
+ if isinstance(body, OnboardingJustificationDocumentationRequestMultipart):
45
+ _kwargs["files"] = body.to_multipart()
46
+
47
+ _kwargs["headers"] = headers
48
+ return _kwargs
49
+
50
+
51
+ def _parse_response(
52
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
53
+ ) -> OnboardingJustificationDocumentation:
54
+ if response.status_code == 200:
55
+ response_200 = OnboardingJustificationDocumentation.from_dict(response.json())
56
+
57
+ return response_200
58
+ raise errors.UnexpectedStatus(response.status_code, response.content)
59
+
60
+
61
+ def _build_response(
62
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
63
+ ) -> Response[OnboardingJustificationDocumentation]:
64
+ return Response(
65
+ status_code=HTTPStatus(response.status_code),
66
+ content=response.content,
67
+ headers=response.headers,
68
+ parsed=_parse_response(client=client, response=response),
69
+ )
70
+
71
+
72
+ def sync_detailed(
73
+ uuid: UUID,
74
+ *,
75
+ client: AuthenticatedClient,
76
+ body: Union[
77
+ OnboardingJustificationDocumentationRequest,
78
+ OnboardingJustificationDocumentationRequestForm,
79
+ OnboardingJustificationDocumentationRequestMultipart,
80
+ ],
81
+ ) -> Response[OnboardingJustificationDocumentation]:
82
+ """Attach supporting document to justification.
83
+
84
+ Args:
85
+ uuid (UUID):
86
+ body (OnboardingJustificationDocumentationRequest):
87
+ body (OnboardingJustificationDocumentationRequestForm):
88
+ body (OnboardingJustificationDocumentationRequestMultipart):
89
+
90
+ Raises:
91
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
92
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
93
+
94
+ Returns:
95
+ Response[OnboardingJustificationDocumentation]
96
+ """
97
+
98
+ kwargs = _get_kwargs(
99
+ uuid=uuid,
100
+ body=body,
101
+ )
102
+
103
+ response = client.get_httpx_client().request(
104
+ **kwargs,
105
+ )
106
+
107
+ return _build_response(client=client, response=response)
108
+
109
+
110
+ def sync(
111
+ uuid: UUID,
112
+ *,
113
+ client: AuthenticatedClient,
114
+ body: Union[
115
+ OnboardingJustificationDocumentationRequest,
116
+ OnboardingJustificationDocumentationRequestForm,
117
+ OnboardingJustificationDocumentationRequestMultipart,
118
+ ],
119
+ ) -> OnboardingJustificationDocumentation:
120
+ """Attach supporting document to justification.
121
+
122
+ Args:
123
+ uuid (UUID):
124
+ body (OnboardingJustificationDocumentationRequest):
125
+ body (OnboardingJustificationDocumentationRequestForm):
126
+ body (OnboardingJustificationDocumentationRequestMultipart):
127
+
128
+ Raises:
129
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
130
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
131
+
132
+ Returns:
133
+ OnboardingJustificationDocumentation
134
+ """
135
+
136
+ return sync_detailed(
137
+ uuid=uuid,
138
+ client=client,
139
+ body=body,
140
+ ).parsed
141
+
142
+
143
+ async def asyncio_detailed(
144
+ uuid: UUID,
145
+ *,
146
+ client: AuthenticatedClient,
147
+ body: Union[
148
+ OnboardingJustificationDocumentationRequest,
149
+ OnboardingJustificationDocumentationRequestForm,
150
+ OnboardingJustificationDocumentationRequestMultipart,
151
+ ],
152
+ ) -> Response[OnboardingJustificationDocumentation]:
153
+ """Attach supporting document to justification.
154
+
155
+ Args:
156
+ uuid (UUID):
157
+ body (OnboardingJustificationDocumentationRequest):
158
+ body (OnboardingJustificationDocumentationRequestForm):
159
+ body (OnboardingJustificationDocumentationRequestMultipart):
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
+ Response[OnboardingJustificationDocumentation]
167
+ """
168
+
169
+ kwargs = _get_kwargs(
170
+ uuid=uuid,
171
+ body=body,
172
+ )
173
+
174
+ response = await client.get_async_httpx_client().request(**kwargs)
175
+
176
+ return _build_response(client=client, response=response)
177
+
178
+
179
+ async def asyncio(
180
+ uuid: UUID,
181
+ *,
182
+ client: AuthenticatedClient,
183
+ body: Union[
184
+ OnboardingJustificationDocumentationRequest,
185
+ OnboardingJustificationDocumentationRequestForm,
186
+ OnboardingJustificationDocumentationRequestMultipart,
187
+ ],
188
+ ) -> OnboardingJustificationDocumentation:
189
+ """Attach supporting document to justification.
190
+
191
+ Args:
192
+ uuid (UUID):
193
+ body (OnboardingJustificationDocumentationRequest):
194
+ body (OnboardingJustificationDocumentationRequestForm):
195
+ body (OnboardingJustificationDocumentationRequestMultipart):
196
+
197
+ Raises:
198
+ errors.UnexpectedStatus: If the server returns an undocumented status code.
199
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
200
+
201
+ Returns:
202
+ OnboardingJustificationDocumentation
203
+ """
204
+
205
+ return (
206
+ await asyncio_detailed(
207
+ uuid=uuid,
208
+ client=client,
209
+ body=body,
210
+ )
211
+ ).parsed