Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jmini committed Oct 15, 2024
2 parents 792b1f5 + ba17e7c commit 5313e62
Showing 1 changed file with 15 additions and 1 deletion.
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);
}
}

0 comments on commit 5313e62

Please sign in to comment.