golift.io/starr@v1.0.0/sonarr/sonarr.go (about)

     1  package sonarr
     2  
     3  import (
     4  	"strings"
     5  
     6  	"golift.io/starr"
     7  )
     8  
     9  // APIver is the Sonarr API version supported by this library.
    10  const APIver = "v3"
    11  
    12  // Sonarr contains all the methods to interact with a Sonarr server.
    13  type Sonarr struct {
    14  	starr.APIer
    15  }
    16  
    17  // Filter values are integers. Given names for ease of discovery.
    18  // https://github.com/Sonarr/Sonarr/blob/0cb8d93069d6310abd39ee2fe73219e17aa83fe6/src/NzbDrone.Core/History/EpisodeHistory.cs#L34-L41
    19  //
    20  //nolint:lll
    21  const (
    22  	FilterUnknown starr.Filtering = iota
    23  	FilterGrabbed
    24  	FilterSeriesFolderImported
    25  	FilterDownloadFolderImported
    26  	FilterDownloadFailed
    27  	FilterDeleted
    28  	FilterRenamed
    29  	FilterImportFailed
    30  )
    31  
    32  // New returns a Sonarr object used to interact with the Sonarr API.
    33  func New(config *starr.Config) *Sonarr {
    34  	if config.Client == nil {
    35  		config.Client = starr.Client(0, false)
    36  	}
    37  
    38  	config.URL = strings.TrimSuffix(config.URL, "/")
    39  
    40  	return &Sonarr{APIer: config}
    41  }