Package org.kohsuke.github
Class GHNotificationStream
- java.lang.Object
-
- org.kohsuke.github.GHNotificationStream
-
public class GHNotificationStream extends Object implements Iterable<GHThread>
Listens to GitHub notification stream.This class supports two modes of retrieving notifications that can be controlled via
nonBlocking(boolean)
.In the blocking mode, which is the default, iterator will be infinite. The call to
Iterator.next()
will block until a new notification arrives. This is useful for application that runs perpetually and reacts to notifications.In the non-blocking mode, the iterator will only report the set of notifications initially retrieved from GitHub, then quit. This is useful for a batch application to process the current set of notifications.
- Author:
- Kohsuke Kawaguchi
- See Also:
GitHub#listNotifications()
,GHRepository#listNotifications()
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description GitHub
getRoot()
Deprecated.For access to theGitHub
instance, use a local copy instead of pulling it out of objects.Iterator<GHThread>
iterator()
void
markAsRead()
Mark as read.void
markAsRead(long timestamp)
Marks all the notifications as read.GHNotificationStream
nonBlocking(boolean v)
If set to true,iterator()
will stop iterating instead of blocking and waiting for the updates to arrive.GHNotificationStream
participating(boolean v)
Should the stream be restricted to notifications in which the user is directly participating or mentioned?.GHNotificationStream
read(boolean v)
Should the stream include notifications that are already read?.GHNotificationStream
since(long timestamp)
Since gh notification stream.GHNotificationStream
since(Date dt)
Since gh notification stream.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
read
public GHNotificationStream read(boolean v)
Should the stream include notifications that are already read?.- Parameters:
v
- the v- Returns:
- the gh notification stream
-
participating
public GHNotificationStream participating(boolean v)
Should the stream be restricted to notifications in which the user is directly participating or mentioned?.- Parameters:
v
- the v- Returns:
- the gh notification stream
-
since
public GHNotificationStream since(long timestamp)
Since gh notification stream.- Parameters:
timestamp
- the timestamp- Returns:
- the gh notification stream
-
since
public GHNotificationStream since(Date dt)
Since gh notification stream.- Parameters:
dt
- the dt- Returns:
- the gh notification stream
-
nonBlocking
public GHNotificationStream nonBlocking(boolean v)
If set to true,iterator()
will stop iterating instead of blocking and waiting for the updates to arrive.- Parameters:
v
- the v- Returns:
- the gh notification stream
-
markAsRead
public void markAsRead() throws IOException
Mark as read.- Throws:
IOException
- the io exception
-
markAsRead
public void markAsRead(long timestamp) throws IOException
Marks all the notifications as read.- Parameters:
timestamp
- the timestamp- Throws:
IOException
- the io exception
-
getRoot
@Deprecated public GitHub getRoot()
Deprecated.For access to theGitHub
instance, use a local copy instead of pulling it out of objects.Get the rootGitHub
instance for this object.- Returns:
- the root
GitHub
instance
-
-