File tree Expand file tree Collapse file tree 5 files changed +65
-13
lines changed
main/java/com/spotify/github/v3
java/com/spotify/github/v3/prs
resources/com/spotify/github/v3 Expand file tree Collapse file tree 5 files changed +65
-13
lines changed Original file line number Diff line number Diff line change 7
7
* Licensed under the Apache License, Version 2.0 (the "License");
8
8
* you may not use this file except in compliance with the License.
9
9
* You may obtain a copy of the License at
10
- *
10
+ *
11
11
* http://www.apache.org/licenses/LICENSE-2.0
12
- *
12
+ *
13
13
* Unless required by applicable law or agreed to in writing, software
14
14
* distributed under the License is distributed on an "AS IS" BASIS,
15
15
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
20
21
21
package com .spotify .github .v3 .issues ;
22
22
23
+ import com .fasterxml .jackson .annotation .JsonProperty ;
23
24
import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
24
25
import com .fasterxml .jackson .databind .annotation .JsonSerialize ;
25
26
import com .spotify .github .GithubStyle ;
27
+
26
28
import java .net .URI ;
27
29
import javax .annotation .Nullable ;
30
+
28
31
import org .immutables .value .Value ;
29
32
30
- /** Issue label resource */
33
+ /**
34
+ * Issue label resource
35
+ */
31
36
@ Value .Immutable
32
37
@ GithubStyle
33
38
@ JsonSerialize (as = ImmutableLabel .class )
34
39
@ JsonDeserialize (as = ImmutableLabel .class )
35
40
public interface Label {
36
41
37
- /** URL */
38
- @ Nullable
39
- URI url ();
42
+ /**
43
+ * Id
44
+ */
45
+ Long id ();
46
+
47
+ @ Nullable
48
+ String nodeId ();
49
+
50
+ /**
51
+ * URL
52
+ */
53
+ @ Nullable
54
+ URI url ();
55
+
56
+ /**
57
+ * Name
58
+ */
59
+ @ Nullable
60
+ String name ();
61
+
62
+ /**
63
+ * Color
64
+ */
65
+ @ Nullable
66
+ String color ();
40
67
41
- /** Name */
42
- @ Nullable
43
- String name ();
68
+ @ Nullable
69
+ String description ();
44
70
45
- /** Color */
46
- @ Nullable
47
- String color ();
71
+ /**
72
+ * Default
73
+ */
74
+ @ JsonProperty ("default" )
75
+ boolean isDefault ();
48
76
}
Original file line number Diff line number Diff line change 24
24
import com .fasterxml .jackson .databind .annotation .JsonSerialize ;
25
25
import com .spotify .github .GithubStyle ;
26
26
import com .spotify .github .v3 .User ;
27
+
28
+ import java .util .List ;
27
29
import java .util .Optional ;
28
30
import javax .annotation .Nullable ;
31
+
32
+ import com .spotify .github .v3 .issues .Label ;
29
33
import org .immutables .value .Value ;
30
34
31
35
/**
@@ -80,4 +84,7 @@ public interface PullRequest extends PullRequestItem {
80
84
81
85
/** Is it a draft PR? */
82
86
Optional <Boolean > draft ();
87
+
88
+ @ Nullable
89
+ List <Label > labels ();
83
90
}
Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ public void testDeserializationPr() throws IOException {
47
47
assertThat (pr .deletions (), is (3 ));
48
48
assertThat (pr .changedFiles (), is (5 ));
49
49
assertThat (pr .draft (), is (Optional .of (false )));
50
+ assertThat (pr .labels ().size (),is (1 ));
51
+ assertThat (pr .labels ().get (0 ).name (),is ("bug" ));
52
+ assertThat (pr .labels ().get (0 ).id (),is (42L ));
53
+ assertThat (pr .labels ().get (0 ).color (),is ("ff0000" ));
50
54
}
51
55
52
56
@ Test
Original file line number Diff line number Diff line change 69
69
"closed_at" : " 2013-02-12T13:22:01Z" ,
70
70
"due_on" : " 2012-10-09T23:39:01Z"
71
71
},
72
+ "labels" : [
73
+ {
74
+ "id" : 42 ,
75
+ "node_id" : " MDU6TGFiZWw0Mg==" ,
76
+ "url" : " https://api.github.com/repos/batterseapower/pinyin-toolkit/labels/bug" ,
77
+ "name" : " bug" ,
78
+ "color" : " ff0000" ,
79
+ "default" : true
80
+ }
81
+ ],
72
82
"locked" : false ,
73
83
"created_at" : " 2011-01-26T19:01:12Z" ,
74
84
"updated_at" : " 2011-01-26T19:01:12Z" ,
Original file line number Diff line number Diff line change 32
32
},
33
33
"labels" : [
34
34
{
35
+ "id" : 42 ,
36
+ "node_id" : " MDU6TGFiZWw0Mg==" ,
35
37
"url" : " https://api.github.com/repos/batterseapower/pinyin-toolkit/labels/bug" ,
36
38
"name" : " bug" ,
37
- "color" : " ff0000"
39
+ "color" : " ff0000" ,
40
+ "default" : true
38
41
}
39
42
],
40
43
"state" : " open" ,
You can’t perform that action at this time.
0 commit comments