mirror of
https://github.com/samsonjs/retrogit.git
synced 2026-04-02 10:45:55 +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)
|
||||
- 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)
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue