models.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package plugins
  2. import (
  3. "encoding/json"
  4. )
  5. type PluginLoader interface {
  6. Load(decoder *json.Decoder, pluginDir string) error
  7. }
  8. type PluginBase struct {
  9. Type string `json:"type"`
  10. Name string `json:"name"`
  11. Id string `json:"id"`
  12. Info PluginInfo `json:"info"`
  13. IncludedInAppId string `json:"-"`
  14. PluginDir string `json:"-"`
  15. }
  16. type PluginInfo struct {
  17. Author PluginInfoLink `json:"author"`
  18. Description string `json:"description"`
  19. Links []PluginInfoLink `json:"links"`
  20. Logos PluginLogos `json:"logos"`
  21. Screenshots []PluginScreenshots `json:"screenshots"`
  22. Version string `json:"version"`
  23. Updated string `json:"updated"`
  24. }
  25. type PluginInfoLink struct {
  26. Name string `json:"name"`
  27. Url string `json:"url"`
  28. }
  29. type PluginLogos struct {
  30. Small string `json:"small"`
  31. Large string `json:"large"`
  32. }
  33. type PluginScreenshots struct {
  34. Path string `json:"path"`
  35. Name string `json:"name"`
  36. }
  37. type PluginStaticRoute struct {
  38. Directory string
  39. PluginId string
  40. }
  41. type EnabledPlugins struct {
  42. Panels []*PanelPlugin
  43. DataSources map[string]*DataSourcePlugin
  44. Apps []*AppPlugin
  45. }
  46. func NewEnabledPlugins() EnabledPlugins {
  47. return EnabledPlugins{
  48. Panels: make([]*PanelPlugin, 0),
  49. DataSources: make(map[string]*DataSourcePlugin),
  50. Apps: make([]*AppPlugin, 0),
  51. }
  52. }