Skip to content

Commit e311008

Browse files
author
Raphaël Benitte
committed
Merge pull request #23 from klingtnet/master
Add support for `/projects/all` endpoint
2 parents d856572 + f689d4b commit e311008

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

projects.go

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
const (
99
projects_url = "/projects" // Get a list of projects owned by the authenticated user
10+
projects_all = "/projects/all" // Get a list of all GitLab projects (admin only)
1011
projects_search_url = "/projects/search/:query" // Search for projects by name
1112
project_url = "/projects/:id" // Get a specific project, identified by project ID or NAME
1213
project_url_events = "/projects/:id/events" // Get project events
@@ -55,12 +56,8 @@ type Project struct {
5556
HttpRepoUrl string `json:"http_url_to_repo"`
5657
}
5758

58-
/*
59-
Get a list of projects owned by the authenticated user.
60-
*/
61-
func (g *Gitlab) Projects() ([]*Project, error) {
62-
63-
url := g.ResourceUrl(projects_url, nil)
59+
func projects(u string, g *Gitlab) ([]*Project, error) {
60+
url := g.ResourceUrl(u, nil)
6461

6562
var projects []*Project
6663

@@ -72,6 +69,20 @@ func (g *Gitlab) Projects() ([]*Project, error) {
7269
return projects, err
7370
}
7471

72+
/*
73+
Get a list of projects owned by the authenticated user.
74+
*/
75+
func (g *Gitlab) Projects() ([]*Project, error) {
76+
return projects(projects_url, g)
77+
}
78+
79+
/*
80+
Get a list of all GitLab projects (admin only).
81+
*/
82+
func (g *Gitlab) AllProjects() ([]*Project, error) {
83+
return projects(projects_all, g)
84+
}
85+
7586
/*
7687
Remove a project.
7788
*/

0 commit comments

Comments
 (0)