Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.

Commit 1d3decd

Browse files
committed
add 'name' and 'description' to project hooks structs
GitLab 17.x API now supports 'name' and 'description' fields Added fields and updates tests.
1 parent 9851eab commit 1d3decd

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

projects.go

+6
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,8 @@ type HookCustomHeader struct {
12701270
type ProjectHook struct {
12711271
ID int `json:"id"`
12721272
URL string `json:"url"`
1273+
Name string `json:"name,omitempty"`
1274+
Description string `json:"description,omitempty"`
12731275
ConfidentialNoteEvents bool `json:"confidential_note_events"`
12741276
ProjectID int `json:"project_id"`
12751277
PushEvents bool `json:"push_events"`
@@ -1352,6 +1354,8 @@ func (s *ProjectsService) GetProjectHook(pid interface{}, hook int, options ...R
13521354
// GitLab API docs:
13531355
// https://docs.gitlab.com/ee/api/projects.html#add-project-hook
13541356
type AddProjectHookOptions struct {
1357+
Name *string `url:"name,omitempty" json:"name,omitempty"`
1358+
Description *string `url:"description,omitempty" json:"description,omitempty"`
13551359
ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
13561360
ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"`
13571361
DeploymentEvents *bool `url:"deployment_events,omitempty" json:"deployment_events,omitempty"`
@@ -1403,6 +1407,8 @@ func (s *ProjectsService) AddProjectHook(pid interface{}, opt *AddProjectHookOpt
14031407
// GitLab API docs:
14041408
// https://docs.gitlab.com/ee/api/projects.html#edit-project-hook
14051409
type EditProjectHookOptions struct {
1410+
Name *string `url:"name,omitempty" json:"name,omitempty"`
1411+
Description *string `url:"description,omitempty" json:"description,omitempty"`
14061412
ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
14071413
ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"`
14081414
DeploymentEvents *bool `url:"deployment_events,omitempty" json:"deployment_events,omitempty"`

projects_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -1505,6 +1505,8 @@ func TestListProjectHooks(t *testing.T) {
15051505
{
15061506
"id": 1,
15071507
"url": "http://example.com/hook",
1508+
"name": "This is the name of an example hook",
1509+
"description": "This is the description of an example hook",
15081510
"confidential_note_events": true,
15091511
"project_id": 1,
15101512
"push_events": true,
@@ -1541,6 +1543,8 @@ func TestListProjectHooks(t *testing.T) {
15411543
want := []*ProjectHook{{
15421544
ID: 1,
15431545
URL: "http://example.com/hook",
1546+
Name: "This is the name of an example hook",
1547+
Description: "This is the description of an example hook",
15441548
ConfidentialNoteEvents: true,
15451549
ProjectID: 1,
15461550
PushEvents: true,

0 commit comments

Comments
 (0)