harness-drone/remote/gitlab/client/user.go

22 lines
330 B
Go
Raw Normal View History

2015-12-12 12:20:01 +00:00
package client
import (
"encoding/json"
)
const (
currentUserUrl = "/user"
)
func (c *Client) CurrentUser() (User, error) {
url, opaque := c.ResourceUrl(currentUserUrl, nil, nil)
var user User
contents, err := c.Do("GET", url, opaque, nil)
if err == nil {
err = json.Unmarshal(contents, &user)
}
return user, err
}