diff --git a/gitea/gitea.go b/gitea/gitea.go index ea29f1e..b6b84d1 100644 --- a/gitea/gitea.go +++ b/gitea/gitea.go @@ -50,6 +50,17 @@ const ( PackageEvent Event = "package" ) +type CreatePayload structs.CreatePayload +type DeletePayload structs.DeletePayload +type ForkPayload structs.ForkPayload +type IssuePayload structs.IssuePayload +type IssueCommentPayload structs.IssueCommentPayload +type PushPayload structs.PushPayload +type PullRequestPayload structs.PullRequestPayload +type RepositoryPayload structs.RepositoryPayload +type ReleasePayload structs.ReleasePayload +type PackagePayload structs.PackagePayload + // EventSubtype defines a GitHub Hook Event subtype type EventSubtype string @@ -149,48 +160,48 @@ func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error) switch giteaEvent { case CreateEvent: - var pl structs.CreatePayload + var pl CreatePayload err = json.Unmarshal([]byte(payload), &pl) return pl, err case DeleteEvent: - var pl structs.DeletePayload + var pl DeletePayload err = json.Unmarshal([]byte(payload), &pl) return pl, err case ForkEvent: - var pl structs.ForkPayload + var pl ForkPayload err = json.Unmarshal([]byte(payload), &pl) return pl, err case IssuesEvent, IssueAssignEvent, IssueLabelEvent, IssueMilestoneEvent: - var pl structs.IssuePayload + var pl IssuePayload err = json.Unmarshal([]byte(payload), &pl) return pl, err case IssueCommentEvent, PullRequestCommentEvent: - var pl structs.IssueCommentPayload + var pl IssueCommentPayload err = json.Unmarshal([]byte(payload), &pl) return pl, err case PushEvent: - var pl structs.PushPayload + var pl PushPayload err = json.Unmarshal([]byte(payload), &pl) return pl, err case PullRequestEvent, PullRequestAssignEvent, PullRequestLabelEvent, PullRequestMilestoneEvent, PullRequestSyncEvent: - var pl structs.PullRequestPayload + var pl PullRequestPayload err = json.Unmarshal([]byte(payload), &pl) return pl, err case PullRequestReviewEvent: - var pl structs.PullRequestPayload + var pl PullRequestPayload err = json.Unmarshal([]byte(payload), &pl) return pl, err case RepositoryEvent: - var pl structs.RepositoryPayload + var pl RepositoryPayload err = json.Unmarshal([]byte(payload), &pl) return pl, err case ReleaseEvent: - var pl structs.ReleasePayload + var pl ReleasePayload err = json.Unmarshal([]byte(payload), &pl) return pl, err case PackageEvent: - var pl structs.PackagePayload + var pl PackagePayload err = json.Unmarshal([]byte(payload), &pl) return pl, err default: