Interface PullRequestProvider
-
public interface PullRequestProvider
Provides pull request information for some specific VCS hosting type
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
PullRequestProvider.UntrustedPullRequestDescription
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
checkAuthData()
Checks if the provider has adequate authentication datavoid
clearProblems()
Clears all system problems for this provider(for build type and pull request feature)PullRequest
deserializePullRequest(String data)
Creates a pull request info object from JSON internally used to cache pull requestsPullRequest
fetchPullRequest(PullRequest pullRequest)
Fetches a single pull request from a third party system (VCS hosting)boolean
fetchPullRequests(Duration maxAge, Integer maxPageNumber, Consumer<Collection<PullRequest>> consumer)
Fetches pull requests from a third party system (VCS hosting) in a batch.PullRequest
getBlankPullRequest(String branchName)
Creates a blank pull request object containing just a pull request id if it is possible to deduce it based on the branch name providedString
getBranchMetaInfoId(String branchName)
String
getBranchMetaInfoIdPrefix()
Global ids for PRs from each VCS root have specific prefix, that allows to distinguish them from all the othersString
getSourceId()
String
getType()
Returns VCS hosting type that is served by the provider (e.g.PullRequestProvider.UntrustedPullRequestDescription
getUntrustedPullRequestDescription(PullRequest pullRequest, VcsRootInstance vcsRootInstance, SBuildType buildType)
SVcsRoot
getVcsRoot()
Returns VCS root that is used to supply pull request informationboolean
isBranchNameBased()
Determines if the provider can detect if a branch name matches some pull-request specific pattern, and therefore a blank pull request object can be created based on the branch name alone.boolean
isLastUpdatedSupported()
Boolean
isRepositoryPublic()
Implemented not for all providers.boolean
matchAttributes(PullRequest pr, VcsRootInstance vcsRootInstance, Map<String,String> attributes)
default void
postUpdatedAction(PullRequest pullRequest)
void
testConnection()
Tests connection
-
-
-
Method Detail
-
getType
String getType()
Returns VCS hosting type that is served by the provider (e.g. "github")- Returns:
- see above
-
getVcsRoot
SVcsRoot getVcsRoot()
Returns VCS root that is used to supply pull request information- Returns:
- see above
-
isBranchNameBased
boolean isBranchNameBased()
Determines if the provider can detect if a branch name matches some pull-request specific pattern, and therefore a blank pull request object can be created based on the branch name alone.- Returns:
- true if the provider can detect pull request branch names, false otherwise
-
getBlankPullRequest
@Nullable PullRequest getBlankPullRequest(@NotNull String branchName)
Creates a blank pull request object containing just a pull request id if it is possible to deduce it based on the branch name provided- Parameters:
branchName
- VCS branch name- Returns:
- blank PR object if VCS branch name contains the PR id, null otherwise
-
fetchPullRequest
@Nullable PullRequest fetchPullRequest(@NotNull PullRequest pullRequest)
Fetches a single pull request from a third party system (VCS hosting)- Parameters:
pullRequest
- VCS branch name- Returns:
- PR info (either complete or incomplete) if the branch name matches hosting provider specific PR pattern, null otherwise
-
clearProblems
void clearProblems()
Clears all system problems for this provider(for build type and pull request feature)
-
fetchPullRequests
boolean fetchPullRequests(@Nullable Duration maxAge, @Nullable Integer maxPageNumber, @NotNull Consumer<Collection<PullRequest>> consumer)
Fetches pull requests from a third party system (VCS hosting) in a batch. The method will fetch pull request in a reverse updated time order and will stop when all PRs updated within maxAge are fetched.- Parameters:
maxAge
- if not null, only the requests that were updated within the duration of time from now will be fetchedmaxPageNumber
- - max number of pages to retrieve, null meaning "as many as practically possible" and must be implemented in a provider-specific wayconsumer
- PR requests info consumer- Returns:
- true if all requested PRs were fetched, false otherwise
-
getBranchMetaInfoIdPrefix
@NotNull String getBranchMetaInfoIdPrefix()
Global ids for PRs from each VCS root have specific prefix, that allows to distinguish them from all the others- Returns:
- see above
-
deserializePullRequest
@NotNull PullRequest deserializePullRequest(@NotNull String data)
Creates a pull request info object from JSON internally used to cache pull requests- Parameters:
data
- pull request info in JSON- Returns:
- see above
-
testConnection
void testConnection() throws PullRequestRetrievalException
Tests connection- Throws:
PullRequestRetrievalException
- if any errors detected
-
checkAuthData
void checkAuthData() throws PullRequestRetrievalException
Checks if the provider has adequate authentication data- Throws:
PullRequestRetrievalException
- if no adequate authentication data is found
-
getSourceId
@NotNull String getSourceId()
-
postUpdatedAction
default void postUpdatedAction(PullRequest pullRequest)
-
isLastUpdatedSupported
boolean isLastUpdatedSupported()
- Returns:
- true if the respective VCS hosting reports last updated timestamp and can return pull requests in the descendant order of it
-
getUntrustedPullRequestDescription
@Nullable PullRequestProvider.UntrustedPullRequestDescription getUntrustedPullRequestDescription(@NotNull PullRequest pullRequest, @NotNull VcsRootInstance vcsRootInstance, @NotNull SBuildType buildType)
- Returns:
- if pull request is untrusted returns the reason description, otherwise returns null
-
isRepositoryPublic
@Nullable Boolean isRepositoryPublic() throws IOException
Implemented not for all providers. If not implemented returns null- Throws:
IOException
-
matchAttributes
boolean matchAttributes(@NotNull PullRequest pr, @NotNull VcsRootInstance vcsRootInstance, @NotNull Map<String,String> attributes)
- Returns:
- true if pull request matches all the given attributes
- Since:
- 2024.3
-
-