summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2016-10-23 21:46:28 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2016-10-23 21:46:28 +0200
commitb15f17b6d2008ee658cf9206aa37faaf966a521b (patch)
tree0ea09ee088d28770c7bc6d0e34382ca1cb142a9f /docs
parent6d3450c4fe4a2e592b9000be309819278f519e11 (diff)
downloadgitlab-b15f17b6d2008ee658cf9206aa37faaf966a521b.tar.gz
Add support for the notification settings API
Diffstat (limited to 'docs')
-rw-r--r--docs/api-objects.rst3
-rw-r--r--docs/gl_objects/notifications.py21
-rw-r--r--docs/gl_objects/notifications.rst38
3 files changed, 61 insertions, 1 deletions
diff --git a/docs/api-objects.rst b/docs/api-objects.rst
index 0328414..5270246 100644
--- a/docs/api-objects.rst
+++ b/docs/api-objects.rst
@@ -7,6 +7,7 @@ API objects manipulation
gl_objects/access_requests
gl_objects/branches
+ gl_objects/messages
gl_objects/builds
gl_objects/commits
gl_objects/deploy_keys
@@ -16,7 +17,7 @@ API objects manipulation
gl_objects/issues
gl_objects/labels
gl_objects/licenses
- gl_objects/messages
+ gl_objects/notifications
gl_objects/mrs
gl_objects/namespaces
gl_objects/milestones
diff --git a/docs/gl_objects/notifications.py b/docs/gl_objects/notifications.py
new file mode 100644
index 0000000..c46e36e
--- /dev/null
+++ b/docs/gl_objects/notifications.py
@@ -0,0 +1,21 @@
+# get
+# global settings
+settings = gl.notificationsettings.get()
+# for a group
+settings = gl.groups.get(group_id).notificationsettings.get()
+# for a project
+settings = gl.projects.get(project_id).notificationsettings.get()
+# end get
+
+# update
+# use a predefined level
+settings.level = gitlab.NOTIFICATION_LEVEL_WATCH
+# create a custom setup
+settings.level = gitlab.NOTIFICATION_LEVEL_CUSTOM
+settings.save() # will create additional attributes, but not mandatory
+
+settings.new_merge_request = True
+settings.new_issue = True
+settings.new_note = True
+settings.save()
+# end update
diff --git a/docs/gl_objects/notifications.rst b/docs/gl_objects/notifications.rst
new file mode 100644
index 0000000..472f710
--- /dev/null
+++ b/docs/gl_objects/notifications.rst
@@ -0,0 +1,38 @@
+#####################
+Notification settings
+#####################
+
+You can define notification settings globally, for groups and for projects.
+Valid levels are defined as constants:
+
+* ``NOTIFICATION_LEVEL_DISABLED``
+* ``NOTIFICATION_LEVEL_PARTICIPATING``
+* ``NOTIFICATION_LEVEL_WATCH``
+* ``NOTIFICATION_LEVEL_GLOBAL``
+* ``NOTIFICATION_LEVEL_MENTION``
+* ``NOTIFICATION_LEVEL_CUSTOM``
+
+You get access to fine-grained settings if you use the
+``NOTIFICATION_LEVEL_CUSTOM`` level.
+
+* Object classes: :class:`gitlab.objects.NotificationSettings` (global),
+ :class:`gitlab.objects.GroupNotificationSettings` (groups) and
+ :class:`gitlab.objects.ProjectNotificationSettings` (projects)
+* Manager objects: :attr:`gitlab.Gitlab.notificationsettings` (global),
+ :attr:`gitlab.objects.Group.notificationsettings` (groups) and
+ :attr:`gitlab.objects.Project.notificationsettings` (projects)
+
+Examples
+--------
+
+Get the settings:
+
+.. literalinclude:: notifications.py
+ :start-after: # get
+ :end-before: # end get
+
+Update the settings:
+
+.. literalinclude:: notifications.py
+ :start-after: # update
+ :end-before: # end update