api

package
v0.0.0-...-abaf21b Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2017 License: GPL-3.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUsernameUnavailable  = errors.New("Username already in use")
	ErrUserNotFound         = errors.New("User does not exist")
	ErrSubscriptionExists   = errors.New("Subscription already exists")
	ErrSubsctiptionNotFound = errors.New("Subscription does not exist")
	ErrSettingNotFound      = errors.New("Setting does not exist")
	ErrCastNotFound         = errors.New("Cast does not exist")
	ErrLabelExists          = errors.New("Label already exists")
)

Functions

func Configure

func Configure(cfg *Config)

func Serve

func Serve()

Types

type APIStore

type APIStore interface {
	Close() error

	GetUser(username string) *User
	GetUsers() []User
	GetUserByToken(token string) *User
	AddUser(user *User) error
	RemoveUser(username string) error
	AddClient(userid uint64, client *Client) error
	AddSubscription(userid, castid uint64) (*User, error)
	RemoveSubscription(userid, castid uint64) (*User, error)

	GetSettings(userid uint64, clientUUID string) []Setting
	SaveSettings(settings []Setting, userid uint64, clientUUID string) error
	RemoveSetting(id, userid uint64) error

	GetCast(id uint64) *Cast
	GetCasts() []Cast
	GetCastsByID(ids []uint64) []Cast
	GetCastByURL(url string) *Cast
	SaveCast(cast *Cast) error

	GetEpisode(id uint64) *Episode
	GetEpisodesByCast(castid uint64) []Episode
	GetEpisodesSince(ts int64, castids []uint64) []Episode
	SaveEpisode(episode *Episode) error
	SaveEpisodes(episodes []Episode) error

	GetEvents(userid, since uint64, excludeUUID string) []Event
	AddEvents(events []Event, userid uint64, clientUUID string) error

	GetLabel(id uint64) *Label
	GetLabels(userid uint64) []Label
	SaveLabel(label *Label, userid uint64) error
	RemoveLabel(id, userid uint64) error
}

func Store

func Store() APIStore

type BoltStore

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

func NewBoltStore

func NewBoltStore(path string) (*BoltStore, error)

func (*BoltStore) AddClient

func (s *BoltStore) AddClient(userid uint64, client *Client) error

func (*BoltStore) AddEvents

func (s *BoltStore) AddEvents(events []Event, userid uint64, clientUUID string) error

func (*BoltStore) AddSubscription

func (s *BoltStore) AddSubscription(userid, castid uint64) (*User, error)

func (*BoltStore) AddUser

func (s *BoltStore) AddUser(user *User) error

func (*BoltStore) Close

func (s *BoltStore) Close() error

func (*BoltStore) GetCast

func (s *BoltStore) GetCast(id uint64) *Cast

func (*BoltStore) GetCastByURL

func (s *BoltStore) GetCastByURL(url string) *Cast

func (*BoltStore) GetCasts

func (s *BoltStore) GetCasts() []Cast

func (*BoltStore) GetCastsByID

func (s *BoltStore) GetCastsByID(ids []uint64) []Cast

func (*BoltStore) GetEpisode

func (s *BoltStore) GetEpisode(id uint64) *Episode

func (*BoltStore) GetEpisodesByCast

func (s *BoltStore) GetEpisodesByCast(castid uint64) []Episode

func (*BoltStore) GetEpisodesSince

func (s *BoltStore) GetEpisodesSince(ts int64, castids []uint64) []Episode

func (*BoltStore) GetEvents

func (s *BoltStore) GetEvents(userid, since uint64, excludeUUID string) []Event

func (*BoltStore) GetLabel

func (s *BoltStore) GetLabel(id uint64) *Label

func (*BoltStore) GetLabels

func (s *BoltStore) GetLabels(userid uint64) []Label

func (*BoltStore) GetSettings

func (s *BoltStore) GetSettings(userid uint64, clientUUID string) []Setting

func (*BoltStore) GetUser

func (s *BoltStore) GetUser(username string) *User

func (*BoltStore) GetUserByToken

func (s *BoltStore) GetUserByToken(token string) *User

func (*BoltStore) GetUsers

func (s *BoltStore) GetUsers() []User

func (*BoltStore) RemoveLabel

func (s *BoltStore) RemoveLabel(id, userid uint64) error

func (*BoltStore) RemoveSetting

func (s *BoltStore) RemoveSetting(id, userid uint64) error

func (*BoltStore) RemoveSubscription

func (s *BoltStore) RemoveSubscription(userid, castid uint64) (*User, error)

func (*BoltStore) RemoveUser

func (s *BoltStore) RemoveUser(username string) error

func (*BoltStore) SaveCast

func (s *BoltStore) SaveCast(cast *Cast) error

func (*BoltStore) SaveEpisode

func (s *BoltStore) SaveEpisode(episode *Episode) error

func (*BoltStore) SaveEpisodes

func (s *BoltStore) SaveEpisodes(episodes []Episode) error

func (*BoltStore) SaveLabel

func (s *BoltStore) SaveLabel(label *Label, userid uint64) error

func (*BoltStore) SaveSettings

func (s *BoltStore) SaveSettings(settings []Setting, userid uint64, clientUUID string) error

type Config

type Config struct {
	Port      int
	Dir       string
	Debug     bool
	LogFormat string

	CrawlInterval          time.Duration
	MaxDownloadConnections int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳