'Remove a link, comment, or modmail message.
If the thing is a link, it will be removed from all subreddit listings.
If the thing is a comment, it will be redacted and removed from all
subreddit comment listings.
See also: [/api/approve](#POST_api_approve).'

@require_oauth2_scope('modposts')
@noresponse(VUser(), VModhash(), VSrCanBan('id'), thing=VByName('id'), spam=VBoolean('spam', default=True))
@api_doc(api_section.moderation)
def POST_remove(self, thing, spam):

    if getattr(thing, 'promoted', None):
        return
    action_name = 'remove'
    if spam:
        action_name = 'spam'
    VNotInTimeout().run(action_name=action_name, target=thing)
    if thing._deleted:
        return
    filtered = thing._spam
    kw = {'target': thing}
    if (filtered and spam):
        kw['details'] = 'confirm_spam'
        train_spam = False
    elif (filtered and (not spam)):
        kw['details'] = 'remove'
        admintools.unspam(thing, unbanner=c.user.name, insert=False)
        train_spam = False
    elif ((not filtered) and spam):
        kw['details'] = 'spam'
        train_spam = True
    elif ((not filtered) and (not spam)):
        kw['details'] = 'remove'
        train_spam = False
    admintools.spam(thing, auto=False, moderator_banned=(not c.user_is_admin), banner=c.user.name, train_spam=train_spam)
    if isinstance(thing, (Link, Comment)):
        sr = thing.subreddit_slow
        action = ('remove' + thing.__class__.__name__.lower())
        ModAction.create(sr, c.user, action, **kw)
    if isinstance(thing, Link):
        sr.remove_sticky(thing)
    elif isinstance(thing, Comment):
        thing.link_slow.remove_sticky_comment(comment=thing, set_by=c.user)
        queries.unnotify(thing)
