You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Project listbitbucket.project_list()
# Repo listbitbucket.repo_list(project_key)
# Project infobitbucket.project(key)
# Create projectbitbucket.create_project(key, name, description="My pretty project")
# Get users who has permission in projectbitbucket.project_users(key, limit=99999, filter_str=None)
# Get project administrators for projectbitbucket.project_users_with_administrator_permissions(key)
# Get Project Groupsbitbucket.project_groups(key, limit=99999, filter_str=None)
# Get groups with admin permissionsbitbucket.project_groups_with_administrator_permissions(key)
# Project summarybitbucket.project_summary(key)
# Check default permission for projectbitbucket.project_default_permissions(project_key, permission)
# Grant default permission for projectbitbucket.project_grant_default_permissions(project_key, permission)
# Grant project permission to a specific userbitbucket.project_grant_user_permissions(project_key, username, permission)
# Grant project permission to a specific groupbitbucket.project_grant_group_permissions(project_key, groupname, permission)
# Remove default permission for projectbitbucket.project_remove_default_permissions(project_key, permission)
# Remove all project permissions for a specific userbitbucket.project_remove_user_permissions(project_key, username)
# Remove all project permissions for a specific groupbitbucket.project_remove_group_permissions(project_key, groupname)
Manage repositories
# Get single repositorybitbucket.get_repo(project_key, repository_slug)
# Update single repositorybitbucket.update_repo(project_key, repository_slug, description="Repo description")
# Get labels for a single repositorybitbucket.get_repo_labels(project_key, repository_slug)
# Set label for a single repositorybitbucket.set_repo_label(project_key, repository_slug, label_name)
# Disable branching modelbitbucket.disable_branching_model(project_key, repo_key)
# Enable branching modelbitbucket.enable_branching_model(project_key, repo_key)
# Get branching modelbitbucket.get_branching_model(project_key, repo_key)
# Set branching modeldata= {'development': {'refId': None, 'useDefault': True},
'types': [{'displayName': 'Bugfix',
'enabled': True,
'id': 'BUGFIX',
'prefix': 'bugfix-'},
{'displayName': 'Feature',
'enabled': True,
'id': 'FEATURE',
'prefix': 'feature-'},
{'displayName': 'Hotfix',
'enabled': True,
'id': 'HOTFIX',
'prefix': 'hotfix-'},
{'displayName': 'Release',
'enabled': True,
'id': 'RELEASE',
'prefix': 'release/'}]}
bitbucket.set_branching_model(project_key, repo_key, data)
bitbucket.repo_users(project_key, repo_key, limit=99999, filter_str=None)
bitbucket.repo_groups(project_key, repo_key, limit=99999, filter_str=None)
# Grant repository permission to an specific userbitbucket.repo_grant_user_permissions(project_key, repo_key, username, permission)
# Grant repository permission to an specific groupbitbucket.repo_grant_group_permissions(project_key, repo_key, groupname, permission)
# Delete a repository (DANGER!)bitbucket.delete_repo(project_key, repository_slug)
# Fork repo inside same projectfork_repository(project_key, repository_slug, new_repository_slug)
# Fork repo to new projectfork_repository(project_key, repository_slug, new_repository_slug, new_project_key, new_repository_slug)
Manage Code Insights
# Delete an existing Code Insights reportbitbucket.delete_code_insights_report(project_key, repository_slug, commit_hash, report_key)
# Create a new Code Insights reportreport= {
'details': 'This is an example report',
'result': 'FAIL',
'reporter': 'Anonymous',
'link': 'http://some-url',
'logo-url': 'http://some-url',
'data': [
{
'title': 'Example coverage',
'type': 'PERCENTAGE',
'value': 85
}
]
}
bitbucket.create_code_insights_report(project_key, repository_slug, commit_hash, report_key, 'Code Insights Report', **report)
# Add annotations to a Code Insights reportannotations= [
{
'path': 'some/path/to/file',
'line': 32,
'message': 'Roses are red, Violets are blue, Unexpected { on line 32',
'severity': 'MEDIUM'
}
]
bitbucket.add_code_insights_annotations_to_report(project_key, repository_slug, commit_hash, report_key, **annotations)
Groups and admins
# Get group of membersbitbucket.group_members(group, limit=99999)
# All project administratorsbitbucket.all_project_administrators()
# Get users. Use 'user_filter' parameter to get specific users.bitbucket.get_users(user_filter="username", limit=25, start=0)
Manage code
# Get repositories list from projectbitbucket.repo_list(project_key, limit=25)
# Create a new repository.# Requires an existing project in which this repository will be created. The only parameters which will be used# are name and scmId.# The authenticated user must have PROJECT_ADMIN permission for the context project to call this resource.bitbucket.create_repo(project_key, repository, forkable=False, is_private=True)
# Get branches from repobitbucket.get_branches(project, repository, filter='', limit=99999, details=True)
# Creates a branch using the information provided in the request.# The authenticated user must have REPO_WRITE permission for the context repository to call this resource.bitbucket.create_branch(project_key, repository, name, start_point, message)
# Delete branch from related repobitbucket.delete_branch(project, repository, name, end_point=None)
# Get pull requestsbitbucket.get_pull_requests(project, repository, state='OPEN', order='newest', limit=100, start=0)
# Get pull request activitiesbitbucket.get_pull_requests_activities(project, repository, pull_request_id)
# Get pull request changesbitbucket.get_pull_requests_changes(project, repository, pull_request_id)
# Get pull request commitsbitbucket.get_pull_requests_commits(project, repository, pull_request_id)
# Add comment into pull requestbitbucket.add_pull_request_comment(project, repository, pull_request_id, text)
# Create a new pull request between two branches.bitbucket.open_pull_request(source_project, source_repo, dest_project, dest_repo, source_branch, destination_branch, title, description)
# Create a new pull request between two branches with one reviewerbitbucket.open_pull_request(source_project, source_repo, dest_project, dest_repo, source_branch, destination_branch, title, description, reviewers='name')
# Create a new pull request between two branches with multiple reviewers.bitbucket.open_pull_request(source_project, source_repo, dest_project, dest_repo, source_branch, destination_branch, title, description, reviewers=['name1', 'name2'])
# Delete a pull requestbitbucket.delete_pull_request(project, repository, pull_request_id, pull_request_version)
# Get tags for related repobitbucket.get_tags(project, repository, filter='', limit=99999)
# Get project tags# The authenticated user must have REPO_READ permission for the context repository to call this resourcebitbucket.get_project_tags(project, repository, tag_name)
# Set tag# The authenticated user must have REPO_WRITE permission for the context repository to call this resourcebitbucket.set_tag(project, repository, tag_name, commit_revision, description=None)
# Delete tag# The authenticated user must have REPO_WRITE permission for the context repository to call this resourcebitbucket.delete_tag(project, repository, tag_name)
# Get diffbitbucket.get_diff(project, repository, path, hash_oldest, hash_newest)
# Get commit list from repobitbucket.get_commits(project, repository, hash_oldest, hash_newest, limit=99999)
# Get change log between 2 refsbitbucket.get_changelog(project, repository, ref_from, ref_to, limit=99999)
# Get raw content of the file from repobitbucket.get_content_of_file(project, repository, filename, at=None, markup=None)
""" Retrieve the raw content for a file path at a specified revision. The authenticated user must have REPO_READ permission for the specified repository to call this resource."""
Branch permissions
# Set branches permissionsbitbucket.set_branches_permissions(project_key, multiple_permissions=False, matcher_type=None, matcher_value=None, permission_type=None, repository=None, except_users=[], except_groups=[], except_access_keys=[], start=0, limit=25)
# Delete a single branch permission by permission idbitbucket.delete_branch_permission(project_key, permission_id, repository=None)
# Get a single branch permission by permission idbitbucket.get_branch_permission(project_key, permission_id, repository=None)
# Get all project conditions with reviewers list for specific projectbitbucket.get_project_conditions(project_key)
# Get a project condition with reviewers list for specific projectbitbucket.get_project_condition(project_key, id_condition)
# Create project condition with reviewers for specific project# :example condition: '{"sourceMatcher":{"id":"any","type":{"id":"ANY_REF"}},"targetMatcher":{"id":"refs/heads/master","type":{"id":"BRANCH"}},"reviewers":[{"id": 12}],"requiredApprovals":"0"}'bitbucket.create_project_condition(project_key, condition)
# Update a project condition with reviewers for specific project# :example condition: '{"sourceMatcher":{"id":"any","type":{"id":"ANY_REF"}},"targetMatcher":{"id":"refs/heads/master","type":{"id":"BRANCH"}},"reviewers":[{"id": 12}],"requiredApprovals":"0"}'bitbucket.update_project_condition(project_key, condition, id_condition)
# Delete a project condition for specific projectbitbucket.delete_project_condition(project_key, id_condition)
# Get all repository conditions with reviewers list for specific repository in projectbitbucket.get_repo_conditions(project_key, repo_key)
# Get repository conditions with reviewers list only only conditions type PROJECT for specific repository in projectbitbucket.get_repo_project_conditions(project_key, repo_key)
# Get repository conditions with reviewers list only conditions type REPOSITORY for specific repository in projectbitbucket.get_repo_repo_conditions(project_key, repo_key)
# Get a project condition with reviewers list for specific repository in projectbitbucket.get_repo_condition(project_key, repo_key, id_condition)
# Create project condition with reviewers for specific repository in project# :example condition: '{"sourceMatcher":{"id":"any","type":{"id":"ANY_REF"}},"targetMatcher":{"id":"refs/heads/master","type":{"id":"BRANCH"}},"reviewers":[{"id": 12}],"requiredApprovals":"0"}'bitbucket.create_repo_condition(project_key, repo_key, condition)
# Update a project condition with reviewers for specific repository in project# :example condition: '{"sourceMatcher":{"id":"any","type":{"id":"ANY_REF"}},"targetMatcher":{"id":"refs/heads/master","type":{"id":"BRANCH"}},"reviewers":[{"id": 12}],"requiredApprovals":"0"}'bitbucket.update_repo_condition(project_key, repo_key, condition, id_condition)
# Delete a project condition for specific repository in projectbitbucket.delete_repo_condition(project_key, repo_key, id_condition)
Pipelines management
# Object oriented:# Get the repository firstr=cloud.workspaces.get(workspace).repositories.get(repository)
# Get first ten Pipelines results for repositoryr.pipelines.each()
# Get twenty last Pipelines results for repositoryr.pipelines.each(sort="-created_on", pagelen=20)
# Trigger default Pipeline on the latest revision of the master branchr.pipelines.trigger()
# Trigger default Pipeline on the latest revision of the develop branchr.pipelines.trigger(branch="develop")
# Trigger default Pipeline on a specific revision of the develop branchr.pipelines.trigger(branch="develop", revision="<40-char hash>")
# Trigger specific Pipeline on a specific revision of the master branchr.pipelines.trigger(revision="<40-char hash>", name="style-check")
# Get specific Pipeline by UUIDpl=r.pipelines.get("{7d6c327d-6336-4721-bfeb-c24caf25045c}")
# Stop specific Pipeline by UUIDpl.stop()
# Get steps of Pipeline specified by UUIDpl.steps()
# Get step of Pipeline specified by UUIDss=pl.step("{56d2d8af-6526-4813-a22c-733ec6ecabf3}")
# Get log of step of Pipeline specified by UUIDss.log()
# or function oriented:# Get most recent Pipelines results for repositorybitbucket.get_pipelines(workspace, repository)
# Trigger default Pipeline on the latest revision of the master branchbitbucket.trigger_pipeline(workspace, repository)
# Trigger default Pipeline on the latest revision of the develop branchbitbucket.trigger_pipeline(workspace, repository, branch="develop")
# Trigger default Pipeline on a specific revision of the develop branchbitbucket.trigger_pipeline(workspace, repository, branch="develop", revision="<40-char hash>")
# Trigger specific Pipeline on a specific revision of the master branchbitbucket.trigger_pipeline(workspace, repository, revision="<40-char hash>", name="style-check")
# Get specific Pipeline by UUIDbitbucket.get_pipeline(workspace, repository, "{7d6c327d-6336-4721-bfeb-c24caf25045c}")
# Stop specific Pipeline by UUIDbitbucket.stop_pipeline(workspace, repository, "{7d6c327d-6336-4721-bfeb-c24caf25045c}")
# Get steps of Pipeline specified by UUIDbitbucket.get_pipeline_steps(workspace, repository, "{7d6c327d-6336-4721-bfeb-c24caf25045c}")
# Get step of Pipeline specified by UUIDsbitbucket.get_pipeline_step(workspace, repository, "{7d6c327d-6336-4721-bfeb-c24caf25045c}", "{56d2d8af-6526-4813-a22c-733ec6ecabf3}")
# Get log of step of Pipeline specified by UUIDsbitbucket.get_pipeline_step_log(workspace, repository, "{7d6c327d-6336-4721-bfeb-c24caf25045c}", "{56d2d8af-6526-4813-a22c-733ec6ecabf3}")
Manage issues
# Object oriented:# Get the repository firstr=cloud.workspaces.get(workspace).repositories.get(repository)
# Get all tracked issuesr.issues.each()
# Get all unassigned issues and sort them by priorityr.issues.get(sort_by="priority", query='assignee = null')
# Create a new issue of kind 'enhancement' and priority 'minor'r.issues.create("New idea", "How about this", kind="enhancement", priority="minor")
# Update the 'priority' field of the issue 42r.issues.get(42).priority="blocker"# Mark issue 42 as resolvedr.issues.get(42).state="resolved"# Get information about issue 1i=r.issues.get(1)
# Delete issue 123r.issues.get(123).delete()
# or function oriented:# Get all tracked issuesbitbucket.get_issues(workspace, repository)
# Get all unassigned issues and sort them by prioritybitbucket.get_issues(workspace, repository, sort_by="priority", query='assignee = null')
# Create a new issuebitbucket.create_issue(workspace, repository, "The title", "The description")
# Create a new issue of kind 'enhancement' and priority 'minor'bitbucket.create_issue(workspace, repository, "New idea", "How about this", kind="enhancement", priority="minor")
# Update the 'priority' field of the issue 42bitbucket.update_issue(workspace, repository, 42, priority="blocker")
# Mark issue 42 as resolvedbitbucket.update_issue(workspace, repository, 42, state="resolved")
# Get information about issue 1bitbucket.get_issue(workspace, repository, 1)
# Delete issue 123bitbucket.delete_issue(workspace, repository, 123)