Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 83ab12b

Browse files
committedOct 13, 2024
feat: get key by id gitlab4j#1176
1 parent 6e5e2e6 commit 83ab12b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed
 

‎src/main/java/org/gitlab4j/api/KeysApi.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
/**
1212
* See:
13-
* https://docs.gitlab.com/ee/api/keys.html#get-user-by-fingerprint-of-ssh-key
13+
* <a href="https://docs.gitlab.com/ee/api/keys.html">GitLab Key API Documentaion<</a>
1414
*/
1515
public class KeysApi extends AbstractApi {
1616
public KeysApi(GitLabApi gitLabApi) {
@@ -28,4 +28,18 @@ public Key getUserBySSHKeyFingerprint(String fingerprint) throws GitLabApiExcept
2828
Response response = get(Response.Status.OK, queryParams, "keys");
2929
return response.readEntity(Key.class);
3030
}
31+
32+
/**
33+
* Get a single key by id.
34+
*
35+
* <pre><code>GitLab Endpoint: GET /keys/:id</code></pre>
36+
*
37+
* @param keyId the IID of the key to get
38+
* @return a Key instance
39+
* @throws GitLabApiException if any exception occurs
40+
*/
41+
public Key getKey(String keyId) throws GitLabApiException {
42+
Response response = get(Response.Status.OK, null, "keys", keyId);
43+
return response.readEntity(Key.class);
44+
}
3145
}

0 commit comments

Comments
 (0)
Please sign in to comment.