MNFTransactionRule

Objective-C

@interface MNFTransactionRule : MNFObject

Swift

class MNFTransactionRule : MNFObject

The MNFTransactionRule class encapsulates transaction rule json data from the server in an object.

A transaction rule can be initialized directly or fetched from the server. When creating a new transaction rule populate properties accordingly before calling save. This will create the rule on the server and assign it a userId and the requisite dates. Use the applyOnExisting property to indicate whether this rule should apply to existing transactions.

Immutable properties

  • @abstract The user identifier for the transaction rule.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSNumber *_Nonnull userId;

    Swift

    var userId: NSNumber { get }
  • @abstract The date the transaction rule was created.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSDate *_Nonnull createdDate;

    Swift

    var createdDate: Date { get }
  • @abstract The date the transaction rule was last modified.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSDate *_Nonnull modifiedDate;

    Swift

    var modifiedDate: Date { get }

Mutable properties

  • @abstract The name of the transaction rule.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nullable name;

    Swift

    var name: String? { get set }
  • @abstract A text criteria to match by this rule, or null if this rule has no text criteria.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nullable textCriteria;

    Swift

    var textCriteria: String? { get set }
  • @abstract The type of operater to use when evaluating text criteria.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSNumber *_Nullable textCriteriaOperatorType;

    Swift

    var textCriteriaOperatorType: NSNumber? { get set }
  • @abstract A date match criteria for the rule. (0 = first, 1 = last).

    Declaration

    Objective-C

    @property (nonatomic, strong) NSNumber *_Nullable dateMatchTypeCriteria;

    Swift

    var dateMatchTypeCriteria: NSNumber? { get set }
  • @abstract The number of days to use when using dateMatchTypeCriteria for the rule.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSNumber *_Nullable daysLimitCriteria;

    Swift

    var daysLimitCriteria: NSNumber? { get set }
  • @abstract Amount criteria for the rule. (0 = amount under, 1 = amount over, 2 = amount equals).

    Declaration

    Objective-C

    @property (nonatomic, strong) NSNumber *_Nullable amountLimitTypeCriteria;

    Swift

    var amountLimitTypeCriteria: NSNumber? { get set }
  • @abstract Amount limit sign criteria for the rule. (0 = income or expense, 1 = expense, 2 = income).

    Declaration

    Objective-C

    @property (nonatomic, strong) NSNumber *_Nullable amountLimitSignCriteria;

    Swift

    var amountLimitSignCriteria: NSNumber? { get set }
  • @abstract Amount criteria for the rule.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSNumber *_Nullable amountCriteria;

    Swift

    var amountCriteria: NSNumber? { get set }
  • @abstract A comma seperated list of account category integers that should be matched before applying actions. (1 = Current, 2 = Credit, 3 = Savings).

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nullable accountCategoryCriteria;

    Swift

    var accountCategoryCriteria: String? { get set }
  • @abstract Accept action for the rule.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSNumber *_Nullable acceptAction;

    Swift

    var acceptAction: NSNumber? { get set }
  • @abstract Month shift action for the rule.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSNumber *_Nullable monthShiftAction;

    Swift

    var monthShiftAction: NSNumber? { get set }
  • @abstract Remove action for the rule.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSNumber *_Nullable removeAction;

    Swift

    var removeAction: NSNumber? { get set }
  • @abstract Text action for the rule.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nullable textAction;

    Swift

    var textAction: String? { get set }
  • @abstract Comment action for the rule.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nullable commentAction;

    Swift

    var commentAction: String? { get set }
  • @abstract Tag action for the rule.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nullable tagAction;

    Swift

    var tagAction: String? { get set }
  • @abstract Categorization to apply by this rule.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSNumber *_Nullable categoryIdAction;

    Swift

    var categoryIdAction: NSNumber? { get set }
  • @abstract Split actions to perform by this rule.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSArray<MNFTransactionSplitAction *> *_Nullable splitActions;

    Swift

    var splitActions: [MNFTransactionSplitAction]? { get set }
  • @abstract Whether to flag transactions mathicng this rule.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSNumber *_Nullable flagAction;

    Swift

    var flagAction: NSNumber? { get set }
  • @abstract Fetches a transaction rule with a given identifier.

    Declaration

    Objective-C

    + (nonnull MNFJob *)
        fetchRuleWithId:(nonnull NSNumber *)identifier
             completion:(nonnull MNFTransactionRuleCompletionHandler)completion;

    Swift

    class func fetch(withId identifier: NSNumber, completion: @escaping MNFTransactionRuleCompletionHandler) -> MNFJob

    Parameters

    identifier

    The identefier of the rule to be fetched.

    completion

    A completion block returning a transaction rule and an error.

    Return Value

    An MNFJob containing a transaction rule and an error.

  • @abstract Fetches a list of transaction rules.

    Declaration

    Objective-C

    + (nonnull MNFJob *)fetchRulesWithCompletion:
        (nonnull MNFMultipleTransactionRulesCompleitonHandler)completion;

    Swift

    class func fetchRules(completion: @escaping MNFMultipleTransactionRulesCompleitonHandler) -> MNFJob

    Parameters

    completion

    A completion block returning a list of transaction rules and an error.

    Return Value

    An MNFJob containing a list of transaction rules and an error.

  • @abstract Creates a transaction rule.

    Declaration

    Objective-C

    + (nonnull MNFJob *)
              createRuleWithName:(nullable NSString *)theRuleName
                    textCriteria:(nullable NSString *)textCriteria
        textCriteriaOperatorType:(nullable NSNumber *)operatorType
           dateMatchTypeCriteria:(nullable NSNumber *)dateMatchTypeCriteria
               daysLimitCriteria:(nullable NSNumber *)daysLimitCriteria
         amountLimitTypeCriteria:(nullable NSNumber *)amountLimitTypeCriteria
         amountLimitSignCriteria:(nullable NSNumber *)amountLimitSignCriteria
                  amountCriteria:(nullable NSNumber *)amountCritera
         accountCategoryCriteria:(nullable NSString *)accountCategoryCriteria
                    acceptAction:(nullable NSNumber *)acceptAction
                monthShiftAction:(nullable NSNumber *)monthShiftAction
                    removeAction:(nullable NSNumber *)removeAction
                      textAction:(nullable NSString *)textAction
                   commentAction:(nullable NSString *)commentAction
                categoryIdAction:(nullable NSNumber *)categoryIdAction
                    splitActions:(nullable NSArray *)splitActions
                      flagAction:(nullable NSNumber *)flagAction
                 applyOnExisting:(nonnull NSNumber *)applyOnExisting
                      completion:
                          (nonnull MNFTransactionRuleCompletionHandler)completion;

    Swift

    class func createRule(withName theRuleName: String?, textCriteria: String?, textCriteriaOperatorType operatorType: NSNumber?, dateMatchTypeCriteria: NSNumber?, daysLimitCriteria: NSNumber?, amountLimitTypeCriteria: NSNumber?, amountLimitSignCriteria: NSNumber?, amountCriteria amountCritera: NSNumber?, accountCategoryCriteria: String?, acceptAction: NSNumber?, monthShiftAction: NSNumber?, removeAction: NSNumber?, textAction: String?, commentAction: String?, categoryIdAction: NSNumber?, splitActions: [Any]?, flagAction: NSNumber?, applyOnExisting: NSNumber, completion: @escaping MNFTransactionRuleCompletionHandler) -> MNFJob

    Return Value

    An MNFJob containing a transaction rule and an error

  • @abstract Deletes a rule from the server.

    Warning

    Remember to deallocate objects that have been deleted from the server.

    Declaration

    Objective-C

    - (nonnull MNFJob *)deleteRuleWithCompletion:
        (nullable MNFErrorOnlyCompletionHandler)completion;

    Swift

    func delete(completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob

    Parameters

    completion

    A completino block returning an error.

    Return Value

    An MNFJob containing an error.

  • @abstract Saves a transaction rule to the server.

    @discussion Used to save changes made to a rule.

    Declaration

    Objective-C

    - (nonnull MNFJob *)
        saveAndApplyOnExisting:(nonnull NSNumber *)applyOnExisting
                    completion:(nullable MNFErrorOnlyCompletionHandler)completion;

    Swift

    func saveAndApply(onExisting applyOnExisting: NSNumber, completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob

    Parameters

    completion

    A completion block returning an error.

    Return Value

    An MNFJob containing an error.

  • @abstract Refreshes a rule with data from the server.

    Declaration

    Objective-C

    - (nonnull MNFJob *)refreshWithCompletion:
        (nullable MNFErrorOnlyCompletionHandler)completion;

    Swift

    func refresh(completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob

    Parameters

    completion

    A completion block returning an error.

    Return Value

    An MNFJob containing an error.