@@ -42,6 +42,7 @@ public class GitlabAPI {
42
42
43
43
private static final String DEFAULT_API_NAMESPACE = "/api/v4" ;
44
44
private static final String PARAM_SUDO = "sudo" ;
45
+ private static final String PARAM_WITH_PROJECTS = "with_projects" ;
45
46
private static final String PARAM_MAX_ITEMS_PER_PAGE = new Pagination ().withPerPage (Pagination .MAX_ITEMS_PER_PAGE ).toString ();
46
47
47
48
private final String hostUrl ;
@@ -467,17 +468,49 @@ public GitlabGroup getGroup(Integer groupId) throws IOException {
467
468
return getGroup (groupId .toString ());
468
469
}
469
470
471
+ public GitlabGroup getGroupWithoutProjects (Integer groupId ) throws IOException {
472
+ return getGroupWithoutProjects (groupId .toString ());
473
+ }
474
+
470
475
/**
471
- * Get a group by path
476
+ * Get a group by path. Don't include the projects.
477
+ *
478
+ * @param path Path of the group
479
+ * @return {@link GitlabGroup} object
480
+ *
481
+ * @throws IOException on gitlab api call error
482
+ */
483
+ public GitlabGroup getGroupWithoutProjects (String path ) throws IOException {
484
+ return getGroup (path , false );
485
+ }
486
+
487
+ /**
488
+ * Get a group by path, including its projects.
472
489
*
473
490
* @param path Path of the group
474
491
* @return {@link GitlabGroup} object
475
492
*
476
493
* @throws IOException on gitlab api call error
477
494
*/
478
495
public GitlabGroup getGroup (String path ) throws IOException {
496
+ return getGroup (path , true );
497
+ }
498
+
499
+ /**
500
+ * Get a group by path
501
+ *
502
+ * @param path Path of the group
503
+ * @param withProjects If true, include the projects
504
+ * @return {@link GitlabGroup} object
505
+ *
506
+ * @throws IOException on gitlab api call error
507
+ */
508
+ public GitlabGroup getGroup (String path , boolean withProjects ) throws IOException {
479
509
String tailUrl = GitlabGroup .URL + "/" + URLEncoder .encode (path , "UTF-8" );
480
- return retrieve ().to (tailUrl , GitlabGroup .class );
510
+ Query query = new Query ()
511
+ .append (PARAM_WITH_PROJECTS , "" + withProjects );
512
+
513
+ return retrieve ().to (tailUrl + query .toString (), GitlabGroup .class );
481
514
}
482
515
483
516
public List <GitlabGroup > getGroups () throws IOException {
0 commit comments