Files
github-api/jacoco/org.kohsuke.github/GHIssueBuilder.java.html
2021-06-02 11:09:28 -07:00

103 lines
4.7 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>GHIssueBuilder.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> &gt; <a href="index.source.html" class="el_package">org.kohsuke.github</a> &gt; <span class="el_source">GHIssueBuilder.java</span></div><h1>GHIssueBuilder.java</h1><pre class="source lang-java linenums">package org.kohsuke.github;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* The type GHIssueBuilder.
*
* @author Kohsuke Kawaguchi
*/
public class GHIssueBuilder {
private final GHRepository repo;
private final Requester builder;
<span class="fc" id="L15"> private List&lt;String&gt; labels = new ArrayList&lt;String&gt;();</span>
<span class="fc" id="L16"> private List&lt;String&gt; assignees = new ArrayList&lt;String&gt;();</span>
<span class="fc" id="L18"> GHIssueBuilder(GHRepository repo, String title) {</span>
<span class="fc" id="L19"> this.repo = repo;</span>
<span class="fc" id="L20"> this.builder = repo.root.createRequest().method(&quot;POST&quot;);</span>
<span class="fc" id="L21"> builder.with(&quot;title&quot;, title);</span>
<span class="fc" id="L22"> }</span>
/**
* Sets the main text of an issue, which is arbitrary multi-line text.
*
* @param str
* the str
* @return the gh issue builder
*/
public GHIssueBuilder body(String str) {
<span class="fc" id="L32"> builder.with(&quot;body&quot;, str);</span>
<span class="fc" id="L33"> return this;</span>
}
/**
* Assignee gh issue builder.
*
* @param user
* the user
* @return the gh issue builder
*/
public GHIssueBuilder assignee(GHUser user) {
<span class="pc bpc" id="L44" title="1 of 2 branches missed."> if (user != null)</span>
<span class="fc" id="L45"> assignees.add(user.getLogin());</span>
<span class="fc" id="L46"> return this;</span>
}
/**
* Assignee gh issue builder.
*
* @param user
* the user
* @return the gh issue builder
*/
public GHIssueBuilder assignee(String user) {
<span class="nc bnc" id="L57" title="All 2 branches missed."> if (user != null)</span>
<span class="nc" id="L58"> assignees.add(user);</span>
<span class="nc" id="L59"> return this;</span>
}
/**
* Milestone gh issue builder.
*
* @param milestone
* the milestone
* @return the gh issue builder
*/
public GHIssueBuilder milestone(GHMilestone milestone) {
<span class="pc bpc" id="L70" title="1 of 2 branches missed."> if (milestone != null)</span>
<span class="fc" id="L71"> builder.with(&quot;milestone&quot;, milestone.getNumber());</span>
<span class="fc" id="L72"> return this;</span>
}
/**
* Label gh issue builder.
*
* @param label
* the label
* @return the gh issue builder
*/
public GHIssueBuilder label(String label) {
<span class="pc bpc" id="L83" title="1 of 2 branches missed."> if (label != null)</span>
<span class="fc" id="L84"> labels.add(label);</span>
<span class="fc" id="L85"> return this;</span>
}
/**
* Creates a new issue.
*
* @return the gh issue
* @throws IOException
* the io exception
*/
public GHIssue create() throws IOException {
<span class="fc" id="L96"> return builder.with(&quot;labels&quot;, labels)</span>
<span class="fc" id="L97"> .with(&quot;assignees&quot;, assignees)</span>
<span class="fc" id="L98"> .withUrlPath(repo.getApiTailUrl(&quot;issues&quot;))</span>
<span class="fc" id="L99"> .fetch(GHIssue.class)</span>
<span class="fc" id="L100"> .wrap(repo);</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>