Gitlab API Node.js client
$ npm install node-gitlab --save
var gitlab = require('node-gitlab');
var client = gitlab.create({
api: 'https://gitlab.com/api/v3',
privateToken: 'your private token'
});
client.milestones.list({id: 1}, function (err, milestones) {
console.log(err, milestones);
});
Require co and node >= 0.11.12
:
var co = require('co');
var gitlab = require('node-gitlab');
var client = gitlab.createThunk({
api: 'https://gitlab.com/api/v3',
privateToken: 'your private token'
});
co(function* () {
var milestones = yield client.milestones.list({id: 1});
})();
Require node >= 0.11.13
or bluebird:
var gitlab = require('node-gitlab');
var client = gitlab.createPromise({
api: 'https://gitlab.com/api/v3',
privateToken: 'your private token'
});
client.milestones.list({id: 1})
.then(function (milestones) {
console.log(milestones);
})
.catch(function (err) {
throw err;
});
@see Gitlab API document.
Most importantly:
- API version can be set to
v3
orv4
privateToken
can be found on your gitlab account pagerequestTimeout
should be set between 30-60 secs, depending on size/complexity of API calls (such as a huge commit) or server load etc.
module.exports = {
api: process.env.NODE_GITLAB_API || 'https://gitlab.com/api/v3',
privateToken: process.env.NODE_GITLAB_TOKEN || 'enEWf516mA168tP6BiVe',
requestTimeout: 30000,
};
- gitlab-api-client a more fluent API
- nodegit - general git API client
All API methods must be added to properties.json
to be added to promise client (ie. client.promise
)
Please see the docs folder
See docs/group folder
- Groups
- [Group members](https://github.com/kristianmandrup/gitlab/tree/master/docs/group/Group Members.md)
See docs/user folder
See docs/project folder
See docs/repository folder
See Gitlab Full API
TODO
(The MIT License)
Copyright (c) 2017 Tecla5 Copyright (c) 2015 repo-utils Copyright (c) 2013 - 2014 fengmk2 fengmk2@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.