Skip to content

Latest commit

 

History

History
316 lines (254 loc) · 4.54 KB

File metadata and controls

316 lines (254 loc) · 4.54 KB

API Usage Examples

Auth

Login

POST /auth

Request:

{
  "provider": "anilist",
  "access_token": "your_anilist_access_token"
}

Response:

{
  "token": "eyJhbGci...",
  "user": {
    "id": "abc-123",
    "username": "john_doe",
    "role": "user",
    "provider": "anilist"
  }
}

Use in all protected endpoints:

Authorization: Bearer eyJhbGci...
Get Profile

GET /me

Auth: Required

Response:

{
  "user": {
    "id": "abc-123",
    "username": "john_doe",
    "role": "user",
    "provider": "anilist",
    "avatar_url": "https://..."
  }
}
Logout

DELETE /auth

Auth: Required

Response:

{ "message": "Logged out successfully" }

Posts (Comments & Replies)

Get Comments for Media

GET /posts?media_id=anime-1&limit=10

Auth: Optional (includes user_vote if authenticated)

Response (includes up to 5 reply previews per comment):

{
  "comments": [
    {
      "id": "c-1",
      "content": "This anime is amazing!",
      "score": 15,
      "user": {
        "username": "john_doe",
        "avatar_url": "https://..."
      },
      "status": "active",
      "replies": [
        {
          "id": "r-1",
          "content": "I agree completely!",
          "score": 3,
          "user": {
            "username": "jane_doe",
            "avatar_url": "https://..."
          },
          "user_vote": 1
        }
      ],
      "has_more_replies": true,
      "replies_count": 8,
      "user_vote": null
    }
  ],
  "comment_count": 42,
  "next_cursor": "2026-02-12T10:00:00Z"
}
Get Replies (Thread)

GET /posts?root_id=c-1&limit=20

Auth: Optional

Response:

{
  "replies": [
    {
      "id": "r-1",
      "content": "I agree completely!",
      "score": 3,
      "user": {
        "username": "jane_doe",
        "avatar_url": "https://..."
      },
      "created_at": "2026-02-12T10:35:00Z",
      "user_vote": -1
    }
  ],
  "reply_count": 15,
  "next_cursor": "2026-02-12T10:35:00Z"
}
Create Comment

POST /posts

Auth: Required

Request:

{
  "media_id": "anime-1",
  "content": "Best anime ever!",
  "media_provider": "anilist",
  "client": "my-app" // optional
}

Response:

{
  "post": {
    "id": "c-2",
    "content": "Best anime ever!",
    "status": "active",
    "created_at": "2026-02-12T10:30:00Z",
    "media_id": "anime-1",
    "media_provider": "anilist",
    "root_id": "c-2"
  }
}
Create Reply

POST /posts

Auth: Required

Request:

{
  "parent_id": "c-1", // or reply id
  "content": "I totally agree!",
  "client": "my-app" // optional
}

Response:

{
  "post": {
    "id": "r-3",
    "content": "I totally agree!",
    "parent_id": "c-1",
    "root_id": "c-1"
  }
}
Update Post

PATCH /posts

Auth: Required

Request:

{
  "id": "c-1",
  "content": "Updated text"
}

Response:

{
  "post": {
    "id": "c-1",
    "content": "Updated text",
    "updated_at": "2026-02-12T11:30:00Z"
  }
}
Delete Post

DELETE /posts

Auth: Required

Request (Body or Query Param): DELETE /posts?id=c-1

Response:

{
  "post": {
    "id": "c-1",
    "status": "deleted"
  }
}

Votes

Vote on Post

POST /votes

Auth: Required

Request:

{
  "post_id": "c-1",
  "vote_type": 1
}

vote_type: 1 (upvote) or -1 (downvote). Send same vote to toggle off (remove).

Response:

{
  "post_id": "c-1",
  "score": 16
}

Reports

Report Post

POST /reports

Auth: Required

Request:

{
  "post_id": "c-1",
  "reason": "Spam content"
}

Response:

{
  "message": "Report submitted"
}