generated from stscoundrel/go-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpolylinguist.go
29 lines (21 loc) · 915 Bytes
/
polylinguist.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package polylinguist
import (
"fmt"
"github.com/stscoundrel/polylinguist/internal/github"
"github.com/stscoundrel/polylinguist/stats"
)
const DEFAULT_GRAPHQL_URL = "https://api.github.com/graphql"
func getLanguageStats(username string, accessToken string, settings stats.Settings) ([]stats.LanguageStatistic, error) {
repositories, err := github.GetRepositories(username, DEFAULT_GRAPHQL_URL, accessToken)
if err != nil {
fmt.Println(err)
return []stats.LanguageStatistic{}, err
}
return stats.GetTopLanguages(repositories, settings), nil
}
func GetTopLanguages(username string, accessToken string) ([]stats.LanguageStatistic, error) {
return getLanguageStats(username, accessToken, stats.Settings{})
}
func GetTopLanguagesWithSettings(username string, accessToken string, settings stats.Settings) ([]stats.LanguageStatistic, error) {
return getLanguageStats(username, accessToken, settings)
}