0.0.0 • Published 9 years ago
gitlab-ce-api v0.0.0
gitlab-ce-api
A node module for connecting to and getting data from gitlab 8
Notes
- this is very much a work in progress. I will only be updating it as I need to.
- Token refers to
Access Tokens. They can be generated from here:[gitlaburl]/profile/personal_access_tokens - Requires GitLab CE version 8.13+
Install
npm install gitlab-ce-api --saveInit
var gitlabAPI = require('gitlab-ce-api');
var options = {
token: "",
baseURL: "",
port: 80,
timeout: 15000,
https: true,
verbose: false
};
gitlabAPI(options);Options
token: The User to sign into the registry withbaseURL: The URL for the registry. eg:hub.docker.comport: The Port Number to connect to. Default:80timeout: Timeout value in milliseconds. Default15000https: Use HTTPS to connect to the API. Defaulttrue,verbose: Log console actions taken (for debugging). Defaultfalse
each option has a get and set method in camel case (gitlabAPI(options).setVerbose(true)).
Usage
List of Projects
gitlabAPI(options).projects().then(function(projects) {
console.log(projects);
}).catch(function(error) {
console.error(error);
});Projects Details
var ProjectId = 123;
gitlabAPI(options).projects(ProjectId).then(function(project) {
console.log(project);
}).catch(function(error) {
console.error(error);
});Projects Repository File Tree
var ProjectId = 123;
gitlabAPI(options).repository(ProjectId, {
path: "", // navigate deeper into file tree
ref_name: "master", // branch
recursive: true // enterprise only
}).then(function(fileTree) {
console.log(fileTree);
}).catch(function(error) {
console.error(error);
});Project Repository File Details
var ProjectId = 123;
gitlabAPI(options).repositoryFile(ProjectId, {
file_path: "", // path to file
ref: "master" // branch
}).then(function(file) {
console.log(file);
}).catch(function(error) {
console.error(error);
});0.0.0
9 years ago