Skip to content

Commit

Permalink
chore: bump version 9.18.0
Browse files Browse the repository at this point in the history
Signed-off-by: Dylan <[email protected]>
  • Loading branch information
nmgwddj committed Sep 5, 2024
1 parent c25dea8 commit a6569f0
Show file tree
Hide file tree
Showing 64 changed files with 14,464 additions and 13,259 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.DS_Store

# Node-gyp
build

Expand Down
102 changes: 58 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ For comprehensive documentation, changelog, and technical support, please visit
## System Requirements

| System | Requirements |
| ------- | ------------- |
| ------- |---------------|
| Windows | >= Windows 7 |
| macOS | >= 10.14.0 |
| macOS | >= 10.13.0 |
| Linux | glibc >= 2.23 |

## Supported Platforms
Expand Down Expand Up @@ -111,59 +111,73 @@ Build Requirements:
Now you are all set to build, run following commands in the root directory of the project:

```cmake
cmake -S . -B build
cmake -Bbuild
cmake --build build --config Release
```

And voilà, you now have your own node-nim binary file in the `build` directory.
Now, you have your own node-nim binary file in the `build` directory.

## Quick Start

```ts
import * as node_nim from 'node-nim'
```

### Initialize SDK
First, you need to import the `node-nim` module:

```ts
const result = node_nim.nim.client.init('appkey', '', '', {
database_encrypt_key_: 'abcdefghijklmnopqrstuvwxyz012345'
})
if (result) {
node_nim.nim.initEventHandlers() // init event handlers
node_nim.nim.talk.on('receiveMsg', (result) => {
console.log('receiveMsg', result)
})
node_nim.nim.talk.on('sendMsg', (message: node_nim.IMMessage) => {
console.log('sendMsg: ', message)
})
// add more event handlers here
// ...
}
return result
// ES6 Module
import * as NIM from 'node-nim'
// CommonJS
const NIM = require('node-nim')
```

### Login
After importing the module, you can directly use the three types of objects we have instantiated for you, such as IM, chatroom, and qchat. Here is an example:

```ts
let [loginResult] = await node_nim.nim.client.login('appkey', 'account', 'password', null, '')
if (loginResult.res_code_ == node_nim.NIMResCode.kNIMResSuccess) {
console.log('login succeeded')
} else {
console.log('login failed')
}
```
```javascript
// IM related functions
NIM.nim.client.init('', '', '', {})
NIM.nim.client.cleanup('')

### Send Message
// Chatroom related functions
NIM.chatroom.init('', '')
NIM.chatroom.cleanup()

```ts
node_nim.nim.talk.sendMsg(
{
session_type_: node_nim.NIMSessionType.kNIMSessionTypeP2P,
receiver_accid_: 'receiver',
type_: node_nim.NIMMessageType.kNIMMessageTypeText,
content_: 'Send from NIM node quick start.'
},
''
)
// QChat related functions
NIM.qchat.instance.init({ appkey: 'your appkey', app_data_path: 'qchat' })
NIM.qchat.instance.cleanup({})
```

The objects that can be directly accessed through `NIM.nim` are:

| Object Name | Description |
|--------------------|---------------------------------------------------------------------|
| `client` | Client module |
| `dataSync` | Data sync module |
| `friend` | Friend module |
| `global` | Global module |
| `msglog` | Message log module |
| `nos` | Object storage module |
| `onlineSession` | Online session module |
| `passThroughProxy` | Pass-through proxy module |
| `session` | Local session module |
| `subscribeEvent` | Event subscription module |
| `superTeam` | Super team module |
| `sysMsg` | System message module |
| `talk` | Talk module |
| `team` | Team module |
| `tool` | Tool module |
| `user` | User module |
| `plugin` | Plugin module |
| `talkEx` | Message extension module, PIN messages, quick comments, collections |

The object that can be directly accessed through `NIM.chatroom` corresponds to `ChatRoomModule`, and you can directly access the member functions under this object.

The objects that can be directly accessed through `NIM.qchat` are:

| Object Name | Description |
|----------------------|----------------------------------|
| `instance` | QChat instance module |
| `server` | QChat server module |
| `channel` | QChat channel module |
| `channelCategory` | QChat channel category module |
| `message` | QChat message module |
| `systemNotification` | QChat system notification module |
| `attachment` | QChat attachment module |
| `role` | QChat role module |
95 changes: 55 additions & 40 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ npm install node-nim --save-dev --arch=arm64 --platform=linux

```cmake
cmake -S . -B build
cmake -Bbuild
cmake --build build --config Release
Expand All @@ -123,51 +123,66 @@ cmake --build build --config Release

## 快速开始

首先您需要导入 `node-nim` 模块:

```ts
import * as node_nim from 'node-nim'
// ES6 Module
import * as NIM from 'node-nim'
// CommonJS
const NIM = require('node-nim')
```

### 初始化 SDK
导入模块后,您可以直接使用我们已经帮您实例化好的三类对象,如即时通讯、聊天室、圈组,示例代码如下:

```ts
const result = node_nim.nim.client.init('appkey', '', '', {
database_encrypt_key_: 'abcdefghijklmnopqrstuvwxyz012345'
})
if (result) {
node_nim.nim.initEventHandlers() // init event handlers
node_nim.nim.talk.on('receiveMsg', (result) => {
console.log('receiveMsg', result)
})
node_nim.nim.talk.on('sendMsg', (message: node_nim.IMMessage) => {
console.log('sendMsg: ', message)
})
// add more event handlers here
// ...
}
return result
```
```javascript
// IM 相关功能
NIM.nim.client.init('', '', '', {})
NIM.nim.client.cleanup('')

### 登陆
// 聊天室相关功能
NIM.chatroom.init('', '')
NIM.chatroom.cleanup()

```ts
let [loginResult] = await node_nim.nim.client.login('appkey', 'account', 'password', null, '')
if (loginResult.res_code_ == node_nim.NIMResCode.kNIMResSuccess) {
console.log('login succeeded')
} else {
console.log('login failed')
}
// 圈组相关功能
NIM.qchat.instance.init({ appkey: 'your appkey', app_data_path: 'qchat' })
NIM.qchat.instance.cleanup({})
```

### 发送消息
其中 `NIM.nim` 可直接访问的对象有:

| 对象名 | 说明 |
|------------------|-----------------------|
| client | 客户端模块 |
| dataSync | 数据同步模块 |
| friend | 好友模块 |
| global | 全局模块 |
| msglog | 消息记录模块 |
| nos | NOS 模块 |
| onlineSession | 在线会话模块 |
| passThroughProxy | 透传代理模块 |
| session | 会话模块 |
| subscribeEvent | 事件订阅模块 |
| superTeam | 超级群模块 |
| sysMsg | 系统消息模块 |
| talk | 会话模块 |
| team | 群组模块 |
| tool | 工具模块 |
| user | 用户模块 |
| plugin | 插件模块 |
| talkEx | 消息扩展模块,PIN 消息、快捷评论、收藏 |

可通过 `NIM.chatroom` 直接访问的对象对应 `ChatRoomModule`,您可以直接访问该对象下的成员函数。

可通过 `NIM.qchat` 直接访问的对象有:

| 对象名 | 说明 |
|--------------------|----------|
| instance | 圈组实例模块 |
| server | 圈组服务器模块 |
| channel | 圈组频道模块 |
| channelCategory | 圈组频道分类模块 |
| message | 圈组消息模块 |
| systemNotification | 圈组系统通知模块 |
| attachment | 圈组附件模块 |
| role | 圈组身份组模块 |

```ts
node_nim.nim.talk.sendMsg(
{
session_type_: node_nim.NIMSessionType.kNIMSessionTypeP2P,
receiver_accid_: 'receiver',
type_: node_nim.NIMMessageType.kNIMMessageTypeText,
content_: 'Send from NIM node quick start.'
},
''
)
```
Empty file modified node-nim-tester.js
100644 → 100755
Empty file.
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-nim",
"version": "9.16.11",
"version": "9.18.0",
"description": "NetEase IM nodejs wrapper based on NetEase IM C++ SDK",
"main": "dist/node-nim.js",
"bin": {
Expand All @@ -17,8 +17,9 @@
"scripts": {
"coverage": "nyc mocha test/test_all.js -slow 200 -timeout 10000",
"build_ts": "rimraf ./dist && rimraf ./types && tsc",
"build_wiki_doc": "typedoc --plugin typedoc-plugin-markdown --plugin typedoc-github-wiki-theme --theme github-wiki --out wiki_doc",
"build_markdown_doc": "typedoc --plugin typedoc-plugin-markdown --theme markdown --out markdown_doc",
"build_html_doc": "typedoc --plugin typedoc-github-theme",
"build_wiki_doc": "typedoc --plugin typedoc-plugin-markdown --plugin typedoc-github-wiki-theme --out wiki_doc",
"build_markdown_doc": "typedoc --plugin typedoc-plugin-markdown --out markdown_doc",
"prepublishOnly": "npm run build_ts",
"install": "npm run download_sdk",
"download_sdk": "node -e \"require('./script/download-sdk.js').downloadSDK()\"",
Expand Down Expand Up @@ -54,9 +55,11 @@
"mocha": "^9.2.2",
"node-addon-api": "^4.3.0",
"nyc": "^15.1.0",
"typedoc": "^0.24.1",
"typedoc-github-wiki-theme": "^1.1.0",
"typedoc-plugin-markdown": "^3.15.1",
"typedoc": "^0.26.6",
"typedoc-github-theme": "^0.1.2",
"typedoc-github-wiki-theme": "^2.0.0",
"typedoc-material-theme": "^1.1.0",
"typedoc-plugin-markdown": "^4.2.6",
"typescript": "^4.9.5"
},
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions src/reflection/qchat_role_reflection.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ReflectionDefinition_O(QChatUpdateMemberRoleParam, cb, server_id, channel_id, ac
ReflectionDefinition_O(QChatRemoveMemberRoleParam, cb, server_id, channel_id, accid);
ReflectionDefinition_O(QChatGetMemberRolesParam, cb, server_id, channel_id, timestamp, limit);
ReflectionDefinition_O(QChatGetRolesByAccidParam, cb, server_id, accid, timestamp, limit);
ReflectionDefinition_O(QChatGetExistingServerRolesByAccidsParam, cb, server_id, accids);
ReflectionDefinition_O(QChatGetExistingServerRolesByAccidsParam, cb, server_id, accids, sort_type, search_order);
ReflectionDefinition_O(QChatGetExistingChannelRolesByServerRoleIdsParam, cb, server_id, channel_id, role_ids);
ReflectionDefinition_O(QChatGetExistingAccidsOfMemberRolesParam, cb, server_id, channel_id, accids);
ReflectionDefinition_O(QChatGetExistingAccidsInServerRoleParam, cb, server_id, role_id, accids);
Expand All @@ -58,4 +58,4 @@ ReflectionDefinition_O(QChatUpdateChannelCategoryMemberRoleParam, cb, server_id,
ReflectionDefinition_O(QChatRemoveChannelCategoryMemberRoleParam, cb, server_id, category_id, accid);
ReflectionDefinition_O(QChatGetChannelCategoryMemberRolesPageParam, cb, server_id, category_id, timestamp, limit);

#endif // __QCHAT_ROLE_HELPER_H__
#endif // __QCHAT_ROLE_HELPER_H__
Loading

0 comments on commit a6569f0

Please sign in to comment.