File tree Expand file tree Collapse file tree 6 files changed +81
-29
lines changed
main/java/com/spotify/github/v3
test/java/com/spotify/github/v3 Expand file tree Collapse file tree 6 files changed +81
-29
lines changed Original file line number Diff line number Diff line change 2222
2323import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
2424import com .spotify .github .GithubStyle ;
25+
26+ import java .util .List ;
2527import java .util .Optional ;
28+
29+ import com .spotify .github .v3 .prs .PartialPullRequestItem ;
2630import org .immutables .value .Value ;
2731
2832/** The CheckRun response resource. */
@@ -73,4 +77,10 @@ public interface CheckRunResponse extends CheckRunBase {
7377 * @return the optional
7478 */
7579 Optional <App > app ();
80+
81+ /**
82+ * Pull Requests where this check is applied.
83+ * @return the list of pull requests
84+ */
85+ List <PartialPullRequestItem > pullRequests ();
7686}
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.
2222
2323import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
2424import com .spotify .github .GithubStyle ;
25+
26+ import java .util .List ;
2527import java .util .Optional ;
28+
29+ import com .spotify .github .v3 .prs .PartialPullRequestItem ;
2630import org .immutables .value .Value ;
2731
28- /** Github CheckSuite */
32+ /** GitHub CheckSuite */
2933@ Value .Immutable
3034@ GithubStyle
3135@ JsonDeserialize (as = ImmutableCheckSuite .class )
3236public interface CheckSuite {
3337
3438 /**
35- * The Check Suite Id .
39+ * The Check Suite id .
3640 *
37- * @return the integer
41+ * @return the long id
3842 */
3943 Long id ();
4044
4145 Optional <App > app ();
4246
4347 Optional <String > headBranch ();
48+
49+ /**
50+ * Pull Requests where this check suite is applied.
51+ *
52+ * @return the list of pull requests
53+ */
54+ List <PartialPullRequestItem > pullRequests ();
4455}
Original file line number Diff line number Diff line change 1+ /*-
2+ * -\-\-
3+ * github-api
4+ * --
5+ * Copyright (C) 2016 - 2020 Spotify AB
6+ * --
7+ * Licensed under the Apache License, Version 2.0 (the "License");
8+ * you may not use this file except in compliance with the License.
9+ * You may obtain a copy of the License at
10+ *
11+ * http://www.apache.org/licenses/LICENSE-2.0
12+ *
13+ * Unless required by applicable law or agreed to in writing, software
14+ * distributed under the License is distributed on an "AS IS" BASIS,
15+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+ * See the License for the specific language governing permissions and
17+ * limitations under the License.
18+ * -/-/-
19+ */
20+ package com .spotify .github .v3 .prs ;
21+
22+ import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
23+ import com .fasterxml .jackson .databind .annotation .JsonSerialize ;
24+ import com .spotify .github .CloseTracking ;
25+ import com .spotify .github .GithubStyle ;
26+ import org .immutables .value .Value ;
27+
28+ import javax .annotation .Nullable ;
29+ import java .net .URI ;
30+
31+ @ Value .Immutable
32+ @ GithubStyle
33+ @ JsonSerialize (as = ImmutablePartialPullRequestItem .class )
34+ @ JsonDeserialize (as = ImmutablePartialPullRequestItem .class )
35+ public interface PartialPullRequestItem extends CloseTracking {
36+ /** ID. */
37+ Long id ();
38+
39+ /** URL. */
40+ URI url ();
41+
42+ /** Number. */
43+ Long number ();
44+
45+ /** Head reference. */
46+ @ Nullable
47+ PullRequestRef head ();
48+
49+ /** Base reference. */
50+ @ Nullable
51+ PullRequestRef base ();
52+ }
Original file line number Diff line number Diff line change 2323import com .fasterxml .jackson .annotation .JsonProperty ;
2424import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
2525import com .fasterxml .jackson .databind .annotation .JsonSerialize ;
26- import com .spotify .github .CloseTracking ;
2726import com .spotify .github .GitHubInstant ;
2827import com .spotify .github .GithubStyle ;
2928import com .spotify .github .v3 .Milestone ;
3938@ GithubStyle
4039@ JsonSerialize (as = ImmutablePullRequestItem .class )
4140@ JsonDeserialize (as = ImmutablePullRequestItem .class )
42- public interface PullRequestItem extends CloseTracking {
43-
44- /** ID. */
45- @ Nullable
46- Long id ();
47-
48- /** URL. */
49- @ Nullable
50- URI url ();
41+ public interface PullRequestItem extends PartialPullRequestItem {
5142
5243 /** HTML URL. */
5344 @ Nullable
@@ -69,10 +60,6 @@ public interface PullRequestItem extends CloseTracking {
6960 @ Nullable
7061 URI commitsUrl ();
7162
72- /** Number. */
73- @ Nullable
74- Integer number ();
75-
7663 /** Either open, closed, or all to filter by state. Default: open. */
7764 @ Nullable
7865 String state ();
@@ -100,14 +87,6 @@ public interface PullRequestItem extends CloseTracking {
10087 /** Merged date. */
10188 Optional <GitHubInstant > mergedAt ();
10289
103- /** Head reference. */
104- @ Nullable
105- PullRequestRef head ();
106-
107- /** Base reference. */
108- @ Nullable
109- PullRequestRef base ();
110-
11190 /** User. */
11291 @ Nullable
11392 User user ();
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public void testDeserialization() throws IOException {
4040 final PullRequestReviewEvent statusEvent =
4141 Json .create ().fromJson (fixture , PullRequestReviewEvent .class );
4242 assertThat (statusEvent .action (), is ("submitted" ));
43- assertThat (statusEvent .pullRequest ().number (), is (8 ));
43+ assertThat (statusEvent .pullRequest ().number (), is (8L ));
4444 assertThat (statusEvent .review ().state (), is (ReviewState .APPROVED ));
4545 }
4646}
Original file line number Diff line number Diff line change @@ -286,7 +286,7 @@ public void listPullRequestsForCommit() throws Exception {
286286 .thenReturn (fixture );
287287 final List <PullRequestItem > prs = repoClient .listPullRequestsForCommit ("thesha" ).get ();
288288 assertThat (prs .size (), is (1 ));
289- assertThat (prs .get (0 ).number (), is (1347 ));
289+ assertThat (prs .get (0 ).number (), is (1347L ));
290290 }
291291
292292 @ Test
You can’t perform that action at this time.
0 commit comments