diff --git a/gitlab/payload.go b/gitlab/payload.go index 7f7d690..446a237 100644 --- a/gitlab/payload.go +++ b/gitlab/payload.go @@ -724,6 +724,7 @@ type ObjectAttributes struct { NoteableID int64 `json:"noteable_id"` // nolint: misspell System bool `json:"system"` WorkInProgress bool `json:"work_in_progress"` + Draft bool `json:"draft"` StDiffs []StDiff `json:"st_diffs"` Source Source `json:"source"` Target Target `json:"target"` @@ -880,14 +881,21 @@ type Author struct { // Changes contains all changes associated with a GitLab issue or MR type Changes struct { LabelChanges LabelChanges `json:"labels"` + DraftChanges DraftChanges `json:"draft"` } -// LabelChanges contains changes in labels assocatiated with a GitLab issue or MR +// LabelChanges contains changes in labels associated with a GitLab issue or MR type LabelChanges struct { Previous []Label `json:"previous"` Current []Label `json:"current"` } +// DraftChanges contains the current and previous value of the draft property, tells us if draft was toggles +type DraftChanges struct { + Previous bool `json:"previous"` + Current bool `json:"current"` +} + // Label contains all of the GitLab label information type Label struct { ID int64 `json:"id"` diff --git a/testdata/gitlab/merge-request-event.json b/testdata/gitlab/merge-request-event.json index d873114..68f6ad4 100644 --- a/testdata/gitlab/merge-request-event.json +++ b/testdata/gitlab/merge-request-event.json @@ -52,6 +52,7 @@ "state": "opened", "blocking_discussions_resolved": true, "work_in_progress": false, + "draft": false, "first_contribution": true, "merge_status": "unchecked", "target_project_id": 14, @@ -137,6 +138,10 @@ "previous": null, "current": 1 }, + "draft": { + "previous": true, + "current": false + }, "updated_at": { "previous": "2017-09-15 16:50:55 UTC", "current":"2017-09-15 16:52:00 UTC" @@ -192,4 +197,4 @@ "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" } ] -} \ No newline at end of file +}