Class: FilterRule

FilterRule(jmap, name)

new FilterRule(jmap, name)

This class represents a JMAP FilterRule.
The FilterRule object represents the state of incoming message filtering for an account.

Parameters:
Name Type Description
jmap Client

The Client instance that created this FilterRule.

name String

The name of the rule

NOTE: How to use and extend this model ? FilterRule is conceived so that a rule can be specified in a highly didactic way. For instance:

 new jmap.FilterRule(client, 'My filter')
   .when.from
     .value('admin@open-paas.org')
     .comparator(jmap.FilterRule.Comparator.EXACTLY_EQUALS)
   .then.moveTo
     .mailboxId('36e4d1c0-a473-11e8-aa26-bfb5d32a28f6');

To achive this, it uses the builder design pattern. To extend this model with new actions and conditions, you just need to create a new class that extends AbstractConditionAction and implements AbstractConditionAction#_init and AbstractConditionAction#_toJSONObject.

AbstractConditionAction#_init is called by AbstractConditionAction' constructor and AbstractConditionAction#_toJSONObject is used to generate a JSON representation of the object. Then, just provide any useful property.

To make the new condition or action available to the builder, you need to extend FilterRuleCondition (if defining a new condition) or FilterRuleAction (if defining a new action)

Source:
See:
  • Model

Extends

  • Model