diff options
-rw-r--r-- | docs/gl_objects/groups.rst | 19 | ||||
-rw-r--r-- | gitlab/v4/objects.py | 15 | ||||
-rw-r--r-- | tools/python_test_v4.py | 1 |
3 files changed, 34 insertions, 1 deletions
diff --git a/docs/gl_objects/groups.rst b/docs/gl_objects/groups.rst index 5e413af..9006ceb 100644 --- a/docs/gl_objects/groups.rst +++ b/docs/gl_objects/groups.rst @@ -72,6 +72,25 @@ Remove a group: :start-after: # delete :end-before: # end delete +Subgroups +========= + +Reference +--------- + +* v4 API: + + + :class:`gitlab.v4.objects.GroupSubgroup` + + :class:`gitlab.v4.objects.GroupSubgroupManager` + + :attr:`gitlab.v4.objects.Group.subgroups` + +Examples +-------- + +List the subgroups for a group:: + + subgroups = group.subgroups.list() + Group members ============= diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 4cd1401..4bf6776 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -554,6 +554,18 @@ class GroupProjectManager(GetFromListMixin, RESTManager): 'ci_enabled_first') +class GroupSubgroup(RESTObject): + pass + + +class GroupSubgroupManager(GetFromListMixin, RESTManager): + _path = '/groups/%(group_id)s/subgroups' + _obj_cls = GroupSubgroup + _from_parent_attrs = {'group_id': 'id'} + _list_filters = ('skip_groups', 'all_available', 'search', 'order_by', + 'sort', 'statistics', 'owned') + + class GroupVariable(SaveMixin, ObjectDeleteMixin, RESTObject): _id_attr = 'key' @@ -570,11 +582,12 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject): _short_print_attr = 'name' _managers = ( ('accessrequests', 'GroupAccessRequestManager'), + ('issues', 'GroupIssueManager'), ('members', 'GroupMemberManager'), ('milestones', 'GroupMilestoneManager'), ('notificationsettings', 'GroupNotificationSettingsManager'), ('projects', 'GroupProjectManager'), - ('issues', 'GroupIssueManager'), + ('subgroups', 'GroupSubgroupManager'), ('variables', 'GroupVariableManager'), ) diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py index bf69500..66493cb 100644 --- a/tools/python_test_v4.py +++ b/tools/python_test_v4.py @@ -206,6 +206,7 @@ group3 = gl.groups.create({'name': 'group3', 'path': 'group3', 'parent_id': p_id assert(len(gl.groups.list()) == 3) assert(len(gl.groups.list(search='oup1')) == 1) assert(group3.parent_id == p_id) +assert(group2.subgroups.list()[0].id == group3.id) group1.members.create({'access_level': gitlab.Group.OWNER_ACCESS, 'user_id': user1.id}) |