Skip to content

Commit 3404b18

Browse files
committed
Asdded GitLab endpoint info to Javadocs.
1 parent 83a05ad commit 3404b18

File tree

1 file changed

+122
-9
lines changed

1 file changed

+122
-9
lines changed

src/main/java/org/gitlab4j/api/MilestonesApi.java

Lines changed: 122 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* This class implements the client side API for the GitLab milestones calls.
17+
* @see <a href="https://docs.gitlab.com/ce/api/milestones.html">Project milestones API</a>
18+
* @see <a href="https://docs.gitlab.com/ce/api/group_milestones.html">Group milestones API</a>
1719
*/
1820
public class MilestonesApi extends AbstractApi {
1921

@@ -24,6 +26,8 @@ public MilestonesApi(GitLabApi gitLabApi) {
2426
/**
2527
* Get a list of group milestones.
2628
*
29+
* <pre><code>GitLab Endpoint: GET /groups/:id/milestones</code></pre>
30+
*
2731
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
2832
* @return the milestones associated with the specified group
2933
* @throws GitLabApiException if any exception occurs
@@ -35,6 +39,8 @@ public List<Milestone> getGroupMilestones(Object groupIdOrPath) throws GitLabApi
3539
/**
3640
* Get a list of group milestones.
3741
*
42+
* <pre><code>GitLab Endpoint: GET /groups/:id/milestones</code></pre>
43+
*
3844
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
3945
* @param page the page number to get
4046
* @param perPage how many milestones per page
@@ -50,6 +56,8 @@ public List<Milestone> getGroupMilestones(Object groupIdOrPath, int page, int pe
5056
/**
5157
* Get a Page of group milestones.
5258
*
59+
* <pre><code>GitLab Endpoint: GET /groups/:id/milestones</code></pre>
60+
*
5361
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
5462
* @param itemsPerPage The number of Milestone instances that will be fetched per page
5563
* @return the milestones associated with the specified group
@@ -63,6 +71,8 @@ public Pager<Milestone> getGroupMilestones(Object groupIdOrPath, int itemsPerPag
6371
/**
6472
* Get a Stream of group milestones.
6573
*
74+
* <pre><code>GitLab Endpoint: GET /groups/:id/milestones</code></pre>
75+
*
6676
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
6777
* @return a Stream of the milestones associated with the specified group
6878
* @throws GitLabApiException if any exception occurs
@@ -74,6 +84,8 @@ public Stream<Milestone> getGroupMilestonesStream(Object groupIdOrPath) throws G
7484
/**
7585
* Get a list of group milestones that have the specified state.
7686
*
87+
* <pre><code>GitLab Endpoint: GET /groups/:id/milestones</code></pre>
88+
*
7789
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
7890
* @param state the milestone state
7991
* @return the milestones associated with the specified group and state
@@ -89,6 +101,8 @@ public List<Milestone> getGroupMilestones(Object groupIdOrPath, MilestoneState s
89101
/**
90102
* Get a list of group milestones that have match the search string.
91103
*
104+
* <pre><code>GitLab Endpoint: GET /groups/:id/milestones</code></pre>
105+
*
92106
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
93107
* @param search the search string
94108
* @return the milestones associated with the specified group
@@ -104,6 +118,8 @@ public List<Milestone> getGroupMilestones(Object groupIdOrPath, String search) t
104118
/**
105119
* Get a list of group milestones that have the specified state and match the search string.
106120
*
121+
* <pre><code>GitLab Endpoint: GET /groups/:id/milestones/:milestone_id</code></pre>
122+
*
107123
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
108124
* @param state the milestone state
109125
* @param search the search string
@@ -123,6 +139,8 @@ public List<Milestone> getGroupMilestones(Object groupIdOrPath, MilestoneState s
123139
/**
124140
* Get the specified group milestone.
125141
*
142+
* <pre><code>GitLab Endpoint: GET /groups/:id/milestones/:milestone_id</code></pre>
143+
*
126144
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
127145
* @param milestoneId the ID of the milestone tp get
128146
* @return a Milestone instance for the specified IDs
@@ -137,20 +155,52 @@ public Milestone getGroupMilestone(Object groupIdOrPath, Integer milestoneId) th
137155
/**
138156
* Get the list of issues associated with the specified group milestone.
139157
*
158+
* <pre><code>GitLab Endpoint: GET /groups/:id/milestones/:milestone_id/issues</code></pre>
159+
*
140160
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
141161
* @param milestoneId the milestone ID to get the issues for
142162
* @return a List of Issue for the milestone
143163
* @throws GitLabApiException if any exception occurs
144164
*/
145165
public List<Issue> getGroupIssues(Object groupIdOrPath, Integer milestoneId) throws GitLabApiException {
146-
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
147-
"groups", getGroupIdOrPath(groupIdOrPath), "milestones", milestoneId, "issues");
148-
return (response.readEntity(new GenericType<List<Issue>>() {}));
166+
return (getGroupIssues(groupIdOrPath, milestoneId, getDefaultPerPage()).all());
167+
}
168+
169+
/**
170+
* Get the Pager of issues associated with the specified group milestone.
171+
*
172+
* <pre><code>GitLab Endpoint: GET /groups/:id/milestones/:milestone_id/issues</code></pre>
173+
*
174+
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
175+
* @param milestoneId the milestone ID to get the issues for
176+
* @param itemsPerPage The number of Milestone instances that will be fetched per page
177+
* @return a Pager of Issue for the milestone
178+
* @throws GitLabApiException if any exception occurs
179+
*/
180+
public Pager<Issue> getGroupIssues(Object groupIdOrPath, Integer milestoneId, int itemsPerPage) throws GitLabApiException {
181+
return (new Pager<Issue>(this, Issue.class, itemsPerPage, null,
182+
"groups", getGroupIdOrPath(groupIdOrPath), "milestones", milestoneId, "issues"));
183+
}
184+
185+
/**
186+
* Get a Stream of issues associated with the specified group milestone.
187+
*
188+
* <pre><code>GitLab Endpoint: GET /groups/:id/milestones/:milestone_id/issues</code></pre>
189+
*
190+
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
191+
* @param milestoneId the milestone ID to get the issues for
192+
* @return a Stream of Issue for the milestone
193+
* @throws GitLabApiException if any exception occurs
194+
*/
195+
public Stream<Issue> getGroupIssuesStream(Object groupIdOrPath, Integer milestoneId) throws GitLabApiException {
196+
return (getGroupIssues(groupIdOrPath, milestoneId, getDefaultPerPage()).stream());
149197
}
150198

151199
/**
152200
* Get the list of merge requests associated with the specified group milestone.
153201
*
202+
* <pre><code>GitLab Endpoint: GET /groups/:id/milestones/:milestone_id/merge_requests</code></pre>
203+
*
154204
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
155205
* @param milestoneId the milestone ID to get the merge requests for
156206
* @return a list of merge requests associated with the specified milestone
@@ -165,6 +215,8 @@ public List<MergeRequest> getGroupMergeRequest(Object groupIdOrPath, Integer mil
165215
/**
166216
* Create a group milestone.
167217
*
218+
* <pre><code>GitLab Endpoint: POST /groups/:id/milestones</code></pre>
219+
*
168220
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
169221
* @param title the title for the milestone
170222
* @param description the description for the milestone
@@ -179,14 +231,15 @@ public Milestone createGroupMilestone(Object groupIdOrPath, String title, String
179231
.withParam("description", description)
180232
.withParam("due_date", dueDate)
181233
.withParam("start_date", startDate);
182-
Response response = post(Response.Status.CREATED, formData,
183-
"groups", getGroupIdOrPath(groupIdOrPath), "milestones");
234+
Response response = post(Response.Status.CREATED, formData, "groups", getGroupIdOrPath(groupIdOrPath), "milestones");
184235
return (response.readEntity(Milestone.class));
185236
}
186237

187238
/**
188239
* Close a group milestone.
189240
*
241+
* <pre><code>GitLab Endpoint: PUT /groups/:id/milestones/:milestone_id</code></pre>
242+
*
190243
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
191244
* @param milestoneId the milestone ID to close
192245
* @return the closed Milestone instance
@@ -207,6 +260,8 @@ public Milestone closeGroupMilestone(Object groupIdOrPath, Integer milestoneId)
207260
/**
208261
* Activate a group milestone.
209262
*
263+
* <pre><code>GitLab Endpoint: PUT /groups/:id/milestones/:milestone_id</code></pre>
264+
*
210265
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
211266
* @param milestoneId the milestone ID to activate
212267
* @return the activated Milestone instance
@@ -227,6 +282,8 @@ public Milestone activateGroupMilestone(Object groupIdOrPath, Integer milestoneI
227282
/**
228283
* Update the specified group milestone.
229284
*
285+
* <pre><code>GitLab Endpoint: PUT /groups/:id/milestones/:milestone_id</code></pre>
286+
*
230287
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
231288
* @param milestoneId the milestone ID to update
232289
* @param title the updated title for the milestone
@@ -258,6 +315,8 @@ public Milestone updateGroupMilestone(Object groupIdOrPath, Integer milestoneId,
258315
/**
259316
* Get a list of project milestones.
260317
*
318+
* <pre><code>GitLab Endpoint: GET /projects/:id/milestones</code></pre>
319+
*
261320
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
262321
* @return the milestones associated with the specified project
263322
* @throws GitLabApiException if any exception occurs
@@ -269,6 +328,8 @@ public List<Milestone> getMilestones(Object projectIdOrPath) throws GitLabApiExc
269328
/**
270329
* Get a list of project milestones.
271330
*
331+
* <pre><code>GitLab Endpoint: GET /projects/:id/milestones</code></pre>
332+
*
272333
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
273334
* @param page the page number to get
274335
* @param perPage how many milestones per page
@@ -282,7 +343,9 @@ public List<Milestone> getMilestones(Object projectIdOrPath, int page, int perPa
282343
}
283344

284345
/**
285-
* Get a Page of project milestones.
346+
* Get a Pager of project milestones.
347+
*
348+
* <pre><code>GitLab Endpoint: GET /projects/:id/milestones</code></pre>
286349
*
287350
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
288351
* @param itemsPerPage The number of Milestone instances that will be fetched per page
@@ -297,6 +360,8 @@ public Pager<Milestone> getMilestones(Object projectIdOrPath, int itemsPerPage)
297360
/**
298361
* Get a Stream of project milestones.
299362
*
363+
* <pre><code>GitLab Endpoint: GET /projects/:id/milestones</code></pre>
364+
*
300365
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
301366
* @return a Stream of the milestones associated with the specified project
302367
* @throws GitLabApiException if any exception occurs
@@ -308,6 +373,8 @@ public Stream<Milestone> getMilestonesStream(Object projectIdOrPath) throws GitL
308373
/**
309374
* Get a list of project milestones that have the specified state.
310375
*
376+
* <pre><code>GitLab Endpoint: GET /projects/:id/milestones</code></pre>
377+
*
311378
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
312379
* @param state the milestone state
313380
* @return the milestones associated with the specified project and state
@@ -323,6 +390,8 @@ public List<Milestone> getMilestones(Object projectIdOrPath, MilestoneState stat
323390
/**
324391
* Get a list of project milestones that have match the search string.
325392
*
393+
* <pre><code>GitLab Endpoint: GET /projects/:id/milestones</code></pre>
394+
*
326395
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
327396
* @param search the search string
328397
* @return the milestones associated with the specified project
@@ -338,6 +407,8 @@ public List<Milestone> getMilestones(Object projectIdOrPath, String search) thro
338407
/**
339408
* Get a list of project milestones that have the specified state and match the search string.
340409
*
410+
* <pre><code>GitLab Endpoint: GET /projects/:id/milestones</code></pre>
411+
*
341412
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
342413
* @param state the milestone state
343414
* @param search the search string
@@ -357,6 +428,8 @@ public List<Milestone> getMilestones(Object projectIdOrPath, MilestoneState stat
357428
/**
358429
* Get the specified milestone.
359430
*
431+
* <pre><code>GitLab Endpoint: GET /projects/:id/milestones/:milestone_id</code></pre>
432+
*
360433
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
361434
* @param milestoneId the ID of the milestone tp get
362435
* @return a Milestone instance for the specified IDs
@@ -371,19 +444,51 @@ public Milestone getMilestone(Object projectIdOrPath, Integer milestoneId) throw
371444
/**
372445
* Get the list of issues associated with the specified milestone.
373446
*
447+
* <pre><code>GitLab Endpoint: GET /projects/:id/milestones/:milestone_id/issues</code></pre>
448+
*
374449
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
375450
* @param milestoneId the milestone ID to get the issues for
376451
* @return a List of Issue for the milestone
377452
* @throws GitLabApiException if any exception occurs
378453
*/
379454
public List<Issue> getIssues(Object projectIdOrPath, Integer milestoneId) throws GitLabApiException {
380-
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
381-
"projects", getProjectIdOrPath(projectIdOrPath), "milestones", milestoneId, "issues");
382-
return (response.readEntity(new GenericType<List<Issue>>() {}));
455+
return (getIssues(projectIdOrPath, milestoneId, getDefaultPerPage()).all());
456+
}
457+
458+
/**
459+
* Get a Pager of issues associated with the specified milestone.
460+
*
461+
* <pre><code>GitLab Endpoint: GET /projects/:id/milestones/:milestone_id/issues</code></pre>
462+
*
463+
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
464+
* @param milestoneId the milestone ID to get the issues for
465+
* @param itemsPerPage the number of Milestone instances that will be fetched per page
466+
* @return a Pager of Issue for the milestone
467+
* @throws GitLabApiException if any exception occurs
468+
*/
469+
public Pager<Issue> getIssues(Object projectIdOrPath, Integer milestoneId, int itemsPerPage) throws GitLabApiException {
470+
return (new Pager<Issue>(this, Issue.class, itemsPerPage, null,
471+
"projects", getProjectIdOrPath(projectIdOrPath), "milestones", milestoneId, "issues"));
472+
}
473+
474+
/**
475+
* Get a Stream of issues associated with the specified milestone.
476+
*
477+
* <pre><code>GitLab Endpoint: GET /projects/:id/milestones/:milestone_id/issues</code></pre>
478+
*
479+
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
480+
* @param milestoneId the milestone ID to get the issues for
481+
* @return a Stream of Issue for the milestone
482+
* @throws GitLabApiException if any exception occurs
483+
*/
484+
public Stream<Issue> getIssuesStream(Object projectIdOrPath, Integer milestoneId) throws GitLabApiException {
485+
return (getIssues(projectIdOrPath, milestoneId, getDefaultPerPage()).stream());
383486
}
384487

385488
/**
386489
* Get the list of merge requests associated with the specified milestone.
490+
*
491+
* <pre><code>GitLab Endpoint: GET /projects/:id/milestones/:milestone_id/merge_requests</code></pre>
387492
*
388493
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
389494
* @param milestoneId the milestone ID to get the merge requests for
@@ -399,6 +504,8 @@ public List<MergeRequest> getMergeRequest(Object projectIdOrPath, Integer milest
399504
/**
400505
* Create a milestone.
401506
*
507+
* <pre><code>GitLab Endpoint: POST /projects/:id/milestones</code></pre>
508+
*
402509
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
403510
* @param title the title for the milestone
404511
* @param description the description for the milestone
@@ -421,6 +528,8 @@ public Milestone createMilestone(Object projectIdOrPath, String title, String de
421528
/**
422529
* Close a milestone.
423530
*
531+
* <pre><code>GitLab Endpoint: PUT /projects/:id/milestones/:milestone_id</code></pre>
532+
*
424533
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
425534
* @param milestoneId the milestone ID to close
426535
* @return the closed Milestone instance
@@ -441,6 +550,8 @@ public Milestone closeMilestone(Object projectIdOrPath, Integer milestoneId) thr
441550
/**
442551
* Activate a milestone.
443552
*
553+
* <pre><code>GitLab Endpoint: PUT /projects/:id/milestones/:milestone_id</code></pre>
554+
*
444555
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
445556
* @param milestoneId the milestone ID to activate
446557
* @return the activated Milestone instance
@@ -461,6 +572,8 @@ public Milestone activateMilestone(Object projectIdOrPath, Integer milestoneId)
461572
/**
462573
* Update the specified milestone.
463574
*
575+
* <pre><code>GitLab Endpoint: PUT /projects/:id/milestones/:milestone_id</code></pre>
576+
*
464577
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
465578
* @param milestoneId the milestone ID to update
466579
* @param title the updated title for the milestone

0 commit comments

Comments
 (0)