From 4a7e9b86aa348b72925bce3af1e5d988b8ce3439 Mon Sep 17 00:00:00 2001 From: Ivan Sugonyak Date: Fri, 25 Jun 2021 20:49:04 +0300 Subject: feat(api): add group hooks --- gitlab/v4/objects/groups.py | 2 ++ gitlab/v4/objects/hooks.py | 52 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) (limited to 'gitlab') diff --git a/gitlab/v4/objects/groups.py b/gitlab/v4/objects/groups.py index 429d95d..ee82415 100644 --- a/gitlab/v4/objects/groups.py +++ b/gitlab/v4/objects/groups.py @@ -13,6 +13,7 @@ from .custom_attributes import GroupCustomAttributeManager # noqa: F401 from .deploy_tokens import GroupDeployTokenManager # noqa: F401 from .epics import GroupEpicManager # noqa: F401 from .export_import import GroupExportManager, GroupImportManager # noqa: F401 +from .hooks import GroupHookManager # noqa: F401 from .issues import GroupIssueManager # noqa: F401 from .labels import GroupLabelManager # noqa: F401 from .members import ( # noqa: F401 @@ -52,6 +53,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject): ("descendant_groups", "GroupDescendantGroupManager"), ("exports", "GroupExportManager"), ("epics", "GroupEpicManager"), + ("hooks", "GroupHookManager"), ("imports", "GroupImportManager"), ("issues", "GroupIssueManager"), ("issues_statistics", "GroupIssuesStatisticsManager"), diff --git a/gitlab/v4/objects/hooks.py b/gitlab/v4/objects/hooks.py index 69b324e..428fd76 100644 --- a/gitlab/v4/objects/hooks.py +++ b/gitlab/v4/objects/hooks.py @@ -6,6 +6,8 @@ __all__ = [ "HookManager", "ProjectHook", "ProjectHookManager", + "GroupHook", + "GroupHookManager", ] @@ -60,3 +62,53 @@ class ProjectHookManager(CRUDMixin, RESTManager): "token", ), ) + + +class GroupHook(SaveMixin, ObjectDeleteMixin, RESTObject): + _short_print_attr = "url" + + +class GroupHookManager(CRUDMixin, RESTManager): + _path = "/groups/%(group_id)s/hooks" + _obj_cls = GroupHook + _from_parent_attrs = {"group_id": "id"} + _create_attrs = RequiredOptional( + required=("url",), + optional=( + "push_events", + "issues_events", + "confidential_issues_events", + "merge_requests_events", + "tag_push_events", + "note_events", + "confidential_note_events", + "job_events", + "pipeline_events", + "wiki_page_events", + "deployment_events", + "releases_events", + "subgroup_events", + "enable_ssl_verification", + "token", + ), + ) + _update_attrs = RequiredOptional( + required=("url",), + optional=( + "push_events", + "issues_events", + "confidential_issues_events", + "merge_requests_events", + "tag_push_events", + "note_events", + "confidential_note_events", + "job_events", + "pipeline_events", + "wiki_page_events", + "deployment_events", + "releases_events", + "subgroup_events", + "enable_ssl_verification", + "token", + ), + ) -- cgit v1.2.1