66from typing import Dict
77from typing import List
88from typing import Literal
9+ from typing import Optional
910
1011from lib .core import entities
1112from lib .core .conditions import Condition
13+ from lib .core .enums import CustomFieldEntityEnum
1214from lib .core .jsx_conditions import Query
1315from lib .core .reporter import Reporter
1416from lib .core .service_types import AnnotationClassListResponse
2527from lib .core .service_types import UploadAnnotationsResponse
2628from lib .core .service_types import UserLimitsResponse
2729from lib .core .service_types import UserResponse
30+ from lib .core .service_types import WMCustomFieldResponse
2831from lib .core .service_types import WMProjectListResponse
32+ from lib .core .service_types import WMUserListResponse
2933from lib .core .service_types import WorkflowListResponse
3034from lib .core .types import Attachment
3135from lib .core .types import AttachmentMeta
@@ -103,15 +107,17 @@ def list_workflow_roles(self, project_id: int, workflow_id: int):
103107 raise NotImplementedError
104108
105109 @abstractmethod
106- def list_project_custom_field_templates (self ):
110+ def list_custom_field_templates (
111+ self ,
112+ entity : CustomFieldEntityEnum ,
113+ parent_entity : CustomFieldEntityEnum ,
114+ context : dict = None ,
115+ ):
107116 raise NotImplementedError
108117
109118 def create_project_custom_field_template (self , data : dict ):
110119 raise NotImplementedError
111120
112- def delete_project_custom_field_template (self , pk : int ):
113- raise NotImplementedError
114-
115121 @abstractmethod
116122 def list_project_custom_entities (self , project_id : int ):
117123 raise NotImplementedError
@@ -136,6 +142,47 @@ def create_project_categories(
136142 ) -> ServiceResponse :
137143 raise NotImplementedError
138144
145+ @abstractmethod
146+ def list_users (
147+ self , body_query : Query , chunk_size = 100 , include_custom_fields = False
148+ ) -> WMUserListResponse :
149+ raise NotImplementedError
150+
151+ @abstractmethod
152+ def create_custom_field_template (
153+ self ,
154+ name : str ,
155+ component_id : int ,
156+ entity : CustomFieldEntityEnum ,
157+ parent_entity : CustomFieldEntityEnum ,
158+ component_payload : Optional [dict ] = None ,
159+ access : Optional [dict ] = None ,
160+ entity_context : Optional [dict ] = None ,
161+ ) -> WMCustomFieldResponse :
162+ raise NotImplementedError
163+
164+ @abstractmethod
165+ def delete_custom_field_template (
166+ self ,
167+ pk : int ,
168+ entity : CustomFieldEntityEnum ,
169+ parent_entity : CustomFieldEntityEnum ,
170+ entity_context : Optional [dict ] = None ,
171+ ):
172+ raise NotImplementedError
173+
174+ @abstractmethod
175+ def set_custom_field_value (
176+ self ,
177+ entity_id : int ,
178+ template_id : int ,
179+ data : dict ,
180+ entity : CustomFieldEntityEnum ,
181+ parent_entity : CustomFieldEntityEnum ,
182+ context : Optional [dict ] = None ,
183+ ):
184+ raise NotImplementedError
185+
139186
140187class BaseProjectService (SuperannotateServiceProvider ):
141188 @abstractmethod
@@ -738,17 +785,23 @@ def invite_contributors(
738785 raise NotImplementedError
739786
740787 @abstractmethod
741- def list_project_custom_field_names (self ) -> List [str ]:
788+ def list_custom_field_names (self , entity : CustomFieldEntityEnum ) -> List [str ]:
742789 raise NotImplementedError
743790
744791 @abstractmethod
745- def get_project_custom_field_id (self , field_name : str ) -> int :
792+ def get_custom_field_id (
793+ self , field_name : str , entity : CustomFieldEntityEnum
794+ ) -> int :
746795 raise NotImplementedError
747796
748797 @abstractmethod
749- def get_project_custom_field_name (self , field_id : int ) -> str :
798+ def get_custom_field_name (
799+ self , field_id : int , entity : CustomFieldEntityEnum
800+ ) -> str :
750801 raise NotImplementedError
751802
752803 @abstractmethod
753- def get_project_custom_field_component_id (self , field_id : int ) -> str :
804+ def get_custom_field_component_id (
805+ self , field_id : int , entity : CustomFieldEntityEnum
806+ ) -> str :
754807 raise NotImplementedError
0 commit comments