diff options
Diffstat (limited to 'docs/gl_objects/notifications.rst')
| -rw-r--r-- | docs/gl_objects/notifications.rst | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/docs/gl_objects/notifications.rst b/docs/gl_objects/notifications.rst index a7310f3..ab0287f 100644 --- a/docs/gl_objects/notifications.rst +++ b/docs/gl_objects/notifications.rst @@ -30,31 +30,30 @@ Reference + :class:`gitlab.v4.objects.ProjectNotificationSettingsManager` + :attr:`gitlab.v4.objects.Project.notificationsettings` -* v3 API: - - + :class:`gitlab.v3.objects.NotificationSettings` - + :class:`gitlab.v3.objects.NotificationSettingsManager` - + :attr:`gitlab.Gitlab.notificationsettings` - + :class:`gitlab.v3.objects.GroupNotificationSettings` - + :class:`gitlab.v3.objects.GroupNotificationSettingsManager` - + :attr:`gitlab.v3.objects.Group.notificationsettings` - + :class:`gitlab.v3.objects.ProjectNotificationSettings` - + :class:`gitlab.v3.objects.ProjectNotificationSettingsManager` - + :attr:`gitlab.v3.objects.Project.notificationsettings` - * GitLab API: https://docs.gitlab.com/ce/api/notification_settings.html Examples -------- -Get the settings: +Get the notifications settings:: + + # 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() + +Update the notifications settings:: -.. literalinclude:: notifications.py - :start-after: # get - :end-before: # end get + # use a predefined level + settings.level = gitlab.NOTIFICATION_LEVEL_WATCH -Update the settings: + # create a custom setup + settings.level = gitlab.NOTIFICATION_LEVEL_CUSTOM + settings.save() # will create additional attributes, but not mandatory -.. literalinclude:: notifications.py - :start-after: # update - :end-before: # end update + settings.new_merge_request = True + settings.new_issue = True + settings.new_note = True + settings.save() |
