mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Add missing internal api endpoint
Signed-off-by: Till Faelligen <tfaelligen@gmail.com>
This commit is contained in:
parent
329c9e671c
commit
f3e46af0d6
1 changed files with 15 additions and 0 deletions
|
@ -16,6 +16,7 @@ package inthttp
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
@ -234,4 +235,18 @@ func AddRoutes(internalAPIMux *mux.Router, s api.UserInternalAPI) {
|
|||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(QueryKeyBackupPath,
|
||||
httputil.MakeInternalAPI("queryKeyBackup", func(req *http.Request) util.JSONResponse {
|
||||
request := api.QueryKeyBackupRequest{}
|
||||
response := api.QueryKeyBackupResponse{}
|
||||
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||
return util.MessageResponse(http.StatusBadRequest, err.Error())
|
||||
}
|
||||
s.QueryKeyBackup(req.Context(), &request, &response)
|
||||
if response.Error != "" {
|
||||
return util.ErrorResponse(fmt.Errorf("QueryKeyBackup: %s", response.Error))
|
||||
}
|
||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue