Skip to content

Commit

Permalink
feat: retrieve repo additional infos
Browse files Browse the repository at this point in the history
  • Loading branch information
coding-convention committed Nov 9, 2023
1 parent 91df27f commit 15e995b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ public record RepoInfoDto(
@JsonProperty("name") String name,
@JsonProperty("fullName") String fullName,
@JsonProperty("private") Boolean isPrivate,
@JsonProperty("fork") Boolean isFork
@JsonProperty("fork") Boolean isFork,
@JsonProperty("description") String description,
@JsonProperty("languagesUrl") String languagesUrl,
@JsonProperty("stargazersUrl") String stargazersUrl,
@JsonProperty("openIssuesCount") Integer openIssuesCount

) { }

public record UserDto(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ public List<GitHubRepoDto.RepoInfoDto> RequestOrgRepoInfo(String org, String oau
String fullName = node.get("full_name").asText();
Boolean isPrivate = node.get("private").asBoolean();
Boolean isFork = node.get("fork").asBoolean();
String description = node.get("description").asText();
String languages_url = node.get("languages_url").asText();
String stargazers_url = node.get("stargazers_url").asText();
Integer open_issues_count = node.get("open_issues_count").asInt();

GitHubRepoDto.RepoInfoDto repoInfo = new GitHubRepoDto.RepoInfoDto(name, fullName, isPrivate, isFork);
GitHubRepoDto.RepoInfoDto repoInfo = new GitHubRepoDto.RepoInfoDto(name, fullName, isPrivate, isFork, description, languages_url, stargazers_url, open_issues_count);
repoInfoList.add(repoInfo);
}
return repoInfoList;
Expand Down Expand Up @@ -76,13 +80,19 @@ private List<GitHubRepoDto.RepoInfoDto> listUserRepos(String user, String token)

List<GitHubRepoDto.RepoInfoDto> repoInfoList = new ArrayList<>();


for (JsonNode node : responseBody.get("items")) {
String name = node.get("name").asText();
String fullName = node.get("full_name").asText();
Boolean isPrivate = node.get("private").asBoolean();
Boolean isFork = node.get("fork").asBoolean();
String description = node.get("description").asText();
String languages_url = node.get("languages_url").asText();
String stargazers_url = node.get("stargazers_url").asText();
Integer open_issues_count = node.get("open_issues_count").asInt();


GitHubRepoDto.RepoInfoDto repoInfo = new GitHubRepoDto.RepoInfoDto(name, fullName, isPrivate, isFork);
GitHubRepoDto.RepoInfoDto repoInfo = new GitHubRepoDto.RepoInfoDto(name, fullName, isPrivate, isFork, description, languages_url, stargazers_url, open_issues_count);
repoInfoList.add(repoInfo);
}
return repoInfoList;
Expand Down

0 comments on commit 15e995b

Please sign in to comment.