Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on May 1, 2023. It is now read-only.

Commit 0780e10

Browse filesBrowse files
committed
Added ghRepo.getBlob(String) method
Signed-off-by: Kanstantsin Shautsou <kanstantsin.sha@gmail.com>
1 parent 0731f63 commit 0780e10
Copy full SHA for 0780e10

File tree

Expand file treeCollapse file tree

3 files changed

+40
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+40
-2
lines changed
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.kohsuke.github;
2+
3+
/**
4+
* @author Kanstantsin Shautsou
5+
* @see <a href="https://developer.github.com/v3/git/blobs/#get-a-blob">Get a blob</a>
6+
*/
7+
public class GHBlob {
8+
private String content, encoding, url, sha;
9+
private long size;
10+
11+
public String getEncoding() {
12+
return encoding;
13+
}
14+
15+
public String getUrl() {
16+
return url;
17+
}
18+
19+
public String getSha() {
20+
return sha;
21+
}
22+
23+
public long getSize() {
24+
return size;
25+
}
26+
27+
public String getContent() {
28+
return content;
29+
}
30+
}

‎src/main/java/org/kohsuke/github/GHRepository.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHRepository.java
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,14 @@ public GHTree getTreeRecursive(String sha, int recursive) throws IOException {
817817
return root.retrieve().to(url, GHTree.class).wrap(root);
818818
}
819819

820+
/**
821+
* @see <a href="https://developer.github.com/v3/git/blobs/#get-a-blob">Get a blob</a>
822+
*/
823+
public GHBlob getBlob(String blobSha) throws IOException {
824+
String target = getApiTailUrl("git/blobs/" + blobSha);
825+
return root.retrieve().to(target, GHBlob.class);
826+
}
827+
820828
/**
821829
* Gets a commit object in this repository.
822830
*/

‎src/main/java/org/kohsuke/github/GHTreeEntry.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHTreeEntry.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ public String getType() {
5454

5555

5656
/**
57-
* SHA1 of this object.
57+
* SHA1 of this blob object.
5858
*/
5959
public String getSha() {
6060
return sha;
6161
}
6262

6363
/**
64-
* API URL to this Git data, such as
64+
* API URL to this Git blob data, such as
6565
* https://api.github.com/repos/jenkinsci
6666
* /jenkins/git/commits/b72322675eb0114363a9a86e9ad5a170d1d07ac0
6767
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.