diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/api-objects.rst | 1 | ||||
-rw-r--r-- | docs/gl_objects/system_hooks.py | 17 | ||||
-rw-r--r-- | docs/gl_objects/system_hooks.rst | 33 |
3 files changed, 51 insertions, 0 deletions
diff --git a/docs/api-objects.rst b/docs/api-objects.rst index 166b1d9..045b83c 100644 --- a/docs/api-objects.rst +++ b/docs/api-objects.rst @@ -20,4 +20,5 @@ API objects manipulation gl_objects/projects gl_objects/runners gl_objects/settings + gl_objects/system_hooks gl_objects/users diff --git a/docs/gl_objects/system_hooks.py b/docs/gl_objects/system_hooks.py new file mode 100644 index 0000000..9bc487b --- /dev/null +++ b/docs/gl_objects/system_hooks.py @@ -0,0 +1,17 @@ +# list +hooks = gl.hooks.list() +# end list + +# test +gl.hooks.get(hook_id) +# end test + +# create +hook = gl.hooks.create({'url': 'http://your.target.url'}) +# end create + +# delete +gl.hooks.delete(hook_id) +# or +hook.delete() +# end delete diff --git a/docs/gl_objects/system_hooks.rst b/docs/gl_objects/system_hooks.rst new file mode 100644 index 0000000..1d1804b --- /dev/null +++ b/docs/gl_objects/system_hooks.rst @@ -0,0 +1,33 @@ +############ +System hooks +############ + +Use :class:`~gitlab.objects.Hook` objects to manipulate system hooks. The +:attr:`gitlab.Gitlab.hooks` manager object provides helper functions. + +Examples +-------- + +List the system hooks: + +.. literalinclude:: system_hooks.py + :start-after: # list + :end-before: # end list + +Create a system hook: + +.. literalinclude:: system_hooks.py + :start-after: # create + :end-before: # end create + +Test a system hook. The returned object is not usable (it misses the hook ID): + +.. literalinclude:: system_hooks.py + :start-after: # test + :end-before: # end test + +Delete a system hook: + +.. literalinclude:: system_hooks.py + :start-after: # delete + :end-before: # end delete |