This commit is contained in:
2024-08-28 00:45:47 +02:00
parent 2be5ae7150
commit e125031384
14 changed files with 199 additions and 257 deletions

View File

@@ -31,7 +31,7 @@ type User struct {
Username string
}
type RepositoryAction struct {
type RepositoryWebhookEvent struct {
Action string
Sender *User
@@ -41,13 +41,17 @@ type RepositoryAction struct {
PrjGit string
}
func (r *RepositoryWebhookEvent) GetAction() string {
return r.Action
}
// TODO: sanity check values!!!!
func (h *RequestHandler) parseRepositoryRequest(dataReader io.Reader) *RepositoryAction {
func (h *RequestHandler) parseRepositoryRequest(dataReader io.Reader) *RepositoryWebhookEvent {
if h.HasError() {
return nil
}
var data RepositoryAction
var data RepositoryWebhookEvent
h.Error = json.NewDecoder(dataReader).Decode(&data)
if h.HasError() {
@@ -69,6 +73,6 @@ func (h *RequestHandler) parseRepositoryRequest(dataReader io.Reader) *Repositor
h.ErrLogger.Println("Request has no data.... skipping")
}
h.Data = data
h.Request.Data = &data
return &data
}