diff --git a/gitlab/payload.go b/gitlab/payload.go index c2c2b8a..e4ed37d 100644 --- a/gitlab/payload.go +++ b/gitlab/payload.go @@ -488,27 +488,11 @@ type Author struct { Email string `json:"email"` } -// Changes contains all changes associated with a GitLab issue or MR -type Changes struct { - LabelChanges LabelChanges `json:"labels"` -} - -// LabelChanges contains changes in labels assocatiated with a GitLab issue or MR -type LabelChanges struct { - Previous []Label `json:"previous"` - Current []Label `json:"current"` -} +// Changes contains all the changes in a MergeRequest +type Changes map[string]Change -// Label contains all of the GitLab label information -type Label struct { - ID int64 `json:"id"` - Title string `json:"title"` - Color string `json:"color"` - ProjectID int64 `json:"project_id"` - CreatedAt customTime `json:"created_at"` - UpdatedAt customTime `json:"updated_at"` - Template bool `json:"template"` - Description string `json:"description"` - Type string `json:"type"` - GroupID int64 `json:"group_id"` +// Change is an individual change of a field in a MergeRequest +type Change struct { + Current interface{} `json:"current"` + Previous interface{} `json:"previous"` } diff --git a/testdata/gitlab/merge-request-event.json b/testdata/gitlab/merge-request-event.json index eb890fb..3a07e43 100644 --- a/testdata/gitlab/merge-request-event.json +++ b/testdata/gitlab/merge-request-event.json @@ -108,8 +108,14 @@ "group_id": 41 }], "changes": { - "updated_by_id": [null, 1], - "updated_at": ["2017-09-15 16:50:55 UTC", "2017-09-15 16:52:00 UTC"], + "updated_by_id": { + "previous": null, + "current": 1 + }, + "updated_at": { + "previous": "2017-09-15 16:50:55 UTC", + "current":"2017-09-15 16:52:00 UTC" + }, "labels": { "previous": [{ "id": 206, @@ -137,4 +143,4 @@ }] } } -} \ No newline at end of file +}