Class GitHubSCMSourceRequest

java.lang.Object
jenkins.scm.api.trait.SCMSourceRequest
org.jenkinsci.plugins.github_branch_source.GitHubSCMSourceRequest
All Implemented Interfaces:
Closeable, AutoCloseable

public class GitHubSCMSourceRequest extends jenkins.scm.api.trait.SCMSourceRequest
The SCMSourceRequest for GitHub.
Since:
2.2.0
  • Nested Class Summary

    Nested classes/interfaces inherited from class jenkins.scm.api.trait.SCMSourceRequest

    jenkins.scm.api.trait.SCMSourceRequest.IntermediateLambda<I extends Object>, jenkins.scm.api.trait.SCMSourceRequest.LazyRevisionLambda<H extends jenkins.scm.api.SCMHead,R extends jenkins.scm.api.SCMRevision,I extends Object>, jenkins.scm.api.trait.SCMSourceRequest.ProbeLambda<H extends jenkins.scm.api.SCMHead,I extends Object>, jenkins.scm.api.trait.SCMSourceRequest.RevisionLambda<H extends jenkins.scm.api.SCMHead,R extends jenkins.scm.api.SCMRevision>, jenkins.scm.api.trait.SCMSourceRequest.Witness<H extends jenkins.scm.api.SCMHead,R extends jenkins.scm.api.SCMRevision>
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    Deprecated.
    rate limit checking is done automatically
    void
    final Iterable<org.kohsuke.github.GHBranch>
    Returns the branch details or an empty list if either the request did not specify to isFetchBranches() or if the branch details have not been provided by setBranches(Iterable) yet.
    final Set<String>
    Returns the names of the repository collaborators or null if those details have not been provided yet.
    final Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy>
    Returns the ChangeRequestCheckoutStrategy to create for each fork pull request.
    org.kohsuke.github.GitHub
    Returns the GitHub API connector to use for the request.
    final Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy>
    Returns the ChangeRequestCheckoutStrategy to create for each origin pull request.
    org.kohsuke.github.GHPermissionType
    Returns the permissions of the supplied user.
    Returns the permission source.
    final Map<Boolean,Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy>>
    Returns the ChangeRequestCheckoutStrategy to create for each pull request.
    final Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy>
    getPRStrategies(boolean fork)
    Returns the ChangeRequestCheckoutStrategy to create for pull requests of the specified type.
    Iterable<org.kohsuke.github.GHPullRequest>
    Returns the pull request details or an empty list if either the request did not specify to isFetchPRs() or if the pull request details have not been provided by setPullRequests(Iterable) yet.
    org.kohsuke.github.GHRepository
    Returns the GHRepository.
    final Set<String>
    Gets requested origin branch names.
    final Set<Integer>
    Returns requested pull request numbers.
    final Set<String>
    Gets requested tag names.
    final Iterable<org.kohsuke.github.GHRef>
    Returns the branch details or an empty list if either the request did not specify to isFetchBranches() or if the branch details have not been provided by setBranches(Iterable) yet.
    final boolean
    Returns true if branch details need to be fetched.
    final boolean
    Returns true if fork pull request details need to be fetched.
    final boolean
    Returns true if origin pull request details need to be fetched.
    final boolean
    Returns true if pull request details need to be fetched.
    final boolean
    Returns true if tag details need to be fetched.
    final void
    setBranches(Iterable<org.kohsuke.github.GHBranch> branches)
    Provides the requests with the branch details.
    final void
    setCollaboratorNames(Set<String> collaboratorNames)
    Provides the request with the names of the repository collaborators.
    void
    setGitHub(org.kohsuke.github.GitHub gitHub)
    Provides the GitHub API connector to use for the request.
    void
    Sets the permission source.
    void
    setPullRequests(Iterable<org.kohsuke.github.GHPullRequest> pullRequests)
    Provides the requests with the pull request details.
    void
    setRepository(org.kohsuke.github.GHRepository repository)
    Sets the GHRepository.
    final void
    setTags(Iterable<org.kohsuke.github.GHRef> tags)
    Provides the requests with the tag details.

    Methods inherited from class jenkins.scm.api.trait.SCMSourceRequest

    getCriteria, isComplete, isExcluded, isTrusted, listener, manage, process, process, process

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isFetchBranches

      public final boolean isFetchBranches()
      Returns true if branch details need to be fetched.
      Returns:
      true if branch details need to be fetched.
    • isFetchTags

      public final boolean isFetchTags()
      Returns true if tag details need to be fetched.
      Returns:
      true if tag details need to be fetched.
    • isFetchPRs

      public final boolean isFetchPRs()
      Returns true if pull request details need to be fetched.
      Returns:
      true if pull request details need to be fetched.
    • isFetchOriginPRs

      public final boolean isFetchOriginPRs()
      Returns true if origin pull request details need to be fetched.
      Returns:
      true if origin pull request details need to be fetched.
    • isFetchForkPRs

      public final boolean isFetchForkPRs()
      Returns true if fork pull request details need to be fetched.
      Returns:
      true if fork pull request details need to be fetched.
    • getOriginPRStrategies

      @NonNull public final Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy> getOriginPRStrategies()
      Returns the ChangeRequestCheckoutStrategy to create for each origin pull request.
      Returns:
      the ChangeRequestCheckoutStrategy to create for each origin pull request.
    • getForkPRStrategies

      @NonNull public final Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy> getForkPRStrategies()
      Returns the ChangeRequestCheckoutStrategy to create for each fork pull request.
      Returns:
      the ChangeRequestCheckoutStrategy to create for each fork pull request.
    • getPRStrategies

      @NonNull public final Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy> getPRStrategies(boolean fork)
      Returns the ChangeRequestCheckoutStrategy to create for pull requests of the specified type.
      Parameters:
      fork - true to return strategies for the fork pull requests, false for origin pull requests.
      Returns:
      the ChangeRequestCheckoutStrategy to create for each pull request.
    • getPRStrategies

      public final Map<Boolean,Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy>> getPRStrategies()
      Returns the ChangeRequestCheckoutStrategy to create for each pull request.
      Returns:
      a map of the ChangeRequestCheckoutStrategy to create for each pull request keyed by whether the strategy applies to forks or not (Boolean.FALSE is the key for origin pull requests)
    • getRequestedPullRequestNumbers

      @CheckForNull public final Set<Integer> getRequestedPullRequestNumbers()
      Returns requested pull request numbers.
      Returns:
      the requested pull request numbers or null if the request was not scoped to a subset of pull requests.
    • getRequestedOriginBranchNames

      @CheckForNull public final Set<String> getRequestedOriginBranchNames()
      Gets requested origin branch names.
      Returns:
      the requested origin branch names or null if the request was not scoped to a subset of branches.
    • getRequestedTagNames

      @CheckForNull public final Set<String> getRequestedTagNames()
      Gets requested tag names.
      Returns:
      the requested tag names or null if the request was not scoped to a subset of tags.
    • setPullRequests

      public void setPullRequests(@CheckForNull Iterable<org.kohsuke.github.GHPullRequest> pullRequests)
      Provides the requests with the pull request details.
      Parameters:
      pullRequests - the pull request details.
    • getPullRequests

      @NonNull public Iterable<org.kohsuke.github.GHPullRequest> getPullRequests()
      Returns the pull request details or an empty list if either the request did not specify to isFetchPRs() or if the pull request details have not been provided by setPullRequests(Iterable) yet.
      Returns:
      the details of pull requests, may be limited by getRequestedPullRequestNumbers() or may be empty if not isFetchPRs()
    • setBranches

      public final void setBranches(@CheckForNull Iterable<org.kohsuke.github.GHBranch> branches)
      Provides the requests with the branch details.
      Parameters:
      branches - the branch details.
    • getBranches

      @NonNull public final Iterable<org.kohsuke.github.GHBranch> getBranches()
      Returns the branch details or an empty list if either the request did not specify to isFetchBranches() or if the branch details have not been provided by setBranches(Iterable) yet.
      Returns:
      the branch details (may be empty)
    • setTags

      public final void setTags(@CheckForNull Iterable<org.kohsuke.github.GHRef> tags)
      Provides the requests with the tag details.
      Parameters:
      tags - the tag details.
    • getTags

      @NonNull public final Iterable<org.kohsuke.github.GHRef> getTags()
      Returns the branch details or an empty list if either the request did not specify to isFetchBranches() or if the branch details have not been provided by setBranches(Iterable) yet.
      Returns:
      the branch details (may be empty)
    • setCollaboratorNames

      public final void setCollaboratorNames(@CheckForNull Set<String> collaboratorNames)
      Provides the request with the names of the repository collaborators.
      Parameters:
      collaboratorNames - the names of the repository collaborators.
    • getCollaboratorNames

      public final Set<String> getCollaboratorNames()
      Returns the names of the repository collaborators or null if those details have not been provided yet.
      Returns:
      the names of the repository collaborators or null if those details have not been provided yet.
    • checkApiRateLimit

      @Deprecated public final void checkApiRateLimit() throws IOException, InterruptedException
      Deprecated.
      rate limit checking is done automatically
      Checks the API rate limit and sleeps if over-used until the remaining limit is on-target for expected usage.
      Throws:
      IOException - if the rate limit could not be obtained.
      InterruptedException - if interrupted while waiting.
    • getGitHub

      @CheckForNull public org.kohsuke.github.GitHub getGitHub()
      Returns the GitHub API connector to use for the request.
      Returns:
      the GitHub API connector to use for the request or null if caller should establish their own.
    • setGitHub

      public void setGitHub(@CheckForNull org.kohsuke.github.GitHub gitHub)
      Provides the GitHub API connector to use for the request.
      Parameters:
      gitHub - GitHub API connector to use for the request.
    • getRepository

      public org.kohsuke.github.GHRepository getRepository()
      Returns the GHRepository.
      Returns:
      the GHRepository.
    • setRepository

      public void setRepository(org.kohsuke.github.GHRepository repository)
      Sets the GHRepository.
      Parameters:
      repository - the GHRepository.
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class jenkins.scm.api.trait.SCMSourceRequest
      Throws:
      IOException
    • getPermissions

      public org.kohsuke.github.GHPermissionType getPermissions(String username) throws IOException, InterruptedException
      Returns the permissions of the supplied user.
      Parameters:
      username - the user.
      Returns:
      the permissions of the supplied user.
      Throws:
      IOException - if the permissions could not be retrieved.
      InterruptedException - if interrupted while retrieving the permissions.
    • getPermissionsSource

      @CheckForNull public GitHubPermissionsSource getPermissionsSource()
      Returns the permission source.
      Returns:
      the permission source.
    • setPermissionsSource

      public void setPermissionsSource(@CheckForNull GitHubPermissionsSource permissionsSource)
      Sets the permission source.
      Parameters:
      permissionsSource - the permission source.