QNPresencesRepository

public class QNPresencesRepository

Service to manage presence actions and subscribe to presence events

API

  • subscribe(to:) Asynchronous

    Subscribe and Get contact’s presence

    Declaration

    Swift

    public func subscribe(to contact: QNContact) async throws -> QNPresence

    Parameters

    contact

    Contact to subscribe

  • subscribe(to:) Asynchronous

    Subscribe and Get contact’s presences

    Declaration

    Swift

    public func subscribe(to contacts: [QNContact]) async throws -> [QNPresence]

    Parameters

    contacts

    List of contacts to subscribe

  • Get user’s presence

    Declaration

    Swift

    public func getPresence(for user: QNUser, fromCache: Bool = true) async throws -> QNPresence

    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) async throws -> QNPresence

    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

  • getOwnPresence() Asynchronous

    Get current user presence

    Declaration

    Swift

    public func getOwnPresence() async throws -> QNPresence
  • updateOwnStatus(_:) Asynchronous

    Update current user status

    Declaration

    Swift

    public func updateOwnStatus(_ status: QNPresence.Status) async throws -> QNPresence

    Parameters

    status

    Status to update

  • Update current user displayName

    Declaration

    Swift

    public func updateOwnDisplayName(_ displayName: String) async throws -> QNPresence

    Parameters

    displayName

    DisplayName to update

  • updateOwnAvatar(_:) Asynchronous

    Update current user avatar

    Declaration

    Swift

    public func updateOwnAvatar(_ avatar: String?) async throws -> QNPresence

    Parameters

    avatar

    Base64 avatar to update. Send a not-empty string to upload a new avatar, and null to remove the current one.

  • updateOwnPresence(_:) Asynchronous

    Update current user presence

    Declaration

    Swift

    public func updateOwnPresence(_ presence: QNPresenceUpdateRequest) async throws -> QNPresence

    Parameters

    presence

    Presence to update

    result

    Result with the presence updated

  • getUser(_:) Asynchronous

    Get user

    Declaration

    Swift

    public func getUser(_ identifier: String) async throws -> QNUser

    Parameters

    identifier

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

    Return Value

    User or QNSDKError

  • getOwnUser() Asynchronous

    Get current user

    Declaration

    Swift

    public func getOwnUser() async throws -> QNUser

    Return Value

    User or QNSDKError