File tree Expand file tree Collapse file tree 3 files changed +36
-3
lines changed
src/main/java/org/gitlab4j/api Expand file tree Collapse file tree 3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change @@ -33,14 +33,25 @@ public GroupApi(GitLabApi gitLabApi) {
33
33
}
34
34
35
35
/**
36
- * Get a list of groups. (As user: my groups, as admin: all groups)
36
+ * <p>Get a list of groups. (As user: my groups, as admin: all groups)</p>
37
+ *
38
+ * <strong>WARNING:</strong> Do not use this method to fetch groups from https://gitlab.com,
39
+ * gitlab.com has many 1,000's of public groups and it will a long time to fetch all of them.
40
+ * Instead use {@link #getGroups(int itemsPerPage)} which will return a Pager of Group instances.
37
41
*
38
42
* <pre><code>GitLab Endpoint: GET /groups</code></pre>
39
43
*
40
44
* @return the list of groups viewable by the authenticated user
41
45
* @throws GitLabApiException if any exception occurs
42
46
*/
43
47
public List <Group > getGroups () throws GitLabApiException {
48
+
49
+ String url = this .gitLabApi .getGitLabServerUrl ();
50
+ if (url .startsWith ("https://gitlab.com" )) {
51
+ GitLabApi .getLogger ().warning ("Fetching all groups from " + url +
52
+ " may take many minutes to complete, use Pager<Group> getGroups(int) instead." );
53
+ }
54
+
44
55
return (getGroups (getDefaultPerPage ()).all ());
45
56
}
46
57
Original file line number Diff line number Diff line change @@ -67,14 +67,25 @@ public ProjectApi(GitLabApi gitLabApi) {
67
67
}
68
68
69
69
/**
70
- * Get a list of projects accessible by the authenticated user.
70
+ * <p>Get a list of projects accessible by the authenticated user.</p>
71
+ *
72
+ * <strong>WARNING:</strong> Do not use this method to fetch projects from https://gitlab.com,
73
+ * gitlab.com has many 100,000's of public projects and it will take hours to fetch all of them.
74
+ * Instead use {@link #getProjects(int itemsPerPage)} which will return a Pager of Project instances.
71
75
*
72
76
* <pre><code>GET /projects</code></pre>
73
77
*
74
78
* @return a list of projects accessible by the authenticated user
75
79
* @throws GitLabApiException if any exception occurs
76
80
*/
77
81
public List <Project > getProjects () throws GitLabApiException {
82
+
83
+ String url = this .gitLabApi .getGitLabServerUrl ();
84
+ if (url .startsWith ("https://gitlab.com" )) {
85
+ GitLabApi .getLogger ().warning ("Fetching all projects from " + url +
86
+ " may take many hours to complete, use Pager<Project> getProjects(int) instead." );
87
+ }
88
+
78
89
return (getProjects (getDefaultPerPage ()).all ());
79
90
}
80
91
Original file line number Diff line number Diff line change @@ -47,14 +47,25 @@ public void disableCustomAttributes() {
47
47
}
48
48
49
49
/**
50
- * Get a list of users.
50
+ * <p>Get a list of users.</p>
51
+ *
52
+ * <strong>WARNING:</strong> Do not use this method to fetch users from https://gitlab.com,
53
+ * gitlab.com has many 1,000,000's of users and it will a long time to fetch all of them.
54
+ * Instead use {@link #getUsers(int itemsPerPage)} which will return a Pager of Group instances.
51
55
*
52
56
* <pre><code>GitLab Endpoint: GET /users</code></pre>
53
57
*
54
58
* @return a list of Users
55
59
* @throws GitLabApiException if any exception occurs
56
60
*/
57
61
public List <User > getUsers () throws GitLabApiException {
62
+
63
+ String url = this .gitLabApi .getGitLabServerUrl ();
64
+ if (url .startsWith ("https://gitlab.com" )) {
65
+ GitLabApi .getLogger ().warning ("Fetching all users from " + url +
66
+ " may take many minutes to complete, use Pager<User> getUsers(int) instead." );
67
+ }
68
+
58
69
return (getUsers (getDefaultPerPage ()).all ());
59
70
}
60
71
You can’t perform that action at this time.
0 commit comments