1
0
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:
Eugene Dzhurinsky
2018-06-28 18:44:35 -04:00
parent 37f2d5b759
commit b01e0251ce
2 changed files with 45 additions and 0 deletions

17
user.go
View File

@@ -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
//