diff options
-rw-r--r-- | docs/api-objects.rst | 1 | ||||
-rw-r--r-- | docs/gl_objects/boards.rst | 95 | ||||
-rw-r--r-- | docs/gl_objects/discussions.rst (renamed from docs/gl_objects/dicussions.rst) | 0 | ||||
-rw-r--r-- | docs/gl_objects/projects.rst | 72 | ||||
-rw-r--r-- | gitlab/v4/objects.py | 24 |
5 files changed, 120 insertions, 72 deletions
diff --git a/docs/api-objects.rst b/docs/api-objects.rst index bcdfccf..eaacf7d 100644 --- a/docs/api-objects.rst +++ b/docs/api-objects.rst @@ -20,6 +20,7 @@ API examples gl_objects/features gl_objects/groups gl_objects/issues + gl_objects/boards gl_objects/labels gl_objects/notifications gl_objects/mrs diff --git a/docs/gl_objects/boards.rst b/docs/gl_objects/boards.rst new file mode 100644 index 0000000..0099371 --- /dev/null +++ b/docs/gl_objects/boards.rst @@ -0,0 +1,95 @@ +############ +Issue boards +############ + +Boards +====== + +Boards are a visual representation of existing issues for a project or a group. +Issues can be moved from one list to the other to track progress and help with +priorities. + +Reference +--------- + +* v4 API: + + + :class:`gitlab.v4.objects.ProjectBoard` + + :class:`gitlab.v4.objects.ProjectBoardManager` + + :attr:`gitlab.v4.objects.Project.boards` + + :class:`gitlab.v4.objects.GroupBoard` + + :class:`gitlab.v4.objects.GroupBoardManager` + + :attr:`gitlab.v4.objects.Group.boards` + +* GitLab API: + + + https://docs.gitlab.com/ce/api/boards.html + + https://docs.gitlab.com/ce/api/group_boards.html + +Examples +-------- + +Get the list of existing boards for a project or a group:: + + # item is a Project or a Group + boards = item.boards.list() + +Get a single board for a project or a group:: + + board = group.boards.get(board_id) + +.. note:: + + Boards cannot be created using the API, they need to be created using the + UI. + +Board lists +=========== + +Boards are made of lists of issues. Each list is associated to a label, and +issues tagged with this label automatically belong to the list. + +Reference +--------- + +* v4 API: + + + :class:`gitlab.v4.objects.ProjectBoardList` + + :class:`gitlab.v4.objects.ProjectBoardListManager` + + :attr:`gitlab.v4.objects.ProjectBoard.lists` + + :class:`gitlab.v4.objects.GroupBoardList` + + :class:`gitlab.v4.objects.GroupBoardListManager` + + :attr:`gitlab.v4.objects.GroupBoard.lists` + +* GitLab API: + + + https://docs.gitlab.com/ce/api/boards.html + + https://docs.gitlab.com/ce/api/group_boards.html + +Examples +-------- + +List the issue lists for a board:: + + b_lists = board.lists.list() + +Get a single list:: + + b_list = board.lists.get(list_id) + +Create a new list:: + + # First get a ProjectLabel + label = get_or_create_label() + # Then use its ID to create the new board list + b_list = board.lists.create({'label_id': label.id}) + +Change a list position. The first list is at position 0. Moving a list will +set it at the given position and move the following lists up a position:: + + b_list.position = 2 + b_list.save() + +Delete a list:: + + b_list.delete() diff --git a/docs/gl_objects/dicussions.rst b/docs/gl_objects/discussions.rst index 7673b7c..7673b7c 100644 --- a/docs/gl_objects/dicussions.rst +++ b/docs/gl_objects/discussions.rst diff --git a/docs/gl_objects/projects.rst b/docs/gl_objects/projects.rst index 1abb82c..b02cdd5 100644 --- a/docs/gl_objects/projects.rst +++ b/docs/gl_objects/projects.rst @@ -565,78 +565,6 @@ Disable a service:: service.delete() -Issue boards -============ - -Boards are a visual representation of existing issues for a project. Issues can -be moved from one list to the other to track progress and help with -priorities. - -Reference ---------- - -* v4 API: - - + :class:`gitlab.v4.objects.ProjectBoard` - + :class:`gitlab.v4.objects.ProjectBoardManager` - + :attr:`gitlab.v4.objects.Project.boards` - -* GitLab API: https://docs.gitlab.com/ce/api/boards.html - -Examples --------- - -Get the list of existing boards for a project:: - - boards = project.boards.list() - -Get a single board for a project:: - - board = project.boards.get(board_id) - -Board lists -=========== - -Reference ---------- - -* v4 API: - - + :class:`gitlab.v4.objects.ProjectBoardList` - + :class:`gitlab.v4.objects.ProjectBoardListManager` - + :attr:`gitlab.v4.objects.Project.board_lists` - -* GitLab API: https://docs.gitlab.com/ce/api/boards.html - -Examples --------- - -List the issue lists for a board:: - - b_lists = board.lists.list() - -Get a single list:: - - b_list = board.lists.get(list_id) - -Create a new list:: - - # First get a ProjectLabel - label = get_or_create_label() - # Then use its ID to create the new board list - b_list = board.lists.create({'label_id': label.id}) - -Change a list position. The first list is at position 0. Moving a list will -set it at the given position and move the following lists up a position:: - - b_list.position = 2 - b_list.save() - -Delete a list:: - - b_list.delete() - - File uploads ============ diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index e4c503f..65134db 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -523,6 +523,29 @@ class GroupAccessRequestManager(ListMixin, CreateMixin, DeleteMixin, _from_parent_attrs = {'group_id': 'id'} +class GroupBoardList(SaveMixin, ObjectDeleteMixin, RESTObject): + pass + + +class GroupBoardListManager(CRUDMixin, RESTManager): + _path = '/groups/%(group_id)s/boards/%(board_id)s/lists' + _obj_cls = GroupBoardList + _from_parent_attrs = {'group_id': 'group_id', + 'board_id': 'id'} + _create_attrs = (('label_id', ), tuple()) + _update_attrs = (('position', ), tuple()) + + +class GroupBoard(RESTObject): + _managers = (('lists', 'GroupBoardListManager'), ) + + +class GroupBoardManager(RetrieveMixin, RESTManager): + _path = '/groups/%(group_id)s/boards' + _obj_cls = GroupBoard + _from_parent_attrs = {'group_id': 'id'} + + class GroupCustomAttribute(ObjectDeleteMixin, RESTObject): _id_attr = 'key' @@ -691,6 +714,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject): _short_print_attr = 'name' _managers = ( ('accessrequests', 'GroupAccessRequestManager'), + ('boards', 'GroupBoardManager'), ('customattributes', 'GroupCustomAttributeManager'), ('issues', 'GroupIssueManager'), ('members', 'GroupMemberManager'), |