autobrr/internal/domain/client.go
Ludvig Lundgren f466657ed4
Fix: Performance issues and sqlite locking (#74)
* fix: performance issues and sqlite locking

* fix: dashboard release stats was reversed

* refactor: open and migrate db

* chore: cleanup
2022-01-11 19:35:27 +01:00

54 lines
1.8 KiB
Go

package domain
import "context"
type DownloadClientRepo interface {
//FindByActionID(actionID int) ([]DownloadClient, error)
List() ([]DownloadClient, error)
FindByID(ctx context.Context, id int32) (*DownloadClient, error)
Store(client DownloadClient) (*DownloadClient, error)
Delete(clientID int) error
}
type DownloadClient struct {
ID int `json:"id"`
Name string `json:"name"`
Type DownloadClientType `json:"type"`
Enabled bool `json:"enabled"`
Host string `json:"host"`
Port int `json:"port"`
SSL bool `json:"ssl"`
Username string `json:"username"`
Password string `json:"password"`
Settings DownloadClientSettings `json:"settings,omitempty"`
}
type DownloadClientSettings struct {
APIKey string `json:"apikey,omitempty"`
Basic BasicAuth `json:"basic,omitempty"`
Rules DownloadClientRules `json:"rules,omitempty"`
}
type DownloadClientRules struct {
Enabled bool `json:"enabled"`
MaxActiveDownloads int `json:"max_active_downloads"`
IgnoreSlowTorrents bool `json:"ignore_slow_torrents"`
DownloadSpeedThreshold int64 `json:"download_speed_threshold"`
}
type BasicAuth struct {
Auth bool `json:"auth,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}
type DownloadClientType string
const (
DownloadClientTypeQbittorrent DownloadClientType = "QBITTORRENT"
DownloadClientTypeDelugeV1 DownloadClientType = "DELUGE_V1"
DownloadClientTypeDelugeV2 DownloadClientType = "DELUGE_V2"
DownloadClientTypeRadarr DownloadClientType = "RADARR"
DownloadClientTypeSonarr DownloadClientType = "SONARR"
DownloadClientTypeLidarr DownloadClientType = "LIDARR"
)