mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-06 00:11:22 +00:00
176 lines
5.6 KiB
HTML
176 lines
5.6 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>GHAsset.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">GHAsset.java</span></div><h1>GHAsset.java</h1><pre class="source lang-java linenums">package org.kohsuke.github;
|
|
|
|
import java.io.IOException;
|
|
import java.net.URL;
|
|
|
|
/**
|
|
* Asset in a release.
|
|
*
|
|
* @see GHRelease#getAssets() GHRelease#getAssets()
|
|
*/
|
|
<span class="fc" id="L11">public class GHAsset extends GHObject {</span>
|
|
GHRepository owner;
|
|
private String name;
|
|
private String label;
|
|
private String state;
|
|
private String content_type;
|
|
private long size;
|
|
private long download_count;
|
|
private String browser_download_url;
|
|
|
|
/**
|
|
* Gets content type.
|
|
*
|
|
* @return the content type
|
|
*/
|
|
public String getContentType() {
|
|
<span class="fc" id="L27"> return content_type;</span>
|
|
}
|
|
|
|
/**
|
|
* Sets content type.
|
|
*
|
|
* @param contentType
|
|
* the content type
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public void setContentType(String contentType) throws IOException {
|
|
<span class="nc" id="L39"> edit("content_type", contentType);</span>
|
|
<span class="nc" id="L40"> this.content_type = contentType;</span>
|
|
<span class="nc" id="L41"> }</span>
|
|
|
|
/**
|
|
* Gets download count.
|
|
*
|
|
* @return the download count
|
|
*/
|
|
public long getDownloadCount() {
|
|
<span class="fc" id="L49"> return download_count;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets label.
|
|
*
|
|
* @return the label
|
|
*/
|
|
public String getLabel() {
|
|
<span class="fc" id="L58"> return label;</span>
|
|
}
|
|
|
|
/**
|
|
* Sets label.
|
|
*
|
|
* @param label
|
|
* the label
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public void setLabel(String label) throws IOException {
|
|
<span class="fc" id="L70"> edit("label", label);</span>
|
|
<span class="fc" id="L71"> this.label = label;</span>
|
|
<span class="fc" id="L72"> }</span>
|
|
|
|
/**
|
|
* Gets name.
|
|
*
|
|
* @return the name
|
|
*/
|
|
public String getName() {
|
|
<span class="fc" id="L80"> return name;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets owner.
|
|
*
|
|
* @return the owner
|
|
*/
|
|
public GHRepository getOwner() {
|
|
<span class="fc" id="L89"> return owner;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets root.
|
|
*
|
|
* @return the root
|
|
*/
|
|
public GitHub getRoot() {
|
|
<span class="nc" id="L98"> return root;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets size.
|
|
*
|
|
* @return the size
|
|
*/
|
|
public long getSize() {
|
|
<span class="fc" id="L107"> return size;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets state.
|
|
*
|
|
* @return the state
|
|
*/
|
|
public String getState() {
|
|
<span class="fc" id="L116"> return state;</span>
|
|
}
|
|
|
|
/**
|
|
* @deprecated This object has no HTML URL.
|
|
*/
|
|
@Override
|
|
public URL getHtmlUrl() {
|
|
<span class="nc" id="L124"> return null;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets browser download url.
|
|
*
|
|
* @return the browser download url
|
|
*/
|
|
public String getBrowserDownloadUrl() {
|
|
<span class="fc" id="L133"> return browser_download_url;</span>
|
|
}
|
|
|
|
private void edit(String key, Object value) throws IOException {
|
|
<span class="fc" id="L137"> root.createRequest().with(key, value).method("PATCH").withUrlPath(getApiRoute()).send();</span>
|
|
<span class="fc" id="L138"> }</span>
|
|
|
|
/**
|
|
* Delete.
|
|
*
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public void delete() throws IOException {
|
|
<span class="fc" id="L147"> root.createRequest().method("DELETE").withUrlPath(getApiRoute()).send();</span>
|
|
<span class="fc" id="L148"> }</span>
|
|
|
|
private String getApiRoute() {
|
|
<span class="fc" id="L151"> return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/releases/assets/" + getId();</span>
|
|
}
|
|
|
|
GHAsset wrap(GHRelease release) {
|
|
<span class="fc" id="L155"> this.owner = release.getOwner();</span>
|
|
<span class="fc" id="L156"> this.root = owner.root;</span>
|
|
<span class="fc" id="L157"> return this;</span>
|
|
}
|
|
|
|
/**
|
|
* Wrap gh asset [ ].
|
|
*
|
|
* @param assets
|
|
* the assets
|
|
* @param release
|
|
* the release
|
|
* @return the gh asset [ ]
|
|
*/
|
|
public static GHAsset[] wrap(GHAsset[] assets, GHRelease release) {
|
|
<span class="nc bnc" id="L170" title="All 2 branches missed."> for (GHAsset aTo : assets) {</span>
|
|
<span class="nc" id="L171"> aTo.wrap(release);</span>
|
|
}
|
|
<span class="nc" id="L173"> return assets;</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> |