@@ -15,6 +15,7 @@ public class PrivateMessage : ModeratableThing
15
15
{
16
16
17
17
#region Properties
18
+ private const string SetAsUnReadUrl = "/api/unread_message" ;
18
19
private const string SetAsReadUrl = "/api/read_message" ;
19
20
private const string CommentUrl = "/api/comment" ;
20
21
@@ -158,28 +159,41 @@ public Listing<PrivateMessage> GetThread()
158
159
/// <inheritdoc />
159
160
internal override JToken GetJsonData ( JToken json ) => json [ "data" ] ;
160
161
161
- /// <summary>
162
- /// Mark the message read
162
+ /// <summary>
163
+ /// Reply to the message
163
164
/// </summary>
164
- public async Task SetAsReadAsync ( )
165
+ /// <param name="message">Markdown text.</param>
166
+ public async Task ReplyAsync ( string message )
165
167
{
166
- await WebAgent . Post ( SetAsReadUrl , new
168
+ await WebAgent . Post ( CommentUrl , new
167
169
{
168
- id = FullName ,
169
- api_type = "json"
170
+ text = message ,
171
+ thing_id = FullName
170
172
} ) . ConfigureAwait ( false ) ;
171
173
}
172
174
173
175
/// <summary>
174
- /// Reply to the message
176
+ /// Mark this comment as read.
175
177
/// </summary>
176
- /// <param name="message">Markdown text.</param>
177
- public async Task ReplyAsync ( string message )
178
+ public async Task SetAsReadAsync ( )
178
179
{
179
- await WebAgent . Post ( CommentUrl , new
180
+ await SetReadStatusAsync ( SetAsReadUrl ) ;
181
+ }
182
+
183
+ /// <summary>
184
+ /// Mark this comment as unread.
185
+ /// </summary>
186
+ public async Task SetAsUnReadAsync ( )
187
+ {
188
+ await SetReadStatusAsync ( SetAsUnReadUrl ) ;
189
+ }
190
+
191
+ private async Task SetReadStatusAsync ( string statusUrl )
192
+ {
193
+ await WebAgent . Post ( statusUrl , new
180
194
{
181
- text = message ,
182
- thing_id = FullName
195
+ id = FullName ,
196
+ api_type = "json"
183
197
} ) . ConfigureAwait ( false ) ;
184
198
}
185
199
}
0 commit comments