Skip to content

Commit 9d457be

Browse files
Jarrad Seersfengmk2
authored andcommitted
feat: Ability to list project labels
1 parent 7202dc7 commit 9d457be

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
fengmk2 <[email protected]> (https://github.com/fengmk2)
66
shigeru.nakajima <[email protected]> (https://github.com/ledsun)
77
vsviridov <[email protected]> (https://github.com/vsviridov)
8+
jarradseers <[email protected]> (https://github.com/jarradseers)

README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,58 @@ Parameters:
356356
]
357357
```
358358

359+
#### client.projects.getLabels({id})
360+
361+
Get the labels for the specified project.
362+
363+
Parameters:
364+
365+
- id (required) - The ID or NAMESPACE/PROJECT_NAME of a project
366+
367+
```json
368+
[
369+
{ "name": "Bug", color: "#A8D695" },
370+
{ "name": "Feature", color: "#5CB85C" }
371+
]
372+
```
373+
374+
#### client.projects.createLabel({id, name, color})
375+
376+
Create a label for the specified project.
377+
378+
Parameters:
379+
380+
- id (required) - The ID of a project
381+
- name (required) - The name of the label
382+
- color (required) - Color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB)
383+
384+
```json
385+
[
386+
{ "name": "Bug", color: "#A8D695" },
387+
{ "name": "Feature", color: "#5CB85C" }
388+
]
389+
```
390+
391+
#### client.projects.updateLabel({id, name, new_name, color})
392+
393+
Update a label for the specified project.
394+
395+
Parameters:
396+
397+
- id (required) - The ID of a project
398+
- name (required) - The name of the existing label
399+
- new_name (optional) - The new name of the label
400+
- color (optional) - New color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB)
401+
402+
#### client.projects.deleteLabel({id, name})
403+
404+
Delete a label for the specified project.
405+
406+
Parameters:
407+
408+
- id (required) - The ID of a project
409+
- name (required) - The name of the label to be deleted
410+
359411
---
360412

361413
### Project Members
@@ -499,6 +551,36 @@ Parameters:
499551
- id (required) - The ID or NAMESPACE/PROJECT_NAME of a project
500552
- branch (required) - The name of the branch.
501553

554+
#### client.repositoryBranches.create({id, branch_name, ref})
555+
556+
Create a repository branch on a project.
557+
558+
Parameters:
559+
560+
- id (required) - The ID or NAMESPACE/PROJECT_NAME of a project
561+
- branch_name (required) - The name of the branch.
562+
- ref (required) - Create branch from commit SHA or existing branch.
563+
564+
#### client.repositoryBranches.remove({id, branch})
565+
566+
Delete repository branch
567+
568+
Parameters:
569+
570+
- id (required) - The ID of a project
571+
- branch (required) - The name of the branch
572+
573+
It return 200 if succeed, 404 if the branch to be deleted does not exist or 400 for other reasons.
574+
In case of an error, an explaining message is provided.
575+
576+
Success response:
577+
578+
```json
579+
{
580+
"branch_name": "my-removed-branch"
581+
}
582+
```
583+
502584
#### client.repositoryBranches.protect({id, branch})
503585

504586
Protects a single branch of a project.

lib/resources/project.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,19 @@ Project.prototype.fork = function (params, callback) {
4848
Project.prototype.listEvents = function (params, callback) {
4949
this.client.request('get', this.onePath + '/events', params, callback);
5050
};
51+
52+
Project.prototype.getLabels = function (params, callback) {
53+
this.client.request('get', this.onePath + '/labels', params, callback);
54+
};
55+
56+
Project.prototype.createLabel = function (params, callback) {
57+
this.client.request('post', this.onePath + '/labels', params, callback);
58+
};
59+
60+
Project.prototype.updateLabel = function(params, callback) {
61+
this.client.request('put', this.onePath + '/labels', params, callback);
62+
};
63+
64+
Project.prototype.deleteLabel = function(params, callback) {
65+
this.client.request('delete', this.onePath + '/labels', params, callback);
66+
};

0 commit comments

Comments
 (0)