gitlab-rest
v0.1.1
Published
GitLab API based on offical API V4
Downloads
6
Readme
gitlab-rest
GitLab API based on offical API v3/v4
If links in this document not avaiable, please access README on GitHub directly.
Description
Get Started
Class
const API = require('gitlab-rest');
let rest = new API({ private_token: 'personal-access-token' });
rest.whoAmI()
.then(info => {
// ...
})
.catch(err => {
// ...
});
Standalone Function
const whoAmI = require('gitlab-rest/whoAmI');
whoAmI({ private_token: 'personal-access-token' })
.then(info => {
// ...
})
.catch(err => {
// ...
});
API
This module is made up of one class and a number of methods which may be members or standalone.
All methods are asynchronous and will return instances of Promise
. Hereafter, response means what to be obtained in .then(response => { /* ... */ })
.
All methods may be required and invoked by itself as what we see in Get Started, Standalone Function. Actually, if a method is invoked by itself, an instance of class Rest
will be created implicitly. In such cases, necessary info required by constructor of class Rest
should occur in object options
or options.api
with the same names.
Class Rest(Object api)
To create an instance of gitlab RESTful API.- string api.endpoint OPTIONAL DEFAULT
- string api.version OPTIONAL
- string api.access_token OPTIONAL
- string api.private_token OPTIONAL
Promise(true) [<rest>].downloadProject(Object options)
To obtain meta data of matching groups.- object options.api OPTIONAL
- string options.namespace OPTIONAL
- string options.project_name OPTIONAL
- string options.project_id OPTIONAL
- string options.path
- string options.ref OPTIONAL
- string options.target
Promise(Object[]) [<rest>].findGroups(Object options)
To obtain meta data of matching groups.- object options.api OPTIONAL
- string options.search OPTIONAL
Promise(Object[]) [<rest>].findObjects(Object options)
To obtain meta data of matching objects / files.- object options.api OPTIONAL
- string options.project_id
- string options.path OPTIONAL
- string options.ref OPTIONAL
- boolean options.recursive OPTIONAL
Promise(Object[]) [<rest>].findProjects(Object options)
To obtain meta data of matching projects.- object options.api OPTIONAL
- string __options.username OPTIONAL
- string __options.group_id OPTIONAL
Promise(Object) [<rest>].getBlob(Object options)
To obtain blob data of specified object / file.- object options.api OPTIONAL
- string options.namespace OPTIONAL
- string options.project_name OPTIONAL
- string options.project_id OPTIONAL
- string options.path
- string options.ref OPTIONAL
Promise(Object) [<rest>].getGroup(Object options)
To obtain details of specified group.- object options.api OPTIONAL
- string options.id
Promise(Object) [<rest>].getProject(Object options)
To obtain details of specified project.object options.api OPTIONAL
string options.id
Promise(Object) [<rest>].getUser(Object options)
To obtain details of specified user.- object options.api OPTIONAL
- string options.id
Promise(Object) [<rest>].whoAmI(Object options)
To obtain details of user who owns the token used.- object options.api OPTIONAL
Promise(Object) [<rest>].whoIsThat(Object options)
To obtain details of GitLab server.- object options.api OPTIONAL
FAQ
What is namespace?
Usernames and groupnames fall under a special category called namespaces.What is ref?
It may be commit (somebody gets used to call it "commit id"), branch or tag.