Skip to content

Commit 6bff4f8

Browse files
committed
Support delete multireddit api method
1 parent b416e88 commit 6bff4f8

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/main/java/org/quantumbadger/redreader/common/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public static final class Reddit {
149149
public static final String PATH_MULTIREDDITS_MINE = "/api/multi/mine.json";
150150
public static final String PATH_COMMENTS = "/comments/";
151151
public static final String PATH_ME = "/api/v1/me";
152+
public static final String PATH_MULTIREDDIT = "/api/multi";
152153

153154
public static String getScheme() {
154155
return SCHEME_HTTPS;

src/main/java/org/quantumbadger/redreader/reddit/RedditAPI.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,43 @@ public void onFailure(@NonNull final RRError error) {
959959
));
960960
}
961961

962+
public static void deleteMultireddit(
963+
final CacheManager cm,
964+
final APIResponseHandler.ActionResponseHandler handler,
965+
final RedditAccount user,
966+
final String multiredditName,
967+
final Context context) {
968+
969+
final Uri.Builder builder = Constants.Reddit.getUriBuilder(
970+
Constants.Reddit.PATH_MULTIREDDIT)
971+
.appendPath("user")
972+
.appendPath(user.username)
973+
.appendPath("m")
974+
.appendPath(multiredditName);
975+
976+
cm.makeRequest(createDeleteRequest(
977+
UriString.from(builder.build()),
978+
user,
979+
context,
980+
new CacheRequestCallbacks() {
981+
@Override
982+
public void onDataStreamAvailable(
983+
@NonNull final GenericFactory<SeekableInputStream, IOException>
984+
streamFactory,
985+
final TimestampUTC timestamp,
986+
@NonNull final UUID session,
987+
final boolean fromCache,
988+
@Nullable final String mimetype) {
989+
handler.notifySuccess();
990+
}
991+
992+
@Override
993+
public void onFailure(@NonNull final RRError error) {
994+
handler.notifyFailure(error);
995+
}
996+
}));
997+
}
998+
962999
@Nullable
9631000
private static APIResponseHandler.APIFailureType findFailureType(final JsonValue response) {
9641001

0 commit comments

Comments
 (0)