arr

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrHealthCheck

func ArrHealthCheck(ctx context.Context, s *core.ServiceCore, url, apiKey string, checker HealthChecker) (models.ServiceHealth, int)

ArrHealthCheck provides a common implementation of health checking for *arr services

func BuildQueueDeleteURL

func BuildQueueDeleteURL(baseURL, queueID string, opts QueueDeleteOptions) string

func BuildQueueDeleteURLWithVersion

func BuildQueueDeleteURLWithVersion(baseURL, apiVersion, queueID string, opts QueueDeleteOptions) string

func BuildQueueURL

func BuildQueueURL(baseURL, rawQuery string) string

func BuildQueueURLWithVersion

func BuildQueueURLWithVersion(baseURL, apiVersion, rawQuery string) string

func CheckArrForUpdates

func CheckArrForUpdates(ctx context.Context, service, url, apiKey string) (bool, error)

CheckArrForUpdates provides a common implementation for checking updates using v3 API.

func CheckArrForUpdatesWithVersion

func CheckArrForUpdatesWithVersion(ctx context.Context, service, apiVersion, url, apiKey string) (bool, error)

CheckArrForUpdates provides a common implementation for checking updates

func DeleteQueueItem

func DeleteQueueItem(
	ctx context.Context,
	service, baseURL, apiKey, queueID string,
	options QueueDeleteOptions,
	readBody func(*http.Response) ([]byte, error),
) error

func DeleteQueueItemWithVersion

func DeleteQueueItemWithVersion(
	ctx context.Context,
	service, apiVersion, baseURL, apiKey, queueID string,
	options QueueDeleteOptions,
	readBody func(*http.Response) ([]byte, error),
) error

func ExtractMessageField

func ExtractMessageField(body []byte) string

func FetchQueueBody

func FetchQueueBody(
	ctx context.Context,
	service, baseURL, apiKey, rawQuery string,
	readBody func(*http.Response) ([]byte, error),
) ([]byte, error)

func FetchQueueBodyWithVersion

func FetchQueueBodyWithVersion(
	ctx context.Context,
	service, apiVersion, baseURL, apiKey, rawQuery string,
	readBody func(*http.Response) ([]byte, error),
) ([]byte, error)

func FetchQueueRecords

func FetchQueueRecords[T any](
	ctx context.Context,
	service, baseURL, apiKey, rawQuery string,
	readBody func(*http.Response) ([]byte, error),
) ([]T, error)

func FetchQueueRecordsWithVersion

func FetchQueueRecordsWithVersion[T any](
	ctx context.Context,
	service, apiVersion, baseURL, apiKey, rawQuery string,
	readBody func(*http.Response) ([]byte, error),
) ([]T, error)

func GetArrSystemStatus

func GetArrSystemStatus(
	ctx context.Context,
	service, url, apiKey string,
	getVersionFromCache func(context.Context, string) string,
	cacheVersion func(context.Context, string, string, time.Duration) error,
) (string, error)

GetArrSystemStatus provides a common implementation for getting system status using v3 API.

func GetArrSystemStatusWithVersion

func GetArrSystemStatusWithVersion(
	ctx context.Context,
	service, apiVersion, url, apiKey string,
	getVersionFromCache func(context.Context, string) string,
	cacheVersion func(context.Context, string, string, time.Duration) error,
) (string, error)

GetArrSystemStatus provides a common implementation for getting system status.

func MakeArrRequest

func MakeArrRequest(ctx context.Context, method, url, apiKey string, body []byte) (*http.Response, error)

MakeArrRequest is a helper function to make requests with proper headers

Types

type ErrArr

type ErrArr struct {
	Service  string // Service name (e.g., "radarr", "sonarr")
	Op       string // Operation that failed
	Err      error  // Underlying error
	HttpCode int    // HTTP status code if applicable
}

Custom error type for *arr services

func (*ErrArr) Error

func (e *ErrArr) Error() string

func (*ErrArr) Unwrap

func (e *ErrArr) Unwrap() error

type HealthChecker

type HealthChecker interface {
	GetSystemStatus(ctx context.Context, url, apiKey string) (string, error)
	CheckForUpdates(ctx context.Context, url, apiKey string) (bool, error)
	GetHealthEndpoint(baseURL string) string
}

HealthChecker interface defines methods required for health checking

type HealthResponse

type HealthResponse struct {
	Source  string `json:"source"`
	Type    string `json:"type"`
	Message string `json:"message"`
	WikiURL string `json:"wikiUrl"`
}

HealthResponse represents a common health check response structure

type QueueDeleteOptions

type QueueDeleteOptions struct {
	RemoveFromClient bool
	Blocklist        bool
	SkipRedownload   bool
	ChangeCategory   bool
}

type SystemStatusResponse

type SystemStatusResponse struct {
	Version string `json:"version"`
}

type WarningCategory

type WarningCategory string

WarningCategory represents the category of a warning message

const (
	SystemCategory       WarningCategory = "System"
	DownloadCategory     WarningCategory = "Download"
	IndexerCategory      WarningCategory = "Indexer"
	MediaCategory        WarningCategory = "Media"
	NotificationCategory WarningCategory = "Notification"
	ApplicationCategory  WarningCategory = "Application"
)

type WarningPattern

type WarningPattern struct {
	Pattern  string
	Category WarningCategory
}

WarningPattern represents a known warning pattern and its categorization

Jump to

Keyboard shortcuts

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