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
- type XmissionConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoTMDB = errors.New("TMDB ID must not be empty") ErrNoGRID = errors.New("GRID ID must not be empty") ErrNoTVDB = errors.New("TVDB ID must not be empty") ErrNoMBID = errors.New("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 = errors.New("the request returned an empty payload") ErrNonZeroID = errors.New("provided ID must be non-zero") // ErrWrongCount is returned when an app returns the wrong item count. ErrWrongCount = errors.New("wrong item count returned") ErrInvalidApp = errors.New("invalid application configuration provided") ErrRateLimit = errors.New("rate limit reached") )
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 `json:"maxBody" toml:"max_body" xml:"max_body" yaml:"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"` Transmission []*XmissionConfig `json:"transmission,omitempty" toml:"transmission" xml:"transmission" yaml:"transmission,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 `json:"-" toml:"-" xml:"-"` // 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 `json:"-" toml:"-" xml:"-"` }
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 ExtraConfig struct { Name string `json:"name" toml:"name" xml:"name"` Timeout cnfg.Duration `json:"timeout" toml:"timeout" xml:"timeout"` Interval cnfg.Duration `json:"interval" toml:"interval" xml:"interval"` ValidSSL bool `json:"validSsl" toml:"valid_ssl" xml:"valid_ssl"` Deletes int `json:"deletes" toml:"deletes" xml:"deletes"` // contains filtered or unexported fields }
func (*ExtraConfig) DelOK ¶ added in v0.7.0
func (e *ExtraConfig) DelOK() bool
DelOK returns true if the delete limit isn't reached.
type LidarrConfig ¶
type LidarrConfig struct { ExtraConfig *starr.Config *lidarr.Lidarr `json:"-" toml:"-" xml:"-"` // 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 data counter 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 `json:"-" toml:"-" xml:"-"` }
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 `json:"-" toml:"-" xml:"-"` // 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 `json:"-" toml:"-" xml:"-"` }
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 `json:"-" toml:"-" xml:"-"` // 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 `json:"-" toml:"-" xml:"-"` // 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 `json:"url" toml:"url" xml:"url"` User string `json:"user" toml:"user" xml:"user"` Pass string `json:"pass" toml:"pass" xml:"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 `json:"-" toml:"-" xml:"-"` 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.
type XmissionConfig ¶ added in v0.7.0
type XmissionConfig struct { URL string `json:"url" toml:"url" xml:"url"` User string `json:"user" toml:"user" xml:"user"` Pass string `json:"pass" toml:"pass" xml:"pass"` ExtraConfig *transmissionrpc.Client `json:"-" toml:"-" xml:"-"` }
XmissionConfig is the Transmission input configuration.
func (*XmissionConfig) Enabled ¶ added in v0.7.0
func (c *XmissionConfig) Enabled() bool
Enabled returns true if the instance is enabled and usable.