|
13 | 13 | import org.gitlab4j.api.models.Issue; |
14 | 14 | import org.gitlab4j.api.models.IssueFilter; |
15 | 15 | import org.gitlab4j.api.models.IssueLink; |
| 16 | +import org.gitlab4j.api.models.IssuesStatistics; |
| 17 | +import org.gitlab4j.api.models.IssuesStatisticsFilter; |
16 | 18 | import org.gitlab4j.api.models.MergeRequest; |
17 | 19 | import org.gitlab4j.api.models.Participant; |
18 | 20 | import org.gitlab4j.api.models.TimeStats; |
|
22 | 24 | * This class provides an entry point to all the GitLab API Issue calls. |
23 | 25 | * @see <a href="https://docs.gitlab.com/ce/api/issues.html">Issues API at GitLab</a> |
24 | 26 | * @see <a href="https://docs.gitlab.com/ce/api/issue_links.html">Issue Links API at GitLab</a> |
| 27 | + * @see <a href="https://docs.gitlab.com/ce/api/issues_statistics.html">Issues Statistics API at GitLab</a> |
25 | 28 | */ |
26 | 29 | public class IssuesApi extends AbstractApi implements Constants { |
27 | 30 |
|
@@ -839,4 +842,52 @@ public Pager<Participant> getParticipants(Object projectIdOrPath, Integer issueI |
839 | 842 | public Stream<Participant> getParticipantsStream(Object projectIdOrPath, Integer issueIid) throws GitLabApiException { |
840 | 843 | return (getParticipants(projectIdOrPath, issueIid, getDefaultPerPage()).stream()); |
841 | 844 | } |
| 845 | + |
| 846 | + /** |
| 847 | + * Gets issues count statistics on all issues the authenticated user has access to. By default it returns |
| 848 | + * only issues created by the current user. To get all issues, use parameter scope=all. |
| 849 | + * |
| 850 | + * <pre><code>GitLab Endpoint: GET /issues_statistics</code></pre> |
| 851 | + * |
| 852 | + * @param filter {@link IssuesStatisticsFilter} a IssuesStatisticsFilter instance with the filter settings. |
| 853 | + * @return an IssuesStatistics instance with the statistics for the matched issues. |
| 854 | + * @throws GitLabApiException if any exception occurs |
| 855 | + */ |
| 856 | + public IssuesStatistics getIssuesStatistics(IssuesStatisticsFilter filter) throws GitLabApiException { |
| 857 | + GitLabApiForm formData = filter.getQueryParams(); |
| 858 | + Response response = get(Response.Status.OK, formData.asMap(), "issues_statistics"); |
| 859 | + return (response.readEntity(IssuesStatistics.class)); |
| 860 | + } |
| 861 | + |
| 862 | + /** |
| 863 | + * Gets issues count statistics for given group. |
| 864 | + * |
| 865 | + * <pre><code>GitLab Endpoint: GET /groups/:groupId/issues_statistics</code></pre> |
| 866 | + * |
| 867 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path, required |
| 868 | + * @param filter {@link IssuesStatisticsFilter} a IssuesStatisticsFilter instance with the filter settings |
| 869 | + * @return an IssuesStatistics instance with the statistics for the matched issues |
| 870 | + * @throws GitLabApiException if any exception occurs |
| 871 | + */ |
| 872 | + public IssuesStatistics getGroupIssuesStatistics(Object groupIdOrPath, IssuesStatisticsFilter filter) throws GitLabApiException { |
| 873 | + GitLabApiForm formData = filter.getQueryParams(); |
| 874 | + Response response = get(Response.Status.OK, formData.asMap(), "groups", this.getGroupIdOrPath(groupIdOrPath), "issues_statistics"); |
| 875 | + return (response.readEntity(IssuesStatistics.class)); |
| 876 | + } |
| 877 | + |
| 878 | + /** |
| 879 | + * Gets issues count statistics for given group. |
| 880 | + * |
| 881 | + * <pre><code>GitLab Endpoint: GET /projects/:projectId/issues_statistics</code></pre> |
| 882 | + * |
| 883 | + * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required |
| 884 | + * @param filter {@link IssuesStatisticsFilter} a IssuesStatisticsFilter instance with the filter settings. |
| 885 | + * @return an IssuesStatistics instance with the statistics for the matched issues |
| 886 | + * @throws GitLabApiException if any exception occurs |
| 887 | + */ |
| 888 | + public IssuesStatistics geProjectIssuesStatistics(Object projectIdOrPath, IssuesStatisticsFilter filter) throws GitLabApiException { |
| 889 | + GitLabApiForm formData = filter.getQueryParams(); |
| 890 | + Response response = get(Response.Status.OK, formData.asMap(), "projects", this.getProjectIdOrPath(projectIdOrPath), "issues_statistics"); |
| 891 | + return (response.readEntity(IssuesStatistics.class)); |
| 892 | + } |
842 | 893 | } |
0 commit comments