コード例 #1
0
async def get_discussions_by_blog(tag: str, start_author: str = '',
                                  start_permlink: str = '', limit: int = 20,
                                  truncate_body: int = 0):
    """Retrieve account's blog posts."""
    ids = cursor.pids_by_blog(
        valid_account(tag),
        valid_account(start_author, allow_empty=True),
        valid_permlink(start_permlink, allow_empty=True),
        valid_limit(limit, 20))
    return load_posts(ids, truncate_body=truncate_body)
コード例 #2
0
async def _get_account_discussion_by_key(account, key):
    assert account, 'account must be specified'
    assert key, 'discussion key must be specified'

    if key == 'recent_replies':
        posts = load_posts(cursor.pids_by_replies_to_account(account, '', 20))
    elif key == 'comments':
        posts = load_posts(cursor.pids_by_account_comments(account, '', 20))
    elif key == 'blog':
        posts = load_posts(cursor.pids_by_blog(account, '', '', 20))
    elif key == 'feed':
        res = cursor.pids_by_feed_with_reblog(account, '', '', 20)
        posts = load_posts_reblogs(res)
    else:
        raise ApiError("unknown account discussion key %s" % key)

    return posts