@@ -3910,58 +3910,65 @@ def find_dataset_object(self, dataset_object_id: str) -> dict:
39103910
39113911 def get_dataset_objects (
39123912 self ,
3913- dataset_version_id : str ,
3914- keyword : str = None ,
3915- offset : int = None ,
3916- limit : int = 100 ,
3913+ dataset : str ,
3914+ version : str = None ,
3915+ tags : List [str ] = [],
39173916 ) -> list :
39183917 """
39193918 Returns a list of dataset objects.
39203919
3921- Returns up to 1000 at a time, to get more, set offset as the starting position
3922- to fetch.
3923-
3924- dataset_version_id is dataset object in dataset version (Required).
3925- keyword are search terms in the dataset object name (Optional).
3926- offset is the starting position number to fetch (Optional).
3927- limit is the max number to fetch (Optional).
3920+ dataset is dataset name (Required).
3921+ version is dataset version (Optional).
3922+ tags is a list of tag (Optional).
39283923 """
3929- if limit > 1000 :
3930- raise FastLabelInvalidException (
3931- "Limit must be less than or equal to 1000." , 422
3932- )
39333924 endpoint = "dataset-objects"
3934- params = {"datasetVersionId" : dataset_version_id }
3935- if keyword :
3936- params ["keyword" ] = keyword
3937- if offset :
3938- params ["offset" ] = offset
3939- if limit :
3940- params ["limit" ] = limit
3925+ params = {"dataset" : dataset }
3926+ if version :
3927+ params ["version" ] = version
3928+ if tags :
3929+ params ["tags" ] = tags
39413930 return self .api .get_request (endpoint , params = params )
39423931
39433932 def create_dataset_object (
3944- self , dataset_version_id : str , name : str , file_path : str
3933+ self ,
3934+ dataset : str ,
3935+ name : str ,
3936+ file_path : str ,
3937+ tags : List [str ] = [],
3938+ annotations : List [dict ] = [],
39453939 ) -> dict :
39463940 """
39473941 Create a dataset object.
39483942
3949- dataset_version_id is dataset object in dataset version (Required).
3943+ dataset is dataset name (Required).
39503944 name is a unique identifier of dataset object in your dataset (Required).
39513945 file_path is a path to data. (Required).
3946+ tags is a list of tag (Optional).
3947+ annotations is a list of annotation (Optional).
39523948 """
39533949 endpoint = "dataset-objects"
39543950 if not utils .is_object_supported_size (file_path ):
39553951 raise FastLabelInvalidException (
39563952 "Supported object size is under 250 MB." , 422
39573953 )
39583954 payload = {
3959- "datasetVersionId " : dataset_version_id ,
3955+ "dataset " : dataset ,
39603956 "name" : name ,
3961- "file " : utils .base64_encode (file_path ),
3957+ "filePath " : utils .base64_encode (file_path ),
39623958 }
3959+ if tags :
3960+ payload ["tags" ] = tags
3961+ if annotations :
3962+ payload ["annotations" ] = annotations
39633963 return self .api .post_request (endpoint , payload = payload )
39643964
3965+ def delete_dataset_object (self , dataset_object_id : str ) -> None :
3966+ """
3967+ Delete a dataset object.
3968+ """
3969+ endpoint = "dataset-objects/" + dataset_object_id
3970+ self .api .delete_request (endpoint )
3971+
39653972 def update_aws_s3_storage (
39663973 self , project : str , bucket_name : str , bucket_region : str , prefix : str = None
39673974 ) -> str :
0 commit comments