Interface PullRequestProvider


  • public interface PullRequestProvider
    Provides pull request information for some specific VCS hosting type
    • 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 fetched
        maxPageNumber - - max number of pages to retrieve, null meaning "as many as practically possible" and must be implemented in a provider-specific way
        consumer - 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
      • getBranchMetaInfoId

        @Nullable
        String getBranchMetaInfoId​(@NotNull
                                   String branchName)
      • 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
      • 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
      • 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