|
33 | 33 | import org.gitlab4j.api.GitLabApi.ApiVersion; |
34 | 34 | import org.gitlab4j.api.models.Duration; |
35 | 35 | import org.gitlab4j.api.models.Issue; |
| 36 | +import org.gitlab4j.api.models.IssueFilter; |
36 | 37 | import org.gitlab4j.api.models.TimeStats; |
37 | 38 | import org.gitlab4j.api.utils.DurationUtils; |
38 | 39 |
|
@@ -128,6 +129,107 @@ public Pager<Issue> getIssues(Integer projectId, int itemsPerPage) throws GitLab |
128 | 129 | return (new Pager<Issue>(this, Issue.class, itemsPerPage, null, "projects", projectId, "issues")); |
129 | 130 | } |
130 | 131 |
|
| 132 | + /** |
| 133 | + * Get a list of project's issues. Only returns the first page with default 100 items. |
| 134 | + * |
| 135 | + * GET /projects/:id/issues |
| 136 | + * |
| 137 | + * @param projectIdOrPath The ID or URL-encoded path of the project owned by the authenticated user. |
| 138 | + * @param filter {@link IssueFilter} a IssueFilter instance with the filter settings |
| 139 | + * @return the list of issues in the specified range. |
| 140 | + * @throws GitLabApiException |
| 141 | + */ |
| 142 | + public List<Issue> getIssues(Object projectIdOrPath, IssueFilter filter) throws GitLabApiException { |
| 143 | + return (getIssues(projectIdOrPath, filter, 1, getDefaultPerPage())); |
| 144 | + } |
| 145 | + |
| 146 | + /** |
| 147 | + * Get a list of project's issues. |
| 148 | + * |
| 149 | + * GET /projects/:id/issues |
| 150 | + * |
| 151 | + * @param projectIdOrPath The ID or URL-encoded path of the project owned by the authenticated user. |
| 152 | + * @param filter {@link IssueFilter} a IssueFilter instance with the filter settings. |
| 153 | + * @param page the page to get. |
| 154 | + * @param perPage the number of projects per page. |
| 155 | + * @return the list of issues in the specified range. |
| 156 | + * @throws GitLabApiException |
| 157 | + */ |
| 158 | + public List<Issue> getIssues(Object projectIdOrPath, IssueFilter filter, int page, int perPage) throws GitLabApiException { |
| 159 | + |
| 160 | + GitLabApiForm formData = filter.getQueryParams(page, perPage); |
| 161 | + Response response = get(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues"); |
| 162 | + return (response.readEntity(new GenericType<List<Issue>>() {})); |
| 163 | + } |
| 164 | + |
| 165 | + /** |
| 166 | + * Get a list of project's issues. |
| 167 | + * |
| 168 | + * GET /projects/:id/issues |
| 169 | + * |
| 170 | + * @param projectIdOrPath The ID or URL-encoded path of the project owned by the authenticated user. |
| 171 | + * @param filter {@link IssueFilter} a IssueFilter instance with the filter settings. |
| 172 | + * @param itemsPerPage the number of Project instances that will be fetched per page. |
| 173 | + * @return the list of issues in the specified range. |
| 174 | + * @throws GitLabApiException |
| 175 | + */ |
| 176 | + public Pager<Issue> getIssues(Object projectIdOrPath, IssueFilter filter, int itemsPerPage) throws GitLabApiException { |
| 177 | + |
| 178 | + GitLabApiForm formData = filter.getQueryParams(); |
| 179 | + return (new Pager<Issue>(this, Issue.class, itemsPerPage, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues")); |
| 180 | + } |
| 181 | + |
| 182 | + /** |
| 183 | + * Get all issues the authenticated user has access to. |
| 184 | + * By default it returns only issues created by the current user. |
| 185 | + * Only returns the first page with default 100 items. |
| 186 | + * |
| 187 | + * GET /issues |
| 188 | + * |
| 189 | + * @param filter {@link IssueFilter} a IssueFilter instance with the filter settings |
| 190 | + * @return the list of issues in the specified range. |
| 191 | + * @throws GitLabApiException |
| 192 | + */ |
| 193 | + public List<Issue> getIssues(IssueFilter filter) throws GitLabApiException { |
| 194 | + return (getIssues(filter, 1, getDefaultPerPage())); |
| 195 | + } |
| 196 | + |
| 197 | + /** |
| 198 | + * Get all issues the authenticated user has access to. |
| 199 | + * By default it returns only issues created by the current user. |
| 200 | + * |
| 201 | + * GET /issues |
| 202 | + * |
| 203 | + * @param filter {@link IssueFilter} a IssueFilter instance with the filter settings. |
| 204 | + * @param page the page to get. |
| 205 | + * @param perPage the number of projects per page. |
| 206 | + * @return the list of issues in the specified range. |
| 207 | + * @throws GitLabApiException |
| 208 | + */ |
| 209 | + public List<Issue> getIssues(IssueFilter filter, int page, int perPage) throws GitLabApiException { |
| 210 | + |
| 211 | + GitLabApiForm formData = filter.getQueryParams(page, perPage); |
| 212 | + Response response = get(Response.Status.OK, formData.asMap(), "issues"); |
| 213 | + return (response.readEntity(new GenericType<List<Issue>>() {})); |
| 214 | + } |
| 215 | + |
| 216 | + /** |
| 217 | + * Get all issues the authenticated user has access to. |
| 218 | + * By default it returns only issues created by the current user. |
| 219 | + * |
| 220 | + * GET /issues |
| 221 | + * |
| 222 | + * @param filter {@link IssueFilter} a IssueFilter instance with the filter settings. |
| 223 | + * @param itemsPerPage the number of Project instances that will be fetched per page. |
| 224 | + * @return the list of issues in the specified range. |
| 225 | + * @throws GitLabApiException |
| 226 | + */ |
| 227 | + public Pager<Issue> getIssues(IssueFilter filter, int itemsPerPage) throws GitLabApiException { |
| 228 | + |
| 229 | + GitLabApiForm formData = filter.getQueryParams(); |
| 230 | + return (new Pager<Issue>(this, Issue.class, itemsPerPage, formData.asMap(), "issues")); |
| 231 | + } |
| 232 | + |
131 | 233 | /** |
132 | 234 | * Get a single project issue. |
133 | 235 | * |
|
0 commit comments