File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,9 @@ namespace RedditSharp.Things
13
13
public class Comment : VotableThing
14
14
{
15
15
private const string CommentUrl = "/api/comment" ;
16
- private const string EditUserTextUrl = "/api/editusertext" ;
17
- private const string RemoveUrl = "/api/remove" ;
16
+ private const string EditUserTextUrl = "/api/editusertext" ;
17
+ private const string RemoveUrl = "/api/remove" ;
18
+ private const string DelUrl = "/api/del" ;
18
19
private const string SetAsReadUrl = "/api/read_message" ;
19
20
20
21
[ JsonIgnore ]
@@ -187,6 +188,28 @@ public void EditText(string newText)
187
188
Body = newText ;
188
189
else
189
190
throw new Exception ( "Error editing text." ) ;
191
+ }
192
+
193
+ private string SimpleAction ( string endpoint )
194
+ {
195
+ if ( Reddit . User == null )
196
+ throw new AuthenticationException ( "No user logged in." ) ;
197
+ var request = WebAgent . CreatePost ( endpoint ) ;
198
+ var stream = request . GetRequestStream ( ) ;
199
+ WebAgent . WritePostBody ( stream , new
200
+ {
201
+ id = FullName ,
202
+ uh = Reddit . User . Modhash
203
+ } ) ;
204
+ stream . Close ( ) ;
205
+ var response = request . GetResponse ( ) ;
206
+ var data = WebAgent . GetResponseString ( response . GetResponseStream ( ) ) ;
207
+ return data ;
208
+ }
209
+
210
+ public void Del ( )
211
+ {
212
+ var data = SimpleAction ( DelUrl ) ;
190
213
}
191
214
192
215
public void Remove ( )
You can’t perform that action at this time.
0 commit comments