MCPcopy
hub / github.com/gotify/server / GetPlugins

Method GetPlugins

api/plugin.go:63–87  ·  view source on GitHub ↗

GetPlugins returns all plugins a user has. swagger:operation GET /plugin plugin getPlugins Return all plugins. --- consumes: [application/json] produces: [application/json] security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] responses:

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

61// schema:
62// $ref: "#/definitions/Error"
63func (c *PluginAPI) GetPlugins(ctx *gin.Context) {
64 userID := auth.GetUserID(ctx)
65 plugins, err := c.DB.GetPluginConfByUser(userID)
66 if success := successOrAbort(ctx, 500, err); !success {
67 return
68 }
69 result := make([]model.PluginConfExternal, 0)
70 for _, conf := range plugins {
71 if inst, err := c.Manager.Instance(conf.ID); err == nil {
72 info := c.Manager.PluginInfo(conf.ModulePath)
73 result = append(result, model.PluginConfExternal{
74 ID: conf.ID,
75 Name: info.String(),
76 Token: conf.Token,
77 ModulePath: conf.ModulePath,
78 Author: info.Author,
79 Website: info.Website,
80 License: info.License,
81 Enabled: conf.Enabled,
82 Capabilities: inst.Supports().Strings(),
83 })
84 }
85 }
86 ctx.JSON(200, result)
87}
88
89// EnablePlugin enables a plugin.
90// swagger:operation POST /plugin/{id}/enable plugin enablePlugin

Callers 1

Test_GetPluginsMethod · 0.80

Calls 8

GetUserIDFunction · 0.92
successOrAbortFunction · 0.85
InstanceMethod · 0.80
StringMethod · 0.80
StringsMethod · 0.80
GetPluginConfByUserMethod · 0.65
PluginInfoMethod · 0.65
SupportsMethod · 0.65

Tested by 1

Test_GetPluginsMethod · 0.64