Skip to content

Commit da6ce34

Browse files
committed
Add support for project deploy keys
1 parent 7202dc7 commit da6ce34

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

README.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var gitlab = require('node-gitlab');
5959

6060
var client = gitlab.createThunk({
6161
api: 'https://gitlab.com/api/v3',
62-
privateToken: 'your private token'
62+
privateToken: 'your private
6363
});
6464
6565
co(function* () {
@@ -255,7 +255,7 @@ Parameters:
255255
- public (optional) - if true same as setting visibility_level = 20
256256
- visibility_level (optional)
257257

258-
On success, method returns 200 with the updated project. If parameters are invalid, 400 is returned.
258+
On success, method returns 200 with the updated project. If parameters are invalid, 400 is returned.
259259

260260
#### client.projects.remove({id})
261261

@@ -425,6 +425,57 @@ This method is idempotent and can be called multiple times with the same paramet
425425

426426
---
427427

428+
### Deploy Keys
429+
430+
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/deploy_keys.md
431+
432+
#### client.deployKeys.list({id})
433+
434+
Get a list of a project's deploy keys.
435+
436+
Parameters:
437+
438+
* `{String}` `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
439+
440+
441+
#### client.deployKeys.get({id, key_id})
442+
443+
Gets a project deploy key.
444+
445+
Parameters:
446+
447+
* `{String}` `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
448+
* `{String}` `key_id` (required) - The ID of a key
449+
450+
{
451+
"id": 1,
452+
"title": "Public key",
453+
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=",
454+
"created_at": "2013-10-02T10:12:29Z"
455+
}
456+
```
457+
458+
#### client.deployKey.create({id, title, key})
459+
460+
Creates a new deploy key for a project. If deploy key already exists in another project - it will be joined to project but only if original one was is accessible by same user
461+
462+
Parameters:
463+
464+
* `{String}` `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
465+
* `{String}` `title` (required) - New deploy key's title
466+
* `{String}` `key` (required) - New deploy key
467+
468+
#### client.deployKeys.remove({id, key_id})
469+
470+
Delete a deploy key from a project.
471+
472+
Parameters:
473+
474+
* `{String}` `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
475+
* `{String}` `key_id` (required) - The ID of the deploy key
476+
477+
---
478+
428479
### Repository Branches
429480
430481
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/projects.md#branches

lib/properties.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ var properties = {
5252
'fork',
5353
'search',
5454
],
55+
deployKeys: [],
5556
projectMembers: [],
5657
groups: [
5758
'transferProject'

lib/resources/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,9 @@ module.exports = {
6060
resourcePath: '/groups/:id/members',
6161
idName: 'user_id',
6262
},
63+
64+
deployKeys: {
65+
resourcePath: '/projects/:id/keys',
66+
idName: 'key_id',
67+
},
6368
};

0 commit comments

Comments
 (0)