MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / UpdateHook

Method UpdateHook

api/hooks.go:28–42  ·  view source on GitHub ↗

UpdateHook handles updating an existing webhook.

(c *gin.Context)

Source from the content-addressed store, hash-verified

26
27// UpdateHook handles updating an existing webhook.
28func (a *Api) UpdateHook(c *gin.Context) {
29 hookID := c.Param("id")
30 var hook hooks.Hook
31 if err := c.ShouldBindJSON(&hook); err != nil {
32 c.JSON(http.StatusBadRequest, apierror.NewAPIError(apierror.ErrInvalidInput, "invalid hook data", err))
33 return
34 }
35
36 if err := a.ledgerforge.Hooks.UpdateHook(c.Request.Context(), hookID, &hook); err != nil {
37 c.JSON(http.StatusBadRequest, apierror.NewAPIError(apierror.ErrInvalidInput, "failed to update hook", err))
38 return
39 }
40
41 c.JSON(http.StatusOK, hook)
42}
43
44// GetHook retrieves a specific webhook by ID.
45func (a *Api) GetHook(c *gin.Context) {

Callers

nothing calls this directly

Calls 2

NewAPIErrorFunction · 0.92
UpdateHookMethod · 0.65

Tested by

no test coverage detected