public interface

WatcherService

com.atlassian.bitbucket.watcher.WatcherService

Class Overview

A service for interacting with watchers

Summary

Public Methods
boolean isWatching(IsWatchingRequest request)
Checks if a watcher exists that matches the provided request
@Nonnull Page<Watcher> search(WatcherSearchRequest request, PageRequest pageRequest)
Search for watcher entities matching the criteria in the provided request
boolean unwatch(UnwatchRequest request)
Removes a user as a watcher of the given watchable.
@Nonnull Watcher watch(WatchRequest request)
Adds a new user as a watcher.

Public Methods

public boolean isWatching (IsWatchingRequest request)

Checks if a watcher exists that matches the provided request

Parameters
request a request describing the watcher to match
Returns
  • true if a watcher exists that matches the provided request, false otherwise

@Nonnull public Page<Watcher> search (WatcherSearchRequest request, PageRequest pageRequest)

Search for watcher entities matching the criteria in the provided request

Parameters
request a request describing the watchers to search for
pageRequest the page request
Returns
  • a page of watchers matching the criteria in the provided request

public boolean unwatch (UnwatchRequest request)

Removes a user as a watcher of the given watchable. If the user is not provided the authenticated user is used. If the user is not watching the watchable, this method will have no effect and return false.

Parameters
request a request describing the watcher to delete
Returns
  • true if the watcher existed and was removed, false otherwise

@Nonnull public Watcher watch (WatchRequest request)

Adds a new user as a watcher. If the user is not provided, the authenticated user is used. If the user is already watching the watchable this method will simply return the corresponding watcher instance.

Parameters
request a request describing the watcher to create
Returns
  • the created watcher