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

Method GetBalanceMonitorsByBalanceID

api/balance.go:282–296  ·  view source on GitHub ↗

GetBalanceMonitorsByBalanceID retrieves all balance monitors associated with a specific balance ID. It extracts the balance ID from the route parameters. If the balance ID is missing or there's an error retrieving the monitors, it responds with an appropriate error message. Parameters: - c: The Gin

(c *gin.Context)

Source from the content-addressed store, hash-verified

280// - 400 Bad Request: If the balance ID is missing or there's an error retrieving the balance monitors.
281// - 200 OK: If the balance monitors are successfully retrieved.
282func (a Api) GetBalanceMonitorsByBalanceID(c *gin.Context) {
283 balanceID, passed := c.Params.Get("balance_id")
284 if !passed {
285 c.JSON(http.StatusBadRequest, gin.H{"error": "balance_id is required. pass balance_id in the route /:balance_id"})
286 return
287 }
288
289 monitors, err := a.ledgerforge.GetMonitorByID(c.Request.Context(), balanceID)
290 if err != nil {
291 c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
292 return
293 }
294
295 c.JSON(http.StatusOK, monitors)
296}
297
298// UpdateBalanceMonitor updates an existing balance monitor record by its ID.
299// It binds the incoming JSON request to a BalanceMonitor object, updates the record,

Callers

nothing calls this directly

Calls 3

GetMethod · 0.65
GetMonitorByIDMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected