diff --git a/src/main/java/org/gitlab4j/api/GroupApi.java b/src/main/java/org/gitlab4j/api/GroupApi.java index b50feae9ef87101666828d0c767d47c9c1dbcece..380e75adb83a8d24248026b8d549015cf4575590 100644 --- a/src/main/java/org/gitlab4j/api/GroupApi.java +++ b/src/main/java/org/gitlab4j/api/GroupApi.java @@ -33,7 +33,11 @@ public class GroupApi extends AbstractApi { } /** - * Get a list of groups. (As user: my groups, as admin: all groups) + *

Get a list of groups. (As user: my groups, as admin: all groups)

+ * + * WARNING: Do not use this method to fetch groups from https://gitlab.com, + * gitlab.com has many 1,000's of public groups and it will a long time to fetch all of them. + * Instead use {@link #getGroups(int itemsPerPage)} which will return a Pager of Group instances. * *
GitLab Endpoint: GET /groups
* @@ -41,6 +45,13 @@ public class GroupApi extends AbstractApi { * @throws GitLabApiException if any exception occurs */ public List getGroups() throws GitLabApiException { + + String url = this.gitLabApi.getGitLabServerUrl(); + if (url.startsWith("https://gitlab.com")) { + GitLabApi.getLogger().warning("Fetching all groups from " + url + + " may take many minutes to complete, use Pager getGroups(int) instead."); + } + return (getGroups(getDefaultPerPage()).all()); } diff --git a/src/main/java/org/gitlab4j/api/ProjectApi.java b/src/main/java/org/gitlab4j/api/ProjectApi.java index 59310a7f60096849078e2e811f2355bf41c58207..a7e39640fe4a5d32a004dc59bfec49c226278cba 100644 --- a/src/main/java/org/gitlab4j/api/ProjectApi.java +++ b/src/main/java/org/gitlab4j/api/ProjectApi.java @@ -67,7 +67,11 @@ public class ProjectApi extends AbstractApi implements Constants { } /** - * Get a list of projects accessible by the authenticated user. + *

Get a list of projects accessible by the authenticated user.

+ * + * WARNING: Do not use this method to fetch projects from https://gitlab.com, + * gitlab.com has many 100,000's of public projects and it will take hours to fetch all of them. + * Instead use {@link #getProjects(int itemsPerPage)} which will return a Pager of Project instances. * *
GET /projects
* @@ -75,6 +79,13 @@ public class ProjectApi extends AbstractApi implements Constants { * @throws GitLabApiException if any exception occurs */ public List getProjects() throws GitLabApiException { + + String url = this.gitLabApi.getGitLabServerUrl(); + if (url.startsWith("https://gitlab.com")) { + GitLabApi.getLogger().warning("Fetching all projects from " + url + + " may take many hours to complete, use Pager getProjects(int) instead."); + } + return (getProjects(getDefaultPerPage()).all()); } diff --git a/src/main/java/org/gitlab4j/api/UserApi.java b/src/main/java/org/gitlab4j/api/UserApi.java index 4e179b042cb34608e461ff198ab78a5e4e2833d0..17772dca1346093abad68ff1fada723fa157c9ed 100644 --- a/src/main/java/org/gitlab4j/api/UserApi.java +++ b/src/main/java/org/gitlab4j/api/UserApi.java @@ -47,7 +47,11 @@ public class UserApi extends AbstractApi { } /** - * Get a list of users. + *

Get a list of users.

+ * + * WARNING: Do not use this method to fetch users from https://gitlab.com, + * gitlab.com has many 1,000,000's of users and it will a long time to fetch all of them. + * Instead use {@link #getUsers(int itemsPerPage)} which will return a Pager of Group instances. * *
GitLab Endpoint: GET /users
* @@ -55,6 +59,13 @@ public class UserApi extends AbstractApi { * @throws GitLabApiException if any exception occurs */ public List getUsers() throws GitLabApiException { + + String url = this.gitLabApi.getGitLabServerUrl(); + if (url.startsWith("https://gitlab.com")) { + GitLabApi.getLogger().warning("Fetching all users from " + url + + " may take many minutes to complete, use Pager getUsers(int) instead."); + } + return (getUsers(getDefaultPerPage()).all()); }