Commit 892a438c authored by Christopher Luu's avatar Christopher Luu

Added a method to fetch the currently logged in user.

parent 6d71f91d
...@@ -252,6 +252,7 @@ public class GitlabAPI { ...@@ -252,6 +252,7 @@ public class GitlabAPI {
} }
// List all users // List all users
// GET /users
public List<GitlabUser> getAllUsers() throws IOException { public List<GitlabUser> getAllUsers() throws IOException {
String tailUrl = GitlabUser.URL; String tailUrl = GitlabUser.URL;
...@@ -268,4 +269,12 @@ public class GitlabAPI { ...@@ -268,4 +269,12 @@ public class GitlabAPI {
return results; return results;
} }
// Gets currently authenticated user
// GET /user
public GitlabUser getLoggedInUser() throws IOException {
String tailUrl = "/user";
GitlabUser user = retrieve().to(tailUrl, GitlabUser.class);
return user;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment