Socket
Socket
Sign inDemoInstall

gitlab-ce-api

Package Overview
Dependencies
15
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gitlab-ce-api

A node module for connecting to and getting data from gitlab 8


Version published
Maintainers
1
Install size
145 kB
Created

Readme

Source

gitlab-ce-api

A node module for connecting to and getting data from gitlab 8

Notes

  1. this is very much a work in progress. I will only be updating it as I need to.
  2. Token refers to Access Tokens. They can be generated from here: [gitlaburl]/profile/personal_access_tokens
  3. Requires GitLab CE version 8.13+

Install

npm install gitlab-ce-api --save

Init

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 with
  • baseURL: The URL for the registry. eg: hub.docker.com
  • port: The Port Number to connect to. Default: 80
  • timeout: Timeout value in milliseconds. Default 15000
  • https: Use HTTPS to connect to the API. Default true,
  • verbose: Log console actions taken (for debugging). Default false

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);
});

Keywords

FAQs

Last updated on 17 Feb 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc