nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: xanzy/go-gitlab
Pull request #1116 (2021-03-29 17:33:26)

Add require_password_to_approve MR setting


Patch:
diff --git a/projects.go b/projects.go
index fb58eef..fd1973c 100644
--- a/projects.go
+++ b/projects.go
@@ -1431,6 +1431,7 @@ type ProjectApprovals struct {
 	DisableOverridingApproversPerMergeRequest bool                         `json:"disable_overriding_approvers_per_merge_request"`
 	MergeRequestsAuthorApproval               bool                         `json:"merge_requests_author_approval"`
 	MergeRequestsDisableCommittersApproval    bool                         `json:"merge_requests_disable_committers_approval"`
+	RequirePasswordToApprove                  bool                         `json:"require_password_to_approve"`
 }
 
 // GetApprovalConfiguration get the approval configuration for a project.
@@ -1469,6 +1470,7 @@ type ChangeApprovalConfigurationOptions struct {
 	DisableOverridingApproversPerMergeRequest *bool `url:"disable_overriding_approvers_per_merge_request,omitempty" json:"disable_overriding_approvers_per_merge_request,omitempty"`
 	MergeRequestsAuthorApproval               *bool `url:"merge_requests_author_approval,omitempty" json:"merge_requests_author_approval,omitempty"`
 	MergeRequestsDisableCommittersApproval    *bool `url:"merge_requests_disable_committers_approval,omitempty" json:"merge_requests_disable_committers_approval,omitempty"`
+	RequirePasswordToApprove                  *bool `url:"require_password_to_approve,omitempty" json:"require_password_to_approve,omitempty"`
 }
 
 // ChangeApprovalConfiguration updates the approval configuration for a project.


Test patch:
diff --git a/projects_test.go b/projects_test.go
index b4a0583..4230ddf 100644
--- a/projects_test.go
+++ b/projects_test.go
@@ -487,7 +487,8 @@ func TestGetApprovalConfiguration(t *testing.T) {
 			"reset_approvals_on_push": false,
 			"disable_overriding_approvers_per_merge_request": false,
 			"merge_requests_author_approval": true,
-			"merge_requests_disable_committers_approval": true
+			"merge_requests_disable_committers_approval": true,
+			"require_password_to_approve": true
 		}`)
 	})
 
@@ -504,6 +505,7 @@ func TestGetApprovalConfiguration(t *testing.T) {
 		DisableOverridingApproversPerMergeRequest: false,
 		MergeRequestsAuthorApproval:               true,
 		MergeRequestsDisableCommittersApproval:    true,
+		RequirePasswordToApprove:                  true,
 	}
 
 	if !reflect.DeepEqual(want, approvals) {
@@ -525,7 +527,8 @@ func TestChangeApprovalConfiguration(t *testing.T) {
 			"reset_approvals_on_push": false,
 			"disable_overriding_approvers_per_merge_request": false,
 			"merge_requests_author_approval": true,
-			"merge_requests_disable_committers_approval": true
+			"merge_requests_disable_committers_approval": true,
+			"require_password_to_approve": true
 		}`)
 	})
 
@@ -546,6 +549,7 @@ func TestChangeApprovalConfiguration(t *testing.T) {
 		DisableOverridingApproversPerMergeRequest: false,
 		MergeRequestsAuthorApproval:               true,
 		MergeRequestsDisableCommittersApproval:    true,
+		RequirePasswordToApprove:                  true,
 	}
 
 	if !reflect.DeepEqual(want, approvals) {
Repository: xanzy/go-gitlab
Pull request #1140 (2021-05-03 05:25:10)

support the FirstContribution in `MergeRequest`
`FirstContribution`  is a boolean that indicates whether the author of the Merge Request is making its first contribution (true) or already has commits in the repository (false).

This is required for our bot to know when to ping a team of mentors that are better prepared to help a new contributor navigate its way to having its merge request accepted (https://gitlab.alpinelinux.org/Cogitri/aports-qa-bot/-/issues/14)


Patch:
diff --git a/merge_requests.go b/merge_requests.go
index 9b9b236..3ec2a7e 100644
--- a/merge_requests.go
+++ b/merge_requests.go
@@ -100,6 +100,7 @@ type MergeRequest struct {
 	RebaseInProgress     bool   `json:"rebase_in_progress"`
 	ApprovalsBeforeMerge int    `json:"approvals_before_merge"`
 	Reference            string `json:"reference"`
+	FirstContribution    bool   `json:"first_contribution"`
 	TaskCompletionStatus struct {
 		Count          int `json:"count"`
 		CompletedCount int `json:"completed_count"`


Test patch:
diff --git a/merge_requests_test.go b/merge_requests_test.go
index a0398fa..e0fcb46 100644
--- a/merge_requests_test.go
+++ b/merge_requests_test.go
@@ -140,6 +140,7 @@ func TestGetMergeRequest(t *testing.T) {
 	require.Equal(t, mergeRequest.CreatedAt, &mrCreation)
 	mrUpdate := time.Date(2019, 8, 20, 9, 9, 56, 690000000, time.UTC)
 	require.Equal(t, mergeRequest.UpdatedAt, &mrUpdate)
+	require.Equal(t, mergeRequest.FirstContribution, true)
 	require.Equal(t, mergeRequest.HasConflicts, true)
 }
 
diff --git a/testdata/get_merge_request.json b/testdata/get_merge_request.json
index a1a1fc1..39f592e 100644
--- a/testdata/get_merge_request.json
+++ b/testdata/get_merge_request.json
@@ -158,6 +158,7 @@
   "user": {
     "can_merge": false
   },
+  "first_contribution": true,
   "approvals_before_merge": 1,
   "has_conflicts": true
 }
Repository: xanzy/go-gitlab
Pull request #1169 (2021-06-20 16:19:59)

add note Type
Add missing Note type, can be `DiscussionNote` or `DiffNote`. 


Patch:
diff --git a/notes.go b/notes.go
index 28edd73..d51d2fa 100644
--- a/notes.go
+++ b/notes.go
@@ -34,11 +34,12 @@ type NotesService struct {
 //
 // GitLab API docs: https://docs.gitlab.com/ce/api/notes.html
 type Note struct {
-	ID         int    `json:"id"`
-	Body       string `json:"body"`
-	Attachment string `json:"attachment"`
-	Title      string `json:"title"`
-	FileName   string `json:"file_name"`
+	ID         int           `json:"id"`
+	Type       NoteTypeValue `json:"type"`
+	Body       string        `json:"body"`
+	Attachment string        `json:"attachment"`
+	Title      string        `json:"title"`
+	FileName   string        `json:"file_name"`
 	Author     struct {
 		ID        int    `json:"id"`
 		Username  string `json:"username"`
diff --git a/types.go b/types.go
index 44187b2..17dcaee 100644
--- a/types.go
+++ b/types.go
@@ -290,6 +290,25 @@ func MergeMethod(v MergeMethodValue) *MergeMethodValue {
 	return p
 }
 
+// NoteTypeValue represents the type of a Note.
+type NoteTypeValue string
+
+// List of available note types.
+const (
+	DiffNote       NoteTypeValue = "DiffNote"
+	DiscussionNote NoteTypeValue = "DiscussionNote"
+	GenericNote    NoteTypeValue = "Note"
+	LegacyDiffNote NoteTypeValue = "LegacyDiffNote"
+)
+
+// NoteType is a helper routine that allocates a new NoteTypeValue to
+// store v and returns a pointer to it.
+func NoteType(v NoteTypeValue) *NoteTypeValue {
+	p := new(NoteTypeValue)
+	*p = v
+	return p
+}
+
 // NotificationLevelValue represents a notification level.
 type NotificationLevelValue int
 


Test patch:
diff --git a/notes_test.go b/notes_test.go
index 8e6813f..d06f666 100644
--- a/notes_test.go
+++ b/notes_test.go
@@ -52,3 +52,31 @@ func TestGetEpicNote(t *testing.T) {
 		t.Errorf("Notes.GetEpicNote want %#v, got %#v", note, want)
 	}
 }
+
+func TestGetMergeRequestNote(t *testing.T) {
+	mux, server, client := setup(t)
+	defer teardown(server)
+
+	mux.HandleFunc("/api/v4/projects/1/merge_requests/4329/notes/3", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, http.MethodGet)
+		fmt.Fprint(w, `{"id":3,"type":"DiffNote","body":"foo bar","attachment":null,"system":false,"noteable_id":4392,"noteable_type":"Epic","resolvable":false,"noteable_iid":null}`)
+	})
+
+	note, _, err := client.Notes.GetMergeRequestNote("1", 4329, 3, nil)
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	want := &Note{
+		ID:           3,
+		Type:         DiffNote,
+		Body:         "foo bar",
+		System:       false,
+		NoteableID:   4392,
+		NoteableType: "Epic",
+	}
+
+	if !reflect.DeepEqual(note, want) {
+		t.Errorf("Notes.GetEpicNote want %#v, got %#v", note, want)
+	}
+}
Repository: xanzy/go-gitlab
Pull request #1189 (2021-08-16 18:47:48)

Add GetGroupOptions
The `/groups/:id` endpoint actually has a limited set of options available which aren't reflected in the library currently. See: https://docs.gitlab.com/ee/api/groups.html#details-of-a-group

Also noting that this is a backwards incompatible change since the GetGroup function didn't previously require an options struct sent with it. Shouldn't affect users that pin to their specific versions with go modules, but to those upgrading it might be a tiny bit of surprise cleanup.


Patch:
diff --git a/groups.go b/groups.go
index 8632357..248e8ae 100644
--- a/groups.go
+++ b/groups.go
@@ -122,17 +122,26 @@ func (s *GroupsService) ListGroups(opt *ListGroupsOptions, options ...RequestOpt
 	return g, resp, err
 }
 
+// GetGroupOptions represents the available GetGroup() options.
+//
+// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#details-of-a-group
+type GetGroupOptions struct {
+	ListOptions
+	WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"`
+	WithProjects         *bool `url:"with_projects,omitempty" json:"with_projects,omitempty"`
+}
+
 // GetGroup gets all details of a group.
 //
 // GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#details-of-a-group
-func (s *GroupsService) GetGroup(gid interface{}, options ...RequestOptionFunc) (*Group, *Response, error) {
+func (s *GroupsService) GetGroup(gid interface{}, opt *GetGroupOptions, options ...RequestOptionFunc) (*Group, *Response, error) {
 	group, err := parseID(gid)
 	if err != nil {
 		return nil, nil, err
 	}
 	u := fmt.Sprintf("groups/%s", pathEscape(group))
 
-	req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
+	req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
 	if err != nil {
 		return nil, nil, err
 	}


Test patch:
diff --git a/groups_test.go b/groups_test.go
index 515dc81..e2e2b87 100644
--- a/groups_test.go
+++ b/groups_test.go
@@ -38,7 +38,7 @@ func TestGetGroup(t *testing.T) {
 			fmt.Fprint(w, `{"id": 1, "name": "g"}`)
 		})
 
-	group, _, err := client.Groups.GetGroup("g")
+	group, _, err := client.Groups.GetGroup("g", &GetGroupOptions{})
 	if err != nil {
 		t.Errorf("Groups.GetGroup returned error: %v", err)
 	}
Repository: xanzy/go-gitlab
Pull request #1291 (2021-11-23 23:00:02)

fix: update pipeline webhook event type payload
This change brings in `Environment` struct as part of the Pipeline Event Payload. Recent versions of the gitlab api's pipeline event payload contain the environment details which would be useful to expose via this sdk.


Patch:
diff --git a/event_webhook_types.go b/event_webhook_types.go
index 719e575..5f253e5 100644
--- a/event_webhook_types.go
+++ b/event_webhook_types.go
@@ -698,15 +698,22 @@ type PipelineEvent struct {
 		AllowFailure bool       `json:"allow_failure"`
 		User         *EventUser `json:"user"`
 		Runner       struct {
-			ID          int    `json:"id"`
-			Description string `json:"description"`
-			Active      bool   `json:"active"`
-			IsShared    bool   `json:"is_shared"`
+			ID          int      `json:"id"`
+			Description string   `json:"description"`
+			Active      bool     `json:"active"`
+			IsShared    bool     `json:"is_shared"`
+			RunnerType  bool     `json:"runner_type"`
+			Tags        []string `json:"tags"`
 		} `json:"runner"`
 		ArtifactsFile struct {
 			Filename string `json:"filename"`
 			Size     int    `json:"size"`
 		} `json:"artifacts_file"`
+		Environment struct {
+			Name           string `json:"name"`
+			Action         string `json:"action"`
+			DeploymentTier string `json:"deployment_tier"`
+		} `json:"environment"`
 	} `json:"builds"`
 }
 


Test patch:
diff --git a/event_webhook_types_test.go b/event_webhook_types_test.go
index 7f6d0ee..9ba1bef 100644
--- a/event_webhook_types_test.go
+++ b/event_webhook_types_test.go
@@ -339,6 +339,10 @@ func TestPipelineEventUnmarshal(t *testing.T) {
 	if event.Builds[0].AllowFailure != true {
 		t.Errorf("Builds.0.AllowFailure is %v, want %v", event.Builds[0].AllowFailure, true)
 	}
+	
+	if event.Builds[0].Environment.Name != "production" {
+		t.Errorf("Builds.0.Environment.Name is %v, want %v", event.Builds[0].Environment.Name, "production")
+	}
 }
 
 func TestPushEventUnmarshal(t *testing.T) {
diff --git a/testdata/webhooks/pipeline.json b/testdata/webhooks/pipeline.json
index 691bcad..f8762eb 100644
--- a/testdata/webhooks/pipeline.json
+++ b/testdata/webhooks/pipeline.json
@@ -90,7 +90,12 @@
         "artifacts_file":{
            "filename": null,
            "size": null
-        }
+        },
+        "environment": {
+             "name": "production",
+             "action": "start",
+             "deployment_tier": "production"
+         }
      },
      {
         "id": 377,
Repository: xanzy/go-gitlab
Pull request #1314 (2021-12-13 11:43:42)

Add none documented response property
Hi! 

First of all thank you for the great package. 
As I used it, I discovered a missing property which is not documented in the official GitLab API docs. 
If you defined a [CODEOWNERS](https://docs.gitlab.com/ee/user/project/code_owners.html) file you get as "rule_type" "code_owner" and also the property "section". I only added the property to the response.

svanharmelen: I'm usually not a bit fan of adding undocumented things, so a little bit in doubt if we should add this. Do you have a specific need to the field? And if so, can you point me to something that shows this field does indeed exist? Thanks!
Micaso: Yes I can fully understand you. 
I created a [test repo](https://gitlab.com/micaso/test-codeowners) on GitLab.

The response of following GET response will show the property:
https://gitlab.com/api/v4/projects/32139950/merge_requests/1/approval_rules 

And yes I do have a need for this field as we want to distinguish between reviewer and assignee. Its a workflow thing for us. Based on the section we could set persons as assignee/reviewer. 

Thank you for your time

Patch:
diff --git a/merge_request_approvals.go b/merge_request_approvals.go
index df80a71..1b13bf6 100644
--- a/merge_request_approvals.go
+++ b/merge_request_approvals.go
@@ -100,6 +100,7 @@ type MergeRequestApprovalRule struct {
 	Users                []*BasicUser         `json:"users"`
 	Groups               []*Group             `json:"groups"`
 	ContainsHiddenGroups bool                 `json:"contains_hidden_groups"`
+	Section              string               `json:"section"`
 	ApprovedBy           []*BasicUser         `json:"approved_by"`
 	Approved             bool                 `json:"approved"`
 }


Test patch:
diff --git a/merge_request_approvals_test.go b/merge_request_approvals_test.go
index 7f845f1..3dc85bc 100644
--- a/merge_request_approvals_test.go
+++ b/merge_request_approvals_test.go
@@ -85,6 +85,7 @@ func TestGetApprovalState(t *testing.T) {
 					}
 				],
 				"contains_hidden_groups": false,
+				"section": "test",
 				"approved_by": [
 					{
 						"id": 5,
@@ -157,6 +158,7 @@ func TestGetApprovalState(t *testing.T) {
 						FullPath:             "group1",
 					},
 				},
+				Section: "test",
 				ApprovedBy: []*BasicUser{
 					{
 						ID:        5,
@@ -236,7 +238,8 @@ func TestGetApprovalRules(t *testing.T) {
 						"ldap_access": null
 					}
 				],
-				"contains_hidden_groups": false
+				"contains_hidden_groups": false,
+				"section": "test"
 			}
 		]`)
 	})
@@ -295,6 +298,7 @@ func TestGetApprovalRules(t *testing.T) {
 					FullPath:             "group1",
 				},
 			},
+			Section: "test",
 		},
 	}
Repository: xanzy/go-gitlab
Pull request #1357 (2022-02-02 01:58:37)

Add Draft field to MergeRequest
closes https://github.com/xanzy/go-gitlab/issues/1356


Patch:
diff --git a/merge_requests.go b/merge_requests.go
index 2495924..8c01fe7 100644
--- a/merge_requests.go
+++ b/merge_requests.go
@@ -54,6 +54,7 @@ type MergeRequest struct {
 	TargetProjectID           int              `json:"target_project_id"`
 	Labels                    Labels           `json:"labels"`
 	Description               string           `json:"description"`
+	Draft                     bool             `json:"draft"`
 	WorkInProgress            bool             `json:"work_in_progress"`
 	Milestone                 *Milestone       `json:"milestone"`
 	MergeWhenPipelineSucceeds bool             `json:"merge_when_pipeline_succeeds"`


Test patch:
diff --git a/merge_requests_test.go b/merge_requests_test.go
index 05f7281..224e014 100644
--- a/merge_requests_test.go
+++ b/merge_requests_test.go
@@ -144,6 +144,7 @@ func TestGetMergeRequest(t *testing.T) {
 	require.Equal(t, mergeRequest.UpdatedAt, &mrUpdate)
 	require.Equal(t, mergeRequest.FirstContribution, true)
 	require.Equal(t, mergeRequest.HasConflicts, true)
+	require.Equal(t, mergeRequest.Draft, true)
 }
 
 func TestListProjectMergeRequests(t *testing.T) {
diff --git a/testdata/get_merge_request.json b/testdata/get_merge_request.json
index 39f592e..8825fd0 100644
--- a/testdata/get_merge_request.json
+++ b/testdata/get_merge_request.json
@@ -160,5 +160,6 @@
   },
   "first_contribution": true,
   "approvals_before_merge": 1,
-  "has_conflicts": true
+  "has_conflicts": true,
+  "draft": true
 }
Repository: xanzy/go-gitlab
Pull request #1383 (2022-02-17 12:12:16)

Add missing fork projects options
The Gitlab API offers more options when forking, see
https://docs.gitlab.com/ee/api/projects.html#fork-project

Let's add them for completeness, also deprecate `Namespace`


Patch:
diff --git a/projects.go b/projects.go
index 1cbc1d7..baf3b31 100644
--- a/projects.go
+++ b/projects.go
@@ -909,9 +909,16 @@ func (s *ProjectsService) EditProject(pid interface{}, opt *EditProjectOptions,
 //
 // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#fork-project
 type ForkProjectOptions struct {
-	Name      *string `url:"name,omitempty" json:"name,omitempty" `
+	Description                   *string          `url:"description,omitempty" json:"description,omitempty"`
+	MergeRequestDefaultTargetSelf *bool            `url:"mr_default_target_self,omitempty" json:"mr_default_target_self,omitempty"`
+	Name                          *string          `url:"name,omitempty" json:"name,omitempty"`
+	NamespaceID                   *int             `url:"namespace_id,omitempty" json:"namespace_id,omitempty"`
+	NamespacePath                 *string          `url:"namespace_path,omitempty" json:"namespace_path,omitempty"`
+	Path                          *string          `url:"path,omitempty" json:"path,omitempty"`
+	Visibility                    *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
+
+	// Deprecated members
 	Namespace *string `url:"namespace,omitempty" json:"namespace,omitempty"`
-	Path      *string `url:"path,omitempty" json:"path,omitempty"`
 }
 
 // ForkProject forks a project into the user namespace of the authenticated


Test patch:
diff --git a/projects_test.go b/projects_test.go
index b7becaf..90815e7 100644
--- a/projects_test.go
+++ b/projects_test.go
@@ -751,20 +751,20 @@ func TestForkProject(t *testing.T) {
 	mux, server, client := setup(t)
 	defer teardown(server)
 
-	namespace := "mynamespace"
+	namespaceID := 42
 	name := "myreponame"
 	path := "myrepopath"
 
 	mux.HandleFunc("/api/v4/projects/1/fork", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, http.MethodPost)
-		testBody(t, r, fmt.Sprintf(`{"name":"%s","namespace":"%s","path":"%s"}`, name, namespace, path))
+		testBody(t, r, fmt.Sprintf(`{"name":"%s","namespace_id":%d,"path":"%s"}`, name, namespaceID, path))
 		fmt.Fprint(w, `{"id":2}`)
 	})
 
 	project, _, err := client.Projects.ForkProject(1, &ForkProjectOptions{
-		Namespace: String(namespace),
-		Name:      String(name),
-		Path:      String(path),
+		NamespaceID: Int(namespaceID),
+		Name:        String(name),
+		Path:        String(path),
 	})
 	if err != nil {
 		t.Errorf("Projects.ForkProject returned error: %v", err)
Repository: xanzy/go-gitlab
Pull request #1391 (2022-02-25 07:01:28)

fix: add ImportError field to ImportStatus


Patch:
diff --git a/project_import_export.go b/project_import_export.go
index 67f8a62..81b9845 100644
--- a/project_import_export.go
+++ b/project_import_export.go
@@ -46,6 +46,9 @@ type ImportStatus struct {
 	PathWithNamespace string     `json:"path_with_namespace"`
 	CreateAt          *time.Time `json:"create_at"`
 	ImportStatus      string     `json:"import_status"`
+	ImportType        string     `json:"import_type"`
+	CorrelationID     string     `json:"correlation_id"`
+	ImportError       string     `json:"import_error"`
 }
 
 func (s ImportStatus) String() string {


Test patch:
diff --git a/project_import_export_test.go b/project_import_export_test.go
index 723eefd..188355e 100644
--- a/project_import_export_test.go
+++ b/project_import_export_test.go
@@ -144,8 +144,7 @@ func TestProjectImportExportService_ImportFile(t *testing.T) {
 			  "path": "api-project",
 			  "path_with_namespace": "root/api-project",
 			  "import_status": "scheduled",
-			  "correlation_id": "mezklWso3Za",
-			  "failed_relations": []
+			  "correlation_id": "mezklWso3Za"
 			}
 		`)
 	})
@@ -158,6 +157,7 @@ func TestProjectImportExportService_ImportFile(t *testing.T) {
 		Path:              "api-project",
 		PathWithNamespace: "root/api-project",
 		ImportStatus:      "scheduled",
+		CorrelationID:     "mezklWso3Za",
 	}
 
 	file := bytes.NewBufferString("dummy")
@@ -187,16 +187,7 @@ func TestProjectImportExportService_ImportStatus(t *testing.T) {
 			  "path": "gitlab-test",
 			  "path_with_namespace": "gitlab-org/gitlab-test",
 			  "import_status": "started",
-			  "correlation_id": "mezklWso3Za",
-			  "failed_relations": [
-				{
-				  "id": 42,
-				  "exception_class": "RuntimeError",
-				  "exception_message": "A failure occurred",
-				  "source": "custom error context",
-				  "relation_name": "merge_requests"
-				}
-			  ]
+			  "correlation_id": "mezklWso3Za"
 			}
 		`)
 	})
@@ -209,6 +200,7 @@ func TestProjectImportExportService_ImportStatus(t *testing.T) {
 		Path:              "gitlab-test",
 		PathWithNamespace: "gitlab-org/gitlab-test",
 		ImportStatus:      "started",
+		CorrelationID:     "mezklWso3Za",
 	}
 
 	es, resp, err := client.ProjectImportExport.ImportStatus(1, nil)
Repository: xanzy/go-gitlab
Pull request #1399 (2022-03-02 16:37:20)

Creation of match between tags.go and Gitlab API
At present time tags structure doesn't match Gitlab API. For this reason, I add fields `target` and `protected` ([link to Gitlab API](https://docs.gitlab.com/ee/api/tags.html)).


Patch:
diff --git a/tags.go b/tags.go
index 7f2851d..e417a11 100644
--- a/tags.go
+++ b/tags.go
@@ -34,10 +34,12 @@ type TagsService struct {
 //
 // GitLab API docs: https://docs.gitlab.com/ce/api/tags.html
 type Tag struct {
-	Commit  *Commit      `json:"commit"`
-	Release *ReleaseNote `json:"release"`
-	Name    string       `json:"name"`
-	Message string       `json:"message"`
+	Commit    *Commit      `json:"commit"`
+	Release   *ReleaseNote `json:"release"`
+	Name      string       `json:"name"`
+	Message   string       `json:"message"`
+	Protected bool         `json:"protected"`
+	Target    string       `json:"target"`
 }
 
 // ReleaseNote represents a GitLab version release.


Test patch:
diff --git a/tags_test.go b/tags_test.go
index 41518e2..d8bd500 100644
--- a/tags_test.go
+++ b/tags_test.go
@@ -29,7 +29,17 @@ func TestTagsService_ListTags(t *testing.T) {
 
 	mux.HandleFunc("/api/v4/projects/1/repository/tags", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, http.MethodGet)
-		fmt.Fprint(w, `[{"name": "1.0.0"},{"name": "1.0.1"}]`)
+		fmt.Fprint(w, `[
+      {
+        "name": "1.0.0",
+        "message": "test",
+        "target": "fffff",
+        "protected": false
+      },{
+        "name": "1.0.1",
+        "protected": true
+      }
+    ]`)
 	})
 
 	opt := &ListTagsOptions{ListOptions: ListOptions{Page: 2, PerPage: 3}}
@@ -39,7 +49,18 @@ func TestTagsService_ListTags(t *testing.T) {
 		t.Errorf("Tags.ListTags returned error: %v", err)
 	}
 
-	want := []*Tag{{Name: "1.0.0"}, {Name: "1.0.1"}}
+	want := []*Tag{
+		{
+			Name:      "1.0.0",
+			Message:   "test",
+			Target:    "fffff",
+			Protected: false,
+		},
+		{
+			Name:      "1.0.1",
+			Protected: true,
+		},
+	}
 	if !reflect.DeepEqual(want, tags) {
 		t.Errorf("Tags.ListTags returned %+v, want %+v", tags, want)
 	}