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 77 * Licensed under the Apache License, Version 2.0 (the "License");
88 * you may not use this file except in compliance with the License.
99 * You may obtain a copy of the License at
10- *
10+ *
1111 * http://www.apache.org/licenses/LICENSE-2.0
12- *
12+ *
1313 * Unless required by applicable law or agreed to in writing, software
1414 * distributed under the License is distributed on an "AS IS" BASIS,
1515 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2020
2121package com .spotify .github .v3 .issues ;
2222
23+ import com .fasterxml .jackson .annotation .JsonProperty ;
2324import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
2425import com .fasterxml .jackson .databind .annotation .JsonSerialize ;
2526import com .spotify .github .GithubStyle ;
27+
2628import java .net .URI ;
2729import javax .annotation .Nullable ;
30+
2831import org .immutables .value .Value ;
2932
30- /** Issue label resource */
33+ /**
34+ * Issue label resource
35+ */
3136@ Value .Immutable
3237@ GithubStyle
3338@ JsonSerialize (as = ImmutableLabel .class )
3439@ JsonDeserialize (as = ImmutableLabel .class )
3540public interface Label {
3641
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 ();
4067
41- /** Name */
42- @ Nullable
43- String name ();
68+ @ Nullable
69+ String description ();
4470
45- /** Color */
46- @ Nullable
47- String color ();
71+ /**
72+ * Default
73+ */
74+ @ JsonProperty ("default" )
75+ boolean isDefault ();
4876}
Original file line number Diff line number Diff line change 2424import com .fasterxml .jackson .databind .annotation .JsonSerialize ;
2525import com .spotify .github .GithubStyle ;
2626import com .spotify .github .v3 .User ;
27+
28+ import java .util .List ;
2729import java .util .Optional ;
2830import javax .annotation .Nullable ;
31+
32+ import com .spotify .github .v3 .issues .Label ;
2933import org .immutables .value .Value ;
3034
3135/**
@@ -80,4 +84,7 @@ public interface PullRequest extends PullRequestItem {
8084
8185 /** Is it a draft PR? */
8286 Optional <Boolean > draft ();
87+
88+ @ Nullable
89+ List <Label > labels ();
8390}
Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ public void testDeserializationPr() throws IOException {
4747 assertThat (pr .deletions (), is (3 ));
4848 assertThat (pr .changedFiles (), is (5 ));
4949 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" ));
5054 }
5155
5256 @ Test
Original file line number Diff line number Diff line change 6969 "closed_at" : " 2013-02-12T13:22:01Z" ,
7070 "due_on" : " 2012-10-09T23:39:01Z"
7171 },
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+ ],
7282 "locked" : false ,
7383 "created_at" : " 2011-01-26T19:01:12Z" ,
7484 "updated_at" : " 2011-01-26T19:01:12Z" ,
Original file line number Diff line number Diff line change 3232 },
3333 "labels" : [
3434 {
35+ "id" : 42 ,
36+ "node_id" : " MDU6TGFiZWw0Mg==" ,
3537 "url" : " https://api.github.com/repos/batterseapower/pinyin-toolkit/labels/bug" ,
3638 "name" : " bug" ,
37- "color" : " ff0000"
39+ "color" : " ff0000" ,
40+ "default" : true
3841 }
3942 ],
4043 "state" : " open" ,
You can’t perform that action at this time.
0 commit comments