From 5cfe8a601645383d0068f9acded1e99aa5f28459 Mon Sep 17 00:00:00 2001 From: andrewrasch Date: Tue, 21 Sep 2021 23:01:17 -0400 Subject: Added API call for generic wiki page. Updated old wiki-only call to cascade to new generic. --- .../infinityforreddit/activities/WikiActivity.java | 1 + .../java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java index f4cc17fa..b6fc29af 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java @@ -71,6 +71,7 @@ import retrofit2.Retrofit; public class WikiActivity extends BaseActivity { public static final String EXTRA_SUBREDDIT_NAME = "ESN"; + public static final String WIKI_PATH = "WP"; private static final String WIKI_MARKDOWN_STATE = "WMS"; @BindView(R.id.coordinator_layout_comment_wiki_activity) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java b/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java index 91b96c70..a7c67893 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java @@ -294,8 +294,12 @@ public interface RedditAPI { @GET("/api/trending_searches_v1.json?withAds=0&raw_json=1&gilding_detail=1") Call getTrendingSearches(@HeaderMap Map headers); - @GET("/r/{subredditName}/wiki/index.json?raw_json=1") - Call getWiki(@Path("subredditName") String subredditName); + default Call getWiki(@Path("subredditName") String subredditName) { + return getWikiPage(subredditName, "index"); + }; + + @GET("/r/{subredditName}/wiki/{wikiPage}.json?raw_json=1") + Call getWikiPage(@Path("subredditName") String subredditName, @Path("wikiPage") String wikiPage); @GET("{sortType}?raw_json=1") ListenableFuture> getBestPostsListenableFuture(@Path("sortType") String sortType, @Query("after") String lastItem, @HeaderMap Map headers); -- cgit v1.2.3