model

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: GPL-3.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateTask

type CreateTask struct {
	Rid string        `json:"rid"`
	Req *base.Request `json:"req"`
	Opt *base.Options `json:"opt"`
}

type CreateTaskBatch added in v1.5.7

type CreateTaskBatch struct {
	Reqs []*base.Request `json:"reqs"`
	Opt  *base.Options   `json:"opt"`
}

type InstallExtension added in v1.4.0

type InstallExtension struct {
	DevMode bool   `json:"devMode"`
	URL     string `json:"url"`
}

type RespCode

type RespCode int
const (
	CodeOk RespCode = 0
	// CodeError is the common error code
	CodeError RespCode = 1000
	// CodeUnauthorized is the error code for unauthorized
	CodeUnauthorized RespCode = 1001
	// CodeInvalidParam is the error code for invalid parameter
	CodeInvalidParam RespCode = 1002
	// CodeTaskNotFound is the error code for task not found
	CodeTaskNotFound RespCode = 2001
)

type Result

type Result[T any] struct {
	Code RespCode `json:"code"`
	Msg  string   `json:"msg"`
	Data T        `json:"data"`
}

func NewErrorResult

func NewErrorResult(msg string, code ...RespCode) *Result[any]

func NewNilResult

func NewNilResult() *Result[any]

func NewOkResult

func NewOkResult[T any](data T) *Result[T]

type StartConfig

type StartConfig struct {
	Network           string                      `json:"network"`
	Address           string                      `json:"address"`
	RefreshInterval   int                         `json:"refreshInterval"`
	Storage           Storage                     `json:"storage"`
	StorageDir        string                      `json:"storageDir"`
	WhiteDownloadDirs []string                    `json:"whiteDownloadDirs"`
	ApiToken          string                      `json:"apiToken"`
	DownloadConfig    *base.DownloaderStoreConfig `json:"downloadConfig"`

	ProductionMode bool

	WebEnable    bool
	WebFS        fs.FS
	WebBasicAuth *WebBasicAuth
}

func (*StartConfig) Init

func (cfg *StartConfig) Init() *StartConfig

type Storage

type Storage string
const (
	StorageMem  Storage = "mem"
	StorageBolt Storage = "bolt"
)

type SwitchExtension added in v1.4.0

type SwitchExtension struct {
	Status bool `json:"status"`
}

type UpdateCheckExtensionResp added in v1.4.0

type UpdateCheckExtensionResp struct {
	NewVersion string `json:"newVersion"`
}

type UpdateExtensionSettings added in v1.4.0

type UpdateExtensionSettings struct {
	Settings map[string]any `json:"settings"`
}

type WebBasicAuth added in v1.3.8

type WebBasicAuth struct {
	Username string
	Password string
}

func (*WebBasicAuth) Authorization added in v1.3.8

func (cfg *WebBasicAuth) Authorization() string

Authorization returns the value of the Authorization header to be used in HTTP requests.

Jump to

Keyboard shortcuts

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