# Presences

class Presences

The presence service.

This class allows performing presence related actions like obtaining the local user presence or subscribing to the presence of one or more contacts. It also allows adding a listener to receive presence events (@see PresencesListener).

## Properties

rx
Link copied to clipboard
val rx: PresencesRx

Access to the reactive API of the service.

## Functions

addListener
Link copied to clipboard
fun addListener(listener: PresencesListener)

Adds a listener to receive presence events.

getOwnPresence
Link copied to clipboard
fun getOwnPresence(onCompletion: (Either<Presence, SippoResourceError>) -> Unit)

Fetches the presence for the current user.

getPresenceForContact
Link copied to clipboard
fun getPresenceForContact(contact: Contact, onCompletion: (Either<Presence?, SippoResourceError>) -> Unit)

Fetches the presence for the specified contact.

getPresences
Link copied to clipboard
fun getPresences(withoutAvatar: Boolean, onCompletion: (Either<List<Presence>, SippoResourceError>) -> Unit)

Fetches all the presences to which the current user is subscribed.

removeListener
Link copied to clipboard
fun removeListener(listener: PresencesListener)

Removes the specified listener.

subscribeToOwnPresence
Link copied to clipboard
fun subscribeToOwnPresence(onCompletion: (Either<Presence, SippoResourceError>) -> Unit)

Subscribes to the presence for the current user.

subscribeToPresence
Link copied to clipboard
fun subscribeToPresence(contact: Contact, onCompletion: (Either<Presence?, SippoResourceError>) -> Unit)

Subscribes to the presence of the specified contact.

subscribeToPresenceBy
Link copied to clipboard
fun subscribeToPresenceBy(userUri: String, onCompletion: (Either<Presence?, SippoResourceError>) -> Unit)

Subscribes to the presence of the specified userUri.

subscribeToPresences
Link copied to clipboard
fun subscribeToPresences(contacts: List<Contact>, onCompletion: (Either<List<Presence>, SippoResourceError>) -> Unit)

Subscribes to the presence of each contact included in contacts.

subscribeToPresencesBy
Link copied to clipboard
fun subscribeToPresencesBy(userUris: List<String>, onCompletion: (Either<List<Presence>, SippoResourceError>) -> Unit)

Subscribes to the presence of each contact included in userUris.

updateOwnAvatar
Link copied to clipboard
fun updateOwnAvatar(avatar: String, onCompletion: (Either<Presence, SippoResourceError>) -> Unit)

Updates the current user avatar.

updateOwnDisplayName
Link copied to clipboard
fun updateOwnDisplayName(displayName: String, onCompletion: (Either<Presence, SippoResourceError>) -> Unit)

Updates the current user displayName.

updateOwnMood
Link copied to clipboard
fun updateOwnMood(mood: String, onCompletion: (Either<Presence, SippoResourceError>) -> Unit)

Updates the current user mood.

updateOwnPresence
Link copied to clipboard
fun updateOwnPresence(request: UpdatePresenceRequest, onCompletion: (Either<Presence, SippoResourceError>) -> Unit)

Updates the presence for the current user.

updateOwnState
Link copied to clipboard
fun updateOwnState(state: Presence.State, onCompletion: (Either<Presence, SippoResourceError>) -> Unit)

Updates the current user state.