File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -2903,7 +2903,7 @@ def list_items(
29032903 project : Union [NotEmptyStr , int ],
29042904 folder : Optional [Union [NotEmptyStr , int ]] = None ,
29052905 * ,
2906- include : List [Literal ["custom_metadata" , "category " ]] = None ,
2906+ include : List [Literal ["custom_metadata" , "categories " ]] = None ,
29072907 ** filters ,
29082908 ):
29092909 """
@@ -3014,6 +3014,14 @@ def list_items(
30143014 if isinstance (project , int )
30153015 else self .controller .get_project (project )
30163016 )
3017+ if (
3018+ include
3019+ and "categories" in include
3020+ and project .type != ProjectType .MULTIMODAL .value
3021+ ):
3022+ raise AppException (
3023+ "The 'categories' option in the 'include' field is only supported for Multimodal projects."
3024+ )
30173025 if folder is None :
30183026 folder = self .controller .get_folder (project , "root" )
30193027 else :
Original file line number Diff line number Diff line change @@ -16,6 +16,13 @@ class Config:
1616 extra = Extra .ignore
1717
1818
19+ class MultiModalItemEntity (BaseItemEntity ):
20+ categories : Optional [list ]
21+
22+ class Config :
23+ extra = Extra .ignore
24+
25+
1926class VideoEntity (BaseItemEntity ):
2027 approval_status : Optional [ApprovalStatus ] = Field (None )
2128
@@ -51,4 +58,5 @@ class Config:
5158 ProjectType .TILED : ImageEntity ,
5259 ProjectType .VIDEO : VideoEntity ,
5360 ProjectType .DOCUMENT : DocumentEntity ,
61+ ProjectType .MULTIMODAL : MultiModalItemEntity ,
5462}
Original file line number Diff line number Diff line change 1717from lib .core .entities import ImageEntity
1818from lib .core .entities import ProjectEntity
1919from lib .core .entities import VideoEntity
20+ from lib .core .entities .items import MultiModalItemEntity
2021from lib .core .exceptions import AppException
2122from lib .core .exceptions import AppValidationException
2223from lib .core .exceptions import BackendError
@@ -60,6 +61,8 @@ def serialize_item_entity(
6061 return VideoEntity (** entity .dict (by_alias = True ))
6162 elif project .type == constants .ProjectType .DOCUMENT .value :
6263 return DocumentEntity (** entity .dict (by_alias = True ))
64+ elif project .type == constants .ProjectType .MULTIMODAL .value :
65+ return MultiModalItemEntity (** entity .dict (by_alias = True ))
6366 return entity
6467
6568
You can’t perform that action at this time.
0 commit comments