Class GitHubRequest

java.lang.Object
org.kohsuke.github.GitHubRequest
All Implemented Interfaces:
GitHubConnectorRequest

public class GitHubRequest extends Object implements GitHubConnectorRequest
Class GitHubRequest represents an immutable instance used by the client to determine what information to retrieve from a GitHub server. Use the GitHubRequest.Builder to construct a GitHubRequest.

NOTE: GitHubRequest should include the data type to be returned. Any use cases where the same request should be used to return different types of data could be handled in some other way. However, the return type is currently not specified until late in the building process, so this is still untyped.

Author:
Liam Newman
  • Method Details

    • method

      @Nonnull public String method()
      The method for this request, such as "GET", "PATCH", or "DELETE".
      Specified by:
      method in interface GitHubConnectorRequest
      Returns:
      the request method.
    • rateLimitTarget

      @Nonnull public RateLimitTarget rateLimitTarget()
      The rate limit target for this request.
      Returns:
      the rate limit to use for this request.
    • args

      The arguments for this request. Depending on the method() and #inBody() these maybe added to the url or to the request body.
      Returns:
      the list of arguments
    • allHeaders

      @Nonnull public Map<String,List<String>> allHeaders()
      The headers for this request.
      Specified by:
      allHeaders in interface GitHubConnectorRequest
      Returns:
      the Map of headers
    • header

      @CheckForNull public String header(String name)
      Gets the first value of a header field for this request.
      Specified by:
      header in interface GitHubConnectorRequest
      Parameters:
      name - the name of the header field.
      Returns:
      the value of the header field, or null if the header isn't set.
    • injectedMappingValues

      @Nonnull public Map<String,Object> injectedMappingValues()
      The headers for this request.
      Returns:
      the Map of headers
    • apiUrl

      @Nonnull public String apiUrl()
      The base GitHub API URL for this request represented as a String.
      Returns:
      the url string
    • urlPath

      @Nonnull public String urlPath()
      The url path to be added to the apiUrl() for this request. If this does not start with a "/", it instead represents the full url string for this request.
      Returns:
      a url path or full url string
    • contentType

      public String contentType()
      The content type to be sent by this request.
      Specified by:
      contentType in interface GitHubConnectorRequest
      Returns:
      the content type.
    • body

      @CheckForNull public InputStream body()
      The InputStream to be sent as the body of this request.
      Specified by:
      body in interface GitHubConnectorRequest
      Returns:
      the InputStream.
    • url

      @Nonnull public URL url()
      The URL for this request. This is the actual URL the GitHubClient will send this request to.
      Specified by:
      url in interface GitHubConnectorRequest
      Returns:
      the request URL
    • hasBody

      public boolean hasBody()
      Whether arguments for this request should be included in the URL or in the body of the request.
      Specified by:
      hasBody in interface GitHubConnectorRequest
      Returns:
      true if the arguments should be sent in the body of the request.