MCPcopy Index your code
hub / github.com/gotify/server / GetUserByID

Method GetUserByID

api/user.go:258–270  ·  view source on GitHub ↗

GetUserByID returns the user by id swagger:operation GET /user/{id} user getUser Get a user. --- consumes: [application/json] produces: [application/json] security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] parameters: - name: id in:

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

256// schema:
257// $ref: "#/definitions/Error"
258func (a *UserAPI) GetUserByID(ctx *gin.Context) {
259 withID(ctx, "id", func(id uint) {
260 user, err := a.DB.GetUserByID(id)
261 if success := successOrAbort(ctx, 500, err); !success {
262 return
263 }
264 if user != nil {
265 ctx.JSON(200, toExternalUser(user))
266 } else {
267 ctx.AbortWithError(404, errors.New("user does not exist"))
268 }
269 })
270}
271
272// DeleteUserByID deletes the user by id
273// swagger:operation DELETE /user/{id} user deleteUser

Callers

nothing calls this directly

Calls 4

withIDFunction · 0.85
successOrAbortFunction · 0.85
toExternalUserFunction · 0.85
GetUserByIDMethod · 0.65

Tested by

no test coverage detected