2222 * @property-read User $author
2323 * @property-read User $assignee
2424 * @property-read Project $project
25+ * @property-read Milestone $milestone
26+ * @property-read File[] $files
2527 */
2628class MergeRequest extends AbstractModel implements Noteable
2729{
@@ -45,7 +47,9 @@ class MergeRequest extends AbstractModel implements Noteable
4547 'target_project_id ' ,
4648 'upvotes ' ,
4749 'downvotes ' ,
48- 'labels '
50+ 'labels ' ,
51+ 'milestone ' ,
52+ 'files '
4953 );
5054
5155 /**
@@ -66,6 +70,19 @@ public static function fromArray(Client $client, Project $project, array $data)
6670 $ data ['assignee ' ] = User::fromArray ($ client , $ data ['assignee ' ]);
6771 }
6872
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+
6986 return $ mr ->hydrate ($ data );
7087 }
7188
@@ -195,4 +212,14 @@ public function isClosed()
195212
196213 return false ;
197214 }
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+ }
198225}
0 commit comments