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

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