MCPcopy Create free account
hub / github.com/OpenSN-Library/OpenSN-Library / AddLinkHandler

Function AddLinkHandler

daemon/pkg/handler/link_handler.go:16–40  ·  view source on GitHub ↗
(ctx *gin.Context)

Source from the content-addressed store, hash-verified

14)
15
16func AddLinkHandler(ctx *gin.Context) {
17 var req ginmodel.AddLinkRequest
18 if err := ctx.Bind(&req); err != nil {
19 jsonResp := ginmodel.JsonResp{
20 Code: -1,
21 Message: fmt.Sprintf("Invalid Request Data: %s", err.Error()),
22 }
23 ctx.JSON(http.StatusBadRequest, jsonResp)
24 return
25 }
26 // err := synchronizer.AddLink(req.NodeIndex, req.Link)
27 // if err != nil {
28 // jsonResp := ginmodel.JsonResp{
29 // Code: -1,
30 // Message: fmt.Sprintf("Add Link Error: %s", err.Error()),
31 // }
32 // ctx.JSON(http.StatusInternalServerError, jsonResp)
33 // return
34 // }
35 jsonResp := ginmodel.JsonResp{
36 Code: 0,
37 Message: "Success",
38 }
39 ctx.JSON(http.StatusOK, jsonResp)
40}
41
42func DelLinkHandler(ctx *gin.Context) {
43 linkID := ctx.Param("link_id")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected