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
16 changes: 15 additions & 1 deletion src/main/java/org/gitlab4j/api/KeysApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

/**
* See:
* https://docs.gitlab.com/ee/api/keys.html#get-user-by-fingerprint-of-ssh-key
* <a href="https://docs.gitlab.com/ee/api/keys.html">GitLab Key API Documentaion</a>
*/
public class KeysApi extends AbstractApi {
public KeysApi(GitLabApi gitLabApi) {
Expand All @@ -28,4 +28,18 @@ public Key getUserBySSHKeyFingerprint(String fingerprint) throws GitLabApiExcept
Response response = get(Response.Status.OK, queryParams, "keys");
return response.readEntity(Key.class);
}

/**
* Get a single key by id.
*
* <pre><code>GitLab Endpoint: GET /keys/:id</code></pre>
*
* @param keyId the IID of the key to get
* @return a Key instance
* @throws GitLabApiException if any exception occurs
*/
public Key getKey(String keyId) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "keys", keyId);
return response.readEntity(Key.class);
}
}
Loading