mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-04 08:21:23 +00:00
Add JavaDocs
Do using IntelliJ JavaDocs plugin. Better to have something than nothing.
This commit is contained in:
@@ -32,9 +32,9 @@ import static org.kohsuke.github.Previews.INERTIA;
|
||||
|
||||
/**
|
||||
* A GitHub project.
|
||||
*
|
||||
* @see <a href="https://developer.github.com/v3/projects/">Projects</a>
|
||||
*
|
||||
* @author Martin van Zijl
|
||||
* @see <a href="https://developer.github.com/v3/projects/">Projects</a>
|
||||
*/
|
||||
public class GHProject extends GHObject {
|
||||
protected GitHub root;
|
||||
@@ -54,10 +54,22 @@ public class GHProject extends GHObject {
|
||||
return GitHub.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets root.
|
||||
*
|
||||
* @return the root
|
||||
*/
|
||||
public GitHub getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets owner.
|
||||
*
|
||||
* @return the owner
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public GHObject getOwner() throws IOException {
|
||||
if (owner == null) {
|
||||
try {
|
||||
@@ -75,40 +87,89 @@ public class GHProject extends GHObject {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets owner url.
|
||||
*
|
||||
* @return the owner url
|
||||
*/
|
||||
public URL getOwnerUrl() {
|
||||
return GitHub.parseURL(owner_url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets node id.
|
||||
*
|
||||
* @return the node id
|
||||
*/
|
||||
public String getNode_id() {
|
||||
return node_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets body.
|
||||
*
|
||||
* @return the body
|
||||
*/
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets number.
|
||||
*
|
||||
* @return the number
|
||||
*/
|
||||
public int getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets state.
|
||||
*
|
||||
* @return the state
|
||||
*/
|
||||
public ProjectState getState() {
|
||||
return Enum.valueOf(ProjectState.class, state.toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets creator.
|
||||
*
|
||||
* @return the creator
|
||||
*/
|
||||
public GHUser getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap gh project.
|
||||
*
|
||||
* @param repo
|
||||
* the repo
|
||||
* @return the gh project
|
||||
*/
|
||||
public GHProject wrap(GHRepository repo) {
|
||||
this.owner = repo;
|
||||
this.root = repo.root;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap gh project.
|
||||
*
|
||||
* @param root
|
||||
* the root
|
||||
* @return the gh project
|
||||
*/
|
||||
public GHProject wrap(GitHub root) {
|
||||
this.root = root;
|
||||
return this;
|
||||
@@ -118,26 +179,61 @@ public class GHProject extends GHObject {
|
||||
new Requester(root).withPreview(INERTIA)._with(key, value).method("PATCH").to(getApiRoute());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets api route.
|
||||
*
|
||||
* @return the api route
|
||||
*/
|
||||
protected String getApiRoute() {
|
||||
return "/projects/" + id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets name.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public void setName(String name) throws IOException {
|
||||
edit("name", name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets body.
|
||||
*
|
||||
* @param body
|
||||
* the body
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public void setBody(String body) throws IOException {
|
||||
edit("body", body);
|
||||
}
|
||||
|
||||
/**
|
||||
* The enum ProjectState.
|
||||
*/
|
||||
public enum ProjectState {
|
||||
OPEN, CLOSED
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets state.
|
||||
*
|
||||
* @param state
|
||||
* the state
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public void setState(ProjectState state) throws IOException {
|
||||
edit("state", state.toString().toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* The enum ProjectStateFilter.
|
||||
*/
|
||||
public static enum ProjectStateFilter {
|
||||
ALL, OPEN, CLOSED
|
||||
}
|
||||
@@ -145,6 +241,11 @@ public class GHProject extends GHObject {
|
||||
/**
|
||||
* Set the permission level that all members of the project's organization will have on this project. Only
|
||||
* applicable for organization-owned projects.
|
||||
*
|
||||
* @param permission
|
||||
* the permission
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public void setOrganizationPermission(GHPermissionType permission) throws IOException {
|
||||
edit("organization_permission", permission.toString().toLowerCase());
|
||||
@@ -152,21 +253,48 @@ public class GHProject extends GHObject {
|
||||
|
||||
/**
|
||||
* Sets visibility of the project within the organization. Only applicable for organization-owned projects.
|
||||
*
|
||||
* @param isPublic
|
||||
* the is public
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public void setPublic(boolean isPublic) throws IOException {
|
||||
edit("public", isPublic);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete.
|
||||
*
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public void delete() throws IOException {
|
||||
new Requester(root).withPreview(INERTIA).method("DELETE").to(getApiRoute());
|
||||
}
|
||||
|
||||
/**
|
||||
* List columns paged iterable.
|
||||
*
|
||||
* @return the paged iterable
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHProjectColumn> listColumns() throws IOException {
|
||||
final GHProject project = this;
|
||||
return root.retrieve().withPreview(INERTIA).asPagedIterable(String.format("/projects/%d/columns", id),
|
||||
GHProjectColumn[].class, item -> item.wrap(project));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create column gh project column.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @return the gh project column
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public GHProjectColumn createColumn(String name) throws IOException {
|
||||
return root.retrieve().method("POST").withPreview(INERTIA).with("name", name)
|
||||
.to(String.format("/projects/%d/columns", id), GHProjectColumn.class).wrap(this);
|
||||
|
||||
Reference in New Issue
Block a user