Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/main/java/org/kohsuke/github/GHBlob.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
8 changes: 8 additions & 0 deletions src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,14 @@ public GHTree getTreeRecursive(String sha, int recursive) throws IOException {
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.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/kohsuke/github/GHTreeEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ public String getType() {


/**
* 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
*/
Expand Down