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

Method GetIdentity

api/identity.go:66–80  ·  view source on GitHub ↗

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

(c *gin.Context)

Source from the content-addressed store, hash-verified

64// - 400 Bad Request: If the ID is missing or there's an error retrieving the identity.
65// - 200 OK: If the identity is successfully retrieved.
66func (a Api) GetIdentity(c *gin.Context) {
67 id, passed := c.Params.Get("id")
68 if !passed {
69 c.JSON(http.StatusBadRequest, gin.H{"error": "id is required. pass id in the route /:id"})
70 return
71 }
72
73 resp, err := a.ledgerforge.GetIdentity(id)
74 if err != nil {
75 c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
76 return
77 }
78
79 c.JSON(http.StatusOK, resp)
80}
81
82// UpdateIdentity updates an existing identity record by its ID.
83// It binds the incoming JSON request to an Identity object, updates the record,

Callers 1

GetTokenizedFieldsMethod · 0.45

Calls 2

GetMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected