smartFolder

The eagle.smartFolder API lets you create, query, modify, and delete smart folders.

triangle-exclamation
// Create a smart folder using the fluent builder
const sf = await eagle.smartFolder.create({
    name: 'Large PNGs',
    conditions: [
        eagle.smartFolder.Condition.create('AND', [
            eagle.smartFolder.rule('width')['>']([1920]),
            eagle.smartFolder.rule('type').equal('png'),
        ])
    ]
});

// Modify properties
sf.name = 'Extra Large PNGs';
sf.iconColor = 'blue';

// Save changes
await sf.save();
circle-check

Methods

create(options)

Create a smart folder

  • options Object

    • name string - Smart folder name

    • conditions Object[] - Filter conditions

    • description string (optional) - Description

    • iconColor string (optional) - Icon color

    • parent string (optional) - Parent smart folder ID

  • Returns Promise<smartFolder: SmartFolder> - The newly created smart folder


get(options)

Get smart folders matching the specified criteria.

  • options Object - Query criteria

    • id string (optional) - Smart folder ID

    • ids string[] (optional) - Array of smart folder IDs

  • Returns Promise<smartFolders: SmartFolder[]> - Query results


getAll()

Get all smart folders.

  • Returns Promise<smartFolders: SmartFolder[]> - Query results


getById(smartFolderId)

Get the smart folder with the specified smartFolderId.

  • smartFolderId string - Smart folder ID

  • Returns Promise<smartFolder: SmartFolder> - Query result


getByIds(smartFolderIds)

Get smart folders matching the specified smartFolderIds.

  • smartFolderIds string[] - Array of smart folder IDs

  • Returns Promise<smartFolders: SmartFolder[]> - Query results


remove(smartFolderId)

Delete the specified smart folder.

  • smartFolderId string - Smart folder ID

  • Returns Promise<result: boolean>


getRules()

Get the available filter rule schema. Returns supported methods, valueType, options, and more for each property.

  • Returns Promise<rules: Object> - Rule schema object

circle-info

Tip: Call getRules() first to get available properties and methods, then use the rule() builder to construct conditions safely.


rule(property)

Fluent builder for constructing a single filter rule. Returns an object with all available methods; calling a method produces the corresponding Rule object.

  • property string - Filter property (e.g., name, width, type)

  • Returns Object - Builder object with all available methods


Class: SmartFolder

The object type returned by SmartFolder API get methods, providing modify and save capabilities.

circle-check

Instance Methods

save()

Save all modifications

  • Returns Promise<smartFolder: SmartFolder> - The updated smart folder


getItems(options)

Get items matching this smart folder's filter conditions.

  • options Object (optional)

    • orderBy string (optional) - Sort field

    • fields string[] (optional) - Fields to return

  • Returns Promise<items: Object[]> - Array of matching items


Instance Properties

A SmartFolder instance contains the following properties:

id string

Read-only. Smart folder ID.

name string

Smart folder name.

conditions Object[]

Filter conditions array.

description string

Smart folder description.

icon string

Read-only. Smart folder icon.

iconColor string

Smart folder icon color.

modificationTime integer

Read-only. Last modification timestamp.

children SmartFolder[]

Read-only. Array of child smart folders.

parent string

Read-only. Parent smart folder ID.

imageCount integer

Read-only. Number of items matching the conditions.


Helper Classes

SmartFolder.Rule

Rule object describing a single filter rule.

SmartFolder.Condition

Condition group object containing multiple rules and logic operators.

Condition.create(match, rules, boolean)

  • match string - 'AND' or 'OR'

  • rules Object[] - Array of rules

  • boolean string (optional) - 'TRUE' (include, default) or 'FALSE' (exclude)


Static Properties

IconColor Object

Provides predefined icon color constants for setting the iconColor property.

circle-check

Last updated