package common /* * This file is part of Autogits. * * Copyright © 2024 SUSE LLC * * Autogits is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later * version. * * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * Foobar. If not, see . */ import ( "encoding/json" "fmt" "io" ) type Status struct { } type StatusWebhookEvent struct { Id uint64 Context string Description string Sha string State string TargetUrl string Commit Commit Repository Repository Sender *User } func (s *StatusWebhookEvent) GetAction() string { return s.State } func (h *RequestHandler) ParseStatusRequest(data io.Reader) (*StatusWebhookEvent, error) { action := new(StatusWebhookEvent) err := json.NewDecoder(data).Decode(&action) if err != nil { return nil, fmt.Errorf("Got error while parsing: %w", err) } h.StdLogger.Printf("Request status for repo: %s#%s\n", action.Repository.Full_Name, action.Sha) h.Request = &Request{ Type: RequestType_Status, Data: action, } return action, nil }