Documentation
¶
Index ¶
- func AdminSetup(Admin *admin.Admin)
- type Action
- type ActionArgument
- type ChannelInterface
- type Config
- type Message
- type Notification
- func (notification *Notification) Action(action *Action) error
- func (notification *Notification) AdminSetup(Admin *admin.Admin)
- func (notification *Notification) GetAction(name string) *Action
- func (notification *Notification) GetNotification(user common.User, messageID string, context *core.Context) *QorNotification
- func (notification *Notification) GetNotifications(user common.User, context *core.Context) *NotificationsResult
- func (notification *Notification) GetUnresolvedNotificationsCount(user common.User, context *core.Context) uint
- func (notification *Notification) RegisterChannel(channel ChannelInterface)
- func (notification *Notification) Send(message *Message, context *core.Context) error
- type NotificationsResult
- type Plugin
- type PluginDefaultNotification
- type QorNotification
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdminSetup ¶
Types ¶
type Action ¶
type Action struct {
Name string
Label string
Method string
MessageTypes []string
Resource *admin.Resource
Visible func(data *QorNotification, context *admin.Context) bool
URL func(data *QorNotification, context *admin.Context) string
Handler func(actionArgument *ActionArgument) error
Undo func(actionArgument *ActionArgument) error
FlashMessage func(actionArgument *ActionArgument, succeed bool, isUndo bool) string
}
func (Action) HasMessageType ¶
type ActionArgument ¶
type ActionArgument struct {
Message *QorNotification
Context *admin.Context
Argument interface{}
}
type ChannelInterface ¶
type ChannelInterface interface {
Send(message *Message, context *core.Context) error
GetNotifications(user common.User, results *NotificationsResult, notification *Notification, context *core.Context) error
GetUnresolvedNotificationsCount(user common.User, notification *Notification, context *core.Context) uint
GetNotification(user common.User, notificationID string, notification *Notification, context *core.Context) (*QorNotification, error)
}
type Notification ¶
type Notification struct {
Config *Config
Channels []ChannelInterface `sql:"-"`
Actions []*Action `sql:"-"`
}
func New ¶
func New(config *Config) *Notification
func (*Notification) Action ¶
func (notification *Notification) Action(action *Action) error
func (*Notification) AdminSetup ¶
func (notification *Notification) AdminSetup(Admin *admin.Admin)
func (*Notification) GetAction ¶
func (notification *Notification) GetAction(name string) *Action
func (*Notification) GetNotification ¶
func (notification *Notification) GetNotification(user common.User, messageID string, context *core.Context) *QorNotification
func (*Notification) GetNotifications ¶
func (notification *Notification) GetNotifications(user common.User, context *core.Context) *NotificationsResult
func (*Notification) GetUnresolvedNotificationsCount ¶
func (*Notification) RegisterChannel ¶
func (notification *Notification) RegisterChannel(channel ChannelInterface)
type NotificationsResult ¶
type NotificationsResult struct {
Notification *Notification
Notifications []*QorNotification
Resolved []*QorNotification
}
type Plugin ¶
type Plugin struct {
db.DBNames
plug.EventDispatcher
}
func (*Plugin) OnRegister ¶
func (p *Plugin) OnRegister()
type PluginDefaultNotification ¶
type PluginDefaultNotification struct {
NotificationKey string
}
func (*PluginDefaultNotification) ProvideOptions ¶
func (p *PluginDefaultNotification) ProvideOptions() []string
func (*PluginDefaultNotification) ProvidesOptions ¶
func (p *PluginDefaultNotification) ProvidesOptions(options *plug.Options)
type QorNotification ¶
type QorNotification struct {
aorm.Model
aorm.Timestamps
From bid.BID
To bid.BID
Title string
Body string `sql:"size:65532"`
MessageType string
ResolvedAt *time.Time
}
func (*QorNotification) Actions ¶
func (qorNotification *QorNotification) Actions(context *admin.Context) (actions []*Action)
func (QorNotification) IsResolved ¶
func (qorNotification QorNotification) IsResolved() bool
Source Files
¶
Click to show internal directories.
Click to hide internal directories.