Commit 073f1918 authored by Patrik Beno's avatar Patrik Beno
Browse files

new: GitLabApi.create(url, user, pass)

parent fce51bb3
......@@ -17,7 +17,20 @@ public class GitLabApi {
private RepositoryApi repositoryApi;
private SessionApi sessoinApi;
private UserApi userApi;
/**
* Logs into GitLab using provided {@code username} and {@code password}, and creates a new
* {@code GitLabApi} instance using returned private token
* @param url GitLab URL
* @param username user name for which private token should be obtained
* @param password password for a given {@code username}
* @return new {@code GitLabApi} instance configured for a user-specific token
*/
static public GitLabApi create(String url, String username, String password) throws GitLabApiException {
String token = new SessionApi(new GitLabApi(url, null)).login(username, null, password).getPrivateToken();
return new GitLabApi(url, token);
}
/**
* Constructs a GitLabApi instance set up to interact with the GitLab server
......
Supports Markdown
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