-
Notifications
You must be signed in to change notification settings - Fork 2
/
plugin.go
29 lines (26 loc) · 887 Bytes
/
plugin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package plugin
// Plugin is the interface every plugin need to implement
type Plugin interface {
// Enable is called every time a plugin is started. Spawn custom goroutines here for polling, etc.
// It is always called after ^Set.*Handler$
Enable() error
// Disable is called every time a plugin is disabled. Plugins should stop all custom goroutines here.
Disable() error
}
// UserContext is provided when calling New to create a plugin instance for each user
type UserContext struct {
ID uint
Name string
Admin bool
}
// Info is returned by the exported plugin function GetPluginInfo() for identification
// plugins are identified by their ModulePath, gotify will refuse to load plugins with empty ModulePath
type Info struct {
Version string
Author string
Name string
Website string
Description string
License string
ModulePath string
}