Method to mark the thread as read

This commit is contained in:
Kohsuke Kawaguchi
2015-03-22 15:49:37 -07:00
parent 8835b2c745
commit 205950fc5f
3 changed files with 23 additions and 3 deletions

View File

@@ -1,20 +1,23 @@
package org.kohsuke.github;
import java.io.IOException;
import java.util.Date;
/**
* A conversation in the notification API.
*
*
* @see <a href="https://developer.github.com/v3/activity/notifications/">documentation</a>
* @see GHNotificationStream
* @author Kohsuke Kawaguchi
*/
public class GHThread extends GHObject {
private GitHub root;
private GHRepository repository;
private Subject subject;
private String reason;
private boolean unread;
private String last_read_at;
private String url;
static class Subject {
String title;
@@ -54,4 +57,18 @@ public class GHThread extends GHObject {
public String getType() {
return subject.type;
}
/*package*/ GHThread wrap(GitHub root) {
this.root = root;
if (this.repository!=null)
this.repository.wrap(root);
return this;
}
/**
* Marks this thread as read.
*/
public void markAsRead() throws IOException {
new Requester(root).method("PATCH").to(url);
}
}