Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.messners.gitlab.api;
 
 
 import java.util.List;

This class implements the client side API for the GitLab commits calls.

Author(s):
Greg Messner <greg@messners.com>
public class CommitsApi extends AbstractApi {
	public CommitsApi (GitLabApi gitLabApi) {
		super(gitLabApi);
	}


Get a list of repository commits in a project. GET /projects/:id/repository/commits

Parameters:
projectId
Returns:
a List<Commit> containing the commits for the specified project ID
Throws:
GitLabApiException
	public List<CommitgetCommits (int projectIdthrows GitLabApiException {		
		Response response = get(..null"projects"projectId"repository""commits");
		return (response.readEntity(new GenericType<List<Commit>>(){}));
	}


Get a specific commit identified by the commit hash or name of a branch or tag. GET /projects/:id/repository/commits/:sha

Parameters:
projectId
sha a commit hash or name of a branch or tag
Returns:
the Commit instance for the specified project ID/sha pair
Throws:
GitLabApiException
	public Commit getCommits (int projectIdString shathrows GitLabApiException {		
		Response response = get(..null"projects"projectId"repository""commits"sha);
		return (response.readEntity(Commit.class));
	}


Get the diff of a commit in a project. GET /projects/:id/repository/commits/:sha/diff

Parameters:
projectId
sha a commit hash or name of a branch or tag
Returns:
the Diff instance for the specified project ID/sha pair
Throws:
GitLabApiException
	public Diff getDiff (int projectIdString shathrows GitLabApiException {		
		Response response = get(..null,
				"projects"projectId"repository""commits"sha"diff");
		return (response.readEntity(Diff.class));
	}
New to GrepCode? Check out our FAQ X