@@ -15,17 +15,7 @@ public class Comment : VotableThing
15
15
{
16
16
private const string CommentUrl = "/api/comment" ;
17
17
private const string EditUserTextUrl = "/api/editusertext" ;
18
- private const string RemoveUrl = "/api/remove" ;
19
- private const string DelUrl = "/api/del" ;
20
- private const string ApproveUrl = "/api/approve" ;
21
18
private const string SetAsReadUrl = "/api/read_message" ;
22
- private const string IgnoreReportsUrl = "/api/ignore_reports" ;
23
- private const string UnIgnoreReportsUrl = "/api/unignore_reports" ;
24
-
25
- [ JsonIgnore ]
26
- private Reddit Reddit { get ; set ; }
27
- [ JsonIgnore ]
28
- private IWebAgent WebAgent { get ; set ; }
29
19
30
20
/// <summary>
31
21
/// Initialize.
@@ -175,14 +165,9 @@ private async Task ParseCommentsAsync(Reddit reddit, JToken data, IWebAgent webA
175
165
/// <summary>
176
166
/// Comment author user name.
177
167
/// </summary>
178
- [ JsonProperty ( "author" ) ]
179
- public string Author { get ; set ; }
180
-
181
- /// <summary>
182
- /// Moderator this comment was removed by. Will be null or empty if the comment has not been removed.
183
- /// </summary>
184
- [ JsonProperty ( "banned_by" ) ]
185
- public string BannedBy { get ; set ; }
168
+ [ JsonIgnore ]
169
+ [ Obsolete ( "Use AuthorName instead." , false ) ]
170
+ public string Author => base . AuthorName ;
186
171
187
172
/// <summary>
188
173
/// Comment body markdown.
@@ -208,30 +193,6 @@ private async Task ParseCommentsAsync(Reddit reddit, JToken data, IWebAgent webA
208
193
[ JsonProperty ( "subreddit" ) ]
209
194
public string Subreddit { get ; set ; }
210
195
211
- /// <summary>
212
- /// Moderator this comment was approved by. Will be null or empty if the comment has not been approved.
213
- /// </summary>
214
- [ JsonProperty ( "approved_by" ) ]
215
- public string ApprovedBy { get ; set ; }
216
-
217
- /// <summary>
218
- /// Css class of the authors flair.
219
- /// </summary>
220
- [ JsonProperty ( "author_flair_css_class" ) ]
221
- public string AuthorFlairCssClass { get ; set ; }
222
-
223
- /// <summary>
224
- /// Text of the authors flair.
225
- /// </summary>
226
- [ JsonProperty ( "author_flair_text" ) ]
227
- public string AuthorFlairText { get ; set ; }
228
-
229
- /// <summary>
230
- /// Number of times this comment has been gilded.
231
- /// </summary>
232
- [ JsonProperty ( "gilded" ) ]
233
- public int Gilded { get ; set ; }
234
-
235
196
/// <summary>
236
197
/// Link id.
237
198
/// </summary>
@@ -244,18 +205,6 @@ private async Task ParseCommentsAsync(Reddit reddit, JToken data, IWebAgent webA
244
205
[ JsonProperty ( "link_title" ) ]
245
206
public string LinkTitle { get ; set ; }
246
207
247
- /// <summary>
248
- /// Number of reports on this comment.
249
- /// </summary>
250
- [ JsonProperty ( "num_reports" ) ]
251
- public int ? NumReports { get ; set ; }
252
-
253
- /// <summary>
254
- /// Returns true if this comment is stickied.
255
- /// </summary>
256
- [ JsonProperty ( "stickied" ) ]
257
- public bool IsStickied { get ; set ; }
258
-
259
208
/// <summary>
260
209
/// More comments.
261
210
/// </summary>
@@ -355,55 +304,6 @@ public void EditText(string newText)
355
304
throw new Exception ( "Error editing text." ) ;
356
305
}
357
306
358
- /// <summary>
359
- /// Approve this comment. Logged in user must be a moderator of parent subreddit.
360
- /// </summary>
361
- public void Approve ( )
362
- {
363
- var data = SimpleAction ( ApproveUrl ) ;
364
- }
365
-
366
- /// <summary>
367
- /// Delete this comment. Logged in user must be a moderator of parent subreddit.
368
- /// or the Author of this comment.
369
- /// </summary>
370
- public void Del ( )
371
- {
372
- var data = SimpleAction ( DelUrl ) ;
373
- }
374
-
375
- /// <summary>
376
- /// Ignore reports on this comment. Logged in user must be a moderator of parent subreddit.
377
- /// </summary>
378
- public void IgnoreReports ( )
379
- {
380
- var data = SimpleAction ( IgnoreReportsUrl ) ;
381
- }
382
-
383
- /// <summary>
384
- /// Unignore reports on this comment. Logged in user must be a moderator of parent subreddit.
385
- /// </summary>
386
- public void UnIgnoreReports ( )
387
- {
388
- var data = SimpleAction ( UnIgnoreReportsUrl ) ;
389
- }
390
-
391
- /// <summary>
392
- /// Remove this comment. Logged in user must be a moderator of parent subreddit.
393
- /// </summary>
394
- public void Remove ( )
395
- {
396
- RemoveImpl ( false ) ;
397
- }
398
-
399
- /// <summary>
400
- /// Remove this comment, flagging it as spam. Logged in user must be a moderator of parent subreddit.
401
- /// </summary>
402
- public void RemoveSpam ( )
403
- {
404
- RemoveImpl ( true ) ;
405
- }
406
-
407
307
/// <summary>
408
308
/// Mark this comment as read.
409
309
/// </summary>
@@ -419,37 +319,5 @@ public void SetAsRead()
419
319
var response = request . GetResponse ( ) ;
420
320
var data = WebAgent . GetResponseString ( response . GetResponseStream ( ) ) ;
421
321
}
422
-
423
- private void RemoveImpl ( bool spam )
424
- {
425
- var request = WebAgent . CreatePost ( RemoveUrl ) ;
426
- var stream = request . GetRequestStream ( ) ;
427
- WebAgent . WritePostBody ( stream , new
428
- {
429
- id = FullName ,
430
- spam = spam ,
431
- uh = Reddit . User . Modhash
432
- } ) ;
433
- stream . Close ( ) ;
434
- var response = request . GetResponse ( ) ;
435
- var data = WebAgent . GetResponseString ( response . GetResponseStream ( ) ) ;
436
- }
437
-
438
- private string SimpleAction ( string endpoint )
439
- {
440
- if ( Reddit . User == null )
441
- throw new AuthenticationException ( "No user logged in." ) ;
442
- var request = WebAgent . CreatePost ( endpoint ) ;
443
- var stream = request . GetRequestStream ( ) ;
444
- WebAgent . WritePostBody ( stream , new
445
- {
446
- id = FullName ,
447
- uh = Reddit . User . Modhash
448
- } ) ;
449
- stream . Close ( ) ;
450
- var response = request . GetResponse ( ) ;
451
- var data = WebAgent . GetResponseString ( response . GetResponseStream ( ) ) ;
452
- return data ;
453
- }
454
322
}
455
323
}
0 commit comments