forked from python-gitlab/python-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlabels.py
More file actions
35 lines (31 loc) · 706 Bytes
/
labels.py
File metadata and controls
35 lines (31 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# list
labels = gl.project_labels.list(project_id=1)
# or
labels = project.labels.list()
# end list
# get
label = gl.project_labels.get(label_name, project_id=1)
# or
label = project.labels.get(label_name)
# end get
# create
label = gl.project_labels.create({'name': 'foo', 'color': '#8899aa'},
project_id=1)
# or
label = project.labels.create({'name': 'foo', 'color': '#8899aa'})
# end create
# update
# change the name of the label:
label.new_name = 'bar'
label.save()
# change its color:
label.color = '#112233'
label.save()
# end update
# delete
gl.project_labels.delete(label_id, project_id=1)
# or
project.labels.delete(label_id)
# or
label.delete()
# end delete