org.eclipse.egit.github.core.service
Class PullRequestService

java.lang.Object
  extended by org.eclipse.egit.github.core.service.GitHubService
      extended by org.eclipse.egit.github.core.service.PullRequestService

public class PullRequestService
extends GitHubService

Service class for creating, updating, getting, and listing pull requests as well as getting the commits associated with a pull request and the files modified by a pull request.

See Also:
GitHub Pull Requests API documentation, GitHub Pull Request comments API documentation

Field Summary
static String PR_BASE
          PR_BASE
static String PR_BODY
          PR_BODY
static String PR_HEAD
          PR_HEAD
static String PR_STATE
          PR_STATE
static String PR_TITLE
          PR_TITLE
 
Fields inherited from class org.eclipse.egit.github.core.service.GitHubService
ACCEPT_FULL, ACCEPT_HTML, ACCEPT_TEXT, client
 
Constructor Summary
PullRequestService()
          Create pull request service
PullRequestService(GitHubClient client)
          Create pull request service
 
Method Summary
 CommitComment createComment(IRepositoryIdProvider repository, int id, CommitComment comment)
          Create comment on given pull request
 PullRequest createPullRequest(IRepositoryIdProvider repository, int issueId, String head, String base)
          Create pull request by attaching branch information to an existing issue
 PullRequest createPullRequest(IRepositoryIdProvider repository, PullRequest request)
          Create pull request
protected  PagedRequest<PullRequest> createPullsRequest(IRepositoryIdProvider provider, String state, int start, int size)
          Create paged request for fetching pull requests
 void deleteComment(IRepositoryIdProvider repository, long commentId)
          Delete commit comment with given id
 CommitComment editComment(IRepositoryIdProvider repository, CommitComment comment)
          Edit pull request comment
 PullRequest editPullRequest(IRepositoryIdProvider repository, PullRequest request)
          Edit pull request
 CommitComment getComment(IRepositoryIdProvider repository, long commentId)
          Get commit comment with given id
 List<CommitComment> getComments(IRepositoryIdProvider repository, int id)
          Get all comments on commits in given pull request
 List<RepositoryCommit> getCommits(IRepositoryIdProvider repository, int id)
          Get all commits associated with given pull request id
 List<CommitFile> getFiles(IRepositoryIdProvider repository, int id)
          Get all changed files associated with given pull request id
 PullRequest getPullRequest(IRepositoryIdProvider repository, int id)
          Create request for single pull request
 List<PullRequest> getPullRequests(IRepositoryIdProvider repository, String state)
          Get pull requests from repository matching state
 boolean isMerged(IRepositoryIdProvider repository, int id)
          Is the given pull request id merged?
 MergeStatus merge(IRepositoryIdProvider repository, int id, String commitMessage)
          Merge given pull request
 PageIterator<CommitComment> pageComments(IRepositoryIdProvider repository, int id)
          Page pull request commit comments
 PageIterator<CommitComment> pageComments(IRepositoryIdProvider repository, int id, int size)
          Page pull request commit comments
 PageIterator<CommitComment> pageComments(IRepositoryIdProvider repository, int id, int start, int size)
          Page pull request commit comments
 PageIterator<PullRequest> pagePullRequests(IRepositoryIdProvider repository, String state)
          Page pull requests with given state
 PageIterator<PullRequest> pagePullRequests(IRepositoryIdProvider repository, String state, int size)
          Page pull requests with given state
 PageIterator<PullRequest> pagePullRequests(IRepositoryIdProvider repository, String state, int start, int size)
          Page pull requests with given state
 CommitComment replyToComment(IRepositoryIdProvider repository, int pullRequestId, int commentId, String body)
          Reply to given comment
 
Methods inherited from class org.eclipse.egit.github.core.service.GitHubService
check, createPagedRequest, createPagedRequest, createPageIterator, createRequest, getAll, getAll, getClient, getId, verifyRepository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PR_TITLE

public static final String PR_TITLE
PR_TITLE

See Also:
Constant Field Values

PR_BODY

public static final String PR_BODY
PR_BODY

See Also:
Constant Field Values

PR_BASE

public static final String PR_BASE
PR_BASE

See Also:
Constant Field Values

PR_HEAD

public static final String PR_HEAD
PR_HEAD

See Also:
Constant Field Values

PR_STATE

public static final String PR_STATE
PR_STATE

See Also:
Constant Field Values
Constructor Detail

PullRequestService

public PullRequestService()
Create pull request service


PullRequestService

public PullRequestService(GitHubClient client)
Create pull request service

Parameters:
client -
Method Detail

getPullRequest

public PullRequest getPullRequest(IRepositoryIdProvider repository,
                                  int id)
                           throws IOException
Create request for single pull request

Parameters:
repository -
id -
Returns:
request
Throws:
IOException

createPullsRequest

protected PagedRequest<PullRequest> createPullsRequest(IRepositoryIdProvider provider,
                                                       String state,
                                                       int start,
                                                       int size)
Create paged request for fetching pull requests

Parameters:
provider -
state -
start -
size -
Returns:
paged request

getPullRequests

public List<PullRequest> getPullRequests(IRepositoryIdProvider repository,
                                         String state)
                                  throws IOException
Get pull requests from repository matching state

Parameters:
repository -
state -
Returns:
list of pull requests
Throws:
IOException

pagePullRequests

public PageIterator<PullRequest> pagePullRequests(IRepositoryIdProvider repository,
                                                  String state)
Page pull requests with given state

Parameters:
repository -
state -
Returns:
iterator over pages of pull requests

pagePullRequests

public PageIterator<PullRequest> pagePullRequests(IRepositoryIdProvider repository,
                                                  String state,
                                                  int size)
Page pull requests with given state

Parameters:
repository -
state -
size -
Returns:
iterator over pages of pull requests

pagePullRequests

public PageIterator<PullRequest> pagePullRequests(IRepositoryIdProvider repository,
                                                  String state,
                                                  int start,
                                                  int size)
Page pull requests with given state

Parameters:
repository -
state -
start -
size -
Returns:
iterator over pages of pull requests

createPullRequest

public PullRequest createPullRequest(IRepositoryIdProvider repository,
                                     PullRequest request)
                              throws IOException
Create pull request

Parameters:
repository -
request -
Returns:
created pull request
Throws:
IOException

createPullRequest

public PullRequest createPullRequest(IRepositoryIdProvider repository,
                                     int issueId,
                                     String head,
                                     String base)
                              throws IOException
Create pull request by attaching branch information to an existing issue

Parameters:
repository -
issueId -
head -
base -
Returns:
created pull request
Throws:
IOException

editPullRequest

public PullRequest editPullRequest(IRepositoryIdProvider repository,
                                   PullRequest request)
                            throws IOException
Edit pull request

Parameters:
repository -
request -
Returns:
edited pull request
Throws:
IOException

getCommits

public List<RepositoryCommit> getCommits(IRepositoryIdProvider repository,
                                         int id)
                                  throws IOException
Get all commits associated with given pull request id

Parameters:
repository -
id -
Returns:
list of commits
Throws:
IOException

getFiles

public List<CommitFile> getFiles(IRepositoryIdProvider repository,
                                 int id)
                          throws IOException
Get all changed files associated with given pull request id

Parameters:
repository -
id -
Returns:
list of commit files
Throws:
IOException

isMerged

public boolean isMerged(IRepositoryIdProvider repository,
                        int id)
                 throws IOException
Is the given pull request id merged?

Parameters:
repository -
id -
Returns:
true if merge, false otherwise
Throws:
IOException

merge

public MergeStatus merge(IRepositoryIdProvider repository,
                         int id,
                         String commitMessage)
                  throws IOException
Merge given pull request

Parameters:
repository -
id -
commitMessage -
Returns:
status of merge
Throws:
IOException

getComments

public List<CommitComment> getComments(IRepositoryIdProvider repository,
                                       int id)
                                throws IOException
Get all comments on commits in given pull request

Parameters:
repository -
id -
Returns:
non-null list of comments
Throws:
IOException

pageComments

public PageIterator<CommitComment> pageComments(IRepositoryIdProvider repository,
                                                int id)
Page pull request commit comments

Parameters:
repository -
id -
Returns:
iterator over pages of commit comments

pageComments

public PageIterator<CommitComment> pageComments(IRepositoryIdProvider repository,
                                                int id,
                                                int size)
Page pull request commit comments

Parameters:
repository -
id -
size -
Returns:
iterator over pages of commit comments

pageComments

public PageIterator<CommitComment> pageComments(IRepositoryIdProvider repository,
                                                int id,
                                                int start,
                                                int size)
Page pull request commit comments

Parameters:
repository -
id -
start -
size -
Returns:
iterator over pages of commit comments

getComment

public CommitComment getComment(IRepositoryIdProvider repository,
                                long commentId)
                         throws IOException
Get commit comment with given id

Parameters:
repository -
commentId -
Returns:
commit comment
Throws:
IOException

createComment

public CommitComment createComment(IRepositoryIdProvider repository,
                                   int id,
                                   CommitComment comment)
                            throws IOException
Create comment on given pull request

Parameters:
repository -
id -
comment -
Returns:
created commit comment
Throws:
IOException

replyToComment

public CommitComment replyToComment(IRepositoryIdProvider repository,
                                    int pullRequestId,
                                    int commentId,
                                    String body)
                             throws IOException
Reply to given comment

Parameters:
repository -
pullRequestId -
commentId -
body -
Returns:
created comment
Throws:
IOException

editComment

public CommitComment editComment(IRepositoryIdProvider repository,
                                 CommitComment comment)
                          throws IOException
Edit pull request comment

Parameters:
repository -
comment -
Returns:
edited comment
Throws:
IOException

deleteComment

public void deleteComment(IRepositoryIdProvider repository,
                          long commentId)
                   throws IOException
Delete commit comment with given id

Parameters:
repository -
commentId -
Throws:
IOException


Copyright © 2012. All Rights Reserved.