QNPresencesRepository

public class QNPresencesRepository

Service to manage presence actions and subscribe to presence events

Delegate

API

  • Subscribe and Get contact’s presence

    Declaration

    Swift

    public func subscribe(to contact: QNContact, result: @escaping (Result<QNPresence, ResourceError>) -> Void)

    Parameters

    contact

    Contact to subscribe

    result

    Result with the presence

  • Subscribe and Get contact’s presences

    Declaration

    Swift

    public func subscribe(to contacts: [QNContact], result: @escaping (Result<[QNPresence], ResourceError>) -> Void)

    Parameters

    contacts

    List of contacts to subscribe

    result

    Result with the presences

  • Get user’s presence

    Declaration

    Swift

    public func getPresence(for user: QNUser, fromCache: Bool = true, result: @escaping (Result<QNPresence, ResourceError>) -> Void)

    Parameters

    user

    User to get presence

    fromCache

    Retrieve from cache or server; true by default

    result

    Result with the presence

  • Get user’s presence

    Declaration

    Swift

    public func getPresence(_ identifier: String, fromCache: Bool = true, result: @escaping (Result<QNPresence, ResourceError>) -> Void)

    Parameters

    identifier

    identifier of the user’s presence you want to obtain. It can be either the username@domain, or the userID

    fromCache

    Retrieve from cache or server; true by default

    result

    Result with the presence

  • Get current user presence

    Declaration

    Swift

    public func getOwnPresence(result: @escaping (Result<QNPresence, ResourceError>) -> Void)

    Parameters

    result

    Result with the Presence

  • Update current user status

    Declaration

    Swift

    public func updateOwnStatus(_ status: QNPresence.Status, result: @escaping (Result<QNPresence, ResourceError>) -> Void)

    Parameters

    status

    Status to update

    result

    Result with the presence updated

  • Update current user displayName

    Declaration

    Swift

    public func updateOwnDisplayName(_ displayName: String, result: @escaping (Result<QNPresence, ResourceError>) -> Void)

    Parameters

    displayName

    DisplayName to update

    result

    Result with the presence updated

  • Update current user avatar

    Declaration

    Swift

    public func updateOwnAvatar(_ avatar: String, result: @escaping (Result<QNPresence, ResourceError>) -> Void)

    Parameters

    avatar

    Avatar to update

    result

    Result with the presence updated

  • Update current user presence

    Declaration

    Swift

    public func updateOwnPresence(_ presence: QNPresenceUpdateRequest, result: @escaping (Result<QNPresence, ResourceError>) -> Void)

    Parameters

    presence

    Presence to update

    result

    Result with the presence updated

  • Get user

    Declaration

    Swift

    public func getUser(_ identifier: String, result: @escaping (Result<QNUser, ResourceError>) -> Void)

    Parameters

    identifier

    identifier of the user you want to obtain. It can be either the username@domain, or the userID

    Return Value

    Single with the User or ResourceError

  • Get current user

    Declaration

    Swift

    public func getOwnUser(result: @escaping (Result<QNUser, ResourceError>) -> Void)

    Return Value

    Single with the User or ResourceError