Class AbstractBitbucketApi
java.lang.Object
com.cloudbees.jenkins.plugins.bitbucket.impl.client.AbstractBitbucketApi
- All Implemented Interfaces:
BitbucketApi
,AutoCloseable
- Direct Known Subclasses:
BitbucketCloudApiClient
,BitbucketServerAPIClient
@Restricted(org.kohsuke.accmod.restrictions.ProtectedExternally.class)
public abstract class AbstractBitbucketApi
extends Object
implements BitbucketApi, AutoCloseable
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractBitbucketApi
(BitbucketAuthenticator authenticator) -
Method Summary
Modifier and TypeMethodDescription<T> T
Adapt this implementation to the given class.protected BitbucketRequestException
buildResponseException
(org.apache.hc.core5.http.ClassicHttpResponse response, String errorMessage) void
close()
protected static org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder
protected String
deleteRequest
(String path) protected org.apache.hc.core5.http.ClassicHttpResponse
executeMethod
(org.apache.hc.client5.http.classic.methods.HttpUriRequest request) protected BitbucketAuthenticator
protected abstract String
protected abstract org.apache.hc.client5.http.impl.classic.CloseableHttpClient
protected abstract org.apache.hc.client5.http.io.HttpClientConnectionManager
protected abstract org.apache.hc.core5.http.HttpHost
getHost()
protected String
getRequest
(String path) protected InputStream
protected String
getResponseContent
(org.apache.hc.core5.http.ClassicHttpResponse response) List<? extends BitbucketWebHook>
Returns the webhooks defined in the repository.protected int
headRequestStatus
(String path) protected abstract boolean
isSupportedAuthenticator
(BitbucketAuthenticator authenticator) Implementation must validate if the configured authenticator is supported by this client implementation.protected String
postRequest
(String path, String content) protected String
postRequest
(String path, List<? extends org.apache.hc.core5.http.NameValuePair> params) protected String
putRequest
(String path, String content) void
Register a webhook on the repository.void
Remove the webhook (ID field required) from the repository.protected void
setClientProxyParams
(org.apache.hc.client5.http.impl.classic.HttpClientBuilder builder) protected org.apache.hc.client5.http.impl.classic.HttpClientBuilder
void
Update a webhook on the repository.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketApi
checkPathExists, getAvatar, getBranch, getBranches, getCommits, getDefaultBranch, getDirectoryContent, getFile, getFileContent, getOwner, getPullRequestById, getPullRequests, getRepositories, getRepositories, getRepository, getRepositoryName, getTag, getTags, getTeam, getTeamAvatar, isPrivate, postBuildStatus, postCommitComment, resolveCommit, resolveCommit, resolveSourceFullHash
-
Field Details
-
logger
-
-
Constructor Details
-
AbstractBitbucketApi
-
-
Method Details
-
buildResponseException
protected BitbucketRequestException buildResponseException(org.apache.hc.core5.http.ClassicHttpResponse response, String errorMessage) -
getResponseContent
protected String getResponseContent(org.apache.hc.core5.http.ClassicHttpResponse response) throws IOException - Throws:
IOException
-
connectionManagerBuilder
protected static org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder connectionManagerBuilder() -
setupClientBuilder
protected org.apache.hc.client5.http.impl.classic.HttpClientBuilder setupClientBuilder() -
setClientProxyParams
protected void setClientProxyParams(org.apache.hc.client5.http.impl.classic.HttpClientBuilder builder) -
isSupportedAuthenticator
protected abstract boolean isSupportedAuthenticator(@CheckForNull BitbucketAuthenticator authenticator) Implementation must validate if the configured authenticator is supported by this client implementation. -
getConnectionManager
@CheckForNull protected abstract org.apache.hc.client5.http.io.HttpClientConnectionManager getConnectionManager() -
getHost
@NonNull protected abstract org.apache.hc.core5.http.HttpHost getHost() -
getBaseURL
-
getClient
@NonNull protected abstract org.apache.hc.client5.http.impl.classic.CloseableHttpClient getClient() -
executeMethod
protected org.apache.hc.core5.http.ClassicHttpResponse executeMethod(org.apache.hc.client5.http.classic.methods.HttpUriRequest request) throws IOException - Throws:
IOException
-
getRequestAsInputStream
- Throws:
IOException
-
headRequestStatus
- Throws:
IOException
-
getRequest
- Throws:
IOException
-
postRequest
protected String postRequest(String path, List<? extends org.apache.hc.core5.http.NameValuePair> params) throws IOException - Throws:
IOException
-
postRequest
- Throws:
IOException
-
putRequest
- Throws:
IOException
-
deleteRequest
- Throws:
IOException
-
close
Description copied from interface:BitbucketApi
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceBitbucketApi
- Throws:
IOException
-
getAuthenticator
-
getWebHooks
Description copied from interface:BitbucketApi
Returns the webhooks defined in the repository.- Specified by:
getWebHooks
in interfaceBitbucketApi
- Returns:
- the list of webhooks registered in the repository.
- Throws:
IOException
- if there was a network communications error.
-
registerCommitWebHook
Description copied from interface:BitbucketApi
Register a webhook on the repository.- Specified by:
registerCommitWebHook
in interfaceBitbucketApi
- Parameters:
hook
- the webhook object- Throws:
IOException
- if there was a network communications error.
-
updateCommitWebHook
Description copied from interface:BitbucketApi
Update a webhook on the repository.- Specified by:
updateCommitWebHook
in interfaceBitbucketApi
- Parameters:
hook
- the webhook object- Throws:
IOException
- if there was a network communications error.
-
removeCommitWebHook
Description copied from interface:BitbucketApi
Remove the webhook (ID field required) from the repository.- Specified by:
removeCommitWebHook
in interfaceBitbucketApi
- Parameters:
hook
- the webhook object- Throws:
IOException
- if there was a network communications error.
-
adapt
Description copied from interface:BitbucketApi
Adapt this implementation to the given class.- Specified by:
adapt
in interfaceBitbucketApi
- Type Parameters:
T
- the return type- Parameters:
clazz
- of type T to adapt to- Returns:
- the adapted class or
null
if given class is not supported.
-