From 7e04770a2ffd4cc2518336322d6b944089a861f9 Mon Sep 17 00:00:00 2001 From: Mihai Parparita Date: Sat, 5 Jul 2014 23:18:59 -0700 Subject: [PATCH] Experiment with using the events API. --- TODO | 1 + app/githop.go | 6 +++--- app/templates/index.html | 9 +++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index cceb921..7fee86c 100644 --- a/TODO +++ b/TODO @@ -1 +1,2 @@ - Option to only do this for public repos (repo vs. public_repo scopes) +- Don't use the events API, since only 300 events are supported. diff --git a/app/githop.go b/app/githop.go index c6c7350..9654bd2 100644 --- a/app/githop.go +++ b/app/githop.go @@ -54,13 +54,13 @@ func index(w http.ResponseWriter, r *http.Request) { token, _ := oauth_transport.Exchange(code) oauth_transport.Token = token - gitub_client := github.NewClient(oauth_transport.Client()) - repos, _, err := gitub_client.Repositories.List("", nil) + github_client := github.NewClient(oauth_transport.Client()) + events, _, err := github_client.Activity.ListEventsPerformedByUser("mihaip", false, nil) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - if err := indexTemplate.Execute(w, repos); err != nil { + if err := indexTemplate.Execute(w, events); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) } } diff --git a/app/templates/index.html b/app/templates/index.html index 326dc60..31ae11e 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -8,13 +8,14 @@

GitHop!

- Your repositories: + Events: