Skip to content

Commit

Permalink
[v4] Update (un)subscribtion endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauvain Pocentek committed May 23, 2017
1 parent 5c8cb29 commit 90c8958
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions gitlab/v4/objects.py
Expand Up @@ -936,11 +936,11 @@ def subscribe(self, **kwargs):
GitlabConnectionError: If the server cannot be reached.
GitlabSubscribeError: If the subscription cannot be done
"""
url = ('/projects/%(project_id)s/issues/%(issue_id)s/subscription' %
url = ('/projects/%(project_id)s/issues/%(issue_id)s/subscribe' %
{'project_id': self.project_id, 'issue_id': self.id})

r = self.gitlab._raw_post(url, **kwargs)
raise_error_from_response(r, GitlabSubscribeError)
raise_error_from_response(r, GitlabSubscribeError, [201, 304])
self._set_from_dict(r.json())

def unsubscribe(self, **kwargs):
Expand All @@ -950,11 +950,11 @@ def unsubscribe(self, **kwargs):
GitlabConnectionError: If the server cannot be reached.
GitlabUnsubscribeError: If the unsubscription cannot be done
"""
url = ('/projects/%(project_id)s/issues/%(issue_id)s/subscription' %
url = ('/projects/%(project_id)s/issues/%(issue_id)s/unsubscribe' %
{'project_id': self.project_id, 'issue_id': self.id})

r = self.gitlab._raw_delete(url, **kwargs)
raise_error_from_response(r, GitlabUnsubscribeError)
r = self.gitlab._raw_post(url, **kwargs)
raise_error_from_response(r, GitlabUnsubscribeError, [201, 304])
self._set_from_dict(r.json())

def move(self, to_project_id, **kwargs):
Expand Down Expand Up @@ -1199,7 +1199,7 @@ def subscribe(self, **kwargs):
GitlabSubscribeError: If the subscription cannot be done
"""
url = ('/projects/%(project_id)s/merge_requests/%(mr_id)s/'
'subscription' %
'subscribe' %
{'project_id': self.project_id, 'mr_id': self.id})

r = self.gitlab._raw_post(url, **kwargs)
Expand All @@ -1215,11 +1215,11 @@ def unsubscribe(self, **kwargs):
GitlabUnsubscribeError: If the unsubscription cannot be done
"""
url = ('/projects/%(project_id)s/merge_requests/%(mr_id)s/'
'subscription' %
'unsubscribe' %
{'project_id': self.project_id, 'mr_id': self.id})

r = self.gitlab._raw_delete(url, **kwargs)
raise_error_from_response(r, GitlabUnsubscribeError, [200, 304])
r = self.gitlab._raw_post(url, **kwargs)
raise_error_from_response(r, GitlabUnsubscribeError, [201, 304])
if r.status_code == 200:
self._set_from_dict(r.json())

Expand Down Expand Up @@ -1458,7 +1458,7 @@ def subscribe(self, **kwargs):
GitlabConnectionError: If the server cannot be reached.
GitlabSubscribeError: If the subscription cannot be done
"""
url = ('/projects/%(project_id)s/labels/%(label_id)s/subscription' %
url = ('/projects/%(project_id)s/labels/%(label_id)s/subscribe' %
{'project_id': self.project_id, 'label_id': self.name})

r = self.gitlab._raw_post(url, **kwargs)
Expand All @@ -1472,11 +1472,11 @@ def unsubscribe(self, **kwargs):
GitlabConnectionError: If the server cannot be reached.
GitlabUnsubscribeError: If the unsubscription cannot be done
"""
url = ('/projects/%(project_id)s/labels/%(label_id)s/subscription' %
url = ('/projects/%(project_id)s/labels/%(label_id)s/unsubscribe' %
{'project_id': self.project_id, 'label_id': self.name})

r = self.gitlab._raw_delete(url, **kwargs)
raise_error_from_response(r, GitlabUnsubscribeError, [200, 304])
r = self.gitlab._raw_post(url, **kwargs)
raise_error_from_response(r, GitlabUnsubscribeError, [201, 304])
self._set_from_dict(r.json())


Expand Down

0 comments on commit 90c8958

Please sign in to comment.