public interface RepositoryService
| Modifier and Type | Method and Description |
|---|---|
void |
addCommentToPullRequest(PullRequest pullRequest,
String comment)
Add a
Comment to the specified PullRequest object, and propagate the changes
to the remote repository. |
void |
addLabelToPullRequest(PullRequest pullRequest,
String labelName)
Attach a label to the specified pull request.
|
default void |
destroy()
allows to destroy and deallocate resources
|
List<PullRequest> |
findPullRequestsRelatedTo(PullRequest pullRequest)
Find all the pull requests related to the given pull request.
|
CommitStatus |
getCommitStatusFromPullRequest(PullRequest pullRequest)
Retrieve the current CI status of the latest commit associated with a given pull request.
|
List<Label> |
getLabelsFromPullRequest(PullRequest pullRequest)
Retrieve all labels associated with the provided
PullRequest object. |
List<Label> |
getLabelsFromRepository(Repository repository)
Retrieve all labels associated with the provided
PullRequest in Repository object. |
PullRequest |
getPullRequest(URL url)
Get the
PullRequest located at the provided URL. |
List<PullRequest> |
getPullRequestsAssociatedWith(Issue issue)
Retrieve all pull requests associated with the provided
Issue object |
List<PullRequest> |
getPullRequestsByState(Repository repository,
PullRequestState state)
Retrieve all pull requests associated with the provided
Repository object, which have a
state that matches the provided PullRequestState object. |
RateLimit |
getRateLimit() |
Repository |
getRepository(URL url)
Get the repository located at the provided
URL. |
RepositoryType |
getRepositoryType()
Get Repository type
|
boolean |
hasModifiableLabels(Repository repository)
Discover if the user logged into this
RepositoryService has the correct permissions to apply/remove
labels to pull request in the provided Repository |
boolean |
init(AphroditeConfig config)
Initiate this
RepositoryService using the supplied AphroditeConfig. |
boolean |
init(RepositoryConfig config)
Initiate this
RepositoryService using the supplied RepositoryConfig. |
void |
removeLabelFromPullRequest(PullRequest pullRequest,
String name)
Delete a label from the provided
PullRequest object. |
boolean |
repositoryAccessable(URL url)
Checks whether the provided
URL is accessable. |
void |
setLabelsToPullRequest(PullRequest pullRequest,
List<Label> labels)
Set the labels for the provided
PullRequest object. |
boolean |
urlExists(URL url)
Checks whether the provided
URL is on the same host as this service. |
boolean init(AphroditeConfig config)
RepositoryService using the supplied AphroditeConfig.
The first RepositoryConfig object found in AphroditeConfig object,
is used to initiate the service and is subsequently removed from the config to prevent the same
service being initiated twice.config - a AphroditeConfig object containing at least one
RepositoryConfig object.true if the service was initialised without errors, false otherwise.IllegalArgumentException - if no RepositoryConfig objects are present.boolean init(RepositoryConfig config)
RepositoryService using the supplied RepositoryConfig.config - a RepositoryConfig object containing all configuration information.true if the service was initialised without errors, false otherwise.boolean urlExists(URL url)
URL is on the same host as this service.url - the URL to check.URL has the same host as this service, otherwise false.NullPointerException - if the provided URL is null.boolean repositoryAccessable(URL url)
URL is accessable.url - the URL to check.URL is accessable, otherwise false.Repository getRepository(URL url) throws NotFoundException
URL.url - the URL of the repository to be retrieved.Repository object.NotFoundException - if a Repository cannot be found at the provided base url.PullRequest getPullRequest(URL url) throws NotFoundException
PullRequest located at the provided URL.url - the URL of the pull request to be retrieved.PullRequest object.NotFoundException - if a PullRequest cannot be found at the provided base url.List<PullRequest> getPullRequestsAssociatedWith(Issue issue) throws NotFoundException
Issue objectissue - the Issue object whose associated pull requests should be returned.PullRequest objects, or an empty list if no pull request can be found.NotFoundException - if an exception is thrown when searching the RepositoryService.List<PullRequest> getPullRequestsByState(Repository repository, PullRequestState state) throws NotFoundException
Repository object, which have a
state that matches the provided PullRequestState object.repository - the Repository object whose associated pull requests should be returned.state - the PullRequestsState which the returned PullRequest objects must have.PullRequest objects, or an empty list if no pull request can be found.NotFoundException - if the provided Repository cannot be found at the RepositoryService.List<Label> getLabelsFromRepository(Repository repository) throws NotFoundException
PullRequest in Repository object.repository - the Repository object whose associated labels should be returned.Label objects, or an empty list if no label can be found.NotFoundException - if the provided Repository url not consistent with the baseURL.List<Label> getLabelsFromPullRequest(PullRequest pullRequest) throws NotFoundException
PullRequest object.pullRequest - the PullRequest object whose associated labels should be returned.Label objects, or an empty list if no pull request can be found.NotFoundException - if the provided PullRequest url not consistent with the baseURL.boolean hasModifiableLabels(Repository repository) throws NotFoundException
RepositoryService has the correct permissions to apply/remove
labels to pull request in the provided Repositoryrepository - the Repository whose permissions are to be checkedNotFoundException - if the specified Repository cannot be found.void setLabelsToPullRequest(PullRequest pullRequest, List<Label> labels) throws NotFoundException, AphroditeException
PullRequest object.pullRequset - the PullRequest object whose will be set.labels - the Label apply to the PullRequestNotFoundException - if the Label can not be found in the provided PullRequestAphroditeException - if add the Label is not consistent with get labelsvoid removeLabelFromPullRequest(PullRequest pullRequest, String name) throws NotFoundException
PullRequest object.pullRequest - the PullRequest whose label will be removed.name - the Label name will be removed.NotFoundException - if the Label name can not be found in the provided PullRequestvoid addCommentToPullRequest(PullRequest pullRequest, String comment) throws NotFoundException
Comment to the specified PullRequest object, and propagate the changes
to the remote repository.pullRequest - the PullRequest on which the comment will be made.comment - the new Comment.NotFoundException - if the PullRequest cannot be found at the remote repository.void addLabelToPullRequest(PullRequest pullRequest, String labelName) throws NotFoundException
NotFoundException will be thrown. If the specified label is already
associated with the provided pull request then no further action is taken.pullRequest - the PullRequest to which the label will be applied.labelName - the name of the label to be applied.NotFoundException - if the specified labelName has not been defined at the remote repository.List<PullRequest> findPullRequestsRelatedTo(PullRequest pullRequest)
pullRequest - the PullRequest on which pull requests related are being searchedCommitStatus getCommitStatusFromPullRequest(PullRequest pullRequest) throws NotFoundException
pullRequest - the PullRequest object whose status is to be queriedNotFoundException - if no commit status can be found for the provided pull requestdefault void destroy()
RateLimit getRateLimit() throws NotFoundException
NotFoundExceptionRepositoryType getRepositoryType()
Copyright © 2017 JBoss by Red Hat. All rights reserved.