https://github.com/evref-bl/gitlab-pharo-api
https://github.com/evref-bl/gitlab-pharo-api
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/evref-bl/gitlab-pharo-api
- Owner: Evref-BL
- Created: 2024-12-10T12:35:51.000Z (over 1 year ago)
- Default Branch: develop
- Last Pushed: 2025-06-19T16:01:07.000Z (12 months ago)
- Last Synced: 2025-06-19T16:43:52.287Z (12 months ago)
- Language: Smalltalk
- Size: 119 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gitlab-Pharo-API
[](https://github.com/Evref-BL/Gitlab-Pharo-API/actions/workflows/continuous.yml)
[](https://coveralls.io/github/Evref-BL/Gitlab-Pharo-API?branch=develop)
This is a Pharo client for the [Gitlab REST API](https://docs.gitlab.com/ee/api/rest/)
## Usage
### Installation
#### From playground
```st
Metacello new
githubUser: 'Evref-BL' project: 'Gitlab-Pharo-API' commitish: 'main' path: 'src';
baseline: 'GitlabAPI';
onConflict: [ :ex | ex useIncoming ];
load
```
#### Baseline dependency
```st
spec baseline: 'GitlabAPI' with: [
spec repository: 'github://Evref-BL/Gitlab-Pharo-API:main' ];
```
### Client
To start using the API, you need to create a client instance with your GitLab host URL and a private token for authentication. Here’s an example:
```st
gitlabApi := GitlabApi new
privateToken: '';
hostUrl: 'https://.com/api/v4';
yourself.
```
Replace `` with your actual GitLab private token and replace `` with the appropriate domain.
### Ressources
The API provides different resource classes to interact with various GitLab entities. These resources include:
- branches
- commits
- discussions
- groups
- jobs
- mergeRequests
- notes
- pipelines
- projects
- repositories
- users
Each resource provides methods for interacting with the corresponding GitLab resource. You can access them like this:
```st
gitlabApi projects
```
### Example
Here are a few examples of how to interact with the API:
#### Fetch All Projects
This example retrieves all projects from GitLab:
```st
| projects |
projects := gitlabApi projects all
```
#### Fetch All Projects Sorted in Ascending Order
This example demonstrates how to fetch all projects sorted in ascending order, using parameters:
```st
| projects params |
params := {
#sort -> 'asc'
} asDictionary.
projects := gitlabApi projects allWithParams: params.
```