Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/main/java/org/gitlab/api/GitlabAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,25 @@ public GitlabSSHKey createSSHKey(Integer targetUserId, String title, String key)

return dispatch().to(tailUrl, GitlabSSHKey.class);
}

/**
* Create a new ssh key for the authenticated user.
*
* @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 createSSHKey(String title, String key) throws IOException {

Query query = new Query()
.append("title", title)
.append("key", key);

String tailUrl = GitlabUser.USER_URL + GitlabSSHKey.KEYS_URL + query.toString();

return dispatch().to(tailUrl, GitlabSSHKey.class);
}

/**
* Delete user's ssh key
Expand Down