diff --git a/src/main/java/org/gitlab4j/api/IssuesApi.java b/src/main/java/org/gitlab4j/api/IssuesApi.java index 7bafa2c60..cb85f8875 100644 --- a/src/main/java/org/gitlab4j/api/IssuesApi.java +++ b/src/main/java/org/gitlab4j/api/IssuesApi.java @@ -387,7 +387,7 @@ public Optional getOptionalIssue(Object projectIdOrPath, Integer issueIid * Create an issue for the project. * *
GitLab Endpoint: POST /projects/:id/issues
- * + * * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance * @param title the title of an issue, required * @param description the description of an issue, optional @@ -412,9 +412,9 @@ public Issue createIssue(Object projectIdOrPath, String title, String descriptio * @param labels comma-separated label names for an issue, optional * @param createdAt the date the issue was created at, optional * @param dueDate the due date, optional - * @param mergeRequestToResolveId the IID of a merge request in which to resolve all issues. This will fill the issue with a default + * @param mergeRequestToResolveId the IID of a merge request in which to resolve all issues. This will fill the issue with a default * description and mark all discussions as resolved. When passing a description or title, these values will take precedence over the default values. Optional - * @param discussionToResolveId the ID of a discussion to resolve. This will fill in the issue with a default description and mark the discussion as resolved. + * @param discussionToResolveId the ID of a discussion to resolve. This will fill in the issue with a default description and mark the discussion as resolved. * Use in combination with merge_request_to_resolve_discussions_of. Optional * @return an instance of Issue * @throws GitLabApiException if any exception occurs @@ -434,7 +434,7 @@ public Issue createIssue(Object projectIdOrPath, String title, String descriptio .withParam("merge_request_to_resolve_discussions_of", mergeRequestToResolveId) .withParam("discussion_to_resolve", discussionToResolveId); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "issues"); - return (response.readEntity(Issue.class)); + return (response.readEntity(Issue.class)); } /** @@ -453,9 +453,9 @@ public Issue closeIssue(Object projectIdOrPath, Integer issueIid) throws GitLabA throw new RuntimeException("issue IID cannot be null"); } - GitLabApiForm formData = new GitLabApiForm().withParam("state_event", StateEvent.CLOSE); + GitLabApiForm formData = new GitLabApiForm().withParam("state_event", StateEvent.CLOSE); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid); - return (response.readEntity(Issue.class)); + return (response.readEntity(Issue.class)); } /** @@ -477,7 +477,7 @@ public Issue closeIssue(Object projectIdOrPath, Integer issueIid) throws GitLabA * @return an instance of the updated Issue * @throws GitLabApiException if any exception occurs */ - public Issue updateIssue(Object projectIdOrPath, Integer issueIid, String title, String description, Boolean confidential, List assigneeIds, + public Issue updateIssue(Object projectIdOrPath, Integer issueIid, String title, String description, Boolean confidential, List assigneeIds, Integer milestoneId, String labels, StateEvent stateEvent, Date updatedAt, Date dueDate) throws GitLabApiException { if (issueIid == null) { @@ -495,7 +495,7 @@ public Issue updateIssue(Object projectIdOrPath, Integer issueIid, String title, .withParam("updated_at", updatedAt) .withParam("due_date", dueDate); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid); - return (response.readEntity(Issue.class)); + return (response.readEntity(Issue.class)); } /** @@ -541,9 +541,9 @@ public void deleteIssue(Object projectIdOrPath, Integer issueIid) throws GitLabA /** * Sets an estimated time of work in this issue - * + * *
GitLab Endpoint: POST /projects/:id/issues/:issue_iid/time_estimate
- * + * * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required * @param issueIid the internal ID of a project's issue * @param duration estimated time in seconds @@ -556,9 +556,9 @@ public TimeStats estimateTime(Object projectIdOrPath, Integer issueIid, int dura /** * Sets an estimated time of work in this issue - * + * *
GitLab Endpoint: POST /projects/:id/issues/:issue_iid/time_estimate
- * + * * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required * @param issueIid the internal ID of a project's issue * @param duration Human readable format, e.g. 3h30m @@ -571,9 +571,9 @@ public TimeStats estimateTime(Object projectIdOrPath, Integer issueIid, String d /** * Sets an estimated time of work in this issue - * + * *
GitLab Endpoint: POST /projects/:id/issues/:issue_iid/time_estimate
- * + * * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance * @param issueIid the internal ID of a project's issue * @param duration set the estimate of time to this duration @@ -596,9 +596,9 @@ public TimeStats estimateTime(Object projectIdOrPath, Integer issueIid, Duration /** * Resets the estimated time for this issue to 0 seconds. - * + * *
GitLab Endpoint: POST /projects/:id/issues/:issue_iid/reset_time_estimate
- * + * * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance * @param issueIid the internal ID of a project's issue * @return a TimeSTats instance @@ -617,9 +617,9 @@ public TimeStats resetEstimatedTime(Object projectIdOrPath, Integer issueIid) th /** * Adds spent time for this issue - * + * *
GitLab Endpoint: POST /projects/:id/issues/:issue_iid/add_spent_time
- * + * * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance * @param issueIid the internal ID of a project's issue * @param duration the duration in seconds @@ -632,9 +632,9 @@ public TimeStats addSpentTime(Object projectIdOrPath, Integer issueIid, int dura /** * Adds spent time for this issue - * + * *
GitLab Endpoint: POST /projects/:id/issues/:issue_iid/add_spent_time
- * + * * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance * @param issueIid the internal ID of a project's issue * @param duration Human readable format, e.g. 3h30m @@ -647,9 +647,9 @@ public TimeStats addSpentTime(Object projectIdOrPath, Integer issueIid, String d /** * Adds spent time for this issue - * + * *
GitLab Endpoint: POST /projects/:id/issues/:issue_iid/add_spent_time
- * + * * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance * @param issueIid the internal ID of a project's issue * @param duration the duration of time spent @@ -672,9 +672,9 @@ public TimeStats addSpentTime(Object projectIdOrPath, Integer issueIid, Duration /** * Resets the total spent time for this issue to 0 seconds. - * + * *
GitLab Endpoint: POST /projects/:id/issues/:issue_iid/reset_spent_time
- * + * * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance * @param issueIid the internal ID of a project's issue * @return a TimeSTats instance @@ -693,9 +693,9 @@ public TimeStats resetSpentTime(Object projectIdOrPath, Integer issueIid) throws /** * Get time tracking stats. - * + * *
GitLab Endpoint: GET /projects/:id/issues/:issue_iid/time_stats
- * + * * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance * @param issueIid the internal ID of a project's issue * @return a TimeStats instance @@ -983,9 +983,25 @@ public IssuesStatistics getGroupIssuesStatistics(Object groupIdOrPath, IssuesSta return (response.readEntity(IssuesStatistics.class)); } + /** + * Gets issues count statistics for given project. + * + *
GitLab Endpoint: GET /projects/:projectId/issues_statistics
+ * + * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required + * @param filter {@link IssuesStatisticsFilter} a IssuesStatisticsFilter instance with the filter settings. + * @return an IssuesStatistics instance with the statistics for the matched issues + * @throws GitLabApiException if any exception occurs + */ + public IssuesStatistics geProjectIssuesStatistics(Object projectIdOrPath, IssuesStatisticsFilter filter) throws GitLabApiException { + GitLabApiForm formData = filter.getQueryParams(); + Response response = get(Response.Status.OK, formData.asMap(), "projects", this.getProjectIdOrPath(projectIdOrPath), "issues_statistics"); + return (response.readEntity(IssuesStatistics.class)); + } + /** *

Moves an issue to a different project. If the target project equals the source project or - * the user has insufficient permissions to move an issue, error 400 together with an + * the user has insufficient permissions to move an issue, error 400 together with an * explaining error message is returned.

* *

If a given label and/or milestone with the same name also exists in the target project, @@ -1004,5 +1020,5 @@ public Issue moveIssue(Object projectIdOrPath, Integer issueIid, Object toProjec Response response = post(Response.Status.OK, formData, "projects", this.getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "move"); return (response.readEntity(Issue.class)); - } + } }