Skip to content

Commit 0cea055

Browse files
committed
Adds support for namespace APIs
1 parent d7cf43f commit 0cea055

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

lib/properties.js

+4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ var properties = {
6464
'transferProject'
6565
],
6666
groupMembers: [],
67+
namespaces: [
68+
'list',
69+
'search',
70+
],
6771
};
6872

6973
for (var key in properties) {

lib/resources/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,6 @@ module.exports = {
6262
resourcePath: '/projects/:id/keys',
6363
idName: 'key_id',
6464
},
65+
66+
namespaces: require('./namespace'),
6567
};

lib/resources/namespace.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**!
2+
* gitlab - lib/resources/namespace.js
3+
*
4+
* Copyright(c) repo-utils and other contributors.
5+
* MIT Licensed
6+
*
7+
* Authors:
8+
* fengmk2 <fengmk2@gmail.com> (http://fengmk2.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+
module.exports = Namespace;
21+
22+
function Namespace(client) {
23+
this.constructor.super_.call(this, client, '/namespaces', 'id');
24+
}
25+
util.inherits(Namespace, restful.RESTFulResource);
26+
27+
Namespace.prototype.list = function (params, callback) {
28+
this.client.request('get', '/namespaces', params, callback);
29+
};
30+
31+
Namespace.prototype.search = function (params, callback) {
32+
this.client.request('get', '/namespaces/search/:query', params, callback);
33+
};

0 commit comments

Comments
 (0)