geddit
Geddit is a convenient abstraction for the reddit.com API in Go.
This library is a WIP.
It should have some API coverage, but does not yet include things like the new OAuth model.
examples
See godoc for OAuth examples.
Here is an example usage of the old, cookie authentication method:
(NOTE: You will be heavily rate-limited by reddit's API when using cookies. Consider switching to OAuth).
package main
import (
"fmt"
"github.com/jzelinskie/geddit"
)
func main() {
session, _ := geddit.NewLoginSession(
"novelty_account",
"password",
"gedditAgent v1",
)
subOpts := geddit.ListingOptions{
Limit: 10,
}
submissions, _ := session.DefaultFrontpage(geddit.DefaultPopularity, subOpts)
submissions, _ = session.Frontpage(geddit.DefaultPopularity, subOpts)
submissions, _ = session.SubredditSubmissions("hockey", geddit.NewSubmissions, subOpts)
for _, s := range submissions {
fmt.Printf("Title: %s\nAuthor: %s\n\n", s.Title, s.Author)
}
session.Vote(submissions[0], geddit.UpVote)
}