Socket
Socket
Sign inDemoInstall

simple-gitlab-api

Package Overview
Dependencies
52
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

.travis.yml

4

package.json
{
"name": "simple-gitlab-api",
"version": "1.0.0",
"version": "1.0.1",
"description": "A simple GitLab API library for Node.js using simple request-promise calls",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Tests coming soon.\" && exit 0"
},

@@ -9,0 +9,0 @@ "repository": {

# simple-gitlab-api
[![npm version](https://badge.fury.io/js/simple-gitlab-api.svg)](https://badge.fury.io/js/simple-gitlab-api)
[![Build Status](https://travis-ci.org/napramirez/simple-gitlab-api.svg?branch=master)](https://travis-ci.org/napramirez/simple-gitlab-api)
[![NPM](https://nodei.co/npm/simple-gitlab-api.png)](https://nodei.co/npm/simple-gitlab-api/)
A simple GitLab API library for Node.js using simple request-promise calls
Install
=======
```bash
# Install from npm
npm install simple-gitlab-api
```
Usage in Node.js
================
```javascript
var gitlab = require('simple-gitlab-api');
gitlab.get('/groups').then(function(groups) {
for (var i = 0; i < groups.length; i++)
console.log(groups[i].name);
});
```
Environment Variables
=====================
- `GITLAB_URL` - the url to the GitLab server, _e.g._ `https://gitlab.mycompany.com`
- `GITLAB_API_PREFIX` - the API endpoint prefix including the API version, _e.g._ `/api/v4`
- `GITLAB_API_TOKEN` - the access token to the API passed into the header, _e.g._ (as used in `curl`):
```bash
curl --request GET --header 'PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK' 'https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fmodels%2Fkey%2Erb/raw?ref=master'
```

@@ -24,6 +24,51 @@ var requestPromise = require('request-promise');

put: (api_path, api_params = {}) =>
self.invoke('PUT', api_path, api_params)
self.invoke('PUT', api_path, api_params),
newGroup: (path, name) =>
self.post('/groups', {
path: path,
name: name,
visibility: 'internal',
lfs_enabled: false
}),
getGroup: (path) =>
self.get('/groups/' + path),
forkProject: (project_path, namespace) =>
self.post('/projects/' + encodeURIComponent(project_path) + '/fork', {
namespace: namespace
}),
getProject: (project_path) =>
self.get('/projects/' + encodeURIComponent(project_path), {
statistics: false
}),
deleteForkRelationship: (project_path) =>
self.delete('/projects/' + encodeURIComponent(project_path) + '/fork'),
renameProject: (project_path, name) =>
self.put('/projects/' + encodeURIComponent(project_path), {
name: name,
path: name
}),
waitUntilForkComplete: (project_path) =>
new Promise(function(fullfill, reject) {
var forkRefreshId = setInterval(() =>
self.getProject(project_path)
.then(function(project) {
if (project.import_status == 'finished') {
clearInterval(forkRefreshId);
fullfill();
}
}, function(err) {
clearInterval(forkRefreshId);
reject(err);
}), 3000)
})
}
module.exports = self;
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