Interface WatchService

  • All Known Implementing Classes:
    WatchServiceImpl

    @ExperimentalApi
    @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 Detail

      • 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