Skip to content

Commit da2c9cc

Browse files
committed
Update Gradle and extend the forum post api
1 parent 15bcbd2 commit da2c9cc

8 files changed

Lines changed: 53 additions & 18 deletions

File tree

gradle/versions.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ext {
22
version = '4.2.1'
33
group = 'com.github.proxer'
44

5-
gradleVersion = '4.3.1'
5+
gradleVersion = '4.4.1'
66

77
errorpronePluginVersion = '0.0.13'
88
gradleVersionsPluginVersion = '0.17.0'

gradle/wrapper/gradle-wrapper.jar

1 Byte
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip

library/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ javadoc {
140140
}
141141

142142
jacoco {
143-
setToolVersion(jacocoVersion)
143+
setVersion(jacocoVersion)
144144
}
145145

146146
jacocoTestReport {
@@ -151,18 +151,18 @@ jacocoTestReport {
151151
}
152152

153153
checkstyle {
154-
setToolVersion(checkstyleVersion)
154+
setVersion(checkstyleVersion)
155155
}
156156

157157
findbugs {
158158
excludeFilter = file('config/findbugs/findbugs-filter.xml')
159159
sourceSets = [sourceSets.main]
160160

161-
setToolVersion(findbugsVersion)
161+
setVersion(findbugsVersion)
162162
}
163163

164164
pmd {
165-
setToolVersion(pmdVersion)
165+
setVersion(pmdVersion)
166166
}
167167

168168
tasks.withType(FindBugs) {

library/src/main/java/me/proxer/library/api/forum/ForumApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* @author Ruben Gees
99
*/
10-
public class ForumApi {
10+
public final class ForumApi {
1111

1212
private final InternalApi internalApi;
1313

library/src/main/java/me/proxer/library/entity/forum/Post.java

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import lombok.Value;
77
import me.proxer.library.entity.ProxerDateItem;
88
import me.proxer.library.entity.ProxerIdItem;
9+
import me.proxer.library.entity.ProxerImageItem;
910

1011
import javax.annotation.Nullable;
1112
import java.util.Date;
@@ -15,7 +16,7 @@
1516
*/
1617
@Value
1718
@EqualsAndHashCode(onParam = @__({@Nullable}))
18-
public class Post implements ProxerIdItem, ProxerDateItem {
19+
public class Post implements ProxerIdItem, ProxerImageItem, ProxerDateItem {
1920

2021
/**
2122
* Returns the id of this post.
@@ -42,13 +43,28 @@ public class Post implements ProxerIdItem, ProxerDateItem {
4243
@Json(name = "username")
4344
private String username;
4445

46+
/**
47+
* Returns the image id.
48+
*/
49+
@Getter(onMethod = @__({@Override}))
50+
@Json(name = "avatar")
51+
private String image;
52+
4553
/**
4654
* Returns the time, the post was updated the last time.
4755
*/
4856
@Getter(onMethod = @__({@Override}))
4957
@Json(name = "time")
5058
private Date date;
5159

60+
/**
61+
* Returns the signature of the user.
62+
*/
63+
@Nullable
64+
@Getter
65+
@Json(name = "signature")
66+
private String signature;
67+
5268
/**
5369
* Returns the id of the last user which modified this post.
5470
*/
@@ -87,19 +103,29 @@ public class Post implements ProxerIdItem, ProxerDateItem {
87103
@Json(name = "message")
88104
private String message;
89105

106+
/**
107+
* Returns the amount of given "thank you".
108+
*/
109+
@Json(name = "thank_you_count")
110+
private int thankYouAmount;
111+
90112
@SuppressWarnings("checkstyle:parameternumber")
91-
public Post(final String id, final String parentId, final String userId, final String username, final Date date,
92-
@Nullable final String modifiedById, @Nullable final String modifiedByName,
93-
@Nullable final Date modifiedDate, @Nullable final String modifiedReason, final String message) {
113+
public Post(final String id, final String parentId, final String userId, final String username, final String image,
114+
final Date date, @Nullable final String signature, @Nullable final String modifiedById,
115+
@Nullable final String modifiedByName, @Nullable final Date modifiedDate,
116+
@Nullable final String modifiedReason, final String message, final int thankYouAmount) {
94117
this.id = id;
95118
this.parentId = parentId;
96119
this.userId = userId;
97120
this.username = username;
121+
this.image = image;
98122
this.date = date;
123+
this.signature = signature;
99124
this.modifiedById = modifiedById;
100125
this.modifiedByName = modifiedByName;
101126
this.modifiedDate = modifiedDate;
102127
this.modifiedReason = modifiedReason;
103128
this.message = message;
129+
this.thankYouAmount = thankYouAmount;
104130
}
105131
}

library/src/test/java/me/proxer/library/api/forum/TopicEndpointTest.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,17 @@ public void testPath() throws ProxerException, IOException, InterruptedException
4646

4747
private Topic buildTestTopic() {
4848
final List<Post> posts = Arrays.asList(
49-
new Post("811201", "0", "613171", "SilverCrow00", new Date(1513552953L * 1000),
50-
null, null, null, null,
51-
"Wie oft oder wie lange guckt ihr so Anime?"),
52-
new Post("811256", "811201", "139597", "Miss-Otaku", new Date(1513626886L * 1000),
49+
new Post("811201", "0", "613171", "SilverCrow00", "613171_Kxk7cM.jpg",
50+
new Date(1513552953L * 1000), null, null, null,
51+
null, null,
52+
"Wie oft oder wie lange guckt ihr so Anime?", 1),
53+
new Post("811256", "811201", "139597", "Miss-Otaku", "139597_cKc2zC.png",
54+
new Date(1513626886L * 1000), "",
5355
"123", "test", new Date(15135529123L * 1000), "just a test",
5456
"Ich versuche, dass ganze im Rahmen zu halten. Meistens sind es so ungefähr 2-3 "
5557
+ "Folgen und über den Tag verteilt. Leider werde ich oft schwach, gerade bei "
56-
+ "besonders spannenden Anime, dass ich auch mehrere Folgen am Stück anschaue.")
58+
+ "besonders spannenden Anime, dass ich auch mehrere Folgen am Stück anschaue.",
59+
0)
5760
);
5861

5962
return new Topic("19", "Proxer Umfragen",

library/src/test/resources/forum_topic.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,30 @@
1616
"pid": "0",
1717
"uid": "613171",
1818
"username": "SilverCrow00",
19+
"avatar": "613171_Kxk7cM.jpg",
20+
"signature": null,
1921
"time": "1513552953",
2022
"modified_by": null,
2123
"modified_name": null,
2224
"modified_time": null,
2325
"modified_reason": null,
24-
"message": "Wie oft oder wie lange guckt ihr so Anime?"
26+
"message": "Wie oft oder wie lange guckt ihr so Anime?",
27+
"thank_you_count": "1"
2528
},
2629
{
2730
"id": "811256",
2831
"pid": "811201",
2932
"uid": "139597",
3033
"username": "Miss-Otaku",
34+
"avatar": "139597_cKc2zC.png",
35+
"signature": "",
3136
"time": "1513626886",
3237
"modified_by": "123",
3338
"modified_name": "test",
3439
"modified_time": "15135529123",
3540
"modified_reason": "just a test",
36-
"message": "Ich versuche, dass ganze im Rahmen zu halten. Meistens sind es so ungefähr 2-3 Folgen und über den Tag verteilt. Leider werde ich oft schwach, gerade bei besonders spannenden Anime, dass ich auch mehrere Folgen am Stück anschaue."
41+
"message": "Ich versuche, dass ganze im Rahmen zu halten. Meistens sind es so ungefähr 2-3 Folgen und über den Tag verteilt. Leider werde ich oft schwach, gerade bei besonders spannenden Anime, dass ich auch mehrere Folgen am Stück anschaue.",
42+
"thank_you_count": "0"
3743
}
3844
]
3945
}

0 commit comments

Comments
 (0)