@@ -15,7 +15,7 @@ public class Subreddit : Thing
15
15
private const string SubredditPostUrl = "/r/{0}.json" ;
16
16
private const string SubredditNewUrl = "/r/{0}/new.json?sort=new" ;
17
17
private const string SubredditHotUrl = "/r/{0}/hot.json" ;
18
- private const string SubredditRisingUrl = "/r/{0}/rising.json" ;
18
+ private const string SubredditRisingUrl = "/r/{0}/rising.json" ;
19
19
private const string SubredditTopUrl = "/r/{0}/top.json?t={1}" ;
20
20
private const string SubscribeUrl = "/api/subscribe" ;
21
21
private const string GetSettingsUrl = "/r/{0}/about/edit.json" ;
@@ -40,6 +40,7 @@ public class Subreddit : Thing
40
40
private const string CommentsUrl = "/r/{0}/comments.json" ;
41
41
private const string SearchUrl = "/r/{0}/search.json?q={1}&restrict_sr=on&sort={2}&t={3}" ;
42
42
private const string SearchUrlDate = "/r/{0}/search.json?q=timestamp:{1}..{2}&restrict_sr=on&sort={3}&syntax=cloudsearch" ;
43
+ private const string ModLogUrl = "/r/{0}/about/log.json" ;
43
44
44
45
[ JsonIgnore ]
45
46
private Reddit Reddit { get ; set ; }
@@ -157,17 +158,17 @@ public Listing<Post> Hot
157
158
return new Listing < Post > ( Reddit , "/.json" , WebAgent ) ;
158
159
return new Listing < Post > ( Reddit , string . Format ( SubredditHotUrl , Name ) , WebAgent ) ;
159
160
}
160
- }
161
- public Listing < Post > Rising
162
- {
163
- get
164
- {
165
- if ( Name == "/" )
166
- return new Listing < Post > ( Reddit , "/.json" , WebAgent ) ;
167
- return new Listing < Post > ( Reddit , string . Format ( SubredditRisingUrl , Name ) , WebAgent ) ;
168
- }
169
- }
170
-
161
+ }
162
+ public Listing < Post > Rising
163
+ {
164
+ get
165
+ {
166
+ if ( Name == "/" )
167
+ return new Listing < Post > ( Reddit , "/.json" , WebAgent ) ;
168
+ return new Listing < Post > ( Reddit , string . Format ( SubredditRisingUrl , Name ) , WebAgent ) ;
169
+ }
170
+ }
171
+
171
172
public Listing < VotableThing > ModQueue
172
173
{
173
174
get
@@ -191,8 +192,8 @@ public Listing<Post> Search(string terms)
191
192
192
193
public Listing < Post > Search ( DateTime from , DateTime to , Sorting sortE = Sorting . New )
193
194
{
194
- string sort = sortE . ToString ( ) . ToLower ( ) ;
195
-
195
+ string sort = sortE . ToString ( ) . ToLower ( ) ;
196
+
196
197
return new Listing < Post > ( Reddit , string . Format ( SearchUrlDate , Name , from . DateTimeToUnixTimestamp ( ) , to . DateTimeToUnixTimestamp ( ) , sort ) , WebAgent ) ;
197
198
}
198
199
@@ -661,7 +662,39 @@ public Post SubmitTextPost(string title, string text, string captchaId = "", str
661
662
Captcha = captchaAnswer
662
663
} ) ;
663
664
}
664
-
665
+ /// <summary>
666
+ /// Gets the moderation log of the current subreddit
667
+ /// </summary>
668
+ public Listing < ModAction > GetModerationLog ( )
669
+ {
670
+ return new Listing < ModAction > ( Reddit , string . Format ( ModLogUrl , this . Name ) , WebAgent ) ;
671
+ }
672
+ /// <summary>
673
+ /// Gets the moderation log of the current subreddit filtered by the action taken
674
+ /// </summary>
675
+ /// <param name="action">ModActionType of action performed</param>
676
+ public Listing < ModAction > GetModerationLog ( ModActionType action )
677
+ {
678
+ return new Listing < ModAction > ( Reddit , string . Format ( ModLogUrl + "?type={1}" , Name , ModActionTypeConverter . GetRedditParamName ( action ) ) , WebAgent ) ;
679
+ }
680
+ /// <summary>
681
+ /// Gets the moderation log of the current subreddit filtered by moderator(s) who performed the action
682
+ /// </summary>
683
+ /// <param name="mods">String array of mods to filter by</param>
684
+ public Listing < ModAction > GetModerationLog ( string [ ] mods )
685
+ {
686
+ return new Listing < ModAction > ( Reddit , string . Format ( ModLogUrl + "?mod={1}" , Name , string . Join ( "," , mods ) ) , WebAgent ) ;
687
+ }
688
+ /// <summary>
689
+ /// Gets the moderation log of the current subreddit filtered by the action taken and moderator(s) who performed the action
690
+ /// </summary>
691
+ /// <param name="action">ModActionType of action performed</param>
692
+ /// <param name="mods">String array of mods to filter by</param>
693
+ /// <returns></returns>
694
+ public Listing < ModAction > GetModerationLog ( ModActionType action , string [ ] mods )
695
+ {
696
+ return new Listing < ModAction > ( Reddit , string . Format ( ModLogUrl + "?type={1}&mod={2}" , Name , ModActionTypeConverter . GetRedditParamName ( action ) , string . Join ( "," , mods ) ) , WebAgent ) ;
697
+ }
665
698
#region Obsolete Getter Methods
666
699
667
700
[ Obsolete ( "Use Posts property instead" ) ]
0 commit comments