@@ -1099,7 +1099,7 @@ def unsubscribe(self, **kwargs):
10991099
11001100 Raises:
11011101 GitlabConnectionError: If the server cannot be reached.
1102- GitlabSubscribeError : If the unsubscription cannot be done
1102+ GitlabUnsubscribeError : If the unsubscription cannot be done
11031103 """
11041104 url = ('/projects/%(project_id)s/issues/%(issue_id)s/subscription' %
11051105 {'project_id' : self .project_id , 'issue_id' : self .id })
@@ -1249,6 +1249,36 @@ def _data_for_gitlab(self, extra_parameters={}, update=False):
12491249 data = json .dumps (d )
12501250 return data
12511251
1252+ def subscribe (self , ** kwargs ):
1253+ """Subscribe to a MR.
1254+
1255+ Raises:
1256+ GitlabConnectionError: If the server cannot be reached.
1257+ GitlabSubscribeError: If the subscription cannot be done
1258+ """
1259+ url = ('/projects/%(project_id)s/merge_requests/%(mr_id)s/'
1260+ 'subscription' %
1261+ {'project_id' : self .project_id , 'mr_id' : self .id })
1262+
1263+ r = self .gitlab ._raw_post (url , ** kwargs )
1264+ raise_error_from_response (r , GitlabSubscribeError , [201 , 304 ])
1265+ self ._set_from_dict (r .json ())
1266+
1267+ def unsubscribe (self , ** kwargs ):
1268+ """Unsubscribe a MR.
1269+
1270+ Raises:
1271+ GitlabConnectionError: If the server cannot be reached.
1272+ GitlabUnsubscribeError: If the unsubscription cannot be done
1273+ """
1274+ url = ('/projects/%(project_id)s/merge_requests/%(mr_id)s/'
1275+ 'subscription' %
1276+ {'project_id' : self .project_id , 'mr_id' : self .id })
1277+
1278+ r = self .gitlab ._raw_delete (url , ** kwargs )
1279+ raise_error_from_response (r , GitlabUnsubscribeError , [200 , 304 ])
1280+ self ._set_from_dict (r .json ())
1281+
12521282 def cancel_merge_when_build_succeeds (self , ** kwargs ):
12531283 """Cancel merge when build succeeds."""
12541284
@@ -1377,7 +1407,7 @@ def unsubscribe(self, **kwargs):
13771407
13781408 Raises:
13791409 GitlabConnectionError: If the server cannot be reached.
1380- GitlabSubscribeError : If the unsubscription cannot be done
1410+ GitlabUnsubscribeError : If the unsubscription cannot be done
13811411 """
13821412 url = ('/projects/%(project_id)s/labels/%(label_id)s/subscription' %
13831413 {'project_id' : self .project_id , 'label_id' : self .name })
0 commit comments