Skip to content

Commit 580f21e

Browse files
author
Gauvain Pocentek
committed
Add support from listing group issues
1 parent 261f947 commit 580f21e

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

docs/gl_objects/issues.py

+10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
tagged_issues = gl.issues.list(labels=['foo', 'bar'])
99
# end filtered list
1010

11+
# group issues list
12+
issues = gl.group_issues.list(group_id=1)
13+
# or
14+
issues = group.issues.list()
15+
# Filter using the state, labels and milestone parameters
16+
issues = group.issues.list(milestone='1.0', state='opened')
17+
# Order using the order_by and sort parameters
18+
issues = group.issues.list(order_by='created_at', sort='desc')
19+
# end group issues list
20+
1121
# project issues list
1222
issues = gl.project_issues.list(project_id=1)
1323
# or

docs/gl_objects/issues.rst

+16
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ Use the ``state`` and ``label`` parameters to filter the results. Use the
2525
:start-after: # filtered list
2626
:end-before: # end filtered list
2727

28+
Group issues
29+
============
30+
31+
Use :class:`~gitlab.objects.GroupIssue` objects to manipulate issues. The
32+
:attr:`gitlab.Gitlab.project_issues` and :attr:`Group.issues
33+
<gitlab.objects.Group.issues>` manager objects provide helper functions.
34+
35+
Examples
36+
--------
37+
38+
List the group issues:
39+
40+
.. literalinclude:: issues.py
41+
:start-after: # group issues list
42+
:end-before: # end group issues list
43+
2844
Project issues
2945
==============
3046

gitlab/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class Gitlab(object):
6868
user_emails (UserEmailManager): Manager for GitLab users' emails.
6969
user_keys (UserKeyManager): Manager for GitLab users' SSH keys.
7070
users (UserManager): Manager for GitLab users
71+
group_issues (GroupIssueManager): Manager for GitLab group issues
7172
group_projects (GroupProjectManager): Manager for GitLab group projects
7273
group_members (GroupMemberManager): Manager for GitLab group members
7374
groups (GroupManager): Manager for GitLab members
@@ -148,6 +149,7 @@ def __init__(self, url, private_token=None, email=None, password=None,
148149
self.user_emails = UserEmailManager(self)
149150
self.user_keys = UserKeyManager(self)
150151
self.users = UserManager(self)
152+
self.group_issues = GroupIssueManager(self)
151153
self.group_projects = GroupProjectManager(self)
152154
self.group_members = GroupMemberManager(self)
153155
self.groups = GroupManager(self)

gitlab/objects.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,20 @@ class ApplicationSettingsManager(BaseManager):
679679
obj_cls = ApplicationSettings
680680

681681

682+
class GroupIssue(GitlabObject):
683+
_url = '/groups/%(group_id)s/issues'
684+
canGet = 'from_list'
685+
canCreate = False
686+
canUpdate = False
687+
canDelete = False
688+
requiredUrlAttrs = ['group_id']
689+
optionalListAttrs = ['state', 'labels', 'milestone', 'order_by', 'sort']
690+
691+
692+
class GroupIssueManager(BaseManager):
693+
obj_cls = GroupIssue
694+
695+
682696
class GroupMember(GitlabObject):
683697
_url = '/groups/%(group_id)s/members'
684698
canGet = 'from_list'
@@ -718,7 +732,8 @@ class Group(GitlabObject):
718732
optionalUpdateAttrs = ['name', 'path', 'description', 'visibility_level']
719733
shortPrintAttr = 'name'
720734
managers = [('members', GroupMemberManager, [('group_id', 'id')]),
721-
('projects', GroupProjectManager, [('group_id', 'id')])]
735+
('projects', GroupProjectManager, [('group_id', 'id')]),
736+
('issues', GroupIssueManager, [('group_id', 'id')])]
722737

723738
GUEST_ACCESS = 10
724739
REPORTER_ACCESS = 20

0 commit comments

Comments
 (0)