org.kohsuke.github.GHIssueCommentQueryBuilder Maven / Gradle / Ivy
package org.kohsuke.github;
import java.util.Date;
// TODO: Auto-generated Javadoc
/**
* Builds a query for listing comments on an issue.
*
* Call various methods that set the filter criteria, then the {@link #list()} method to actually retrieve the comments.
*
*
* GHIssue issue = ...;
* for (GHIssueComment comment : issue.queryComments().since(x).list()) {
* ...
* }
*
*
* @author Yoann Rodiere
* @see GHIssue#queryComments() GHIssue#queryComments()
* @see List issue comments
*/
public class GHIssueCommentQueryBuilder {
private final Requester req;
private final GHIssue issue;
/**
* Instantiates a new GH issue comment query builder.
*
* @param issue
* the issue
*/
GHIssueCommentQueryBuilder(GHIssue issue) {
this.issue = issue;
this.req = issue.root().createRequest().withUrlPath(issue.getIssuesApiRoute() + "/comments");
}
/**
* Only comments created/updated after this date will be returned.
*
* @param date
* the date
* @return the query builder
*/
public GHIssueCommentQueryBuilder since(Date date) {
req.with("since", GitHubClient.printDate(date));
return this;
}
/**
* Only comments created/updated after this timestamp will be returned.
*
* @param timestamp
* the timestamp
* @return the query builder
*/
public GHIssueCommentQueryBuilder since(long timestamp) {
return since(new Date(timestamp));
}
/**
* Lists up the comments with the criteria added so far.
*
* @return the paged iterable
*/
public PagedIterable list() {
return req.toIterable(GHIssueComment[].class, item -> item.wrapUp(issue));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy