Repository: xanzy/go-gitlab
Pull request #549 (2019-01-24 10:49:36)

Fix the board list label field
It needs to be a single label, not a slice of labels.

Fixes: #548 


Patch:
diff --git a/boards.go b/boards.go
index 7579a5b..5d5f83c 100644
--- a/boards.go
+++ b/boards.go
@@ -48,9 +48,9 @@ func (b IssueBoard) String() string {
 //
 // GitLab API docs: https://docs.gitlab.com/ce/api/boards.html
 type BoardList struct {
-	ID       int      `json:"id"`
-	Labels   []*Label `json:"labels"`
-	Position int      `json:"position"`
+	ID       int    `json:"id"`
+	Label    *Label `json:"label"`
+	Position int    `json:"position"`
 }
 
 func (b BoardList) String() string {
diff --git a/environments.go b/environments.go
index 5afa784..b53a8d9 100644
--- a/environments.go
+++ b/environments.go
@@ -182,4 +182,4 @@ func (s *EnvironmentsService) StopEnvironment(pid interface{}, environmentID int
 	}
 
 	return s.client.Do(req, nil)
-}
+}
\ No newline at end of file
diff --git a/groups.go b/groups.go
index 157c930..d379915 100644
--- a/groups.go
+++ b/groups.go
@@ -54,14 +54,12 @@ type Group struct {
 // GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#list-project-groups
 type ListGroupsOptions struct {
 	ListOptions
-	AllAvailable   *bool             `url:"all_available,omitempty" json:"all_available,omitempty"`
-	MinAccessLevel *AccessLevelValue `url:"min_access_level,omitempty" json:"min_access_level,omitempty"`
-	OrderBy        *string           `url:"order_by,omitempty" json:"order_by,omitempty"`
-	Owned          *bool             `url:"owned,omitempty" json:"owned,omitempty"`
-	Search         *string           `url:"search,omitempty" json:"search,omitempty"`
-	SkipGroups     []int             `url:"skip_groups,omitempty" json:"skip_groups,omitempty"`
-	Sort           *string           `url:"sort,omitempty" json:"sort,omitempty"`
-	Statistics     *bool             `url:"statistics,omitempty" json:"statistics,omitempty"`
+	AllAvailable *bool   `url:"all_available,omitempty" json:"all_available,omitempty"`
+	OrderBy      *string `url:"order_by,omitempty" json:"order_by,omitempty"`
+	Owned        *bool   `url:"owned,omitempty" json:"owned,omitempty"`
+	Search       *string `url:"search,omitempty" json:"search,omitempty"`
+	Sort         *string `url:"sort,omitempty" json:"sort,omitempty"`
+	Statistics   *bool   `url:"statistics,omitempty" json:"statistics,omitempty"`
 }
 
 // ListGroups gets a list of groups (as user: my groups, as admin: all groups).
diff --git a/services.go b/services.go
index 313568f..890e5a3 100644
--- a/services.go
+++ b/services.go
@@ -393,7 +393,7 @@ type JiraServiceProperties struct {
 	ProjectKey            *string `url:"project_key,omitempty" json:"project_key,omitempty" `
 	Username              *string `url:"username,omitempty" json:"username,omitempty" `
 	Password              *string `url:"password,omitempty" json:"password,omitempty" `
-	JiraIssueTransitionID *int    `url:"jira_issue_transition_id,omitempty" json:"jira_issue_transition_id,omitempty"`
+	JiraIssueTransitionID *string `url:"jira_issue_transition_id,omitempty" json:"jira_issue_transition_id,omitempty"`
 }
 
 // GetJiraService gets Jira service settings for a project.


Test patch:
diff --git a/environments_test.go b/environments_test.go
index 329c667..75b7470 100644
--- a/environments_test.go
+++ b/environments_test.go
@@ -14,16 +14,16 @@ func TestListEnvironments(t *testing.T) {
 
 	mux.HandleFunc("/api/v4/projects/1/environments", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testURL(t, r, "/api/v4/projects/1/environments?page=1&per_page=10")
+		testURL(t,r,"/api/v4/projects/1/environments?page=1&per_page=10")
 		fmt.Fprint(w, `[{"id": 1,"name": "review/fix-foo", "slug": "review-fix-foo-dfjre3", "external_url": "https://review-fix-foo-dfjre3.example.gitlab.com"}]`)
 	})
 
-	envs, _, err := client.Environments.ListEnvironments(1, &ListEnvironmentsOptions{Page: 1, PerPage: 10})
+	envs, _, err := client.Environments.ListEnvironments(1, &ListEnvironmentsOptions{Page:1,PerPage:10})
 	if err != nil {
 		log.Fatal(err)
 	}
 
-	want := []*Environment{{ID: 1, Name: "review/fix-foo", Slug: "review-fix-foo-dfjre3", ExternalURL: "https://review-fix-foo-dfjre3.example.gitlab.com"}}
+	want := []*Environment{{ID:1,Name:"review/fix-foo",Slug:"review-fix-foo-dfjre3",ExternalURL:"https://review-fix-foo-dfjre3.example.gitlab.com"}}
 	if !reflect.DeepEqual(want, envs) {
 		t.Errorf("Environments.ListEnvironments returned %+v, want %+v", envs, want)
 	}
@@ -35,16 +35,16 @@ func TestCreateEnvironment(t *testing.T) {
 
 	mux.HandleFunc("/api/v4/projects/1/environments", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "POST")
-		testURL(t, r, "/api/v4/projects/1/environments")
+		testURL(t,r,"/api/v4/projects/1/environments")
 		fmt.Fprint(w, `{"id": 1,"name": "deploy", "slug": "deploy", "external_url": "https://deploy.example.gitlab.com"}`)
 	})
 
-	envs, _, err := client.Environments.CreateEnvironment(1, &CreateEnvironmentOptions{Name: String("deploy"), ExternalURL: String("https://deploy.example.gitlab.com")})
+	envs, _, err := client.Environments.CreateEnvironment(1, &CreateEnvironmentOptions{Name:String("deploy"), ExternalURL:String("https://deploy.example.gitlab.com")})
 	if err != nil {
 		log.Fatal(err)
 	}
 
-	want := &Environment{ID: 1, Name: "deploy", Slug: "deploy", ExternalURL: "https://deploy.example.gitlab.com"}
+	want := &Environment{ID:1,Name:"deploy",Slug:"deploy",ExternalURL:"https://deploy.example.gitlab.com"}
 	if !reflect.DeepEqual(want, envs) {
 		t.Errorf("Environments.CreateEnvironment returned %+v, want %+v", envs, want)
 	}
@@ -56,16 +56,16 @@ func TestEditEnvironment(t *testing.T) {
 
 	mux.HandleFunc("/api/v4/projects/1/environments/1", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "PUT")
-		testURL(t, r, "/api/v4/projects/1/environments/1")
+		testURL(t,r,"/api/v4/projects/1/environments/1")
 		fmt.Fprint(w, `{"id": 1,"name": "staging", "slug": "staging", "external_url": "https://staging.example.gitlab.com"}`)
 	})
 
-	envs, _, err := client.Environments.EditEnvironment(1, 1, &EditEnvironmentOptions{Name: String("staging"), ExternalURL: String("https://staging.example.gitlab.com")})
+	envs, _, err := client.Environments.EditEnvironment(1, 1,&EditEnvironmentOptions{Name:String("staging"), ExternalURL:String("https://staging.example.gitlab.com")})
 	if err != nil {
 		log.Fatal(err)
 	}
 
-	want := &Environment{ID: 1, Name: "staging", Slug: "staging", ExternalURL: "https://staging.example.gitlab.com"}
+	want := &Environment{ID:1,Name:"staging",Slug:"staging",ExternalURL:"https://staging.example.gitlab.com"}
 	if !reflect.DeepEqual(want, envs) {
 		t.Errorf("Environments.EditEnvironment returned %+v, want %+v", envs, want)
 	}
@@ -77,9 +77,9 @@ func TestDeleteEnvironment(t *testing.T) {
 
 	mux.HandleFunc("/api/v4/projects/1/environments/1", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "DELETE")
-		testURL(t, r, "/api/v4/projects/1/environments/1")
+		testURL(t,r,"/api/v4/projects/1/environments/1")
 	})
-	_, err := client.Environments.DeleteEnvironment(1, 1)
+	_, err := client.Environments.DeleteEnvironment(1,1)
 	if err != nil {
 		log.Fatal(err)
 	}
@@ -91,10 +91,10 @@ func TestStopEnvironment(t *testing.T) {
 
 	mux.HandleFunc("/api/v4/projects/1/environments/1/stop", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "POST")
-		testURL(t, r, "/api/v4/projects/1/environments/1/stop")
+		testURL(t,r,"/api/v4/projects/1/environments/1/stop")
 	})
-	_, err := client.Environments.StopEnvironment(1, 1)
+	_, err := client.Environments.StopEnvironment(1,1)
 	if err != nil {
 		log.Fatal(err)
 	}
-}
+}
\ No newline at end of file
diff --git a/issues_test.go b/issues_test.go
index 98dde53..140ab13 100644
--- a/issues_test.go
+++ b/issues_test.go
@@ -272,7 +272,7 @@ func TestListMergeRequestsClosingIssue(t *testing.T) {
 
 	mux.HandleFunc("/api/v4/projects/1/issues/5/closed_by", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testURL(t, r, "/api/v4/projects/1/issues/5/closed_by?page=1&per_page=10")
+		testURL(t,r,"/api/v4/projects/1/issues/5/closed_by?page=1&per_page=10")
 
 		fmt.Fprint(w, `[{"id":1, "title" : "test merge one"},{"id":2, "title" : "test merge two"}]`)
 	})
diff --git a/services_test.go b/services_test.go
index 853b5d1..1e23ee3 100644
--- a/services_test.go
+++ b/services_test.go
@@ -141,7 +141,7 @@ func TestSetJiraService(t *testing.T) {
 		ProjectKey:            String("as"),
 		Username:              String("aas"),
 		Password:              String("asd"),
-		JiraIssueTransitionID: Int(2),
+		JiraIssueTransitionID: String("asd"),
 	}
 
 	_, err := client.Services.SetJiraService(1, opt)
diff --git a/tags_test.go b/tags_test.go
index 7492a52..d35018b 100644
--- a/tags_test.go
+++ b/tags_test.go
@@ -16,7 +16,7 @@ func TestListTags(t *testing.T) {
 		fmt.Fprint(w, `[{"name": "1.0.0"},{"name": "1.0.1"}]`)
 	})
 
-	opt := &ListTagsOptions{ListOptions: ListOptions{Page: 2, PerPage: 3}}
+	opt := &ListTagsOptions{ListOptions: ListOptions{Page:2, PerPage: 3}}
 
 	tags, _, err := client.Tags.ListTags(1, opt)
 	if err != nil {