settingspanel

package
v0.0.0-...-5de3a08 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextIDKey          = "setting_id"
	ContextButtonValueKey = "button_value"
	ContextOptionValueKey = "selected_option"
)

Variables

This section is empty.

Functions

func Init

func Init(h *httputils.Handler, panel Panel)

Types

type Panel

type Panel interface {
	Set(userID, settingID string, value interface{}) error
	Print(userID string)
	ToPost(userID string) (*model.Post, error)
	Clear(userID string) error
	URL() string
	GetSettingIDs() []string
}

func NewSettingsPanel

func NewSettingsPanel(settings []Setting, poster bot.Poster, logger bot.Logger, store PanelStore, settingHandler, pluginURL string) Panel

type PanelStore

type PanelStore interface {
	SetPanelPostID(userID string, postIDs string) error
	GetPanelPostID(userID string) (string, error)
	DeletePanelPostID(userID string) error
}

type Setting

type Setting interface {
	Set(userID string, value interface{}) error
	Get(userID string) (interface{}, error)
	GetID() string
	GetDependency() string
	IsDisabled(foreignValue interface{}) bool
	GetTitle() string
	GetDescription() string
	GetSlackAttachments(userID, settingHandler string, disabled bool) (*model.SlackAttachment, error)
}

func NewBoolSetting

func NewBoolSetting(id string, title string, description string, dependsOn string, store SettingStore) Setting

func NewEmptySetting

func NewEmptySetting(id, title, description string) Setting

func NewOptionSetting

func NewOptionSetting(id string, title string, description string, dependsOn string, options []string, store SettingStore) Setting

func NewReadOnlySetting

func NewReadOnlySetting(id string, title string, description string, dependsOn string, store SettingStore) Setting

type SettingStore

type SettingStore interface {
	SetSetting(userID, settingID string, value interface{}) error
	GetSetting(userID, settingID string) (interface{}, error)
}

Jump to

Keyboard shortcuts

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