mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-23 08:21:22 +00:00
222 lines
6.8 KiB
HTML
222 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>
|
|
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="L27"> return root;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets owner.
|
|
*
|
|
* @return the owner
|
|
*/
|
|
public GHRepository getOwner() {
|
|
<span class="nc" id="L36"> return owner;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets creator.
|
|
*
|
|
* @return the creator
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public GHUser getCreator() throws IOException {
|
|
<span class="nc" id="L47"> return root.intern(creator);</span>
|
|
}
|
|
|
|
/**
|
|
* Gets due on.
|
|
*
|
|
* @return the due on
|
|
*/
|
|
public Date getDueOn() {
|
|
<span class="pc bpc" id="L56" title="1 of 2 branches missed."> if (due_on == null)</span>
|
|
<span class="nc" id="L57"> return null;</span>
|
|
<span class="fc" id="L58"> 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="L69"> return GitHubClient.parseDate(closed_at);</span>
|
|
}
|
|
|
|
/**
|
|
* Gets title.
|
|
*
|
|
* @return the title
|
|
*/
|
|
public String getTitle() {
|
|
<span class="fc" id="L78"> return title;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets description.
|
|
*
|
|
* @return the description
|
|
*/
|
|
public String getDescription() {
|
|
<span class="fc" id="L87"> return description;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets closed issues.
|
|
*
|
|
* @return the closed issues
|
|
*/
|
|
public int getClosedIssues() {
|
|
<span class="nc" id="L96"> return closed_issues;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets open issues.
|
|
*
|
|
* @return the open issues
|
|
*/
|
|
public int getOpenIssues() {
|
|
<span class="nc" id="L105"> return open_issues;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets number.
|
|
*
|
|
* @return the number
|
|
*/
|
|
public int getNumber() {
|
|
<span class="fc" id="L114"> return number;</span>
|
|
}
|
|
|
|
public URL getHtmlUrl() {
|
|
<span class="nc" id="L118"> return GitHubClient.parseURL(html_url);</span>
|
|
}
|
|
|
|
/**
|
|
* Gets state.
|
|
*
|
|
* @return the state
|
|
*/
|
|
public GHMilestoneState getState() {
|
|
<span class="nc" id="L127"> 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="L137"> edit("state", "closed");</span>
|
|
<span class="nc" id="L138"> }</span>
|
|
|
|
/**
|
|
* Reopens this milestone.
|
|
*
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public void reopen() throws IOException {
|
|
<span class="nc" id="L147"> edit("state", "open");</span>
|
|
<span class="nc" id="L148"> }</span>
|
|
|
|
/**
|
|
* Deletes this milestone.
|
|
*
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public void delete() throws IOException {
|
|
<span class="nc" id="L157"> root.createRequest().method("DELETE").withUrlPath(getApiRoute()).send();</span>
|
|
<span class="nc" id="L158"> }</span>
|
|
|
|
private void edit(String key, Object value) throws IOException {
|
|
<span class="fc" id="L161"> root.createRequest().with(key, value).method("PATCH").withUrlPath(getApiRoute()).send();</span>
|
|
<span class="fc" id="L162"> }</span>
|
|
|
|
/**
|
|
* Sets title.
|
|
*
|
|
* @param title
|
|
* the title
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public void setTitle(String title) throws IOException {
|
|
<span class="fc" id="L173"> edit("title", title);</span>
|
|
<span class="fc" id="L174"> }</span>
|
|
|
|
/**
|
|
* Sets description.
|
|
*
|
|
* @param description
|
|
* the description
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public void setDescription(String description) throws IOException {
|
|
<span class="fc" id="L185"> edit("description", description);</span>
|
|
<span class="fc" id="L186"> }</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="L197"> edit("due_on", GitHubClient.printDate(dueOn));</span>
|
|
<span class="fc" id="L198"> }</span>
|
|
|
|
/**
|
|
* Gets api route.
|
|
*
|
|
* @return the api route
|
|
*/
|
|
protected String getApiRoute() {
|
|
<span class="fc" id="L206"> 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="L217"> this.owner = repo;</span>
|
|
<span class="fc" id="L218"> this.root = repo.root;</span>
|
|
<span class="fc" id="L219"> return this;</span>
|
|
}
|
|
}
|
|
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.7.202105040129</span></div></body></html> |