Feat(Initial): Initial Go codebase
All checks were successful
Webhook-Everything/Webhook-Everything/pipeline/head This commit looks good
All checks were successful
Webhook-Everything/Webhook-Everything/pipeline/head This commit looks good
This commit is contained in:
34
backend/internal/webhookeverything/routegenroutes.go
Normal file
34
backend/internal/webhookeverything/routegenroutes.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package webhookeverything
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"git.samuelpua.com/telboon/webhook-everything/backend/internal/common"
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/go-chi/render"
|
||||
)
|
||||
|
||||
// Handles pre-generated webhooks
|
||||
// @Summary Pre-generated webhooks
|
||||
// @Description Description
|
||||
// @Tags Webhook
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param webhookID path string true "Pre-registered Webhook Path"
|
||||
// @Success 200 {object} common.TextResponse
|
||||
// @Failure 500 {object} common.ErrResponse
|
||||
// @Router /webhook/routes/{webhookID} [POST]
|
||||
func (env *Env) handleWebhook(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
routeID := chi.URLParam(r, "routeID")
|
||||
_ = ctx
|
||||
|
||||
err := env.forwardHookToTelegram(r, routeID)
|
||||
|
||||
if err != nil {
|
||||
render.Render(w, r, common.ErrInternalError(err))
|
||||
return
|
||||
}
|
||||
|
||||
render.Render(w, r, common.NewGenericTextResponse("success", ""))
|
||||
}
|
||||
Reference in New Issue
Block a user