1.0.2 • Published 7 years ago

gitlabpp v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

node-gitlabpp

GitlabPlusPlus (gitlabpp) is a fork from an original repository. The original code is missing some operations such as merge request acceptance or protect a branch with parameters.

The sole purpose of GitlabPlusPlus is only to provide the additional methods. Any development here is made as a pull request to the original repository.

GitLab API Nodejs library. It wraps the HTTP api library described here.

Original repo maintained by Manfred Touron and Dave Irvine. This fork is kept by Miguel Ribeiro

Install

# Install from npm
npm install gitlabpp

Usage

URL to your GitLab instance should not include /api/v3 path.

Coffee-Script

# Connection
gitlab = (require 'gitlabpp')
  url:   'http://example.com'
  token: 'abcdefghij123456'

# Listing users
gitlab.users.all (users) ->
  console.log "##{user.id}: #{user.email}, #{user.name}, #{user.created_at}" for user in users

# Listing projects
gitlab.projects.all (projects) ->
  for project in projects
    console.log "##{project.id}: #{project.name}, path: #{project.path}, default_branch: #{project.default_branch}, private: #{project.private}, owner: #{project.owner.name} (#{project.owner.email}), date: #{project.created_at}"

Javascript

// Connection
var gitlab = require('gitlabpp')({
  url:   'http://example.com',
  token: 'abcdefghij123456'
});

// Listing users
gitlab.users.all(function(users) {
  for (var i = 0; i < users.length; i++) {
    console.log("#" + users[i].id + ": " + users[i].email + ", " + users[i].name + ", " + users[i].created_at);
  }
});

// Listing projects
gitlab.projects.all(function(projects) {
  for (var i = 0; i < projects.length; i++) {
    console.log("#" + projects[i].id + ": " + projects[i].name + ", path: " + projects[i].path + ", default_branch: " + projects[i].default_branch + ", private: " + projects[i]["private"] + ", owner: " + projects[i].owner.name + " (" + projects[i].owner.email + "), date: " + projects[i].created_at);
  }
});

See Examples directory for more examples

Develop

Edit the Coffee-Script files in src, then build them using cake build. Use cake watch to build files continuously while developing.

However I suggest you develop and pull request for the original repository.

CLI

Check out cli-gitlab

Contributors

License

MIT

Changelog

master (unreleased)

  • No entry.

Full commits list

1.0.0 (2017-07-06)

  • Fixed API doc link in README;
  • Protect branch accepts parameters;
  • Merges can be accepted.