Skip to content

Commit f4c4e52

Browse files
author
Gauvain Pocentek
committed
Add support for board creation/deletion (EE)
1 parent d6a61af commit f4c4e52

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-9
lines changed

docs/gl_objects/boards.rst

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,25 @@ Examples
3232
Get the list of existing boards for a project or a group::
3333

3434
# item is a Project or a Group
35-
boards = item.boards.list()
35+
boards = project_or_group.boards.list()
3636

3737
Get a single board for a project or a group::
3838

39-
board = group.boards.get(board_id)
39+
board = project_or_group.boards.get(board_id)
4040

41-
.. note::
41+
Create a board::
4242

43-
Boards cannot be created using the API, they need to be created using the
44-
UI.
43+
board = project_or_group.boards.create({'name': 'new-board'})
44+
45+
.. note:: Board creation is not supported in the GitLab CE edition.
46+
47+
Delete a board::
48+
49+
board.delete()
50+
# or
51+
project_or_group.boards.delete(board_id)
52+
53+
.. note:: Board deletion is not supported in the GitLab CE edition.
4554

4655
Board lists
4756
===========

gitlab/v4/objects.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,14 +580,15 @@ class GroupBoardListManager(CRUDMixin, RESTManager):
580580
_update_attrs = (('position', ), tuple())
581581

582582

583-
class GroupBoard(RESTObject):
583+
class GroupBoard(ObjectDeleteMixin, RESTObject):
584584
_managers = (('lists', 'GroupBoardListManager'), )
585585

586586

587-
class GroupBoardManager(RetrieveMixin, RESTManager):
587+
class GroupBoardManager(NoUpdateMixin, RESTManager):
588588
_path = '/groups/%(group_id)s/boards'
589589
_obj_cls = GroupBoard
590590
_from_parent_attrs = {'group_id': 'id'}
591+
_create_attrs = (('name', ), tuple())
591592

592593

593594
class GroupCustomAttribute(ObjectDeleteMixin, RESTObject):
@@ -1004,14 +1005,15 @@ class ProjectBoardListManager(CRUDMixin, RESTManager):
10041005
_update_attrs = (('position', ), tuple())
10051006

10061007

1007-
class ProjectBoard(RESTObject):
1008+
class ProjectBoard(ObjectDeleteMixin, RESTObject):
10081009
_managers = (('lists', 'ProjectBoardListManager'), )
10091010

10101011

1011-
class ProjectBoardManager(RetrieveMixin, RESTManager):
1012+
class ProjectBoardManager(NoUpdateMixin, RESTManager):
10121013
_path = '/projects/%(project_id)s/boards'
10131014
_obj_cls = ProjectBoard
10141015
_from_parent_attrs = {'project_id': 'id'}
1016+
_create_attrs = (('name', ), tuple())
10151017

10161018

10171019
class ProjectBranch(ObjectDeleteMixin, RESTObject):

tools/ee-test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,20 @@ def end_log():
6666
group1.ldap_sync()
6767
group1.delete_ldap_group_link(LDAP_CN)
6868
end_log()
69+
70+
start_log('Boards')
71+
# bit of cleanup just in case
72+
for board in project1.boards.list():
73+
if board.name == 'testboard':
74+
board.delete()
75+
board = project1.boards.create({'name': 'testboard'})
76+
board = project1.boards.get(board.id)
77+
project1.boards.delete(board.id)
78+
79+
for board in group1.boards.list():
80+
if board.name == 'testboard':
81+
board.delete()
82+
board = group1.boards.create({'name': 'testboard'})
83+
board = group1.boards.get(board.id)
84+
group1.boards.delete(board.id)
85+
end_log()

0 commit comments

Comments
 (0)