MNFSynchronization

Objective-C

@interface MNFSynchronization : MNFObject

Swift

class MNFSynchronization : MNFObject

The MNFSynchronization class encapsulates synchronization data from the server in an object.

A synchronization object should not be directly initialized but rather fetched through the server when performing synchronization.

Immutable properties

  • @abstract The sync history identifier of this synchronization.

    Declaration

    Objective-C

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

    Swift

    var syncHistoryId: NSNumber { get }
  • @abstract Whether the synchronization is completed.

    Declaration

    Objective-C

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

    Swift

    var isSyncDone: NSNumber { get }
  • @abstract The starting date of the synchronization session.

    Declaration

    Objective-C

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

    Swift

    var syncSessionStartTime: Date { get }
  • @abstract Response information from the financial realm being synchronized to.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSArray<MNFRealmSyncResponse *> *_Nonnull realmSyncResponses;

    Swift

    var realmSyncResponses: [MNFRealmSyncResponse] { get }

Sync and wait

  • Starts synchronization of financial data, and waits until synchronization is completed. Returns an error if the synchronization did not complete before the timeout period.

    Note

    All queries and waits are performed on a background thread until the request either times out or synchronization is completed. The completion block fires on the main thread.

    Declaration

    Objective-C

    + (nonnull MNFJob *)
        synchronizeWithTimeout:(nonnull NSNumber *)timeout
                      interval:(nonnull NSNumber *)interval
                    completion:
                        (nonnull MNFSynchronizationCompletionHandler)completion;

    Swift

    class func synchronize(withTimeout timeout: NSNumber, interval: NSNumber, completion: @escaping MNFSynchronizationCompletionHandler) -> MNFJob

    Parameters

    timeout

    The number of milliseconds to wait before cancelling the task in the background.

    interval

    The number of milliseconds to wait between queries of synchronization status.

    completion

    A completion block returning an error.

    Return Value

    An MNFJob containing a result or an error.

  • @abstract Starts the accounts synchronization process for a specific realm with a session token already provided.

    Note

    All queries and waits are performed on a background thread until the request either times out or synchronization is completed. The completion block fires on the main thread.

    Declaration

    Objective-C

    + (nonnull MNFJob *)synchronizeRealmUserWithId:(nonnull NSNumber *)realmUserId
                                      sessionToken:(nullable NSString *)sessionToken
                                           timeout:(nonnull NSNumber *)timeout
                                          interval:(nonnull NSNumber *)interval
                                        completion:
                                            (nullable MNFErrorOnlyCompletionHandler)
                                                completion;

    Swift

    class func synchronizeRealmUser(withId realmUserId: NSNumber, sessionToken: String?, timeout: NSNumber, interval: NSNumber, completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob

    Parameters

    realmUserId

    The id of the realm account user - a realm is a “department” in e.g. a bank. Most organizations (most often banks) have only one but some large organizations can have many realms (e.g. insurance, banking, credit cards and so on). This id identifies the user’s realm user account.

    sessionToken

    A token from a previous (e.g. authentication) operation that should be carried over to the sync process

    timeout

    The number of milliseconds to wait before cancelling the task in the background.

    interval

    The number of milliseconds to wait between queries of synchronization status.

    Return Value

    An MNFJob containing a synchronization object and an error.

Start synchronization

  • @abstract Starts synchronization of financial data and returns a synchronization object with information on the sync session.

    Declaration

    Objective-C

    + (nonnull MNFJob *)
        startSynchronizationWithWaitTime:(nonnull NSNumber *)waitTime
                              completion:
                                  (nullable MNFSynchronizationCompletionHandler)
                                      completion;

    Swift

    class func start(withWaitTime waitTime: NSNumber, completion: MNFSynchronizationCompletionHandler? = nil) -> MNFJob

    Parameters

    waitTime

    The number of milliseconds to wait before cancelling the task in the background.

    completion

    A completion block returning a synchronization object and an error.

    Return Value

    An MNFJob containing a synchronization object and an error.

  • @abstract Starts the accounts synchronization process for a specific realm with a session token already provided.

    Declaration

    Objective-C

    + (nonnull MNFJob *)
        startSynchronizationForRealmUserWithId:(nonnull NSNumber *)realmUserId
                                  sessionToken:(nullable NSString *)sessionToken
                                      waitTime:(nonnull NSNumber *)waitTime
                                    completion:
                                        (nullable
                                             MNFSynchronizationCompletionHandler)
                                            completion;

    Swift

    class func startForRealmUser(withId realmUserId: NSNumber, sessionToken: String?, waitTime: NSNumber, completion: MNFSynchronizationCompletionHandler? = nil) -> MNFJob

    Parameters

    realmUserId

    The id of the realm account user - a realm is a “department” in e.g. a bank. Most organizations (most often banks) have only one but some large organizations can have many realms (e.g. insurance, banking, credit cards and so on). This id identifies the user’s realm user account.

    sessionToken

    A token from a previous (e.g. authentication) operation that should be carried over to the sync process

    waitTime

    The number of milliseconds to wait before cancelling the task in the background.

    Return Value

    An MNFJob containing a synchronization object and an error.

Synchronization status

  • @abstract Get the synchronization status of this synchronization session and updates the object.

    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.

  • @abstract Get the current synchronization status for the user.

    Declaration

    Objective-C

    + (nonnull MNFJob *)fetchCurrentSynchronizationStatusWithCompletion:
        (nullable MNFSynchronizationCompletionHandler)completion;

    Swift

    class func fetchCurrentSynchronizationStatus(completion: MNFSynchronizationCompletionHandler? = nil) -> MNFJob

    Parameters

    completion

    A completion block returning a synchronization object and an error.

    Return Value

    An MNFJob containing a synchronization object and an error.

  • @abstract Find out whether synchronization is needed

    Declaration

    Objective-C

    - (BOOL)isSynchronizationNeeded;

    Swift

    func isSynchronizationNeeded() -> Bool

    Return Value

    A boolean indicating whether synchronization is needed.

Realm authentication

  • Fetch an authentication challenge with a realm id. This will tell you the methods and parameters the bank with the given realm id requires you to fulfill to authenticate a user.

    Declaration

    Objective-C

    + (nonnull MNFJob *)
        fetchRealmAuthenticationChallengeWithRealmId:(nonnull NSNumber *)realmId
                                          completion:
                                              (nullable
                                                   MNFSyncAuthenticationCompletionHandler)
                                                  completion;

    Swift

    class func fetchRealmAuthenticationChallenge(withRealmId realmId: NSNumber, completion: MNFSyncAuthenticationCompletionHandler? = nil) -> MNFJob

    Parameters

    realmId

    The realm id of the organization to authenticate to.

    completion

    A completion block returning an authentication challenge and an error.

    Return Value

    MNFJob A job containing an authentication challenge and an error.

  • Authenticate to an organization with a given realm id with the required parameters.

    Declaration

    Objective-C

    + (nonnull MNFJob *)
        authenticateToRealmWithId:(nonnull NSNumber *)realmId
                   withParameters:(nullable NSArray<NSDictionary *> *)parameters
                     sessionToken:(nullable NSString *)sessionToken
                      saveDetails:(nullable NSNumber *)saveDetails
              realmUserIdentifier:(nullable NSString *)realmUserIdentifier
                       completion:(nullable MNFSyncAuthenticationCompletionHandler)
                                      completion;

    Swift

    class func authenticateToRealm(withId realmId: NSNumber, withParameters parameters: [[AnyHashable : Any]]?, sessionToken: String?, saveDetails: NSNumber?, realmUserIdentifier: String?, completion: MNFSyncAuthenticationCompletionHandler? = nil) -> MNFJob

    Parameters

    realmId

    The realm id of the organization to authenticate to.

    parameters

    A list of key-value pairs for the parameters. The key-value pairs should be ‘name’ for the parameter name and ‘value’ for the corresponding value.

    saveDetails

    Whether the details should be saved.

    realmUserIdentifier

    The user identifier for the user in the context of the realm.

    completion

    A completion block returning an authentication challenge and an error.

    Return Value

    MNFJob A job containing an authentication challenge and an error.

  • Fetches the realm accounts available to the user.

    Declaration

    Objective-C

    + (nonnull MNFJob *)
        fetchAvailableRealmAccountsWithRealmUserId:(nonnull NSNumber *)realmUserId
                                      sessionToken:(nullable NSString *)sessionToken
                                        completion:
                                            (nullable
                                                 MNFMultipleRealmAccountCompletionHandler)
                                                completion;

    Swift

    class func fetchAvailableRealmAccounts(withRealmUserId realmUserId: NSNumber, sessionToken: String?, completion: MNFMultipleRealmAccountCompletionHandler? = nil) -> MNFJob

    Parameters

    realmUserId

    The realm id of the user.

    sessionToken

    The session token which is added as a query so we know you are a properly authenticated user. The session token is url encoded.

    completion

    A completion block returning a list of realm accounts and an error.

    Return Value

    MNFJob A job containing a list of realm accounts and an error.

  • Authorizes a list of realm accounts.

    Declaration

    Objective-C

    + (nonnull MNFJob *)
        authorizeRealmAccounts:(nonnull NSArray<MNFRealmAccount *> *)realmAccounts
                   realmUserId:(nonnull NSNumber *)realmUserId
                  sessionToken:(nullable NSString *)sessionToken
                    completion:(nullable MNFErrorOnlyCompletionHandler)completion;

    Swift

    class func authorizeRealmAccounts(_ realmAccounts: [MNFRealmAccount], realmUserId: NSNumber, sessionToken: String?, completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob

    Parameters

    realmAccounts

    The realm accounts to authorize.

    realmUserId

    The realm id of the user.

    sessionToken

    The session token which is added as a query so we know you are a properly authenticated user. The session token is url encoded.

    completion

    A completion block returning a list of realm accounts and an error.

    Return Value

    MNFJob A job containing a list of realm accounts and an error.