models

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NewAutobrrService     func() ServiceHealthChecker
	NewBazarrService      func() ServiceHealthChecker
	NewRadarrService      func() ServiceHealthChecker
	NewSonarrService      func() ServiceHealthChecker
	NewLidarrService      func() ServiceHealthChecker
	NewReadarrService     func() ServiceHealthChecker
	NewSabnzbdService     func() ServiceHealthChecker
	NewNzbgetService      func() ServiceHealthChecker
	NewJellyfinService    func() ServiceHealthChecker
	NewUptimeKumaService  func() ServiceHealthChecker
	NewTraefikService     func() ServiceHealthChecker
	NewProwlarrService    func() ServiceHealthChecker
	NewOverseerrService   func() ServiceHealthChecker
	NewPlexService        func() ServiceHealthChecker
	NewTailscaleService   func() ServiceHealthChecker
	NewMaintainerrService func() ServiceHealthChecker
	NewQuiService         func() ServiceHealthChecker
	NewGeneralService     func() ServiceHealthChecker
)

Service creation function types

Functions

func ServiceTypeFromInstanceID added in v0.3.0

func ServiceTypeFromInstanceID(instanceID string) (string, bool)

ServiceTypeFromInstanceID extracts the service type prefix from an instance id like "radarr-1" or "general-myhost".

Types

type Service

type Service struct {
	ID             string `json:"id"`
	Type           string `json:"type"`
	URL            string `json:"url"`
	AccessURL      string `json:"accessUrl,omitempty"` // New field for external access URL
	APIKey         string `json:"apiKey,omitempty"`
	Name           string `json:"name"`
	DisplayName    string `json:"displayName,omitempty"`
	HealthEndpoint string `json:"healthEndpoint,omitempty"`
}

Service represents a configured service instance

type ServiceConfiguration

type ServiceConfiguration struct {
	ID          int64  `json:"-"` // Hide ID from JSON response
	InstanceID  string `json:"instanceId" gorm:"uniqueIndex"`
	DisplayName string `json:"displayName"`
	URL         string `json:"url"`
	APIKey      string `json:"apiKey,omitempty"`
	AccessURL   string `json:"accessUrl,omitempty"`
}

ServiceConfiguration is the database model

type ServiceCreator

type ServiceCreator interface {
	CreateService(serviceType string) ServiceHealthChecker
}

ServiceCreator is responsible for creating service instances

func NewServiceRegistry

func NewServiceRegistry() ServiceCreator

NewServiceRegistry creates a new instance of ServiceRegistry

type ServiceEventType added in v0.3.0

type ServiceEventType string
const (
	ServiceEventHealth   ServiceEventType = "health"
	ServiceEventInternal ServiceEventType = "internal"
)

type ServiceHealth

type ServiceHealth struct {
	Status          string           `json:"status"`
	ResponseTime    int64            `json:"responseTime"`
	LastChecked     time.Time        `json:"lastChecked"`
	Message         string           `json:"message,omitempty"`
	EventType       ServiceEventType `json:"eventType,omitempty"`
	Version         string           `json:"version,omitempty"`
	UpdateAvailable bool             `json:"updateAvailable,omitempty"`
	ServiceID       string           `json:"serviceId"`
	Stats           map[string]any   `json:"stats,omitempty"`
	Details         map[string]any   `json:"details,omitempty"`
}

ServiceHealth represents the health status of a service

type ServiceHealthChecker

type ServiceHealthChecker interface {
	CheckHealth(ctx context.Context, url, apiKey string) (ServiceHealth, int)
}

ServiceHealthChecker defines the interface for service health checking

type ServiceRegistry

type ServiceRegistry struct{}

ServiceRegistry is the default implementation of ServiceCreator

func (*ServiceRegistry) CreateService

func (r *ServiceRegistry) CreateService(serviceType string) ServiceHealthChecker

CreateService returns a new service instance based on the service type

Jump to

Keyboard shortcuts

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