Commit 74bf061f authored by Marko Kungla's avatar Marko Kungla Committed by Sander van Harmelen

Add parameters Visibility Simple to ListProjectsOptions struct (#105)

* Add parameter Simple to ListProjectsOptions struct

Enables you to query list of projects with minimal
information much faster.

ListProjectsOptions{
  Simple *bool url:"simple,omitempty" json:"simple,omitempty"
}

Fields returned:
ID, HTTPURLToRepo, WebURL, Name, NameWithNameSpace, Path
PathWithNamesPace

* Add parameter Visibility to ListProjectOptions

Limit by visibility public, internal or private

ListProjectOptions{
  Visibility *string url:"visibility:omitempty" json:"visibility,omitempty"
}
parent d99758a9
......@@ -138,6 +138,8 @@ type ListProjectsOptions struct {
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
Search *string `url:"search,omitempty" json:"search,omitempty"`
CIEnabledFirst *bool `url:"ci_enabled_first,omitempty" json:"ci_enabled_first,omitempty"`
Simple *bool `url:"simple,omitempty" json:"simple,omitempty"`
Visibility *string `url:"visibility,omitempty" json:"visibility,omitempty"`
}
// ListProjects gets a list of projects accessible by the authenticated user.
......
......@@ -21,11 +21,13 @@ func TestListProjects(t *testing.T) {
"sort": "asc",
"search": "query",
"ci_enabled_first": "true",
"simple": "true",
"visibility": "public",
})
fmt.Fprint(w, `[{"id":1},{"id":2}]`)
})
opt := &ListProjectsOptions{ListOptions{2, 3}, Bool(true), String("name"), String("asc"), String("query"), Bool(true)}
opt := &ListProjectsOptions{ListOptions{2, 3}, Bool(true), String("name"), String("asc"), String("query"), Bool(true), Bool(true), String("public")}
projects, _, err := client.Projects.ListProjects(opt)
if err != nil {
......@@ -52,11 +54,13 @@ func TestListOwnedProjects(t *testing.T) {
"sort": "asc",
"search": "query",
"ci_enabled_first": "true",
"simple": "true",
"visibility": "public",
})
fmt.Fprint(w, `[{"id":1},{"id":2}]`)
})
opt := &ListProjectsOptions{ListOptions{2, 3}, Bool(true), String("name"), String("asc"), String("query"), Bool(true)}
opt := &ListProjectsOptions{ListOptions{2, 3}, Bool(true), String("name"), String("asc"), String("query"), Bool(true), Bool(true), String("public")}
projects, _, err := client.Projects.ListOwnedProjects(opt)
if err != nil {
......@@ -83,11 +87,13 @@ func TestListStarredProjects(t *testing.T) {
"sort": "asc",
"search": "query",
"ci_enabled_first": "true",
"simple": "true",
"visibility": "public",
})
fmt.Fprint(w, `[{"id":1},{"id":2}]`)
})
opt := &ListProjectsOptions{ListOptions{2, 3}, Bool(true), String("name"), String("asc"), String("query"), Bool(true)}
opt := &ListProjectsOptions{ListOptions{2, 3}, Bool(true), String("name"), String("asc"), String("query"), Bool(true), Bool(true), String("public")}
projects, _, err := client.Projects.ListStarredProjects(opt)
if err != nil {
......@@ -114,11 +120,13 @@ func TestListAllProjects(t *testing.T) {
"sort": "asc",
"search": "query",
"ci_enabled_first": "true",
"simple": "true",
"visibility": "public",
})
fmt.Fprint(w, `[{"id":1},{"id":2}]`)
})
opt := &ListProjectsOptions{ListOptions{2, 3}, Bool(true), String("name"), String("asc"), String("query"), Bool(true)}
opt := &ListProjectsOptions{ListOptions{2, 3}, Bool(true), String("name"), String("asc"), String("query"), Bool(true), Bool(true), String("public")}
projects, _, err := client.Projects.ListAllProjects(opt)
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment