folder
The eagle.folder API allows you to easily create new folders or access existing ones in the current application.
🦄 Best Practice: To ensure data safety, please use the save()
method provided by the API for data access and modification. Avoid directly modifying the metadata.json
or any files under the Eagle resource library.
Methods
create(options)
Create a folder.
options
Objectname
string - Folder namedescription
string (optional) - Folder descriptionparent
string (optional) - Parent folder ID; with this parameter, it is equivalent tocreateSubfolder(parentId, options)
Returns
Promise<folder: Folder>
- Successfully createdfolder
createSubfolder(parentId, options)
Create a subfolder.
parentId
string - Parent folder IDoptions
Objectname
string - Folder namedescription
string (optional) - Folder description
Returns
Promise<folder: Folder>
- Successfully createdfolder
get(options)
Get folders with specified conditions.
options
Object - Query conditionsid
string (optional) - Folder idids
string[] (optional) - Array of folder idsisSelected
boolean (optional) - Currently selected foldersisRecent
boolean (optional) - Recently accessed folders
Returns
Promise<folders: Folder[]>
- Query resultfolders
getAll()
Get all folders.
Returns
Promise<folders: Folder[]>
- Query resultfolders
getById(folderId)
Get the folder corresponding to folderId
.
folderId
string - Folder idReturns
Promise<folder: Folder>
- Query resultfolder
getByIds(folderIds)
Get an array of folders corresponding to folderIds
.
folderIds
string[] - Array of folder idsReturns
Promise<folders: Folder[]>
- Query resultfolders
getSelected()
Get the currently selected folders in the application.
Returns
Promise<folders: Folder[]>
-folders
getRecents()
Get the recently used folders.
Returns
Promise<folders: Folder[]>
-folders
open(folderId)
Eagle will open the folder corresponding to folderId
.
Returns
Promise<void>
Tip: You can also directly call the folder instance's open()
method to open the folder.
Class: Folder
An Object type returned by the Folder API get
, provides modification and save functions.
🦄 Best Practice: To ensure data security, please use the save()
method provided by the Folder instance for data access and modification, and avoid directly modifying the metadata.json
or any files under the Eagle repository.
Instance Methods
save()
Save all modifications.
Returns
Promise<void>
open()
Eagle will open this folder.
Returns
Promise<void>
Tip: You can also directly call eagle.folder.open(folderId)
method to open the folder.
Instance Properties
The Folder
instance includes the following properties:
id
string
id
stringRead-only, folder id.
name
string
name
stringFolder name.
description
string
description
stringFolder description/introduction.
icon
string
icon
stringRead-only, folder icon.
iconColor
string
iconColor
stringRead-only, folder icon color.
createdAt
Integer
createdAt
IntegerRead-only, folder creation time (timestamp).
children
Folder[]
children
Folder[]Read-only, an array of child folders.
Last updated