Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
java-gitlab-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
沈俊林
java-gitlab-api
Commits
894d7cfe
Commit
894d7cfe
authored
Aug 19, 2015
by
Tim Olshansky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #63 from openwide-java/deploy-key-support
Add support for project deploy keys
parents
aec664c9
b5393d37
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
4 deletions
+45
-4
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+45
-4
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
894d7cfe
...
...
@@ -138,7 +138,7 @@ public class GitlabAPI {
Query
query
=
new
Query
()
.
append
(
"email"
,
email
)
.
appendIf
(
"
skip_confirmation"
,
skip_confirmation
)
.
appendIf
(
"
confirm"
,
!
skip_confirmation
)
.
appendIf
(
"password"
,
password
)
.
appendIf
(
"username"
,
username
)
.
appendIf
(
"name"
,
fullName
)
...
...
@@ -186,12 +186,10 @@ public class GitlabAPI {
String
fullName
,
String
skypeId
,
String
linkedIn
,
String
twitter
,
String
website_url
,
Integer
projects_limit
,
String
extern_uid
,
String
extern_provider_name
,
String
bio
,
Boolean
isAdmin
,
Boolean
can_create_group
,
Boolean
skip_confirmation
)
throws
IOException
{
String
bio
,
Boolean
isAdmin
,
Boolean
can_create_group
)
throws
IOException
{
Query
query
=
new
Query
()
.
append
(
"email"
,
email
)
.
appendIf
(
"skip_confirmation"
,
skip_confirmation
)
.
appendIf
(
"password"
,
password
)
.
appendIf
(
"username"
,
username
)
.
appendIf
(
"name"
,
fullName
)
...
...
@@ -951,6 +949,49 @@ public class GitlabAPI {
dispatch
().
to
(
tailUrl
,
Void
.
class
);
}
/**
* Create a new deploy key for the project
*
* @param targetProjectId The id of the Gitlab project
* @param title The title of the ssh key
* @param key The public key
* @return The new GitlabSSHKey
* @throws IOException on gitlab api call error
*/
public
GitlabSSHKey
createDeployKey
(
Integer
targetProjectId
,
String
title
,
String
key
)
throws
IOException
{
Query
query
=
new
Query
()
.
append
(
"title"
,
title
)
.
append
(
"key"
,
key
);
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
targetProjectId
+
GitlabSSHKey
.
KEYS_URL
+
query
.
toString
();
return
dispatch
().
to
(
tailUrl
,
GitlabSSHKey
.
class
);
}
/**
* Delete a deploy key for a project
*
* @param targetProjectId The id of the Gitlab project
* @param targetKeyId The id of the Gitlab ssh key
* @throws IOException on gitlab api call error
*/
public
void
deleteDeployKey
(
Integer
targetProjectId
,
Integer
targetKeyId
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
targetProjectId
+
GitlabSSHKey
.
KEYS_URL
+
"/"
+
targetKeyId
;
retrieve
().
method
(
"DELETE"
).
to
(
tailUrl
,
Void
.
class
);
}
/**
* Gets all deploy keys for a project
*
* @param targetProjectId The id of the Gitlab project
* @return The list of project deploy keys
* @throws IOException on gitlab api call error
*/
public
List
<
GitlabSSHKey
>
getDeployKeys
(
Integer
targetProjectId
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
targetProjectId
+
GitlabSSHKey
.
KEYS_URL
;
return
Arrays
.
asList
(
retrieve
().
to
(
tailUrl
,
GitlabSSHKey
[].
class
));
}
public
GitlabSession
getCurrentSession
()
throws
IOException
{
String
tailUrl
=
"/user"
;
return
retrieve
().
to
(
tailUrl
,
GitlabSession
.
class
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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