Class BitbucketApiServiceImpl
java.lang.Object
com.atlassian.bamboo.plugins.bitbucket.impl.BitbucketApiServiceImpl
- All Implemented Interfaces:
BitbucketApiService,org.springframework.beans.factory.DisposableBean
public class BitbucketApiServiceImpl
extends Object
implements BitbucketApiService, org.springframework.beans.factory.DisposableBean
-
Constructor Summary
ConstructorsConstructorDescriptionBitbucketApiServiceImpl(com.atlassian.sal.api.message.I18nResolver i18nResolver) -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteComment(String username, String password, String repositorySlug, String commitId, String commentId) Delete commit comment.voiddestroy()@NotNull BitbucketPageEntity<BitbucketNodeEntity> findBranches(@NotNull String owner, @NotNull String slug, @NotNull String username, @Nullable String password, @Nullable String queryString, int start, int limit) @NotNull BitbucketPageEntity<BitbucketResourceEntity> findPublicRepositories(@NotNull String username, @Nullable String queryString, int start, int limit) Return a filtered list of public repositories that user has access to.@NotNull BitbucketNodeEntitygetBranch(@NotNull String owner, @NotNull String slug, @NotNull String branch, String username, String password) Returns a branch of a repository if it exists, throws exception (404) if not.@NotNull List<BitbucketNodeEntity> getBranches(@NotNull String owner, @NotNull String slug, @NotNull String username, @Nullable String password) JAXB binding cannot be used in this method as Bitbucket returns JSON with node names containing characters which cannot be used as XML element names.getCommentIds(String username, String password, String repositorySlug, String commitId) Fetch comment ids by commit id.getCommits(String username, String password, String repositorySlug, int limit) Fetch repository commits.@NotNull BitbucketNodeEntitygetDefaultBranch(@NotNull String owner, @NotNull String slug, @Nullable String username, @Nullable String password) Fetch default branch of a repository.@NotNull List<BitbucketResourceEntity> getPublicRepositories(@NotNull String username) Return a list of all public repositories that user has access to.@NotNull List<BitbucketResourceEntity> getPublicRepositories(@NotNull String username, @Nullable String queryString) Return a list of all public repositories that user has access to.@NotNull BitbucketPageEntity<BitbucketResourceEntity> getRepositories(@NotNull String username, @NotNull String password, @NotNull String workspace, @Nullable String queryString, int start, int limit) Return a list of all repositories in a workspace that user has access to.@NotNull BitbucketResourceEntitygetRepository(@NotNull String owner, @NotNull String slug, @Nullable String username, @Nullable String password) Retrieve data about single Bitbucket repository.@Nullable StringgetUuidForWorkspaceOrUsername(@NotNull String identifier, @Nullable String secret) Fetch UUID for given identifier.@NotNull BitbucketPageEntity<BitbucketWorkspaceEntity> getWorkspaces(@NotNull String username, @NotNull String password, int start, int limit) Retrieve a paginated list of workspaces accessible to Bitbucket user.voidupdateBuildStatus(@NotNull String owner, @NotNull String slug, @NotNull String revision, @NotNull RestBuildStatus buildStatus, @NotNull String username, @NotNull String password) Send build status update to Bitbucket serverbooleanverifyRepositoryExists(@NotNull String owner, @NotNull String slug, @Nullable String username, @Nullable String password) Verify that repository exists by hitting its REST
-
Constructor Details
-
BitbucketApiServiceImpl
@Inject public BitbucketApiServiceImpl(com.atlassian.sal.api.message.I18nResolver i18nResolver)
-
-
Method Details
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
getWorkspaces
@NotNull public @NotNull BitbucketPageEntity<BitbucketWorkspaceEntity> getWorkspaces(@NotNull @NotNull String username, @NotNull @NotNull String password, int start, int limit) throws BitbucketApiException Description copied from interface:BitbucketApiServiceRetrieve a paginated list of workspaces accessible to Bitbucket user.- Specified by:
getWorkspacesin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
getRepositories
@NotNull public @NotNull BitbucketPageEntity<BitbucketResourceEntity> getRepositories(@NotNull @NotNull String username, @NotNull @NotNull String password, @NotNull @NotNull String workspace, @Nullable @Nullable String queryString, int start, int limit) throws BitbucketApiException Description copied from interface:BitbucketApiServiceReturn a list of all repositories in a workspace that user has access to.- Specified by:
getRepositoriesin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
findPublicRepositories
@NotNull public @NotNull BitbucketPageEntity<BitbucketResourceEntity> findPublicRepositories(@NotNull @NotNull String username, @Nullable @Nullable String queryString, int start, int limit) throws BitbucketApiException Description copied from interface:BitbucketApiServiceReturn a filtered list of public repositories that user has access to. The length of the list is limited.- Specified by:
findPublicRepositoriesin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
getPublicRepositories
@NotNull public @NotNull List<BitbucketResourceEntity> getPublicRepositories(@NotNull @NotNull String username, @Nullable @Nullable String queryString) throws BitbucketApiException Description copied from interface:BitbucketApiServiceReturn a list of all public repositories that user has access to.- Specified by:
getPublicRepositoriesin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
getPublicRepositories
@NotNull public @NotNull List<BitbucketResourceEntity> getPublicRepositories(@NotNull @NotNull String username) throws BitbucketApiException Description copied from interface:BitbucketApiServiceReturn a list of all public repositories that user has access to.- Specified by:
getPublicRepositoriesin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
findBranches
@NotNull public @NotNull BitbucketPageEntity<BitbucketNodeEntity> findBranches(@NotNull @NotNull String owner, @NotNull @NotNull String slug, @NotNull @NotNull String username, @Nullable @Nullable String password, @Nullable @Nullable String queryString, int start, int limit) throws BitbucketApiException - Specified by:
findBranchesin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
getBranches
@NotNull public @NotNull List<BitbucketNodeEntity> getBranches(@NotNull @NotNull String owner, @NotNull @NotNull String slug, @NotNull @NotNull String username, @Nullable @Nullable String password) throws BitbucketApiException JAXB binding cannot be used in this method as Bitbucket returns JSON with node names containing characters which cannot be used as XML element names. Internals of JAXB - JSON parsing use XML DOM as intermediate format so it obviously fails.- Specified by:
getBranchesin interfaceBitbucketApiService- Parameters:
owner-slug-username-password-- Returns:
- Throws:
BitbucketApiException
-
getBranch
@NotNull public @NotNull BitbucketNodeEntity getBranch(@NotNull @NotNull String owner, @NotNull @NotNull String slug, @NotNull @NotNull String branch, String username, String password) throws BitbucketApiException Description copied from interface:BitbucketApiServiceReturns a branch of a repository if it exists, throws exception (404) if not.- Specified by:
getBranchin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
verifyRepositoryExists
public boolean verifyRepositoryExists(@NotNull @NotNull String owner, @NotNull @NotNull String slug, @Nullable @Nullable String username, @Nullable @Nullable String password) Description copied from interface:BitbucketApiServiceVerify that repository exists by hitting its REST- Specified by:
verifyRepositoryExistsin interfaceBitbucketApiService
-
getRepository
@NotNull public @NotNull BitbucketResourceEntity getRepository(@NotNull @NotNull String owner, @NotNull @NotNull String slug, @Nullable @Nullable String username, @Nullable @Nullable String password) throws BitbucketApiException Description copied from interface:BitbucketApiServiceRetrieve data about single Bitbucket repository.- Specified by:
getRepositoryin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
getDefaultBranch
@NotNull public @NotNull BitbucketNodeEntity getDefaultBranch(@NotNull @NotNull String owner, @NotNull @NotNull String slug, @Nullable @Nullable String username, @Nullable @Nullable String password) throws BitbucketApiException Description copied from interface:BitbucketApiServiceFetch default branch of a repository.- Specified by:
getDefaultBranchin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
getUuidForWorkspaceOrUsername
@Nullable public @Nullable String getUuidForWorkspaceOrUsername(@NotNull @NotNull String identifier, @Nullable @Nullable String secret) Description copied from interface:BitbucketApiServiceFetch UUID for given identifier.- Specified by:
getUuidForWorkspaceOrUsernamein interfaceBitbucketApiService- Parameters:
identifier- workspace or username or UUIDsecret- the password of the uuid account- Returns:
- uuid
-
getCommits
public List<String> getCommits(String username, String password, String repositorySlug, int limit) throws BitbucketApiException, org.json.JSONException Description copied from interface:BitbucketApiServiceFetch repository commits.- Specified by:
getCommitsin interfaceBitbucketApiService- Throws:
BitbucketApiExceptionorg.json.JSONException
-
getCommentIds
public List<String> getCommentIds(String username, String password, String repositorySlug, String commitId) throws BitbucketApiException, org.json.JSONException Description copied from interface:BitbucketApiServiceFetch comment ids by commit id.- Specified by:
getCommentIdsin interfaceBitbucketApiService- Throws:
BitbucketApiExceptionorg.json.JSONException
-
deleteComment
public void deleteComment(String username, String password, String repositorySlug, String commitId, String commentId) Description copied from interface:BitbucketApiServiceDelete commit comment.- Specified by:
deleteCommentin interfaceBitbucketApiService
-
updateBuildStatus
public void updateBuildStatus(@NotNull @NotNull String owner, @NotNull @NotNull String slug, @NotNull @NotNull String revision, @NotNull @NotNull RestBuildStatus buildStatus, @NotNull @NotNull String username, @NotNull @NotNull String password) throws BitbucketApiException Description copied from interface:BitbucketApiServiceSend build status update to Bitbucket server- Specified by:
updateBuildStatusin interfaceBitbucketApiService- Parameters:
owner- repository ownerslug- repository slugrevision- changeset revisionbuildStatus- payload to be sent to Bitbucketusername- credentials used to authenticate against Bitbucketpassword- credentials used to authenticate against Bitbucket- Throws:
BitbucketApiException
-