MNFTransactionPage

Objective-C

@interface MNFTransactionPage : MNFObject

Swift

class MNFTransactionPage : MNFObject

The MNFTransactionPage class encapsulated transaction page json data form the server in an object.

A transaction page should no be directly initialized but instead should be constructed with data from the server. The response from the server will be automatically converted to an MNFTransactionPage object.

Immutable properties

  • @abstract current page

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSNumber *_Nullable pageNumber;

    Swift

    var pageNumber: NSNumber? { get }
  • @abstract Total number of pages

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSNumber *_Nullable numberOfPages;

    Swift

    var numberOfPages: NSNumber? { get }
  • @abstract Transactions on current page

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSArray<MNFTransaction *> *_Nullable transactions;

    Swift

    var transactions: [MNFTransaction]? { get }
  • @abstract Total count of transactions

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSNumber *_Nullable numberOfTransactions;

    Swift

    var numberOfTransactions: NSNumber? { get }
  • @abstract Total sum of the “amount” key for all transactions

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSNumber *_Nullable sumOfTransactions;

    Swift

    var sumOfTransactions: NSNumber? { get }
  • @abstract number of transactions per page

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSNumber *_Nullable transactionsPerPage;

    Swift

    var transactionsPerPage: NSNumber? { get }

Fetching

  • @abstract Fetching a transaction page using a filter.

    Declaration

    Objective-C

    + (nonnull MNFJob *)
        fetchWithTransactionFilter:(nonnull MNFTransactionFilter *)filter
                              page:(nullable NSNumber *)page
               transactionsPerPage:(nullable NSNumber *)transactionsPerPage
                        completion:(nullable MNFTransactionPageCompletionHandler)
                                       completion;

    Swift

    class func fetch(with filter: MNFTransactionFilter, page: NSNumber?, transactionsPerPage: NSNumber?, completion: MNFTransactionPageCompletionHandler? = nil) -> MNFJob

    Parameters

    filter

    a transaction filter

    page

    The page to fetch. Defaults to zero

    transactionsPerPage

    The number of transactions on each page. Defaults to 25

    completion

    A completion block returning a transaction page and an error.

    Return Value

    an MNFJob containing a transaction page or an error.

Next page

  • @abstract Appends the next page of transactions to the current transaction list. Updates pageNumber.

    Declaration

    Objective-C

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

    Swift

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

    Parameters

    completion

    A completion block returning an error.

    Return Value

    An MNFJob containing either a @YES result or an error.

  • @abstract Replaces the transaction list with the next page of transactions. Updates pageNumber.

    Declaration

    Objective-C

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

    Swift

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

    Parameters

    completion

    A completion block returning an error.

    Return Value

    An MNFJob containing either a @YES result or an error.

Refreshing

  • Deprecated

    Please use -refreshTransactionList instead

    @abstract Refreshes and reorders the transaction list. Reccommended to use after a significant transaction update

    Declaration

    Objective-C

    - (BOOL)refreshTransactionListWithError:(NSError *_Nullable *_Nullable)error;

    Swift

    func refreshTransactionListWithError() throws

    Parameters

    error

    An error that may occur when refreshing a transaction page.

  • @abstract Refreshes and reorders the transaction list. Reccommended to use after a significant transaction update

    Declaration

    Objective-C

    - (void)refreshTransactionList;

    Swift

    func refreshTransactionList()
  • @abstract Refreshes the transaction list 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

    MNFJob A job containing an error.

Grouping

  • @abstract Groups all transactions by date into transaction groups which is cached and can be accessed by using transactionsGroupedByDate method.

    Declaration

    Objective-C

    - (void)groupByDate;

    Swift

    func groupByDate()
  • @abstract The transaction groups for all the transactions grouped by date. Make sure you have called the group by date method after any additional fetches on the transaction page.

    Declaration

    Objective-C

    - (nonnull NSArray<MNFTransactionGroup *> *)transactionsGroupedByDate;

    Swift

    func transactionsGroupedByDate() -> [MNFTransactionGroup]
  • @abstract Groups all transactions by categoryId into transaction groups.

    Declaration

    Objective-C

    - (void)groupByCategory;

    Swift

    func groupByCategory()
  • @abstract The transactions for all the transactions grouped by category. Make sure you have called the group by category method after any additional fetches on the transaction page.

    Declaration

    Objective-C

    - (nullable NSArray<MNFTransactionGroup *> *)transactionsGroupedByCategory;

    Swift

    func transactionsGroupedByCategory() -> [MNFTransactionGroup]?