Repository: xanzy/go-gitlab
Pull request #615 (2019-04-30 13:53:45)

updatedById is not an array of int but an object like other fields
Related [gitlab issue #61187](https://gitlab.com/gitlab-org/gitlab-ce/issues/61187) and [merge request !27897](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27897) 

Wait and see...


Patch:
diff --git a/event_types.go b/event_types.go
index a36a6e5..d6b79c1 100644
--- a/event_types.go
+++ b/event_types.go
@@ -173,7 +173,10 @@ type IssueEvent struct {
 			Previous []Label `json:"previous"`
 			Current  []Label `json:"current"`
 		} `json:"labels"`
-		UpdatedByID []int `json:"updated_by_id"`
+		UpdatedByID struct {
+			Previous int `json:"previous"`
+			Current  int `json:"current"`
+		} `json:"updated_by_id"`
 	} `json:"changes"`
 }
 
@@ -584,7 +587,10 @@ type MergeEvent struct {
 			Previous []Label `json:"previous"`
 			Current  []Label `json:"current"`
 		} `json:"labels"`
-		UpdatedByID []int `json:"updated_by_id"`
+		UpdatedByID struct {
+			Previous int `json:"previous"`
+			Current  int `json:"current"`
+		} `json:"updated_by_id"`
 	} `json:"changes"`
 }
 


Test patch:
diff --git a/event_parsing_test.go b/event_parsing_test.go
index 786ccf9..aa2f3c1 100644
--- a/event_parsing_test.go
+++ b/event_parsing_test.go
@@ -3,6 +3,7 @@ package gitlab
 import (
 	"net/http"
 	"testing"
+
 	"github.com/stretchr/testify/assert"
 )
 
@@ -260,8 +261,14 @@ func TestParseIssueHook(t *testing.T) {
     "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,
@@ -317,7 +324,8 @@ func TestParseIssueHook(t *testing.T) {
 		t.Errorf("Assignee username is %v, want %v", event.Assignee.Username, "user1")
 	}
 	assert.Equal(t, 1, len(event.Labels))
-	assert.Equal(t, []int{0, 1}, event.Changes.UpdatedByID)
+	assert.Equal(t, 0, event.Changes.UpdatedByID.Previous)
+	assert.Equal(t, 1, event.Changes.UpdatedByID.Current)
 	assert.Equal(t, 1, len(event.Changes.Labels.Previous))
 	assert.Equal(t, 1, len(event.Changes.Labels.Current))
 }
@@ -855,8 +863,14 @@ func TestParseMergeRequestHook(t *testing.T) {
     "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,
@@ -912,7 +926,8 @@ func TestParseMergeRequestHook(t *testing.T) {
 		t.Errorf("WorkInProgress is %v, want %v", event.ObjectAttributes.WorkInProgress, false)
 	}
 	assert.Equal(t, 1, len(event.Labels))
-	assert.Equal(t, []int{0, 1}, event.Changes.UpdatedByID)
+	assert.Equal(t, 0, event.Changes.UpdatedByID.Previous)
+	assert.Equal(t, 1, event.Changes.UpdatedByID.Current)
 	assert.Equal(t, 1, len(event.Changes.Labels.Previous))
 	assert.Equal(t, 1, len(event.Changes.Labels.Current))
 }
diff --git a/event_types_test.go b/event_types_test.go
index 0f72392..3b653c0 100644
--- a/event_types_test.go
+++ b/event_types_test.go
@@ -214,8 +214,14 @@ func TestMergeEventUnmarshal(t *testing.T) {
     "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,