31
31
import java .util .Map ;
32
32
import java .util .Optional ;
33
33
import java .util .stream .Stream ;
34
+ import java .util .stream .StreamSupport ;
34
35
35
36
import javax .ws .rs .core .Form ;
36
37
import javax .ws .rs .core .GenericType ;
@@ -109,7 +110,7 @@ public Pager<Project> getProjects(int itemsPerPage) throws GitLabApiException {
109
110
* @throws GitLabApiException if any exception occurs
110
111
*/
111
112
public Stream <Project > getProjectsStream () throws GitLabApiException {
112
- return ( getProjects (getDefaultPerPage ()). stream () );
113
+ return StreamSupport . stream ( new PagerSpliterator ( getProjects (getDefaultPerPage ())), false );
113
114
}
114
115
115
116
/**
@@ -818,15 +819,15 @@ public Project createProject(Project project, String importUrl) throws GitLabApi
818
819
if (isApiVersion (ApiVersion .V3 )) {
819
820
boolean isPublic = (project .getPublic () != null ? project .getPublic () : project .getVisibility () == Visibility .PUBLIC );
820
821
formData .withParam ("public" , isPublic );
821
-
822
+
822
823
if (project .getTagList () != null && !project .getTagList ().isEmpty ()) {
823
824
throw new IllegalArgumentException ("GitLab API v3 does not support tag lists when creating projects" );
824
825
}
825
826
} else {
826
827
Visibility visibility = (project .getVisibility () != null ? project .getVisibility () :
827
828
project .getPublic () == Boolean .TRUE ? Visibility .PUBLIC : null );
828
829
formData .withParam ("visibility" , visibility );
829
-
830
+
830
831
if (project .getTagList () != null && !project .getTagList ().isEmpty ()) {
831
832
formData .withParam ("tag_list" , String .join ("," , project .getTagList ()));
832
833
}
@@ -1057,15 +1058,15 @@ public Project updateProject(Project project) throws GitLabApiException {
1057
1058
formData .withParam ("visibility_level" , project .getVisibilityLevel ());
1058
1059
boolean isPublic = (project .getPublic () != null ? project .getPublic () : project .getVisibility () == Visibility .PUBLIC );
1059
1060
formData .withParam ("public" , isPublic );
1060
-
1061
+
1061
1062
if (project .getTagList () != null && !project .getTagList ().isEmpty ()) {
1062
1063
throw new IllegalArgumentException ("GitLab API v3 does not support tag lists when updating projects" );
1063
1064
}
1064
1065
} else {
1065
1066
Visibility visibility = (project .getVisibility () != null ? project .getVisibility () :
1066
1067
project .getPublic () == Boolean .TRUE ? Visibility .PUBLIC : null );
1067
1068
formData .withParam ("visibility" , visibility );
1068
-
1069
+
1069
1070
if (project .getTagList () != null && !project .getTagList ().isEmpty ()) {
1070
1071
formData .withParam ("tag_list" , String .join ("," , project .getTagList ()));
1071
1072
}
@@ -1090,7 +1091,7 @@ public void deleteProject(Object projectIdOrPath) throws GitLabApiException {
1090
1091
1091
1092
/**
1092
1093
* Forks a project into the user namespace of the authenticated user or the one provided.
1093
- * The forking operation for a project is asynchronous and is completed in a background job.
1094
+ * The forking operation for a project is asynchronous and is completed in a background job.
1094
1095
* The request will return immediately.
1095
1096
*
1096
1097
* <pre><code>POST /projects/:id/fork</code></pre>
@@ -1109,7 +1110,7 @@ public Project forkProject(Object projectIdOrPath, String namespace) throws GitL
1109
1110
1110
1111
/**
1111
1112
* Forks a project into the user namespace of the authenticated user or the one provided.
1112
- * The forking operation for a project is asynchronous and is completed in a background job.
1113
+ * The forking operation for a project is asynchronous and is completed in a background job.
1113
1114
* The request will return immediately.
1114
1115
*
1115
1116
* <pre><code>POST /projects/:id/fork</code></pre>
@@ -1130,7 +1131,7 @@ public Project forkProject(Object projectIdOrPath, Integer namespaceId) throws G
1130
1131
* Create a forked from/to relation between existing projects.
1131
1132
*
1132
1133
* <pre><code>POST /projects/:id/fork/:forkFromId</code></pre>
1133
- *
1134
+ *
1134
1135
*
1135
1136
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
1136
1137
* @param forkedFromId the ID of the project that was forked from
@@ -1455,7 +1456,7 @@ public List<ProjectUser> getProjectUsers(Object projectIdOrPath, String search)
1455
1456
}
1456
1457
1457
1458
/**
1458
- * Get a Pager of project users matching the specified search string. This Pager includes
1459
+ * Get a Pager of project users matching the specified search string. This Pager includes
1459
1460
* all project members and all users assigned to project parent groups.
1460
1461
*
1461
1462
* <pre><code>GET /projects/:id/users</code></pre>
@@ -1644,7 +1645,7 @@ public Optional<ProjectHook> getOptionalHook(Object projectIdOrPath, Integer hoo
1644
1645
* @return the added ProjectHook instance
1645
1646
* @throws GitLabApiException if any exception occurs
1646
1647
*/
1647
- public ProjectHook addHook (String projectName , String url , ProjectHook enabledHooks , boolean enableSslVerification , String secretToken )
1648
+ public ProjectHook addHook (String projectName , String url , ProjectHook enabledHooks , boolean enableSslVerification , String secretToken )
1648
1649
throws GitLabApiException {
1649
1650
1650
1651
if (projectName == null ) {
@@ -2266,9 +2267,9 @@ public void deletePushRules(Object projectIdOrPath) throws GitLabApiException {
2266
2267
2267
2268
/**
2268
2269
* Get a list of projects that were forked from the specified project.
2269
- *
2270
+ *
2270
2271
* <pre><code>GET /projects/:id/forks</code></pre>
2271
- *
2272
+ *
2272
2273
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
2273
2274
* @return a List of forked projects
2274
2275
* @throws GitLabApiException if any exception occurs
@@ -2382,7 +2383,7 @@ public Project transferProject(Object projectIdOrPath, String namespace) throws
2382
2383
}
2383
2384
2384
2385
/**
2385
- * Uploads and sets the project avatar for the specified project.
2386
+ * Uploads and sets the project avatar for the specified project.
2386
2387
*
2387
2388
* <pre><code>PUT /projects/:id/uploads</code></pre>
2388
2389
*
0 commit comments