public interface StashClient
| Modifier and Type | Interface and Description |
|---|---|
static class |
StashClient.PullRequestDirection
the direction relative to the specified repository.
|
static class |
StashClient.PullRequestsOrder
the order to return pull requests in, either OLDEST (as in: "oldest first") or NEWEST.
|
static class |
StashClient.PullRequestStateFilter
used to filter pull requests by state.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addProjectGroupPermission(String projectKey,
String groupName,
ProjectPermission permission)
Sets Permissions for the given group
|
boolean |
addProjectUserPermission(String projectKey,
String userName,
ProjectPermission permission)
Sets Permissions for the given user
|
Comment |
addPullRequestGeneralComment(String projectKey,
String repositorySlug,
long pullRequestId,
String text)
adds general comment to a pull request
|
boolean |
addRepositoryKey(String projectKey,
String repositorySlug,
String publicKey,
String keyLabel,
Permission keyPermission)
Adds to the repository a new access key (SSH public key) with given permission
|
boolean |
addRepositoryUserPermission(String projectKey,
String repositorySlug,
String userName,
Permission permission)
Sets permission for specified user on specified repository.
|
Task |
addTask(TaskAnchor anchor,
String text)
Create new task
|
boolean |
addUserKey(String publicKey,
String keyLabel)
Adds to current user a new access key (SSH public key)
|
PullRequestMergeability |
canMergePullRequest(String projectKey,
String repositorySlug,
long pullRequestId)
Test whether a pull request can be merged.
|
boolean |
createCodeAnnotations(String projectKey,
String repositorySlug,
String revision,
String reportKey,
Iterable<CodeAnnotation> codeAnnotations)
Creates multiple code annotations for a given code insights report.
|
boolean |
createProject(String projectKey,
String name,
String type,
String description)
Adds a project
|
default PullRequestStatus |
createPullRequest(String title,
String description,
PullRequestRef fromRef,
PullRequestRef toRef,
Iterable<String> reviewers)
Creates a new pull request between two branches.
|
PullRequestStatus |
createPullRequest(String title,
String description,
PullRequestRef fromRef,
PullRequestRef toRef,
Iterable<String> reviewers,
AvatarRequest avatarRequest)
Creates a new pull request between two branches.
|
Report |
createReport(String projectKey,
String repositorySlug,
String revision,
Report report)
Create a code insights report for a given revision in a repository.
|
boolean |
createRepository(String projectKey,
String name,
String scmId,
boolean forkable)
Adds a repository to project
|
void |
deleteCodeAnnotation(String projectKey,
String repositorySlug,
String revision,
String reportKey,
String externalId)
Deletes a single code annotation identified by an external Id fora given code insights report.
|
void |
deleteCodeAnnotations(String projectKey,
String repositorySlug,
String revision,
String reportKey)
Deletes all code annotations for a given code insights report.
|
boolean |
deleteProject(String projectKey)
Deletes a project of given projectKey
|
void |
deleteReport(String projectKey,
String repositorySlug,
String revision,
String key)
Deletes a code insights report identified by the given
key for a given revision in a repository. |
boolean |
deleteRepository(String projectKey,
String repositorySlug)
Deletes a repository
|
Repository |
forkRepository(String sourceProjectKey,
String sourceRepositorySlug,
String targetProjectKey,
String targetRepositorySlug)
Create a new repository forked from an existing repository.
|
Page<Project> |
getAccessibleProjects(long start,
long limit)
Get a list of all projects the user can see.
|
ApplicationProperties |
getApplicationProperties()
Retrieves version information and other application properties.
|
List<CodeAnnotation> |
getCodeAnnotations(String projectKey,
String repositorySlug,
String revision)
Obtain a full list of code annotations for a given revision in a repository.
|
Page<UserSshKey> |
getCurrentUserKeys(long start,
long limit)
Retrieves access keys (SSH public keys) for current user
|
Optional<Permission> |
getCurrentUserRepositoryPermission(String projectKey,
String repositorySlug)
Retrieves user permission to given repository.
|
MirrorServer |
getMirror(String mirrorId)
Returns mirror details.
|
Page<ProjectGroupPermission> |
getProjectGroupPermissions(String projectKey,
String filter,
long start,
long limit)
Retrieve a page of groups that have been granted at least one permission for the specified project.
|
Page<Repository> |
getProjectRepositories(String projectKey,
long start,
long limit)
Get a list of all repositories of a project
|
Page<ProjectUserPermission> |
getProjectUserPermissions(String projectKey,
String filter,
long start,
long limit)
Retrieve a page of users that have been granted at least one permission for the specified project.
|
default Page<PullRequestStatus> |
getPullRequestsByRepository(String projectKey,
String repositorySlug,
String branchName,
StashClient.PullRequestDirection direction,
StashClient.PullRequestStateFilter stateFilter,
StashClient.PullRequestsOrder order,
long start,
long limit)
Retrieve a page of pull requests to or from the specified repository.
|
Page<PullRequestStatus> |
getPullRequestsByRepository(String projectKey,
String repositorySlug,
String branchName,
StashClient.PullRequestDirection direction,
StashClient.PullRequestStateFilter stateFilter,
StashClient.PullRequestsOrder order,
long start,
long limit,
AvatarRequest avatarRequest)
Retrieve a page of pull requests to or from the specified repository.
|
Optional<Report> |
getReport(String projectKey,
String repositorySlug,
String revision,
String key)
Obtains a code insights report identified by the given
key for a given revision in a repository. |
Page<Report> |
getReports(String projectKey,
String repositorySlug,
String revision,
long start,
long limit)
Obtain a paginated list of code insights report for a given revision in a repository.
|
Page<Repository> |
getRepositories(String projectName,
String query,
long start,
long limit)
Search for repositories the user can see.
|
Repository |
getRepository(String projectKey,
String repositorySlug)
Retrieve a specific repository object
|
Page<Branch> |
getRepositoryBranches(String projectKey,
String repositorySlug,
String query,
long start,
long limit)
Search for the branches for a specific repository
|
Branch |
getRepositoryDefaultBranch(String projectKey,
String repositorySlug)
Retrieves default branch for a specific repository
|
Page<RepositorySshKey> |
getRepositoryKeys(String projectKey,
String repositorySlug,
long start,
long limit)
Retrieves access keys (SSH public keys) for given repository
|
Page<MirrorServer> |
getRepositoryMirrors(long repositoryId,
long start,
long limit)
Returns a page of mirrors for a repository.
|
Page<Tag> |
getRepositoryTags(String projectKey,
String repositorySlug,
String query,
long start,
long limit)
Search for the tags for a specific repository
|
Page<User> |
getUsers(String filterForUsername,
long start,
long limit)
Retrieve a List of users.
|
boolean |
isRepositoryKey(String projectKey,
String repositorySlug,
String publicKey)
Checks if provided access key (SSH public key) is already registered as a repository key on Stash server
|
boolean |
isUserKey(String publicKey)
Checks if provided access key (SSH public key) is already registered as a user key on Stash server
|
default PullRequestStatus |
mergePullRequest(String projectKey,
String repositorySlug,
long pullRequestId,
long version)
Merge specified pull request.
|
PullRequestStatus |
mergePullRequest(String projectKey,
String repositorySlug,
long pullRequestId,
long version,
AvatarRequest avatarRequest)
Merge specified pull request.
|
boolean |
projectExists(String projectKey)
Checks if the given project exists.
|
boolean |
removeUserKey(long keyId)
Removes user key by it's id
|
boolean |
removeUserKey(String publicKey)
Removes user key by key content and label
|
boolean |
updateCodeAnnotation(String projectKey,
String repositorySlug,
String revision,
String reportKey,
String externalId,
CodeAnnotation codeAnnotation)
Creates or updates a single code annotation identified by an external Id for a given code insights report.
|
boolean |
updateProject(String projectKey,
String newProjectKey,
String name,
String description)
Edits an existing project
|
default Task |
updateTask(long taskId,
String text)
Updates state of a task.
|
default Task |
updateTask(long taskId,
TaskState taskState)
Updates state of a task.
|
Task |
updateTask(long taskId,
TaskState taskState,
String text)
Updates state and/or text of a task.
|
@Nonnull Page<User> getUsers(@Nullable String filterForUsername, long start, long limit)
filterForUsername - if specified only users with usernames, display name or email addresses containing the supplied string will be returnedstart - index of the first result to retrieve (for paging)limit - total number of results to retrieve after start (for Paging)@Nonnull Page<Project> getAccessibleProjects(long start, long limit)
start - index of the first result to retrieve (for paging)limit - total number of results to retrieve after start (for Paging)StashExceptionStashRestException@Nonnull Page<Repository> getRepositories(@Nullable String projectName, @Nullable String query, long start, long limit)
projectName - optional. Filter by an individual projectquery - Search term to filter repositories bystart - index of the first result to retrieve (for paging)limit - total number of results to retrieve after start (for Paging)StashExceptionStashRestException@Nonnull Page<Repository> getProjectRepositories(@Nonnull String projectKey, long start, long limit)
projectKey - repositories belong tostart - index of the first result to retrieve (for paging)limit - total number of results to retrieve after start (for Paging)StashExceptionStashRestException@Nullable Repository getRepository(@Nonnull String projectKey, @Nonnull String repositorySlug)
projectKey - of the project the repo is inrepositorySlug - slugified version of the repo nameStashExceptionStashRestException@Nonnull Page<Branch> getRepositoryBranches(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nullable String query, long start, long limit)
projectKey - the repository belongs torepositorySlug - repository (this is the slugified version of the repository name, not the raw repository name)query - search term for branch namestart - index of the first result to retrieve (for paging)limit - total number of results to retrieve after start (for Paging)StashExceptionStashRestExceptionPage<Tag> getRepositoryTags(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nullable String query, long start, long limit)
projectKey - the repository belongs torepositorySlug - repository (this is the slugified version of the repository name, not the raw repository name)query - search term for tag namestart - index of the first result to retrieve (for paging)limit - total number of results to retrieve after start (for Paging)StashExceptionStashRestException@Nonnull Page<MirrorServer> getRepositoryMirrors(long repositoryId, long start, long limit)
repositoryId - repository idstart - index of the first result to retrieve (for paging)limit - total number of results to retrieve after start (for Paging)StashExceptionStashRestException@Nullable MirrorServer getMirror(@Nonnull String mirrorId)
mirrorId - mirror idStashExceptionStashRestException@Nullable Branch getRepositoryDefaultBranch(@Nonnull String projectKey, @Nonnull String repositorySlug)
projectKey - the repository belongs torepositorySlug - repository (this is the slugified version of the repository name, not the raw repository name)@Nonnull Page<RepositorySshKey> getRepositoryKeys(@Nonnull String projectKey, @Nonnull String repositorySlug, long start, long limit)
projectKey - project keyrepositorySlug - repository keystart - index of the first result to retrieve (for paging)limit - total number of results to retrieve after start (for Paging)StashExceptionStashRestExceptionboolean addRepositoryKey(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nonnull String publicKey, @Nullable String keyLabel, @Nonnull Permission keyPermission)
projectKey - project keyrepositorySlug - repository keypublicKey - access key valuekeyLabel - label stored with access keykeyPermission - type of permission given by public keyStashExceptionStashRestExceptionStashUnauthorizedRestExceptionboolean isRepositoryKey(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nonnull String publicKey)
projectKey - project keyrepositorySlug - repository keypublicKey - Access key (SSH public key) valueStashExceptionStashRestException@Nonnull Page<UserSshKey> getCurrentUserKeys(long start, long limit)
start - index of the first result to retrieve (for paging)limit - total number of results to retrieve after start (for Paging)StashExceptionStashRestExceptionboolean isUserKey(@Nonnull String publicKey)
publicKey - Access key (SSH public key) valueStashExceptionStashRestExceptionboolean addUserKey(@Nonnull String publicKey, @Nullable String keyLabel)
publicKey - access key valuekeyLabel - label stored with access keyStashExceptionStashRestExceptionboolean removeUserKey(@Nonnull String publicKey)
publicKey - public key to removeboolean removeUserKey(long keyId)
keyId - boolean projectExists(@Nonnull String projectKey)
projectKey - project key to identify the projectboolean createProject(@Nonnull String projectKey, @Nonnull String name, @Nonnull String type, @Nonnull String description)
projectKey - project key to identify the projectname - display name of the projecttype - project type, can be "NORMAL" or "PERSONAL"description - project descriptionboolean updateProject(@Nonnull String projectKey, @Nonnull String newProjectKey, @Nonnull String name, @Nullable String description)
projectKey - project key to identify the projectnewProjectKey - new value for project keyname - display name of the projectdescription - project descriptionPage<ProjectGroupPermission> getProjectGroupPermissions(@Nonnull String projectKey, @Nullable String filter, long start, long limit)
projectKey - project key to identify the projectfilter - if specified only group names containing the supplied string will be returnedstart - index of the first result to retrieve (for paging)limit - total number of results to retrieve after start (for Paging)boolean addProjectGroupPermission(@Nonnull String projectKey, @Nonnull String groupName, @Nonnull ProjectPermission permission)
projectKey - project key to identify the projectgroupName - name of the affected grouppermission - permission level to setPage<ProjectUserPermission> getProjectUserPermissions(@Nonnull String projectKey, @Nullable String filter, long start, long limit)
projectKey - project key to identify the projectfilter - if specified only user names containing the supplied string will be returnedstart - index of the first result to retrieve (for paging)limit - total number of results to retrieve after start (for Paging)boolean addProjectUserPermission(@Nonnull String projectKey, @Nonnull String userName, @Nonnull ProjectPermission permission)
projectKey - project key to identify the projectuserName - name of the affected userpermission - permission level to setboolean createRepository(@Nonnull String projectKey, @Nonnull String name, @Nonnull String scmId, boolean forkable)
projectKey - repository owning project keyname - name of the repositoryforkable - true if repository should be forkableboolean deleteProject(@Nonnull String projectKey)
projectKey - key of the project to deleteboolean deleteRepository(@Nonnull String projectKey, @Nonnull String repositorySlug)
projectKey - owning project keyrepositorySlug - repository slug@Nonnull ApplicationProperties getApplicationProperties()
Optional<Permission> getCurrentUserRepositoryPermission(@Nonnull String projectKey, @Nonnull String repositorySlug)
projectKey - project keyrepositorySlug - repository keyboolean addRepositoryUserPermission(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nonnull String userName, @Nonnull Permission permission)
projectKey - project key to set permission onrepositorySlug - repository slug to set permission onuserName - name of the user to set permission forpermission - permission to be set@Nonnull PullRequestStatus createPullRequest(@Nonnull String title, @Nullable String description, @Nonnull PullRequestRef fromRef, @Nonnull PullRequestRef toRef, @Nonnull Iterable<String> reviewers, @Nullable AvatarRequest avatarRequest)
title - pull request titledescription - pull request descriptionfromRef - reference of the branch to be merged fromtoRef - reference of the branch to be merged toreviewers - collection of reviewers, each identified by user nameavatarRequest - if provided remote Stash/Bitbucket will return avatars data as requestedStashExceptionStashRestException@Nonnull default PullRequestStatus createPullRequest(@Nonnull String title, @Nullable String description, @Nonnull PullRequestRef fromRef, @Nonnull PullRequestRef toRef, @Nonnull Iterable<String> reviewers)
title - pull request titledescription - pull request descriptionfromRef - reference of the branch to be merged fromtoRef - reference of the branch to be merged toreviewers - collection of reviewers, each identified by user nameStashExceptionStashRestException@Nonnull Page<PullRequestStatus> getPullRequestsByRepository(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nullable String branchName, @Nullable StashClient.PullRequestDirection direction, @Nullable StashClient.PullRequestStateFilter stateFilter, @Nullable StashClient.PullRequestsOrder order, long start, long limit, @Nullable AvatarRequest avatarRequest)
projectKey - repository project keyrepositorySlug - repository slugbranchName - a fully-qualified branch ID to find pull requests to or from, such as
refs/heads/master. Might be null to get pull requests for every branches.direction - the direction relative to the specified repository. Might be null.stateFilter - Supply ALL to return pull request in any state. If a state is supplied only pull requests
in the specified state will be returned. Might be null.order - the order to return pull requests in, either OLDEST (as in: "oldest first") or NEWEST.
Might be null.start - index of the first result to retrieve (for paging)limit - total number of results to retrieve after start (for Paging)avatarRequest - if provided remote Stash/Bitbucket will return avatars data as requestedStashExceptionStashRestException@Nonnull default Page<PullRequestStatus> getPullRequestsByRepository(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nullable String branchName, @Nullable StashClient.PullRequestDirection direction, @Nullable StashClient.PullRequestStateFilter stateFilter, @Nullable StashClient.PullRequestsOrder order, long start, long limit)
PullRequestStatus.getMergeOutcome() property might be missing if
BBS has not yet determined the mergeability of this pull request, as only cached value is returned if exists,
no actual check is being triggered by this call. In order to find out actual mergeability state consider
calling canMergePullRequest(String, String, long).
See also StashVersions.REPORTS_PR_MERGE_STATUS.projectKey - repository project keyrepositorySlug - repository slugbranchName - a fully-qualified branch ID to find pull requests to or from, such as
refs/heads/master. Might be nulldirection - the direction relative to the specified repository. Might be nullstateFilter - Supply ALL to return pull request in any state. If a state is supplied only pull requests
in the specified state will be returned. Might be null.order - the order to return pull requests in, either OLDEST (as in: "oldest first") or NEWEST.
Might be null.start - index of the first result to retrieve (for paging)limit - total number of results to retrieve after start (for Paging)StashExceptionStashRestException@Nonnull PullRequestStatus mergePullRequest(@Nonnull String projectKey, @Nonnull String repositorySlug, long pullRequestId, long version, @Nullable AvatarRequest avatarRequest)
projectKey - repository project keyrepositorySlug - repository slugpullRequestId - pull request idversion - pull request version, version of the data the decision to merge was based upon.avatarRequest - if provided remote Stash/Bitbucket will return avatars data as requestedStashExceptionStashRestException@Nonnull default PullRequestStatus mergePullRequest(@Nonnull String projectKey, @Nonnull String repositorySlug, long pullRequestId, long version)
projectKey - repository project keyrepositorySlug - repository slugpullRequestId - pull request idversion - pull request version, version of the data the decision to merge was based upon.StashExceptionStashRestException@Nonnull PullRequestMergeability canMergePullRequest(@Nonnull String projectKey, @Nonnull String repositorySlug, long pullRequestId)
projectKey - repository project keyrepositorySlug - repository slugpullRequestId - pull request idStashExceptionStashRestException@Nonnull Repository forkRepository(@Nonnull String sourceProjectKey, @Nonnull String sourceRepositorySlug, @Nonnull String targetProjectKey, @Nonnull String targetRepositorySlug)
sourceProjectKey - key of the project where source repository belongs tosourceRepositorySlug - source repository to be forked fromtargetProjectKey - key of the project where forked repository will be created.targetRepositorySlug - target repositor to be created@Nonnull Comment addPullRequestGeneralComment(@Nonnull String projectKey, @Nonnull String repositorySlug, long pullRequestId, @Nonnull String text)
projectKey - project keyrepositorySlug - repository slugpullRequestId - pull request idtext - comment text@Nonnull Task addTask(@Nonnull TaskAnchor anchor, @Nonnull String text)
anchor - the anchor of the task, such as a pull request's commenttext - task text@Nonnull Task updateTask(long taskId, @Nullable TaskState taskState, @Nullable String text)
taskId - task idtaskState - optional state, if provided it will be updated to requested value.text - optional text, if provided task text will be updated to requested value.StashExceptionStashRestException@Nonnull default Task updateTask(long taskId, @Nonnull TaskState taskState)
taskId - task id.taskState - desired state value.StashExceptionStashRestException@Nonnull default Task updateTask(long taskId, @Nonnull String text)
taskId - task id.text - desired text value.StashExceptionStashRestException@Nonnull Page<Report> getReports(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nonnull String revision, long start, long limit)
projectKey - project keyrepositorySlug - repository slugrevision - commit hashstart - pagination start (offset)limit - pagination limit (results count)@Nonnull Optional<Report> getReport(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nonnull String revision, @Nonnull String key)
key for a given revision in a repository.projectKey - project keyrepositorySlug - repository slugrevision - commit hashkey - unique key of the reportReport.getKey()@Nonnull Report createReport(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nonnull String revision, @Nonnull Report report)
key then all it's configuration will be updated.projectKey - project keyrepositorySlug - repository slugrevision - commit hashreport - report to create or updatevoid deleteReport(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nonnull String revision, @Nonnull String key)
key for a given revision in a repository. Does
nothing if the report doesn't exist.projectKey - project keyrepositorySlug - repository slugrevision - commit hashkey - unique key of the reportReport.getKey()@Nonnull List<CodeAnnotation> getCodeAnnotations(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nonnull String revision)
projectKey - project keyrepositorySlug - repository slugrevision - commit hashboolean createCodeAnnotations(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nonnull String revision, @Nonnull String reportKey, @Nonnull Iterable<CodeAnnotation> codeAnnotations)
projectKey - project keyrepositorySlug - repository slugrevision - commit hashreportKey - unique key of the reportcodeAnnotations - a collection of code annotations to createtrue if annotations have been created, false when the number of annotations in the report
has exceeded an allowed limitboolean updateCodeAnnotation(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nonnull String revision, @Nonnull String reportKey, @Nonnull String externalId, @Nonnull CodeAnnotation codeAnnotation)
projectKey - project keyrepositorySlug - repository slugrevision - commit hashreportKey - unique key of the reportexternalId - external Id of the annotationcodeAnnotation - the code annotation to create or updatetrue if the annotation has been created or updated, false when the number of annotations
in the report has exceeded an allowed limitCodeAnnotation.getExternalId()void deleteCodeAnnotation(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nonnull String revision, @Nonnull String reportKey, @Nonnull String externalId)
projectKey - project keyrepositorySlug - repository slugrevision - commit hashreportKey - unique key of the reportexternalId - external Id of the annotationCodeAnnotation.getExternalId()void deleteCodeAnnotations(@Nonnull String projectKey, @Nonnull String repositorySlug, @Nonnull String revision, @Nonnull String reportKey)
projectKey - project keyrepositorySlug - repository slugrevision - commit hashreportKey - unique key of the reportCopyright © 2020 Atlassian. All rights reserved.