clients

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(httpClient *http.Client) *Manager

NewManager creates an arrs client manager. httpClient is shared with every starr.Config, so its Transport (incl. proxy) and Timeout apply to all Radarr/Sonarr/Lidarr/Readarr/Whisparr requests. When nil, a no-proxy 30s default client is used.

func (*Manager) GetOrCreateClient

func (m *Manager) GetOrCreateClient(instance *model.ConfigInstance) (any, error)

GetOrCreateClient is a helper to get or create the appropriate client

func (*Manager) GetOrCreateLidarrClient added in v0.3.0

func (m *Manager) GetOrCreateLidarrClient(instanceName, url, apiKey string) (*lidarr.Lidarr, error)

GetOrCreateLidarrClient gets or creates a Lidarr client for an instance

func (*Manager) GetOrCreateRadarrClient

func (m *Manager) GetOrCreateRadarrClient(instanceName, url, apiKey string) (*radarr.Radarr, error)

GetOrCreateRadarrClient gets or creates a Radarr client for an instance

func (*Manager) GetOrCreateReadarrClient added in v0.3.0

func (m *Manager) GetOrCreateReadarrClient(instanceName, url, apiKey string) (*readarr.Readarr, error)

GetOrCreateReadarrClient gets or creates a Readarr client for an instance

func (*Manager) GetOrCreateSonarrClient

func (m *Manager) GetOrCreateSonarrClient(instanceName, url, apiKey string) (*sonarr.Sonarr, error)

GetOrCreateSonarrClient gets or creates a Sonarr client for an instance

func (*Manager) GetOrCreateSportarrClient added in v0.3.0

func (m *Manager) GetOrCreateSportarrClient(instanceName, url, apiKey string) (*Sportarr, error)

GetOrCreateSportarrClient gets or creates a native Sportarr client for an instance

func (*Manager) GetOrCreateWhisparrClient added in v0.3.0

func (m *Manager) GetOrCreateWhisparrClient(instanceName, url, apiKey string) (*sonarr.Sonarr, error)

GetOrCreateWhisparrClient gets or creates a Whisparr client for an instance (using Sonarr client)

func (*Manager) TestConnection

func (m *Manager) TestConnection(ctx context.Context, instanceType, url, apiKey string) error

TestConnection tests the connection to an arrs instance

type Sportarr added in v0.3.0

type Sportarr struct {
	// contains filtered or unexported fields
}

Sportarr is a thin native HTTP client for Sportarr.

Unlike Sonarr/Radarr/Lidarr/Readarr/Whisparr, Sportarr is NOT driveable through the golift.io/starr library: its /api/v3 surface is a narrow Sonarr-compat shim where only system/status and indexer are real, while /api/v3/queue and /api/v3/command fall through to the SPA. Sportarr's real, JSON-returning API lives at the unversioned /api/* paths (queue, history, pending-imports), so we talk to those directly here.

The main management value AltMount adds for Sportarr is queue cleanup; Sportarr already self-imports finished downloads on its own poll interval.

func NewSportarr added in v0.3.0

func NewSportarr(baseURL, apiKey string, hc *http.Client) *Sportarr

NewSportarr builds a native Sportarr client. The shared *http.Client carries the manager's proxy/timeout configuration.

func (*Sportarr) DeleteQueueItem added in v0.3.0

func (s *Sportarr) DeleteQueueItem(ctx context.Context, id int64) error

DeleteQueueItem removes a queue item, also instructing Sportarr to remove the download from the (AltMount) download client. It does not blocklist.

func (*Sportarr) DeleteQueueItemBlocklist added in v0.3.0

func (s *Sportarr) DeleteQueueItemBlocklist(ctx context.Context, id int64) error

DeleteQueueItemBlocklist removes a queue item and blocklists the release so the same NZB is not grabbed again, prompting Sportarr to search for a replacement.

func (*Sportarr) GetQueue added in v0.3.0

func (s *Sportarr) GetQueue(ctx context.Context) ([]SportarrQueueItem, error)

GetQueue returns the current Sportarr queue. Sportarr's native /api/queue may return either a bare JSON array or a paged object with a "records" array, so we tolerate both shapes.

func (*Sportarr) Health added in v0.3.0

func (s *Sportarr) Health(ctx context.Context) error

Health verifies connectivity using the one /api/v3 endpoint Sportarr implements for real (system/status).

type SportarrQueueItem added in v0.3.0

type SportarrQueueItem struct {
	ID                    int64                  `json:"id"`
	Title                 string                 `json:"title"`
	Status                sportarrStatus         `json:"status"`
	Protocol              string                 `json:"protocol"`
	DownloadClient        sportarrRef            `json:"downloadClient"`
	DownloadID            string                 `json:"downloadId"`
	Indexer               string                 `json:"indexer"`
	OutputPath            string                 `json:"outputPath"`
	TrackedDownloadStatus string                 `json:"trackedDownloadStatus"`
	TrackedDownloadState  string                 `json:"trackedDownloadState"`
	StatusMessages        sportarrStatusMessages `json:"statusMessages"`
}

SportarrQueueItem maps the fields of a Sportarr native queue record that the queue-cleanup worker needs. Field names follow the Servarr convention; unknown fields are ignored by the JSON decoder. status, statusMessages and downloadClient use tolerant types because their wire shapes differ between Sportarr builds and a mismatch would otherwise fail the whole queue decode.

type SportarrStatusMessage added in v0.3.0

type SportarrStatusMessage struct {
	Title    string   `json:"title"`
	Messages []string `json:"messages"`
}

SportarrStatusMessage mirrors the Servarr status-message shape used by the queue-cleanup allowlist matching.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL