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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceProvides methods for validating the permissions to watch / unwatch space / content / labels. -
Method Summary
Modifier and TypeMethodDescriptionfindUsersWatchingContentPaginated(ContentId contentId, PageRequest pageRequest) Returns a paginated list of Users watching the given Content identified by contentId.findUsersWatchingSpacePaginated(String spaceKey, PageRequest pageRequest) Returns a paginated list of Users watching the given Space identified by spaceKey.booleanisWatchingContent(com.atlassian.sal.api.user.UserKey userKey, ContentId contentId) booleanisWatchingSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey) booleanisWatchingSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey, ContentType contentType) voidunwatchContent(com.atlassian.sal.api.user.UserKey userKey, ContentId contentId) Remove a watch to the givencontentvoidunwatchSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey) Remove a watch to the givenspacevoidunwatchSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey, List<ContentType> contentTypes) Remove a watch to the givenspaceGet the validator of theWatchService.watchContent(com.atlassian.sal.api.user.UserKey userKey, ContentId contentId) Create a watch to the givencontent@NonNull SpaceWatchwatchSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey) Create a watch to the givenspace@NonNull SpaceWatchwatchSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey, List<ContentType> contentTypes) Create a watch to the givenspace
-
Method Details
-
isWatchingSpace
boolean isWatchingSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey, ContentType contentType) - Parameters:
userKey- the watcherspaceKey- the key of the space to checkcontentType- the content type- Returns:
- whether the user is watching the specific content type in the given
spaceor 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 givenspace- Parameters:
userKey- the key of the user to add as a watcherspaceKey- the key of the space to add the watch forcontentTypes- the content types to remove the watch for, currently onlyContentType.BLOG_POSTis supported if supplied- Since:
- 6.8.0
-
watchSpace
Create a watch to the givenspace- Parameters:
userKey- the key of the user to add as a watcherspaceKey- 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 givenspace- Parameters:
userKey- the key of the user to add as a watcherspaceKey- the key of the space to remove the watch forcontentTypes- the content type to remove the watch for, currently onlyContentType.BLOG_POSTis supported if supplied- Since:
- 6.8.0
-
unwatchSpace
Remove a watch to the givenspace- Parameters:
userKey- the key of the user to add as a watcherspaceKey- the key of the space to remove the watch for
-
isWatchingSpace
- Parameters:
userKey- the watcherspaceKey- the key of the space to check- Returns:
- whether the user is watching the given
spaceor not
-
watchContent
Create a watch to the givencontent- Parameters:
userKey- the key of the user to add as a watchercontentId- the id of the content to add the watch for
-
unwatchContent
Remove a watch to the givencontent- Parameters:
userKey- the key of the user to add as a watchercontentId- the id of the content to remove the watch for
-
isWatchingContent
- Parameters:
userKey- the watchercontentId- the id of the content to check- Returns:
- whether the user is watching the given
contentor not
-
findUsersWatchingSpacePaginated
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
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
WatchService.Validator validator()Get the validator of theWatchService.- Returns:
- a Validator that can be used to validate service requests.
-