Skip to content

Commit 53f0e95

Browse files
committed
update docs and index.js
1 parent 3102983 commit 53f0e95

File tree

3 files changed

+165
-5
lines changed

3 files changed

+165
-5
lines changed

document/API.md

Lines changed: 161 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,28 @@ import JMessage from 'jmessage-react-plugin';
4242
- [getConversation](#getconversation)
4343
- [getConversations](#getconversations)
4444
- [resetUnreadMessageCount](#resetunreadmessagecount)
45+
- [聊天室](#聊天室)
46+
- [getChatRoomListByApp](#getchatroomlistbyapp)
47+
- [getChatRoomListByUser](#getchatroomlistbyuser)
48+
- [getChatRoomInfos](#getchatroominfos)
49+
- [getChatRoomOwner](#getchatroomowner)
50+
- [enterChatRoom](#enterchatroom)
51+
- [leaveChatRoom](#leavechatroom)
52+
- [getChatRoomConversationList](#getchatroomconversationlist)
53+
- [好友](#好友)
54+
- [sendInvitationRequest](#sendinvitationrequest)
55+
- [acceptInvitation](#acceptInvitation)
56+
- [declineInvitation](#declineinvitation)
57+
- [getFriends](#getfriends)
58+
- [removeFromFriendList](#removefromfriendlist)
59+
- [updateFriendNoteName](#updatefriendnotename)
60+
- [updateFriendNoteText](#updatefriendnotetext)
4561
- [事件监听]()
4662
- [消息事件](#addreceivemessagelistener)
4763
- [addReceiveMessageListener](#addreceivemessagelistener)
4864
- [removeReceiveMessageListener](#addreceivemessagelistener)
65+
- [*addReceiveChatRoomMsgListener]()
66+
- [*removeReceiveChatRoomMsgListener]()
4967
- [离线消息](#addsyncofflinemessagelistener)
5068
- [addSyncOfflineMessageListener](#addsyncofflinemessagelistener)
5169
- [removeSyncOfflineMessageListener](#addsyncofflinemessagelistener)
@@ -884,7 +902,7 @@ JMessage.getConversations((conArr) => { // conArr: 会话数组。
884902
885903
```js
886904
JMessage.resetUnreadMessageCount({ type: 'single', username: 'username', appKey: 'appKey' },
887-
(conversation) => {
905+
(conversation) => {
888906
// do something.
889907

890908
}, (error) => {
@@ -901,6 +919,148 @@ JMessage.resetUnreadMessageCount({ type: 'single', username: 'username', appKey:
901919
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
902920
903921
922+
## 聊天室
923+
924+
### getChatRoomListByApp
925+
926+
查询当前 AppKey 下的聊天室信息。
927+
928+
#### 示例
929+
930+
```js
931+
JMessage.getChatRoomListByApp({ start: 0, count: 5, reason: '请求添加好友'},
932+
(chatRoomList) => { // chatRoomList 为所有聊天室信息
933+
// do something.
934+
935+
}, (error) => {
936+
var code = error.code
937+
var desc = error.description
938+
})
939+
```
940+
941+
#### 参数说明
942+
943+
- start: 起始位置。
944+
- count: 获得个数。
945+
946+
### getChatRoomListByUser
947+
948+
获取当前用户(登录用户)所加入的所有聊天室信息。
949+
950+
#### 示例
951+
952+
```js
953+
JMessage.getChatRoomListByUser((chatRoomList) => { // chatRoomList 为当前用户加入的所有聊天室列表
954+
// do something.
955+
956+
}, (error) => {
957+
var code = error.code
958+
var desc = error.description
959+
})
960+
```
961+
962+
### getChatRoomInfos
963+
964+
查询指定 roomId 聊天室信息。
965+
966+
#### 示例
967+
968+
```js
969+
JMessage.getChatRoomInfos({ roomIds: ['Example_RoomId_1''Example_RoomId_2']},
970+
(chatRoomList) => { // chatRoomList 为指定的聊天室列表
971+
// do something.
972+
973+
}, (error) => {
974+
var code = error.code
975+
var desc = error.description
976+
})
977+
```
978+
979+
#### 参数说明
980+
981+
- roomIds:需要获取聊天室详情的聊天室 id 列表。
982+
983+
### getChatRoomOwner
984+
985+
查询指定 roomId 聊天室的所有者。
986+
987+
#### 示例
988+
989+
```js
990+
JMessage.getChatRoomOwner({ roomId: 'Example_RoomId_1'},
991+
(userInfo) => { // userInfo 为该聊天室的所有者
992+
// do something.
993+
994+
}, (error) => {
995+
var code = error.code
996+
var desc = error.description
997+
})
998+
```
999+
1000+
#### 参数说明
1001+
1002+
- roomId:需要获取聊天室所有者的聊天室 id。
1003+
1004+
### enterChatRoom
1005+
1006+
进入聊天室,进入后才能收到聊天室信息及发言。
1007+
1008+
#### 示例
1009+
1010+
```js
1011+
JMessage.enterChatRoom({ roomId: 'Example_RoomId_1'},
1012+
(conversation) => { // 进入聊天室,会自动创建并返回该聊天室会话信息。
1013+
// do something.
1014+
1015+
}, (error) => {
1016+
var code = error.code
1017+
var desc = error.description
1018+
})
1019+
```
1020+
1021+
#### 参数说明
1022+
1023+
- roomId:要进入的聊天室的 id。
1024+
1025+
### leaveChatRoom
1026+
1027+
离开指定聊天室。
1028+
1029+
#### 示例
1030+
1031+
```js
1032+
JMessage.leaveChatRoom({ roomId: 'Example_RoomId_1'},
1033+
() => {
1034+
// do something.
1035+
1036+
}, (error) => {
1037+
var code = error.code
1038+
var desc = error.description
1039+
})
1040+
```
1041+
1042+
#### 参数说明
1043+
1044+
- roomId:要离开的聊天室的 id。
1045+
1046+
### getChatRoomConversationList
1047+
1048+
从本地获取用户的聊天室会话列表,没有则返回为空的列表。
1049+
1050+
#### 示例
1051+
1052+
```js
1053+
JMessage.getChatRoomConversationList( (conversationList) => { // conversationList 为聊天室会话信息。
1054+
// do something.
1055+
1056+
}, (error) => {
1057+
var code = error.code
1058+
var desc = error.description
1059+
})
1060+
```
1061+
1062+
1063+
9041064
## 好友
9051065
9061066
JMessage 好友模块仅实现对用户好友关系的托管,以及相关好友请求的发送与接收。

document/Models.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ appKey: string, // 聊天室所属 AppKey
5858
owner: UserInfo, // 聊天室拥有者
5959
maxMemberCount: number, // 聊天室最大成员数量
6060
description: string, // 聊天室描述
61-
totalMemberCount: number, // 聊天室当前成员数量
61+
memberCount: number, // 聊天室当前成员数量
6262
createTime: number // 聊天室创建时间,单位 秒
6363
```
6464

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ export default class JMessage {
10161016
* "roomName": String,
10171017
* "appKey": String,
10181018
* "maxMemberCount": number,
1019-
* "totalMemberCount": number,
1019+
* "memberCount": number,
10201020
* "owner": UserInfo,
10211021
* "description": String,
10221022
* "createTime": number,
@@ -1063,7 +1063,7 @@ export default class JMessage {
10631063
* @param {function} success = function({conversation})
10641064
* @param {function} error = function ({'code': '错误码', 'description': '错误信息'}) {}
10651065
*/
1066-
static enterChatRoom(roomId, success, error) {
1066+
static enterChatRoom(param, success, error) {
10671067
JMessageModule.enterChatRoom(roomId, success, error);
10681068
}
10691069

@@ -1073,7 +1073,7 @@ export default class JMessage {
10731073
* @param {function} success = function(0)
10741074
* @param {function} error = function ({'code': '错误码', 'description': '错误信息'}) {}
10751075
*/
1076-
static leaveChatRoom(roomId, success, error) {
1076+
static leaveChatRoom(param, success, error) {
10771077
JMessageModule.leaveChatRoom(roomId, success, error);
10781078
}
10791079

0 commit comments

Comments
 (0)