NXMClient

@interface NXMClient : NSObject

/*!
Return the connection status.
*/
@property (nonatomic, assign, readonly, getter=getConnectionStatus) NXMConnectionStatus connectionStatus;

/*!
 Return the current user
 */
@property (nonatomic, strong, readonly, nullable, getter=getUser) NXMUser *user;

/*!
 Return the current authentication token
 */
@property (nonatomic, strong, readonly, nullable, getter=getToken) NSString *token;

/**
 init nxmClient with authentication token
 @param authToken user authentication token
 */
- (instancetype)initWithToken:(nonnull NSString *)authToken;

/*!
 Set nexmo client logger delegate
 *  @param delegate a `NXMLoggerDelegate` object.
 *
 */
- (void)setLoggerDelegate:(nullable id <NXMLoggerDelegate>)delegate;

/*!
 Set nexmo client delegate
 *  @param delegate a `NXMClientDelegate` object.
 *
 */
- (void)setDelegate:(nonnull id <NXMClientDelegate>)delegate;

/**
 login and connect to nexmo sdk.
 */
- (void)login;

/**
 Update authentication token when logged in
 @param authToken user authentication token
 */
- (void)refreshAuthToken:(nonnull NSString *)authToken;

/**
Logout
 */
- (void)logout;

#pragma mark - Conversation

/**
 Get a conversation object by id
 @param converesationId     conversation id
 @param completion          completion block
 */
- (void)getConversationWithId:(nonnull NSString *)converesationId
                   completion:(void(^_Nullable)(NSError * _Nullable error, NXMConversation * _Nullable conversation))completion;


/**
 Creatw a new conversation with name

 @param name                conversation name
 @param completion          completion block
 */
- (void)createConversationWithName:(nonnull NSString *)name completion:(void(^_Nullable)(NSError * _Nullable error, NXMConversation * _Nullable conversation))completion;

#pragma mark - Call

///**
// Create a new call to users
//
// @param callees         user ids/name or pstn number to call
// @param callType        type of the call (InApp/SERVER)
// @param delegate        call delegate
// @param completion      completion block
// */
- (void)call:(nonnull NSArray<NSString *>*)callees
    callType:(NXMCallType)callType
    delegate:(nullable id<NXMCallDelegate>)delegate
  completion:(void(^_Nullable)(NSError * _Nullable error, NXMCall * _Nullable call))completion;

- (void)onMemberEvent:(NSNotification* )notification;

#pragma mark - Push Notifications

/**
 Enable push notification for specific device

 @param deviceToken     the device token
 @param isPushKit       is the app using PushKit
 @param isSandbox       is apple sandbox enviroment
 @param completion      completion block
 */
- (void)enablePushNotificationsWithDeviceToken:(nonnull NSData *)deviceToken
                                     isPushKit:(BOOL)isPushKit
                                     isSandbox:(BOOL)isSandbox
                                    completion:(void(^_Nullable)(NSError * _Nullable error))completion;

/**
 Disable push notification for the current device
 
 @param completion      completion block
 */
- (void)disablePushNotificationsWithCompletion:(void(^_Nullable)(NSError * _Nullable error))completion;

/**
 Call this method on incoming push

 @param userInfo    pushInfo
 @return true if nexmo push
 */
- (BOOL)isNexmoPushWithUserInfo:(nonnull NSDictionary *)userInfo;

/**
 Handle nexmo push
 Call this method when isNexmoPushWithUserInfo:userInfo return true
 
 @param userInfo    pushInfo
 @param completion  completion block
 */
- (void)processNexmoPushWithUserInfo:(nonnull NSDictionary *)userInfo
                           completion:(void(^_Nullable)(NSError * _Nullable error))completion;

@end

Undocumented

  • Undocumented

    Declaration

    Objective-C

    @property (readonly, getter=getConnectionStatus, assign, nonatomic)
        int connectionStatus;

    Swift

    var connectionStatus: Int32 { get }
  • Undocumented

    Declaration

    Objective-C

    @property (readonly, getter=getUser, strong, nonatomic, nullable) NXMUser *user;

    Swift

    var user: NXMUser? { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable, getter=getToken) NSString *token

    Swift

    var token: UnsafeMutablePointer<Int32>? { get }
  • init nxmClient with authentication token

    Declaration

    Objective-C

    - (instancetype)initWithToken:(id)authToken;

    Swift

    init!(token authToken: Any!)

    Parameters

    authToken

    user authentication token

  • Undocumented

    Declaration

    Objective-C

    - (void)setLoggerDelegate:(nullable id<NXMLoggerDelegate>)delegate;

    Swift

    func setLoggerDelegate(_ delegate: NXMLoggerDelegate?)
  • Undocumented

    Declaration

    Objective-C

    - (void)setDelegate:(nonnull id<NXMClientDelegate>)delegate;

    Swift

    func setDelegate(_ delegate: NXMClientDelegate)
  • login and connect to nexmo sdk.

    Declaration

    Objective-C

    - (void)login;

    Swift

    func login()
  • Update authentication token when logged in

    Declaration

    Objective-C

    - (void)refreshAuthToken:(id)authToken;

    Swift

    func refreshAuthToken(_ authToken: Any!)

    Parameters

    authToken

    user authentication token

  • Logout

    Declaration

    Objective-C

    - (void)logout;

    Swift

    func logout()
  • Get a conversation object by id

    Declaration

    Objective-C

    - (void)getConversationWithId:(id)converesationId
                       completion:(void (^_Nullable)(int *_Nullable,
                                                     NXMConversation *_Nullable))
                                      completion;

    Swift

    func getConversationWithId(_ converesationId: Any!, completion: ((UnsafeMutablePointer<Int32>?, NXMConversation?) -> Void)? = nil)

    Parameters

    converesationId

    conversation id

    completion

    completion block

  • Creatw a new conversation with name

    Declaration

    Objective-C

    - (void)createConversationWithName:(id)name
                            completion:(void (^_Nullable)(
                                           int *_Nullable,
                                           NXMConversation *_Nullable))completion;

    Swift

    func createConversation(withName name: Any!, completion: ((UnsafeMutablePointer<Int32>?, NXMConversation?) -> Void)? = nil)

    Parameters

    name

    conversation name

    completion

    completion block

  • Undocumented

    Declaration

    Objective-C

    - (void)call:(nonnull NSArray<NSString *>*)callees
        callType:(NXMCallType)callType
        delegate:(nullable id<NXMCallDelegate>)delegate
      completion:(void(^_Nullable)(NSError * _Nullable error, NXMCall * _Nullable call))completion;

    Swift

    func call(_ callees: Any!, callType: Any!, delegate: NXMCallDelegate?, completion: ((UnsafeMutablePointer<Int32>?, NXMCall?) -> Void)? = nil)
  • Undocumented

    Declaration

    Objective-C

    - (void)onMemberEvent:(NSNotification* )notification;

    Swift

    func onMemberEvent(_ notification: Any!)
  • Enable push notification for specific device

    Declaration

    Objective-C

    - (void)enablePushNotificationsWithDeviceToken:(id)deviceToken
                                         isPushKit:(id)isPushKit
                                         isSandbox:(id)isSandbox
                                        completion:(void (^_Nullable)(
                                                       int *_Nullable))completion;

    Swift

    func enablePushNotifications(withDeviceToken deviceToken: Any!, isPushKit: Any!, isSandbox: Any!, completion: ((UnsafeMutablePointer<Int32>?) -> Void)? = nil)

    Parameters

    deviceToken

    the device token

    isPushKit

    is the app using PushKit

    isSandbox

    is apple sandbox enviroment

    completion

    completion block

  • Disable push notification for the current device

    Declaration

    Objective-C

    - (void)disablePushNotificationsWithCompletion:
        (void (^_Nullable)(int *_Nullable))completion;

    Swift

    func disablePushNotifications(completion: ((UnsafeMutablePointer<Int32>?) -> Void)? = nil)

    Parameters

    completion

    completion block

  • Call this method on incoming push

    Declaration

    Objective-C

    - (id)isNexmoPushWithUserInfo:(id)userInfo;

    Swift

    func isNexmoPush(withUserInfo userInfo: Any!) -> Any!

    Parameters

    userInfo

    pushInfo

    Return Value

    true if nexmo push

  • Handle nexmo push Call this method when isNexmoPushWithUserInfo:userInfo return true

    Declaration

    Objective-C

    - (void)processNexmoPushWithUserInfo:(id)userInfo
                              completion:
                                  (void (^_Nullable)(int *_Nullable))completion;

    Swift

    func processNexmoPush(withUserInfo userInfo: Any!, completion: ((UnsafeMutablePointer<Int32>?) -> Void)? = nil)

    Parameters

    userInfo

    pushInfo

    completion

    completion block