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

Method GetBalanceMonitor

api/balance.go:236–250  ·  view source on GitHub ↗

GetBalanceMonitor retrieves a balance monitor record by its ID. It extracts the ID from the route parameters. If the ID is missing or there's an error retrieving the monitor, it responds with an appropriate error message. Parameters: - c: The Gin context containing the request and response. Respon

(c *gin.Context)

Source from the content-addressed store, hash-verified

234// - 400 Bad Request: If the ID is missing or there's an error retrieving the balance monitor.
235// - 200 OK: If the balance monitor is successfully retrieved.
236func (a Api) GetBalanceMonitor(c *gin.Context) {
237 id, passed := c.Params.Get("id")
238 if !passed {
239 c.JSON(http.StatusBadRequest, gin.H{"error": "id is required. pass id in the route /:id"})
240 return
241 }
242
243 resp, err := a.ledgerforge.GetMonitorByID(c.Request.Context(), id)
244 if err != nil {
245 c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
246 return
247 }
248
249 c.JSON(http.StatusOK, resp)
250}
251
252// GetAllBalanceMonitors retrieves all balance monitor records in the system.
253// It fetches the monitor records and responds with the list of monitors.

Callers

nothing calls this directly

Calls 3

GetMethod · 0.65
GetMonitorByIDMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected