Package org.kohsuke.github
Class GitHubRequest
- java.lang.Object
-
- org.kohsuke.github.GitHubRequest
-
- All Implemented Interfaces:
GitHubConnectorRequest
public class GitHubRequest extends Object implements GitHubConnectorRequest
ClassGitHubRequest
represents an immutable instance used by the client to determine what information to retrieve from a GitHub server. Use theGitHubRequest.Builder
to construct aGitHubRequest
.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
GitHubRequest.Entry
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,List<String>>
allHeaders()
The headers for this request.String
apiUrl()
The base GitHub API URL for this request represented as aString
List<GitHubRequest.Entry>
args()
The arguments for this request.InputStream
body()
TheInputStream
to be sent as the body of this request.String
contentType()
The content type to to be sent by this request.boolean
hasBody()
Whether arguments for this request should be included in the URL or in the body of the request.String
header(String name)
Gets the first value of a header field for this request.Map<String,Object>
injectedMappingValues()
The headers for this request.String
method()
The method for this request, such as "GET", "PATCH", or "DELETE".RateLimitTarget
rateLimitTarget()
The rate limit target for this request.URL
url()
TheURL
for this request.String
urlPath()
The url path to be added to theapiUrl()
for this request.
-
-
-
Method Detail
-
method
@Nonnull public String method()
The method for this request, such as "GET", "PATCH", or "DELETE".- Specified by:
method
in interfaceGitHubConnectorRequest
- 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
@Nonnull public List<GitHubRequest.Entry> args()
The arguments for this request. Depending on themethod()
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 interfaceGitHubConnectorRequest
- 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 interfaceGitHubConnectorRequest
- 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 aString
- Returns:
- the url string
-
urlPath
@Nonnull public String urlPath()
The url path to be added to theapiUrl()
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 to be sent by this request.- Specified by:
contentType
in interfaceGitHubConnectorRequest
- Returns:
- the content type.
-
body
@CheckForNull public InputStream body()
TheInputStream
to be sent as the body of this request.- Specified by:
body
in interfaceGitHubConnectorRequest
- Returns:
- the
InputStream
.
-
url
@Nonnull public URL url()
TheURL
for this request. This is the actual URL theGitHubClient
will send this request to.- Specified by:
url
in interfaceGitHubConnectorRequest
- 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 interfaceGitHubConnectorRequest
- Returns:
- true if the arguements should be sent in the body of the request.
-
-