maleo-identity 0.0.75__py3-none-any.whl → 0.0.76__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 maleo-identity might be problematic. Click here for more details.

Files changed (142) hide show
  1. {maleo_identity-0.0.75.dist-info → maleo_identity-0.0.76.dist-info}/METADATA +3 -3
  2. maleo_identity-0.0.76.dist-info/RECORD +4 -0
  3. maleo_identity-0.0.76.dist-info/top_level.txt +1 -0
  4. maleo_identity/__init__.py +0 -0
  5. maleo_identity/client/__init__.py +0 -0
  6. maleo_identity/client/controllers/__init__.py +0 -17
  7. maleo_identity/client/controllers/http/__init__.py +0 -0
  8. maleo_identity/client/controllers/http/organization.py +0 -647
  9. maleo_identity/client/controllers/http/user.py +0 -541
  10. maleo_identity/client/manager.py +0 -77
  11. maleo_identity/client/services/__init__.py +0 -11
  12. maleo_identity/client/services/organization.py +0 -968
  13. maleo_identity/client/services/user.py +0 -817
  14. maleo_identity/constants/__init__.py +0 -17
  15. maleo_identity/constants/organization.py +0 -13
  16. maleo_identity/constants/organization_registration_code.py +0 -14
  17. maleo_identity/constants/organization_role.py +0 -22
  18. maleo_identity/constants/user.py +0 -27
  19. maleo_identity/constants/user_organization.py +0 -46
  20. maleo_identity/constants/user_organization_role.py +0 -35
  21. maleo_identity/constants/user_profile.py +0 -20
  22. maleo_identity/constants/user_system_role.py +0 -9
  23. maleo_identity/db.py +0 -6
  24. maleo_identity/enums/__init__.py +0 -19
  25. maleo_identity/enums/general.py +0 -5
  26. maleo_identity/enums/organization.py +0 -11
  27. maleo_identity/enums/organization_registration_code.py +0 -8
  28. maleo_identity/enums/organization_role.py +0 -7
  29. maleo_identity/enums/user.py +0 -16
  30. maleo_identity/enums/user_organization.py +0 -14
  31. maleo_identity/enums/user_organization_role.py +0 -15
  32. maleo_identity/enums/user_profile.py +0 -15
  33. maleo_identity/enums/user_system_role.py +0 -5
  34. maleo_identity/models/__init__.py +0 -11
  35. maleo_identity/models/responses/__init__.py +0 -17
  36. maleo_identity/models/responses/organization.py +0 -58
  37. maleo_identity/models/responses/organization_registration_code.py +0 -46
  38. maleo_identity/models/responses/organization_role.py +0 -25
  39. maleo_identity/models/responses/user.py +0 -68
  40. maleo_identity/models/responses/user_organization.py +0 -25
  41. maleo_identity/models/responses/user_organization_role.py +0 -25
  42. maleo_identity/models/responses/user_profile.py +0 -46
  43. maleo_identity/models/responses/user_system_role.py +0 -25
  44. maleo_identity/models/schemas/__init__.py +0 -19
  45. maleo_identity/models/schemas/general.py +0 -18
  46. maleo_identity/models/schemas/organization.py +0 -25
  47. maleo_identity/models/schemas/organization_registration_code.py +0 -21
  48. maleo_identity/models/schemas/organization_role.py +0 -15
  49. maleo_identity/models/schemas/user.py +0 -44
  50. maleo_identity/models/schemas/user_organization.py +0 -8
  51. maleo_identity/models/schemas/user_organization_role.py +0 -15
  52. maleo_identity/models/schemas/user_profile.py +0 -57
  53. maleo_identity/models/schemas/user_system_role.py +0 -8
  54. maleo_identity/models/tables/__init__.py +0 -19
  55. maleo_identity/models/tables/organization.py +0 -58
  56. maleo_identity/models/tables/organization_registration_code.py +0 -37
  57. maleo_identity/models/tables/organization_role.py +0 -43
  58. maleo_identity/models/tables/user.py +0 -43
  59. maleo_identity/models/tables/user_organization.py +0 -58
  60. maleo_identity/models/tables/user_organization_role.py +0 -69
  61. maleo_identity/models/tables/user_profile.py +0 -31
  62. maleo_identity/models/tables/user_system_role.py +0 -24
  63. maleo_identity/models/transfers/__init__.py +0 -9
  64. maleo_identity/models/transfers/general/__init__.py +0 -17
  65. maleo_identity/models/transfers/general/organization.py +0 -31
  66. maleo_identity/models/transfers/general/organization_registration_code.py +0 -19
  67. maleo_identity/models/transfers/general/organization_role.py +0 -20
  68. maleo_identity/models/transfers/general/user.py +0 -28
  69. maleo_identity/models/transfers/general/user_organization.py +0 -18
  70. maleo_identity/models/transfers/general/user_organization_role.py +0 -19
  71. maleo_identity/models/transfers/general/user_profile.py +0 -32
  72. maleo_identity/models/transfers/general/user_system_role.py +0 -17
  73. maleo_identity/models/transfers/parameters/__init__.py +0 -9
  74. maleo_identity/models/transfers/parameters/client/__init__.py +0 -17
  75. maleo_identity/models/transfers/parameters/client/organization.py +0 -77
  76. maleo_identity/models/transfers/parameters/client/organization_registration_code.py +0 -24
  77. maleo_identity/models/transfers/parameters/client/organization_role.py +0 -33
  78. maleo_identity/models/transfers/parameters/client/user.py +0 -34
  79. maleo_identity/models/transfers/parameters/client/user_organization.py +0 -45
  80. maleo_identity/models/transfers/parameters/client/user_organization_role.py +0 -36
  81. maleo_identity/models/transfers/parameters/client/user_profile.py +0 -23
  82. maleo_identity/models/transfers/parameters/client/user_system_role.py +0 -33
  83. maleo_identity/models/transfers/parameters/general/__init__.py +0 -17
  84. maleo_identity/models/transfers/parameters/general/organization.py +0 -35
  85. maleo_identity/models/transfers/parameters/general/organization_registration_code.py +0 -33
  86. maleo_identity/models/transfers/parameters/general/organization_role.py +0 -17
  87. maleo_identity/models/transfers/parameters/general/user.py +0 -77
  88. maleo_identity/models/transfers/parameters/general/user_organization.py +0 -31
  89. maleo_identity/models/transfers/parameters/general/user_organization_role.py +0 -18
  90. maleo_identity/models/transfers/parameters/general/user_profile.py +0 -55
  91. maleo_identity/models/transfers/parameters/general/user_system_role.py +0 -29
  92. maleo_identity/models/transfers/parameters/service/__init__.py +0 -17
  93. maleo_identity/models/transfers/parameters/service/organization.py +0 -66
  94. maleo_identity/models/transfers/parameters/service/organization_registration_code.py +0 -19
  95. maleo_identity/models/transfers/parameters/service/organization_role.py +0 -26
  96. maleo_identity/models/transfers/parameters/service/user.py +0 -34
  97. maleo_identity/models/transfers/parameters/service/user_organization.py +0 -31
  98. maleo_identity/models/transfers/parameters/service/user_organization_role.py +0 -28
  99. maleo_identity/models/transfers/parameters/service/user_profile.py +0 -23
  100. maleo_identity/models/transfers/parameters/service/user_system_role.py +0 -26
  101. maleo_identity/models/transfers/results/__init__.py +0 -5
  102. maleo_identity/models/transfers/results/client/__init__.py +0 -17
  103. maleo_identity/models/transfers/results/client/organization.py +0 -21
  104. maleo_identity/models/transfers/results/client/organization_registration_code.py +0 -15
  105. maleo_identity/models/transfers/results/client/organization_role.py +0 -15
  106. maleo_identity/models/transfers/results/client/user.py +0 -24
  107. maleo_identity/models/transfers/results/client/user_organization.py +0 -15
  108. maleo_identity/models/transfers/results/client/user_organization_role.py +0 -15
  109. maleo_identity/models/transfers/results/client/user_profile.py +0 -15
  110. maleo_identity/models/transfers/results/client/user_system_role.py +0 -15
  111. maleo_identity/models/transfers/results/service/__init__.py +0 -0
  112. maleo_identity/models/transfers/results/service/organization.py +0 -21
  113. maleo_identity/models/transfers/results/service/organization_registration_code.py +0 -15
  114. maleo_identity/models/transfers/results/service/organization_role.py +0 -15
  115. maleo_identity/models/transfers/results/service/user.py +0 -24
  116. maleo_identity/models/transfers/results/service/user_organization.py +0 -15
  117. maleo_identity/models/transfers/results/service/user_organization_role.py +0 -15
  118. maleo_identity/models/transfers/results/service/user_profile.py +0 -15
  119. maleo_identity/models/transfers/results/service/user_system_role.py +0 -15
  120. maleo_identity/types/__init__.py +0 -5
  121. maleo_identity/types/results/__init__.py +0 -5
  122. maleo_identity/types/results/client/__init__.py +0 -17
  123. maleo_identity/types/results/client/organization.py +0 -30
  124. maleo_identity/types/results/client/organization_registration_code.py +0 -20
  125. maleo_identity/types/results/client/organization_role.py +0 -14
  126. maleo_identity/types/results/client/user.py +0 -29
  127. maleo_identity/types/results/client/user_organization.py +0 -19
  128. maleo_identity/types/results/client/user_organization_role.py +0 -14
  129. maleo_identity/types/results/client/user_profile.py +0 -19
  130. maleo_identity/types/results/client/user_system_role.py +0 -19
  131. maleo_identity/types/results/service/__init__.py +0 -0
  132. maleo_identity/types/results/service/organization.py +0 -32
  133. maleo_identity/types/results/service/organization_registration_code.py +0 -21
  134. maleo_identity/types/results/service/organization_role.py +0 -15
  135. maleo_identity/types/results/service/user.py +0 -30
  136. maleo_identity/types/results/service/user_organization.py +0 -20
  137. maleo_identity/types/results/service/user_organization_role.py +0 -15
  138. maleo_identity/types/results/service/user_profile.py +0 -20
  139. maleo_identity/types/results/service/user_system_role.py +0 -20
  140. maleo_identity-0.0.75.dist-info/RECORD +0 -140
  141. maleo_identity-0.0.75.dist-info/top_level.txt +0 -1
  142. {maleo_identity-0.0.75.dist-info → maleo_identity-0.0.76.dist-info}/WHEEL +0 -0
@@ -1,968 +0,0 @@
1
- from typing import Dict, Optional
2
- from maleo_foundation.authorization import Authorization
3
- from maleo_foundation.managers.client.maleo import MaleoClientService
4
- from maleo_foundation.utils.exceptions import BaseExceptions
5
- from maleo_identity.client.controllers import MaleoIdentityOrganizationControllers
6
- from maleo_identity.enums.general import MaleoIdentityGeneralEnums
7
- from maleo_identity.models.transfers.parameters.general.organization_role \
8
- import MaleoIdentityOrganizationRoleGeneralParametersTransfers
9
- from maleo_identity.models.transfers.parameters.general.organization \
10
- import MaleoIdentityOrganizationGeneralParametersTransfers
11
- from maleo_identity.models.transfers.parameters.general.user_organization \
12
- import MaleoIdentityUserOrganizationGeneralParametersTransfers
13
- from maleo_identity.models.transfers.parameters.general.user_organization_role \
14
- import MaleoIdentityUserOrganizationRoleGeneralParametersTransfers
15
- from maleo_identity.models.transfers.parameters.client.organization_role \
16
- import MaleoIdentityOrganizationRoleClientParametersTransfers
17
- from maleo_identity.models.transfers.parameters.client.organization \
18
- import MaleoIdentityOrganizationClientParametersTransfers
19
- from maleo_identity.models.transfers.parameters.client.user_organization \
20
- import MaleoIdentityUserOrganizationClientParametersTransfers
21
- from maleo_identity.models.transfers.parameters.client.user_organization_role \
22
- import MaleoIdentityUserOrganizationRoleClientParametersTransfers
23
- from maleo_identity.models.transfers.results.client.organization_role \
24
- import MaleoIdentityOrganizationRoleClientResultsTransfers
25
- from maleo_identity.models.transfers.results.client.organization \
26
- import MaleoIdentityOrganizationClientResultsTransfers
27
- from maleo_identity.models.transfers.results.client.user_organization \
28
- import MaleoIdentityUserOrganizationClientResultsTransfers
29
- from maleo_identity.models.transfers.results.client.user_organization_role \
30
- import MaleoIdentityUserOrganizationRoleClientResultsTransfers
31
- from maleo_identity.types.results.client.organization_role \
32
- import MaleoIdentityOrganizationRoleClientResultsTypes
33
- from maleo_identity.types.results.client.organization \
34
- import MaleoIdentityOrganizationClientResultsTypes
35
- from maleo_identity.types.results.client.user_organization \
36
- import MaleoIdentityUserOrganizationClientResultsTypes
37
- from maleo_identity.types.results.client.user_organization_role \
38
- import MaleoIdentityUserOrganizationRoleClientResultsTypes
39
-
40
- class MaleoIdentityOrganizationClientService(MaleoClientService):
41
- def __init__(
42
- self,
43
- key,
44
- logger,
45
- service_manager,
46
- controllers:MaleoIdentityOrganizationControllers
47
- ):
48
- super().__init__(key, logger, service_manager)
49
- self._controllers = controllers
50
-
51
- @property
52
- def controllers(self) -> MaleoIdentityOrganizationControllers:
53
- raise self._controllers
54
-
55
- async def get_organizations(
56
- self,
57
- parameters:MaleoIdentityOrganizationClientParametersTransfers.GetMultiple,
58
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
59
- authorization:Optional[Authorization] = None,
60
- headers:Optional[Dict[str, str]] = None
61
- ) -> MaleoIdentityOrganizationClientResultsTypes.GetMultiple:
62
- """Retrieve organizations from MaleoIdentity"""
63
- @BaseExceptions.service_exception_handler(
64
- operation="retrieving organizations",
65
- logger=self._logger,
66
- fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
67
- )
68
- async def _impl(
69
- parameters:MaleoIdentityOrganizationClientParametersTransfers.GetMultiple,
70
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
71
- authorization:Optional[Authorization] = None,
72
- headers:Optional[Dict[str, str]] = None
73
- ):
74
- #* Validate chosen controller type
75
- if not isinstance(
76
- controller_type,
77
- MaleoIdentityGeneralEnums.ClientControllerType
78
- ):
79
- message = "Invalid controller type"
80
- description = "The provided controller type did not exists"
81
- return MaleoIdentityOrganizationClientResultsTransfers.Fail(
82
- message=message,
83
- description=description
84
- )
85
- #* Retrieve organizations using chosen controller
86
- if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
87
- controller_result = (
88
- await self._controllers.http
89
- .get_organizations(
90
- parameters=parameters,
91
- authorization=authorization,
92
- headers=headers
93
- )
94
- )
95
- else:
96
- message = "Invalid controller type"
97
- description = "The provided controller type has not been implemented"
98
- return MaleoIdentityOrganizationClientResultsTransfers.Fail(
99
- message=message,
100
- description=description
101
- )
102
- #* Return proper response
103
- if not controller_result.success:
104
- return (
105
- MaleoIdentityOrganizationClientResultsTransfers
106
- .Fail
107
- .model_validate(controller_result.content)
108
- )
109
- else:
110
- if controller_result.content["data"] is None:
111
- return (
112
- MaleoIdentityOrganizationClientResultsTransfers
113
- .NoData
114
- .model_validate(controller_result.content)
115
- )
116
- else:
117
- return (
118
- MaleoIdentityOrganizationClientResultsTransfers
119
- .MultipleData
120
- .model_validate(controller_result.content)
121
- )
122
- return await _impl(
123
- parameters=parameters,
124
- controller_type=controller_type,
125
- authorization=authorization,
126
- headers=headers
127
- )
128
-
129
- # async def get_structured_organizations(
130
- # self,
131
- # parameters:MaleoIdentityOrganizationClientParametersTransfers.GetMultipleStructured,
132
- # controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
133
- # authorization:Optional[Authorization] = None,
134
- # headers:Optional[Dict[str, str]] = None
135
- # ) -> MaleoIdentityOrganizationClientResultsTypes.GetMultipleStructured:
136
- # """Retrieve structured organizations from MaleoIdentity"""
137
- # @BaseExceptions.service_exception_handler(
138
- # operation="retrieving structured organizations",
139
- # logger=self._logger,
140
- # fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
141
- # )
142
- # async def _impl(
143
- # parameters:MaleoIdentityOrganizationClientParametersTransfers.GetMultipleStructured,
144
- # controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
145
- # authorization:Optional[Authorization] = None,
146
- # headers:Optional[Dict[str, str]] = None
147
- # ):
148
- # #* Validate chosen controller type
149
- # if not isinstance(
150
- # controller_type,
151
- # MaleoIdentityGeneralEnums.ClientControllerType
152
- # ):
153
- # message = "Invalid controller type"
154
- # description = "The provided controller type did not exists"
155
- # return MaleoIdentityOrganizationClientResultsTransfers.Fail(
156
- # message=message,
157
- # description=description
158
- # )
159
- # #* Retrieve structured organizations using chosen controller
160
- # if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
161
- # controller_result = (
162
- # await self._controllers.http
163
- # .get_structured_organizations(
164
- # parameters=parameters,
165
- # authorization=authorization,
166
- # headers=headers
167
- # )
168
- # )
169
- # else:
170
- # message = "Invalid controller type"
171
- # description = "The provided controller type has not been implemented"
172
- # return MaleoIdentityOrganizationClientResultsTransfers.Fail(
173
- # message=message,
174
- # description=description
175
- # )
176
- # #* Return proper response
177
- # if not controller_result.success:
178
- # return (
179
- # MaleoIdentityOrganizationClientResultsTransfers
180
- # .Fail
181
- # .model_validate(controller_result.content)
182
- # )
183
- # else:
184
- # if controller_result.content["data"] is None:
185
- # return (
186
- # MaleoIdentityOrganizationClientResultsTransfers
187
- # .NoData
188
- # .model_validate(controller_result.content)
189
- # )
190
- # else:
191
- # return (
192
- # MaleoIdentityOrganizationClientResultsTransfers
193
- # .MultipleStructured
194
- # .model_validate(controller_result.content)
195
- # )
196
- # return await _impl(
197
- # parameters=parameters,
198
- # controller_type=controller_type,
199
- # authorization=authorization,
200
- # headers=headers
201
- # )
202
-
203
- async def get_organization(
204
- self,
205
- parameters:MaleoIdentityOrganizationGeneralParametersTransfers.GetSingle,
206
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
207
- authorization:Optional[Authorization] = None,
208
- headers:Optional[Dict[str, str]] = None
209
- ) -> MaleoIdentityOrganizationClientResultsTypes.GetSingle:
210
- """Retrieve organization from MaleoIdentity"""
211
- @BaseExceptions.service_exception_handler(
212
- operation="retrieving organization",
213
- logger=self._logger,
214
- fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
215
- )
216
- async def _impl(
217
- parameters:MaleoIdentityOrganizationGeneralParametersTransfers.GetSingle,
218
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
219
- authorization:Optional[Authorization] = None,
220
- headers:Optional[Dict[str, str]] = None
221
- ):
222
- #* Validate chosen controller type
223
- if not isinstance(
224
- controller_type,
225
- MaleoIdentityGeneralEnums.ClientControllerType
226
- ):
227
- message = "Invalid controller type"
228
- description = "The provided controller type did not exists"
229
- return MaleoIdentityOrganizationClientResultsTransfers.Fail(
230
- message=message,
231
- description=description
232
- )
233
- #* Retrieve organization using chosen controller
234
- if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
235
- controller_result = (
236
- await self._controllers.http
237
- .get_organization(
238
- parameters=parameters,
239
- authorization=authorization,
240
- headers=headers
241
- )
242
- )
243
- else:
244
- message = "Invalid controller type"
245
- description = "The provided controller type has not been implemented"
246
- return MaleoIdentityOrganizationClientResultsTransfers.Fail(
247
- message=message,
248
- description=description
249
- )
250
- #* Return proper response
251
- if not controller_result.success:
252
- return (
253
- MaleoIdentityOrganizationClientResultsTransfers
254
- .Fail
255
- .model_validate(controller_result.content)
256
- )
257
- else:
258
- return (
259
- MaleoIdentityOrganizationClientResultsTransfers
260
- .SingleData
261
- .model_validate(controller_result.content)
262
- )
263
- return await _impl(
264
- parameters=parameters,
265
- controller_type=controller_type,
266
- authorization=authorization,
267
- headers=headers
268
- )
269
-
270
- # async def get_structured_organization(
271
- # self,
272
- # parameters:MaleoIdentityOrganizationGeneralParametersTransfers.GetSingle,
273
- # controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
274
- # authorization:Optional[Authorization] = None,
275
- # headers:Optional[Dict[str, str]] = None
276
- # ) -> MaleoIdentityOrganizationClientResultsTypes.GetSingleStructured:
277
- # """Retrieve structured organization from MaleoIdentity"""
278
- # @BaseExceptions.service_exception_handler(
279
- # operation="retrieving structured organization",
280
- # logger=self._logger,
281
- # fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
282
- # )
283
- # async def _impl(
284
- # parameters:MaleoIdentityOrganizationGeneralParametersTransfers.GetSingle,
285
- # controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
286
- # authorization:Optional[Authorization] = None,
287
- # headers:Optional[Dict[str, str]] = None
288
- # ):
289
- # #* Validate chosen controller type
290
- # if not isinstance(
291
- # controller_type,
292
- # MaleoIdentityGeneralEnums.ClientControllerType
293
- # ):
294
- # message = "Invalid controller type"
295
- # description = "The provided controller type did not exists"
296
- # return MaleoIdentityOrganizationClientResultsTransfers.Fail(
297
- # message=message,
298
- # description=description
299
- # )
300
- # #* Retrieve structured organization using chosen controller
301
- # if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
302
- # controller_result = (
303
- # await self._controllers.http
304
- # .get_structured_organization(
305
- # parameters=parameters,
306
- # authorization=authorization,
307
- # headers=headers
308
- # )
309
- # )
310
- # else:
311
- # message = "Invalid controller type"
312
- # description = "The provided controller type has not been implemented"
313
- # return MaleoIdentityOrganizationClientResultsTransfers.Fail(
314
- # message=message,
315
- # description=description
316
- # )
317
- # #* Return proper response
318
- # if not controller_result.success:
319
- # return (
320
- # MaleoIdentityOrganizationClientResultsTransfers
321
- # .Fail
322
- # .model_validate(controller_result.content)
323
- # )
324
- # else:
325
- # return (
326
- # MaleoIdentityOrganizationClientResultsTransfers
327
- # .SingleStructured
328
- # .model_validate(controller_result.content)
329
- # )
330
- # return await _impl(
331
- # parameters=parameters,
332
- # controller_type=controller_type,
333
- # authorization=authorization,
334
- # headers=headers
335
- # )
336
-
337
- async def get_organization_children(
338
- self,
339
- parameters:MaleoIdentityOrganizationClientParametersTransfers.GetMultipleChildren,
340
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
341
- authorization:Optional[Authorization] = None,
342
- headers:Optional[Dict[str, str]] = None
343
- ) -> MaleoIdentityOrganizationClientResultsTypes.GetMultiple:
344
- """Retrieve organization's children from MaleoIdentity"""
345
- @BaseExceptions.service_exception_handler(
346
- operation="retrieving organization's children",
347
- logger=self._logger,
348
- fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
349
- )
350
- async def _impl(
351
- parameters:MaleoIdentityOrganizationClientParametersTransfers.GetMultipleChildren,
352
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
353
- authorization:Optional[Authorization] = None,
354
- headers:Optional[Dict[str, str]] = None
355
- ):
356
- #* Validate chosen controller type
357
- if not isinstance(
358
- controller_type,
359
- MaleoIdentityGeneralEnums.ClientControllerType
360
- ):
361
- message = "Invalid controller type"
362
- description = "The provided controller type did not exists"
363
- return MaleoIdentityOrganizationClientResultsTransfers.Fail(
364
- message=message,
365
- description=description
366
- )
367
- #* Retrieve organization's children using chosen controller
368
- if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
369
- controller_result = (
370
- await self._controllers.http
371
- .get_organization_children(
372
- parameters=parameters,
373
- authorization=authorization,
374
- headers=headers
375
- )
376
- )
377
- else:
378
- message = "Invalid controller type"
379
- description = "The provided controller type has not been implemented"
380
- return MaleoIdentityOrganizationClientResultsTransfers.Fail(
381
- message=message,
382
- description=description
383
- )
384
- #* Return proper response
385
- if not controller_result.success:
386
- return (
387
- MaleoIdentityOrganizationClientResultsTransfers
388
- .Fail
389
- .model_validate(controller_result.content)
390
- )
391
- else:
392
- if controller_result.content["data"] is None:
393
- return (
394
- MaleoIdentityOrganizationClientResultsTransfers
395
- .NoData
396
- .model_validate(controller_result.content)
397
- .model_dump(mode="json")
398
- )
399
- else:
400
- return (
401
- MaleoIdentityOrganizationClientResultsTransfers
402
- .MultipleData
403
- .model_validate(controller_result.content)
404
- .model_dump(mode="json")
405
- )
406
- return await _impl(
407
- parameters=parameters,
408
- controller_type=controller_type,
409
- authorization=authorization,
410
- headers=headers
411
- )
412
-
413
- async def create(
414
- self,
415
- parameters:MaleoIdentityOrganizationGeneralParametersTransfers.Create,
416
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
417
- authorization:Optional[Authorization] = None,
418
- headers:Optional[Dict[str, str]] = None
419
- ) -> MaleoIdentityOrganizationClientResultsTypes.CreateOrUpdate:
420
- """Create a new organization in MaleoIdentity"""
421
- @BaseExceptions.service_exception_handler(
422
- operation="creating a new organization",
423
- logger=self._logger,
424
- fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
425
- )
426
- async def _impl(
427
- parameters:MaleoIdentityOrganizationGeneralParametersTransfers.Create,
428
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
429
- authorization:Optional[Authorization] = None,
430
- headers:Optional[Dict[str, str]] = None
431
- ):
432
- #* Validate chosen controller type
433
- if not isinstance(
434
- controller_type,
435
- MaleoIdentityGeneralEnums.ClientControllerType
436
- ):
437
- message = "Invalid controller type"
438
- description = "The provided controller type did not exists"
439
- return MaleoIdentityOrganizationClientResultsTransfers.Fail(
440
- message=message,
441
- description=description
442
- )
443
- #* Create a new organization using chosen controller
444
- if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
445
- controller_result = (
446
- await self._controllers.http
447
- .create(
448
- parameters=parameters,
449
- authorization=authorization,
450
- headers=headers
451
- )
452
- )
453
- else:
454
- message = "Invalid controller type"
455
- description = "The provided controller type has not been implemented"
456
- return MaleoIdentityOrganizationClientResultsTransfers.Fail(
457
- message=message,
458
- description=description
459
- )
460
- #* Return proper response
461
- if not controller_result.success:
462
- return (
463
- MaleoIdentityOrganizationClientResultsTransfers
464
- .Fail
465
- .model_validate(controller_result.content)
466
- )
467
- else:
468
- return (
469
- MaleoIdentityOrganizationClientResultsTransfers
470
- .SingleData
471
- .model_validate(controller_result.content)
472
- )
473
- return await _impl(
474
- parameters=parameters,
475
- controller_type=controller_type,
476
- authorization=authorization,
477
- headers=headers
478
- )
479
-
480
- async def update(
481
- self,
482
- parameters:MaleoIdentityOrganizationGeneralParametersTransfers.Update,
483
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
484
- authorization:Optional[Authorization] = None,
485
- headers:Optional[Dict[str, str]] = None
486
- ) -> MaleoIdentityOrganizationClientResultsTypes.CreateOrUpdate:
487
- """Update organization's data in MaleoIdentity"""
488
- @BaseExceptions.service_exception_handler(
489
- operation="updating organization's data",
490
- logger=self._logger,
491
- fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
492
- )
493
- async def _impl(
494
- parameters:MaleoIdentityOrganizationGeneralParametersTransfers.Update,
495
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
496
- authorization:Optional[Authorization] = None,
497
- headers:Optional[Dict[str, str]] = None
498
- ):
499
- #* Validate chosen controller type
500
- if not isinstance(
501
- controller_type,
502
- MaleoIdentityGeneralEnums.ClientControllerType
503
- ):
504
- message = "Invalid controller type"
505
- description = "The provided controller type did not exists"
506
- return MaleoIdentityOrganizationClientResultsTransfers.Fail(
507
- message=message,
508
- description=description
509
- )
510
- #* Update organization's data using chosen controller
511
- if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
512
- controller_result = (
513
- await self._controllers.http
514
- .update(
515
- parameters=parameters,
516
- authorization=authorization,
517
- headers=headers
518
- )
519
- )
520
- else:
521
- message = "Invalid controller type"
522
- description = "The provided controller type has not been implemented"
523
- return MaleoIdentityOrganizationClientResultsTransfers.Fail(
524
- message=message,
525
- description=description
526
- )
527
- #* Return proper response
528
- if not controller_result.success:
529
- return (
530
- MaleoIdentityOrganizationClientResultsTransfers
531
- .Fail
532
- .model_validate(controller_result.content)
533
- )
534
- else:
535
- return (
536
- MaleoIdentityOrganizationClientResultsTransfers
537
- .SingleData
538
- .model_validate(controller_result.content)
539
- )
540
- return await _impl(
541
- parameters=parameters,
542
- controller_type=controller_type,
543
- authorization=authorization,
544
- headers=headers
545
- )
546
-
547
- async def get_organization_users(
548
- self,
549
- parameters:MaleoIdentityUserOrganizationClientParametersTransfers.GetMultipleFromOrganization,
550
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
551
- authorization:Optional[Authorization] = None,
552
- headers:Optional[Dict[str, str]] = None
553
- ) -> MaleoIdentityUserOrganizationClientResultsTypes.GetMultiple:
554
- """Retrieve organization's users from MaleoIdentity"""
555
- @BaseExceptions.service_exception_handler(
556
- operation="retrieving organization's users",
557
- logger=self._logger,
558
- fail_result_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail
559
- )
560
- async def _impl(
561
- parameters:MaleoIdentityUserOrganizationClientParametersTransfers.GetMultipleFromOrganization,
562
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
563
- authorization:Optional[Authorization] = None,
564
- headers:Optional[Dict[str, str]] = None
565
- ):
566
- #* Validate chosen controller type
567
- if not isinstance(
568
- controller_type,
569
- MaleoIdentityGeneralEnums.ClientControllerType
570
- ):
571
- message = "Invalid controller type"
572
- description = "The provided controller type did not exists"
573
- return MaleoIdentityUserOrganizationClientResultsTransfers.Fail(
574
- message=message,
575
- description=description
576
- )
577
- #* Retrieve organization's users using chosen controller
578
- if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
579
- controller_result = (
580
- await self._controllers.http
581
- .get_organization_users(
582
- parameters=parameters,
583
- authorization=authorization,
584
- headers=headers
585
- )
586
- )
587
- else:
588
- message = "Invalid controller type"
589
- description = "The provided controller type has not been implemented"
590
- return MaleoIdentityUserOrganizationClientResultsTransfers.Fail(
591
- message=message,
592
- description=description
593
- )
594
- #* Return proper response
595
- if not controller_result.success:
596
- return (
597
- MaleoIdentityUserOrganizationClientResultsTransfers
598
- .Fail
599
- .model_validate(controller_result.content)
600
- )
601
- else:
602
- if controller_result.content["data"] is None:
603
- return (
604
- MaleoIdentityUserOrganizationClientResultsTransfers
605
- .NoData
606
- .model_validate(controller_result.content)
607
- )
608
- else:
609
- return (
610
- MaleoIdentityUserOrganizationClientResultsTransfers
611
- .MultipleData
612
- .model_validate(controller_result.content)
613
- )
614
- return await _impl(
615
- parameters=parameters,
616
- controller_type=controller_type,
617
- authorization=authorization,
618
- headers=headers
619
- )
620
-
621
- async def get_organization_user(
622
- self,
623
- parameters:MaleoIdentityUserOrganizationGeneralParametersTransfers.GetSingle,
624
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
625
- authorization:Optional[Authorization] = None,
626
- headers:Optional[Dict[str, str]] = None
627
- ) -> MaleoIdentityUserOrganizationClientResultsTypes.GetSingle:
628
- """Retrieve organization's user from MaleoIdentity"""
629
- @BaseExceptions.service_exception_handler(
630
- operation="retrieving organization's user",
631
- logger=self._logger,
632
- fail_result_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail
633
- )
634
- async def _impl(
635
- parameters:MaleoIdentityUserOrganizationGeneralParametersTransfers.GetSingle,
636
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
637
- authorization:Optional[Authorization] = None,
638
- headers:Optional[Dict[str, str]] = None
639
- ):
640
- #* Validate chosen controller type
641
- if not isinstance(
642
- controller_type,
643
- MaleoIdentityGeneralEnums.ClientControllerType
644
- ):
645
- message = "Invalid controller type"
646
- description = "The provided controller type did not exists"
647
- return MaleoIdentityUserOrganizationClientResultsTransfers.Fail(
648
- message=message,
649
- description=description
650
- )
651
- #* Retrieve organization's user using chosen controller
652
- if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
653
- controller_result = (
654
- await self._controllers.http
655
- .get_organization_user(
656
- parameters=parameters,
657
- authorization=authorization,
658
- headers=headers
659
- )
660
- )
661
- else:
662
- message = "Invalid controller type"
663
- description = "The provided controller type has not been implemented"
664
- return MaleoIdentityUserOrganizationClientResultsTransfers.Fail(
665
- message=message,
666
- description=description
667
- )
668
- #* Return proper response
669
- if not controller_result.success:
670
- return (
671
- MaleoIdentityUserOrganizationClientResultsTransfers
672
- .Fail
673
- .model_validate(controller_result.content)
674
- )
675
- else:
676
- return (
677
- MaleoIdentityUserOrganizationClientResultsTransfers
678
- .SingleData
679
- .model_validate(controller_result.content)
680
- )
681
- return await _impl(
682
- parameters=parameters,
683
- controller_type=controller_type,
684
- authorization=authorization,
685
- headers=headers
686
- )
687
-
688
- async def get_organization_roles(
689
- self,
690
- parameters:MaleoIdentityOrganizationRoleClientParametersTransfers.GetMultipleFromOrganization,
691
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
692
- authorization:Optional[Authorization] = None,
693
- headers:Optional[Dict[str, str]] = None
694
- ) -> MaleoIdentityOrganizationRoleClientResultsTypes.GetMultiple:
695
- """Retrieve organization's roles from MaleoIdentity"""
696
- @BaseExceptions.service_exception_handler(
697
- operation="retrieving organization's roles",
698
- logger=self._logger,
699
- fail_result_class=MaleoIdentityOrganizationRoleClientResultsTransfers.Fail
700
- )
701
- async def _impl(
702
- parameters:MaleoIdentityOrganizationRoleClientParametersTransfers.GetMultipleFromOrganization,
703
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
704
- authorization:Optional[Authorization] = None,
705
- headers:Optional[Dict[str, str]] = None
706
- ):
707
- #* Validate chosen controller type
708
- if not isinstance(
709
- controller_type,
710
- MaleoIdentityGeneralEnums.ClientControllerType
711
- ):
712
- message = "Invalid controller type"
713
- description = "The provided controller type did not exists"
714
- return MaleoIdentityOrganizationRoleClientResultsTransfers.Fail(
715
- message=message,
716
- description=description
717
- )
718
- #* Retrieve organization's roles using chosen controller
719
- if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
720
- controller_result = (
721
- await self._controllers.http
722
- .get_organization_roles(
723
- parameters=parameters,
724
- authorization=authorization,
725
- headers=headers
726
- )
727
- )
728
- else:
729
- message = "Invalid controller type"
730
- description = "The provided controller type has not been implemented"
731
- return MaleoIdentityOrganizationRoleClientResultsTransfers.Fail(
732
- message=message,
733
- description=description
734
- )
735
- #* Return proper response
736
- if not controller_result.success:
737
- return (
738
- MaleoIdentityOrganizationRoleClientResultsTransfers
739
- .Fail
740
- .model_validate(controller_result.content)
741
- )
742
- else:
743
- if controller_result.content["data"] is None:
744
- return (
745
- MaleoIdentityOrganizationRoleClientResultsTransfers
746
- .NoData
747
- .model_validate(controller_result.content)
748
- )
749
- else:
750
- return (
751
- MaleoIdentityOrganizationRoleClientResultsTransfers
752
- .MultipleData
753
- .model_validate(controller_result.content)
754
- )
755
- return await _impl(
756
- parameters=parameters,
757
- controller_type=controller_type,
758
- authorization=authorization,
759
- headers=headers
760
- )
761
-
762
- async def get_organization_role(
763
- self,
764
- parameters:MaleoIdentityOrganizationRoleGeneralParametersTransfers.GetSingle,
765
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
766
- authorization:Optional[Authorization] = None,
767
- headers:Optional[Dict[str, str]] = None
768
- ) -> MaleoIdentityOrganizationRoleClientResultsTypes.GetSingle:
769
- """Retrieve organization's role from MaleoIdentity"""
770
- @BaseExceptions.service_exception_handler(
771
- operation="retrieving organization's role",
772
- logger=self._logger,
773
- fail_result_class=MaleoIdentityOrganizationRoleClientResultsTransfers.Fail
774
- )
775
- async def _impl(
776
- parameters:MaleoIdentityOrganizationRoleGeneralParametersTransfers.GetSingle,
777
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
778
- authorization:Optional[Authorization] = None,
779
- headers:Optional[Dict[str, str]] = None
780
- ):
781
- #* Validate chosen controller type
782
- if not isinstance(
783
- controller_type,
784
- MaleoIdentityGeneralEnums.ClientControllerType
785
- ):
786
- message = "Invalid controller type"
787
- description = "The provided controller type did not exists"
788
- return MaleoIdentityOrganizationRoleClientResultsTransfers.Fail(
789
- message=message,
790
- description=description
791
- )
792
- #* Retrieve organization's role using chosen controller
793
- if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
794
- controller_result = (
795
- await self._controllers.http
796
- .get_organization_role(
797
- parameters=parameters,
798
- authorization=authorization,
799
- headers=headers
800
- )
801
- )
802
- else:
803
- message = "Invalid controller type"
804
- description = "The provided controller type has not been implemented"
805
- return MaleoIdentityOrganizationRoleClientResultsTransfers.Fail(
806
- message=message,
807
- description=description
808
- )
809
- #* Return proper response
810
- if not controller_result.success:
811
- return (
812
- MaleoIdentityOrganizationRoleClientResultsTransfers
813
- .Fail
814
- .model_validate(controller_result.content)
815
- )
816
- else:
817
- return (
818
- MaleoIdentityOrganizationRoleClientResultsTransfers
819
- .SingleData
820
- .model_validate(controller_result.content)
821
- )
822
- return await _impl(
823
- parameters=parameters,
824
- controller_type=controller_type,
825
- authorization=authorization,
826
- headers=headers
827
- )
828
-
829
- async def get_organization_user_roles(
830
- self,
831
- parameters:MaleoIdentityUserOrganizationRoleClientParametersTransfers.GetMultipleFromUserOrOrganization,
832
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
833
- authorization:Optional[Authorization] = None,
834
- headers:Optional[Dict[str, str]] = None
835
- ) -> MaleoIdentityUserOrganizationRoleClientResultsTypes.GetMultiple:
836
- """Retrieve organization's user roles from MaleoIdentity"""
837
- @BaseExceptions.service_exception_handler(
838
- operation="retrieving organization's user roles",
839
- logger=self._logger,
840
- fail_result_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail
841
- )
842
- async def _impl(
843
- parameters:MaleoIdentityUserOrganizationRoleClientParametersTransfers.GetMultipleFromUserOrOrganization,
844
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
845
- authorization:Optional[Authorization] = None,
846
- headers:Optional[Dict[str, str]] = None
847
- ):
848
- #* Validate chosen controller type
849
- if not isinstance(
850
- controller_type,
851
- MaleoIdentityGeneralEnums.ClientControllerType
852
- ):
853
- message = "Invalid controller type"
854
- description = "The provided controller type did not exists"
855
- return MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail(
856
- message=message,
857
- description=description
858
- )
859
- #* Retrieve organization's user roles using chosen controller
860
- if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
861
- controller_result = (
862
- await self._controllers.http
863
- .get_organization_user_roles(
864
- parameters=parameters,
865
- authorization=authorization,
866
- headers=headers
867
- )
868
- )
869
- else:
870
- message = "Invalid controller type"
871
- description = "The provided controller type has not been implemented"
872
- return MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail(
873
- message=message,
874
- description=description
875
- )
876
- #* Return proper response
877
- if not controller_result.success:
878
- return (
879
- MaleoIdentityUserOrganizationRoleClientResultsTransfers
880
- .Fail
881
- .model_validate(controller_result.content)
882
- )
883
- else:
884
- if controller_result.content["data"] is None:
885
- return (
886
- MaleoIdentityUserOrganizationRoleClientResultsTransfers
887
- .NoData
888
- .model_validate(controller_result.content)
889
- )
890
- else:
891
- return (
892
- MaleoIdentityUserOrganizationRoleClientResultsTransfers
893
- .MultipleData
894
- .model_validate(controller_result.content)
895
- )
896
- return await _impl(
897
- parameters=parameters,
898
- controller_type=controller_type,
899
- authorization=authorization,
900
- headers=headers
901
- )
902
-
903
- async def get_organization_user_role(
904
- self,
905
- parameters:MaleoIdentityUserOrganizationRoleGeneralParametersTransfers.GetSingle,
906
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
907
- authorization:Optional[Authorization] = None,
908
- headers:Optional[Dict[str, str]] = None
909
- ) -> MaleoIdentityUserOrganizationRoleClientResultsTypes.GetSingle:
910
- """Retrieve organization's user role from MaleoIdentity"""
911
- @BaseExceptions.service_exception_handler(
912
- operation="retrieving organization's user role",
913
- logger=self._logger,
914
- fail_result_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail
915
- )
916
- async def _impl(
917
- parameters:MaleoIdentityUserOrganizationRoleGeneralParametersTransfers.GetSingle,
918
- controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
919
- authorization:Optional[Authorization] = None,
920
- headers:Optional[Dict[str, str]] = None
921
- ):
922
- #* Validate chosen controller type
923
- if not isinstance(
924
- controller_type,
925
- MaleoIdentityGeneralEnums.ClientControllerType
926
- ):
927
- message = "Invalid controller type"
928
- description = "The provided controller type did not exists"
929
- return MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail(
930
- message=message,
931
- description=description
932
- )
933
- #* Retrieve organization's user role using chosen controller
934
- if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
935
- controller_result = (
936
- await self._controllers.http
937
- .get_organization_user_role(
938
- parameters=parameters,
939
- authorization=authorization,
940
- headers=headers
941
- )
942
- )
943
- else:
944
- message = "Invalid controller type"
945
- description = "The provided controller type has not been implemented"
946
- return MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail(
947
- message=message,
948
- description=description
949
- )
950
- #* Return proper response
951
- if not controller_result.success:
952
- return (
953
- MaleoIdentityUserOrganizationRoleClientResultsTransfers
954
- .Fail
955
- .model_validate(controller_result.content)
956
- )
957
- else:
958
- return (
959
- MaleoIdentityUserOrganizationRoleClientResultsTransfers
960
- .SingleData
961
- .model_validate(controller_result.content)
962
- )
963
- return await _impl(
964
- parameters=parameters,
965
- controller_type=controller_type,
966
- authorization=authorization,
967
- headers=headers
968
- )