Skip to content

Commit 1659d38

Browse files
committed
Merge pull request #204 from RoboCafaz/master
/subreddits/where access
2 parents 043ad10 + ff78112 commit 1659d38

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

RedditSharp/Reddit.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ public class Reddit
3232
private const string OAuthDomainUrl = "oauth.reddit.com";
3333
private const string SearchUrl = "/search.json?q={0}&restrict_sr=off&sort={1}&t={2}";
3434
private const string UrlSearchPattern = "url:'{0}'";
35+
private const string NewSubredditsUrl = "/subreddits/new.json";
36+
private const string PopularSubredditsUrl = "/subreddits/popular.json";
37+
private const string GoldSubredditsUrl = "/subreddits/gold.json";
38+
private const string DefaultSubredditsUrl = "/subreddits/default.json";
3539

3640
#endregion
3741

@@ -397,6 +401,48 @@ public Listing<T> Search<T>(string query, Sorting sortE = Sorting.Relevance, Tim
397401
return new Listing<T>(this, string.Format(SearchUrl, query, sort, time), WebAgent);
398402
}
399403

404+
405+
406+
#region SubredditSearching
407+
408+
/// <summary>
409+
/// Returns a Listing of newly created subreddits.
410+
/// </summary>
411+
/// <returns></returns>
412+
public Listing<Subreddit> GetNewSubreddits()
413+
{
414+
return new Listing<Subreddit>(this, NewSubredditsUrl, WebAgent);
415+
}
416+
417+
/// <summary>
418+
/// Returns a Listing of the most popular subreddits.
419+
/// </summary>
420+
/// <returns></returns>
421+
public Listing<Subreddit> GetPopularSubreddits()
422+
{
423+
return new Listing<Subreddit>(this, PopularSubredditsUrl, WebAgent);
424+
}
425+
426+
/// <summary>
427+
/// Returns a Listing of Gold-only subreddits. This endpoint will not return anything if the authenticated Reddit account does not currently have gold.
428+
/// </summary>
429+
/// <returns></returns>
430+
public Listing<Subreddit> GetGoldSubreddits()
431+
{
432+
return new Listing<Subreddit>(this, GoldSubredditsUrl, WebAgent);
433+
}
434+
435+
/// <summary>
436+
/// Returns the Listing of default subreddits.
437+
/// </summary>
438+
/// <returns></returns>
439+
public Listing<Subreddit> GetDefaultSubreddits()
440+
{
441+
return new Listing<Subreddit>(this, DefaultSubredditsUrl, WebAgent);
442+
}
443+
444+
#endregion SubredditSearching
445+
400446
#region Helpers
401447

402448
protected async internal Task<T> GetThingAsync<T>(string url) where T : Thing

0 commit comments

Comments
 (0)