apps

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoTMDB    = fmt.Errorf("TMDB ID must not be empty")
	ErrNoGRID    = fmt.Errorf("GRID ID must not be empty")
	ErrNoTVDB    = fmt.Errorf("TVDB ID must not be empty")
	ErrNoMBID    = fmt.Errorf("MBID ID must not be empty")
	ErrNoRadarr  = fmt.Errorf("configured %s ID not found", Radarr)
	ErrNoSonarr  = fmt.Errorf("configured %s ID not found", Sonarr)
	ErrNoLidarr  = fmt.Errorf("configured %s ID not found", Lidarr)
	ErrNoReadarr = fmt.Errorf("configured %s ID not found", Readarr)
	ErrNotFound  = fmt.Errorf("the request returned an empty payload")
)

Errors sent to client web requests.

Functions

This section is empty.

Types

type APIHandler

type APIHandler func(r *http.Request) (int, interface{})

APIHandler is our custom handler function for APIs.

type App

type App string

App allows safely storing context values.

const (
	Sonarr  App = "sonarr"
	Readarr App = "readarr"
	Radarr  App = "radarr"
	Lidarr  App = "lidarr"
)

Constant for each app to unique identify itself. These strings are also used as a suffix to the /api/ web path.

type Apps

type Apps struct {
	APIKey   string           `json:"api_key" toml:"api_key" xml:"api_key" yaml:"api_key"`
	URLBase  string           `json:"urlbase" toml:"urlbase" xml:"urlbase" yaml:"urlbase"`
	Sonarr   []*SonarrConfig  `json:"sonarr,omitempty" toml:"sonarr" xml:"sonarr" yaml:"sonarr,omitempty"`
	Radarr   []*RadarrConfig  `json:"radarr,omitempty" toml:"radarr" xml:"radarr" yaml:"radarr,omitempty"`
	Lidarr   []*LidarrConfig  `json:"lidarr,omitempty" toml:"lidarr" xml:"lidarr" yaml:"lidarr,omitempty"`
	Readarr  []*ReadarrConfig `json:"readarr,omitempty" toml:"readarr" xml:"readarr" yaml:"readarr,omitempty"`
	Router   *mux.Router      `json:"-" toml:"-" xml:"-" yaml:"-"`
	ErrorLog *log.Logger      `json:"-" toml:"-" xml:"-" yaml:"-"`
}

Apps is the input configuration to relay requests to Starr apps.

func (*Apps) CheckAPIKey

func (a *Apps) CheckAPIKey(next http.Handler) http.Handler

CheckAPIKey drops a 403 if the API key doesn't match, otherwise run next handler.

func (*Apps) HandleAPIpath

func (a *Apps) HandleAPIpath(app App, uri string, api APIHandler, method ...string)

HandleAPIpath makes adding API paths a little cleaner.

func (*Apps) InitHandlers

func (a *Apps) InitHandlers()

InitHandlers activates all our handlers. This is part of the web server init.

func (*Apps) Respond

func (a *Apps) Respond(w http.ResponseWriter, stat int, msg interface{})

Respond sends a standard response to our caller. JSON encoded blobs.

func (*Apps) Setup

func (a *Apps) Setup(timeout time.Duration)

Setup creates request interfaces and sets the timeout for each server. This is part of the config/startup init.

type LidarrConfig

type LidarrConfig struct {
	Name     string
	Interval cnfg.Duration
	*starr.Config
	// contains filtered or unexported fields
}

LidarrConfig represents the input data for a Lidarr server.

type RadarrConfig

type RadarrConfig struct {
	Name     string
	Interval cnfg.Duration
	*starr.Config
	// contains filtered or unexported fields
}

RadarrConfig represents the input data for a Radarr server.

type ReadarrConfig

type ReadarrConfig struct {
	Name     string
	Interval cnfg.Duration
	*starr.Config
	// contains filtered or unexported fields
}

ReadarrConfig represents the input data for a Readarr server.

type SonarrConfig

type SonarrConfig struct {
	Name     string
	Interval cnfg.Duration
	*starr.Config
	// contains filtered or unexported fields
}

SonarrConfig represents the input data for a Sonarr server.

Jump to

Keyboard shortcuts

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