reddit

package
v0.0.0-...-3518944 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2017 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSuchStory       = errors.New("Story with the given ID not found")
	ErrInvalidDataFormat = errors.New("Invalid data format")
)
View Source
var (
	HotSource           = "hot"
	NewSource           = "new"
	TopSource           = "top"
	ControversialSource = "controversial"
)
View Source
var (
	SortNew = &Parameter{
		sources: []string{NewSource},
		values:  map[string]string{"sort": "new"},
	}

	SortRising = &Parameter{
		sources: []string{NewSource},
		values:  map[string]string{"sort": "rising"},
	}

	TimeToday = &Parameter{
		sources: []string{TopSource, ControversialSource},
		values:  map[string]string{"t": "today"},
	}

	TimeHour = &Parameter{
		sources: []string{TopSource, ControversialSource},
		values:  map[string]string{"t": "hour"},
	}

	TimeWeek = &Parameter{
		sources: []string{TopSource, ControversialSource},
		values:  map[string]string{"t": "week"},
	}

	TimeMonth = &Parameter{
		sources: []string{TopSource, ControversialSource},
		values:  map[string]string{"t": "month"},
	}

	TimeYear = &Parameter{
		sources: []string{TopSource, ControversialSource},
		values:  map[string]string{"t": "year"},
	}

	TimeAll = &Parameter{
		sources: []string{TopSource, ControversialSource},
		values:  map[string]string{"t": "all"},
	}
)

Functions

func SourceIsValid

func SourceIsValid(source string) bool

func StoryId

func StoryId(url string) string

Types

type App

type App struct {
	Client *httpclient.Client
	// contains filtered or unexported fields
}

func (*App) Clone

func (a *App) Clone(ctx httpclient.Context) *App

func (*App) Stories

func (a *App) Stories(ids36 []string) ([]*Story, error)

func (*App) Story

func (a *App) Story(id36 string) (*Story, error)

func (*App) Subreddit

func (a *App) Subreddit(name string, source string, p *Parameter, after string, before string) (*Listing, error)

type Listing

type Listing struct {
	Stories []*Story
}

func (*Listing) After

func (l *Listing) After() string

func (*Listing) Before

func (l *Listing) Before() string

type Parameter

type Parameter struct {
	// contains filtered or unexported fields
}

type Story

type Story struct {
	Id           string
	Title        string
	Self         bool
	URL          string
	ThumbnailURL string
	Subreddit    string
	Score        int
	NumComments  int
	Author       string
	SelfText     string
	SelfHtml     string
	Nsfw         bool
	Created      time.Time
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL