# Notification settings

You can define notification settings globally, for groups and for projects. Valid levels are defined as constants:

- `gitlab.NOTIFICATION_LEVEL_DISABLED`
- `gitlab.NOTIFICATION_LEVEL_PARTICIPATING`
- `gitlab.NOTIFICATION_LEVEL_WATCH`
- `gitlab.NOTIFICATION_LEVEL_GLOBAL`
- `gitlab.NOTIFICATION_LEVEL_MENTION`
- `gitlab.NOTIFICATION_LEVEL_CUSTOM`

You get access to fine-grained settings if you use the `NOTIFICATION_LEVEL_CUSTOM` level.

## Reference

- v4 API:
  - `gitlab.v4.objects.NotificationSettings`
  - `gitlab.v4.objects.NotificationSettingsManager`
  - `gitlab.Gitlab.notificationsettings`
  - `gitlab.v4.objects.GroupNotificationSettings`
  - `gitlab.v4.objects.GroupNotificationSettingsManager`
  - `gitlab.v4.objects.Group.notificationsettings`
  - `gitlab.v4.objects.ProjectNotificationSettings`
  - `gitlab.v4.objects.ProjectNotificationSettingsManager`
  - `gitlab.v4.objects.Project.notificationsettings`
- v3 API:
  - `gitlab.v3.objects.NotificationSettings`
  - `gitlab.v3.objects.NotificationSettingsManager`
  - `gitlab.Gitlab.notificationsettings`
  - `gitlab.v3.objects.GroupNotificationSettings`
  - `gitlab.v3.objects.GroupNotificationSettingsManager`
  - `gitlab.v3.objects.Group.notificationsettings`
  - `gitlab.v3.objects.ProjectNotificationSettings`
  - `gitlab.v3.objects.ProjectNotificationSettingsManager`
  - `gitlab.v3.objects.Project.notificationsettings`
- GitLab API: https://docs.gitlab.com/ce/api/notification_settings.html

## Examples

Get the 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 settings:

    # 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()