mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-30 08:21:23 +00:00
99 lines
4.0 KiB
HTML
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> > <a href="index.source.html" class="el_package">org.kohsuke.github</a> > <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 = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
|
|
justification = "JSON API")
|
|
<span class="fc" id="L20">public abstract class GHHook extends GHObject {</span>
|
|
String name;
|
|
List<String> events;
|
|
boolean active;
|
|
Map<String, String> config;
|
|
|
|
/**
|
|
* Gets name.
|
|
*
|
|
* @return the name
|
|
*/
|
|
public String getName() {
|
|
<span class="fc" id="L32"> return name;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets events.
|
|
*
|
|
* @return the events
|
|
*/
|
|
public EnumSet<GHEvent> getEvents() {
|
|
<span class="fc" id="L41"> EnumSet<GHEvent> 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("*") ? 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<String, String> getConfig() {
|
|
<span class="fc" id="L63"> return Collections.unmodifiableMap(config);</span>
|
|
}
|
|
|
|
/**
|
|
* Ping.
|
|
*
|
|
* @throws IOException
|
|
* the io exception
|
|
* @see <a href="https://developer.github.com/v3/repos/hooks/#ping-a-hook">Ping hook</a>
|
|
*/
|
|
public void ping() throws IOException {
|
|
<span class="fc" id="L74"> getRoot().createRequest().method("POST").withUrlPath(getApiRoute() + "/pings").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("DELETE").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> |