Skip to content

Commit d2c1744

Browse files
committed
feat(objects): add support for Group wikis
1 parent 1b70580 commit d2c1744

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

docs/gl_objects/wikis.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ References
1111
+ :class:`gitlab.v4.objects.ProjectWiki`
1212
+ :class:`gitlab.v4.objects.ProjectWikiManager`
1313
+ :attr:`gitlab.v4.objects.Project.wikis`
14+
+ :class:`gitlab.v4.objects.GroupWiki`
15+
+ :class:`gitlab.v4.objects.GroupWikiManager`
16+
+ :attr:`gitlab.v4.objects.Group.wikis`
1417

1518
* GitLab API: https://docs.gitlab.com/ce/api/wikis.html
1619

@@ -21,6 +24,10 @@ Get the list of wiki pages for a project::
2124

2225
pages = project.wikis.list()
2326

27+
Get the list of wiki pages for a group::
28+
29+
pages = group.wikis.list()
30+
2431
Get a single wiki page::
2532

2633
page = project.wikis.get(page_slug)

gitlab/v4/objects/groups.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from .projects import GroupProjectManager # noqa: F401
2828
from .runners import GroupRunnerManager # noqa: F401
2929
from .variables import GroupVariableManager # noqa: F401
30+
from .wikis import GroupWikiManager # noqa: F401
3031

3132
__all__ = [
3233
"Group",
@@ -65,6 +66,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
6566
("variables", "GroupVariableManager"),
6667
("clusters", "GroupClusterManager"),
6768
("deploytokens", "GroupDeployTokenManager"),
69+
("wikis", "GroupWikiManager"),
6870
)
6971

7072
@cli.register_custom_action("Group", ("to_project_id",))

gitlab/v4/objects/wikis.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
__all__ = [
55
"ProjectWiki",
66
"ProjectWikiManager",
7+
"GroupWiki",
8+
"GroupWikiManager",
79
]
810

911

@@ -21,3 +23,19 @@ class ProjectWikiManager(CRUDMixin, RESTManager):
2123
)
2224
_update_attrs = RequiredOptional(optional=("title", "content", "format"))
2325
_list_filters = ("with_content",)
26+
27+
28+
class GroupWiki(SaveMixin, ObjectDeleteMixin, RESTObject):
29+
_id_attr = "slug"
30+
_short_print_attr = "slug"
31+
32+
33+
class GroupWikiManager(CRUDMixin, RESTManager):
34+
_path = "/groups/%(group_id)s/wikis"
35+
_obj_cls = GroupWiki
36+
_from_parent_attrs = {"group_id": "id"}
37+
_create_attrs = RequiredOptional(
38+
required=("title", "content"), optional=("format",)
39+
)
40+
_update_attrs = RequiredOptional(optional=("title", "content", "format"))
41+
_list_filters = ("with_content",)

0 commit comments

Comments
 (0)