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
<FILE_STORE_INSTANCE>.getFolder( int id, void Function(ZCatalystFolder) onSuccess, void Function(ZCatalystException) onFailed )

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
ZCatalystApp.getInstance().getFileStoreInstance().getFolder( 2823000000006561, //Specify the Folder ID using the File Store instance (APIResponse response, ZCatalystFolder folder) { print('Get Folder Success.'); print('Folder name : ${folder.name}'); //Actions to be executed upon success }, (ZCatalystException exception) { print('Get Folder failed: $exception'); //Actions to be executed upon failure }, );

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
<FILE_STORE_INSTANCE>getFolders( void Function(List<ZCatalystFolder>) onSuccess, void Function(ZCatalystException) onFailed )

A sample code snippet is shown below:

    
copy
ZCatalystApp.getInstance().getFileStoreInstance().getFolders( //Define the File Store instance (APIResponse response, List<ZCatalystFolder> folders) { print('Get all Folders Success.'); for (var folder in folders) { print(folder.name); //Actions to be executed upon success } }, (ZCatalystException exception) { print('Get Folders failed: $exception'); //Actions to be executed upon failure }, );

Last Updated 2023-09-03 01:06:41 +0530 +0530