norcalli / reddit

a simple golang reddit api wrapper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reddit

a convenient abstraction for the reddit.com API

Checkout the godoc page

warning

this is a work in progress!

example

package main

import (
	"fmt"

	"github.com/jzelinskie/reddit"
)

// Please don't handle errors this way.
func main() {
	// Login to reddit
	session, _ := reddit.NewLoginSession(
		"novelty_account",
		"password",
		"golang reddit example",
	)

	// Get reddit's default frontpage
	submissions, _ := session.DefaultFrontpage()

	// Get our own personal frontpage
	submissions, _ = session.Frontpage()

	// Upvote the first post
	session.Vote(submissions[0], reddit.UpVote)
}

About

a simple golang reddit api wrapper

License:BSD 3-Clause "New" or "Revised" License