geddit
a convenient abstraction for the reddit.com API in Go
Checkout the godoc page
warning
this is a work in progress!
example
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)
}