Experiment with using the events API.

This commit is contained in:
Mihai Parparita 2014-07-05 23:18:59 -07:00
parent 9097e1508b
commit 7e04770a2f
3 changed files with 9 additions and 7 deletions

1
TODO
View file

@ -1 +1,2 @@
- Option to only do this for public repos (repo vs. public_repo scopes) - 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.

View file

@ -54,13 +54,13 @@ func index(w http.ResponseWriter, r *http.Request) {
token, _ := oauth_transport.Exchange(code) token, _ := oauth_transport.Exchange(code)
oauth_transport.Token = token oauth_transport.Token = token
gitub_client := github.NewClient(oauth_transport.Client()) github_client := github.NewClient(oauth_transport.Client())
repos, _, err := gitub_client.Repositories.List("", nil) events, _, err := github_client.Activity.ListEventsPerformedByUser("mihaip", false, nil)
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
return return
} }
if err := indexTemplate.Execute(w, repos); err != nil { if err := indexTemplate.Execute(w, events); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
} }
} }

View file

@ -8,13 +8,14 @@
<body> <body>
<h1>GitHop!</h1> <h1>GitHop!</h1>
Your repositories: Events:
<ul> <ul>
{{range .}} {{range .}}
<li> <li>
<a href="https://github.com/{{.FullName}}"> {{.ID}}
{{.FullName}} <pre>
</a> {{printf "%s" .RawPayload}}
</pre>
</li> </li>
{{end}} {{end}}
</ul> </ul>