@@ -245,6 +245,31 @@ def create_reply(self, post, content, anonymous=False):
245245 }
246246 return self ._rpc .content_create (params )
247247
248+ def update_post (self , post , content ):
249+ """Update post content by cid
250+
251+ :type post: dict|str|int
252+ :param post: Either the post dict returned by another API method, or
253+ the `cid` field of that post.
254+ :type subject: str
255+ :param content: The content of the followup.
256+ :rtype: dict
257+ :returns: Dictionary with information about the updated post.
258+ """
259+ try :
260+ cid = post ["id" ]
261+ except KeyError :
262+ cid = post
263+ except TypeError :
264+ cid = post
265+
266+ params = {
267+ "cid" : cid ,
268+ # For updates, the content is put into the subject.
269+ "subject" : content ,
270+ }
271+ return self ._rpc .content_update (params )
272+
248273 def mark_as_duplicate (self , duplicated_cid , master_cid , msg = '' ):
249274 """Mark the post at ``duplicated_cid`` as a duplicate of ``master_cid``
250275
@@ -306,6 +331,30 @@ def pin_post(self, post):
306331
307332 return self ._rpc .content_pin (params )
308333
334+ def delete_post (self , post ):
335+ """ Deletes post by cid
336+
337+ :type post: dict|str|int
338+ :param post: Either the post dict returned by another API method, the post ID, or
339+ the `cid` field of that post.
340+ :rtype: dict
341+ :returns: Dictionary with information about the post cid.
342+ """
343+
344+ try :
345+ cid = post ['id' ]
346+ except KeyError :
347+ cid = post
348+ except TypeError :
349+ post = self .get_post (post )
350+ cid = post ['id' ]
351+
352+ params = {
353+ "cid" : cid ,
354+ }
355+
356+ return self ._rpc .content_delete (params )
357+
309358 #########
310359 # Users #
311360 #########
@@ -375,30 +424,6 @@ def remove_users(self, user_ids):
375424 """
376425 return self ._rpc .remove_users (user_ids = user_ids )
377426
378- def delete_post (self , post ):
379- """ Deletes post by cid
380-
381- :type post: dict|str|int
382- :param post: Either the post dict returned by another API method, the post ID, or
383- the `cid` field of that post.
384- :rtype: dict
385- :returns: Dictionary with information about the post cid.
386- """
387-
388- try :
389- cid = post ['id' ]
390- except KeyError :
391- cid = post
392- except TypeError :
393- post = self .get_post (post )
394- cid = post ['id' ]
395-
396- params = {
397- "cid" : cid ,
398- }
399-
400- return self ._rpc .content_delete (params )
401-
402427 ########
403428 # Feed #
404429 ########
0 commit comments