Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/main/java/com/spotify/github/v3/prs/PullRequestItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -32,6 +32,8 @@
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;

import com.spotify.github.v3.issues.Label;
import org.immutables.value.Value;

/** Pull request item resource represents data returned during pull request list operation */
Expand Down Expand Up @@ -112,6 +114,10 @@ public interface PullRequestItem extends CloseTracking {
@Nullable
User user();

/** A list of PR labels */
@Nullable
List<Label> labels();

/** Statuses API URL. */
@Nullable
URI statusesUrl();
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/com/spotify/github/v3/prs/PullRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.google.common.io.Resources;
import com.spotify.github.jackson.Json;
import java.io.IOException;
import java.util.Objects;
import java.util.Optional;
import org.junit.jupiter.api.Test;

Expand All @@ -47,6 +48,8 @@ public void testDeserializationPr() throws IOException {
assertThat(pr.deletions(), is(3));
assertThat(pr.changedFiles(), is(5));
assertThat(pr.draft(), is(Optional.of(false)));
assertThat(Objects.requireNonNull(pr.labels()).size(), is(1));
assertThat(Objects.requireNonNull(pr.labels()).get(0).name(), is("bug"));
}

@Test
Expand Down
6 changes: 5 additions & 1 deletion src/test/resources/com/spotify/github/v3/issues/issue.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@
},
"labels": [
{
"id": 600797884,
"node_id": "MDU6TGFiZWw2MDA3OTc4ODQ=",
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
"name": "bug",
"color": "f29513"
"color": "c5def5",
"default": true,
"description": null
}
],
"assignee": {
Expand Down
11 changes: 11 additions & 0 deletions src/test/resources/com/spotify/github/v3/prs/pull_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,17 @@
"type": "User",
"site_admin": false
},
"labels": [
{
"id": 600797884,
"node_id": "MDU6TGFiZWw2MDA3OTc4ODQ=",
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
"name": "bug",
"color": "c5def5",
"default": true,
"description": null
}
],
"merge_commit_sha": "e5bd3914e2e596debea16f433f57875b5b90bcd6",
"merged": false,
"mergeable": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,5 +345,16 @@
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
},
"labels": [
{
"id": 600797884,
"node_id": "MDU6TGFiZWw2MDA3OTc4ODQ=",
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
"name": "bug",
"color": "c5def5",
"default": true,
"description": null
}
]
}