Skip to content

Commit 864c4d7

Browse files
committed
add groups and projectMembers
1 parent 9cec12a commit 864c4d7

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

lib/gitlab.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var User = require('./user');
2222
var Repository = require('./repository');
2323
var MergeRequest = require('./merge_request');
2424
var RepositoryFile = require('./repository_file');
25+
var Group = require('./group');
2526

2627
module.exports = Gitlab;
2728

@@ -41,6 +42,10 @@ function Gitlab(options) {
4142

4243
this.addResources({
4344
projects: Project,
45+
projectMembers: {
46+
resourcePath: '/projects/:id/members',
47+
idName: 'user_id',
48+
},
4449
repository: Repository,
4550
repositoryFiles: RepositoryFile,
4651
mergeRequests: MergeRequest,
@@ -57,6 +62,7 @@ function Gitlab(options) {
5762
resourcePath: '/groups/:id/members',
5863
idName: 'user_id',
5964
},
65+
groups: Group
6066
});
6167

6268
this.merge_requests = this.mergeRequests;

lib/group.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**!
2+
* gitlab - lib/group.js
3+
*
4+
* Copyright(c) fengmk2 and other contributors.
5+
* MIT Licensed
6+
*
7+
* Authors:
8+
* fengmk2 <[email protected]> (http://fengmk2.github.com)
9+
*/
10+
11+
'use strict';
12+
13+
/**
14+
* Module dependencies.
15+
*/
16+
17+
var util = require('util');
18+
var restful = require('restful-client');
19+
20+
function Group(client) {
21+
this.constructor.super_.call(this, client, '/groups', 'id');
22+
}
23+
util.inherits(Group, restful.RESTFulResource);
24+
25+
module.exports = Group;
26+
27+
/**
28+
* Transfer a project to the Group namespace. Available only for admin
29+
*
30+
* POST /groups/:id/projects/:project_id
31+
*
32+
* @param {Object} params
33+
* - {String} id group id
34+
* - {String} project_id project id
35+
* @param {Function(err, project)} callback
36+
*/
37+
Group.prototype.transferProject = function (params, callback) {
38+
this.client.request('post', '/groups/:id/projects/:project_id', params, callback);
39+
return this;
40+
};

0 commit comments

Comments
 (0)