domain

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	Name      string     `json:"name,omitempty"`
	Key       string     `json:"key,omitempty"`
	Scopes    []string   `json:"scopes,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
}

type APIRepo

type APIRepo interface {
	Store(ctx context.Context, key *APIKey) error
	Delete(ctx context.Context, key string) error
	GetKeys(ctx context.Context) ([]APIKey, error)
	Get(ctx context.Context, key string) (*APIKey, error)
}

type Config

type Config struct {
	Version          string
	ConfigPath       string
	Host             string `toml:"host"`
	Port             int    `toml:"port"`
	LogLevel         string `toml:"logLevel"`
	LogPath          string `toml:"logPath"`
	LogMaxSize       int    `toml:"logMaxSize"`
	LogMaxBackups    int    `toml:"logMaxBackups"`
	BaseURL          string `toml:"baseUrl"`
	SessionSecret    string `toml:"sessionSecret"`
	CheckForUpdates  bool   `toml:"checkForUpdates"`
	DatabaseType     string `toml:"databaseType"`
	PostgresHost     string `toml:"postgresHost"`
	PostgresPort     int    `toml:"postgresPort"`
	PostgresDatabase string `toml:"postgresDatabase"`
	PostgresUser     string `toml:"postgresUser"`
	PostgresPass     string `toml:"postgresPass"`
}

type ConfigUpdate

type ConfigUpdate struct {
	Host            *string `json:"host,omitempty"`
	Port            *int    `json:"port,omitempty"`
	LogLevel        *string `json:"log_level,omitempty"`
	LogPath         *string `json:"log_path,omitempty"`
	BaseURL         *string `json:"base_url,omitempty"`
	CheckForUpdates *bool   `json:"check_for_updates,omitempty"`
}

type Notification

type Notification struct {
	ID        int              `json:"id"`
	Name      string           `json:"name"`
	Type      NotificationType `json:"type"`
	Enabled   bool             `json:"enabled"`
	Events    []string         `json:"events"`
	Token     string           `json:"token"`
	APIKey    string           `json:"api_key"`
	Webhook   string           `json:"webhook"`
	Title     string           `json:"title"`
	Icon      string           `json:"icon"`
	Username  string           `json:"username"`
	Host      string           `json:"host"`
	Password  string           `json:"password"`
	Channel   string           `json:"channel"`
	Rooms     string           `json:"rooms"`
	Targets   string           `json:"targets"`
	Devices   string           `json:"devices"`
	CreatedAt time.Time        `json:"created_at"`
	UpdatedAt time.Time        `json:"updated_at"`
}

type NotificationEvent

type NotificationEvent string
const (
	NotificationEventAppUpdateAvailable NotificationEvent = "SERVER_UPDATE_AVAILABLE"
	NotificationEventSyncStarted        NotificationEvent = "SYNC_STARTED"
	NotificationEventSyncSuccess        NotificationEvent = "SYNC_SUCCESS"
	NotificationEventSyncFailed         NotificationEvent = "SYNC_FAILED"
	NotificationEventSyncError          NotificationEvent = "SYNC_ERROR"
	NotificationEventTest               NotificationEvent = "TEST"
)

type NotificationEventArr

type NotificationEventArr []NotificationEvent

type NotificationPayload

type NotificationPayload struct {
	Subject   string
	Message   string
	Event     NotificationEvent
	Timestamp time.Time
}

type NotificationQueryParams

type NotificationQueryParams struct {
	Limit   uint64
	Offset  uint64
	Sort    map[string]string
	Filters struct {
		Indexers   []string
		PushStatus string
	}
	Search string
}

type NotificationRepo

type NotificationRepo interface {
	List(ctx context.Context) ([]Notification, error)
	Find(ctx context.Context, params NotificationQueryParams) ([]Notification, int, error)
	FindByID(ctx context.Context, id int) (*Notification, error)
	Store(ctx context.Context, notification Notification) (*Notification, error)
	Update(ctx context.Context, notification Notification) (*Notification, error)
	Delete(ctx context.Context, notificationID int) error
}

type NotificationSender

type NotificationSender interface {
	Send(event NotificationEvent, payload NotificationPayload) error
	CanSend(event NotificationEvent) bool
}

type NotificationType

type NotificationType string
const (
	NotificationTypeDiscord    NotificationType = "DISCORD"
	NotificationTypeNotifiarr  NotificationType = "NOTIFIARR"
	NotificationTypeIFTTT      NotificationType = "IFTTT"
	NotificationTypeJoin       NotificationType = "JOIN"
	NotificationTypeMattermost NotificationType = "MATTERMOST"
	NotificationTypeMatrix     NotificationType = "MATRIX"
	NotificationTypePushBullet NotificationType = "PUSH_BULLET"
	NotificationTypePushover   NotificationType = "PUSHOVER"
	NotificationTypeRocketChat NotificationType = "ROCKETCHAT"
	NotificationTypeSlack      NotificationType = "SLACK"
	NotificationTypeTelegram   NotificationType = "TELEGRAM"
)

type SyncRepo

type SyncRepo interface {
	// Get etag of sync data.
	// For avoid memory usage, only the etag will be returned.
	GetSyncDataETag(ctx context.Context, apiKey string) (*string, error)
	// Get sync data and etag
	GetSyncDataAndETag(ctx context.Context, apiKey string) ([]byte, *string, error)
	// Create or replace sync data, returns the new etag.
	SetSyncData(ctx context.Context, apiKey string, data []byte) (*string, error)
	// Replace sync data only if the etag matches,
	// returns the new etag if updated, or nil if not.
	SetSyncDataIfMatch(ctx context.Context, apiKey string, etag string, data []byte) (*string, error)
}

type User

type User struct {
	ID       int    `json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type UserRepo

type UserRepo interface {
	GetUserCount(ctx context.Context) (int, error)
	FindByUsername(ctx context.Context, username string) (*User, error)
	Store(ctx context.Context, user User) error
	Update(ctx context.Context, user User) error
}

Jump to

Keyboard shortcuts

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