mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-04 08:21:23 +00:00
Merge branch 'master' into issue_330_statistics
This commit is contained in:
@@ -1659,6 +1659,44 @@ public class GHRepository extends GHObject {
|
||||
return new GHRepositoryStatistics(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a project for this repository.
|
||||
*/
|
||||
public GHProject createProject(String name, String body) throws IOException {
|
||||
return root.retrieve().method("POST")
|
||||
.withPreview(INERTIA)
|
||||
.with("name", name)
|
||||
.with("body", body)
|
||||
.to(getApiTailUrl("projects"), GHProject.class).wrap(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the projects for this repository.
|
||||
* @param status The status filter (all, open or closed).
|
||||
*/
|
||||
public PagedIterable<GHProject> listProjects(final GHProject.ProjectStateFilter status) throws IOException {
|
||||
return new PagedIterable<GHProject>() {
|
||||
public PagedIterator<GHProject> _iterator(int pageSize) {
|
||||
return new PagedIterator<GHProject>(root.retrieve().withPreview(INERTIA)
|
||||
.with("state", status)
|
||||
.asIterator(getApiTailUrl("projects"), GHProject[].class, pageSize)) {
|
||||
@Override
|
||||
protected void wrapUp(GHProject[] page) {
|
||||
for (GHProject c : page)
|
||||
c.wrap(GHRepository.this);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns open projects for this repository.
|
||||
*/
|
||||
public PagedIterable<GHProject> listProjects() throws IOException {
|
||||
return listProjects(GHProject.ProjectStateFilter.OPEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a Markdown document.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user