Skip to content

Commit 953ac4a

Browse files
committed
Added getCurrentUser().
1 parent 2e2c67f commit 953ac4a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/java/org/gitlab4j/api/UserApi.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,19 @@ public void deleteUser(User user) throws GitLabApiException {
215215
deleteUser(user.getId());
216216
}
217217

218+
/**
219+
* Get currently authenticated user.
220+
*
221+
* GET /user
222+
*
223+
* @return the User instance for the currently authenticated user
224+
* @throws GitLabApiException if any exception occurs
225+
*/
226+
public User getCurrentUser() throws GitLabApiException {
227+
Response response = get(Response.Status.OK, null, "user");
228+
return (response.readEntity(User.class));
229+
}
230+
218231
/**
219232
* Get a list of currently authenticated user's SSH keys.
220233
*

0 commit comments

Comments
 (0)