Class 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 Detail

      • rateLimitTarget

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

        @Nonnull
        public List<GitHubRequest.Entry> 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
      • 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
      • 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 arguements should be sent in the body of the request.