Skip to content
Merged
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
52 changes: 40 additions & 12 deletions src/main/java/com/spotify/github/v3/issues/Label.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 @@ -20,29 +20,57 @@

package com.spotify.github.v3.issues;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.spotify.github.GithubStyle;

import java.net.URI;
import javax.annotation.Nullable;

import org.immutables.value.Value;

/** Issue label resource */
/**
* Issue label resource
*/
@Value.Immutable
@GithubStyle
@JsonSerialize(as = ImmutableLabel.class)
@JsonDeserialize(as = ImmutableLabel.class)
public interface Label {

/** URL */
@Nullable
URI url();
/**
* Id
*/
Long id();

@Nullable
String nodeId();

/**
* URL
*/
@Nullable
URI url();

/**
* Name
*/
@Nullable
String name();

/**
* Color
*/
@Nullable
String color();

/** Name */
@Nullable
String name();
@Nullable
String description();

/** Color */
@Nullable
String color();
/**
* Default
*/
@JsonProperty("default")
boolean isDefault();
}
7 changes: 7 additions & 0 deletions src/main/java/com/spotify/github/v3/prs/PullRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.spotify.github.GithubStyle;
import com.spotify.github.v3.User;

import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;

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

/**
Expand Down Expand Up @@ -80,4 +84,7 @@ public interface PullRequest extends PullRequestItem {

/** Is it a draft PR? */
Optional<Boolean> draft();

@Nullable
List<Label> labels();
}
4 changes: 4 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 @@ -47,6 +47,10 @@ public void testDeserializationPr() throws IOException {
assertThat(pr.deletions(), is(3));
assertThat(pr.changedFiles(), is(5));
assertThat(pr.draft(), is(Optional.of(false)));
assertThat(pr.labels().size(),is(1));
assertThat(pr.labels().get(0).name(),is("bug"));
assertThat(pr.labels().get(0).id(),is(42L));
assertThat(pr.labels().get(0).color(),is("ff0000"));
}

@Test
Expand Down
10 changes: 10 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 @@ -69,6 +69,16 @@
"closed_at": "2013-02-12T13:22:01Z",
"due_on": "2012-10-09T23:39:01Z"
},
"labels": [
{
"id": 42,
"node_id": "MDU6TGFiZWw0Mg==",
"url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/labels/bug",
"name": "bug",
"color": "ff0000",
"default": true
}
],
"locked": false,
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:01:12Z",
Expand Down
5 changes: 4 additions & 1 deletion src/test/resources/com/spotify/github/v3/search/issues.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@
},
"labels": [
{
"id": 42,
"node_id": "MDU6TGFiZWw0Mg==",
"url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/labels/bug",
"name": "bug",
"color": "ff0000"
"color": "ff0000",
"default": true
}
],
"state": "open",
Expand Down