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)
- 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)
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)
}
}

View file

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