From 15e995bcfc2c7448c580c64229985ec917175d16 Mon Sep 17 00:00:00 2001 From: coding-convention Date: Fri, 10 Nov 2023 03:33:02 +0900 Subject: [PATCH] feat: retrieve repo additional infos --- .../cloud/appDeploy/dto/GitHubRepoDto.java | 7 ++++++- .../appDeploy/service/UserRepoServiceImpl.java | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/kumofactory/cloud/appDeploy/dto/GitHubRepoDto.java b/src/main/java/com/kumofactory/cloud/appDeploy/dto/GitHubRepoDto.java index 9b94f75..fa62fac 100644 --- a/src/main/java/com/kumofactory/cloud/appDeploy/dto/GitHubRepoDto.java +++ b/src/main/java/com/kumofactory/cloud/appDeploy/dto/GitHubRepoDto.java @@ -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( diff --git a/src/main/java/com/kumofactory/cloud/appDeploy/service/UserRepoServiceImpl.java b/src/main/java/com/kumofactory/cloud/appDeploy/service/UserRepoServiceImpl.java index 26d136b..5397d84 100644 --- a/src/main/java/com/kumofactory/cloud/appDeploy/service/UserRepoServiceImpl.java +++ b/src/main/java/com/kumofactory/cloud/appDeploy/service/UserRepoServiceImpl.java @@ -44,8 +44,12 @@ public List 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; @@ -76,13 +80,19 @@ private List listUserRepos(String user, String token) List 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;