Skip to content

Commit 90c8958

Browse files
author
Gauvain Pocentek
committed
[v4] Update (un)subscribtion endpoints
1 parent 5c8cb29 commit 90c8958

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

gitlab/v4/objects.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -936,11 +936,11 @@ def subscribe(self, **kwargs):
936936
GitlabConnectionError: If the server cannot be reached.
937937
GitlabSubscribeError: If the subscription cannot be done
938938
"""
939-
url = ('/projects/%(project_id)s/issues/%(issue_id)s/subscription' %
939+
url = ('/projects/%(project_id)s/issues/%(issue_id)s/subscribe' %
940940
{'project_id': self.project_id, 'issue_id': self.id})
941941

942942
r = self.gitlab._raw_post(url, **kwargs)
943-
raise_error_from_response(r, GitlabSubscribeError)
943+
raise_error_from_response(r, GitlabSubscribeError, [201, 304])
944944
self._set_from_dict(r.json())
945945

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

956-
r = self.gitlab._raw_delete(url, **kwargs)
957-
raise_error_from_response(r, GitlabUnsubscribeError)
956+
r = self.gitlab._raw_post(url, **kwargs)
957+
raise_error_from_response(r, GitlabUnsubscribeError, [201, 304])
958958
self._set_from_dict(r.json())
959959

960960
def move(self, to_project_id, **kwargs):
@@ -1199,7 +1199,7 @@ def subscribe(self, **kwargs):
11991199
GitlabSubscribeError: If the subscription cannot be done
12001200
"""
12011201
url = ('/projects/%(project_id)s/merge_requests/%(mr_id)s/'
1202-
'subscription' %
1202+
'subscribe' %
12031203
{'project_id': self.project_id, 'mr_id': self.id})
12041204

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

1221-
r = self.gitlab._raw_delete(url, **kwargs)
1222-
raise_error_from_response(r, GitlabUnsubscribeError, [200, 304])
1221+
r = self.gitlab._raw_post(url, **kwargs)
1222+
raise_error_from_response(r, GitlabUnsubscribeError, [201, 304])
12231223
if r.status_code == 200:
12241224
self._set_from_dict(r.json())
12251225

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

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

1478-
r = self.gitlab._raw_delete(url, **kwargs)
1479-
raise_error_from_response(r, GitlabUnsubscribeError, [200, 304])
1478+
r = self.gitlab._raw_post(url, **kwargs)
1479+
raise_error_from_response(r, GitlabUnsubscribeError, [201, 304])
14801480
self._set_from_dict(r.json())
14811481

14821482

0 commit comments

Comments
 (0)