ManagementAPI
public class ManagementAPI
The Management API provides utility methods for managing Activeconnect applications. The API is used for managing users.
-
Initialises an instance of the Activeconnect Management API
Declaration
Swift
public init(application_id: String, application_secret: String, activeconnect_configuration: ActiveconnectConfiguration = ActiveconnectConfiguration.DEFAULT_ACTIVECONNECT_CONFIGURATION)Parameters
application_idThe application ID of your Activeconnect application.
application_secretThe application secret of your Activeconnect application.
activeconnect_configuration(optional) Describes the Activeconnect server that hosts your application. If omitted the default production Activeconnect server will be used.
-
Registers a client user with Activeconnect 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
Swift
public func create_user_and_register_device(user: String, notification_token: String, success: @escaping ACMobileDevice.device_success_proc, failure: @escaping ACMobileDevice.device_failure_proc)Parameters
userA client defined identifier for the user.
notification_tokenThe APNS token required to send Push Notifications to this device,
successCode block to execute when the registration process is successful.
failureCode block to execute when the registration fails
-
Add users to an Activeconnect 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
usersAn array of strings containing the ids of the users to add.
successA 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.
failureA 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. Activeconnect user ids are case insensitive
Declaration
Swift
public func add_user(user: String, success: @escaping () -> Void, failure: @escaping (_ error: Error) -> Void)Parameters
userThe user to add. It is recommended that you use a random string to identify users to Activeconnect and maintain a lookup mechanism within your application to connect your user ID values to Activeconnect user ID values.
successA code block to execute if the user is added
failureA code block to execute if the request fails. If the user already exists error will be an ACError with kind = User_Exists.
-
Deletes users
Declaration
Swift
public func delete_users(users: [String], success: @escaping () -> Void, failure: @escaping (_ error: Error) -> Void)Parameters
usersAn array of user ids as used with add_users.
successA code block to execute if the users are deleted.
failureA code block to execute if the user are not deleted. The error can be an ACError with the kind and message indicating the failure reason or a generic Swift error.
-
Delete a single user.
Declaration
Swift
public func delete_user(user: String, success: @escaping () -> Void, failure: @escaping (_ error: Error) -> Void)Parameters
userthe user to delete.
successA code block to execute when the user is deleted.
failureA code block to execute if deletion fails. The error can be an ACError with the kind and message describing the failure reason or a generic Swift error.
-
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_idThe user to get the registration link for.
display_nameOptional 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.
successCode 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
ACMobileDevice.registerDevice) -
Calls the Activeconnect 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_idThe Activeconnect user id
successA code block to call on success. has_registered_device will be true if the user has registered a mobile device, otherwise false,
failuteA 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.
ManagementAPI Class Reference