diff --git a/src/main/java/org/gitlab4j/api/CommitsApi.java b/src/main/java/org/gitlab4j/api/CommitsApi.java index 2b5990c8d24cf1ccef7470bdb948d56faad929ca..3a2c801fe2427969c54ebce111ddabf9bf9cdd63 100644 --- a/src/main/java/org/gitlab4j/api/CommitsApi.java +++ b/src/main/java/org/gitlab4j/api/CommitsApi.java @@ -34,7 +34,7 @@ public class CommitsApi extends AbstractApi { } /** - * Get a list of repository commits in a project. + * Get a list of all repository commits in a project. * *
GitLab Endpoint: GET /projects/:id/repository/commits
* @@ -43,7 +43,7 @@ public class CommitsApi extends AbstractApi { * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ public List getCommits(Object projectIdOrPath) throws GitLabApiException { - return (getCommits(projectIdOrPath, null, null, null, getDefaultPerPage()).all()); + return (getCommits(projectIdOrPath, null, null, null, null, true, null, null, getDefaultPerPage()).all()); } /** @@ -56,13 +56,15 @@ public class CommitsApi extends AbstractApi { * @param perPage the number of commits per page * @return a list containing the commits for the specified project ID * @throws GitLabApiException GitLabApiException if any exception occurs during execution + * @deprecated */ + @Deprecated public List getCommits(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { return (getCommits(projectIdOrPath, null, null, null, page, perPage)); } /** - * Get a Pager of repository commits in a project. + * Get a Pager of all repository commits in a project. * *
GitLab Endpoint: GET /projects/:id/repository/commits
* @@ -72,11 +74,11 @@ public class CommitsApi extends AbstractApi { * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ public Pager getCommits(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException { - return (getCommits(projectIdOrPath, null, null, null, itemsPerPage)); + return (getCommits(projectIdOrPath, null, null, null, null, true, null, null, itemsPerPage)); } /** - * Get a Stream of repository commits in a project. + * Get a Stream of all repository commits in a project. * *
GitLab Endpoint: GET /projects/:id/repository/commits
* @@ -85,7 +87,7 @@ public class CommitsApi extends AbstractApi { * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ public Stream getCommitStream(Object projectIdOrPath) throws GitLabApiException { - return (getCommits(projectIdOrPath, null, null, null, getDefaultPerPage()).stream()); + return (getCommits(projectIdOrPath, null, null, null,null, true, null, null, getDefaultPerPage()).stream()); } /** @@ -102,7 +104,7 @@ public class CommitsApi extends AbstractApi { * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ public List getCommits(Object projectIdOrPath, String ref, Date since, Date until, String path) throws GitLabApiException { - return (getCommits(projectIdOrPath, ref, since, until, path, getDefaultPerPage()).all()); + return (getCommits(projectIdOrPath, ref, since, until, path, null, null, null, getDefaultPerPage()).all()); } /** @@ -117,7 +119,7 @@ public class CommitsApi extends AbstractApi { * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ public List getCommits(Object projectIdOrPath, String ref, String path) throws GitLabApiException { - return (getCommits(projectIdOrPath, ref, null, null, path, getDefaultPerPage()).all()); + return (getCommits(projectIdOrPath, ref, null, null, path, null, null, null, getDefaultPerPage()).all()); } /** @@ -133,7 +135,7 @@ public class CommitsApi extends AbstractApi { * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ public List getCommits(Object projectIdOrPath, String ref, Date since, Date until) throws GitLabApiException { - return (getCommits(projectIdOrPath, ref, since, until, null, getDefaultPerPage()).all()); + return (getCommits(projectIdOrPath, ref, since, until, null, null, null, null, getDefaultPerPage()).all()); } /** @@ -149,7 +151,9 @@ public class CommitsApi extends AbstractApi { * @param perPage the number of commits per page * @return a list containing the commits for the specified project ID * @throws GitLabApiException GitLabApiException if any exception occurs during execution + * @deprecated */ + @Deprecated public List getCommits(Object projectIdOrPath, String ref, Date since, Date until, int page, int perPage) throws GitLabApiException { return (getCommits(projectIdOrPath, ref, since, until, null, page, perPage)); } @@ -167,7 +171,7 @@ public class CommitsApi extends AbstractApi { * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ public Stream getCommitsStream(Object projectIdOrPath, String ref, Date since, Date until) throws GitLabApiException { - return (getCommits(projectIdOrPath, ref, since, until, null, getDefaultPerPage()).stream()); + return (getCommits(projectIdOrPath, ref, since, until, null, null, null, null, getDefaultPerPage()).stream()); } /** @@ -184,7 +188,7 @@ public class CommitsApi extends AbstractApi { * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ public Stream getCommitsStream(Object projectIdOrPath, String ref, Date since, Date until, String path) throws GitLabApiException { - return (getCommits(projectIdOrPath, ref, since, until, path, getDefaultPerPage()).stream()); + return (getCommits(projectIdOrPath, ref, since, until, path, null, null, null, getDefaultPerPage()).stream()); } /** @@ -201,7 +205,9 @@ public class CommitsApi extends AbstractApi { * @param perPage the number of commits per page * @return a list containing the commits for the specified project ID * @throws GitLabApiException GitLabApiException if any exception occurs during execution + * @deprecated */ + @Deprecated public List getCommits(Object projectIdOrPath, String ref, Date since, Date until, String path, int page, int perPage) throws GitLabApiException { Form formData = new GitLabApiForm() .withParam("ref_name", ref) @@ -228,7 +234,7 @@ public class CommitsApi extends AbstractApi { * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ public Pager getCommits(Object projectIdOrPath, String ref, Date since, Date until, int itemsPerPage) throws GitLabApiException { - return getCommits(projectIdOrPath, ref, since, until, null, itemsPerPage); + return getCommits(projectIdOrPath, ref, since, until, null, null, null, null, itemsPerPage); } /** @@ -246,14 +252,81 @@ public class CommitsApi extends AbstractApi { * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ public Pager getCommits(Object projectIdOrPath, String ref, Date since, Date until, String path, int itemsPerPage) throws GitLabApiException { + return (getCommits(projectIdOrPath, ref, since, until, path, null, null, null, itemsPerPage)); + } + + /** + * Get a List of the specified repository commits in a project + * + *
GitLab Endpoint: GET /projects/:id/repository/commits
+ * + * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance + * @param ref the name of a repository branch or tag or if not given the default branch + * @param since only commits after or on this date will be returned + * @param until only commits before or on this date will be returned + * @param path the path to file of a project + * @param all retrieve every commit from the repository + * @param withStats stats about each commit will be added to the response + * @param firstParent follow only the first parent commit upon seeing a merge commit + * @return a Pager containing the commits for the specified project ID + * @throws GitLabApiException GitLabApiException if any exception occurs during execution + */ + public List getCommits(Object projectIdOrPath, String ref, Date since, Date until, + String path, Boolean all, Boolean withStats, Boolean firstParent) throws GitLabApiException { + return (getCommits(projectIdOrPath, ref, since, until, path, all, withStats, firstParent, getDefaultPerPage()).all()); + } + + /** + * Get a Pager of the specified repository commits in a project + * + *
GitLab Endpoint: GET /projects/:id/repository/commits
+ * + * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance + * @param ref the name of a repository branch or tag or if not given the default branch + * @param since only commits after or on this date will be returned + * @param until only commits before or on this date will be returned + * @param path the path to file of a project + * @param all retrieve every commit from the repository + * @param withStats stats about each commit will be added to the response + * @param firstParent follow only the first parent commit upon seeing a merge commit + * @param itemsPerPage the number of Commit instances that will be fetched per page + * @return a Pager containing the commits for the specified project ID + * @throws GitLabApiException GitLabApiException if any exception occurs during execution + */ + public Pager getCommits(Object projectIdOrPath, String ref, Date since, Date until, + String path, Boolean all, Boolean withStats, Boolean firstParent, int itemsPerPage) throws GitLabApiException { Form formData = new GitLabApiForm() .withParam("ref_name", ref) .withParam("since", ISO8601.toString(since, false)) .withParam("until", ISO8601.toString(until, false)) - .withParam("path", (path == null ? null : urlEncode(path))); + .withParam("path", (path == null ? null : urlEncode(path))) + .withParam("all", all) + .withParam("with_stats", withStats) + .withParam("first_parent", firstParent); return (new Pager(this, Commit.class, itemsPerPage, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits")); } + /** + * Get a Stream of the specified repository commits in a project + * + *
GitLab Endpoint: GET /projects/:id/repository/commits
+ * + * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance + * @param ref the name of a repository branch or tag or if not given the default branch + * @param since only commits after or on this date will be returned + * @param until only commits before or on this date will be returned + * @param path the path to file of a project + * @param all retrieve every commit from the repository + * @param withStats stats about each commit will be added to the response + * @param firstParent follow only the first parent commit upon seeing a merge commit + * @return a Stream containing the commits for the specified project ID + * @throws GitLabApiException GitLabApiException if any exception occurs during execution + */ + public Stream getCommitsStream(Object projectIdOrPath, String ref, Date since, Date until, + String path, Boolean all, Boolean withStats, Boolean firstParent) throws GitLabApiException { + return (getCommits(projectIdOrPath, ref, since, until, path, all, withStats, firstParent, getDefaultPerPage()).stream()); + } + /** * Get a specific commit identified by the commit hash or name of a branch or tag. *