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 CheckURLs(config *AppsConfig) error
- func NewFakeCloser(app, method string, body io.ReadCloser) io.ReadCloser
- type APIHandler
- type ApiResponse
- type Apps
- type AppsConfig
- type BaseConfig
- type Deluge
- type DelugeConfig
- type ExtraConfig
- type Lidarr
- type LoggingRoundTripper
- type NZBGet
- type NZBGetConfig
- type Plex
- type PlexConfig
- type Prowlarr
- type Qbit
- type QbitConfig
- type Radarr
- type Readarr
- type Rtorrent
- type RtorrentConfig
- type SabNZB
- type SabNZBConfig
- type SeriesSearchItem
- type Sonarr
- type StarrApp
- type StarrConfig
- type Tautulli
- type TautulliConfig
- type Xmission
- 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 CheckURLs ¶ added in v0.9.0
func CheckURLs(config *AppsConfig) error
CheckURLs validates the configuration for each app.
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 ApiResponse ¶ added in v0.9.0
type ApiResponse struct {
// The status always matches the HTTP response.
Status string `json:"status"`
// This message contains the request-specific response payload.
Msg any `json:"message"`
}
ApiResponse is a standard response to our caller. JSON encoded blobs.
type Apps ¶
type Apps struct {
BaseConfig
Lidarr []Lidarr
Radarr []Radarr
Readarr []Readarr
Sonarr []Sonarr
Prowlarr []Prowlarr
Deluge []Deluge
NZBGet []NZBGet
Qbit []Qbit
Rtorrent []Rtorrent
SabNZB []SabNZB
Transmission []Xmission
Tautulli Tautulli
Plex Plex
Router *mux.Router
// contains filtered or unexported fields
}
func New ¶ added in v0.9.0
func New(config *AppsConfig) (*Apps, error)
New creates request interfaces and sets the timeout for each server. This is part of the config/startup init.
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 AppsConfig ¶ added in v0.9.0
type AppsConfig struct {
BaseConfig
Sonarr []StarrConfig `json:"sonarr,omitempty" toml:"sonarr" xml:"sonarr" yaml:"sonarr,omitempty"`
Radarr []StarrConfig `json:"radarr,omitempty" toml:"radarr" xml:"radarr" yaml:"radarr,omitempty"`
Lidarr []StarrConfig `json:"lidarr,omitempty" toml:"lidarr" xml:"lidarr" yaml:"lidarr,omitempty"`
Readarr []StarrConfig `json:"readarr,omitempty" toml:"readarr" xml:"readarr" yaml:"readarr,omitempty"`
Prowlarr []StarrConfig `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" toml:"tautulli" xml:"tautulli" yaml:"tautulli"`
Plex PlexConfig `json:"plex" toml:"plex" xml:"plex" yaml:"plex"`
}
AppsConfig is the input configuration to relay requests to Starr apps.
type BaseConfig ¶ added in v0.9.0
type BaseConfig 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"`
}
type Deluge ¶ added in v0.9.0
type Deluge struct {
DelugeConfig
*deluge.Deluge `json:"-" toml:"-" xml:"-"`
}
type DelugeConfig ¶ added in v0.1.13
type DelugeConfig struct {
ExtraConfig
deluge.Config
}
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"`
}
type Lidarr ¶
type Lidarr struct {
StarrApp `json:"-" toml:"-" xml:"-"`
*lidarr.Lidarr `json:"-" toml:"-" xml:"-"`
}
Lidarr represents the input data for a Lidarr server.
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 NZBGet ¶ added in v0.9.0
type NZBGet struct {
NZBGetConfig
*nzbget.NZBGet `json:"-" toml:"-" xml:"-"`
}
type NZBGetConfig ¶ added in v0.3.2
type NZBGetConfig struct {
ExtraConfig
nzbget.Config
}
type Plex ¶ added in v0.9.0
type Plex struct {
PlexConfig
plex.Server `json:"-" toml:"-" xml:"-"`
}
type PlexConfig ¶ added in v0.4.1
type PlexConfig struct {
plex.Config
ExtraConfig
}
func (*PlexConfig) Enabled ¶ added in v0.4.1
func (c *PlexConfig) Enabled() bool
Enabled returns true if the server is configured, false otherwise.
func (*PlexConfig) Setup ¶ added in v0.4.1
func (c *PlexConfig) Setup(maxBody int) Plex
type Qbit ¶ added in v0.9.0
type Qbit struct {
QbitConfig
*qbit.Qbit `json:"-" toml:"-" xml:"-"`
}
type QbitConfig ¶ added in v0.1.13
type QbitConfig struct {
ExtraConfig
qbit.Config
}
type Rtorrent ¶ added in v0.9.0
type Rtorrent struct {
RtorrentConfig
*xmlrpc.Client `json:"-" toml:"-" xml:"-"`
}
type RtorrentConfig ¶ added in v0.3.2
type RtorrentConfig struct {
ExtraConfig
URL string `json:"url" toml:"url" xml:"url"`
User string `json:"username" toml:"user" xml:"user"`
Pass string `json:"password" toml:"pass" xml:"pass"`
}
type SabNZB ¶ added in v0.9.0
type SabNZB struct {
SabNZBConfig
*sabnzbd.SabNZB `json:"-" toml:"-" xml:"-"`
}
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 SeriesSearchItem ¶ added in v0.9.0
type SeriesSearchItem struct {
ID int64 `json:"id"`
Title string `json:"title"`
First time.Time `json:"first"`
Next time.Time `json:"next"`
Previous time.Time `json:"prev"`
Added time.Time `json:"added"`
Status string `json:"status"`
Path string `json:"path"`
TvDBID int64 `json:"tvdbId"`
Monitored bool `json:"monitored"`
QualityProfileID int64 `json:"qualityId"`
SeasonFolder bool `json:"seasonFolder"`
SeriesType string `json:"seriesType"`
LanguageProfileID int64 `json:"languageProfileId"`
Exists bool `json:"exists"`
Year int `json:"year"`
Score int `json:"score"`
}
type StarrApp ¶ added in v0.9.0
type StarrApp struct {
StarrConfig
// contains filtered or unexported fields
}
type StarrConfig ¶ added in v0.9.0
type StarrConfig struct {
starr.Config
ExtraConfig
}
func (StarrConfig) Enabled ¶ added in v0.9.0
func (s StarrConfig) Enabled() bool
Enabled returns true if the Sonarr instance is enabled and usable.
type Tautulli ¶ added in v0.9.0
type Tautulli struct {
TautulliConfig
*tautulli.Tautulli `json:"-" toml:"-" xml:"-"`
}
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.
func (*TautulliConfig) Setup ¶ added in v0.4.1
func (c *TautulliConfig) Setup(maxBody int) Tautulli
type Xmission ¶ added in v0.9.0
type Xmission struct {
XmissionConfig
*transmissionrpc.Client `json:"-" toml:"-" xml:"-"`
}
type XmissionConfig ¶ added in v0.7.0
type XmissionConfig struct {
URL string `json:"url" toml:"url" xml:"url"`
User string `json:"username" toml:"user" xml:"user"`
Pass string `json:"password" toml:"pass" xml:"pass"`
ExtraConfig
}
XmissionConfig is the Transmission input configuration.
func (XmissionConfig) Enabled ¶ added in v0.7.0
func (x XmissionConfig) Enabled() bool
Enabled returns true if the instance is enabled and usable.