tag
The eagle.tag API allows easy access to the tags in the current application.
// Get all tags
const tags = await eagle.tag.get();
// Filter tags by name
const designTags = await eagle.tag.get({ name: "design" });
// Get recently used tags
const recents = await eagle.tag.getRecents();
Methods
get(options)
Retrieves tags with optional filtering.
options
Object (optional) - Query conditionsname
string (optional) - Filter tags by name with fuzzy search, case-insensitive
Returns
Promise<tags: Object[]>
- the query result for tags.
// Get all tags
const tags = await eagle.tag.get();
// Filter tags by name
const filteredTags = await eagle.tag.get({
name: "design"
});
getRecents()
Retrieves the most recently used tags.
Returns
Promise<tags: Object[]>
- the query result for tags.
const recents = (await eagle.tag.getRecents());
Class: Tag
Object type returned by Eagle API get
, providing modification and save functionality.
🦄 Best Practice: To ensure data security, use the save()
method provided by the Tag instance to modify data. Avoid directly modifying tag data in the Eagle resource library.
Instance Methods
save()
Save tag modifications. Currently only supports modifying tag names.
Returns
Promise<result: boolean>
-result
whether the modification was successful
// Get all tags
const tags = await eagle.tag.get();
// Find the tag to modify
const tag = tags.find(t => t.name === 'old-name');
// Modify tag name
tag.name = 'new-name';
// Save changes
await tag.save();
Warning: After modifying a tag name, all files using that tag will automatically be updated with the new tag name.
Instance Properties
name
string
name
stringTag name. This property can be modified and saved through the save()
method.
count
number
count
numberRead-only, number of files using this tag.
color
string
color
stringTag color.
groups
string[]
groups
string[]Read-only, groups the tag belongs to.
pinyin
string
pinyin
stringRead-only, pinyin of tag name (for search and sorting).
Last updated