java.lang.Object
org.kohsuke.github.extras.okhttp3.OkHttpGitHubConnector
- All Implemented Interfaces:
GitHubConnector
GitHubConnector
for OkHttpClient
.
Unlike GitHubConnector.DEFAULT
, OkHttp supports response caching. Making a conditional request against GitHub API and
receiving a 304 response does not count against the rate limit. See
http://developer.github.com/v3/#conditional-requests
- Author:
- Liam Newman
-
Field Summary
Fields inherited from interface org.kohsuke.github.connector.GitHubConnector
DEFAULT, OFFLINE
-
Constructor Summary
ConstructorDescriptionOkHttpGitHubConnector
(okhttp3.OkHttpClient client) Instantiates a new Ok http connector.OkHttpGitHubConnector
(okhttp3.OkHttpClient client, int cacheMaxAge) Instantiates a new Ok http connector. -
Method Summary
Modifier and TypeMethodDescriptionsend
(GitHubConnectorRequest request) Sends a request and retrieves a raw response for processing.
-
Constructor Details
-
OkHttpGitHubConnector
public OkHttpGitHubConnector(okhttp3.OkHttpClient client) Instantiates a new Ok http connector.- Parameters:
client
- the client
-
OkHttpGitHubConnector
public OkHttpGitHubConnector(okhttp3.OkHttpClient client, int cacheMaxAge) Instantiates a new Ok http connector.- Parameters:
client
- the clientcacheMaxAge
- the cache max age
-
-
Method Details
-
send
Description copied from interface:GitHubConnector
Sends a request and retrieves a raw response for processing. Implementers ofGitHubConnector.send(GitHubConnectorRequest)
process the information from aGitHubConnectorRequest
to open an HTTP connection and retrieve a raw response. They then return a class that extendsGitHubConnectorResponse
corresponding their response data. Clients should not implement their ownGitHubConnectorRequest
. TheGitHubConnectorRequest
provided by the caller ofGitHubConnector.send(GitHubConnectorRequest)
should be passed to the constructor ofGitHubConnectorResponse
.- Specified by:
send
in interfaceGitHubConnector
- Parameters:
request
- the request data to be sent.- Returns:
- a GitHubConnectorResponse for the request
- Throws:
IOException
- if there is an I/O error
-