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( id : Int64, completion : @escaping ( Result< ZCatalystFolder, ZCatalystError > ) -> Void )

Parameters:

  • id: The unique Folder ID of the folder to be retrieved
  • completion: If the operation is successful, the completion block will return the folder details. Else, it will return an error.

A sample code snippet is shown below:

    
copy
ZCatalystApp.shared.getFileStoreInstance().getFolder(id : 3376000000427654) {(result) in //Replace this with your Folder ID switch result { case .success ( let folder) : print("The names of the folder are " + folder.name) case .error( let error ) : print( "Error occurred >>> \( error )" ) } }

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( completion : @escaping ( Result< [ ZCatalystFolder ], ZCatalystError > ) -> Void )

Parameters:

  • completion: If the operation is successful, the completion block will return the details of all the folders. Else, it will return an error.

A sample code snippet is shown below:

    
copy
ZCatalystApp.shared.getFileStoreInstance().getFolders() {(result) in switch result{ case .success ( let folders) : for folder in folders { print("The names of the folder are " + folder.name) } case .error( let error ) : print( "Error occurred >>> \( error )" ) } }

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