While using the API, it is sometimes frustrating that some places expect a UUID as a UUID instance, others as a str and some accept either.
For example, EncordUserClient.get_storage_folder() accepts folder_uuid: Union[UUID, str] which it handles with:
if isinstance(folder_uuid, str):
folder_uuid = UUID(folder_uuid)
but then StorageFolder.add_data_to_folder_job_cancel() only accepts a UUID in the argument upload_job_id: UUID
then in another method for the same class StorageFolder.add_private_data_to_folder_start() it only accepts a str for the argument integration_id: str, even though it just gets converted to a UUID in the private method StorageFolder._add_data_to_folder_start() so it can be passed to encord.orm.storage.PostUploadJobParams().
I believe the ideal solution would be to accept str | UUID in all public functions/methods.
There is also a related standardization issue of _uuid, _id and _hash being used in different places with no clear difference, but resolving this would likely be a breaking change not suitable for a minor version release.
While using the API, it is sometimes frustrating that some places expect a UUID as a
UUIDinstance, others as astrand some accept either.For example,
EncordUserClient.get_storage_folder()acceptsfolder_uuid: Union[UUID, str]which it handles with:but then
StorageFolder.add_data_to_folder_job_cancel()only accepts aUUIDin the argumentupload_job_id: UUIDthen in another method for the same class
StorageFolder.add_private_data_to_folder_start()it only accepts astrfor the argumentintegration_id: str, even though it just gets converted to aUUIDin the private methodStorageFolder._add_data_to_folder_start()so it can be passed toencord.orm.storage.PostUploadJobParams().I believe the ideal solution would be to accept
str | UUIDin all public functions/methods.There is also a related standardization issue of
_uuid,_idand_hashbeing used in different places with no clear difference, but resolving this would likely be a breaking change not suitable for a minor version release.