Class OkHttpGitHubConnector
- java.lang.Object
-
- org.kohsuke.github.extras.okhttp3.OkHttpGitHubConnector
-
- All Implemented Interfaces:
GitHubConnector
public class OkHttpGitHubConnector extends Object implements GitHubConnector
GitHubConnectorforOkHttpClient.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
Constructors Constructor Description OkHttpGitHubConnector(okhttp3.OkHttpClient client)Instantiates a new Ok http connector.OkHttpGitHubConnector(okhttp3.OkHttpClient client, int cacheMaxAge)Instantiates a new Ok http connector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GitHubConnectorResponsesend(GitHubConnectorRequest request)Sends a request and retrieves a raw response for processing.
-
-
-
Constructor Detail
-
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 Detail
-
send
public GitHubConnectorResponse send(GitHubConnectorRequest request) throws IOException
Description copied from interface:GitHubConnectorSends a request and retrieves a raw response for processing. Implementers ofGitHubConnector.send(GitHubConnectorRequest)process the information from aGitHubConnectorRequestto open an HTTP connection and retrieve a raw response. They then return a class that extendsGitHubConnectorResponsecorresponding their response data. Clients should not implement their ownGitHubConnectorRequest. TheGitHubConnectorRequestprovided by the caller ofGitHubConnector.send(GitHubConnectorRequest)should be passed to the constructor ofGitHubConnectorResponse.- Specified by:
sendin interfaceGitHubConnector- Parameters:
request- the request data to be sent.- Returns:
- a GitHubConnectorResponse for the request
- Throws:
IOException- if there is an I/O error
-
-