mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-09-16 09:06:19 +02:00
Added the method to get the profile of the currently logged in user.
https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-myself-get Signed-off-by: Eugene Dzhurinsky <jdevelop@gmail.com>
This commit is contained in:
17
user.go
17
user.go
@@ -99,6 +99,23 @@ func (s *UserService) GetGroups(username string) (*[]UserGroup, *Response, error
|
||||
return userGroups, resp, nil
|
||||
}
|
||||
|
||||
// Get information about the current logged-in user
|
||||
//
|
||||
// JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-myself-get
|
||||
func (s *UserService) GetSelf() (*User, *Response, error) {
|
||||
const apiEndpoint = "rest/api/2/myself"
|
||||
req, err := s.client.NewRequest("GET", apiEndpoint, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
var user User
|
||||
resp, err := s.client.Do(req, &user)
|
||||
if err != nil {
|
||||
return nil, resp, NewJiraError(resp, err)
|
||||
}
|
||||
return &user, resp, nil
|
||||
}
|
||||
|
||||
// Find searches for user info from JIRA:
|
||||
// It can find users by email, username or name
|
||||
//
|
||||
|
Reference in New Issue
Block a user