mirror of
https://github.com/samsonjs/retrogit.git
synced 2026-04-27 15:07:43 +00:00
Experiment with using the events API.
This commit is contained in:
parent
9097e1508b
commit
7e04770a2f
3 changed files with 9 additions and 7 deletions
1
TODO
1
TODO
|
|
@ -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.
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue