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

99 lines
4.0 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>GHHook.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">GHHook.java</span></div><h1>GHHook.java</h1><pre class="source lang-java linenums">package org.kohsuke.github;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.kohsuke.github.internal.EnumUtils;
import java.io.IOException;
import java.net.URL;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
/**
* The type GHHook.
*
* @author Kohsuke Kawaguchi
*/
@SuppressFBWarnings(value = { &quot;UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD&quot;, &quot;UWF_UNWRITTEN_FIELD&quot;, &quot;NP_UNWRITTEN_FIELD&quot; },
justification = &quot;JSON API&quot;)
<span class="fc" id="L20">public abstract class GHHook extends GHObject {</span>
String name;
List&lt;String&gt; events;
boolean active;
Map&lt;String, String&gt; config;
/**
* Gets name.
*
* @return the name
*/
public String getName() {
<span class="fc" id="L32"> return name;</span>
}
/**
* Gets events.
*
* @return the events
*/
public EnumSet&lt;GHEvent&gt; getEvents() {
<span class="fc" id="L41"> EnumSet&lt;GHEvent&gt; s = EnumSet.noneOf(GHEvent.class);</span>
<span class="fc bfc" id="L42" title="All 2 branches covered."> for (String e : events) {</span>
<span class="pc bpc" id="L43" title="1 of 2 branches missed."> s.add(e.equals(&quot;*&quot;) ? GHEvent.ALL : EnumUtils.getEnumOrDefault(GHEvent.class, e, GHEvent.UNKNOWN));</span>
<span class="fc" id="L44"> }</span>
<span class="fc" id="L45"> return s;</span>
}
/**
* Is active boolean.
*
* @return the boolean
*/
public boolean isActive() {
<span class="fc" id="L54"> return active;</span>
}
/**
* Gets config.
*
* @return the config
*/
public Map&lt;String, String&gt; getConfig() {
<span class="fc" id="L63"> return Collections.unmodifiableMap(config);</span>
}
/**
* Ping.
*
* @throws IOException
* the io exception
* @see &lt;a href=&quot;https://developer.github.com/v3/repos/hooks/#ping-a-hook&quot;&gt;Ping hook&lt;/a&gt;
*/
public void ping() throws IOException {
<span class="fc" id="L74"> getRoot().createRequest().method(&quot;POST&quot;).withUrlPath(getApiRoute() + &quot;/pings&quot;).send();</span>
<span class="fc" id="L75"> }</span>
/**
* Deletes this hook.
*
* @throws IOException
* the io exception
*/
public void delete() throws IOException {
<span class="fc" id="L84"> getRoot().createRequest().method(&quot;DELETE&quot;).withUrlPath(getApiRoute()).send();</span>
<span class="fc" id="L85"> }</span>
/**
* @deprecated This object has no HTML URL.
*/
@Override
public URL getHtmlUrl() {
<span class="nc" id="L92"> return null;</span>
}
abstract GitHub getRoot();
abstract String getApiRoute();
}
</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>