mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-04 00:11:24 +00:00
223 lines
6.8 KiB
HTML
223 lines
6.8 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>GHMilestone.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">GitHub API for Java</a> > <a href="index.source.html" class="el_package">org.kohsuke.github</a> > <span class="el_source">GHMilestone.java</span></div><h1>GHMilestone.java</h1><pre class="source lang-java linenums">package org.kohsuke.github;
|
|
|
|
import java.io.IOException;
|
|
import java.net.URL;
|
|
import java.util.Date;
|
|
import java.util.Locale;
|
|
|
|
/**
|
|
* The type GHMilestone.
|
|
*
|
|
* @author Yusuke Kokubo
|
|
*/
|
|
<span class="fc" id="L13">public class GHMilestone extends GHObject {</span>
|
|
GitHub root;
|
|
GHRepository owner;
|
|
|
|
GHUser creator;
|
|
private String state, due_on, title, description, html_url;
|
|
private int closed_issues, open_issues, number;
|
|
protected String closed_at;
|
|
|
|
/**
|
|
* Gets root.
|
|
*
|
|
* @return the root
|
|
*/
|
|
public GitHub getRoot() {
|
|
<span class="nc" id="L28"> return root;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets owner.
|
|
*
|
|
* @return the owner
|
|
*/
|
|
public GHRepository getOwner() {
|
|
<span class="nc" id="L37"> return owner;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets creator.
|
|
*
|
|
* @return the creator
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public GHUser getCreator() throws IOException {
|
|
<span class="nc" id="L48"> return root.intern(creator);</span>
|
|
}
|
|
|
|
/**
|
|
* Gets due on.
|
|
*
|
|
* @return the due on
|
|
*/
|
|
public Date getDueOn() {
|
|
<span class="pc bpc" id="L57" title="1 of 2 branches missed."> if (due_on == null)</span>
|
|
<span class="nc" id="L58"> return null;</span>
|
|
<span class="fc" id="L59"> return GitHubClient.parseDate(due_on);</span>
|
|
}
|
|
|
|
/**
|
|
* When was this milestone closed?
|
|
*
|
|
* @return the closed at
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public Date getClosedAt() throws IOException {
|
|
<span class="nc" id="L70"> return GitHubClient.parseDate(closed_at);</span>
|
|
}
|
|
|
|
/**
|
|
* Gets title.
|
|
*
|
|
* @return the title
|
|
*/
|
|
public String getTitle() {
|
|
<span class="fc" id="L79"> return title;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets description.
|
|
*
|
|
* @return the description
|
|
*/
|
|
public String getDescription() {
|
|
<span class="fc" id="L88"> return description;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets closed issues.
|
|
*
|
|
* @return the closed issues
|
|
*/
|
|
public int getClosedIssues() {
|
|
<span class="nc" id="L97"> return closed_issues;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets open issues.
|
|
*
|
|
* @return the open issues
|
|
*/
|
|
public int getOpenIssues() {
|
|
<span class="nc" id="L106"> return open_issues;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets number.
|
|
*
|
|
* @return the number
|
|
*/
|
|
public int getNumber() {
|
|
<span class="fc" id="L115"> return number;</span>
|
|
}
|
|
|
|
public URL getHtmlUrl() {
|
|
<span class="nc" id="L119"> return GitHubClient.parseURL(html_url);</span>
|
|
}
|
|
|
|
/**
|
|
* Gets state.
|
|
*
|
|
* @return the state
|
|
*/
|
|
public GHMilestoneState getState() {
|
|
<span class="nc" id="L128"> return Enum.valueOf(GHMilestoneState.class, state.toUpperCase(Locale.ENGLISH));</span>
|
|
}
|
|
|
|
/**
|
|
* Closes this milestone.
|
|
*
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public void close() throws IOException {
|
|
<span class="nc" id="L138"> edit("state", "closed");</span>
|
|
<span class="nc" id="L139"> }</span>
|
|
|
|
/**
|
|
* Reopens this milestone.
|
|
*
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public void reopen() throws IOException {
|
|
<span class="nc" id="L148"> edit("state", "open");</span>
|
|
<span class="nc" id="L149"> }</span>
|
|
|
|
/**
|
|
* Deletes this milestone.
|
|
*
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public void delete() throws IOException {
|
|
<span class="nc" id="L158"> root.createRequest().method("DELETE").withUrlPath(getApiRoute()).send();</span>
|
|
<span class="nc" id="L159"> }</span>
|
|
|
|
private void edit(String key, Object value) throws IOException {
|
|
<span class="fc" id="L162"> root.createRequest().with(key, value).method("PATCH").withUrlPath(getApiRoute()).send();</span>
|
|
<span class="fc" id="L163"> }</span>
|
|
|
|
/**
|
|
* Sets title.
|
|
*
|
|
* @param title
|
|
* the title
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public void setTitle(String title) throws IOException {
|
|
<span class="fc" id="L174"> edit("title", title);</span>
|
|
<span class="fc" id="L175"> }</span>
|
|
|
|
/**
|
|
* Sets description.
|
|
*
|
|
* @param description
|
|
* the description
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public void setDescription(String description) throws IOException {
|
|
<span class="fc" id="L186"> edit("description", description);</span>
|
|
<span class="fc" id="L187"> }</span>
|
|
|
|
/**
|
|
* Sets due on.
|
|
*
|
|
* @param dueOn
|
|
* the due on
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public void setDueOn(Date dueOn) throws IOException {
|
|
<span class="fc" id="L198"> edit("due_on", GitHubClient.printDate(dueOn));</span>
|
|
<span class="fc" id="L199"> }</span>
|
|
|
|
/**
|
|
* Gets api route.
|
|
*
|
|
* @return the api route
|
|
*/
|
|
protected String getApiRoute() {
|
|
<span class="fc" id="L207"> return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/milestones/" + number;</span>
|
|
}
|
|
|
|
/**
|
|
* Wrap gh milestone.
|
|
*
|
|
* @param repo
|
|
* the repo
|
|
* @return the gh milestone
|
|
*/
|
|
public GHMilestone wrap(GHRepository repo) {
|
|
<span class="fc" id="L218"> this.owner = repo;</span>
|
|
<span class="fc" id="L219"> this.root = repo.root;</span>
|
|
<span class="fc" id="L220"> return this;</span>
|
|
}
|
|
}
|
|
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.5.201910111838</span></div></body></html> |