This repository was archived by the owner on Jul 31, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
main/java/org/kohsuke/github
test/java/org/kohsuke/github Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -285,6 +285,18 @@ protected void wrapUp(GHTag[] page) {
285285 };
286286 }
287287
288+ /**
289+ * List languages for the specified repository.
290+ * The value on the right of a language is the number of bytes of code written in that language.
291+ * {
292+ "C": 78769,
293+ "Python": 7769
294+ }
295+ */
296+ public Map <String ,Integer > listLanguages () throws IOException {
297+ return root .retrieve ().to (getApiTailUrl ("languages" ), HashMap .class );
298+ }
299+
288300 public String getOwnerName () {
289301 return owner .login ;
290302 }
Original file line number Diff line number Diff line change @@ -43,4 +43,11 @@ public void listContributors() throws IOException {
4343 private GHRepository getRepository () throws IOException {
4444 return gitHub .getOrganization ("github-api-test-org" ).getRepository ("jenkins" );
4545 }
46+
47+ @ Test
48+ public void listLanguages () throws IOException {
49+ GHRepository r = gitHub .getRepository ("kohsuke/github-api" );
50+ String mainLanguage = r .getLanguage ();
51+ assertTrue (r .listLanguages ().containsKey (mainLanguage ));
52+ }
4653}
You can’t perform that action at this time.
0 commit comments