-
Notifications
You must be signed in to change notification settings - Fork 1
/
plugin.go
44 lines (34 loc) · 925 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package mock
import "github.com/ambientkit/ambient"
// Plugin represents an Ambient plugin.
type Plugin struct {
*ambient.PluginBase
pluginName string
pluginVersion string
MockGrants []ambient.GrantRequest
MockRoutes func(p *ambient.PluginBase)
}
// NewPlugin returns a new mock plugin.
func NewPlugin(name string, version string) *Plugin {
return &Plugin{
PluginBase: &ambient.PluginBase{},
pluginName: name,
pluginVersion: version,
}
}
// PluginName returns the plugin name.
func (p *Plugin) PluginName() string {
return p.pluginName
}
// PluginVersion returns the plugin version.
func (p *Plugin) PluginVersion() string {
return p.pluginVersion
}
// GrantRequests returns a list of grants requested by the plugin.
func (p *Plugin) GrantRequests() []ambient.GrantRequest {
return p.MockGrants
}
// Routes gets routes for the plugin.
func (p *Plugin) Routes() {
p.MockRoutes(p.PluginBase)
}