forked from gitlab4j/gitlab4j-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathErrorTrackingApi.java
More file actions
60 lines (53 loc) · 2.18 KB
/
ErrorTrackingApi.java
File metadata and controls
60 lines (53 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package org.gitlab4j.api;
import java.util.List;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.models.ErrorTrackingClientKey;
/**
* This class provides an entry point to the GitLab API error tracking.
* <a href="https://docs.gitlab.com/api/error_tracking/">GitLab Error tracking API Documentation</a>
*/
public class ErrorTrackingApi extends AbstractApi {
public ErrorTrackingApi(GitLabApi gitLabApi) {
super(gitLabApi);
}
/**
* Creates an integrated error tracking client key for a specified project.
*
* <pre><code>GitLab Endpoint: POST /projects/:id/error_tracking/client_keys</code></pre>
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @return the created ErrorTrackingClientKey
* @throws GitLabApiException if any exception occurs
*/
public ErrorTrackingClientKey createClientKey(Object projectIdOrPath) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm();
Response response = post(
Response.Status.CREATED,
formData,
"projects",
getProjectIdOrPath(projectIdOrPath),
"error_tracking",
"client_keys");
return (response.readEntity(ErrorTrackingClientKey.class));
}
/**
* Lists all integrated error tracking client keys for a specified project.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/error_tracking/client_keys</code></pre>
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @return a list of ErrorTrackingClientKey
* @throws GitLabApiException if any exception occurs
*/
public List<ErrorTrackingClientKey> getClientKeys(Object projectIdOrPath) throws GitLabApiException {
Response response = get(
Response.Status.OK,
null,
"projects",
getProjectIdOrPath(projectIdOrPath),
"error_tracking",
"client_keys");
return (response.readEntity(new GenericType<>() {}));
}
}