From dc1225d12df893f437bd41ddbc9222ccc3c4e1ec Mon Sep 17 00:00:00 2001 From: Mihai Parparita Date: Sun, 13 Jul 2014 15:55:24 -0700 Subject: [PATCH] Include all repositories the user has access to, not just those that they own. --- TODO | 9 +++++++-- app/githop.go | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index c1badfa..daaf970 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,13 @@ Notes: - Will need to get/store timezone of user (use https://bitbucket.org/pellepim/jstimezonedetect, use it with time.Location.LoadLocation) - To get digests for non-user owned organizations, will need to list the organizations and their repositories -- What about getting other repositories the user has access to? +- Handle pagination for repository list +- Handle pagination for commit list +- To make a raw HTTP request with the github package: + httpReq, _ := githubClient.NewRequest("GET", "user/teams", nil) + var jsonResp interface{} + githubClient.Do(httpReq, &jsonResp) + log.Printf("response'%s'", jsonResp) Later - Option to only do this for public repos (repo vs. public_repo scopes) - diff --git a/app/githop.go b/app/githop.go index bf71ccb..1b64948 100644 --- a/app/githop.go +++ b/app/githop.go @@ -96,7 +96,9 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { digestStartTime := time.Date(now.Year()-1, now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) digestEndTime := digestStartTime.AddDate(0, 0, 7) - repos, _, err := githubClient.Repositories.List(*user.Login, nil) + // The username parameter must be left blank so that we can get all of the + // repositories the user has access to, not just ones that they own. + repos, _, err := githubClient.Repositories.List("", nil) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return