summaryrefslogtreecommitdiff
path: root/gitlab
diff options
context:
space:
mode:
authorNejc Habjan <hab.nejc@gmail.com>2021-06-27 20:26:41 +0200
committerGitHub <noreply@github.com>2021-06-27 20:26:41 +0200
commit6abf13a7e25e368da342e7d1da6cfc19915c2dfd (patch)
tree260ab3034ff8a51dcfcb5d56805d1120dcd02f71 /gitlab
parent33d342818599f403434e7024097449b6f21babc0 (diff)
parent953f207466c53c28a877f2a88da9160acef40643 (diff)
downloadgitlab-6abf13a7e25e368da342e7d1da6cfc19915c2dfd.tar.gz
Merge pull request #1533 from sugonyak/add-group-hooks
feat(api): add group hooks
Diffstat (limited to 'gitlab')
-rw-r--r--gitlab/v4/objects/groups.py2
-rw-r--r--gitlab/v4/objects/hooks.py52
2 files changed, 54 insertions, 0 deletions
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",
+ ),
+ )