Class CommitsApi

java.lang.Object
org.miaixz.bus.gitlab.AbstractApi
org.miaixz.bus.gitlab.CommitsApi
All Implemented Interfaces:
Constants

public class CommitsApi extends AbstractApi
This class implements the client side API for the GitLab commits calls. See Commits API at GitLab for more information.
  • Constructor Details

    • CommitsApi

      public CommitsApi(GitLabApi gitLabApi)
  • Method Details

    • getCommits

      public List<Commit> getCommits(Object projectIdOrPath) throws GitLabApiException
      Get a list of all repository commits in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      Returns:
      a list containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommits

      @Deprecated public List<Commit> getCommits(Object projectIdOrPath, int page, int perPage) throws GitLabApiException
      Deprecated.
      Get a list of repository commits in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      page - the page to get
      perPage - the number of commits per page
      Returns:
      a list containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommits

      public Pager<Commit> getCommits(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException
      Get a Pager of all repository commits in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      itemsPerPage - the number of Commit instances that will be fetched per page
      Returns:
      a Pager containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommitStream

      public Stream<Commit> getCommitStream(Object projectIdOrPath) throws GitLabApiException
      Get a Stream of all repository commits in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      Returns:
      a Stream containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommits

      public List<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, String path) throws GitLabApiException
      Get a list of repository commits in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      ref - the name of a repository branch or tag or if not given the default branch
      since - only commits after or on this date will be returned
      until - only commits before or on this date will be returned
      path - the path to file of a project
      Returns:
      a list containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommits

      public List<Commit> getCommits(Object projectIdOrPath, String ref, String path) throws GitLabApiException
      Get a list of file commits in a project
      GitLab Endpoint: GET /projects/:id/repository/commits?path=:file_path
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      ref - the name of a repository branch or tag or if not given the default branch
      path - the path to file of a project
      Returns:
      a list containing the commits for the specified project ID and file
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommits

      public List<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until) throws GitLabApiException
      Get a list of repository commits in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      ref - the name of a repository branch or tag or if not given the default branch
      since - only commits after or on this date will be returned
      until - only commits before or on this date will be returned
      Returns:
      a list containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommits

      @Deprecated public List<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, int page, int perPage) throws GitLabApiException
      Deprecated.
      Get a list of repository commits in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      ref - the name of a repository branch or tag or if not given the default branch
      since - only commits after or on this date will be returned
      until - only commits before or on this date will be returned
      page - the page to get
      perPage - the number of commits per page
      Returns:
      a list containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommitsStream

      public Stream<Commit> getCommitsStream(Object projectIdOrPath, String ref, Date since, Date until) throws GitLabApiException
      Get a Stream of repository commits in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      ref - the name of a repository branch or tag or if not given the default branch
      since - only commits after or on this date will be returned
      until - only commits before or on this date will be returned
      Returns:
      a Stream containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommitsStream

      public Stream<Commit> getCommitsStream(Object projectIdOrPath, String ref, Date since, Date until, String path) throws GitLabApiException
      Get a Stream of repository commits in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      ref - the name of a repository branch or tag or if not given the default branch
      since - only commits after or on this date will be returned
      until - only commits before or on this date will be returned
      path - the path to file of a project
      Returns:
      a Stream containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommits

      @Deprecated public List<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, String path, int page, int perPage) throws GitLabApiException
      Deprecated.
      Get a list of repository commits in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      ref - the name of a repository branch or tag or if not given the default branch
      since - only commits after or on this date will be returned
      until - only commits before or on this date will be returned
      path - the path to file of a project
      page - the page to get
      perPage - the number of commits per page
      Returns:
      a list containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommits

      public Pager<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, int itemsPerPage) throws GitLabApiException
      Get a Pager of repository commits in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      ref - the name of a repository branch or tag or if not given the default branch
      since - only commits after or on this date will be returned
      until - only commits before or on this date will be returned
      itemsPerPage - the number of Commit instances that will be fetched per page
      Returns:
      a Pager containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommits

      public Pager<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, String path, int itemsPerPage) throws GitLabApiException
      Get a Pager of repository commits in a project
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      ref - the name of a repository branch or tag or if not given the default branch
      since - only commits after or on this date will be returned
      until - only commits before or on this date will be returned
      path - the path to file of a project
      itemsPerPage - the number of Commit instances that will be fetched per page
      Returns:
      a Pager containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommits

      public List<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, String path, Boolean all, Boolean withStats, Boolean firstParent) throws GitLabApiException
      Get a List of the specified repository commits in a project
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      ref - the name of a repository branch or tag or if not given the default branch
      since - only commits after or on this date will be returned
      until - only commits before or on this date will be returned
      path - the path to file of a project
      all - retrieve every commit from the repository
      withStats - stats about each commit will be added to the response
      firstParent - follow only the first parent commit upon seeing a merge commit
      Returns:
      a Pager containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommits

      public Pager<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, String path, Boolean all, Boolean withStats, Boolean firstParent, int itemsPerPage) throws GitLabApiException
      Get a Pager of the specified repository commits in a project
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      ref - the name of a repository branch or tag or if not given the default branch
      since - only commits after or on this date will be returned
      until - only commits before or on this date will be returned
      path - the path to file of a project
      all - retrieve every commit from the repository
      withStats - stats about each commit will be added to the response
      firstParent - follow only the first parent commit upon seeing a merge commit
      itemsPerPage - the number of Commit instances that will be fetched per page
      Returns:
      a Pager containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommitsStream

      public Stream<Commit> getCommitsStream(Object projectIdOrPath, String ref, Date since, Date until, String path, Boolean all, Boolean withStats, Boolean firstParent) throws GitLabApiException
      Get a Stream of the specified repository commits in a project
      GitLab Endpoint: GET /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      ref - the name of a repository branch or tag or if not given the default branch
      since - only commits after or on this date will be returned
      until - only commits before or on this date will be returned
      path - the path to file of a project
      all - retrieve every commit from the repository
      withStats - stats about each commit will be added to the response
      firstParent - follow only the first parent commit upon seeing a merge commit
      Returns:
      a Stream containing the commits for the specified project ID
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommit

      public Commit getCommit(Object projectIdOrPath, String sha) throws GitLabApiException
      Get a specific commit identified by the commit hash or name of a branch or tag.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      Returns:
      the Commit instance for the specified project ID/sha pair
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getOptionalCommit

      public Optional<Commit> getOptionalCommit(Object projectIdOrPath, String sha)
      Get a specific commit identified by the commit hash or name of a branch or tag as an Optional instance
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      Returns:
      the Commit for the specified project ID/sha pair as an Optional instance
    • getCommitRefs

      public List<CommitRef> getCommitRefs(Object projectIdOrPath, String sha) throws GitLabApiException
      Get a List of all references (from branches or tags) a commit is pushed to.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      Returns:
      a List of all references (from branches or tags) a commit is pushed to
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
      Since:
      Gitlab 10.6
    • getCommitRefs

      public Pager<CommitRef> getCommitRefs(Object projectIdOrPath, String sha, int itemsPerPage) throws GitLabApiException
      Get a Pager of references (from branches or tags) a commit is pushed to.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs?type=:refType
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      itemsPerPage - the number of Commit instances that will be fetched per page
      Returns:
      a Pager of references (from branches or tags) a commit is pushed to
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
      Since:
      Gitlab 10.6
    • getCommitRefsStream

      public Stream<CommitRef> getCommitRefsStream(Object projectIdOrPath, String sha) throws GitLabApiException
      Get a Stream of all references (from branches or tags) a commit is pushed to.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      Returns:
      a Stream of all references (from branches or tags) a commit is pushed to
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
      Since:
      Gitlab 10.6
    • getCommitRefs

      public List<CommitRef> getCommitRefs(Object projectIdOrPath, String sha, CommitRef.RefType refType) throws GitLabApiException
      Get a List of all references (from branches or tags) a commit is pushed to.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs?type=:refType
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      refType - the scope of commits. Possible values branch, tag, all. Default is all.
      Returns:
      a List of all references (from branches or tags) a commit is pushed to
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
      Since:
      Gitlab 10.6
    • getCommitRefs

      public Pager<CommitRef> getCommitRefs(Object projectIdOrPath, String sha, CommitRef.RefType refType, int itemsPerPage) throws GitLabApiException
      Get a Pager of references (from branches or tags) a commit is pushed to.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs?type=:refType
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      refType - the scope of commits. Possible values branch, tag, all. Default is all.
      itemsPerPage - the number of Commit instances that will be fetched per page
      Returns:
      a Pager of references (from branches or tags) a commit is pushed to
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
      Since:
      Gitlab 10.6
    • getCommitRefsStream

      public Stream<CommitRef> getCommitRefsStream(Object projectIdOrPath, String sha, CommitRef.RefType refType) throws GitLabApiException
      Get a Stream of all references (from branches or tags) a commit is pushed to.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs?type=:refType
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      refType - the scope of commits. Possible values branch, tag, all. Default is all.
      Returns:
      a Stream of all references (from branches or tags) a commit is pushed to
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
      Since:
      Gitlab 10.6
    • getCommitStatuses

      public List<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha, CommitStatusFilter filter) throws GitLabApiException
      Get a list of repository commit statuses that meet the provided filter.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/statuses
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - the commit SHA
      filter - the commit statuses file, contains ref, stage, name, all
      Returns:
      a List containing the commit statuses for the specified project and sha that meet the provided filter
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommitStatuses

      public List<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha, CommitStatusFilter filter, int page, int perPage) throws GitLabApiException
      Get a list of repository commit statuses that meet the provided filter.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/statuses
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - the commit SHA
      filter - the commit statuses file, contains ref, stage, name, all
      page - the page to get
      perPage - the number of commits statuses per page
      Returns:
      a List containing the commit statuses for the specified project and sha that meet the provided filter
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommitStatuses

      public Pager<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha, CommitStatusFilter filter, int itemsPerPage) throws GitLabApiException
      Get a Pager of repository commit statuses that meet the provided filter.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/statuses
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - the commit SHA
      filter - the commit statuses file, contains ref, stage, name, all
      itemsPerPage - the number of CommitStatus instances that will be fetched per page
      Returns:
      a Pager containing the commit statuses for the specified project and sha that meet the provided filter
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommitStatusesStream

      public Stream<CommitStatus> getCommitStatusesStream(Object projectIdOrPath, String sha, CommitStatusFilter filter) throws GitLabApiException
      Get a Stream of repository commit statuses that meet the provided filter.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/statuses
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - the commit SHA
      filter - the commit statuses file, contains ref, stage, name, all
      Returns:
      a Stream containing the commit statuses for the specified project and sha that meet the provided filter
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • addCommitStatus

      public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, Constants.CommitBuildState state, CommitStatus status) throws GitLabApiException

      Add or update the build status of a commit. The following fluent methods are available on the CommitStatus instance for setting up the status:

      
       withCoverage(Float)
       withDescription(String)
       withName(String)
       withRef(String)
       withTargetUrl(String)
       
      GitLab Endpoint: POST /projects/:id/statuses/:sha
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance (required)
      sha - a commit SHA (required)
      state - the state of the status. Can be one of the following: PENDING, RUNNING, SUCCESS, FAILED, CANCELED (required)
      status - the CommitSatus instance hoilding the optional parms: ref, name, target_url, description, and coverage
      Returns:
      a CommitStatus instance with the updated info
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • addCommitStatus

      @Deprecated public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, Constants.CommitBuildState state, Long pipelineId, CommitStatus status) throws GitLabApiException
      Deprecated.
      use addCommitStatus(Object, String, CommitBuildState, CommitStatus) and set the pipelineId value in the CommitStatus parameter

      Add or update the build status of a commit. The following fluent methods are available on the CommitStatus instance for setting up the status:

      
       withCoverage(Float)
       withDescription(String)
       withName(String)
       withRef(String)
       withTargetUrl(String)
       
      GitLab Endpoint: POST /projects/:id/statuses/:sha
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance (required)
      sha - a commit SHA (required)
      state - the state of the status. Can be one of the following: PENDING, RUNNING, SUCCESS, FAILED, CANCELED (required)
      pipelineId - The ID of the pipeline to set status. Use in case of several pipeline on same SHA (optional)
      status - the CommitSatus instance hoilding the optional parms: ref, name, target_url, description, and coverage
      Returns:
      a CommitStatus instance with the updated info
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getDiff

      public List<Diff> getDiff(Object projectIdOrPath, String sha) throws GitLabApiException
      Get the list of diffs of a commit in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/diff
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      Returns:
      a List of Diff instances for the specified project ID/sha pair
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getDiff

      public Pager<Diff> getDiff(Object projectIdOrPath, String sha, int itemsPerPage) throws GitLabApiException
      Get the Pager of diffs of a commit in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/diff
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      itemsPerPage - the number of Diff instances that will be fetched per page
      Returns:
      a Pager of Diff instances for the specified project ID/sha pair
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getDiffStream

      public Stream<Diff> getDiffStream(Object projectIdOrPath, String sha) throws GitLabApiException
      Get the Diff of diffs of a commit in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/diff
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      Returns:
      a Stream of Diff instances for the specified project ID/sha pair
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getComments

      public List<Comment> getComments(Object projectIdOrPath, String sha) throws GitLabApiException
      Get the comments of a commit in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/comments
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      Returns:
      a List of Comment instances for the specified project ID/sha pair
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getComments

      public Pager<Comment> getComments(Object projectIdOrPath, String sha, int itemsPerPage) throws GitLabApiException
      Get a Pager of the comments of a commit in a project.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/comments
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      itemsPerPage - the number of Comment instances that will be fetched per page
      Returns:
      a List of Comment instances for the specified project ID/sha pair
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getCommentsStream

      public Stream<Comment> getCommentsStream(Object projectIdOrPath, String sha) throws GitLabApiException
      Get the comments of a commit in a project as a Stream.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/comments
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      Returns:
      a Stream of Comment instances for the specified project ID/sha pair
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • addComment

      public Comment addComment(Object projectIdOrPath, String sha, String note, String path, Integer line, Constants.LineType lineType) throws GitLabApiException
      Add a comment to a commit. In order to post a comment in a particular line of a particular file, you must specify the full commit SHA, the path, the line and lineType should be NEW.
      GitLab Endpoint: POST /projects/:id/repository/commits/:sha/comments
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      note - the text of the comment, required
      path - the file path relative to the repository, optional
      line - the line number where the comment should be placed, optional
      lineType - the line type, optional
      Returns:
      a Comment instance for the posted comment
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • addComment

      public Comment addComment(Object projectIdOrPath, String sha, String note) throws GitLabApiException
      Add a comment to a commit.
      GitLab Endpoint: POST /projects/:id/repository/commits/:sha/comments
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      note - the text of the comment, required
      Returns:
      a Comment instance for the posted comment
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • createCommit

      public Commit createCommit(Object projectIdOrPath, String branch, String commitMessage, String startBranch, String authorEmail, String authorName, CommitAction action) throws GitLabApiException
      Create a commit with single file and action.
      GitLab Endpoint: POST /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      branch - tame of the branch to commit into. To create a new branch, also provide startBranch
      commitMessage - the commit message
      startBranch - the name of the branch to start the new commit from
      authorEmail - the commit author's email address
      authorName - the commit author's name
      action - the CommitAction to commit
      Returns:
      the created Commit instance
      Throws:
      GitLabApiException - if any exception occurs during execution
    • createCommit

      public Commit createCommit(Object projectIdOrPath, String branch, String commitMessage, String startBranch, String authorEmail, String authorName, List<CommitAction> actions) throws GitLabApiException
      Create a commit with multiple files and actions.
      GitLab Endpoint: POST /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      branch - tame of the branch to commit into. To create a new branch, also provide startBranch
      commitMessage - the commit message
      startBranch - the name of the branch to start the new commit from
      authorEmail - the commit author's email address
      authorName - the commit author's name
      actions - the array of CommitAction to commit as a batch
      Returns:
      the created Commit instance
      Throws:
      GitLabApiException - if any exception occurs during execution
    • createCommit

      public Commit createCommit(Object projectIdOrPath, CommitPayload payload) throws GitLabApiException
      Create a commit with multiple files and actions.
      GitLab Endpoint: POST /projects/:id/repository/commits
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      payload - a CommitPayload instance holding the parameters for the commit
      Returns:
      the created Commit instance
      Throws:
      GitLabApiException - if any exception occurs during execution
    • revertCommit

      public Commit revertCommit(Object projectIdOrPath, String sha, String branch) throws GitLabApiException
      Reverts a commit in a given branch.
      GitLab Endpoint: POST /projects/:id/repository/commits/:sha/revert
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - the commit SHA to revert
      branch - the target branch to revert the commit on
      Returns:
      a Commit instance holding the reverted commit
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
      Since:
      GitLab 11.5
    • cherryPickCommit

      public Commit cherryPickCommit(Object projectIdOrPath, String sha, String branch) throws GitLabApiException
      Cherry picks a commit in a given branch.
      GitLab Endpoint: POST /projects/:id/repository/commits/:sha/cherry_pick
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - the commit SHA to cherry pick
      branch - the target branch to cherry pick the commit on
      Returns:
      a Commit instance holding the cherry picked commit
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
      Since:
      GitLab 8.15
    • getMergeRequests

      public List<MergeRequest> getMergeRequests(Object projectIdOrPath, String sha) throws GitLabApiException
      Get a list of Merge Requests related to the specified commit.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/merge_requests
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - the commit SHA to get merge requests for
      Returns:
      a list containing the MergeRequest instances for the specified project/SHA
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getMergeRequests

      public Pager<MergeRequest> getMergeRequests(Object projectIdOrPath, String sha, int itemsPerPage) throws GitLabApiException
      Get a Pager of Merge Requests related to the specified commit.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/merge_requests
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - the commit SHA to get merge requests for
      itemsPerPage - the number of Commit instances that will be fetched per page
      Returns:
      a Pager containing the MergeRequest instances for the specified project/SHA
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getMergeRequestsStream

      public Stream<MergeRequest> getMergeRequestsStream(Object projectIdOrPath, String sha) throws GitLabApiException
      Get a Stream of Merge Requests related to the specified commit.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/merge_requests
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - the commit SHA to get merge requests for
      Returns:
      a Stream containing the MergeRequest instances for the specified project/SHA
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getGpgSignature

      public GpgSignature getGpgSignature(Object projectIdOrPath, String sha) throws GitLabApiException
      Get the GPG signature from a commit, if it is signed. For unsigned commits, it results in a 404 response.
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/signature
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      Returns:
      the GpgSignature instance for the specified project ID/sha pair
      Throws:
      GitLabApiException - GitLabApiException if any exception occurs during execution
    • getOptionalGpgSignature

      public Optional<GpgSignature> getOptionalGpgSignature(Object projectIdOrPath, String sha)
      Get the GPG signature from a commit as an Optional instance
      GitLab Endpoint: GET /projects/:id/repository/commits/:sha/signature
      Parameters:
      projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
      sha - a commit hash or name of a branch or tag
      Returns:
      the GpgSignature for the specified project ID/sha pair as an Optional instance