Modules@robinpath/bitbucket
bitbucket

@robinpath/bitbucket

0.1.2Node.jsPublic

Bitbucket module for RobinPath.

Bitbucket

Bitbucket module for RobinPath.

Package: @robinpath/bitbucket | Category: Devops | Type: Integration

Authentication

bitbucket.setCredentials "your-credentials"

Call this once at the start of your script before using any other function. Credentials persist for the duration of the script execution.

Use Cases

Use the bitbucket module when you need to:

  • listRepositories -- Use bitbucket.listRepositories to perform this operation
  • getRepository -- Use bitbucket.getRepository to perform this operation
  • createRepository -- Use bitbucket.createRepository to perform this operation
  • deleteRepository -- Use bitbucket.deleteRepository to perform this operation
  • listBranches -- Use bitbucket.listBranches to perform this operation

Quick Reference

FunctionDescriptionReturns
setCredentialsConfigure bitbucket credentials.object
listRepositorieslistRepositoriesobject
getRepositorygetRepositoryobject
createRepositorycreateRepositoryobject
deleteRepositorydeleteRepositoryobject
listBrancheslistBranchesobject
createBranchcreateBranchobject
deleteBranchdeleteBranchobject
listPullRequestslistPullRequestsobject
getPullRequestgetPullRequestobject
createPullRequestcreatePullRequestobject
updatePullRequestupdatePullRequestobject
mergePullRequestmergePullRequestobject
declinePullRequestdeclinePullRequestobject
listCommitslistCommitsobject
listPipelineslistPipelinesobject
getPipelinegetPipelineobject
triggerPipelinetriggerPipelineobject
listIssueslistIssuesobject
createIssuecreateIssueobject
listWorkspaceslistWorkspacesobject
getWorkspacegetWorkspaceobject
listWebhookslistWebhooksobject
getUsergetUserobject
listDeploymentslistDeploymentsobject

Functions

setCredentials

Configure bitbucket credentials.

Module: bitbucket | Returns: object -- API response.

bitbucket.setCredentials
ParameterTypeRequiredDescription
usernamestringYesusername
appPasswordstringYesappPassword

listRepositories

listRepositories

Module: bitbucket | Returns: object -- API response.

bitbucket.listRepositories
ParameterTypeRequiredDescription
inputstringNoInput parameter

getRepository

getRepository

Module: bitbucket | Returns: object -- API response.

bitbucket.getRepository
ParameterTypeRequiredDescription
inputstringNoInput parameter

createRepository

createRepository

Module: bitbucket | Returns: object -- API response.

bitbucket.createRepository
ParameterTypeRequiredDescription
inputstringNoInput parameter

deleteRepository

deleteRepository

Module: bitbucket | Returns: object -- API response.

bitbucket.deleteRepository
ParameterTypeRequiredDescription
inputstringNoInput parameter

listBranches

listBranches

Module: bitbucket | Returns: object -- API response.

bitbucket.listBranches
ParameterTypeRequiredDescription
inputstringNoInput parameter

createBranch

createBranch

Module: bitbucket | Returns: object -- API response.

bitbucket.createBranch
ParameterTypeRequiredDescription
inputstringNoInput parameter

deleteBranch

deleteBranch

Module: bitbucket | Returns: object -- API response.

bitbucket.deleteBranch
ParameterTypeRequiredDescription
inputstringNoInput parameter

listPullRequests

listPullRequests

Module: bitbucket | Returns: object -- API response.

bitbucket.listPullRequests
ParameterTypeRequiredDescription
inputstringNoInput parameter

getPullRequest

getPullRequest

Module: bitbucket | Returns: object -- API response.

bitbucket.getPullRequest
ParameterTypeRequiredDescription
inputstringNoInput parameter

createPullRequest

createPullRequest

Module: bitbucket | Returns: object -- API response.

bitbucket.createPullRequest
ParameterTypeRequiredDescription
inputstringNoInput parameter

updatePullRequest

updatePullRequest

Module: bitbucket | Returns: object -- API response.

bitbucket.updatePullRequest
ParameterTypeRequiredDescription
inputstringNoInput parameter

mergePullRequest

mergePullRequest

Module: bitbucket | Returns: object -- API response.

bitbucket.mergePullRequest
ParameterTypeRequiredDescription
inputstringNoInput parameter

declinePullRequest

declinePullRequest

Module: bitbucket | Returns: object -- API response.

bitbucket.declinePullRequest
ParameterTypeRequiredDescription
inputstringNoInput parameter

listCommits

listCommits

Module: bitbucket | Returns: object -- API response.

bitbucket.listCommits
ParameterTypeRequiredDescription
inputstringNoInput parameter

listPipelines

listPipelines

Module: bitbucket | Returns: object -- API response.

bitbucket.listPipelines
ParameterTypeRequiredDescription
inputstringNoInput parameter

getPipeline

getPipeline

Module: bitbucket | Returns: object -- API response.

bitbucket.getPipeline
ParameterTypeRequiredDescription
inputstringNoInput parameter

triggerPipeline

triggerPipeline

Module: bitbucket | Returns: object -- API response.

bitbucket.triggerPipeline
ParameterTypeRequiredDescription
inputstringNoInput parameter

listIssues

listIssues

Module: bitbucket | Returns: object -- API response.

bitbucket.listIssues
ParameterTypeRequiredDescription
inputstringNoInput parameter

createIssue

createIssue

Module: bitbucket | Returns: object -- API response.

bitbucket.createIssue
ParameterTypeRequiredDescription
inputstringNoInput parameter

listWorkspaces

listWorkspaces

Module: bitbucket | Returns: object -- API response.

bitbucket.listWorkspaces
ParameterTypeRequiredDescription
inputstringNoInput parameter

getWorkspace

getWorkspace

Module: bitbucket | Returns: object -- API response.

bitbucket.getWorkspace
ParameterTypeRequiredDescription
inputstringNoInput parameter

listWebhooks

listWebhooks

Module: bitbucket | Returns: object -- API response.

bitbucket.listWebhooks
ParameterTypeRequiredDescription
inputstringNoInput parameter

getUser

getUser

Module: bitbucket | Returns: object -- API response.

bitbucket.getUser
ParameterTypeRequiredDescription
inputstringNoInput parameter

listDeployments

listDeployments

Module: bitbucket | Returns: object -- API response.

bitbucket.listDeployments
ParameterTypeRequiredDescription
inputstringNoInput parameter

Error Handling

All functions throw on failure. Common errors:

ErrorCause
Bitbucket API error (${res.status}): ${t}Check the error message for details
bitbucket.setCredentials requires username, appPassword.Check the error message for details
bitbucket.deleteRepository requires an ID.Check the error message for details
bitbucket.deleteBranch requires an ID.Check the error message for details
bitbucket.updatePullRequest requires an ID.Check the error message for details
bitbucket.mergePullRequest requires an ID.Check the error message for details
bitbucket.declinePullRequest requires an ID.Check the error message for details
Bitbucket: "..." not configured. Call bitbucket.setCredentials first.Check the error message for details
@desc "List repositories and validate result"
do
  set $result as bitbucket.listRepositories
  if $result != null
    print "Success"
  else
    print "No result"
  end
enddo

Recipes

1. List and iterate Repositories

Retrieve all items and loop through them.

@desc "Setup authentication"
do
  bitbucket.setCredentials $token
enddo

@desc "List repositories and iterate results"
do
  set $result as bitbucket.listRepositories
  each $item in $result
    print $item
  end
enddo

2. Create a new item with createRepository

Create a new resource and capture the result.

@desc "Setup authentication"
do
  bitbucket.setCredentials $token
enddo

@desc "Create repository"
do
  set $result as bitbucket.createRepository
  print "Created: " + $result
enddo

3. Create and update workflow

Create an item and then update it.

@desc "Setup authentication"
do
  bitbucket.setCredentials $token
enddo

@desc "Create repository and update pull request"
do
  set $created as bitbucket.createRepository
  # Update the created item
  bitbucket.updatePullRequest
enddo

4. Check before creating

List existing items and only create if needed.

@desc "Setup authentication"
do
  bitbucket.setCredentials $token
enddo

@desc "List repositories and create repository"
do
  set $existing as bitbucket.listRepositories
  if $existing == null
    bitbucket.createRepository
    print "Item created"
  else
    print "Item already exists"
  end
enddo

5. Multi-step Bitbucket workflow

Chain multiple bitbucket operations together.

@desc "Setup authentication"
do
  bitbucket.setCredentials $token
enddo

@desc "List repositories, get repository, and more"
do
  set $r_listRepositories as bitbucket.listRepositories
  set $r_getRepository as bitbucket.getRepository
  set $r_createRepository as bitbucket.createRepository
  print "All operations complete"
enddo

6. Safe listRepositories with validation

Check results before proceeding.

@desc "Setup authentication"
do
  bitbucket.setCredentials $token
enddo

@desc "List repositories and validate result"
do
  set $result as bitbucket.listRepositories
  if $result != null
    print "Success: " + $result
  else
    print "Operation returned no data"
  end
enddo

Related Modules

  • docker -- Docker module for complementary functionality
  • git -- Git module for complementary functionality
  • github -- GitHub module for complementary functionality
  • gitlab -- GitLab module for complementary functionality
  • vercel -- Vercel module for complementary functionality

Versions (1)

VersionTagPublished
0.1.2latest1 months ago
Install
$ robinpath add @robinpath/bitbucket

Collaborators

Dumitru Balaban
Dumitru Balaban
@dumitru
View all @robinpath modules
Version0.1.2
LicenseMIT
Unpacked Size5.2 KB
Versions1
Weekly Downloads26
Total Downloads26
Stars0
Last Publish1 months ago
Created1 months ago

Category

devops