GitLab Commando
gitlab-commando
is a TypeScript library that implements the command pattern with undo/redo functionality specifically for interacting with the GitLab API. This library provides a robust and flexible way to perform various GitLab operations programmatically while supporting undoable actions for safer batch operations.
Installation
npm i gitlab-commando
Usage
Here is how you can use the gitlab-commando
to interact with the GitLab API:
import { GitLabCommando } from 'gitlab-commando';
const commando = new GitLabCommando('your-instance-url');
commando.createProject('your-token', 'New Project', 'namespaceId', ['topic1', 'topic2'], 'master').then(response => {
console.log('Project created:', response);
}).catch(error => {
console.error('Error creating project:', error);
});
commando.closeMergeRequest('your-token', 'project-id', 'merge-request-iid').then(response => {
console.log('Merge request closed:', response);
}).catch(error => {
console.error('Error closing merge request:', error);
});
commando.rollback();