Skip to content

Commit a678512

Browse files
committed
Implement adaption info
1 parent 805a392 commit a678512

7 files changed

Lines changed: 68 additions & 7 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package me.proxer.library.entity.info;
2+
3+
import com.squareup.moshi.Json;
4+
import lombok.EqualsAndHashCode;
5+
import lombok.Getter;
6+
import lombok.Value;
7+
import me.proxer.library.entity.ProxerIdItem;
8+
import me.proxer.library.enums.Medium;
9+
10+
import javax.annotation.Nullable;
11+
12+
@Value
13+
@EqualsAndHashCode(onParam = @__({@Nullable}))
14+
public class AdaptionInfo implements ProxerIdItem {
15+
16+
/**
17+
* Returns the id of this comment.
18+
*/
19+
@Getter(onMethod = @__({@Override}))
20+
@Json(name = "id")
21+
private String id;
22+
23+
/**
24+
* Returns the medium
25+
*/
26+
@Json(name = "name")
27+
private String name;
28+
29+
/**
30+
* Returns the medium
31+
*/
32+
@Json(name = "medium")
33+
private Medium medium;
34+
}

library/src/main/java/me/proxer/library/entity/info/Entry.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ public class Entry implements ProxerIdItem {
101101
@Json(name = "license")
102102
private License license;
103103

104+
/**
105+
* Returns information regarding the adaption of this entry.
106+
*/
107+
@Json(name = "adaption_data")
108+
private AdaptionInfo adaptionInfo;
109+
104110
/**
105111
* Returns true, if this entry is age restricted.
106112
*/

library/src/main/java/me/proxer/library/entity/info/EntryCore.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ public class EntryCore implements ProxerIdItem {
9999
@Json(name = "license")
100100
private License license;
101101

102+
/**
103+
* Returns information regarding the adaption of this entry.
104+
*/
105+
@Json(name = "adaption_data")
106+
private AdaptionInfo adaptionInfo;
107+
102108
/**
103109
* Returns the average of all ratings.
104110
*/

library/src/test/java/me/proxer/library/api/info/EntryCoreEndpointTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import me.proxer.library.ProxerTest;
44
import me.proxer.library.api.ProxerException;
5+
import me.proxer.library.entity.info.AdaptionInfo;
56
import me.proxer.library.entity.info.EntryCore;
67
import me.proxer.library.enums.*;
78
import okhttp3.mockwebserver.MockResponse;
@@ -51,6 +52,7 @@ private EntryCore buildTestEntry() {
5152
+ "decent again. Of course, the angels can't simply allow demons to roam freely on Earth, "
5253
+ "and they do their best to stop Lucu and her dastardly plans.",
5354
Medium.MANGASERIES, 90, MediaState.FINISHED, 7, 1, 134,
54-
Category.MANGA, License.NOT_LICENSED);
55+
Category.MANGA, License.NOT_LICENSED,
56+
new AdaptionInfo("2793", "KissXsis", Medium.MANGASERIES));
5557
}
5658
}

library/src/test/java/me/proxer/library/api/info/EntryEndpointTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ private Entry buildTestEntry() throws ParseException {
5656
+ "decent again. Of course, the angels can't simply allow demons to roam freely on Earth, "
5757
+ "and they do their best to stop Lucu and her dastardly plans.",
5858
Medium.MANGASERIES, 90, MediaState.FINISHED, 7, 1, 134,
59-
Category.MANGA, License.NOT_LICENSED, false, Arrays.asList(
59+
Category.MANGA, License.NOT_LICENSED, new AdaptionInfo("2793", "KissXsis", Medium.MANGASERIES),
60+
false, Arrays.asList(
6061
new Synonym("12322", "6174", SynonymType.ORIGINAL, "LuCu LuCu"),
6162
new Synonym("12323", "6174", SynonymType.JAPANESE, "るくるく"),
6263
new Synonym("44662", "6174", SynonymType.ORIGINAL_ALTERNATIVE, "Lucu Lucu"),

library/src/test/resources/entry.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,21 @@
88
"fsk": "",
99
"description": "Humans are a despicable lot, committing sin after sin, filling the endless boundaries of the underworld with tortured souls. Now, it would seem, Hell isn't so endless after all, and it has become dangerously close to filling, and then overflowing into the human realm. Princess Lucuha sees this imminent disaster and has a plan: save Hell by making humans decent again. Of course, the angels can't simply allow demons to roam freely on Earth, and they do their best to stop Lucu and her dastardly plans.",
1010
"medium": "mangaseries",
11-
"adaption_type": "",
12-
"adaption_value": "",
11+
"media_format": "tv",
12+
"adaption_type": "entry",
13+
"adaption_value": "2793",
1314
"count": "90",
1415
"state": "1",
1516
"rate_sum": "7",
1617
"rate_count": "1",
1718
"clicks": "134",
1819
"kat": "manga",
1920
"license": "1",
21+
"adaption_data": {
22+
"id": "2793",
23+
"name": "KissXsis",
24+
"medium": "mangaseries"
25+
},
2026
"names": [
2127
{
2228
"id": "12322",

library/src/test/resources/entry_core.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@
88
"fsk": "bad_language",
99
"description": "Humans are a despicable lot, committing sin after sin, filling the endless boundaries of the underworld with tortured souls. Now, it would seem, Hell isn't so endless after all, and it has become dangerously close to filling, and then overflowing into the human realm. Princess Lucuha sees this imminent disaster and has a plan: save Hell by making humans decent again. Of course, the angels can't simply allow demons to roam freely on Earth, and they do their best to stop Lucu and her dastardly plans.",
1010
"medium": "mangaseries",
11-
"adaption_type": "",
12-
"adaption_value": "",
11+
"media_format": "tv",
12+
"adaption_type": "entry",
13+
"adaption_value": "2793",
1314
"count": "90",
1415
"state": "1",
1516
"rate_sum": "7",
1617
"rate_count": "1",
1718
"clicks": "134",
1819
"kat": "manga",
19-
"license": "1"
20+
"license": "1",
21+
"adaption_data": {
22+
"id": "2793",
23+
"name": "KissXsis",
24+
"medium": "mangaseries"
25+
}
2026
}
2127
}

0 commit comments

Comments
 (0)