Skip to content
This repository was archived by the owner on Jun 2, 2023. It is now read-only.

Commit 65bbf8f

Browse files
authored
Merge pull request #56 from golangci/feature/return-repo-language-in-list
return repo language in repo list
2 parents 20c9a0a + a495764 commit 65bbf8f

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

pkg/app/providers/implementations/github.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ func parseGithubRepository(r *github.Repository, root bool) *provider.Repo {
9797
DefaultBranch: r.GetDefaultBranch(),
9898
Source: source,
9999
StargazersCount: r.GetStargazersCount(),
100+
Language: r.GetLanguage(),
100101
}
101102
}
102103

pkg/app/providers/provider/models.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Repo struct {
1919
Source *Repo
2020

2121
StargazersCount int
22+
Language string
2223
}
2324

2425
type Branch struct {

pkg/app/returntypes/returntypes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type RepoInfo struct {
2020
IsPrivate bool `json:"isPrivate,omitempty"`
2121
IsCreating bool `json:"isCreating,omitempty"`
2222
IsDeleting bool `json:"isDeleting,omitempty"`
23+
Language string `json:"language,omitempty"`
2324
}
2425

2526
type WrappedRepoInfo struct {

pkg/app/services/repo/service.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ func (s BasicService) List(rc *request.AuthorizedContext, req *listRequest) (*re
329329
Organization: strings.Split(pr.Name, "/")[0],
330330
IsAdmin: pr.IsAdmin,
331331
IsPrivate: pr.IsPrivate,
332+
Language: pr.Language,
332333
}
333334

334335
if ar, ok := activatedRepos[pr.ID]; pr.ID != 0 && ok {
@@ -354,7 +355,7 @@ func (s BasicService) List(rc *request.AuthorizedContext, req *listRequest) (*re
354355

355356
func (s BasicService) fetchProviderReposCached(rc *request.AuthorizedContext, useCache bool, p provider.Provider) ([]provider.Repo, error) {
356357
const maxPages = 20
357-
key := fmt.Sprintf("repos/%s/fetch?user_id=%d&maxPage=%d&v=4", p.Name(), rc.Auth.UserID, maxPages)
358+
key := fmt.Sprintf("repos/%s/fetch?user_id=%d&maxPage=%d&v=5", p.Name(), rc.Auth.UserID, maxPages)
358359
if rc.Auth.PrivateAccessToken != "" {
359360
key += "&private=true"
360361
}

0 commit comments

Comments
 (0)