Skip to content

Commit 9de946b

Browse files
committed
Merge pull request #216 from tomnolan95/master
List of Subreddits related to param.
2 parents 5be133d + b6d4071 commit 9de946b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
###############################################################################
22
# Set default behavior to automatically normalize line endings.
33
###############################################################################
4-
* text=auto
4+
#* text=auto
55

66
###############################################################################
77
# Set default behavior for command prompt diff.

RedditSharp/Reddit.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public class Reddit
3636
private const string PopularSubredditsUrl = "/subreddits/popular.json";
3737
private const string GoldSubredditsUrl = "/subreddits/gold.json";
3838
private const string DefaultSubredditsUrl = "/subreddits/default.json";
39+
private const string SearchSubredditsUrl = "/subreddits/search.json?q={0}";
40+
3941

4042
#endregion
4143

@@ -439,6 +441,15 @@ public Listing<Subreddit> GetGoldSubreddits()
439441
public Listing<Subreddit> GetDefaultSubreddits()
440442
{
441443
return new Listing<Subreddit>(this, DefaultSubredditsUrl, WebAgent);
444+
}
445+
446+
/// <summary>
447+
/// Returns the Listing of subreddits related to a query.
448+
/// </summary>
449+
/// <returns></returns>
450+
public Listing<Subreddit> SearchSubreddits(string query)
451+
{
452+
return new Listing<Subreddit>(this, string.Format(SearchSubredditsUrl, query), WebAgent);
442453
}
443454

444455
#endregion SubredditSearching

0 commit comments

Comments
 (0)