https://github.com/evref-bl/bitbucket-pharo-api
https://github.com/evref-bl/bitbucket-pharo-api
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/evref-bl/bitbucket-pharo-api
- Owner: Evref-BL
- Created: 2025-01-20T09:26:11.000Z (11 months ago)
- Default Branch: develop
- Last Pushed: 2025-03-11T15:50:43.000Z (10 months ago)
- Last Synced: 2025-03-11T16:39:21.511Z (10 months ago)
- Language: Smalltalk
- Size: 53.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bitbucket-Pharo-API
[](https://github.com/Evref-BL/Bitbucket-Pharo-API/actions/workflows/continuous.yml)
[](https://coveralls.io/github/Evref-BL/Bitbucket-Pharo-API?branch=develop)
This is a Pharo client for the [Bitbucket Server REST API](https://docs.atlassian.com/bitbucket-server/rest/5.9.0/bitbucket-rest.html)
## Usage
### Installation
```st
Metacello new
githubUser: 'Evref-BL' project: 'Bitbucket-Pharo-API' commitish: 'develop' path: 'src';
baseline: 'BitbucketPharoAPI';
onConflict: [ :ex | ex useIncoming ];
load
```
### Client
To start using the API, you need to create a client instance with your Bitbucket host and a Bearer token for authentication. Here’s an example:
```st
bitbucketApi := BitbucketApi new
host: 'bitbucket.org';
bearerToken: ''.
```
Replace `` with your actual Bitbucket token.
### Ressources
The API provides different resource classes to interact with different entities in Bitbucket. These resources include:
- branches
- commits
- projects
- pullRequests
- repositories
- users
Each resource provides methods for interacting with the corresponding Bitbucket resource. You can access them like this:
```st
bitbucketApi projects
```
### Example
Here are a few examples of how to interact with the API:
#### Fetch All Projects
This example retrieves all projects from Bitbucket:
```st
| projects |
projects := bitbucketApi projects all
```
#### Fetch All Commits for a Specific Branch
This example demonstrates how to fetch all commits for the dev branch within a specific repository and project, using parameters:
```st
| commits params |
params := {
#until -> 'dev'
} asDictionary.
commits := bitbucketApi commits allWithParams: params inRepository: '' ofProject: ''.
```
Replace `` with the slug of the repository and `` with the project key.