maleo-identity 0.1.31__py3-none-any.whl → 0.1.59__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.
- maleo/identity/constants/api_key.py +1 -1
- maleo/identity/constants/organization.py +1 -1
- maleo/identity/constants/organization_registration_code.py +1 -1
- maleo/identity/constants/organization_relation.py +1 -1
- maleo/identity/constants/patient.py +1 -1
- maleo/identity/constants/user.py +1 -1
- maleo/identity/constants/user_medical_role.py +1 -1
- maleo/identity/constants/user_organization.py +13 -0
- maleo/identity/constants/user_organization_role.py +1 -1
- maleo/identity/constants/user_profile.py +2 -2
- maleo/identity/constants/user_system_role.py +2 -2
- maleo/identity/enums/api_key.py +1 -1
- maleo/identity/enums/organization.py +14 -10
- maleo/identity/enums/organization_registration_code.py +1 -1
- maleo/identity/enums/organization_relation.py +1 -1
- maleo/identity/enums/patient.py +1 -1
- maleo/identity/enums/user.py +16 -1
- maleo/identity/enums/user_medical_role.py +14 -1
- maleo/identity/enums/user_organization.py +40 -0
- maleo/identity/enums/user_organization_role.py +14 -1
- maleo/identity/enums/user_profile.py +1 -1
- maleo/identity/enums/user_system_role.py +1 -1
- maleo/identity/mixins/api_key.py +19 -3
- maleo/identity/mixins/common.py +2 -2
- maleo/identity/mixins/organization.py +10 -4
- maleo/identity/mixins/organization_registration_code.py +4 -4
- maleo/identity/mixins/organization_relation.py +5 -5
- maleo/identity/mixins/patient.py +2 -2
- maleo/identity/mixins/user.py +9 -3
- maleo/identity/mixins/user_medical_role.py +11 -5
- maleo/identity/mixins/user_organization.py +76 -0
- maleo/identity/mixins/user_organization_role.py +11 -5
- maleo/identity/mixins/user_profile.py +2 -2
- maleo/identity/mixins/user_system_role.py +3 -3
- maleo/identity/schemas/api_key.py +22 -8
- maleo/identity/schemas/common.py +26 -82
- maleo/identity/schemas/organization.py +59 -25
- maleo/identity/schemas/organization_registration_code.py +11 -11
- maleo/identity/schemas/organization_relation.py +48 -22
- maleo/identity/schemas/patient.py +12 -12
- maleo/identity/schemas/user.py +104 -22
- maleo/identity/schemas/user_medical_role.py +66 -16
- maleo/identity/schemas/user_organization.py +334 -0
- maleo/identity/schemas/user_organization_role.py +68 -16
- maleo/identity/schemas/user_profile.py +12 -12
- maleo/identity/schemas/user_system_role.py +10 -10
- maleo/identity/types/api_key.py +3 -2
- maleo/identity/types/organization.py +1 -1
- maleo/identity/types/organization_registration_code.py +1 -1
- maleo/identity/types/organization_relation.py +1 -1
- maleo/identity/types/user.py +1 -1
- maleo/identity/types/user_medical_role.py +3 -2
- maleo/identity/types/user_organization.py +7 -0
- maleo/identity/types/user_organization_role.py +3 -2
- maleo/identity/types/user_profile.py +1 -1
- maleo/identity/types/user_system_role.py +1 -1
- {maleo_identity-0.1.31.dist-info → maleo_identity-0.1.59.dist-info}/METADATA +10 -9
- maleo_identity-0.1.59.dist-info/RECORD +68 -0
- maleo/identity/utils/__init__.py +0 -0
- maleo/identity/utils/organization.py +0 -32
- maleo/identity/utils/user.py +0 -32
- maleo_identity-0.1.31.dist-info/RECORD +0 -66
- {maleo_identity-0.1.31.dist-info → maleo_identity-0.1.59.dist-info}/WHEEL +0 -0
- {maleo_identity-0.1.31.dist-info → maleo_identity-0.1.59.dist-info}/licenses/LICENSE +0 -0
- {maleo_identity-0.1.31.dist-info → maleo_identity-0.1.59.dist-info}/top_level.txt +0 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
from pydantic import BaseModel, Field
|
|
2
2
|
from typing import Annotated, Generic, Literal, TypeVar, overload
|
|
3
3
|
from uuid import UUID
|
|
4
|
-
from
|
|
4
|
+
from nexo.enums.medical import (
|
|
5
5
|
MedicalRole,
|
|
6
6
|
OptMedicalRole,
|
|
7
7
|
FullMedicalRoleMixin,
|
|
8
8
|
OptListOfMedicalRoles,
|
|
9
9
|
FullMedicalRolesMixin,
|
|
10
10
|
)
|
|
11
|
-
from
|
|
11
|
+
from nexo.enums.status import (
|
|
12
12
|
ListOfDataStatuses,
|
|
13
13
|
FULL_DATA_STATUSES,
|
|
14
14
|
)
|
|
15
|
-
from
|
|
16
|
-
from
|
|
15
|
+
from nexo.schemas.mixins.filter import convert as convert_filter
|
|
16
|
+
from nexo.schemas.mixins.identity import (
|
|
17
17
|
IdentifierMixin,
|
|
18
18
|
Ids,
|
|
19
19
|
UUIDs,
|
|
@@ -22,23 +22,41 @@ from maleo.schemas.mixins.identity import (
|
|
|
22
22
|
IntOrganizationId,
|
|
23
23
|
IntOrganizationIds,
|
|
24
24
|
)
|
|
25
|
-
from
|
|
26
|
-
from
|
|
27
|
-
from
|
|
25
|
+
from nexo.schemas.mixins.sort import convert as convert_sort
|
|
26
|
+
from nexo.schemas.operation.enums import ResourceOperationStatusUpdateType
|
|
27
|
+
from nexo.schemas.parameter import (
|
|
28
28
|
ReadSingleParameter as BaseReadSingleParameter,
|
|
29
29
|
ReadPaginatedMultipleParameter,
|
|
30
30
|
StatusUpdateParameter as BaseStatusUpdateParameter,
|
|
31
31
|
DeleteSingleParameter as BaseDeleteSingleParameter,
|
|
32
32
|
)
|
|
33
|
-
from
|
|
34
|
-
from
|
|
35
|
-
from
|
|
36
|
-
from ..enums.user_medical_role import IdentifierType
|
|
37
|
-
from ..mixins.user_medical_role import UserMedicalRoleIdentifier
|
|
33
|
+
from nexo.types.dict import StrToAnyDict
|
|
34
|
+
from nexo.types.integer import OptInt, OptListOfInts
|
|
35
|
+
from nexo.types.uuid import OptListOfUUIDs
|
|
36
|
+
from ..enums.user_medical_role import IdentifierType, OptListOfExpandableFields
|
|
37
|
+
from ..mixins.user_medical_role import Expand, UserMedicalRoleIdentifier
|
|
38
38
|
from ..types.user_medical_role import CompositeIdentifierType, IdentifierValueType
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
class
|
|
41
|
+
class BaseCreateData(FullMedicalRoleMixin[MedicalRole]):
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class CreateFromOrganizationData(
|
|
46
|
+
FullMedicalRoleMixin[MedicalRole],
|
|
47
|
+
IntUserId[int],
|
|
48
|
+
):
|
|
49
|
+
pass
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class CreateFromUserData(
|
|
53
|
+
FullMedicalRoleMixin[MedicalRole],
|
|
54
|
+
IntOrganizationId[int],
|
|
55
|
+
):
|
|
56
|
+
pass
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class FullCreateData(
|
|
42
60
|
FullMedicalRoleMixin[MedicalRole],
|
|
43
61
|
IntOrganizationId[int],
|
|
44
62
|
IntUserId[int],
|
|
@@ -46,7 +64,15 @@ class CreateParameter(
|
|
|
46
64
|
pass
|
|
47
65
|
|
|
48
66
|
|
|
67
|
+
class CreateParameter(
|
|
68
|
+
Expand,
|
|
69
|
+
FullCreateData,
|
|
70
|
+
):
|
|
71
|
+
pass
|
|
72
|
+
|
|
73
|
+
|
|
49
74
|
class ReadMultipleParameter(
|
|
75
|
+
Expand,
|
|
50
76
|
ReadPaginatedMultipleParameter,
|
|
51
77
|
FullMedicalRolesMixin[OptListOfMedicalRoles],
|
|
52
78
|
IntOrganizationIds[OptListOfInts],
|
|
@@ -77,6 +103,7 @@ class ReadMultipleParameter(
|
|
|
77
103
|
"page",
|
|
78
104
|
"limit",
|
|
79
105
|
"use_cache",
|
|
106
|
+
"expand",
|
|
80
107
|
}
|
|
81
108
|
|
|
82
109
|
def to_query_params(self) -> StrToAnyDict:
|
|
@@ -89,15 +116,18 @@ class ReadMultipleParameter(
|
|
|
89
116
|
return params
|
|
90
117
|
|
|
91
118
|
|
|
92
|
-
class ReadSingleParameter(BaseReadSingleParameter[UserMedicalRoleIdentifier]):
|
|
119
|
+
class ReadSingleParameter(Expand, BaseReadSingleParameter[UserMedicalRoleIdentifier]):
|
|
93
120
|
@classmethod
|
|
94
121
|
def from_identifier(
|
|
95
122
|
cls,
|
|
96
123
|
identifier: UserMedicalRoleIdentifier,
|
|
97
124
|
statuses: ListOfDataStatuses = FULL_DATA_STATUSES,
|
|
98
125
|
use_cache: bool = True,
|
|
126
|
+
expand: OptListOfExpandableFields = None,
|
|
99
127
|
) -> "ReadSingleParameter":
|
|
100
|
-
return cls(
|
|
128
|
+
return cls(
|
|
129
|
+
identifier=identifier, statuses=statuses, use_cache=use_cache, expand=expand
|
|
130
|
+
)
|
|
101
131
|
|
|
102
132
|
@overload
|
|
103
133
|
@classmethod
|
|
@@ -107,6 +137,7 @@ class ReadSingleParameter(BaseReadSingleParameter[UserMedicalRoleIdentifier]):
|
|
|
107
137
|
identifier_value: int,
|
|
108
138
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
109
139
|
use_cache: bool = True,
|
|
140
|
+
expand: OptListOfExpandableFields = None,
|
|
110
141
|
) -> "ReadSingleParameter": ...
|
|
111
142
|
@overload
|
|
112
143
|
@classmethod
|
|
@@ -116,6 +147,7 @@ class ReadSingleParameter(BaseReadSingleParameter[UserMedicalRoleIdentifier]):
|
|
|
116
147
|
identifier_value: UUID,
|
|
117
148
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
118
149
|
use_cache: bool = True,
|
|
150
|
+
expand: OptListOfExpandableFields = None,
|
|
119
151
|
) -> "ReadSingleParameter": ...
|
|
120
152
|
@overload
|
|
121
153
|
@classmethod
|
|
@@ -125,6 +157,7 @@ class ReadSingleParameter(BaseReadSingleParameter[UserMedicalRoleIdentifier]):
|
|
|
125
157
|
identifier_value: CompositeIdentifierType,
|
|
126
158
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
127
159
|
use_cache: bool = True,
|
|
160
|
+
expand: OptListOfExpandableFields = None,
|
|
128
161
|
) -> "ReadSingleParameter": ...
|
|
129
162
|
@overload
|
|
130
163
|
@classmethod
|
|
@@ -134,6 +167,7 @@ class ReadSingleParameter(BaseReadSingleParameter[UserMedicalRoleIdentifier]):
|
|
|
134
167
|
identifier_value: IdentifierValueType,
|
|
135
168
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
136
169
|
use_cache: bool = True,
|
|
170
|
+
expand: OptListOfExpandableFields = None,
|
|
137
171
|
) -> "ReadSingleParameter": ...
|
|
138
172
|
@classmethod
|
|
139
173
|
def new(
|
|
@@ -142,6 +176,7 @@ class ReadSingleParameter(BaseReadSingleParameter[UserMedicalRoleIdentifier]):
|
|
|
142
176
|
identifier_value: IdentifierValueType,
|
|
143
177
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
144
178
|
use_cache: bool = True,
|
|
179
|
+
expand: OptListOfExpandableFields = None,
|
|
145
180
|
) -> "ReadSingleParameter":
|
|
146
181
|
return cls(
|
|
147
182
|
identifier=UserMedicalRoleIdentifier(
|
|
@@ -149,11 +184,12 @@ class ReadSingleParameter(BaseReadSingleParameter[UserMedicalRoleIdentifier]):
|
|
|
149
184
|
),
|
|
150
185
|
statuses=statuses,
|
|
151
186
|
use_cache=use_cache,
|
|
187
|
+
expand=expand,
|
|
152
188
|
)
|
|
153
189
|
|
|
154
190
|
def to_query_params(self) -> StrToAnyDict:
|
|
155
191
|
return self.model_dump(
|
|
156
|
-
mode="json", include={"statuses", "use_cache"}, exclude_none=True
|
|
192
|
+
mode="json", include={"statuses", "use_cache", "expand"}, exclude_none=True
|
|
157
193
|
)
|
|
158
194
|
|
|
159
195
|
|
|
@@ -181,6 +217,7 @@ class UpdateDataMixin(BaseModel, Generic[UpdateDataT]):
|
|
|
181
217
|
|
|
182
218
|
|
|
183
219
|
class UpdateParameter(
|
|
220
|
+
Expand,
|
|
184
221
|
UpdateDataMixin[UpdateDataT],
|
|
185
222
|
IdentifierMixin[UserMedicalRoleIdentifier],
|
|
186
223
|
Generic[UpdateDataT],
|
|
@@ -192,6 +229,7 @@ class UpdateParameter(
|
|
|
192
229
|
identifier_type: Literal[IdentifierType.ID],
|
|
193
230
|
identifier_value: int,
|
|
194
231
|
data: UpdateDataT,
|
|
232
|
+
expand: OptListOfExpandableFields = None,
|
|
195
233
|
) -> "UpdateParameter": ...
|
|
196
234
|
@overload
|
|
197
235
|
@classmethod
|
|
@@ -200,6 +238,7 @@ class UpdateParameter(
|
|
|
200
238
|
identifier_type: Literal[IdentifierType.UUID],
|
|
201
239
|
identifier_value: UUID,
|
|
202
240
|
data: UpdateDataT,
|
|
241
|
+
expand: OptListOfExpandableFields = None,
|
|
203
242
|
) -> "UpdateParameter": ...
|
|
204
243
|
@overload
|
|
205
244
|
@classmethod
|
|
@@ -208,6 +247,7 @@ class UpdateParameter(
|
|
|
208
247
|
identifier_type: Literal[IdentifierType.COMPOSITE],
|
|
209
248
|
identifier_value: CompositeIdentifierType,
|
|
210
249
|
data: UpdateDataT,
|
|
250
|
+
expand: OptListOfExpandableFields = None,
|
|
211
251
|
) -> "UpdateParameter": ...
|
|
212
252
|
@overload
|
|
213
253
|
@classmethod
|
|
@@ -216,6 +256,7 @@ class UpdateParameter(
|
|
|
216
256
|
identifier_type: IdentifierType,
|
|
217
257
|
identifier_value: IdentifierValueType,
|
|
218
258
|
data: UpdateDataT,
|
|
259
|
+
expand: OptListOfExpandableFields = None,
|
|
219
260
|
) -> "UpdateParameter": ...
|
|
220
261
|
@classmethod
|
|
221
262
|
def new(
|
|
@@ -223,16 +264,19 @@ class UpdateParameter(
|
|
|
223
264
|
identifier_type: IdentifierType,
|
|
224
265
|
identifier_value: IdentifierValueType,
|
|
225
266
|
data: UpdateDataT,
|
|
267
|
+
expand: OptListOfExpandableFields = None,
|
|
226
268
|
) -> "UpdateParameter":
|
|
227
269
|
return cls(
|
|
228
270
|
identifier=UserMedicalRoleIdentifier(
|
|
229
271
|
type=identifier_type, value=identifier_value
|
|
230
272
|
),
|
|
231
273
|
data=data,
|
|
274
|
+
expand=expand,
|
|
232
275
|
)
|
|
233
276
|
|
|
234
277
|
|
|
235
278
|
class StatusUpdateParameter(
|
|
279
|
+
Expand,
|
|
236
280
|
BaseStatusUpdateParameter[UserMedicalRoleIdentifier],
|
|
237
281
|
):
|
|
238
282
|
@overload
|
|
@@ -242,6 +286,7 @@ class StatusUpdateParameter(
|
|
|
242
286
|
identifier_type: Literal[IdentifierType.ID],
|
|
243
287
|
identifier_value: int,
|
|
244
288
|
type: ResourceOperationStatusUpdateType,
|
|
289
|
+
expand: OptListOfExpandableFields = None,
|
|
245
290
|
) -> "StatusUpdateParameter": ...
|
|
246
291
|
@overload
|
|
247
292
|
@classmethod
|
|
@@ -250,6 +295,7 @@ class StatusUpdateParameter(
|
|
|
250
295
|
identifier_type: Literal[IdentifierType.UUID],
|
|
251
296
|
identifier_value: UUID,
|
|
252
297
|
type: ResourceOperationStatusUpdateType,
|
|
298
|
+
expand: OptListOfExpandableFields = None,
|
|
253
299
|
) -> "StatusUpdateParameter": ...
|
|
254
300
|
@overload
|
|
255
301
|
@classmethod
|
|
@@ -258,6 +304,7 @@ class StatusUpdateParameter(
|
|
|
258
304
|
identifier_type: Literal[IdentifierType.COMPOSITE],
|
|
259
305
|
identifier_value: CompositeIdentifierType,
|
|
260
306
|
type: ResourceOperationStatusUpdateType,
|
|
307
|
+
expand: OptListOfExpandableFields = None,
|
|
261
308
|
) -> "StatusUpdateParameter": ...
|
|
262
309
|
@overload
|
|
263
310
|
@classmethod
|
|
@@ -266,6 +313,7 @@ class StatusUpdateParameter(
|
|
|
266
313
|
identifier_type: IdentifierType,
|
|
267
314
|
identifier_value: IdentifierValueType,
|
|
268
315
|
type: ResourceOperationStatusUpdateType,
|
|
316
|
+
expand: OptListOfExpandableFields = None,
|
|
269
317
|
) -> "StatusUpdateParameter": ...
|
|
270
318
|
@classmethod
|
|
271
319
|
def new(
|
|
@@ -273,12 +321,14 @@ class StatusUpdateParameter(
|
|
|
273
321
|
identifier_type: IdentifierType,
|
|
274
322
|
identifier_value: IdentifierValueType,
|
|
275
323
|
type: ResourceOperationStatusUpdateType,
|
|
324
|
+
expand: OptListOfExpandableFields = None,
|
|
276
325
|
) -> "StatusUpdateParameter":
|
|
277
326
|
return cls(
|
|
278
327
|
identifier=UserMedicalRoleIdentifier(
|
|
279
328
|
type=identifier_type, value=identifier_value
|
|
280
329
|
),
|
|
281
330
|
type=type,
|
|
331
|
+
expand=expand,
|
|
282
332
|
)
|
|
283
333
|
|
|
284
334
|
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from typing import Annotated, Generic, Literal, TypeVar, overload
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
from nexo.enums.status import (
|
|
5
|
+
ListOfDataStatuses,
|
|
6
|
+
FULL_DATA_STATUSES,
|
|
7
|
+
)
|
|
8
|
+
from nexo.schemas.mixins.filter import convert as convert_filter
|
|
9
|
+
from nexo.schemas.mixins.identity import (
|
|
10
|
+
IdentifierMixin,
|
|
11
|
+
Ids,
|
|
12
|
+
UUIDs,
|
|
13
|
+
IntUserId,
|
|
14
|
+
IntUserIds,
|
|
15
|
+
IntOrganizationId,
|
|
16
|
+
IntOrganizationIds,
|
|
17
|
+
)
|
|
18
|
+
from nexo.schemas.mixins.sort import convert as convert_sort
|
|
19
|
+
from nexo.schemas.operation.enums import ResourceOperationStatusUpdateType
|
|
20
|
+
from nexo.schemas.parameter import (
|
|
21
|
+
ReadSingleParameter as BaseReadSingleParameter,
|
|
22
|
+
ReadPaginatedMultipleParameter,
|
|
23
|
+
StatusUpdateParameter as BaseStatusUpdateParameter,
|
|
24
|
+
DeleteSingleParameter as BaseDeleteSingleParameter,
|
|
25
|
+
)
|
|
26
|
+
from nexo.types.dict import StrToAnyDict
|
|
27
|
+
from nexo.types.integer import OptInt, OptListOfInts
|
|
28
|
+
from nexo.types.uuid import OptListOfUUIDs
|
|
29
|
+
from ..enums.user_organization import IdentifierType, OptListOfExpandableFields
|
|
30
|
+
from ..mixins.user_organization import Expand, UserOrganizationIdentifier
|
|
31
|
+
from ..types.user_organization import CompositeIdentifierType, IdentifierValueType
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class CreateData(
|
|
35
|
+
IntOrganizationId[int],
|
|
36
|
+
IntUserId[int],
|
|
37
|
+
):
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class CreateParameter(
|
|
42
|
+
Expand,
|
|
43
|
+
CreateData,
|
|
44
|
+
):
|
|
45
|
+
pass
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class ReadMultipleParameter(
|
|
49
|
+
Expand,
|
|
50
|
+
ReadPaginatedMultipleParameter,
|
|
51
|
+
IntOrganizationIds[OptListOfInts],
|
|
52
|
+
IntUserIds[OptListOfInts],
|
|
53
|
+
UUIDs[OptListOfUUIDs],
|
|
54
|
+
Ids[OptListOfInts],
|
|
55
|
+
):
|
|
56
|
+
ids: Annotated[OptListOfInts, Field(None, description="Ids")] = None
|
|
57
|
+
uuids: Annotated[OptListOfUUIDs, Field(None, description="UUIDs")] = None
|
|
58
|
+
user_ids: Annotated[OptListOfInts, Field(None, description="User's IDs")] = None
|
|
59
|
+
organization_ids: Annotated[
|
|
60
|
+
OptListOfInts, Field(None, description="Organization's IDs")
|
|
61
|
+
] = None
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def _query_param_fields(self) -> set[str]:
|
|
65
|
+
return {
|
|
66
|
+
"ids",
|
|
67
|
+
"uuids",
|
|
68
|
+
"statuses",
|
|
69
|
+
"user_ids",
|
|
70
|
+
"organization_ids",
|
|
71
|
+
"search",
|
|
72
|
+
"page",
|
|
73
|
+
"limit",
|
|
74
|
+
"use_cache",
|
|
75
|
+
"expand",
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
def to_query_params(self) -> StrToAnyDict:
|
|
79
|
+
params = self.model_dump(
|
|
80
|
+
mode="json", include=self._query_param_fields, exclude_none=True
|
|
81
|
+
)
|
|
82
|
+
params["filters"] = convert_filter(self.date_filters)
|
|
83
|
+
params["sorts"] = convert_sort(self.sort_columns)
|
|
84
|
+
params = {k: v for k, v in params.items()}
|
|
85
|
+
return params
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class ReadSingleParameter(Expand, BaseReadSingleParameter[UserOrganizationIdentifier]):
|
|
89
|
+
@classmethod
|
|
90
|
+
def from_identifier(
|
|
91
|
+
cls,
|
|
92
|
+
identifier: UserOrganizationIdentifier,
|
|
93
|
+
statuses: ListOfDataStatuses = FULL_DATA_STATUSES,
|
|
94
|
+
use_cache: bool = True,
|
|
95
|
+
expand: OptListOfExpandableFields = None,
|
|
96
|
+
) -> "ReadSingleParameter":
|
|
97
|
+
return cls(
|
|
98
|
+
identifier=identifier, statuses=statuses, use_cache=use_cache, expand=expand
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
@overload
|
|
102
|
+
@classmethod
|
|
103
|
+
def new(
|
|
104
|
+
cls,
|
|
105
|
+
identifier_type: Literal[IdentifierType.ID],
|
|
106
|
+
identifier_value: int,
|
|
107
|
+
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
108
|
+
use_cache: bool = True,
|
|
109
|
+
expand: OptListOfExpandableFields = None,
|
|
110
|
+
) -> "ReadSingleParameter": ...
|
|
111
|
+
@overload
|
|
112
|
+
@classmethod
|
|
113
|
+
def new(
|
|
114
|
+
cls,
|
|
115
|
+
identifier_type: Literal[IdentifierType.UUID],
|
|
116
|
+
identifier_value: UUID,
|
|
117
|
+
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
118
|
+
use_cache: bool = True,
|
|
119
|
+
expand: OptListOfExpandableFields = None,
|
|
120
|
+
) -> "ReadSingleParameter": ...
|
|
121
|
+
@overload
|
|
122
|
+
@classmethod
|
|
123
|
+
def new(
|
|
124
|
+
cls,
|
|
125
|
+
identifier_type: Literal[IdentifierType.COMPOSITE],
|
|
126
|
+
identifier_value: CompositeIdentifierType,
|
|
127
|
+
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
128
|
+
use_cache: bool = True,
|
|
129
|
+
expand: OptListOfExpandableFields = None,
|
|
130
|
+
) -> "ReadSingleParameter": ...
|
|
131
|
+
@overload
|
|
132
|
+
@classmethod
|
|
133
|
+
def new(
|
|
134
|
+
cls,
|
|
135
|
+
identifier_type: IdentifierType,
|
|
136
|
+
identifier_value: IdentifierValueType,
|
|
137
|
+
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
138
|
+
use_cache: bool = True,
|
|
139
|
+
expand: OptListOfExpandableFields = None,
|
|
140
|
+
) -> "ReadSingleParameter": ...
|
|
141
|
+
@classmethod
|
|
142
|
+
def new(
|
|
143
|
+
cls,
|
|
144
|
+
identifier_type: IdentifierType,
|
|
145
|
+
identifier_value: IdentifierValueType,
|
|
146
|
+
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
147
|
+
use_cache: bool = True,
|
|
148
|
+
expand: OptListOfExpandableFields = None,
|
|
149
|
+
) -> "ReadSingleParameter":
|
|
150
|
+
return cls(
|
|
151
|
+
identifier=UserOrganizationIdentifier(
|
|
152
|
+
type=identifier_type,
|
|
153
|
+
value=identifier_value,
|
|
154
|
+
),
|
|
155
|
+
statuses=statuses,
|
|
156
|
+
use_cache=use_cache,
|
|
157
|
+
expand=expand,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
def to_query_params(self) -> StrToAnyDict:
|
|
161
|
+
return self.model_dump(
|
|
162
|
+
mode="json", include={"statuses", "use_cache", "expand"}, exclude_none=True
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class FullUpdateData(
|
|
167
|
+
IntOrganizationId[int],
|
|
168
|
+
IntUserId[int],
|
|
169
|
+
):
|
|
170
|
+
pass
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
class PartialUpdateData(
|
|
174
|
+
IntOrganizationId[OptInt],
|
|
175
|
+
IntUserId[OptInt],
|
|
176
|
+
):
|
|
177
|
+
pass
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
UpdateDataT = TypeVar("UpdateDataT", FullUpdateData, PartialUpdateData)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class UpdateDataMixin(BaseModel, Generic[UpdateDataT]):
|
|
184
|
+
data: UpdateDataT = Field(..., description="Update data")
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class UpdateParameter(
|
|
188
|
+
Expand,
|
|
189
|
+
UpdateDataMixin[UpdateDataT],
|
|
190
|
+
IdentifierMixin[UserOrganizationIdentifier],
|
|
191
|
+
Generic[UpdateDataT],
|
|
192
|
+
):
|
|
193
|
+
@overload
|
|
194
|
+
@classmethod
|
|
195
|
+
def new(
|
|
196
|
+
cls,
|
|
197
|
+
identifier_type: Literal[IdentifierType.ID],
|
|
198
|
+
identifier_value: int,
|
|
199
|
+
data: UpdateDataT,
|
|
200
|
+
expand: OptListOfExpandableFields = None,
|
|
201
|
+
) -> "UpdateParameter": ...
|
|
202
|
+
@overload
|
|
203
|
+
@classmethod
|
|
204
|
+
def new(
|
|
205
|
+
cls,
|
|
206
|
+
identifier_type: Literal[IdentifierType.UUID],
|
|
207
|
+
identifier_value: UUID,
|
|
208
|
+
data: UpdateDataT,
|
|
209
|
+
expand: OptListOfExpandableFields = None,
|
|
210
|
+
) -> "UpdateParameter": ...
|
|
211
|
+
@overload
|
|
212
|
+
@classmethod
|
|
213
|
+
def new(
|
|
214
|
+
cls,
|
|
215
|
+
identifier_type: Literal[IdentifierType.COMPOSITE],
|
|
216
|
+
identifier_value: CompositeIdentifierType,
|
|
217
|
+
data: UpdateDataT,
|
|
218
|
+
expand: OptListOfExpandableFields = None,
|
|
219
|
+
) -> "UpdateParameter": ...
|
|
220
|
+
@overload
|
|
221
|
+
@classmethod
|
|
222
|
+
def new(
|
|
223
|
+
cls,
|
|
224
|
+
identifier_type: IdentifierType,
|
|
225
|
+
identifier_value: IdentifierValueType,
|
|
226
|
+
data: UpdateDataT,
|
|
227
|
+
expand: OptListOfExpandableFields = None,
|
|
228
|
+
) -> "UpdateParameter": ...
|
|
229
|
+
@classmethod
|
|
230
|
+
def new(
|
|
231
|
+
cls,
|
|
232
|
+
identifier_type: IdentifierType,
|
|
233
|
+
identifier_value: IdentifierValueType,
|
|
234
|
+
data: UpdateDataT,
|
|
235
|
+
expand: OptListOfExpandableFields = None,
|
|
236
|
+
) -> "UpdateParameter":
|
|
237
|
+
return cls(
|
|
238
|
+
identifier=UserOrganizationIdentifier(
|
|
239
|
+
type=identifier_type, value=identifier_value
|
|
240
|
+
),
|
|
241
|
+
data=data,
|
|
242
|
+
expand=expand,
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
class StatusUpdateParameter(
|
|
247
|
+
Expand,
|
|
248
|
+
BaseStatusUpdateParameter[UserOrganizationIdentifier],
|
|
249
|
+
):
|
|
250
|
+
@overload
|
|
251
|
+
@classmethod
|
|
252
|
+
def new(
|
|
253
|
+
cls,
|
|
254
|
+
identifier_type: Literal[IdentifierType.ID],
|
|
255
|
+
identifier_value: int,
|
|
256
|
+
type: ResourceOperationStatusUpdateType,
|
|
257
|
+
expand: OptListOfExpandableFields = None,
|
|
258
|
+
) -> "StatusUpdateParameter": ...
|
|
259
|
+
@overload
|
|
260
|
+
@classmethod
|
|
261
|
+
def new(
|
|
262
|
+
cls,
|
|
263
|
+
identifier_type: Literal[IdentifierType.UUID],
|
|
264
|
+
identifier_value: UUID,
|
|
265
|
+
type: ResourceOperationStatusUpdateType,
|
|
266
|
+
expand: OptListOfExpandableFields = None,
|
|
267
|
+
) -> "StatusUpdateParameter": ...
|
|
268
|
+
@overload
|
|
269
|
+
@classmethod
|
|
270
|
+
def new(
|
|
271
|
+
cls,
|
|
272
|
+
identifier_type: Literal[IdentifierType.COMPOSITE],
|
|
273
|
+
identifier_value: CompositeIdentifierType,
|
|
274
|
+
type: ResourceOperationStatusUpdateType,
|
|
275
|
+
expand: OptListOfExpandableFields = None,
|
|
276
|
+
) -> "StatusUpdateParameter": ...
|
|
277
|
+
@overload
|
|
278
|
+
@classmethod
|
|
279
|
+
def new(
|
|
280
|
+
cls,
|
|
281
|
+
identifier_type: IdentifierType,
|
|
282
|
+
identifier_value: IdentifierValueType,
|
|
283
|
+
type: ResourceOperationStatusUpdateType,
|
|
284
|
+
expand: OptListOfExpandableFields = None,
|
|
285
|
+
) -> "StatusUpdateParameter": ...
|
|
286
|
+
@classmethod
|
|
287
|
+
def new(
|
|
288
|
+
cls,
|
|
289
|
+
identifier_type: IdentifierType,
|
|
290
|
+
identifier_value: IdentifierValueType,
|
|
291
|
+
type: ResourceOperationStatusUpdateType,
|
|
292
|
+
expand: OptListOfExpandableFields = None,
|
|
293
|
+
) -> "StatusUpdateParameter":
|
|
294
|
+
return cls(
|
|
295
|
+
identifier=UserOrganizationIdentifier(
|
|
296
|
+
type=identifier_type, value=identifier_value
|
|
297
|
+
),
|
|
298
|
+
type=type,
|
|
299
|
+
expand=expand,
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
class DeleteSingleParameter(BaseDeleteSingleParameter[UserOrganizationIdentifier]):
|
|
304
|
+
@overload
|
|
305
|
+
@classmethod
|
|
306
|
+
def new(
|
|
307
|
+
cls, identifier_type: Literal[IdentifierType.ID], identifier_value: int
|
|
308
|
+
) -> "DeleteSingleParameter": ...
|
|
309
|
+
@overload
|
|
310
|
+
@classmethod
|
|
311
|
+
def new(
|
|
312
|
+
cls, identifier_type: Literal[IdentifierType.UUID], identifier_value: UUID
|
|
313
|
+
) -> "DeleteSingleParameter": ...
|
|
314
|
+
@overload
|
|
315
|
+
@classmethod
|
|
316
|
+
def new(
|
|
317
|
+
cls,
|
|
318
|
+
identifier_type: Literal[IdentifierType.COMPOSITE],
|
|
319
|
+
identifier_value: CompositeIdentifierType,
|
|
320
|
+
) -> "DeleteSingleParameter": ...
|
|
321
|
+
@overload
|
|
322
|
+
@classmethod
|
|
323
|
+
def new(
|
|
324
|
+
cls, identifier_type: IdentifierType, identifier_value: IdentifierValueType
|
|
325
|
+
) -> "DeleteSingleParameter": ...
|
|
326
|
+
@classmethod
|
|
327
|
+
def new(
|
|
328
|
+
cls, identifier_type: IdentifierType, identifier_value: IdentifierValueType
|
|
329
|
+
) -> "DeleteSingleParameter":
|
|
330
|
+
return cls(
|
|
331
|
+
identifier=UserOrganizationIdentifier(
|
|
332
|
+
type=identifier_type, value=identifier_value
|
|
333
|
+
)
|
|
334
|
+
)
|