Skip to content

Commit b95503f

Browse files
committed
Add more info to Creation object
1 parent 6f8c387 commit b95503f

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
package com.creatubbles.api.core;
22

33
public class Creation {
4+
45
public String id, user_id;
5-
public String name, created_at;
6+
public String[] creator_ids;
7+
public String name, created_at, created_at_age;
68
public int created_at_month, created_at_year, comments_count, bubble_count, views_count;
79
public String last_bubbled_at, last_commented_at, last_submitted_at;
810
public Image image;
11+
public String short_url;
12+
13+
@Deprecated
14+
public Creator[] creators;
15+
/**
16+
* @see #short_url
17+
* @see Image#links
18+
*/
19+
@Deprecated
920
public String store_dir;
21+
/**
22+
* @see #short_url
23+
* @see Image#links
24+
*/
25+
@Deprecated
1026
public String url;
1127
}

src/main/java/com/creatubbles/api/core/Image.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public class Image {
77
public Map<ImageType, String> links;
88

99
public enum ImageType {
10+
original,
1011
full_view,
1112
list_view_retina,
1213
list_view,

src/main/java/com/creatubbles/api/response/creation/GetCreationsResponse.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ private void deserializeData(JsonObject jsonObject) {
4545
if (idE != null && attributes != null) {
4646
Creation creation = CreatubblesAPI.GSON.fromJson(attributes, Creation.class);
4747
creation.id = idE.getAsString();
48+
49+
JsonObject relationships = obj.getAsJsonObject("relationships");
50+
JsonObject user = relationships.getAsJsonObject("user");
51+
creation.user_id = user.getAsJsonObject("data").getAsJsonPrimitive("id").getAsString();
52+
JsonArray creators = relationships.getAsJsonObject("creators").getAsJsonArray("data");
53+
creation.creator_ids = new String[creators.size()];
54+
for (int j = 0; j < creators.size(); j++) {
55+
creation.creator_ids[j] = creators.get(j).getAsJsonObject().getAsJsonPrimitive("id").getAsString();
56+
}
57+
4858
creations.add(creation);
4959
}
5060
}

0 commit comments

Comments
 (0)