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) {
3333 }
3434
3535 /**
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.
3741 *
3842 * <pre><code>GitLab Endpoint: GET /groups</code></pre>
3943 *
4044 * @return the list of groups viewable by the authenticated user
4145 * @throws GitLabApiException if any exception occurs
4246 */
4347 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+
4455 return (getGroups (getDefaultPerPage ()).all ());
4556 }
4657
Original file line number Diff line number Diff line change @@ -67,14 +67,25 @@ public ProjectApi(GitLabApi gitLabApi) {
6767 }
6868
6969 /**
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.
7175 *
7276 * <pre><code>GET /projects</code></pre>
7377 *
7478 * @return a list of projects accessible by the authenticated user
7579 * @throws GitLabApiException if any exception occurs
7680 */
7781 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+
7889 return (getProjects (getDefaultPerPage ()).all ());
7990 }
8091
Original file line number Diff line number Diff line change @@ -47,14 +47,25 @@ public void disableCustomAttributes() {
4747 }
4848
4949 /**
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.
5155 *
5256 * <pre><code>GitLab Endpoint: GET /users</code></pre>
5357 *
5458 * @return a list of Users
5559 * @throws GitLabApiException if any exception occurs
5660 */
5761 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+
5869 return (getUsers (getDefaultPerPage ()).all ());
5970 }
6071
You can’t perform that action at this time.
0 commit comments