mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-11 15:50:17 +00:00
54 lines
3.4 KiB
HTML
54 lines
3.4 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>GHWorkflowsIterable.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">GHWorkflowsIterable.java</span></div><h1>GHWorkflowsIterable.java</h1><pre class="source lang-java linenums">package org.kohsuke.github;
|
|
|
|
import java.net.MalformedURLException;
|
|
import java.util.Iterator;
|
|
|
|
import javax.annotation.Nonnull;
|
|
|
|
/**
|
|
* Iterable for workflows listing.
|
|
*/
|
|
class GHWorkflowsIterable extends PagedIterable<GHWorkflow> {
|
|
private final transient GHRepository owner;
|
|
|
|
private GHWorkflowsPage result;
|
|
|
|
<span class="fc" id="L16"> public GHWorkflowsIterable(GHRepository owner) {</span>
|
|
<span class="fc" id="L17"> this.owner = owner;</span>
|
|
<span class="fc" id="L18"> }</span>
|
|
|
|
@Nonnull
|
|
@Override
|
|
public PagedIterator<GHWorkflow> _iterator(int pageSize) {
|
|
try {
|
|
<span class="fc" id="L24"> GitHubRequest request = owner.getRoot()</span>
|
|
<span class="fc" id="L25"> .createRequest()</span>
|
|
<span class="fc" id="L26"> .withUrlPath(owner.getApiTailUrl("actions/workflows"))</span>
|
|
<span class="fc" id="L27"> .build();</span>
|
|
|
|
<span class="fc" id="L29"> return new PagedIterator<>(</span>
|
|
<span class="fc" id="L30"> adapt(GitHubPageIterator</span>
|
|
<span class="fc" id="L31"> .create(owner.getRoot().getClient(), GHWorkflowsPage.class, request, pageSize)),</span>
|
|
null);
|
|
<span class="nc" id="L33"> } catch (MalformedURLException e) {</span>
|
|
<span class="nc" id="L34"> throw new GHException("Malformed URL", e);</span>
|
|
}
|
|
}
|
|
|
|
protected Iterator<GHWorkflow[]> adapt(final Iterator<GHWorkflowsPage> base) {
|
|
<span class="fc" id="L39"> return new Iterator<GHWorkflow[]>() {</span>
|
|
public boolean hasNext() {
|
|
<span class="fc" id="L41"> return base.hasNext();</span>
|
|
}
|
|
|
|
public GHWorkflow[] next() {
|
|
<span class="fc" id="L45"> GHWorkflowsPage v = base.next();</span>
|
|
<span class="pc bpc" id="L46" title="1 of 2 branches missed."> if (result == null) {</span>
|
|
<span class="fc" id="L47"> result = v;</span>
|
|
}
|
|
<span class="fc" id="L49"> return v.getWorkflows(owner);</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> |