WOVUserManager

@objc final public class WOVUserManager: NSObject, WOVUserType

Provides WOVER’s functionality related to user and contacts management.

  • A boolean indicating if the user is already authorised or not with WOVER service.

    Declaration

    Swift

    public var isAuthorised: Bool
  • User’s id at WOVER service

    Declaration

    Swift

    public fileprivate(set) var woverId: String?
  • Authorises a new or existing user with WOVER service. When user is authorised all data harvesting begins.

    Declaration

    Swift

    public func authoriseUser(with userId: String, firstName: String, middleName: String?, lastName: String, phoneNumber: String, completion: @escaping (_ success: Bool, _ error: Error?) -> ()) -> URLSessionDataTask?

    Parameters

    userId

    User’s unique identifier

    firstName

    User’s first name

    middleName

    User’s middle name if any

    lastName

    User’s family name

    phoneNumber

    User’s phone number in E.164 format

    completion

    A block that is called when request is finished. This block is passed the following parameters:

    success

    A Boolean value that indicates whether the request was processed successfully. This parameter is false if an error occurred while processing the request; otherwise, it is true.

    error

    An error object. If an error occurred, this object contains information about the error; otherwise, it is set to nil.

    Return Value

    An ‘URLSessionDataTask’ task or nil if local validation fails

  • Logout user from WOVER service.

    Declaration

    Swift

    public func logout(completion: @escaping (_ success: Bool, _ error: Error?) -> ()) -> URLSessionDataTask?

    Parameters

    completion

    A block that is called when request is finished. This block is passed the following parameters:

    success

    A Boolean value that indicates whether the request was processed successfully. This parameter is false if an error occurred while processing the request; otherwise, it is true.

    error

    An error object. If an error occurred, this object contains information about the error; otherwise, it is set to nil.

    Return Value

    An ‘URLSessionDataTask’ task or nil if local validation fails

  • Fetches user’s resolved WOVER contacts.

    Declaration

    Swift

    public func fetchResolvedContacts(completion: @escaping (_ contacts: [WOVContactObject]?, _ error: Error?) -> ()) -> URLSessionDataTask?

    Parameters

    completion

    A block that is called when request is finished. This block is passed the following parameters:

    contacts

    An array of representing the resolved contacts if any. This parameter is nil if an error occurred while processing the request.

    error

    An error object. If an error occurred, this object contains information about the error; otherwise, it is set to nil.

    Return Value

    An ‘URLSessionDataTask’ task or nil if local validation fails

  • Assigns user’s resolved WOVER contacts should be notified when an emergency occurs.

    Declaration

    Swift

    public func assign(contacts: [WOVContactObject], completion: @escaping (_ success: Bool, _ error: Error?) -> ()) -> URLSessionDataTask?

    Parameters

    contacts

    An array of to be assigned.

    completion

    A block that is called when request is finished. This block is passed the following parameters:

    success

    A Boolean value that indicates whether the request was processed successfully. This parameter is false if an error occurred while processing the request; otherwise, it is true.

    error

    An error object. If an error occurred, this object contains information about the error; otherwise, it is set to nil.

    Return Value

    An ‘URLSessionDataTask’ task or nil if local validation fails

  • De-assigns user’s resolved WOVER contacts from be notified when an emergency occurs.

    Declaration

    Swift

    public func deassign(contacts: [WOVContactObject], completion: @escaping (_ success: Bool, _ error: Error?) -> ()) -> URLSessionDataTask?

    Parameters

    contacts

    An array of to be de-assigned.

    completion

    A block that is called when request is finished. This block is passed the following parameters:

    success

    A Boolean value that indicates whether the request was processed successfully. This parameter is false if an error occurred while processing the request; otherwise, it is true.

    error

    An error object. If an error occurred, this object contains information about the error; otherwise, it is set to nil.

    Return Value

    An ‘URLSessionDataTask’ task or nil if local validation fails

  • Uploads contacts to WOVER service.

    Declaration

    Swift

    public func upload(_ contacts: [CNContact], completion: @escaping (_ contacts: [WOVContactObject]?, _ error: Error?) -> ()) -> URLSessionDataTask?

    Parameters

    contacts

    An array of to be uploaded.

    completion

    A block that is called when request is finished. This block is passed the following parameters:

    contacts

    An array of representing the resolved contacts if any. This parameter is nil if an error occurred while processing the request.

    error

    An error object. If an error occurred, this object contains information about the error; otherwise, it is set to nil.

    Return Value

    An ‘URLSessionDataTask’ task or nil if local validation fails

  • Removes uploaded contacts from WOVER service.

    Declaration

    Swift

    public func removeContacts(_ contacts: [CNContact], completion: @escaping (_ success: Bool, _ error: Error?) -> ()) -> URLSessionDataTask?

    Parameters

    contacts

    An array of to be removed.

    completion

    A block that is called when request is finished. This block is passed the following parameters:

    success

    A Boolean value that indicates whether the request was processed successfully. This parameter is false if an error occurred while processing the request; otherwise, it is true.

    error

    An error object. If an error occurred, this object contains information about the error; otherwise, it is set to nil.

    Return Value

    An ‘URLSessionDataTask’ task or nil if local validation fails