// https://github.com/gogits/go-gogs-client/wiki/Users-Public-Keys#get-a-single-public-key func GetUserPublicKey(ctx *middleware.Context) { key, err := models.GetPublicKeyByID(ctx.ParamsInt64(":id")) if err != nil { if models.IsErrKeyNotExist(err) { ctx.Error(404) } else { ctx.Handle(500, "GetPublicKeyByID", err) } return } apiLink := composePublicKeysAPILink() ctx.JSON(200, ToApiPublicKey(apiLink, key)) }
// https://github.com/gogits/go-gogs-client/wiki/Users-Public-Keys#get-a-single-public-key func GetPublicKey(ctx *context.APIContext) { key, err := models.GetPublicKeyByID(ctx.ParamsInt64(":id")) if err != nil { if models.IsErrKeyNotExist(err) { ctx.Status(404) } else { ctx.Error(500, "GetPublicKeyByID", err) } return } apiLink := composePublicKeysAPILink() ctx.JSON(200, convert.ToPublicKey(apiLink, key)) }