MNFUser

Objective-C

@interface MNFUser : MNFObject

Swift

class MNFUser : MNFObject

The MNFUser object encapsulates a user profile json data from the server in an object.

A user should not be directly initialized but instead should be constructed with data from the server. The response from the server will be automatically converted to an MNFUser object.

Immutable properties

  • @abstract The identifier of the person corresponding to this user.

    Declaration

    Objective-C

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

    Swift

    var personId: NSNumber { get }
  • @abstract The preferred culture set for this person.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull culture;

    Swift

    var culture: String { get }
  • @abstract The date this person last logged in.

    Declaration

    Objective-C

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

    Swift

    var lastLoginDate: Date { get }
  • @abstract Whether initial setup has been completed for this user.

    Declaration

    Objective-C

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

    Swift

    var isInitialSetupDone: NSNumber { get }
  • @abstract The email for this person.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull email;

    Swift

    var email: String { get }
  • @abstract The host where this person last logged in.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull lastLoginRemoteHost;

    Swift

    var lastLoginRemoteHost: String { get }
  • @abstract The date this person was created.

    Declaration

    Objective-C

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

    Swift

    var createDate: Date { get }
  • @abstract The id of the terms and condition this person has accepted.

    Declaration

    Objective-C

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

    Swift

    var termsAndConditionsId: NSNumber { get }
  • @abstract The date this person acceted the terms and conditions.

    Declaration

    Objective-C

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

    Swift

    var termsAndConditionsAcceptDate: Date { get }
  • @abstract The date this perosn opted out of the system.

    Declaration

    Objective-C

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

    Swift

    var optOutDate: Date { get }
  • @abstract The users profile.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) MNFUserProfile *_Nonnull profile;

    Swift

    var profile: MNFUserProfile { get }
  • @abstract The phone number for this person.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull phoneNumber;

    Swift

    var phoneNumber: String { get }
  • @abstract The date when the users password is set to expire.

    Declaration

    Objective-C

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

    Swift

    var passwordExpiryDate: Date { get }
  • @abstract Whether the user should be hidden from search results in admin.

    Declaration

    Objective-C

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

    Swift

    var hide: NSNumber { get }

Mutable properties

  • @abstract Optional display first name for the current person.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSString *_Nullable firstName;

    Swift

    var firstName: String? { get set }
  • @abstract Option display surname for the current person.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSString *_Nullable lastName;

    Swift

    var lastName: String? { get set }

Registering

  • Deprecated

    Use beginRegistration instead and follow with registerUserWithEmail:password:signupToken:culture:completion:

    Register a user with email, password and default culture.

    Declaration

    Objective-C

    + (nonnull MNFJob *)registerUserWithEmail:(nonnull NSString *)email
                                     password:(nonnull NSString *)password
                                      culture:(nonnull NSString *)culture
                                   completion:(nullable MNFUserCompletionHandler)
                                                  completion;

    Swift

    class func register(withEmail email: String, password: String, culture: String, completion: MNFUserCompletionHandler? = nil) -> MNFJob

    Parameters

    email

    The email for the user.

    password

    The password for the user.

    culture

    The default culture for the user.

    completion

    A completion block returning a user and an error.

    Return Value

    MNFJob A job containing a user and an error.

  • Begin registration of a user with an email.

    Declaration

    Objective-C

    + (nonnull MNFJob *)beginRegistrationWithEmail:(nonnull NSString *)email
                                        completion:
                                            (nullable MNFErrorOnlyCompletionHandler)
                                                completion;

    Swift

    class func beginRegistration(withEmail email: String, completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob

    Parameters

    email

    The email for the user

    completion

    A completion block returning a user and an error.

    Return Value

    MNFJob A job containing a user and an error.

  • Register a user with email, password, signup token and default culture.

    Declaration

    Objective-C

    + (nonnull MNFJob *)registerUserWithEmail:(nonnull NSString *)email
                                     password:(nonnull NSString *)password
                                  signupToken:(nonnull NSString *)signupToken
                                      culture:(nonnull NSString *)culture
                                   completion:(nullable MNFUserCompletionHandler)
                                                  completion;

    Swift

    class func register(withEmail email: String, password: String, signupToken: String, culture: String, completion: MNFUserCompletionHandler? = nil) -> MNFJob

    Parameters

    email

    The email for the user.

    password

    The password for the user.

    signupToken

    A token provided through the signup process via f.x. email.

    culture

    The default culture for the user.

    completion

    A completion block returning a user and an error.

    Return Value

    MNFJob A job containing a user and an error.

Fetching

  • @abstract Fetches a list of all persons connected to the given user.

    Declaration

    Objective-C

    + (nonnull MNFJob *)fetchUsersWithCompletion:
        (nullable MNFMultipleUsersCompletionHandler)completion;

    Swift

    class func fetchUsers(completion: MNFMultipleUsersCompletionHandler? = nil) -> MNFJob

    Parameters

    completion

    A completion block returning a list of persons and an error.

    Return Value

    An MNFJob containing a list of persons and an error.

Saving

  • @abstract Saves changes to this person.

    Declaration

    Objective-C

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

    Swift

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

    Parameters

    completion

    A completion block returning an error.

    Return Value

    An MNFJob containing an error.

Deleting

  • @abstract Deletes the current person.

    Declaration

    Objective-C

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

    Swift

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

    Parameters

    completion

    A completion block returning an error.

    Return Value

    An MNFJob containing an error.

Refreshing

  • @abstract Refreshes the current person with server data.

    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.

Culture

  • @abstract Changes the culture for the current person.

    Declaration

    Objective-C

    - (nonnull MNFJob *)changeCulture:(nonnull NSString *)culture
                       withCompletion:
                           (nullable MNFErrorOnlyCompletionHandler)completion;

    Swift

    func changeCulture(_ culture: String, withCompletion completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob

    Parameters

    culture

    The culture to be set.

    completion

    A completion block returning an error.

    Return Value

    An MNFJob containing an error.

Opting

  • @abstract Opts in the current person.

    Declaration

    Objective-C

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

    Swift

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

    Parameters

    completion

    A completion block returning an error.

    Return Value

    An MNFJob containing an error.

  • @abstract Opts out the current person.

    Declaration

    Objective-C

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

    Swift

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

    Parameters

    completion

    A completion block returning an error.

    Return Value

    An MNFJob containing an error.

Metadata

  • @abstract Fetches user metadata based on the names provided. By default it returns all user metadata for the current user.

    Declaration

    Objective-C

    - (nonnull MNFJob *)
        fetchMetaDataForKeys:(nonnull NSString *)keys
                  completion:
                      (nullable MNFMultipleMetadataCompletionHandlers)completion;

    Swift

    func fetchMetaData(forKeys keys: String, completion: MNFMultipleMetadataCompletionHandlers? = nil) -> MNFJob

    Parameters

    keys

    The keys of the metadata to be fetched in a comma seperated string.

    completion

    A completion block returning a list of NSDictionary of metadata and an error.

    Return Value

    An MNFJob containing a list of NSDictionary of metadata and an error.

  • @abstract Updates user metadata based on the name value.

    Declaration

    Objective-C

    - (nonnull MNFJob *)
        updateMetaDataForKey:(nonnull NSString *)key
                       value:(nonnull NSString *)value
                  completion:(nullable MNFErrorOnlyCompletionHandler)completion;

    Swift

    func updateMetaData(forKey key: String, value: String, completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob

    Parameters

    key

    The key of the metadata to be updated.

    value

    The value of the metadata to be updated.

    completion

    A completion block returning an error.

    Return Value

    An MNFJob containing an error.