use of org.kohsuke.github.GitHubBuilder in project blueocean-plugin by jenkinsci.
the class GitHubFactory method connect.
/**
* Connect to github with the correct limit handlers
* @param accessToken to authorize
* @param endpointUri endpoint to connect to
* @return GitHub
* @throws IOException if GitHub could not be constructed
*/
public static GitHub connect(String accessToken, String endpointUri) throws IOException {
URL apiUrl = new URL(endpointUri);
ProxyConfiguration proxyConfig = Jenkins.getInstance().proxy;
Proxy proxy = proxyConfig == null ? Proxy.NO_PROXY : proxyConfig.createProxy(apiUrl.getHost());
return new GitHubBuilder().withOAuthToken(accessToken).withRateLimitHandler(RateLimitHandlerImpl.INSTANCE).withAbuseLimitHandler(AbuseLimitHandlerImpl.INSTANCE).withProxy(proxy).withEndpoint(endpointUri).build();
}
Aggregations