MCPcopy
hub / github.com/apache/devlake / registerPluginEndpoints

Function registerPluginEndpoints

backend/server/api/router.go:100–110  ·  view source on GitHub ↗
(r *gin.Engine, basicRes context.BasicRes, pluginName string, apiResources map[string]map[string]plugin.ApiResourceHandler)

Source from the content-addressed store, hash-verified

98}
99
100func registerPluginEndpoints(r *gin.Engine, basicRes context.BasicRes, pluginName string, apiResources map[string]map[string]plugin.ApiResourceHandler) {
101 for resourcePath, resourceHandlers := range apiResources {
102 for method, h := range resourceHandlers {
103 r.Handle(
104 method,
105 fmt.Sprintf("/plugins/%s/%s", pluginName, resourcePath),
106 handlePluginCall(basicRes, pluginName, h),
107 )
108 }
109 }
110}
111
112func handlePluginCall(basicRes context.BasicRes, pluginName string, handler plugin.ApiResourceHandler) func(c *gin.Context) {
113 return func(c *gin.Context) {

Callers 1

RegisterRouterFunction · 0.85

Calls 1

handlePluginCallFunction · 0.85

Tested by

no test coverage detected