Interface WatchService

All Known Implementing Classes:
WatchServiceImpl

@ParametersAreNonnullByDefault @ReturnValuesAreNonnullByDefault public interface WatchService
API service for managing content watchers.

A user can watch (subscribe) or unwatch (unsusbscribe) to events happening in a Space, a particular piece of Content or a Label.

It also provides a means for retrieving the effective watchers of a given piece of content. For e.g., if a user is watching a Space, and a Page in that Space is modified, for that page change it needs to produce a list of all watchers (i.e. watchers of that particular page plus watchers of the whole space).

Since:
6.5.0
  • Method Details

    • isWatchingSpace

      boolean isWatchingSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey, ContentType contentType)
      Parameters:
      userKey - the watcher
      spaceKey - the key of the space to check
      contentType - the content type
      Returns:
      whether the user is watching the specific content type in the given space or not
      Since:
      6.8.0
    • watchSpace

      @NonNull SpaceWatch watchSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey, List<ContentType> contentTypes)
      Create a watch to the given space
      Parameters:
      userKey - the key of the user to add as a watcher
      spaceKey - the key of the space to add the watch for
      contentTypes - the content types to remove the watch for, currently only ContentType.BLOG_POST is supported if supplied
      Since:
      6.8.0
    • watchSpace

      @NonNull SpaceWatch watchSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey)
      Create a watch to the given space
      Parameters:
      userKey - the key of the user to add as a watcher
      spaceKey - the key of the space to add the watch for
    • unwatchSpace

      void unwatchSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey, List<ContentType> contentTypes)
      Remove a watch to the given space
      Parameters:
      userKey - the key of the user to add as a watcher
      spaceKey - the key of the space to remove the watch for
      contentTypes - the content type to remove the watch for, currently only ContentType.BLOG_POST is supported if supplied
      Since:
      6.8.0
    • unwatchSpace

      void unwatchSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey)
      Remove a watch to the given space
      Parameters:
      userKey - the key of the user to add as a watcher
      spaceKey - the key of the space to remove the watch for
    • isWatchingSpace

      boolean isWatchingSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey)
      Parameters:
      userKey - the watcher
      spaceKey - the key of the space to check
      Returns:
      whether the user is watching the given space or not
    • watchContent

      ContentWatch watchContent(com.atlassian.sal.api.user.UserKey userKey, ContentId contentId)
      Create a watch to the given content
      Parameters:
      userKey - the key of the user to add as a watcher
      contentId - the id of the content to add the watch for
    • unwatchContent

      void unwatchContent(com.atlassian.sal.api.user.UserKey userKey, ContentId contentId)
      Remove a watch to the given content
      Parameters:
      userKey - the key of the user to add as a watcher
      contentId - the id of the content to remove the watch for
    • isWatchingContent

      boolean isWatchingContent(com.atlassian.sal.api.user.UserKey userKey, ContentId contentId)
      Parameters:
      userKey - the watcher
      contentId - the id of the content to check
      Returns:
      whether the user is watching the given content or not
    • findUsersWatchingSpacePaginated

      PageResponse<User> findUsersWatchingSpacePaginated(String spaceKey, PageRequest pageRequest)
      Returns a paginated list of Users watching the given Space identified by spaceKey. Only a Confluence Administrator or Space Administrator can perform this action.
      Parameters:
      spaceKey - the key of the Space the User is attempting to view.
      pageRequest - the pagination parameters.
      Returns:
      Users watching the given Space.
      Since:
      8.9.0
    • findUsersWatchingContentPaginated

      PageResponse<User> findUsersWatchingContentPaginated(ContentId contentId, PageRequest pageRequest)
      Returns a paginated list of Users watching the given Content identified by contentId. Only a Confluence Administrator or Space Administrator can perform this action.
      Parameters:
      contentId - the id of the Content the User is attempting to view.
      pageRequest - the pagination parameters.
      Returns:
      Users watching the given Content.
      Since:
      8.9.0
    • validator

      Get the validator of the WatchService.
      Returns:
      a Validator that can be used to validate service requests.