api

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupFileInfo

type BackupFileInfo struct {
	Name        string `json:"name"`
	Size        int64  `json:"size"`
	ModTime     string `json:"modTime"`
	DownloadURL string `json:"downloadUrl"`
}

BackupFileInfo represents metadata about a backup file

type BackupRequest

type BackupRequest struct {
	OutputFilename    string            `json:"outputFilename"`
	EncryptRecipients []string          `json:"encryptRecipients"`
	DataTypes         DataTypeSelection `json:"dataTypes"`
}

BackupRequest represents a backup operation request

type Config added in v0.7.0

type Config struct {
	OpenWebUIBaseURL string `json:"openWebUIBaseURL"`
	AgeIdentity      string `json:"ageIdentity"`
	AgeRecipients    string `json:"ageRecipients"`
	Passphrase       string `json:"passphrase"`
}

Config represents the application configuration

type ConfigResponse

type ConfigResponse struct {
	OpenWebUIURL         string   `json:"openWebUIURL"`
	APIKey               string   `json:"apiKey,omitempty"`
	ServerPort           int      `json:"serverPort"`
	BackupsDir           string   `json:"backupsDir"`
	DefaultRecipient     string   `json:"defaultRecipient"`
	DefaultIdentity      string   `json:"defaultIdentity"`
	DefaultAgeIdentity   string   `json:"defaultAgeIdentity,omitempty"`
	DefaultAgeRecipients string   `json:"defaultAgeRecipients,omitempty"`
	AvailableBackups     []string `json:"availableBackups"`
}

ConfigResponse represents the configuration response

type Connection

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

Connection represents a WebSocket connection

type DataTypeSelection

type DataTypeSelection struct {
	Knowledge bool `json:"knowledge"`
	Models    bool `json:"models"`
	Tools     bool `json:"tools"`
	Prompts   bool `json:"prompts"`
	Files     bool `json:"files"`
	Chats     bool `json:"chats"`
	Users     bool `json:"users"`
	Groups    bool `json:"groups"`
	Feedbacks bool `json:"feedbacks"`
}

DataTypeSelection represents the selection of data types for backup/restore

type ErrorResponse added in v0.7.0

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse represents an error response

type GenerateIdentityResponse added in v0.7.0

type GenerateIdentityResponse struct {
	Identity  string `json:"identity"`  // Private key (AGE-SECRET-KEY-...)
	Recipient string `json:"recipient"` // Public key (age1...)
}

GenerateIdentityResponse contains a newly generated age identity pair

type Hub

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

Hub manages WebSocket connections

func NewHub

func NewHub() *Hub

NewHub creates a new WebSocket hub

func (*Hub) Broadcast

func (h *Hub) Broadcast(msg WebSocketMessage)

Broadcast sends a message to all connected clients

func (*Hub) HandleWebSocket

func (h *Hub) HandleWebSocket(c echo.Context) error

HandleWebSocket upgrades HTTP connection to WebSocket

func (*Hub) Run

func (h *Hub) Run()

Run starts the hub's main loop

type OperationManager

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

OperationManager manages concurrent backup and restore operations

func NewOperationManager

func NewOperationManager(hub *Hub) *OperationManager

NewOperationManager creates a new operation manager

func (*OperationManager) GetAll

func (om *OperationManager) GetAll() []OperationStatus

GetAll returns all operations

func (*OperationManager) GetStatus

func (om *OperationManager) GetStatus(id string) (*OperationStatus, error)

GetStatus retrieves the status of an operation

func (*OperationManager) SetOutputFile

func (om *OperationManager) SetOutputFile(id string, outputFile string)

SetOutputFile sets the output file for an operation

func (*OperationManager) StartOperation

func (om *OperationManager) StartOperation(opType string, fn func(progress ProgressCallback) error) (string, error)

StartOperation starts a new async operation and returns its ID

type OperationStartResponse

type OperationStartResponse struct {
	OperationID string `json:"operationId"`
}

OperationStartResponse represents the response when starting an operation

type OperationStatus

type OperationStatus struct {
	ID         string     `json:"id"`
	Type       string     `json:"type"`
	Status     string     `json:"status"`
	Progress   int        `json:"progress"`
	Message    string     `json:"message"`
	StartTime  time.Time  `json:"startTime"`
	EndTime    *time.Time `json:"endTime,omitempty"`
	Error      string     `json:"error,omitempty"`
	OutputFile string     `json:"outputFile,omitempty"`
}

OperationStatus represents the status of an operation

type ProgressCallback

type ProgressCallback func(percent int, message string)

ProgressCallback is a function that receives progress updates

type RestoreRequest

type RestoreRequest struct {
	InputFilename   string            `json:"inputFilename"`
	DecryptIdentity string            `json:"decryptIdentity"`
	DataTypes       DataTypeSelection `json:"dataTypes"`
	Overwrite       bool              `json:"overwrite"`
}

RestoreRequest represents a restore operation request

type Server

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

Server represents the HTTP server

func NewServer

func NewServer(cfg *config.Config) *Server

NewServer creates a new HTTP server instance

func (*Server) Start

func (s *Server) Start() error

Start starts the HTTP server

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop performs graceful shutdown

type UpdateConfigRequest

type UpdateConfigRequest struct {
	OpenWebUIURL string `json:"openWebUIURL,omitempty"`
	APIKey       string `json:"apiKey,omitempty"`
}

UpdateConfigRequest represents a configuration update request

type WebSocketMessage

type WebSocketMessage struct {
	Type    string      `json:"type"`
	Payload interface{} `json:"payload"`
}

WebSocketMessage represents a WebSocket message

Jump to

Keyboard shortcuts

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