Class PresenceService

java.lang.Object
com.symphony.bdk.core.service.presence.PresenceService
All Implemented Interfaces:
OboService<OboPresenceService>, OboPresenceService

@API(status=STABLE) public class PresenceService extends Object implements OboPresenceService, OboService<OboPresenceService>
Service class for managing user presence information.

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:

  • Set Presence to calling user
  • Set Presence to a specified user
  • Create a presence feed
  • Read a created presence feed
  • Delete a created presence feed

  • Constructor Details

  • Method Details

    • obo

      public OboPresenceService obo(AuthSession oboSession)
      Returns a new service instance with OBO-enabled endpoints from a given OBO session.
      Specified by:
      obo in interface OboService<OboPresenceService>
      Parameters:
      oboSession - the OBO session
      Returns:
      the instance of the service class with OBO-enabled endpoints
    • getPresence

      public V2Presence getPresence()
      Get the online status (presence info) of the calling user. getPresence()
      Specified by:
      getPresence in interface OboPresenceService
      Returns:
      Presence info of the calling user.
      See Also:
    • listPresences

      public List<V2Presence> listPresences(@Nullable Long lastUserId, @Nullable Integer limit)
      Get the presence info of all users in a pod. listPresences(Long, Integer)
      Specified by:
      listPresences in interface OboPresenceService
      Parameters:
      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.
      Returns:
      List of presence info of all users in a pod.
      See Also:
    • getUserPresence

      public V2Presence getUserPresence(@Nonnull Long userId, @Nullable Boolean local)
      Get the presence info of a specified user. getUserPresence(Long, Boolean)
      Specified by:
      getUserPresence in interface OboPresenceService
      Parameters:
      userId - User Id
      local - 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.
      Returns:
      Presence info of the looked up user.
      See Also:
    • externalPresenceInterest

      public void externalPresenceInterest(@Nonnull List<Long> userIds)
      Register interest in a list of external users to get their presence info. externalPresenceInterest(List)
      Specified by:
      externalPresenceInterest in interface OboPresenceService
      Parameters:
      userIds - List of user ids to be registered.
      See Also:
    • setPresence

      public V2Presence setPresence(@Nonnull PresenceStatus status, @Nullable Boolean soft)
      Set the presence info of the calling user. setPresence(PresenceStatus, Boolean)
      Specified by:
      setPresence in interface OboPresenceService
      Parameters:
      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)
      Returns:
      Presence info of the calling user.
      See Also:
    • createPresenceFeed

      public String createPresenceFeed()
      Creates a new stream capturing online status changes ("presence feed") for the company (pod) and returns the ID of the new feed. The feed will return the presence of users whose presence status has changed since it was last read. createPresenceFeed()
      Specified by:
      createPresenceFeed in interface OboPresenceService
      Returns:
      Presence feed Id
      See Also:
    • readPresenceFeed

      public List<V2Presence> readPresenceFeed(@Nonnull String feedId)
      Reads the specified presence feed that was created. The feed returned includes the user presence statuses that have changed since they were last read. readPresenceFeed(String)
      Specified by:
      readPresenceFeed in interface OboPresenceService
      Parameters:
      feedId - The presence feed id to be read.
      Returns:
      The list of user presences has changed since the last presence read.
      See Also:
    • deletePresenceFeed

      public String deletePresenceFeed(@Nonnull String feedId)
      Delete the specified presence feed that was created. deletePresenceFeed(String)
      Specified by:
      deletePresenceFeed in interface OboPresenceService
      Parameters:
      feedId - The presence feed id to be deleted.
      Returns:
      The id of the deleted presence feed.
    • setUserPresence

      public V2Presence setUserPresence(@Nonnull Long userId, @Nonnull PresenceStatus status, @Nullable Boolean soft)
      Set the presence state of a another user. setUserPresence(Long, PresenceStatus, Boolean)
      Specified by:
      setUserPresence in interface OboPresenceService
      Parameters:
      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)
      Returns:
      The presence info of the specified user.