mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
Added ghRepo.getBlob(String) method
Signed-off-by: Kanstantsin Shautsou <kanstantsin.sha@gmail.com>
This commit is contained in:
30
src/main/java/org/kohsuke/github/GHBlob.java
Normal file
30
src/main/java/org/kohsuke/github/GHBlob.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
/**
|
||||
* @author Kanstantsin Shautsou
|
||||
* @see <a href="https://developer.github.com/v3/git/blobs/#get-a-blob">Get a blob</a>
|
||||
*/
|
||||
public class GHBlob {
|
||||
private String content, encoding, url, sha;
|
||||
private long size;
|
||||
|
||||
public String getEncoding() {
|
||||
return encoding;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getSha() {
|
||||
return sha;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
}
|
||||
@@ -817,6 +817,14 @@ public class GHRepository extends GHObject {
|
||||
return root.retrieve().to(url, GHTree.class).wrap(root);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://developer.github.com/v3/git/blobs/#get-a-blob">Get a blob</a>
|
||||
*/
|
||||
public GHBlob getBlob(String blobSha) throws IOException {
|
||||
String target = getApiTailUrl("git/blobs/" + blobSha);
|
||||
return root.retrieve().to(target, GHBlob.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a commit object in this repository.
|
||||
*/
|
||||
|
||||
@@ -54,14 +54,14 @@ public class GHTreeEntry {
|
||||
|
||||
|
||||
/**
|
||||
* SHA1 of this object.
|
||||
* SHA1 of this blob object.
|
||||
*/
|
||||
public String getSha() {
|
||||
return sha;
|
||||
}
|
||||
|
||||
/**
|
||||
* API URL to this Git data, such as
|
||||
* API URL to this Git blob data, such as
|
||||
* https://api.github.com/repos/jenkinsci
|
||||
* /jenkins/git/commits/b72322675eb0114363a9a86e9ad5a170d1d07ac0
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user