Skip to content

Commit 42bef0a

Browse files
author
Gauvain Pocentek
committed
support for system hooks
1 parent af84700 commit 42bef0a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

gitlab.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,19 @@ def _getListOrObject(self, cls, id, **kwargs):
264264
else:
265265
return cls(self, id, **kwargs)
266266

267+
def Hook(self, id=None, **kwargs):
268+
"""Creates/tests/lists system hook(s) known by the GitLab server.
269+
270+
If id is None, returns a list of hooks.
271+
272+
If id is an integer, test the matching hook.
273+
274+
If id is a dict, create a new object using attributes provided. The
275+
object is NOT saved on the server. Use the save() method on the object
276+
to write it on the server.
277+
"""
278+
return self._getListOrObject(Hook, id, **kwargs)
279+
267280
def Project(self, id=None, **kwargs):
268281
"""Creates/gets/lists project(s) known by the GitLab server.
269282
@@ -433,6 +446,10 @@ class Group(GitlabObject):
433446
_constructorTypes = {'projects': 'Project'}
434447

435448

449+
class Hook(GitlabObject):
450+
_url = '/hooks'
451+
452+
436453
class Issue(GitlabObject):
437454
_url = '/issues'
438455
_constructorTypes = {'author': 'User', 'assignee': 'User',

0 commit comments

Comments
 (0)