@API(status=STABLE) public class PresenceService extends java.lang.Object implements OboPresenceService, OboService<OboPresenceService>
This service is used for retrieving information about the presence of the calling user, a specified user or all users in the pod, and perform some actions related to the user presence information like:
Constructor and Description |
---|
PresenceService(PresenceApi presenceApi,
AuthSession authSession,
RetryWithRecoveryBuilder<?> retryBuilder) |
PresenceService(PresenceApi presenceApi,
RetryWithRecoveryBuilder<?> retryBuilder) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
createPresenceFeed()
Creates a new stream capturing online status changes ("presence feed") for the company (pod) and returns the ID of
the new feed.
|
java.lang.String |
deletePresenceFeed(java.lang.String feedId)
Delete the specified presence feed that was created.
|
void |
externalPresenceInterest(java.util.List<java.lang.Long> userIds)
Register interest in a list of external users to get their presence info.
|
V2Presence |
getPresence()
Get the online status (presence info) of the calling user.
|
V2Presence |
getUserPresence(java.lang.Long userId,
java.lang.Boolean local)
Get the presence info of a specified user.
|
java.util.List<V2Presence> |
listPresences(java.lang.Long lastUserId,
java.lang.Integer limit)
Get the presence info of all users in a pod.
|
OboPresenceService |
obo(AuthSession oboSession)
Returns a new service instance with OBO-enabled endpoints from a given OBO session.
|
java.util.List<V2Presence> |
readPresenceFeed(java.lang.String feedId)
Reads the specified presence feed that was created.
|
V2Presence |
setPresence(PresenceStatus status,
java.lang.Boolean soft)
Set the presence info of the calling user.
|
V2Presence |
setUserPresence(java.lang.Long userId,
PresenceStatus status,
java.lang.Boolean soft)
Set the presence state of a another user.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkAuthSession
public PresenceService(PresenceApi presenceApi, AuthSession authSession, RetryWithRecoveryBuilder<?> retryBuilder)
public PresenceService(PresenceApi presenceApi, RetryWithRecoveryBuilder<?> retryBuilder)
public OboPresenceService obo(AuthSession oboSession)
obo
in interface OboService<OboPresenceService>
oboSession
- the OBO sessionpublic V2Presence getPresence()
getPresence()
getPresence
in interface OboPresenceService
public java.util.List<V2Presence> listPresences(@Nullable java.lang.Long lastUserId, @Nullable java.lang.Integer limit)
listPresences(Long, Integer)
listPresences
in interface OboPresenceService
lastUserId
- Last user ID retrieved, used for paging. If provided, results skip users with IDs less than
this parameter.limit
- Maximum number of records to return. The maximum supported value is 5000.public V2Presence getUserPresence(@Nonnull java.lang.Long userId, @Nullable java.lang.Boolean local)
getUserPresence(Long, Boolean)
getUserPresence
in interface OboPresenceService
userId
- User Idlocal
- If true then Perform a local query and set the presence to OFFLINE for users who are not local to
the calling user’s pod. If false or absent then query the presence of all local and external users
who are connected to the calling user.public void externalPresenceInterest(@Nonnull java.util.List<java.lang.Long> userIds)
externalPresenceInterest(List)
externalPresenceInterest
in interface OboPresenceService
userIds
- List of user ids to be registered.public V2Presence setPresence(@Nonnull PresenceStatus status, @Nullable java.lang.Boolean soft)
setPresence(PresenceStatus, Boolean)
setPresence
in interface OboPresenceService
status
- The new presence state for the user.
Possible values are AVAILABLE, BUSY, AWAY, ON_THE_PHONE, BE_RIGHT_BACK, IN_A_MEETING, OUT_OF_OFFICE, OFF_WORK.soft
- If true, the user's current status is taken into consideration. If the user is currently OFFLINE,
the user's presence will still be OFFLINE, but the new presence will take effect when the
user comes online. If the user is currently online, the user's activity state will be
applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE,
but the user is currently idle, their status will be represented as AWAY)public java.lang.String createPresenceFeed()
createPresenceFeed()
createPresenceFeed
in interface OboPresenceService
public java.util.List<V2Presence> readPresenceFeed(@Nonnull java.lang.String feedId)
readPresenceFeed(String)
readPresenceFeed
in interface OboPresenceService
feedId
- The presence feed id to be read.public java.lang.String deletePresenceFeed(@Nonnull java.lang.String feedId)
deletePresenceFeed(String)
deletePresenceFeed
in interface OboPresenceService
feedId
- The presence feed id to be deleted.public V2Presence setUserPresence(@Nonnull java.lang.Long userId, @Nonnull PresenceStatus status, @Nullable java.lang.Boolean soft)
setUserPresence(Long, PresenceStatus, Boolean)
setUserPresence
in interface OboPresenceService
userId
- The id of the specified user.status
- Presence state to set.
Possible values are AVAILABLE, BUSY, AWAY, ON_THE_PHONE, BE_RIGHT_BACK, IN_A_MEETING, OUT_OF_OFFICE, OFF_WORK.soft
- If true, the user's current status is taken into consideration. If the user is currently OFFLINE,
the user's presence will still be OFFLINE, but the new presence will take effect when the
user comes online. If the user is currently online, the user's activity state will be
applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE,
but the user is currently idle, their status will be represented as AWAY)