Get Folders

Get the Metadata of a Specific Folder

You can obtain the details of a specific folder in the File Store, by passing its unique Folder ID as an argument to the getFolder() method, as shown in the code syntax below. This fetches the folder object using which you can retrieve the folder’s metadata such as the details of its creation, last modification, and the meta details of the files in it.

The <FILE_STORE_INSTANCE> used in the code below is the instance defined in the File Store Instance page.

    
copy
Future<(APIResponse, ZCatalystFolder)> <FILE_STORE_INSTANCE>.getFolder(int id)

Parameters:

  • id: The unique Folder ID of the folder to be retrieved

A sample code snippet with the File Store instance is shown below:

    
copy
try{ var (response, folder) = await ZCatalystApp.getInstance().getFileStoreInstance().getFolder(2823000000006561); print('Get Folder Success.'); print('Folder name : ${folder.name}'); } on ZCatalystException catch (ex) { print("Failed to fetch folder: $ex") }

Get the Metadata of all Folders

You can retrieve the details of all the folders available in your project’s File Store using the getFolders() method, as shown in the code syntax below. This can fetch the meta data of all the folders, and the files in them.

The <FILE_STORE_INSTANCE> used in the code below is the instance defined in the File Store Instance page.

    
copy
Future<(APIResponse, List<ZCatalystFolder>)> <FILE_STORE_INSTANCE>.getFolders()

A sample code snippet is shown below:

    
copy
try{ var (response, folders) = await ZCatalystApp.getInstance().getFileStoreInstance().getFolders(); print('Get all Folders Success.'); for (var folder in folders) { print(folder.name); } } on ZCatalystException catch (ex) { print("Failed to fetch all folders $ex"); }

Last Updated 2024-09-12 18:16:13 +0530 +0530