diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2017-05-23 22:26:50 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2017-05-23 22:26:50 +0200 |
commit | 90c895824aaf84a9a77f9a3fd18db6d16b73908d (patch) | |
tree | 9572d8542d386ab2599f2d37e4769670498b6a0b | |
parent | 5c8cb293bca387309b9e40fc6b1a96cc8fbd8dfe (diff) | |
download | gitlab-90c895824aaf84a9a77f9a3fd18db6d16b73908d.tar.gz |
[v4] Update (un)subscribtion endpoints
-rw-r--r-- | gitlab/v4/objects.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index aac7a04..f46495c 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -936,11 +936,11 @@ class ProjectIssue(GitlabObject): 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): @@ -950,11 +950,11 @@ class ProjectIssue(GitlabObject): 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): @@ -1199,7 +1199,7 @@ class ProjectMergeRequest(GitlabObject): 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) @@ -1215,11 +1215,11 @@ class ProjectMergeRequest(GitlabObject): 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()) @@ -1458,7 +1458,7 @@ class ProjectLabel(GitlabObject): 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) @@ -1472,11 +1472,11 @@ class ProjectLabel(GitlabObject): 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()) |