aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/xanzy/go-gitlab/namespaces.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/xanzy/go-gitlab/namespaces.go')
-rw-r--r--vendor/github.com/xanzy/go-gitlab/namespaces.go39
1 files changed, 36 insertions, 3 deletions
diff --git a/vendor/github.com/xanzy/go-gitlab/namespaces.go b/vendor/github.com/xanzy/go-gitlab/namespaces.go
index 22ad7af..9add644 100644
--- a/vendor/github.com/xanzy/go-gitlab/namespaces.go
+++ b/vendor/github.com/xanzy/go-gitlab/namespaces.go
@@ -16,6 +16,10 @@
package gitlab
+import (
+ "fmt"
+)
+
// NamespacesService handles communication with the namespace related methods
// of the GitLab API.
//
@@ -28,9 +32,13 @@ type NamespacesService struct {
//
// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html
type Namespace struct {
- ID int `json:"id"`
- Path string `json:"path"`
- Kind string `json:"kind"`
+ ID int `json:"id"`
+ Name string `json:"name"`
+ Path string `json:"path"`
+ Kind string `json:"kind"`
+ FullPath string `json:"full_path"`
+ ParentID int `json:"parent_id"`
+ MembersCountWithDescendants int `json:"members_count_with_descendants"`
}
func (n Namespace) String() string {
@@ -87,3 +95,28 @@ func (s *NamespacesService) SearchNamespace(query string, options ...OptionFunc)
return n, resp, err
}
+
+// GetNamespace gets a namespace by id.
+//
+// GitLab API docs:
+// https://docs.gitlab.com/ce/api/namespaces.html#get-namespace-by-id
+func (s *NamespacesService) GetNamespace(id interface{}, options ...OptionFunc) (*Namespace, *Response, error) {
+ namespace, err := parseID(id)
+ if err != nil {
+ return nil, nil, err
+ }
+ u := fmt.Sprintf("namespaces/%s", namespace)
+
+ req, err := s.client.NewRequest("GET", u, nil, options)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ n := new(Namespace)
+ resp, err := s.client.Do(req, n)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return n, resp, err
+}