Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 982 Bytes

API.md

File metadata and controls

25 lines (19 loc) · 982 Bytes

Overview

Use postile.ajax(api_dir, data, callback) to interact with backend api.

  • api_dir = ['post', 'get_post'] to get comments of a post.

    • data = {post_id: XXX}
    • The argument to callback will always be in the format of: { status: 'ok' | 'error', message: (the actual message) }
    • callback is called with message = PostWE, which will be explained below.
  • api_dir = ['board', 'get_recent_post'] to get some posts in a board.

    • data = {board_id: XXX, number: XXX}
      • set number = 0 to get all posts for a board.
    • callback is called with message = [PostWE].
    • For anonymous board, inline_comment.creator_id will be null instead.

Data types

  • PostWE: (WE stands for with extra.) Generally speaking, it's something like { post: XXX, likes: XXX, inline_comments: XXX }. Note that this file is generated from move_post, so it contains an extra level of indirection (posts).