Skip to content

Commit b539b8e

Browse files
committed
[feat] fill blank documents
1 parent caf0570 commit b539b8e

6 files changed

Lines changed: 1025 additions & 6 deletions

File tree

Lines changed: 192 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,192 @@
1-
# 刪除訊息
1+
# 刪除訊息
2+
3+
## 概述
4+
5+
管理員權限專用的訊息刪除功能,允許平台管理員、聊天室擁有者和聊天室管理員刪除指定的訊息或清空整個聊天室的所有訊息。此功能適用於內容管理、違規內容清理和聊天室維護。
6+
7+
------
8+
9+
## API 端點
10+
11+
### 刪除聊天室訊息
12+
13+
刪除聊天室中的特定訊息或所有訊息,僅限具備管理權限的用戶使用。
14+
15+
```http
16+
DELETE /rooms/{roomID}/messages/{messageID}
17+
```
18+
19+
#### Headers
20+
21+
| 參數 | 類型 | 必填 | 說明 |
22+
| ------------------ | ------ | ---- | -------------- |
23+
| `IM-CLIENT-KEY` | string || Client Key |
24+
| `IM-Authorization` | string || Client Token |
25+
26+
#### Path Parameters
27+
28+
| 參數 | 類型 | 必填 | 說明 |
29+
| ----------- | ------ | ---- | --------------------------------------------------- |
30+
| `roomID` | string || 聊天室 ID |
31+
| `messageID` | string || 要刪除的訊息 ID,或使用 `_all` 刪除聊天室內所有訊息 |
32+
33+
#### 範例請求
34+
35+
**刪除特定訊息**
36+
37+
```http
38+
DELETE /rooms/test-room-123/messages/5f890cf37d980e06f6aaf349 HTTP/1.1
39+
IM-CLIENT-KEY: {CLIENT_KEY}
40+
IM-Authorization: {ACCESS_TOKEN}
41+
Content-Type: application/json; charset=utf-8
42+
Connection: close
43+
```
44+
45+
**刪除聊天室所有訊息**
46+
47+
```http
48+
DELETE /rooms/test-room-123/messages/_all HTTP/1.1
49+
IM-CLIENT-KEY: {CLIENT_KEY}
50+
IM-Authorization: {ACCESS_TOKEN}
51+
Content-Type: application/json; charset=utf-8
52+
Connection: close
53+
```
54+
55+
#### Response
56+
57+
**成功回應(200 OK)**
58+
59+
| 參數 | 類型 | 說明 |
60+
| -------- | ------ | ---------------------- |
61+
| `RC` | number | 回應代碼(0 表示成功) |
62+
| `RM` | string | 回應訊息 |
63+
| `result` | object | 刪除操作結果 |
64+
65+
**刪除結果物件結構**
66+
67+
| 參數 | 類型 | 說明 |
68+
| -------------- | ------ | ----------------------------- |
69+
| `deletedCount` | number | 已刪除的訊息數量 |
70+
| `roomID` | string | 聊天室 ID |
71+
| `messageID` | string | 被刪除的訊息 ID(或 "_all") |
72+
| `deletedBy` | string | 執行刪除操作的用戶 ID |
73+
| `deletedAt` | string | 刪除時間 |
74+
75+
#### 範例回應
76+
77+
**刪除單一訊息**
78+
79+
```json
80+
{
81+
"RC": 0,
82+
"RM": "Message deleted successfully",
83+
"result": {
84+
"deletedCount": 1,
85+
"roomID": "test-room-123",
86+
"messageID": "5f890cf37d980e06f6aaf349",
87+
"deletedBy": "admin-user-id",
88+
"deletedAt": "2023-10-15T10:30:45.123Z"
89+
}
90+
}
91+
```
92+
93+
**刪除所有訊息**
94+
95+
```json
96+
{
97+
"RC": 0,
98+
"RM": "All messages deleted successfully",
99+
"result": {
100+
"deletedCount": 145,
101+
"roomID": "test-room-123",
102+
"messageID": "_all",
103+
"deletedBy": "admin-user-id",
104+
"deletedAt": "2023-10-15T10:30:45.123Z"
105+
}
106+
}
107+
```
108+
109+
#### 錯誤回應
110+
111+
**401 Unauthorized** - 認證失敗
112+
113+
```json
114+
{
115+
"RC": 401,
116+
"RM": "Unauthorized",
117+
"error": {
118+
"code": "INVALID_TOKEN",
119+
"message": "Invalid or expired token"
120+
}
121+
}
122+
```
123+
124+
**403 Forbidden** - 權限不足
125+
126+
```json
127+
{
128+
"RC": 403,
129+
"RM": "Permission denied",
130+
"error": {
131+
"code": "INSUFFICIENT_PERMISSION",
132+
"message": "Only platform admin, room owner or room manager can delete messages"
133+
}
134+
}
135+
```
136+
137+
**404 Not Found** - 訊息或聊天室不存在
138+
139+
```json
140+
{
141+
"RC": 404,
142+
"RM": "Message not found",
143+
"error": {
144+
"code": "MESSAGE_NOT_FOUND",
145+
"message": "The specified message does not exist in this room"
146+
}
147+
}
148+
```
149+
150+
**404 Not Found** - 聊天室不存在
151+
152+
```json
153+
{
154+
"RC": 404,
155+
"RM": "Room not found",
156+
"error": {
157+
"code": "ROOM_NOT_FOUND",
158+
"message": "The specified room does not exist"
159+
}
160+
}
161+
```
162+
163+
------
164+
165+
## 使用場景
166+
167+
### 內容管理
168+
- **違規處理**:刪除違反社群規範的不當訊息
169+
- **垃圾訊息**:清理廣告訊息或垃圾內容
170+
- **敏感內容**:移除包含敏感資訊的訊息
171+
172+
### 聊天室維護
173+
- **聊天室重置**:清空聊天室重新開始對話
174+
- **測試清理**:清理測試環境的測試訊息
175+
- **定期維護**:定期清理過舊的訊息內容
176+
177+
### 管理操作
178+
- **緊急處理**:快速處理需要立即移除的內容
179+
- **批量清理**:一次性刪除聊天室內所有訊息
180+
- **權限控制**:確保只有授權用戶能執行刪除操作
181+
182+
------
183+
184+
## 注意事項
185+
186+
- **權限限制**:僅限平台管理員、聊天室擁有者和聊天室管理員使用
187+
- **永久刪除**:訊息刪除後無法復原,請謹慎使用
188+
- **批量刪除**:使用 `_all` 參數會刪除聊天室內所有訊息
189+
- **操作記錄**:所有刪除操作都會記錄執行者和時間
190+
- **即時生效**:刪除操作會立即生效,所有用戶都會看到訊息消失
191+
- **通知機制**:刪除操作可能會觸發相關的通知或事件
192+
- **與撤回區別**:此功能為強制刪除,與用戶自主撤回功能不同

pages/message/message-basic/get-a-message.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)