func UpdateWebhook(w http.ResponseWriter, req *http.Request) {
	wh, err := hasWebhookAccess(w, req)
	if err != nil {
		return
	}

	var input inputWebhookType
	err = httputils.DecodeBody(w, req.Body, &input)
	if err != nil {
		httputils.ErrorOut(w, http.StatusBadRequest, errIncorrectBody.Error())
		return
	}

	// Update fields with input
	wh.Config = input.Config

	// Store webhook into persistent storage
	repo := container.Instance.GetWebhookRepo()
	err = repo.Store(*wh)
	if err != nil {
		msg := fmt.Sprintf("error while storing webhook: %s", err)
		httputils.ErrorOut(w, http.StatusInternalServerError, msg)
		return
	}

	_ = dispatcher.DispatchWebhookUpdate(wh.Account, *wh)

	// Output webhook
	_ = httputils.JSONOut(w, http.StatusCreated, wh)
}
// UpdateWebhook is a handler that will update a webhook
UpdateWebhook is a handler that will update a webhook
// UpdateWebhook is a handler that will update a webhook
func UpdateWebhook(w http.ResponseWriter, req *http.Request) {
	wh, err := hasWebhookAccess(w, req)
	if err != nil {
		return
	}
	var input inputWebhookType
	err = httputils.DecodeBody(w, req.Body, &input)
	if err != nil {
		httputils.ErrorOut(w, http.StatusBadRequest, errIncorrectBody.Error())
		return
	}
	wh.Config = input.Config
	repo := container.Instance.GetWebhookRepo()
	err = repo.Store(*wh)
	if err != nil {
		msg := fmt.Sprintf("error while storing webhook: %s", err)
		httputils.ErrorOut(w, http.StatusInternalServerError, msg)
		return
	}
	_ = dispatcher.DispatchWebhookUpdate(wh.Account, *wh)
	_ = httputils.JSONOut(w, http.StatusCreated, wh)
}
func UpdateWebhook ( w http . ResponseWriter , req * http . Request ) { wh , err := hasWebhookAccess ( w , req ) if err != nil { return } var input inputWebhookType err = httputils . DecodeBody ( w , req . Body , & input ) if err != nil { httputils . ErrorOut ( w , http . StatusBadRequest , errIncorrectBody . Error ( ) ) return } wh . Config = input . Config repo := container . Instance . GetWebhookRepo ( ) err = repo . Store ( * wh ) if err != nil { msg := fmt . Sprintf ( " " , err ) httputils . ErrorOut ( w , http . StatusInternalServerError , msg ) return } _ = dispatcher . DispatchWebhookUpdate ( wh . Account , * wh ) _ = httputils . JSONOut ( w , http . StatusCreated , wh ) }
UpdateWebhook is a handler that will update a webhook
UpdateWebhook is a handler that will update a webhook
// Update fields with input // Store webhook into persistent storage // Output webhook