IPManagementAPI
public class IPManagementAPI
The Management API provides utility methods for managing IAMPASS applications. The API is used for managing users.
-
Initialises an instance of the IAMPASS Management API
Declaration
Swift
public init(application_id: String, application_secret: String, iampass_configuration: IAMPASSConfiguration = IAMPASSConfiguration.DEFAULT_IAMPASS_CONFIGURATION)
Parameters
application_id
The application ID of your IAMPASS application.
application_secret
The application secret of your IAMPASS application.
IAMPASS_configuration
(optional) Describes the IAMPASS server that hosts your application. If omitted the default production IAMPASS server will be used.
-
Registers a client user with IAMPASS and registers the calling mobile device.
Important
Client applications should not call this method until they have a valid APNS notification token. The client application is repsonsible for storing the returned device data.Declaration
Parameters
user
A client defined identifier for the user.
notification_token
The APNS token required to send Push Notifications to this device,
success
Code block to execute when the registration process is successful.
failure
Code block to execute when the registration fails
-
Add users to an IAMPASS application. The method will attempt to add the users and call either the success or failure code blocks. You can use any string for the the users field but best practice is to use a random string that you can connect back to your actual user.
Declaration
Swift
public func add_users(users: [String], success: @escaping (_ added: [String], _ existing: [String]) -> Void, failure: @escaping (_ error: Error) -> Void)
Parameters
users
An array of strings containing the ids of the users to add.
success
A code block to execute if the users are added. The added parameter contains the ids of the users that were added. The existing parameter contains the ids of any of the users that already exist.
failure
A code block to execute if the request fails. The error parameter may be a standard Swift error or an ACError with the message describing the failure reason.
-
Adds a single user. IAMPASS user ids are case insensitive
Declaration
Swift
public func add_user(user: String, success: @escaping () -> Void, failure: @escaping (_ error: Error) -> Void)
Parameters
user
The user to add. It is recommended that you use a random string to identify users to IAMPASS and maintain a lookup mechanism within your application to connect your user ID values to IAMPASS user ID values.
success
A code block to execute if the user is added
failure
A code block to execute if the request fails. If the user already exists error will be an ACError with kind = User_Exists.
-
Gets a registration link for a user that can be used to register a mobile device.
Declaration
Swift
public func get_registration_link(user_id: String, display_name: String?, success: @escaping (_ registration_link: URL) -> Void, failure: @escaping (_ error: Error) -> Void)
Parameters
user_id
The user to get the registration link for.
display_name
Optional string that is used as the display name in the registration link. Active connect does not maintain information about your users so you can use this parameter to display a meaningful name to the user.
success
Code block to execute if the request is successul. The registration_link parameter is a link that can be used to register a mobile device (See
IPUser.registerDevice
) -
Calls the IAMPASS API to check if a user has registered a mobile device. If the method succeeds the code block success is called. The has_registered_device parameter will be true if the the user has registered a mobile device otherwise it will be false. If the method fails the failure block is called with an error indicating the failure reason.
Declaration
Swift
public func has_registered_mobile_device(user_id: String, success: @escaping (_ has_registered_device: Bool) -> Void, failure: @escaping (_ error: Error) -> Void)
Parameters
user_id
The IAMPASS user id
success
A code block to call on success. has_registered_device will be true if the user has registered a mobile device, otherwise false,
failure
A code block to call on failure. Error may be an ACError with the kind and description indicating the failure reason or a standard Swift error.