Skip to content

Commit

Permalink
Remove commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Oct 10, 2023
1 parent 985b320 commit 7ba1d20
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions internal/http/services/ocmd/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,6 @@ func (h *notifHandler) init(c *config) error {
return nil
}

// type notificationRequest struct {
// NotificationType string `json:"notificationType" validate:"required"`
// ResourceType string `json:"resourceType" validate:"required"`
// ProviderId string `json:"providerId" validate:"required"`
// Notification ... `json:"notification"`
//}

// Example of payload from Nextcloud:
// {
// "notificationType": <one of "SHARE_ACCEPTED", "SHARE_DECLINED", "REQUEST_RESHARE", "SHARE_UNSHARED", "RESHARE_UNDO", "RESHARE_CHANGE_PERMISSION">,
// "resourceType" : "file",
// "providerId" : <shareId>,
// "notification" : {
// "sharedSecret" : <token>,
// "message" : "human-readable message",
// "shareWith" : <user>,
// "senderId" : <user>,
// "shareType" : <type>
// }
// }

// Notifications dispatches any notifications received from remote OCM sites
// according to the specifications at:
// https://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1notifications/post
Expand All @@ -76,22 +55,12 @@ func (h *notifHandler) Notifications(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusCreated)
}

func getNotification(r *http.Request) (string, error) { // (*notificationRequest, error)
func getNotification(r *http.Request) (string, error) {
// var req notificationRequest
contentType, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
if err == nil && contentType == "application/json" {
bytes, _ := io.ReadAll(r.Body)
return string(bytes), nil
// if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
// return nil, err
//}
// } else {
// return nil, errors.New("body request not recognised")
}
return "", nil
// validate the request
// if err := validate.Struct(req); err != nil {
// return nil, err
//}
// return &req, nil
}

0 comments on commit 7ba1d20

Please sign in to comment.