Documentation ¶
Overview ¶
Package apps provides the _incoming_ HTTP methods for notifiarr.com integrations. Methods are included for Radarr, Readrr, Lidarr and Sonarr. This library also holds the site API Key and the base HTTP server abstraction used throughout the Notifiarr client application. The configuration should be derived from a config file; a Router and an Error Log logger must also be provided.
Index ¶
- Variables
- type APIHandler
- type Apps
- func (a *Apps) CheckAPIKey(next http.Handler) http.Handler
- func (a *Apps) HandleAPIpath(app starr.App, uri string, api APIHandler, method ...string) *mux.Route
- func (a *Apps) InitHandlers()
- func (a *Apps) Respond(w http.ResponseWriter, stat int, msg interface{})
- func (a *Apps) Setup(timeout time.Duration) error
- type DelugeConfig
- type LidarrConfig
- type QbitConfig
- type RadarrConfig
- type ReadarrConfig
- type SonarrConfig
Constants ¶
This section is empty.
Variables ¶
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", starr.Radarr) ErrNoSonarr = fmt.Errorf("configured %s ID not found", starr.Sonarr) ErrNoLidarr = fmt.Errorf("configured %s ID not found", starr.Lidarr) ErrNoReadarr = fmt.Errorf("configured %s ID not found", starr.Readarr) ErrNotFound = fmt.Errorf("the request returned an empty payload") ErrNonZeroID = fmt.Errorf("provided ID must be non-zero") // ErrWrongCount is returned when an app returns the wrong item count. ErrWrongCount = fmt.Errorf("wrong item count returned") )
Errors sent to client web requests.
Functions ¶
This section is empty.
Types ¶
type APIHandler ¶
APIHandler is our custom handler function for APIs. The powers the middleware procedure that stores the app interface in a request context. And the procedures to save and fetch an app interface into/from a request content.
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"` Deluge []*DelugeConfig `json:"deluge,omitempty" toml:"deluge" xml:"deluge" yaml:"deluge,omitempty"` Qbit []*QbitConfig `json:"qbit,omitempty" toml:"qbit" xml:"qbit" yaml:"qbit,omitempty"` Router *mux.Router `json:"-" toml:"-" xml:"-" yaml:"-"` ErrorLog *log.Logger `json:"-" toml:"-" xml:"-" yaml:"-"` DebugLog *log.Logger `json:"-" toml:"-" xml:"-" yaml:"-"` }
Apps is the input configuration to relay requests to Starr apps.
func (*Apps) CheckAPIKey ¶
CheckAPIKey drops a 403 if the API key doesn't match, otherwise run next handler.
func (*Apps) HandleAPIpath ¶
func (a *Apps) HandleAPIpath(app starr.App, uri string, api APIHandler, method ...string) *mux.Route
HandleAPIpath makes adding APIKey authenticated API paths a little cleaner. An empty App may be passed in, but URI, API and at least one method are required. Automatically adds an id route to routes with an app name. In case you have > 1 of that app.
func (*Apps) InitHandlers ¶
func (a *Apps) InitHandlers()
InitHandlers activates all our handlers. This is part of the web server init.
type DelugeConfig ¶ added in v0.1.13
type LidarrConfig ¶
type LidarrConfig struct { Name string `toml:"name" xml:"name"` Interval cnfg.Duration `toml:"interval" xml:"interval"` StuckItem bool `toml:"stuck_items" xml:"stuck_items"` CheckQ *uint `toml:"check_q" xml:"check_q"` *starr.Config *lidarr.Lidarr Errorf func(string, ...interface{}) `toml:"-" xml:"-"` }
LidarrConfig represents the input data for a Lidarr server.
type QbitConfig ¶ added in v0.1.13
type RadarrConfig ¶
type RadarrConfig struct { Name string `toml:"name" xml:"name"` Interval cnfg.Duration `toml:"interval" xml:"interval"` DisableCF bool `toml:"disable_cf" xml:"disable_cf"` StuckItem bool `toml:"stuck_items" xml:"stuck_items"` CheckQ *uint `toml:"check_q" xml:"check_q"` *starr.Config *radarr.Radarr Errorf func(string, ...interface{}) `toml:"-" xml:"-"` }
RadarrConfig represents the input data for a Radarr server.
type ReadarrConfig ¶
type ReadarrConfig struct { Name string `toml:"name" xml:"name"` Interval cnfg.Duration `toml:"interval" xml:"interval"` StuckItem bool `toml:"stuck_items" xml:"stuck_items"` CheckQ *uint `toml:"check_q" xml:"check_q"` *starr.Config *readarr.Readarr Errorf func(string, ...interface{}) `toml:"-" xml:"-"` }
ReadarrConfig represents the input data for a Readarr server.
type SonarrConfig ¶
type SonarrConfig struct { Name string `toml:"name" xml:"name"` Interval cnfg.Duration `toml:"interval" xml:"interval"` DisableCF bool `toml:"disable_cf" xml:"disable_cf"` StuckItem bool `toml:"stuck_items" xml:"stuck_items"` CheckQ *uint `toml:"check_q" xml:"check_q"` *starr.Config *sonarr.Sonarr Errorf func(string, ...interface{}) `toml:"-" xml:"-"` }
SonarrConfig represents the input data for a Sonarr server.