22
22
* @property-read User $author
23
23
* @property-read User $assignee
24
24
* @property-read Project $project
25
+ * @property-read Milestone $milestone
26
+ * @property-read File[] $files
25
27
*/
26
28
class MergeRequest extends AbstractModel implements Noteable
27
29
{
@@ -45,7 +47,9 @@ class MergeRequest extends AbstractModel implements Noteable
45
47
'target_project_id ' ,
46
48
'upvotes ' ,
47
49
'downvotes ' ,
48
- 'labels '
50
+ 'labels ' ,
51
+ 'milestone ' ,
52
+ 'files '
49
53
);
50
54
51
55
/**
@@ -66,6 +70,19 @@ public static function fromArray(Client $client, Project $project, array $data)
66
70
$ data ['assignee ' ] = User::fromArray ($ client , $ data ['assignee ' ]);
67
71
}
68
72
73
+ if (isset ($ data ['milestone ' ])) {
74
+ $ data ['milestone ' ] = Milestone::fromArray ($ client , $ project , $ data ['milestone ' ]);
75
+ }
76
+
77
+ if (isset ($ data ['files ' ])) {
78
+ $ files = array ();
79
+ foreach ($ data ['files ' ] as $ file ) {
80
+ $ files [] = File::fromArray ($ client , $ project , $ file );
81
+ }
82
+
83
+ $ data ['files ' ] = $ files ;
84
+ }
85
+
69
86
return $ mr ->hydrate ($ data );
70
87
}
71
88
@@ -195,4 +212,14 @@ public function isClosed()
195
212
196
213
return false ;
197
214
}
215
+
216
+ /**
217
+ * @return MergeRequest
218
+ */
219
+ public function changes ()
220
+ {
221
+ $ data = $ this ->api ('mr ' )->changes ($ this ->project ->id , $ this ->id );
222
+
223
+ return static ::fromArray ($ this ->getClient (), $ this ->project , $ data );
224
+ }
198
225
}
0 commit comments