maleo-identity 0.0.85__py3-none-any.whl → 0.1.24__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 +13 -0
- maleo/identity/constants/organization.py +3 -10
- maleo/identity/constants/organization_registration_code.py +5 -17
- maleo/identity/constants/organization_relation.py +13 -0
- maleo/identity/constants/patient.py +7 -0
- maleo/identity/constants/user.py +3 -20
- maleo/identity/constants/user_medical_role.py +13 -0
- maleo/identity/constants/user_organization_role.py +5 -39
- maleo/identity/constants/user_profile.py +3 -21
- maleo/identity/constants/user_system_role.py +9 -8
- maleo/identity/enums/api_key.py +25 -0
- maleo/identity/enums/organization.py +16 -3
- maleo/identity/enums/organization_registration_code.py +9 -0
- maleo/identity/enums/organization_relation.py +22 -0
- maleo/identity/enums/patient.py +29 -0
- maleo/identity/enums/user.py +16 -7
- maleo/identity/enums/user_medical_role.py +22 -0
- maleo/identity/enums/user_organization_role.py +19 -12
- maleo/identity/enums/user_profile.py +7 -9
- maleo/identity/enums/user_system_role.py +30 -0
- maleo/identity/mixins/api_key.py +72 -0
- maleo/identity/mixins/common.py +29 -0
- maleo/identity/mixins/organization.py +68 -8
- maleo/identity/mixins/organization_registration_code.py +126 -9
- maleo/identity/mixins/organization_relation.py +80 -0
- maleo/identity/mixins/patient.py +65 -0
- maleo/identity/mixins/user.py +86 -24
- maleo/identity/mixins/user_medical_role.py +68 -0
- maleo/identity/mixins/user_organization_role.py +68 -4
- maleo/identity/mixins/user_profile.py +84 -53
- maleo/identity/mixins/user_system_role.py +72 -4
- maleo/identity/schemas/api_key.py +171 -0
- maleo/identity/schemas/common.py +335 -0
- maleo/identity/schemas/organization.py +311 -0
- maleo/identity/schemas/organization_registration_code.py +314 -0
- maleo/identity/schemas/organization_relation.py +315 -0
- maleo/identity/schemas/patient.py +349 -0
- maleo/identity/schemas/user.py +318 -0
- maleo/identity/schemas/user_medical_role.py +316 -0
- maleo/identity/schemas/user_organization_role.py +317 -0
- maleo/identity/schemas/user_profile.py +362 -0
- maleo/identity/schemas/user_system_role.py +339 -0
- maleo/identity/types/api_key.py +7 -0
- maleo/identity/types/organization.py +4 -0
- maleo/identity/types/organization_registration_code.py +4 -0
- maleo/identity/types/organization_relation.py +7 -0
- maleo/identity/types/patient.py +4 -0
- maleo/identity/types/user.py +4 -0
- maleo/identity/types/user_medical_role.py +7 -0
- maleo/identity/types/user_organization_role.py +7 -0
- maleo/identity/types/user_profile.py +4 -0
- maleo/identity/types/user_system_role.py +8 -0
- maleo/identity/utils/organization.py +32 -0
- maleo/identity/utils/user.py +32 -0
- maleo_identity-0.1.24.dist-info/METADATA +119 -0
- maleo_identity-0.1.24.dist-info/RECORD +66 -0
- maleo_identity-0.1.24.dist-info/licenses/LICENSE +57 -0
- maleo/identity/client/manager.py +0 -157
- maleo/identity/client/services/__init__.py +0 -0
- maleo/identity/client/services/organization.py +0 -1944
- maleo/identity/client/services/organization_registration_code.py +0 -470
- maleo/identity/client/services/organization_role.py +0 -276
- maleo/identity/client/services/user.py +0 -1559
- maleo/identity/client/services/user_organization.py +0 -276
- maleo/identity/client/services/user_organization_role.py +0 -278
- maleo/identity/client/services/user_profile.py +0 -276
- maleo/identity/client/services/user_system_role.py +0 -276
- maleo/identity/constants/organization_role.py +0 -35
- maleo/identity/constants/user_organization.py +0 -58
- maleo/identity/db.py +0 -4
- maleo/identity/dtos/__init__.py +0 -0
- maleo/identity/dtos/configuration.py +0 -15
- maleo/identity/dtos/data/__init__.py +0 -0
- maleo/identity/dtos/data/organization_registration_code.py +0 -15
- maleo/identity/dtos/data/user_profile.py +0 -29
- maleo/identity/dtos/settings.py +0 -17
- maleo/identity/enums/general.py +0 -5
- maleo/identity/enums/organization_role.py +0 -7
- maleo/identity/enums/user_organization.py +0 -14
- maleo/identity/mixins/organization_role.py +0 -15
- maleo/identity/mixins/user_organization.py +0 -6
- maleo/identity/models/__init__.py +0 -0
- maleo/identity/models/organization.py +0 -62
- maleo/identity/models/organization_registration_code.py +0 -33
- maleo/identity/models/organization_role.py +0 -37
- maleo/identity/models/user.py +0 -39
- maleo/identity/models/user_organization.py +0 -48
- maleo/identity/models/user_organization_role.py +0 -61
- maleo/identity/models/user_profile.py +0 -33
- maleo/identity/models/user_system_role.py +0 -26
- maleo/identity/schemas/data/__init__.py +0 -0
- maleo/identity/schemas/data/organization.py +0 -36
- maleo/identity/schemas/data/organization_registration_code.py +0 -27
- maleo/identity/schemas/data/organization_role.py +0 -32
- maleo/identity/schemas/data/user.py +0 -33
- maleo/identity/schemas/data/user_organization.py +0 -23
- maleo/identity/schemas/data/user_organization_role.py +0 -13
- maleo/identity/schemas/data/user_profile.py +0 -59
- maleo/identity/schemas/data/user_system_role.py +0 -25
- maleo/identity/schemas/metadata/__init__.py +0 -0
- maleo/identity/schemas/metadata/user.py +0 -6
- maleo/identity/schemas/parameter/__init__.py +0 -0
- maleo/identity/schemas/parameter/client/__init__.py +0 -0
- maleo/identity/schemas/parameter/client/organization.py +0 -74
- maleo/identity/schemas/parameter/client/organization_registration_code.py +0 -24
- maleo/identity/schemas/parameter/client/organization_role.py +0 -42
- maleo/identity/schemas/parameter/client/user.py +0 -44
- maleo/identity/schemas/parameter/client/user_organization.py +0 -62
- maleo/identity/schemas/parameter/client/user_organization_role.py +0 -49
- maleo/identity/schemas/parameter/client/user_profile.py +0 -28
- maleo/identity/schemas/parameter/client/user_system_role.py +0 -43
- maleo/identity/schemas/parameter/general/__init__.py +0 -0
- maleo/identity/schemas/parameter/general/organization.py +0 -43
- maleo/identity/schemas/parameter/general/organization_registration_code.py +0 -54
- maleo/identity/schemas/parameter/general/organization_role.py +0 -14
- maleo/identity/schemas/parameter/general/user.py +0 -101
- maleo/identity/schemas/parameter/general/user_organization.py +0 -18
- maleo/identity/schemas/parameter/general/user_organization_role.py +0 -15
- maleo/identity/schemas/parameter/general/user_profile.py +0 -70
- maleo/identity/schemas/parameter/general/user_system_role.py +0 -30
- maleo/identity/schemas/parameter/service/__init__.py +0 -0
- maleo/identity/schemas/parameter/service/organization.py +0 -60
- maleo/identity/schemas/parameter/service/organization_registration_code.py +0 -24
- maleo/identity/schemas/parameter/service/organization_role.py +0 -35
- maleo/identity/schemas/parameter/service/user.py +0 -47
- maleo/identity/schemas/parameter/service/user_organization_role.py +0 -36
- maleo/identity/schemas/parameter/service/user_profile.py +0 -28
- maleo/identity/schemas/parameter/service/user_system_role.py +0 -31
- maleo/identity/types/base/__init__.py +0 -0
- maleo/identity/types/base/organization.py +0 -5
- maleo/identity/types/base/organization_registration_code.py +0 -4
- maleo/identity/types/base/user.py +0 -5
- maleo/identity/types/base/user_profile.py +0 -5
- maleo_identity-0.0.85.dist-info/METADATA +0 -40
- maleo_identity-0.0.85.dist-info/RECORD +0 -105
- /maleo/identity/{client → utils}/__init__.py +0 -0
- {maleo_identity-0.0.85.dist-info → maleo_identity-0.1.24.dist-info}/WHEEL +0 -0
- {maleo_identity-0.0.85.dist-info → maleo_identity-0.1.24.dist-info}/top_level.txt +0 -0
|
@@ -1,88 +1,119 @@
|
|
|
1
1
|
from pydantic import BaseModel, Field
|
|
2
|
-
from typing import
|
|
3
|
-
from
|
|
4
|
-
from maleo.
|
|
5
|
-
from maleo.
|
|
2
|
+
from typing import Annotated, Generic, Literal, TypeGuard
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
from maleo.schemas.mixins.identity import Identifier
|
|
5
|
+
from maleo.types.string import OptStrT
|
|
6
|
+
from ..enums.user_profile import IdentifierType
|
|
7
|
+
from ..types.user_profile import IdentifierValueType
|
|
6
8
|
|
|
7
9
|
|
|
8
|
-
class
|
|
9
|
-
|
|
10
|
+
class LeadingTitle(BaseModel, Generic[OptStrT]):
|
|
11
|
+
leading_title: Annotated[
|
|
12
|
+
OptStrT, Field(..., description="User's Leading Title", max_length=25)
|
|
13
|
+
]
|
|
10
14
|
|
|
11
15
|
|
|
12
|
-
class
|
|
13
|
-
|
|
16
|
+
class FirstName(BaseModel, Generic[OptStrT]):
|
|
17
|
+
first_name: Annotated[
|
|
18
|
+
OptStrT, Field(..., description="User's First Name", max_length=50)
|
|
19
|
+
]
|
|
14
20
|
|
|
15
21
|
|
|
16
|
-
class
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
class MiddleName(BaseModel, Generic[OptStrT]):
|
|
23
|
+
middle_name: Annotated[
|
|
24
|
+
OptStrT, Field(..., description="User's Middle Name", max_length=50)
|
|
25
|
+
]
|
|
20
26
|
|
|
21
27
|
|
|
22
|
-
class
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
class LastName(BaseModel, Generic[OptStrT]):
|
|
29
|
+
last_name: Annotated[
|
|
30
|
+
OptStrT, Field(..., description="User's Last Name", max_length=50)
|
|
31
|
+
]
|
|
26
32
|
|
|
27
33
|
|
|
28
|
-
class
|
|
29
|
-
|
|
34
|
+
class EndingTitle(BaseModel, Generic[OptStrT]):
|
|
35
|
+
ending_title: Annotated[
|
|
36
|
+
OptStrT, Field(..., description="User's Ending Title", max_length=25)
|
|
37
|
+
]
|
|
30
38
|
|
|
31
39
|
|
|
32
|
-
class
|
|
33
|
-
|
|
34
|
-
None, max_length=50, description="User's middle name"
|
|
35
|
-
)
|
|
40
|
+
class AvatarName(BaseModel, Generic[OptStrT]):
|
|
41
|
+
avatar_name: Annotated[OptStrT, Field(..., description="User's Avatar Name")]
|
|
36
42
|
|
|
37
43
|
|
|
38
|
-
class
|
|
39
|
-
|
|
44
|
+
class AvatarUrl(BaseModel, Generic[OptStrT]):
|
|
45
|
+
avatar_url: Annotated[OptStrT, Field(..., description="User's Avatar URL")]
|
|
40
46
|
|
|
41
47
|
|
|
42
|
-
class
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
class UserProfileIdentifier(Identifier[IdentifierType, IdentifierValueType]):
|
|
49
|
+
@property
|
|
50
|
+
def column_and_value(self) -> tuple[str, IdentifierValueType]:
|
|
51
|
+
return self.type.column, self.value
|
|
46
52
|
|
|
47
53
|
|
|
48
|
-
class
|
|
49
|
-
|
|
54
|
+
class IdUserProfileIdentifier(Identifier[Literal[IdentifierType.ID], int]):
|
|
55
|
+
type: Annotated[
|
|
56
|
+
Literal[IdentifierType.ID],
|
|
57
|
+
Field(IdentifierType.ID, description="Identifier's type"),
|
|
58
|
+
] = IdentifierType.ID
|
|
59
|
+
value: Annotated[int, Field(..., description="Identifier's value", ge=1)]
|
|
50
60
|
|
|
51
61
|
|
|
52
|
-
class
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
class UserIdUserProfileIdentifier(Identifier[Literal[IdentifierType.USER_ID], int]):
|
|
63
|
+
type: Annotated[
|
|
64
|
+
Literal[IdentifierType.USER_ID],
|
|
65
|
+
Field(IdentifierType.USER_ID, description="Identifier's type"),
|
|
66
|
+
] = IdentifierType.USER_ID
|
|
67
|
+
value: Annotated[int, Field(..., description="Identifier's value", ge=1)]
|
|
56
68
|
|
|
57
69
|
|
|
58
|
-
class
|
|
59
|
-
|
|
70
|
+
class UUIDUserProfileIdentifier(Identifier[Literal[IdentifierType.UUID], UUID]):
|
|
71
|
+
type: Annotated[
|
|
72
|
+
Literal[IdentifierType.UUID],
|
|
73
|
+
Field(IdentifierType.UUID, description="Identifier's type"),
|
|
74
|
+
] = IdentifierType.UUID
|
|
60
75
|
|
|
61
76
|
|
|
62
|
-
class
|
|
63
|
-
|
|
77
|
+
class IdCardUserProfileIdentifier(Identifier[Literal[IdentifierType.ID_CARD], str]):
|
|
78
|
+
type: Annotated[
|
|
79
|
+
Literal[IdentifierType.ID_CARD],
|
|
80
|
+
Field(IdentifierType.ID_CARD, description="Identifier's type"),
|
|
81
|
+
] = IdentifierType.ID_CARD
|
|
82
|
+
value: Annotated[str, Field(..., description="Identifier's value", max_length=16)]
|
|
64
83
|
|
|
65
84
|
|
|
66
|
-
|
|
67
|
-
|
|
85
|
+
AnyUserProfileIdentifier = (
|
|
86
|
+
UserProfileIdentifier
|
|
87
|
+
| IdUserProfileIdentifier
|
|
88
|
+
| UserIdUserProfileIdentifier
|
|
89
|
+
| UUIDUserProfileIdentifier
|
|
90
|
+
| IdCardUserProfileIdentifier
|
|
91
|
+
)
|
|
68
92
|
|
|
69
93
|
|
|
70
|
-
|
|
71
|
-
|
|
94
|
+
def is_id_identifier(
|
|
95
|
+
identifier: AnyUserProfileIdentifier,
|
|
96
|
+
) -> TypeGuard[IdUserProfileIdentifier]:
|
|
97
|
+
return identifier.type is IdentifierType.ID and isinstance(identifier.value, int)
|
|
72
98
|
|
|
73
99
|
|
|
74
|
-
|
|
75
|
-
|
|
100
|
+
def is_user_id_identifier(
|
|
101
|
+
identifier: AnyUserProfileIdentifier,
|
|
102
|
+
) -> TypeGuard[UserIdUserProfileIdentifier]:
|
|
103
|
+
return identifier.type is IdentifierType.USER_ID and isinstance(
|
|
104
|
+
identifier.value, int
|
|
105
|
+
)
|
|
76
106
|
|
|
77
107
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
)
|
|
108
|
+
def is_uuid_identifier(
|
|
109
|
+
identifier: AnyUserProfileIdentifier,
|
|
110
|
+
) -> TypeGuard[UUIDUserProfileIdentifier]:
|
|
111
|
+
return identifier.type is IdentifierType.UUID and isinstance(identifier.value, UUID)
|
|
82
112
|
|
|
83
113
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
114
|
+
def is_id_card_identifier(
|
|
115
|
+
identifier: AnyUserProfileIdentifier,
|
|
116
|
+
) -> TypeGuard[IdCardUserProfileIdentifier]:
|
|
117
|
+
return identifier.type is IdentifierType.ID_CARD and isinstance(
|
|
118
|
+
identifier.value, str
|
|
119
|
+
)
|
|
@@ -1,6 +1,74 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from typing import Annotated, Literal, TypeGuard
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
from maleo.schemas.mixins.identity import Identifier
|
|
5
|
+
from maleo.types.any import ManyAny
|
|
6
|
+
from maleo.types.string import ManyStrs
|
|
7
|
+
from ..enums.user_system_role import IdentifierType, OptListOfExpandableFields
|
|
8
|
+
from ..types.user_system_role import CompositeIdentifierType, IdentifierValueType
|
|
3
9
|
|
|
4
10
|
|
|
5
|
-
class Expand(
|
|
6
|
-
|
|
11
|
+
class Expand(BaseModel):
|
|
12
|
+
expand: Annotated[
|
|
13
|
+
OptListOfExpandableFields, Field(None, description="Expanded field(s)")
|
|
14
|
+
] = None
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class UserSystemRoleIdentifier(Identifier[IdentifierType, IdentifierValueType]):
|
|
18
|
+
@property
|
|
19
|
+
def columns_and_values(self) -> tuple[ManyStrs, ManyAny]:
|
|
20
|
+
values = self.value if isinstance(self.value, tuple) else (self.value,)
|
|
21
|
+
return self.type.columns, values
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class IdUserSystemRoleIdentifier(Identifier[Literal[IdentifierType.ID], int]):
|
|
25
|
+
type: Annotated[
|
|
26
|
+
Literal[IdentifierType.ID],
|
|
27
|
+
Field(IdentifierType.ID, description="Identifier's type"),
|
|
28
|
+
] = IdentifierType.ID
|
|
29
|
+
value: Annotated[int, Field(..., description="Identifier's value", ge=1)]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class UUIDUserSystemRoleIdentifier(Identifier[Literal[IdentifierType.UUID], UUID]):
|
|
33
|
+
type: Annotated[
|
|
34
|
+
Literal[IdentifierType.UUID],
|
|
35
|
+
Field(IdentifierType.UUID, description="Identifier's type"),
|
|
36
|
+
] = IdentifierType.UUID
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class CompositeUserSystemRoleIdentifier(
|
|
40
|
+
Identifier[Literal[IdentifierType.COMPOSITE], CompositeIdentifierType]
|
|
41
|
+
):
|
|
42
|
+
type: Annotated[
|
|
43
|
+
Literal[IdentifierType.COMPOSITE],
|
|
44
|
+
Field(IdentifierType.COMPOSITE, description="Identifier's type"),
|
|
45
|
+
] = IdentifierType.COMPOSITE
|
|
46
|
+
value: Annotated[CompositeIdentifierType, Field(..., description="Identifier's value")]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
AnyUserSystemRoleIdentifier = (
|
|
50
|
+
UserSystemRoleIdentifier
|
|
51
|
+
| IdUserSystemRoleIdentifier
|
|
52
|
+
| UUIDUserSystemRoleIdentifier
|
|
53
|
+
| CompositeUserSystemRoleIdentifier
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def is_id_identifier(
|
|
58
|
+
identifier: AnyUserSystemRoleIdentifier,
|
|
59
|
+
) -> TypeGuard[IdUserSystemRoleIdentifier]:
|
|
60
|
+
return identifier.type is IdentifierType.ID and isinstance(identifier.value, int)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def is_uuid_identifier(
|
|
64
|
+
identifier: AnyUserSystemRoleIdentifier,
|
|
65
|
+
) -> TypeGuard[UUIDUserSystemRoleIdentifier]:
|
|
66
|
+
return identifier.type is IdentifierType.UUID and isinstance(identifier.value, UUID)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def is_composite_identifier(
|
|
70
|
+
identifier: AnyUserSystemRoleIdentifier,
|
|
71
|
+
) -> TypeGuard[CompositeUserSystemRoleIdentifier]:
|
|
72
|
+
return identifier.type is IdentifierType.COMPOSITE and isinstance(
|
|
73
|
+
identifier.value, tuple
|
|
74
|
+
)
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
from pydantic import Field
|
|
2
|
+
from typing import Annotated, Literal, overload
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
from maleo.enums.status import (
|
|
5
|
+
ListOfDataStatuses,
|
|
6
|
+
FULL_DATA_STATUSES,
|
|
7
|
+
)
|
|
8
|
+
from maleo.schemas.mixins.filter import convert as convert_filter
|
|
9
|
+
from maleo.schemas.mixins.identity import (
|
|
10
|
+
Ids,
|
|
11
|
+
UUIDs,
|
|
12
|
+
IntUserId,
|
|
13
|
+
IntUserIds,
|
|
14
|
+
IntOrganizationId,
|
|
15
|
+
IntOrganizationIds,
|
|
16
|
+
)
|
|
17
|
+
from maleo.schemas.mixins.sort import convert as convert_sort
|
|
18
|
+
from maleo.schemas.parameter import (
|
|
19
|
+
ReadSingleParameter as BaseReadSingleParameter,
|
|
20
|
+
ReadPaginatedMultipleParameter,
|
|
21
|
+
DeleteSingleParameter as BaseDeleteSingleParameter,
|
|
22
|
+
)
|
|
23
|
+
from maleo.types.dict import StrToAnyDict
|
|
24
|
+
from maleo.types.integer import OptInt, OptListOfInts
|
|
25
|
+
from maleo.types.uuid import OptListOfUUIDs
|
|
26
|
+
from ..enums.api_key import IdentifierType
|
|
27
|
+
from ..mixins.api_key import APIKeyIdentifier
|
|
28
|
+
from ..types.api_key import CompositeIdentifierType, IdentifierValueType
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class CreateParameter(
|
|
32
|
+
IntOrganizationId[OptInt],
|
|
33
|
+
IntUserId[int],
|
|
34
|
+
):
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class ReadMultipleParameter(
|
|
39
|
+
ReadPaginatedMultipleParameter,
|
|
40
|
+
IntOrganizationIds[OptListOfInts],
|
|
41
|
+
IntUserIds[OptListOfInts],
|
|
42
|
+
UUIDs[OptListOfUUIDs],
|
|
43
|
+
Ids[OptListOfInts],
|
|
44
|
+
):
|
|
45
|
+
ids: Annotated[OptListOfInts, Field(None, description="Ids")] = None
|
|
46
|
+
uuids: Annotated[OptListOfUUIDs, Field(None, description="UUIDs")] = None
|
|
47
|
+
user_ids: Annotated[OptListOfInts, Field(None, description="User's IDs")] = None
|
|
48
|
+
organization_ids: Annotated[
|
|
49
|
+
OptListOfInts, Field(None, description="Organization's IDs")
|
|
50
|
+
] = None
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def _query_param_fields(self) -> set[str]:
|
|
54
|
+
return {
|
|
55
|
+
"ids",
|
|
56
|
+
"uuids",
|
|
57
|
+
"statuses",
|
|
58
|
+
"user_ids",
|
|
59
|
+
"organization_ids",
|
|
60
|
+
"search",
|
|
61
|
+
"page",
|
|
62
|
+
"limit",
|
|
63
|
+
"use_cache",
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
def to_query_params(self) -> StrToAnyDict:
|
|
67
|
+
params = self.model_dump(
|
|
68
|
+
mode="json", include=self._query_param_fields, exclude_none=True
|
|
69
|
+
)
|
|
70
|
+
params["filters"] = convert_filter(self.date_filters)
|
|
71
|
+
params["sorts"] = convert_sort(self.sort_columns)
|
|
72
|
+
params = {k: v for k, v in params.items()}
|
|
73
|
+
return params
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class ReadSingleParameter(BaseReadSingleParameter[APIKeyIdentifier]):
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_identifier(
|
|
79
|
+
cls,
|
|
80
|
+
identifier: APIKeyIdentifier,
|
|
81
|
+
statuses: ListOfDataStatuses = FULL_DATA_STATUSES,
|
|
82
|
+
use_cache: bool = True,
|
|
83
|
+
) -> "ReadSingleParameter":
|
|
84
|
+
return cls(identifier=identifier, statuses=statuses, use_cache=use_cache)
|
|
85
|
+
|
|
86
|
+
@overload
|
|
87
|
+
@classmethod
|
|
88
|
+
def new(
|
|
89
|
+
cls,
|
|
90
|
+
identifier_type: Literal[IdentifierType.ID],
|
|
91
|
+
identifier_value: int,
|
|
92
|
+
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
93
|
+
use_cache: bool = True,
|
|
94
|
+
) -> "ReadSingleParameter": ...
|
|
95
|
+
@overload
|
|
96
|
+
@classmethod
|
|
97
|
+
def new(
|
|
98
|
+
cls,
|
|
99
|
+
identifier_type: Literal[IdentifierType.UUID],
|
|
100
|
+
identifier_value: UUID,
|
|
101
|
+
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
102
|
+
use_cache: bool = True,
|
|
103
|
+
) -> "ReadSingleParameter": ...
|
|
104
|
+
@overload
|
|
105
|
+
@classmethod
|
|
106
|
+
def new(
|
|
107
|
+
cls,
|
|
108
|
+
identifier_type: Literal[IdentifierType.COMPOSITE],
|
|
109
|
+
identifier_value: CompositeIdentifierType,
|
|
110
|
+
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
111
|
+
use_cache: bool = True,
|
|
112
|
+
) -> "ReadSingleParameter": ...
|
|
113
|
+
@overload
|
|
114
|
+
@classmethod
|
|
115
|
+
def new(
|
|
116
|
+
cls,
|
|
117
|
+
identifier_type: IdentifierType,
|
|
118
|
+
identifier_value: IdentifierValueType,
|
|
119
|
+
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
120
|
+
use_cache: bool = True,
|
|
121
|
+
) -> "ReadSingleParameter": ...
|
|
122
|
+
@classmethod
|
|
123
|
+
def new(
|
|
124
|
+
cls,
|
|
125
|
+
identifier_type: IdentifierType,
|
|
126
|
+
identifier_value: IdentifierValueType,
|
|
127
|
+
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
128
|
+
use_cache: bool = True,
|
|
129
|
+
) -> "ReadSingleParameter":
|
|
130
|
+
return cls(
|
|
131
|
+
identifier=APIKeyIdentifier(type=identifier_type, value=identifier_value),
|
|
132
|
+
statuses=statuses,
|
|
133
|
+
use_cache=use_cache,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
def to_query_params(self) -> StrToAnyDict:
|
|
137
|
+
return self.model_dump(
|
|
138
|
+
mode="json", include={"statuses", "use_cache"}, exclude_none=True
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class DeleteSingleParameter(BaseDeleteSingleParameter[APIKeyIdentifier]):
|
|
143
|
+
@overload
|
|
144
|
+
@classmethod
|
|
145
|
+
def new(
|
|
146
|
+
cls, identifier_type: Literal[IdentifierType.ID], identifier_value: int
|
|
147
|
+
) -> "DeleteSingleParameter": ...
|
|
148
|
+
@overload
|
|
149
|
+
@classmethod
|
|
150
|
+
def new(
|
|
151
|
+
cls, identifier_type: Literal[IdentifierType.UUID], identifier_value: UUID
|
|
152
|
+
) -> "DeleteSingleParameter": ...
|
|
153
|
+
@overload
|
|
154
|
+
@classmethod
|
|
155
|
+
def new(
|
|
156
|
+
cls,
|
|
157
|
+
identifier_type: Literal[IdentifierType.COMPOSITE],
|
|
158
|
+
identifier_value: CompositeIdentifierType,
|
|
159
|
+
) -> "DeleteSingleParameter": ...
|
|
160
|
+
@overload
|
|
161
|
+
@classmethod
|
|
162
|
+
def new(
|
|
163
|
+
cls, identifier_type: IdentifierType, identifier_value: IdentifierValueType
|
|
164
|
+
) -> "DeleteSingleParameter": ...
|
|
165
|
+
@classmethod
|
|
166
|
+
def new(
|
|
167
|
+
cls, identifier_type: IdentifierType, identifier_value: IdentifierValueType
|
|
168
|
+
) -> "DeleteSingleParameter":
|
|
169
|
+
return cls(
|
|
170
|
+
identifier=APIKeyIdentifier(type=identifier_type, value=identifier_value)
|
|
171
|
+
)
|