From a68cff51b1f1e07c943c363239402d09f3cde997 Mon Sep 17 00:00:00 2001 From: eiknat Date: Wed, 11 Nov 2020 15:41:40 -0500 Subject: [PATCH] add doc --- docs/src/contributing_websocket_http_api.md | 215 +++++++++++++++++++- 1 file changed, 214 insertions(+), 1 deletion(-) diff --git a/docs/src/contributing_websocket_http_api.md b/docs/src/contributing_websocket_http_api.md index 8a6df622d..a3b678eb9 100644 --- a/docs/src/contributing_websocket_http_api.md +++ b/docs/src/contributing_websocket_http_api.md @@ -306,11 +306,12 @@ Connect to ws://***host***/api/v1/ws to get started. If the ***`host`*** supports secure connections, you can use wss://***host***/api/v1/ws. -To receive websocket messages, you must join a room / context. The three available are: +To receive websocket messages, you must join a room / context. The four available are: - [UserJoin](#user-join). Receives replies, private messages, etc. - [PostJoin](#post-join). Receives new comments on a post. - [CommunityJoin](#community-join). Receives front page / community posts. +- [ModJoin](#mod-join). Receives community moderator updates like reports. #### Testing with Websocat @@ -913,6 +914,35 @@ Marks all user replies and mentions as read. `POST /user/join` +#### Get Report Count + +If a community is supplied, returns the report count for only that community, otherwise returns the report count for all communities the user moderates. + +##### Request +```rust +{ + op: "GetReportCount", + data: { + community: Option, + auth: String + } +} +``` +##### Response +```rust +{ + op: "GetReportCount", + data: { + community: Option, + comment_reports: i64, + post_reports: i64, + } +} +``` +##### HTTP + +`GET /user/report_count` + ### Site #### List Categories ##### Request @@ -1489,6 +1519,29 @@ The main / frontpage community is `community_id: 0`. `POST /community/join` +#### Mod Join +##### Request +```rust +{ + op: "ModJoin", + data: { + community_id: i32 + } +} +``` +##### Response +```rust +{ + op: "ModJoin", + data: { + joined: bool, + } +} +``` +##### HTTP + +`POST /community/mod/join` + ### Post #### Create Post ##### Request @@ -1796,6 +1849,86 @@ Only admins and mods can sticky a post. `POST /post/join` +#### Create Post Report +##### Request +```rust +{ + op: "CreatePostReport", + data: { + post_id: i32, + reason: String, + auth: String + } +} +``` +##### Response +```rust +{ + op: "CreatePostReport", + data: { + success: bool + } +} +``` +##### HTTP + +`POST /post/report` + +#### Resolve Post Report +##### Request +```rust +{ + op: "ResolvePostReport", + data: { + report_id: i32, + resolved: bool, + auth: String + } +} +``` +##### Response +```rust +{ + op: "ResolvePostReport", + data: { + report_id: i32, + resolved: bool + } +} +``` +##### HTTP + +`PUT /post/report/resolve` + +#### List Post Reports + +If a community is supplied, returns reports for only that community, otherwise returns the reports for all communities the user moderates + +##### Request +```rust +{ + op: "ListPostReports", + data: { + page: Option, + limit: Option, + community: Option, + auth: String + } +} +``` +##### Response +```rust +{ + op: "ListPostReports", + data: { + posts: Vec + } +} +``` +##### HTTP + +`GET /post/report/list` + ### Comment #### Create Comment ##### Request @@ -2025,6 +2158,86 @@ Only the recipient can do this. `POST /comment/like` +#### Create Comment Report +##### Request +```rust +{ + op: "CreateCommentReport", + data: { + comment_id: i32, + reason: String, + auth: String, + } +} +``` +##### Response +```rust +{ + op: "CreateCommentReport", + data: { + success: bool, + } +} +``` +##### HTTP + +`POST /comment/report` + +#### Resolve Comment Report +##### Request +```rust +{ + op: "ResolveCommentReport", + data: { + report_id: i32, + resolved: bool, + auth: String, + } +} +``` +##### Response +```rust +{ + op: "ResolveCommentReport", + data: { + report_id: i32, + resolved: bool, + } +} +``` +##### HTTP + +`PUT /comment/report/resolve` + +#### List Comment Reports + +If a community is supplied, returns reports for only that community, otherwise returns the reports for all communities the user moderates + +##### Request +```rust +{ + op: "ListCommentReports", + data: { + page: Option, + limit: Option, + community: Option, + auth: String, + } +} +``` +##### Response +```rust +{ + op: "ListCommentReports", + data: { + comments: Vec + } +} +``` +##### HTTP + +`GET /comment/report/list` + ### RSS / Atom feeds #### All