@@ -37,6 +37,8 @@ public enum VoteType
37
37
private const string UnsaveUrl = "/api/unsave" ;
38
38
39
39
private const string DelUrl = "/api/del" ;
40
+ private const string LockUrl = "/api/lock" ;
41
+ private const string UnlockUrl = "/api/unlock" ;
40
42
41
43
/// <summary>
42
44
/// Css flair class of the item author.
@@ -80,6 +82,14 @@ public enum VoteType
80
82
[ JsonProperty ( "saved" ) ]
81
83
public bool Saved { get ; private set ; }
82
84
85
+ /// <summary>
86
+ /// Whether this <see cref="VotableThing"/> is locked. If <see langword="true""/>,
87
+ /// only moderators with posts permissions or admins will be able to
88
+ /// comment.
89
+ /// </summary>
90
+ [ JsonProperty ( "locked" ) ]
91
+ public bool Locked { get ; private set ; }
92
+
83
93
/// <summary>
84
94
/// Shortlink to the item
85
95
/// </summary>
@@ -112,6 +122,27 @@ public enum VoteType
112
122
[ JsonProperty ( "gilded" ) ]
113
123
public int Gilded { get ; private set ; }
114
124
125
+ /// <summary>
126
+ /// Locks this <see cref="VotableThing"/>. If <see langword="true""/>,
127
+ /// Only moderators with posts permissions or admins will be able to
128
+ /// comment.
129
+ /// </summary>
130
+ public async Task LockAsync ( )
131
+ {
132
+ await SimpleActionAsync ( LockUrl ) ;
133
+ Locked = true ;
134
+ }
135
+
136
+ /// <summary>
137
+ /// Unlocks this <see cref="VotableThing"/>. Users who were previously
138
+ /// unable to comment because of it being locked are now able to.
139
+ /// </summary>
140
+ public async Task UnlockAsync ( )
141
+ {
142
+ await SimpleActionAsync ( UnlockUrl ) ;
143
+ Locked = false ;
144
+ }
145
+
115
146
/// <summary>
116
147
/// Gets or sets the vote for the current VotableThing.
117
148
/// </summary>
0 commit comments