mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 22:22:46 +00:00
➕ Implemented Create Pusher
This commit is contained in:
parent
024afaba7c
commit
4c4cf8020a
10 changed files with 110 additions and 2 deletions
|
@ -29,6 +29,7 @@ const (
|
|||
InputAccountDataPath = "/userapi/inputAccountData"
|
||||
|
||||
PerformDeviceCreationPath = "/userapi/performDeviceCreation"
|
||||
PerformPusherCreationPath = "/userapi/performPusherCreation"
|
||||
PerformAccountCreationPath = "/userapi/performAccountCreation"
|
||||
PerformPasswordUpdatePath = "/userapi/performPasswordUpdate"
|
||||
PerformDeviceDeletionPath = "/userapi/performDeviceDeletion"
|
||||
|
@ -124,6 +125,18 @@ func (h *httpUserInternalAPI) PerformDeviceDeletion(
|
|||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
func (h *httpUserInternalAPI) PerformPusherCreation(
|
||||
ctx context.Context,
|
||||
request *api.PerformPusherCreationRequest,
|
||||
response *api.PerformPusherCreationResponse,
|
||||
) error {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformPusherCreation")
|
||||
defer span.Finish()
|
||||
|
||||
apiURL := h.apiURL + PerformPusherCreationPath
|
||||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
func (h *httpUserInternalAPI) PerformPusherDeletion(
|
||||
ctx context.Context,
|
||||
request *api.PerformPusherDeletionRequest,
|
||||
|
|
|
@ -52,6 +52,19 @@ func AddRoutes(internalAPIMux *mux.Router, s api.UserInternalAPI) {
|
|||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(PerformPusherCreationPath,
|
||||
httputil.MakeInternalAPI("performPusherCreation", func(req *http.Request) util.JSONResponse {
|
||||
request := api.PerformPusherCreationRequest{}
|
||||
response := api.PerformPusherCreationResponse{}
|
||||
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||
return util.MessageResponse(http.StatusBadRequest, err.Error())
|
||||
}
|
||||
if err := s.PerformPusherCreation(req.Context(), &request, &response); err != nil {
|
||||
return util.ErrorResponse(err)
|
||||
}
|
||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(PerformDeviceCreationPath,
|
||||
httputil.MakeInternalAPI("performDeviceCreation", func(req *http.Request) util.JSONResponse {
|
||||
request := api.PerformDeviceCreationRequest{}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue