Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

const (
projects_url = "/projects" // Get a list of projects owned by the authenticated user
projects_all = "/projects/all" // Get a list of all GitLab projects (admin only)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be suffixed with _url

projects_search_url = "/projects/search/:query" // Search for projects by name
project_url = "/projects/:id" // Get a specific project, identified by project ID or NAME
project_url_events = "/projects/:id/events" // Get project events
Expand Down Expand Up @@ -55,12 +56,8 @@ type Project struct {
HttpRepoUrl string `json:"http_url_to_repo"`
}

/*
Get a list of projects owned by the authenticated user.
*/
func (g *Gitlab) Projects() ([]*Project, error) {

url := g.ResourceUrl(projects_url, nil)
func projects(u string, g *Gitlab) ([]*Project, error) {
url := g.ResourceUrl(u, nil)

var projects []*Project

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

/*
Get a list of projects owned by the authenticated user.
*/
func (g *Gitlab) Projects() ([]*Project, error) {
return projects(projects_url, g)
}

/*
Get a list of all GitLab projects (admin only).
*/
func (g *Gitlab) AllProjects() ([]*Project, error) {
return projects(projects_all, g)
}

/*
Remove a project.
*/
Expand Down