mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 22:22:46 +00:00
🗑 Implemented Delete Pusher
This commit is contained in:
parent
784aba53b2
commit
024afaba7c
10 changed files with 122 additions and 9 deletions
|
@ -32,6 +32,7 @@ const (
|
|||
PerformAccountCreationPath = "/userapi/performAccountCreation"
|
||||
PerformPasswordUpdatePath = "/userapi/performPasswordUpdate"
|
||||
PerformDeviceDeletionPath = "/userapi/performDeviceDeletion"
|
||||
PerformPusherDeletionPath = "/userapi/performPusherDeletion"
|
||||
PerformLastSeenUpdatePath = "/userapi/performLastSeenUpdate"
|
||||
PerformDeviceUpdatePath = "/userapi/performDeviceUpdate"
|
||||
PerformAccountDeactivationPath = "/userapi/performAccountDeactivation"
|
||||
|
@ -123,6 +124,18 @@ func (h *httpUserInternalAPI) PerformDeviceDeletion(
|
|||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
func (h *httpUserInternalAPI) PerformPusherDeletion(
|
||||
ctx context.Context,
|
||||
request *api.PerformPusherDeletionRequest,
|
||||
response *api.PerformPusherDeletionResponse,
|
||||
) error {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformPusherDeletion")
|
||||
defer span.Finish()
|
||||
|
||||
apiURL := h.apiURL + PerformPusherDeletionPath
|
||||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
func (h *httpUserInternalAPI) PerformLastSeenUpdate(
|
||||
ctx context.Context,
|
||||
req *api.PerformLastSeenUpdateRequest,
|
||||
|
|
|
@ -104,6 +104,19 @@ func AddRoutes(internalAPIMux *mux.Router, s api.UserInternalAPI) {
|
|||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(PerformPusherDeletionPath,
|
||||
httputil.MakeInternalAPI("performPusherDeletion", func(req *http.Request) util.JSONResponse {
|
||||
request := api.PerformPusherDeletionRequest{}
|
||||
response := api.PerformPusherDeletionResponse{}
|
||||
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||
return util.MessageResponse(http.StatusBadRequest, err.Error())
|
||||
}
|
||||
if err := s.PerformPusherDeletion(req.Context(), &request, &response); err != nil {
|
||||
return util.ErrorResponse(err)
|
||||
}
|
||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(PerformAccountDeactivationPath,
|
||||
httputil.MakeInternalAPI("performAccountDeactivation", func(req *http.Request) util.JSONResponse {
|
||||
request := api.PerformAccountDeactivationRequest{}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue