Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
073f1918
Commit
073f1918
authored
Apr 08, 2015
by
Patrik Beno
Browse files
new: GitLabApi.create(url, user, pass)
parent
fce51bb3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/messners/gitlab/api/GitLabApi.java
100644 → 100755
View file @
073f1918
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment