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
- func NewFakeCloser(app, method string, body io.ReadCloser) io.ReadCloser
- type APIHandler
- type Apps
- func (a *Apps) CheckAPIKey(next http.Handler) http.HandlerFunc
- 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{}) int64
- func (a *Apps) Setup() error
- type DelugeConfig
- type ExtraConfig
- type LidarrConfig
- type LoggingRoundTripper
- type NZBGetConfig
- type PlexConfig
- type ProwlarrConfig
- type QbitConfig
- type RadarrConfig
- type ReadarrConfig
- type RtorrentConfig
- type SabNZBConfig
- type SonarrConfig
- type TautulliConfig
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) ErrNoProwlarr = fmt.Errorf("configured %s ID not found", starr.Prowlarr) 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") ErrInvalidApp = fmt.Errorf("invalid application configuration provided") )
Errors sent to client web requests.
Functions ¶
func NewFakeCloser ¶ added in v0.4.1
func NewFakeCloser(app, method string, body io.ReadCloser) io.ReadCloser
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:"apiKey" toml:"api_key" xml:"api_key" yaml:"apiKey"` ExKeys []string `json:"extraKeys" toml:"extra_keys" xml:"extra_keys" yaml:"extraKeys"` URLBase string `json:"urlbase" toml:"urlbase" xml:"urlbase" yaml:"urlbase"` MaxBody int `toml:"max_body" xml:"max_body" json:"maxBody"` Serial bool `json:"serial" toml:"serial" xml:"serial" yaml:"serial"` 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"` Prowlarr []*ProwlarrConfig `json:"prowlarr,omitempty" toml:"prowlarr" xml:"prowlarr" yaml:"prowlarr,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"` Rtorrent []*RtorrentConfig `json:"rtorrent,omitempty" toml:"rtorrent" xml:"rtorrent" yaml:"rtorrent,omitempty"` SabNZB []*SabNZBConfig `json:"sabnzbd,omitempty" toml:"sabnzbd" xml:"sabnzbd" yaml:"sabnzbd,omitempty"` NZBGet []*NZBGetConfig `json:"nzbget,omitempty" toml:"nzbget" xml:"nzbget" yaml:"nzbget,omitempty"` Tautulli *TautulliConfig `json:"tautulli,omitempty" toml:"tautulli" xml:"tautulli" yaml:"tautulli,omitempty"` Plex *PlexConfig `json:"plex" toml:"plex" xml:"plex" yaml:"plex"` Router *mux.Router `json:"-" toml:"-" xml:"-" yaml:"-"` mnd.Logger `toml:"-" xml:"-" json:"-"` // contains filtered or unexported fields }
Apps is the input configuration to relay requests to Starr apps.
func (*Apps) CheckAPIKey ¶
func (a *Apps) CheckAPIKey(next http.Handler) http.HandlerFunc
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 DelugeConfig struct { ExtraConfig *deluge.Config *deluge.Deluge `toml:"-" xml:"-" json:"-"` }
func (*DelugeConfig) Enabled ¶ added in v0.4.1
func (c *DelugeConfig) Enabled() bool
Enabled returns true if the instance is enabled and usable.
type ExtraConfig ¶ added in v0.5.2
type LidarrConfig ¶
type LidarrConfig struct { ExtraConfig *starr.Config *lidarr.Lidarr `toml:"-" xml:"-" json:"-"` // contains filtered or unexported fields }
LidarrConfig represents the input data for a Lidarr server.
func (*LidarrConfig) Enabled ¶ added in v0.3.3
func (l *LidarrConfig) Enabled() bool
Enabled returns true if the Lidarr instance is enabled and usable.
type LoggingRoundTripper ¶ added in v0.4.1
type LoggingRoundTripper struct {
// contains filtered or unexported fields
}
LoggingRoundTripper allows us to use a datacounter to log http request data.
func NewMetricsRoundTripper ¶ added in v0.4.1
func NewMetricsRoundTripper(app string, next http.RoundTripper) *LoggingRoundTripper
NewMetricsRoundTripper returns a round tripper to log requests counts and response sizes.
type NZBGetConfig ¶ added in v0.3.2
type NZBGetConfig struct { ExtraConfig *nzbget.Config *nzbget.NZBGet `toml:"-" xml:"-" json:"-"` }
func (*NZBGetConfig) Enabled ¶ added in v0.4.1
func (c *NZBGetConfig) Enabled() bool
Enabled returns true if the instance is enabled and usable.
type PlexConfig ¶ added in v0.4.1
type PlexConfig struct { *plex.Config *plex.Server ExtraConfig }
func (*PlexConfig) Enabled ¶ added in v0.4.1
func (c *PlexConfig) Enabled() bool
Enabled returns true if the server is configured, false otherwise.
type ProwlarrConfig ¶ added in v0.2.5
type ProwlarrConfig struct { ExtraConfig *starr.Config *prowlarr.Prowlarr `toml:"-" xml:"-" json:"-"` // contains filtered or unexported fields }
ProwlarrConfig represents the input data for a Prowlarr server.
func (*ProwlarrConfig) Enabled ¶ added in v0.3.3
func (p *ProwlarrConfig) Enabled() bool
Enabled returns true if the Prowlarr instance is enabled and usable.
type QbitConfig ¶ added in v0.1.13
type QbitConfig struct { ExtraConfig *qbit.Config *qbit.Qbit `toml:"-" xml:"-" json:"-"` }
func (*QbitConfig) Enabled ¶ added in v0.4.1
func (c *QbitConfig) Enabled() bool
Enabled returns true if the instance is enabled and usable.
type RadarrConfig ¶
type RadarrConfig struct { ExtraConfig *starr.Config *radarr.Radarr `toml:"-" xml:"-" json:"-"` // contains filtered or unexported fields }
RadarrConfig represents the input data for a Radarr server.
func (*RadarrConfig) Enabled ¶ added in v0.3.3
func (r *RadarrConfig) Enabled() bool
Enabled returns true if the Radarr instance is enabled and usable.
type ReadarrConfig ¶
type ReadarrConfig struct { ExtraConfig *starr.Config *readarr.Readarr `toml:"-" xml:"-" json:"-"` // contains filtered or unexported fields }
ReadarrConfig represents the input data for a Readarr server.
func (*ReadarrConfig) Enabled ¶ added in v0.3.3
func (r *ReadarrConfig) Enabled() bool
Enabled returns true if the Readarr instance is enabled and usable.
type RtorrentConfig ¶ added in v0.3.2
type RtorrentConfig struct { ExtraConfig *xmlrpc.Client URL string `toml:"url" xml:"url" json:"url"` User string `toml:"user" xml:"user" json:"user"` Pass string `toml:"pass" xml:"pass" json:"pass"` }
func (*RtorrentConfig) Enabled ¶ added in v0.4.1
func (c *RtorrentConfig) Enabled() bool
Enabled returns true if the instance is enabled and usable.
type SabNZBConfig ¶ added in v0.2.0
type SabNZBConfig struct { ExtraConfig *sabnzbd.Config }
func (*SabNZBConfig) Enabled ¶ added in v0.4.1
func (c *SabNZBConfig) Enabled() bool
Enabled returns true if the instance is enabled and usable.
type SonarrConfig ¶
type SonarrConfig struct { *sonarr.Sonarr `toml:"-" xml:"-" json:"-"` ExtraConfig *starr.Config // contains filtered or unexported fields }
SonarrConfig represents the input data for a Sonarr server.
func (*SonarrConfig) Enabled ¶ added in v0.3.3
func (s *SonarrConfig) Enabled() bool
Enabled returns true if the Sonarr instance is enabled and usable.
type TautulliConfig ¶ added in v0.2.0
type TautulliConfig struct { ExtraConfig tautulli.Config }
func (*TautulliConfig) Enabled ¶ added in v0.4.1
func (c *TautulliConfig) Enabled() bool
Enabled returns true if the instance is enabled and usable.