File tree Expand file tree Collapse file tree 2 files changed +16
-13
lines changed
src/main/java/me/memerator/api/object Expand file tree Collapse file tree 2 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -98,18 +98,6 @@ public int getNotificationCount() {
9898 return new JSONObject (MemeratorAPI .api .get ("/notifications/count" )).getInt ("count" );
9999 }
100100
101- /**
102- * @return a list of your memes
103- */
104- public List <Meme > getMemes () {
105- JSONArray response = new JSONArray (MemeratorAPI .api .get ("/mymemes" ));
106- List <Meme > memes = new ArrayList <>();
107- for (int i = 0 ; i < response .length (); i ++) {
108- memes .add (new Meme ((JSONObject ) response .get (i )));
109- }
110- return memes ;
111- }
112-
113101 /**
114102 * Returns as a UserIntegrations object, from there you can get each integration type.
115103 * @return the integrations.
Original file line number Diff line number Diff line change 11package me .memerator .api .object ;
22
3+ import me .memerator .api .MemeratorAPI ;
4+ import org .json .JSONArray ;
35import org .json .JSONObject ;
46
57import java .time .Instant ;
8+ import java .util .ArrayList ;
9+ import java .util .List ;
610
711public class User {
812 JSONObject values ;
@@ -101,11 +105,22 @@ public String getJoinedAt() {
101105 return values .getString ("joined" );
102106 }
103107
104-
105108 /**
106109 * @return the user's join timestamp
107110 */
108111 public Instant getJoinTimestamp () {
109112 return Instant .ofEpochSecond (values .getLong ("joined_epoch_seconds" ));
110113 }
114+
115+ /**
116+ * @return a list of this user's memes
117+ */
118+ public List <Meme > getMemes () {
119+ JSONArray response = new JSONArray (MemeratorAPI .api .get ("/profile/" + getId () + "/memes" ));
120+ List <Meme > memes = new ArrayList <>();
121+ for (int i = 0 ; i < response .length (); i ++) {
122+ memes .add (new Meme ((JSONObject ) response .get (i )));
123+ }
124+ return memes ;
125+ }
111126}
You can’t perform that action at this time.
0 commit comments